text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'lewuathe'
import numpy as np
import hashlib
import common
def __calc_with_hash(vec, m, target):
for v in vec:
m.update(v)
if target == 'hex':
return m.hexdigest()
else:
return common.hex2dec(m.hexdigest())
def md5_for_vec(vec, target = 'dec'):
"""
Calculate h... | {
"repo_name": "PhysicsEngine/kHLL",
"path": "kHLL/hash/image.py",
"copies": "1",
"size": "1542",
"license": "mit",
"hash": -1933602909675902500,
"line_mean": 22.0149253731,
"line_max": 52,
"alpha_frac": 0.6031128405,
"autogenerated": false,
"ratio": 3.3090128755364807,
"config_test": false,
"... |
__author__ = 'lex'
#import sys, os.path
import argparse
import time
import struct
from serial import Serial, EIGHTBITS, PARITY_EVEN
def ser_read(sz = 1, timeout = 0.1):
st = time.clock()
while ser.inWaiting() < sz:
if (time.clock() - st) > timeout:
break;
z = ser.inWaiting();
if z... | {
"repo_name": "Dominga/STM32SerialProg",
"path": "stm32prog.py",
"copies": "1",
"size": "2722",
"license": "mit",
"hash": 8636338710271880000,
"line_mean": 22.8771929825,
"line_max": 145,
"alpha_frac": 0.5727406319,
"autogenerated": false,
"ratio": 2.981380065717415,
"config_test": false,
"ha... |
__author__ = 'lgeorge'
from resources.sound_file import SendSoundFile
import time
import os
import json
class ClassifySoundApi(SendSoundFile):
def __init__(self, sound_classification_obj=None, api=None, **kwargs):
super(ClassifySoundApi, self).__init__(**kwargs)
self.sound_classification_obj = ap... | {
"repo_name": "laurent-george/protolab_sound_recognition",
"path": "flask_restful_app/resources/classify_sounds.py",
"copies": "1",
"size": "1949",
"license": "mit",
"hash": -6465937160896407000,
"line_mean": 41.3695652174,
"line_max": 130,
"alpha_frac": 0.6080041047,
"autogenerated": false,
"rat... |
__author__ = 'lgeorge'
import glob
import os
import traceback
import pandas as pd
from sound_processing.features_extraction import extract_mfcc_features_one_channel, _flatten_features_dict
from sound_processing.sig_proc import downsample_signal
from sound_processing.io_sound import load_sound
def _generate_humavips_... | {
"repo_name": "laurent-george/protolab_sound_recognition",
"path": "sound_classification/generate_database_humavips.py",
"copies": "1",
"size": "2915",
"license": "mit",
"hash": -9073260926266492000,
"line_mean": 33.2941176471,
"line_max": 126,
"alpha_frac": 0.6240137221,
"autogenerated": false,
... |
__author__ = 'lgeorge'
import numpy as np
def compute_precision_cumulative_curve(df, true_positive_class=None, step=0.01):
"""
Compute `cumulative precision` based on predicted/expected of a specific class
:param df: a dataframe with columns class_expected, class_predicted, confidence
:param true_pos... | {
"repo_name": "laurent-george/protolab_sound_recognition",
"path": "sound_classification/confidence_scaling_based_on_confusion.py",
"copies": "1",
"size": "2389",
"license": "mit",
"hash": -2926375244135272000,
"line_mean": 42.4363636364,
"line_max": 123,
"alpha_frac": 0.7166178317,
"autogenerated"... |
__author__ = 'lgeorge'
#import seaborn as sns
import pylab
import classification_service
import numpy as np
import sound_classification.confusion_matrix
from sklearn.metrics import confusion_matrix
def plot_distribution_true_false(prediction_df):
"""
:param prediction_df:
:return:
"""
mask_well_c... | {
"repo_name": "laurent-george/protolab_sound_recognition",
"path": "sound_classification/evaluate_classification.py",
"copies": "1",
"size": "5875",
"license": "mit",
"hash": -5033064654732151000,
"line_mean": 44.8984375,
"line_max": 207,
"alpha_frac": 0.6663829787,
"autogenerated": false,
"ratio... |
__author__ = 'lgeorge'
"""
little script to offline generate features database from wav file
"""
import glob
import os
import traceback
import pandas as pd
from sound_processing.features_extraction import extract_mfcc_features_one_channel, _flatten_features_dict
from sound_processing.sig_proc import downsample_signal... | {
"repo_name": "laurent-george/protolab_sound_recognition",
"path": "sound_classification/generate_feature_database.py",
"copies": "1",
"size": "2699",
"license": "mit",
"hash": -5751769369057855000,
"line_mean": 29.3258426966,
"line_max": 122,
"alpha_frac": 0.5753982957,
"autogenerated": false,
"... |
__author__ = 'lgeorge'
import numpy as np
import scipy.stats
from features import mfcc, logfbank, fbank # to compute mel frequency we use this package -> https://github.com/jameslyons/python_speech_features
from sklearn import preprocessing
import sklearn.feature_extraction
from collections import namedtuple
fro... | {
"repo_name": "laurent-george/protolab_sound_recognition",
"path": "sound_processing/features_extraction.py",
"copies": "1",
"size": "5579",
"license": "mit",
"hash": 7373982474141451000,
"line_mean": 42.5859375,
"line_max": 242,
"alpha_frac": 0.6825595985,
"autogenerated": false,
"ratio": 3.4695... |
__author__ = 'liam'
# -*- coding: utf-8 -*-
import pandas as pd
from kaggle import KaggleCompetition
from bs4 import BeautifulSoup
import re
from nltk.corpus import stopwords
import nltk
from gensim.models import Word2Vec
import logging
def review_to_sentences( review, tokenizer, remove_stopwords=False ):
# Func... | {
"repo_name": "ldamewood/kaggle",
"path": "word2vec/word2vec.py",
"copies": "1",
"size": "3332",
"license": "mit",
"hash": 478368762461770700,
"line_mean": 36.0333333333,
"line_max": 119,
"alpha_frac": 0.6608643457,
"autogenerated": false,
"ratio": 3.7312430011198208,
"config_test": false,
"h... |
__author__ = 'Liam'
"""Drawing testing. Mores specifically I used this as a scratch pad of
sorts to validate ideas before implementing into project1.py
"""
# convert_gui.pyw
# Program to convert Celsius to Fahrenheit using a simple
# graphical interface.
from random import randint
from math import *
from time import s... | {
"repo_name": "iJebus/CITS4406-Assignment1",
"path": "draw.py",
"copies": "1",
"size": "1796",
"license": "mit",
"hash": 4481195910735414300,
"line_mean": 25.8059701493,
"line_max": 79,
"alpha_frac": 0.5874164811,
"autogenerated": false,
"ratio": 2.958813838550247,
"config_test": false,
"has_... |
__author__ = 'liam'
from .. import db
from slugify import slugify
from .problem import Problem
from sqlalchemy.ext.orderinglist import ordering_list
import datetime
def exam_slugify_(text):
count = 0
slug = slugify(text)
while Exam.query.filter_by(slug=slug).count() > 0:
slug = slugify(text) + st... | {
"repo_name": "OldGermanTrick/oldgermantrick",
"path": "oldgermantrick/models/exam.py",
"copies": "1",
"size": "1277",
"license": "mit",
"hash": -7505213022463698000,
"line_mean": 29.4047619048,
"line_max": 108,
"alpha_frac": 0.6100234926,
"autogenerated": false,
"ratio": 3.5971830985915494,
"c... |
__author__ = 'liam'
from .. import db
problem_tags = db.Table('problem_tags',
db.Column('problem_id', db.Integer, db.ForeignKey('problem.id')),
db.Column('tag_name', db.String(80), db.ForeignKey('tag.name'))
)
class Problem(db.Model):
id = ... | {
"repo_name": "OldGermanTrick/oldgermantrick",
"path": "oldgermantrick/models/problem.py",
"copies": "1",
"size": "1857",
"license": "mit",
"hash": -2565400216792930000,
"line_mean": 32.1607142857,
"line_max": 89,
"alpha_frac": 0.5799676898,
"autogenerated": false,
"ratio": 3.3763636363636365,
... |
__author__ = 'Liam'
from random import randrange
from room import *
class Player:
"""The Player object, with associated variables and methods. This is you!
"""
def __init__(self, location):
"""When initialising the character, we'll later give the player the
choice of a name and spirit an... | {
"repo_name": "iJebus/gone-crawling",
"path": "application.py",
"copies": "1",
"size": "2932",
"license": "mit",
"hash": 4928187684842963000,
"line_mean": 31.9550561798,
"line_max": 79,
"alpha_frac": 0.5798090041,
"autogenerated": false,
"ratio": 3.8226857887874837,
"config_test": false,
"has... |
__author__ = 'liam'
import json
import random
import string
import os
from flask import make_response, request, session
from oauth2client.client import FlowExchangeError
from simplekv.memory import DictStore
from flask.ext.kvsession import KVSessionExtension
from flask.ext.login import LoginManager, login_user, logo... | {
"repo_name": "OldGermanTrick/oldgermantrick",
"path": "oldgermantrick/views/login.py",
"copies": "1",
"size": "3923",
"license": "mit",
"hash": 6317891530682385000,
"line_mean": 31.1557377049,
"line_max": 94,
"alpha_frac": 0.6869742544,
"autogenerated": false,
"ratio": 3.958627648839556,
"conf... |
__author__ = 'liam'
from .. import app, db
from ..models import Exam, Problem, Solution, Category, User
from flask.ext.login import current_user
from flask.ext.restless import ProcessingException, APIManager
def allow_all(**kw):
pass
def allow_user(**kw):
if not current_user.is_authenticated():
ra... | {
"repo_name": "OldGermanTrick/oldgermantrick",
"path": "oldgermantrick/views/api.py",
"copies": "1",
"size": "2394",
"license": "mit",
"hash": -6507612975858906000,
"line_mean": 28.1951219512,
"line_max": 111,
"alpha_frac": 0.6587301587,
"autogenerated": false,
"ratio": 3.0850515463917527,
"con... |
__author__ = 'liam'
"""
Manually convert the old OldGermanTrick database to the new schema.
https://gist.github.com/esperlu/943776
./mysql2sqlite.sh -u XXXX -p XXXX | sqlite3 ogt.db
export OGT_OLD_DB=sqllite:///ogt.db
"""
from oldgermantrick import db
from oldgermantrick.models import Category, Exam, Tag... | {
"repo_name": "OldGermanTrick/oldgermantrick",
"path": "scripts/setup_db.py",
"copies": "1",
"size": "3815",
"license": "mit",
"hash": 8726388694910209000,
"line_mean": 34.3240740741,
"line_max": 110,
"alpha_frac": 0.5889908257,
"autogenerated": false,
"ratio": 3.15550041356493,
"config_test": ... |
__author__ = 'lichengwu'
# -*- coding: utf-8 -*-
import itertools
import os
import plistlib
import unicodedata
import sys
from xml.etree.ElementTree import Element, SubElement, tostring
"""
You should run your script via /bin/bash with all escape options ticked.
The command line should be
python yourscript.py "{quer... | {
"repo_name": "lichengwu/python_tools",
"path": "utils/cn/lichengwu/utils/utils/alfred/alfred.py",
"copies": "2",
"size": "2713",
"license": "apache-2.0",
"hash": 2661929330140290000,
"line_mean": 27.8723404255,
"line_max": 87,
"alpha_frac": 0.6343531146,
"autogenerated": false,
"ratio": 3.726648... |
__author__ = 'lichengwu'
import re
import time
class CmsLogUtil:
__path = ''
# some regular expression pattern
# like this '2012-12-19T10:25:19'
__START_TIME_PATTERN = re.compile('^([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}):')
# [GC [1 CMS-initial-mark: 2723087K(3145728K)] 3525585K(4106944K), 0.542188... | {
"repo_name": "lichengwu/python_tools",
"path": "utils/cn/lichengwu/utils/utils/gc/CmsLogUtil.py",
"copies": "1",
"size": "3733",
"license": "apache-2.0",
"hash": -4996262008597806000,
"line_mean": 40.9438202247,
"line_max": 381,
"alpha_frac": 0.5788909724,
"autogenerated": false,
"ratio": 3.1343... |
__author__ = 'lichengwu'
def get_groups(sharding):
sc = (int(sharding) - 1) * 8
group_list = ""
for s in xrange(sc, sc + 8):
group_list += str(s) + ","
return group_list[:-1]
def get_note(host):
v = host[3]
if v == 'm':
return 'message_' + host[17:]
else:
t = host... | {
"repo_name": "lichengwu/python_tools",
"path": "test/atw_config_auto.py",
"copies": "1",
"size": "1524",
"license": "apache-2.0",
"hash": -8096584117195458000,
"line_mean": 30.1020408163,
"line_max": 176,
"alpha_frac": 0.5433070866,
"autogenerated": false,
"ratio": 2.6458333333333335,
"config_... |
__author__ = 'lichengwu'
POST_PATH = "/Users/lichengwu/workspace/lichengwu.github.com/_posts"
SAVE_PATH = "/Users/lichengwu/tmp/hpstr-jekyll-theme"
import os
import re
import urllib2
def get_all_files(path, rs):
for i in os.listdir(path):
full_path = os.path.join(path, i)
if os.path.isfile(ful... | {
"repo_name": "lichengwu/python_tools",
"path": "utils/cn/lichengwu/utils/utils/web/BlogSwift.py",
"copies": "1",
"size": "2335",
"license": "apache-2.0",
"hash": -3034542105886309400,
"line_mean": 22.5858585859,
"line_max": 77,
"alpha_frac": 0.4835117773,
"autogenerated": false,
"ratio": 3.38405... |
#this code is really ugly, I'm not a good progammer, I'm sorry
import ugfx
import buttons
import pyb
ugfx.init()
buttons.init()
bz=pyb.Pin(pyb.Pin.cpu.D12, pyb.Pin.OUT_PP) # music comes from here
buttons.enable_menu_reset()
room = 1
haskey1=0
haskey2=0
hp=50
orc1=10
orc2=10
orc3=20
btn_a_presses=0
def setup_... | {
"repo_name": "liedra/adventure-emf",
"path": "main.py",
"copies": "1",
"size": "14429",
"license": "mit",
"hash": 5111079307308239000,
"line_mean": 23.7495711835,
"line_max": 70,
"alpha_frac": 0.6044077899,
"autogenerated": false,
"ratio": 2.1714070729872086,
"config_test": false,
"has_no_ke... |
__author__ = 'lige'
#encoding:utf-8
import networkx as nx
def build_graph(word_word,word_sort,vectors,f,k):
G=nx.DiGraph()#创建空图
print len(word_sort)
#print word_sort
for i in range(0,len(word_sort)):
G.add_node(i)#创造节点
for i in range(0,word_word.shape[0]):
for j in range(0,word_word... | {
"repo_name": "yanshengli/DBN_Learning",
"path": "基于复杂语言网络的文本二分类/graph_feature.py",
"copies": "1",
"size": "1930",
"license": "apache-2.0",
"hash": -4760338265013776000,
"line_mean": 27.3880597015,
"line_max": 93,
"alpha_frac": 0.6261829653,
"autogenerated": false,
"ratio": 2.780701754385965,
"... |
__author__ = 'lige'
#encoding:Utf-8
import numpy as np
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import TfidfVectorizer
from graph_feature import build_graph
def file():
cats = ['alt.atheism','sci.electronics']
newsgroups_train = fetch_20newsgroups(subset='train', ... | {
"repo_name": "yanshengli/DBN_Learning",
"path": "基于复杂语言网络的文本二分类/file_to_graph1_test.py",
"copies": "1",
"size": "1727",
"license": "apache-2.0",
"hash": 3450149549853551600,
"line_mean": 31.3725490196,
"line_max": 92,
"alpha_frac": 0.6208358571,
"autogenerated": false,
"ratio": 2.911816578483245... |
__author__ = 'lige'
#encoding:utf-8
import numpy as np
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import TfidfVectorizer
from graph_feature import build_graph
def file():
cats = ['alt.atheism','sci.electronics']
newsgroups_train = fetch_20newsgroups(subset='train', ... | {
"repo_name": "yanshengli/DBN_Learning",
"path": "基于复杂语言网络的文本二分类/file_to_graph1_train.py",
"copies": "1",
"size": "1639",
"license": "apache-2.0",
"hash": -6057292663759597000,
"line_mean": 30.26,
"line_max": 92,
"alpha_frac": 0.6148432502,
"autogenerated": false,
"ratio": 2.88909426987061,
"co... |
__author__ = 'LiGe'
#encoding:utf-8
import networkx as nx
import matplotlib.pyplot as plot
from file_to_graph import file_to_mat
def build_graph(mat):
G=nx.DiGraph()#创建空图
for i in range(0,mat.shape[0]):
G.add_node(i)#创造节点
for i in range(0,mat.shape[0]):
for j in range(0,mat.shape... | {
"repo_name": "yanshengli/DBN_Learning",
"path": "基于复杂语言网络的文本二分类/select_feature.py",
"copies": "1",
"size": "1297",
"license": "apache-2.0",
"hash": -6527090369500463000,
"line_mean": 28.2142857143,
"line_max": 59,
"alpha_frac": 0.5996847912,
"autogenerated": false,
"ratio": 2.813747228381375,
... |
__author__ = 'LiGe'
#encoding:utf-8
import numpy as np
#归一化train数据
def txt2mat_train():
f=open("train.txt",'r')
datas=f.readlines()
train_mat=list()
train_label=list()
for data in datas:
data=data.strip()
if len(data)>0:
data=data.split(',')
row... | {
"repo_name": "yanshengli/DBN_Learning",
"path": "normal_8.py",
"copies": "1",
"size": "4948",
"license": "apache-2.0",
"hash": 3601355746533400000,
"line_mean": 29.3757961783,
"line_max": 83,
"alpha_frac": 0.3803818034,
"autogenerated": false,
"ratio": 3.6828721017202692,
"config_test": false,... |
__author__ = 'LiGe'
#encoding:utf-8
import pymongo
import os
import csv
class mongodb(object):
def __init__(self, ip, port):
self.ip=ip
self.port=port
self.conn=pymongo.MongoClient(ip,port)
def close(self):
return self.conn.disconnect()
def get_conn(self):
... | {
"repo_name": "siutanwong/sina_weibo_crawler",
"path": "mongodb.py",
"copies": "3",
"size": "1385",
"license": "apache-2.0",
"hash": -3343504703143104000,
"line_mean": 30.2558139535,
"line_max": 116,
"alpha_frac": 0.5133574007,
"autogenerated": false,
"ratio": 3.243559718969555,
"config_test": ... |
from cv2 import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey
from numpy import array, dot, pad, ravel, uint8, zeros
def im2col(image, block_size):
rows, cols = image.shape
dst_height = cols - block_size[1] + 1
dst_width = rows - block_size[0] + 1
image_array = zeros((dst_height * dst_width, block... | {
"repo_name": "TheAlgorithms/Python",
"path": "digital_image_processing/filters/convolve.py",
"copies": "1",
"size": "1635",
"license": "mit",
"hash": 3264865868384566300,
"line_mean": 32.2857142857,
"line_max": 80,
"alpha_frac": 0.6161863887,
"autogenerated": false,
"ratio": 2.9281867145421905,
... |
import numpy as np
from cv2 import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey
from digital_image_processing.filters.convolve import img_convolve
def sobel_filter(image):
kernel_x = np.array([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]])
kernel_y = np.array([[1, 2, 1], [0, 0, 0], [-1, -2, -1]])
dst_x = np.... | {
"repo_name": "TheAlgorithms/Python",
"path": "digital_image_processing/filters/sobel_filter.py",
"copies": "1",
"size": "1157",
"license": "mit",
"hash": -5435931416588439000,
"line_mean": 28.5641025641,
"line_max": 66,
"alpha_frac": 0.604509974,
"autogenerated": false,
"ratio": 2.59101123595505... |
__author__ = 'LiGuangyu'
import asyncio,re
patten = re.compile(r'(\w+)\((\d+)(,\d+)?\)')
sList = []
def getVName(dbName):
dbName =dbName.lower();
vname = ''
for x in dbName.split('_'):
vname += x.capitalize()
gName = 'get' + vname
sName = 'set' + vname
vname = vname[0].lower() + vnam... | {
"repo_name": "liguangyulgy/mytest1",
"path": "buildEntity.py",
"copies": "1",
"size": "2214",
"license": "bsd-2-clause",
"hash": 1105659074213806700,
"line_mean": 26.9746835443,
"line_max": 134,
"alpha_frac": 0.5470588235,
"autogenerated": false,
"ratio": 2.8516129032258064,
"config_test": fal... |
__author__ = 'LiGuangyu'
import xml.sax as sax
class CardFreeXmlHandler(sax.ContentHandler):
def __init__(self):
self.CurrentData = ""
self.type = ""
self.format = ""
self.year = ""
self.rating = ""
self.stars = ""
self.description = ""
def startEleme... | {
"repo_name": "liguangyulgy/mytest1",
"path": "xmlDemo/xml1.py",
"copies": "1",
"size": "1779",
"license": "bsd-2-clause",
"hash": -6892096445895668000,
"line_mean": 28.1639344262,
"line_max": 56,
"alpha_frac": 0.5497470489,
"autogenerated": false,
"ratio": 4.156542056074766,
"config_test": fal... |
__author__ = 'lily'
import numpy as np
from sklearn.decomposition import ProjectedGradientNMF
import recsys
import evaluate
import similarity
from sklearn import decomposition
from numpy.linalg import inv
from sklearn.metrics.pairwise import pairwise_distances
#feature helper and user_feature are derived from lambda f... | {
"repo_name": "rlowrance/find_best_mall",
"path": "recomendation system/content.py",
"copies": "3",
"size": "4596",
"license": "mit",
"hash": 8641989055335113000,
"line_mean": 39.6814159292,
"line_max": 136,
"alpha_frac": 0.6512184508,
"autogenerated": false,
"ratio": 3.6360759493670884,
"confi... |
__author__ = 'Lime Microsystems'
from string import Template
import datetime
filename = "version.h"
version_file_template = Template(
"""/**
@author Lime Microsystems
@brief Automatically generated software version
*/
#pragma once
namespace AutoVersion
{
static const int year = $year;
static const int month ... | {
"repo_name": "myriadrf/lms-suite",
"path": "LMS7002M/lms7suite/auto_version.py",
"copies": "1",
"size": "1568",
"license": "apache-2.0",
"hash": -9124580741714376000,
"line_mean": 23.5,
"line_max": 72,
"alpha_frac": 0.6288265306,
"autogenerated": false,
"ratio": 3.69811320754717,
"config_test"... |
__author__ = 'LimeQM'
from flask.ext.restful import Resource, abort, fields, marshal_with, reqparse
from Server.models import Users, Keeper
from Server import db
from datetime import datetime
class DecryptRow(fields.Raw):
def format(self, value):
return
keeper_fields = {
'id': fields.String,
'la... | {
"repo_name": "wangjun/PassBank",
"path": "Server/blueprints/API_v1/apis/keeper.py",
"copies": "2",
"size": "4267",
"license": "mit",
"hash": 4568454123855177700,
"line_mean": 38.8785046729,
"line_max": 113,
"alpha_frac": 0.5826107335,
"autogenerated": false,
"ratio": 4.0832535885167465,
"confi... |
__author__ = 'LimeQM'
from flask.ext.restful import Resource, abort
from Server.models import Users
from Server import db
class Preference(Resource):
def get(self, token, target, item, new_value, old_value=None):
user = Users.verify_auth_token(token)
if user:
if target == "keeper":
... | {
"repo_name": "LimeQM/PassBank",
"path": "Server/blueprints/API_v1/apis/preference.py",
"copies": "2",
"size": "2277",
"license": "mit",
"hash": -2613607195906765300,
"line_mean": 47.4468085106,
"line_max": 157,
"alpha_frac": 0.4835309618,
"autogenerated": false,
"ratio": 4.783613445378151,
"co... |
__author__ = 'LimeQM'
from flask.ext.restful import Resource, abort, reqparse
from Server.models import Users
from Server import db
row_data = reqparse.RequestParser()
row_data.add_argument('data', type=str, help='Can not resolve data')
update_list = ['username', 'password', 'email', 'verify']
class User(Resource... | {
"repo_name": "wangjun/PassBank",
"path": "Server/blueprints/API_v1/apis/user.py",
"copies": "2",
"size": "1396",
"license": "mit",
"hash": -1114557481554365400,
"line_mean": 32.2380952381,
"line_max": 81,
"alpha_frac": 0.5444126074,
"autogenerated": false,
"ratio": 4.192192192192192,
"config_t... |
__author__ = 'LimeQM'
from flask import render_template, jsonify, request
from . import user
from .forms import SigninForm, SignupForm
from Server.models import Users
from Server import db
@user.route('/signin', methods = ['GET', 'POST'])
def signin():
form = SigninForm()
if request.method == 'POST':
... | {
"repo_name": "wangjun/PassBank",
"path": "Server/blueprints/User/views.py",
"copies": "2",
"size": "1900",
"license": "mit",
"hash": -3942393393887980500,
"line_mean": 34.8490566038,
"line_max": 120,
"alpha_frac": 0.5515789474,
"autogenerated": false,
"ratio": 4.094827586206897,
"config_test":... |
__author__ = 'LimeQM'
from Server import app, db
from uuid import uuid4
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer, SignatureExpired, BadSignature
authority = db.Table('authorities', db.Model.metadata,
db.Column('permission_id', db.Integer, db.ForeignKey('permission.id... | {
"repo_name": "wangjun/PassBank",
"path": "Server/models/role.py",
"copies": "2",
"size": "1569",
"license": "mit",
"hash": 6263168076428301000,
"line_mean": 40.1842105263,
"line_max": 109,
"alpha_frac": 0.6338658147,
"autogenerated": false,
"ratio": 3.7893462469733654,
"config_test": false,
... |
__author__ = 'LimeQM'
from Server import crypt, app, db
from datetime import datetime
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer, SignatureExpired, BadSignature
from .role import Role
from .user_status import UserStatus
from random import sample
from string import ascii_letters, digits
from... | {
"repo_name": "wangjun/PassBank",
"path": "Server/models/users.py",
"copies": "2",
"size": "3547",
"license": "mit",
"hash": 3141011224688003600,
"line_mean": 37.1397849462,
"line_max": 144,
"alpha_frac": 0.6504087962,
"autogenerated": false,
"ratio": 3.5864509605662285,
"config_test": false,
... |
__author__ = 'linas'
'''
Parameter tuning based on the Gaussian Processes.
Idea based on http://arxiv.org/pdf/1206.2944.pdf
Because it is more natural for me, I will use UCB method.
0. Estimate method performance at 2 points
1. Run GP and estimate mean and variance of each parameter at many points
2. Try the new poin... | {
"repo_name": "grafos-ml/okapi",
"path": "bin/parameterTuning.py",
"copies": "3",
"size": "3732",
"license": "apache-2.0",
"hash": 8036748035569235000,
"line_mean": 33.8878504673,
"line_max": 115,
"alpha_frac": 0.6010182208,
"autogenerated": false,
"ratio": 3.0515126737530665,
"config_test": fa... |
__author__ = 'linlin'
import os
import logging
import re
import random
parDir = os.path.dirname(os.getcwd())
# curDir = os.getcwd()
logger = logging.getLogger(__name__)
separator = ' '
text = []
RED = '\033[0;31;40m'
GREEN = '\033[0;32;40m'
YELLOW = '\033[0;33;40m'
BLUE = '\033[0;34;40m'
NORM = '\033[0m'
def GetData... | {
"repo_name": "linkinwong/word2vec",
"path": "src/crf-paper-script/demo.py",
"copies": "1",
"size": "3906",
"license": "apache-2.0",
"hash": 6551608936362459000,
"line_mean": 28.1492537313,
"line_max": 121,
"alpha_frac": 0.4864311316,
"autogenerated": false,
"ratio": 3.4875,
"config_test": fals... |
__author__ = 'linlin'
import os
import logging
import re
parDir = os.path.dirname(os.getcwd())
# curDir = os.getcwd()
logger = logging.getLogger(__name__)
separator = ' '
def MergePrediction():
prediction_path = parDir + '/data/0112nonCopyAsOKSeparator/result.txt'
preprocessed_path = parDir + '/data/0112nonC... | {
"repo_name": "linkinwong/word2vec",
"path": "src/crf-paper-script/merger.py",
"copies": "1",
"size": "1235",
"license": "apache-2.0",
"hash": 7393634498470396000,
"line_mean": 25.847826087,
"line_max": 83,
"alpha_frac": 0.636437247,
"autogenerated": false,
"ratio": 3.1748071979434447,
"config_... |
__author__ = 'linlin'
import os
import logging
parDir = os.path.dirname(os.getcwd())
logger = logging.getLogger(__name__)
separator = ' '
def DirProcessing():
path = parDir + "/expr_0112"
for root, dirs, files in os.walk(path):
for filespath in files:
abs_file_path = os.path.join(root, fi... | {
"repo_name": "linkinwong/word2vec",
"path": "src/crf-paper-script/preprocessor1.py",
"copies": "1",
"size": "1739",
"license": "apache-2.0",
"hash": -56259343182240560,
"line_mean": 27.0483870968,
"line_max": 92,
"alpha_frac": 0.5508913168,
"autogenerated": false,
"ratio": 3.3250478011472278,
... |
__author__ = 'linlin'
import os
import logging
parDir = os.path.dirname(os.getcwd())
logger = logging.getLogger(__name__)
def DirProcessing():
path = parDir + "/expr_0112"
for root, dirs, files in os.walk(path):
for filespath in files:
abs_file_path = os.path.join(root, filespath)
... | {
"repo_name": "linkinwong/word2vec",
"path": "src/crf-paper-script/preprocessor.py",
"copies": "1",
"size": "1364",
"license": "apache-2.0",
"hash": -5374794186364358000,
"line_mean": 28.0212765957,
"line_max": 75,
"alpha_frac": 0.5681818182,
"autogenerated": false,
"ratio": 3.401496259351621,
... |
__author__ = 'li'
from ControllerApp.FlowDB import FlowDB
from ControllerApp.Allocator import Allocator
from ControllerApp.CoflowID import CoflowID
from ControllerApp.SizeEstimator import SizeEstimator
# Spine leaf testbed topology constants
NUMCORE = 2
NUMRACK = 4
NUMSERVERPRACK = 4
NUMSERVER = NUMCORE * NUMRACK * N... | {
"repo_name": "li-ch/mind",
"path": "ControllerApp/Controller.py",
"copies": "1",
"size": "2042",
"license": "mit",
"hash": 5182461616376937000,
"line_mean": 24.8481012658,
"line_max": 62,
"alpha_frac": 0.6410381978,
"autogenerated": false,
"ratio": 3.551304347826087,
"config_test": false,
"h... |
__author__ = 'li'
from flowsizepred import GPRFlowEstimator
import datetime
class PredictionModels:
def __init__(self):
pass
GPR, NW, RL = range(3)
class SizeEstimator(object):
def __init__(self):
self.model = GPRFlowEstimator.GPRModel()
self.model.load('Models/GPR_model.txt')
... | {
"repo_name": "li-ch/mind",
"path": "ControllerApp/SizeEstimator.py",
"copies": "1",
"size": "4030",
"license": "mit",
"hash": -7755628496980546000,
"line_mean": 35.9724770642,
"line_max": 113,
"alpha_frac": 0.6143920596,
"autogenerated": false,
"ratio": 3.6208445642407905,
"config_test": false... |
__author__ = 'li'
from random import choice
import gc
from SmartLearning.smartlearn import LearnSDN
# Define number of hidden nodes per layer with a list.
# For instance, [20, 10] means 2 hidden layers: the first with 20 nodes and the second with 10 nodes.
number_hidden_nodes_per_layer = [20, 20]
# Define type of act... | {
"repo_name": "li-ch/mind",
"path": "ControllerApp/Allocator.py",
"copies": "1",
"size": "3026",
"license": "mit",
"hash": -4192530054519071000,
"line_mean": 38.2987012987,
"line_max": 118,
"alpha_frac": 0.6503635162,
"autogenerated": false,
"ratio": 3.667878787878788,
"config_test": false,
"... |
__author__ = 'li'
from random import choice, randint
from time import sleep
def main():
ipbase = '192.168.100.'
ippoolsize = 30
iplast = range(1, ippoolsize+1)
ippool = []
for ipl in iplast:
ippool.append(ipbase+str(ipl))
flowCounter = choice(range(2000, 3000))
portpool = range(80... | {
"repo_name": "li-ch/mind",
"path": "scripts/run.py",
"copies": "1",
"size": "1308",
"license": "mit",
"hash": 2621628594928678000,
"line_mean": 28.75,
"line_max": 82,
"alpha_frac": 0.498470948,
"autogenerated": false,
"ratio": 3.5447154471544717,
"config_test": false,
"has_no_keywords": fals... |
__author__ = 'li'
import datetime
class Flow(dict):
def __init__(self,
fid=0,
srcIP='10.0.0.1',
dstIP='10.0.0.2',
srcPort=8008,
dstPort=8009):
self['id'] = fid
self['srcIP'] = srcIP
self['dstIP'] = dstIP
... | {
"repo_name": "li-ch/mind",
"path": "ControllerApp/FlowDB.py",
"copies": "1",
"size": "3577",
"license": "mit",
"hash": -4372937296510216700,
"line_mean": 28.5702479339,
"line_max": 84,
"alpha_frac": 0.5255800951,
"autogenerated": false,
"ratio": 3.3336439888164024,
"config_test": false,
"has... |
__author__ = 'linus'
def create_query(search_dict):
""" Creates a query parts dictionary
:search_dict search_dict:
Dict contains:
peptide
ms_run
source_name
source (organ/tissue/dignity)
person
source_hla_typing (TODO)
spectrum_hit (ionscore, e-val... | {
"repo_name": "mwalzer/Ligandomat",
"path": "ligandomat/tools/queryCreator.py",
"copies": "1",
"size": "9573",
"license": "mit",
"hash": -5306212579580342000,
"line_mean": 40.0858369099,
"line_max": 200,
"alpha_frac": 0.5160346809,
"autogenerated": false,
"ratio": 3.743840438013297,
"config_tes... |
__author__ = 'Linwei'
import numpy as np
import os, json, sys, re
import _cymlda
from settings import H, E, alpha, beta, gamma, docDir, outputDir, iter_max, run_num, dictionary, docset
PY2 = sys.version_info[0] == 2
if PY2:
range = xrange
def n2s(counts):
"""convert a counts vector to corresponding samples"... | {
"repo_name": "LaoWang-Lab/multi-dimensional-topic-model",
"path": "cymlda.py",
"copies": "1",
"size": "7884",
"license": "mit",
"hash": -1022365349762493200,
"line_mean": 39.0203045685,
"line_max": 146,
"alpha_frac": 0.5012683917,
"autogenerated": false,
"ratio": 2.952808988764045,
"config_tes... |
__author__ = 'lioro'
from DIE.Lib.DataPluginBase import DataPluginBase
from ctypes import *
from win32api import *
from win32con import *
import idc
ObjectTypeInformation = 2
ObjectNameInformation = 1
ObjectBasicInformation = 0
isWin64Process = False # Set if the IDA process is 64-bit
def tohex(val... | {
"repo_name": "HackerTool/DIE",
"path": "DIE/Plugins/DataParsers/HandleParser/HandleParser.py",
"copies": "9",
"size": "3383",
"license": "mit",
"hash": -5804645983906495000,
"line_mean": 29.9150943396,
"line_max": 243,
"alpha_frac": 0.577298256,
"autogenerated": false,
"ratio": 3.641550053821313... |
__author__ = 'Liran & Rotem '
from Client import Client
from Crypto.PublicKey import RSA
PORT = 8888
HOST = ""
class Bob(Client):
def __init__(self):
super(Bob, self).__init__()
self.alice_password = "123456"
def open_connection(self):
super(Bob, self).open_connection()
pri... | {
"repo_name": "liranbg/MITM",
"path": "Bob.py",
"copies": "1",
"size": "1888",
"license": "mit",
"hash": 8037218270827086000,
"line_mean": 28.5,
"line_max": 120,
"alpha_frac": 0.4973516949,
"autogenerated": false,
"ratio": 4.017021276595744,
"config_test": false,
"has_no_keywords": false,
"... |
__author__ = 'Liran & Rotem '
from Client import Client
PORT = 8886
HOST = ""
DST_IP = "127.0.0.1"
class Alice(Client):
def __init__(self):
super(Alice, self).__init__()
self.dst_port = ""
self.dst_ip = ""
self.my_password = ""
def open_connection(self):
super(Alice,... | {
"repo_name": "liranbg/MITM",
"path": "Alice.py",
"copies": "1",
"size": "2389",
"license": "mit",
"hash": -3198133505636386000,
"line_mean": 28.4938271605,
"line_max": 70,
"alpha_frac": 0.5642528254,
"autogenerated": false,
"ratio": 3.398293029871977,
"config_test": false,
"has_no_keywords":... |
__author__ = 'Liran & Rotem '
from Crypto.PublicKey import RSA
from threading import Thread
from Client import Client
LISTEN_PORT = 8886
CONNECTION_PORT = 8888
HOST = ""
DST_IP = "127.0.0.1"
class Eve:
def __init__(self):
self.Alice = Client()
self.Alice.open_connection()
self.Bob = Cli... | {
"repo_name": "liranbg/MITM",
"path": "Eve.py",
"copies": "1",
"size": "4649",
"license": "mit",
"hash": -988187977988687200,
"line_mean": 37.4214876033,
"line_max": 120,
"alpha_frac": 0.5371047537,
"autogenerated": false,
"ratio": 3.890376569037657,
"config_test": false,
"has_no_keywords": f... |
__author__ = 'Liran & Rotem '
from RSAHandler import RSAHandler
from Crypto.PublicKey import RSA
import socket
PORT = 8888
HOST = ""
DST_IP = "10.0.0.3"
class Client(object):
def __init__(self):
self.sock = None
self.rsa = RSAHandler()
def open_connection(self):
self.sock = socket.s... | {
"repo_name": "liranbg/MITM",
"path": "Client.py",
"copies": "1",
"size": "1229",
"license": "mit",
"hash": 8800329717915981000,
"line_mean": 28.2619047619,
"line_max": 107,
"alpha_frac": 0.6623270952,
"autogenerated": false,
"ratio": 3.3950276243093924,
"config_test": false,
"has_no_keywords... |
"""
Command line access to the PETSc Options Database.
This module provides command line access to PETSc Options
Database. It outputs a listing of the many PETSc options
indicating option names, default values and descriptions.
Usage::
$ python -m petsc4py [vec|mat|pc|ksp|snes|ts|tao] [<petsc-option-list>]
"""
d... | {
"repo_name": "zonca/petsc4py",
"path": "src/__main__.py",
"copies": "1",
"size": "2171",
"license": "bsd-2-clause",
"hash": -9190952603875722000,
"line_mean": 26.1375,
"line_max": 73,
"alpha_frac": 0.5836020267,
"autogenerated": false,
"ratio": 3.132756132756133,
"config_test": false,
"has_n... |
# --------------------------------------------------------------------
"""
PETSc for Python
================
This package is an interface to PETSc libraries.
PETSc_ (the Portable, Extensible Toolkit for Scientific Computation)
is a suite of data structures and routines for the scalable (parallel)
solution of scient... | {
"repo_name": "zonca/petsc4py",
"path": "src/__init__.py",
"copies": "1",
"size": "1952",
"license": "bsd-2-clause",
"hash": -4565239449265172500,
"line_mean": 29.9841269841,
"line_max": 70,
"alpha_frac": 0.581454918,
"autogenerated": false,
"ratio": 3.951417004048583,
"config_test": false,
"... |
"""
Run some benchmarks and tests
"""
import sys as _sys
def helloworld(comm, args=None, verbose=True):
"""
Hello, World! using MPI
"""
from mpi4py import MPI
from optparse import OptionParser
parser = OptionParser(prog="mpi4py helloworld")
parser.add_option("-q", "--quiet", action="store_... | {
"repo_name": "pressel/mpi4py",
"path": "src/__main__.py",
"copies": "1",
"size": "5821",
"license": "bsd-2-clause",
"hash": -2716387458160515600,
"line_mean": 33.6488095238,
"line_max": 79,
"alpha_frac": 0.5406287579,
"autogenerated": false,
"ratio": 3.917227456258412,
"config_test": false,
... |
"""
This is the **MPI for Python** package.
What is *MPI*?
==============
The *Message Passing Interface*, is a standardized and portable
message-passing system designed to function on a wide variety of
parallel computers. The standard defines the syntax and semantics of
library routines and allows users to write por... | {
"repo_name": "keithroe/vtkoptix",
"path": "ThirdParty/mpi4py/vtkmpi4py/src/__init__.py",
"copies": "20",
"size": "2219",
"license": "bsd-3-clause",
"hash": -3525008551808361000,
"line_mean": 31.6323529412,
"line_max": 70,
"alpha_frac": 0.6070301938,
"autogenerated": false,
"ratio": 4.65199161425... |
"""
Runtime configuration parameters
"""
initialize = True
"""
Automatic MPI initialization at import time
* Any of ``{True | 1 | "yes" }``: initialize MPI at import time
* Any of ``{False | 0 | "no" }``: do not initialize MPI at import time
"""
threaded = True
"""
Request for thread support at MPI... | {
"repo_name": "hlzz/dotfiles",
"path": "graphics/VTK-7.0.0/ThirdParty/mpi4py/vtkmpi4py/src/rc.py",
"copies": "2",
"size": "3034",
"license": "bsd-3-clause",
"hash": -330844378297847900,
"line_mean": 27.4563106796,
"line_max": 78,
"alpha_frac": 0.5454845089,
"autogenerated": false,
"ratio": 3.4873... |
__author__ = 'lisette-espin'
######################################################################
# dependencies
######################################################################
import matplotlib
import sys
from scipy.sparse import lil_matrix, csr_matrix
import pandas as pd
import os
import operator
import num... | {
"repo_name": "lisette-espin/JANUS",
"path": "python-code/sociopatterns.py",
"copies": "1",
"size": "17255",
"license": "mit",
"hash": 4269578345546126000,
"line_mean": 34.7246376812,
"line_max": 199,
"alpha_frac": 0.5778614894,
"autogenerated": false,
"ratio": 3.0708311087382096,
"config_test"... |
__author__ = 'lisette.espin'
#######################################################################
# Dependencies
#######################################################################
import numpy as np
from libs.mrqap import MRQAP
import time
from libs import utils
from libs.profiling import Profiling
import sys
... | {
"repo_name": "lisette-espin/mrqap",
"path": "example_countries_timing_permutations.py",
"copies": "1",
"size": "3432",
"license": "cc0-1.0",
"hash": 6045072363041595000,
"line_mean": 41.9,
"line_max": 218,
"alpha_frac": 0.4842657343,
"autogenerated": false,
"ratio": 4.0711743772241995,
"config... |
__author__ = 'lisette-espin'
################################################################################
### Local
################################################################################
from org.gesis.libs import graph as c
from org.gesis.libs.janus import JANUS
from org.gesis.libs.graph import DataMatr... | {
"repo_name": "lisette-espin/JANUS",
"path": "python-code/multiplex.py",
"copies": "1",
"size": "12361",
"license": "mit",
"hash": -4607561690240163300,
"line_mean": 33.2409972299,
"line_max": 199,
"alpha_frac": 0.5789984629,
"autogenerated": false,
"ratio": 3.337203023758099,
"config_test": fa... |
__author__ = 'lisette.espin'
######################################################################################################################
# SYSTEM DEPENDENCES
######################################################################################################################
from datetime import datetime
i... | {
"repo_name": "lisette-espin/mrqap",
"path": "libs/utils.py",
"copies": "1",
"size": "1290",
"license": "cc0-1.0",
"hash": -4096407195533890000,
"line_mean": 34.8611111111,
"line_max": 118,
"alpha_frac": 0.3984496124,
"autogenerated": false,
"ratio": 4.417808219178082,
"config_test": false,
"... |
__author__ = 'Liudmila'
from model.contact import Contact
import re
from selenium.webdriver.support.select import Select
class ContactHelper:
def __init__(self, app):
self.app = app
def delete_first_contact(self):
self.delete_contact_by_index(0)
def delete_contact_by_index(self,index):
... | {
"repo_name": "MilaPetrova/python-training-group3",
"path": "fixture/contact.py",
"copies": "1",
"size": "11064",
"license": "apache-2.0",
"hash": -6609793667290839000,
"line_mean": 41.8837209302,
"line_max": 126,
"alpha_frac": 0.6111713666,
"autogenerated": false,
"ratio": 3.449953227315248,
"... |
__author__ = 'Liudmila'
from model.group import Group
class GroupHelper:
def __init__(self, app):
self.app = app
def return_group_page(self):
wd = self.app.wd
wd.find_element_by_link_text("group page").click()
def delete_first_group(self):
self.delete_group_by_index(0)
... | {
"repo_name": "MilaPetrova/python-training-group3",
"path": "fixture/group.py",
"copies": "1",
"size": "3781",
"license": "apache-2.0",
"hash": -2893418086093830000,
"line_mean": 30.7731092437,
"line_max": 98,
"alpha_frac": 0.5863528167,
"autogenerated": false,
"ratio": 3.366874443455031,
"conf... |
__author__ = 'Liudmila'
from model.project import MyProject
from selenium.webdriver.support.select import Select
class MyProjectHelper:
def __init__(self, app):
self.app = app
def create_project(self, project):
wd = self.app.wd
self.open_project_page()
wd.find_element_by_css_... | {
"repo_name": "MilaPetrova/Mantis_testing",
"path": "fixture/project.py",
"copies": "1",
"size": "2436",
"license": "apache-2.0",
"hash": 707676824169503900,
"line_mean": 33.3098591549,
"line_max": 143,
"alpha_frac": 0.6145320197,
"autogenerated": false,
"ratio": 3.5304347826086957,
"config_tes... |
__author__ = 'Liudmila'
import mysql.connector
from model.group import Group
from model.contact import Contact
from model.contact_id_in_group import Contact_id_in_group
class Dbfixture:
def __init__(self, host, name, user, password):
self.host = host
self.name = name
self.user = user
... | {
"repo_name": "MilaPetrova/python-training-group3",
"path": "fixture/db.py",
"copies": "1",
"size": "2138",
"license": "apache-2.0",
"hash": -8713398725129115000,
"line_mean": 36.5263157895,
"line_max": 176,
"alpha_frac": 0.5991580917,
"autogenerated": false,
"ratio": 3.9592592592592593,
"confi... |
__author__ = 'Liudmila'
import random
from model.group import Group
from model.contact import Contact
def test_add_contact_from_homepage_in_group(app, db, check_ui):
old_groups = db.get_group_list()
old_contacts = db.get_contact_list()
old_contacts_in_group = db.get_contact_in_group()
group = random.c... | {
"repo_name": "MilaPetrova/python-training-group3",
"path": "test/replace_contact_to_group.py",
"copies": "1",
"size": "1216",
"license": "apache-2.0",
"hash": 2227936098536498200,
"line_mean": 44.0740740741,
"line_max": 117,
"alpha_frac": 0.6850328947,
"autogenerated": false,
"ratio": 3.07848101... |
__author__ = 'Liudmila'
import re
from model.contact import Contact
def test_all_contacts_on_home_page(app):
contact_from_home_page = app.contact.get_contact_list()[0]
contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0)
assert contact_from_home_page.all_phones_from_home_page == merge_p... | {
"repo_name": "MilaPetrova/python-training-group3",
"path": "test/test_contact_info_on_home_page.py",
"copies": "1",
"size": "2159",
"license": "apache-2.0",
"hash": 5860408968847048000,
"line_mean": 50.4285714286,
"line_max": 120,
"alpha_frac": 0.6762389995,
"autogenerated": false,
"ratio": 3.31... |
__author__ = 'Liudmila'
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username, password):
wd = self.app.wd
self.app.open_home_page()
wd.find_element_by_name("user").click()
wd.find_element_by_name("user").clear()
wd.find_element_... | {
"repo_name": "MilaPetrova/python-training-group3",
"path": "fixture/session.py",
"copies": "1",
"size": "1484",
"license": "apache-2.0",
"hash": -4784728517713185000,
"line_mean": 28.0980392157,
"line_max": 74,
"alpha_frac": 0.5653638814,
"autogenerated": false,
"ratio": 3.3574660633484164,
"c... |
__author__ = 'Liudmila'
from model.contact import Contact
import random
import string
import os.path
import getopt
import sys
import jsonpickle
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of groups", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 5
f = "data/... | {
"repo_name": "MilaPetrova/python-training-group3",
"path": "generator/contact_for_modify.py",
"copies": "1",
"size": "1395",
"license": "apache-2.0",
"hash": 8946193647247534000,
"line_mean": 32.2380952381,
"line_max": 134,
"alpha_frac": 0.6451612903,
"autogenerated": false,
"ratio": 3.251748251... |
__author__ = 'Liudmila'
from model.contact import Contact
import random
import string
import os.path
import json
import getopt
import sys
import jsonpickle
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of groups", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = ... | {
"repo_name": "MilaPetrova/python-training-group3",
"path": "generator/contact.py",
"copies": "1",
"size": "1541",
"license": "apache-2.0",
"hash": 4369766163199737000,
"line_mean": 34.0454545455,
"line_max": 178,
"alpha_frac": 0.6255678131,
"autogenerated": false,
"ratio": 3.40929203539823,
"c... |
__author__ = 'Liudmila'
import pytest
import json
import os.path
from fixture.application import Application
fixture = None
target = None
def load_config(file):
global target
if target is None:
config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), file)
with open (config_file)... | {
"repo_name": "MilaPetrova/Mantis_testing",
"path": "conftest.py",
"copies": "1",
"size": "1303",
"license": "apache-2.0",
"hash": 5465307064066256000,
"line_mean": 26.7234042553,
"line_max": 114,
"alpha_frac": 0.681504221,
"autogenerated": false,
"ratio": 3.755043227665706,
"config_test": true... |
__author__ = 'Liudmila'
import random
from model.group import Group
from model.contact import Contact
def test_delete_contact_from_group(app, db, check_ui):
if len(db.get_contact_list()) == 0:
app.contact.create(Contact(firstname="test"))
old_groups = db.get_group_list()
old_contacts = db.get_cont... | {
"repo_name": "MilaPetrova/python-training-group3",
"path": "test/del_contact_from_group.py",
"copies": "1",
"size": "1132",
"license": "apache-2.0",
"hash": -6444101182076059000,
"line_mean": 42.5384615385,
"line_max": 121,
"alpha_frac": 0.6819787986,
"autogenerated": false,
"ratio": 3.144444444... |
__author__ = 'Liu'
def quadrado_menores(n):
return [i ** 2 for i in range(1, n + 1) if i ** 2 <= n]
assert [1] == quadrado_menores(1)
assert [1, 4] == quadrado_menores(4)
assert [1, 4, 9] == quadrado_menores(9)
assert [1, 4, 9] == quadrado_menores(11)
def soma_quadrados(n):
if n > 0:
menores = quadrad... | {
"repo_name": "liu88620/POO-Python",
"path": "Tarefa1/quadrados.py",
"copies": "1",
"size": "1342",
"license": "mit",
"hash": -1484354985373488000,
"line_mean": 28.8222222222,
"line_max": 65,
"alpha_frac": 0.6013412817,
"autogenerated": false,
"ratio": 2.354385964912281,
"config_test": false,
... |
__author__ = 'liux4@onid.oregonstate.edu'
from enum import Enum
MAX_PLAYERS = 4
class Card(Enum):
curse = 0
estate = 1
duchy = 2
province = 3
copper = 4
silver = 5
gold = 6
# kingdom cards
adventurer = 7 # action card
bureaucrat = 8 # action attack card
cellar =... | {
"repo_name": "apepkuss/DominionGame",
"path": "source/enums.py",
"copies": "1",
"size": "3967",
"license": "mit",
"hash": -8502631993384627000,
"line_mean": 24.2675159236,
"line_max": 87,
"alpha_frac": 0.5636501134,
"autogenerated": false,
"ratio": 3.629460201280878,
"config_test": false,
"h... |
__author__ = 'liux4@onid.oregonstate.edu'
import enums
import dominion
# NON-API functions
def cardEffect(card, choice1, choice2, choice3, game, handPos, bonus):
currentPlayer = game.whoseTurn
nextPlayer = (currentPlayer + 1) % len(game.players)
tributeRevealedCards = [-1, -1]
temphand = [] # temph... | {
"repo_name": "apepkuss/DominionGame",
"path": "source/helper.py",
"copies": "1",
"size": "12841",
"license": "mit",
"hash": 2099540680136791300,
"line_mean": 32.2668393782,
"line_max": 112,
"alpha_frac": 0.6176310256,
"autogenerated": false,
"ratio": 3.731764022086603,
"config_test": false,
... |
__author__ = 'liux4@onid.oregonstate.edu'
import sys
import enums
import dominion
def runAdventurerTestCase1():
"""
Precondition: there should be at least an adventurer card in hand.
Test case description: play the adventurer card in hand.
Expected result: Two additional treasure cards are added in y... | {
"repo_name": "apepkuss/DominionGame",
"path": "source/unittest2.py",
"copies": "1",
"size": "2185",
"license": "mit",
"hash": -7751821628699512000,
"line_mean": 30.6811594203,
"line_max": 93,
"alpha_frac": 0.6352402746,
"autogenerated": false,
"ratio": 3.507223113964687,
"config_test": false,
... |
__author__ = 'liux4@onid.oregonstate.edu'
import sys
import enums
import dominion
def runBureaucratTestCase1():
"""
Precondition: There should be at least a Bureaucrat card in hand.
The opponent has a Victory card in the hand card at least.
Test case description: play the Bureaucrat car... | {
"repo_name": "apepkuss/DominionGame",
"path": "source/unittest5.py",
"copies": "1",
"size": "3387",
"license": "mit",
"hash": 5376179073836527000,
"line_mean": 33.9278350515,
"line_max": 96,
"alpha_frac": 0.5958074993,
"autogenerated": false,
"ratio": 3.6224598930481284,
"config_test": false,
... |
__author__ = 'liux4@onid.oregonstate.edu'
import sys
import enums
import dominion
def runBuycardTestCase1():
"""
This test case is designed to test invalid phase and the number of actions of the game.
"""
# The number of players
numPlayers = 2
# 10 kinds of kingdom cards
kingdomCards = ... | {
"repo_name": "apepkuss/DominionGame",
"path": "source/unittest14.py",
"copies": "1",
"size": "3627",
"license": "mit",
"hash": -2838574057418144300,
"line_mean": 28.7295081967,
"line_max": 91,
"alpha_frac": 0.664460987,
"autogenerated": false,
"ratio": 3.4152542372881354,
"config_test": true,
... |
__author__ = 'liux4@onid.oregonstate.edu'
import sys
import enums
import dominion
def runCellarTestCase1():
"""
Precondition: There should be at least a cellar card in hand.
Test case description: play the cellar card in hand, and discard 2 hand cards.
Expected result: The number of hand cards = curr... | {
"repo_name": "apepkuss/DominionGame",
"path": "source/unittest6.py",
"copies": "1",
"size": "1733",
"license": "mit",
"hash": -3580255990118147000,
"line_mean": 28.3728813559,
"line_max": 92,
"alpha_frac": 0.6353144836,
"autogenerated": false,
"ratio": 3.529531568228106,
"config_test": false,
... |
__author__ = 'liux4@onid.oregonstate.edu'
import sys
import enums
import dominion
def runChancellorTestCase1():
"""
Precondition: There should be at least a chancellor card in hand.
Test case description: play the cellar card in hand, and discard 2 hand cards.
Expected result: The number of hand card... | {
"repo_name": "apepkuss/DominionGame",
"path": "source/unittest7.py",
"copies": "1",
"size": "1949",
"license": "mit",
"hash": -3691442598500846000,
"line_mean": 30.9508196721,
"line_max": 107,
"alpha_frac": 0.6495638789,
"autogenerated": false,
"ratio": 3.413309982486865,
"config_test": false,... |
__author__ = 'liux4@onid.oregonstate.edu'
import sys
import enums
import dominion
def runCouncilroomTestCase1():
"""
Precondition: there should be at least a councilroom card in hand.
Test case description: play the councilroom card in hand.
Expected result: The number of the hand cards of each other... | {
"repo_name": "apepkuss/DominionGame",
"path": "source/unittest4.py",
"copies": "1",
"size": "2243",
"license": "mit",
"hash": -8758579563270439000,
"line_mean": 30.6056338028,
"line_max": 88,
"alpha_frac": 0.6344181899,
"autogenerated": false,
"ratio": 3.554675118858954,
"config_test": false,
... |
__author__ = 'liux4@onid.oregonstate.edu'
import sys
import enums
import dominion
def runFestivalTestCase1():
"""
Precondition: There should be at least a festival card in hand.
Test case description: play the festival card in hand.
Expected result: +2 actions, +2 coins, and +1 Buy.
"""
# Th... | {
"repo_name": "apepkuss/DominionGame",
"path": "source/unittest8.py",
"copies": "1",
"size": "1755",
"license": "mit",
"hash": 414386171393569800,
"line_mean": 27.7704918033,
"line_max": 107,
"alpha_frac": 0.6313390313,
"autogenerated": false,
"ratio": 3.3815028901734103,
"config_test": false,
... |
__author__ = 'liux4@onid.oregonstate.edu'
import sys
import enums
import dominion
def runLaboratoryTestCase1():
"""
Precondition: There should be at least a laboratory card in hand.
Test case description: play the laboratory card in hand.
Expected result: +2 cards in hand and +1 action.
"""
... | {
"repo_name": "apepkuss/DominionGame",
"path": "source/unittest9.py",
"copies": "1",
"size": "1708",
"license": "mit",
"hash": 3701937124516818400,
"line_mean": 27.9491525424,
"line_max": 91,
"alpha_frac": 0.6364168618,
"autogenerated": false,
"ratio": 3.550935550935551,
"config_test": false,
... |
__author__ = 'liux4@onid.oregonstate.edu'
import sys
import enums
import dominion
def runSeahagTestCase1():
"""
Precondition: There should be at least a seahag card in hand.
Test case description: play the seahag card in hand.
Expected result: Each other player discards the top card of his deck,
... | {
"repo_name": "apepkuss/DominionGame",
"path": "source/unittest10.py",
"copies": "1",
"size": "2219",
"license": "mit",
"hash": -2984526469485932000,
"line_mean": 28.9864864865,
"line_max": 107,
"alpha_frac": 0.6047769265,
"autogenerated": false,
"ratio": 3.5,
"config_test": false,
"has_no_ke... |
__author__ = 'liux4@onid.oregonstate.edu'
import sys
import enums
import dominion
def runSmithyTestCase1():
"""
Precondition: There should be at least a smithy card in hand.
Test case description: play the smithy card in hand.
Expected result: your handsize +3.
"""
# The number of players
... | {
"repo_name": "apepkuss/DominionGame",
"path": "source/unittest11.py",
"copies": "1",
"size": "1557",
"license": "mit",
"hash": -6685782946049734000,
"line_mean": 26.3157894737,
"line_max": 88,
"alpha_frac": 0.6217084136,
"autogenerated": false,
"ratio": 3.3995633187772927,
"config_test": false... |
__author__ = 'liux4@onid.oregonstate.edu'
import sys
import enums
import dominion
def runVillageTestCase1():
"""
Precondition: There should be at least a village card in hand.
Test case description: play the village card in hand.
Expected result: +2 actions and +1 Card.
"""
# The number of p... | {
"repo_name": "apepkuss/DominionGame",
"path": "source/unittest12.py",
"copies": "1",
"size": "1675",
"license": "mit",
"hash": -2890445028080709600,
"line_mean": 27.3898305085,
"line_max": 88,
"alpha_frac": 0.632238806,
"autogenerated": false,
"ratio": 3.50418410041841,
"config_test": false,
... |
__Author__ = 'LiuXiaozeeee'
class Solution(object):
def myAtoi(self, string):
"""
:param string: str
:return: int
"""
l = list(string)
aim = 0
# ctrl 标记变量,0 表示在前字符串, 1 表示在数字中 2 表示在后字符串
ctrl = 0
mulsub = [0, 0, 0]
flag = 1
for... | {
"repo_name": "LiuXiaozeeee/OnlineJudge",
"path": "src/leet8StringtoInteger(atoi).py",
"copies": "1",
"size": "1272",
"license": "mit",
"hash": 7995191900355990000,
"line_mean": 28.8536585366,
"line_max": 59,
"alpha_frac": 0.3439542484,
"autogenerated": false,
"ratio": 3.457627118644068,
"confi... |
__author__ = 'l.jones'
import survey
# Print the number of pregnancies
table = survey.Pregnancies()
table.ReadRecords(data_dir='../etc')
print 'Number of pregnancies', len(table)
# Print the number of live births
live_births = [r for r in table.records if r.outcome == 1]
print 'Number of live births:', len(live_bir... | {
"repo_name": "mrwizard82d1/think_stats",
"path": "think_stats/first.py",
"copies": "1",
"size": "1250",
"license": "epl-1.0",
"hash": -1751047723248893400,
"line_mean": 35.7941176471,
"line_max": 79,
"alpha_frac": 0.712,
"autogenerated": false,
"ratio": 3.109452736318408,
"config_test": false,... |
__author__ = 'lkoch'
import numpy as np
from scipy.stats import multivariate_normal
__all__ = [
'pdf',
'fit',
]
def fit(data):
"""
Estimate parameters of logistic normal distribution by estimating the multivariate gaussian distribution of the
logit-transformed data
:param data: array, ... | {
"repo_name": "lmkoch/logistic-normal",
"path": "logisticnormal/logisticnormal.py",
"copies": "1",
"size": "1991",
"license": "mit",
"hash": -1782525228046877200,
"line_mean": 25.5466666667,
"line_max": 120,
"alpha_frac": 0.5936715218,
"autogenerated": false,
"ratio": 3.5809352517985613,
"confi... |
__author__ = 'l.limin'
# -*- coding: utf8 -*-
import pyperclip
import time
import constants
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import TimeoutException, NoSuchElementException, WebDriverException
from selenium.webdriver.support.ui import WebDri... | {
"repo_name": "LevLimin/FearOrder",
"path": "FearOrder.py",
"copies": "1",
"size": "10291",
"license": "unlicense",
"hash": -906691110250383700,
"line_mean": 42.3691588785,
"line_max": 288,
"alpha_frac": 0.608512931,
"autogenerated": false,
"ratio": 2.7901383042693926,
"config_test": false,
"... |
import os
import glob
import numpy as np
import cv2
import codecs
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
np.random.seed(123)
nb_class = 36
letters = list('0123456789abcdefghijklmnopqrstuvwxyz')
model_p... | {
"repo_name": "lllcho/CAPTCHA-breaking",
"path": "test_type2.py",
"copies": "1",
"size": "2986",
"license": "mit",
"hash": 4837807095675923000,
"line_mean": 37.2820512821,
"line_max": 85,
"alpha_frac": 0.6299397187,
"autogenerated": false,
"ratio": 2.5987815491731943,
"config_test": false,
"h... |
import math
import numpy as np
import theano
import theano.tensor as T
flat = lambda L: sum(map(flat, L), []) if isinstance(L, list) else [L]
s1 = T.vector('s1')
s2 = T.vector('s2')
ce = T.nnet.categorical_crossentropy(s1, s2)
ccee = theano.function([s1, s2], ce, allow_input_downcast=True)
def get_align_terms(l, r, ... | {
"repo_name": "lllcho/CAPTCHA-breaking",
"path": "util.py",
"copies": "1",
"size": "1940",
"license": "mit",
"hash": -5883734610004029000,
"line_mean": 22.3734939759,
"line_max": 70,
"alpha_frac": 0.5448453608,
"autogenerated": false,
"ratio": 2.8156748911465894,
"config_test": false,
"has_no... |
import cv2
import numpy as np
import cPickle
import codecs
import scipy.spatial.distance
from keras.regularizers import l2
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from util import *
model_path = './mode... | {
"repo_name": "lllcho/CAPTCHA-breaking",
"path": "test_type1.py",
"copies": "1",
"size": "6537",
"license": "mit",
"hash": 4994372479065851000,
"line_mean": 35.3166666667,
"line_max": 112,
"alpha_frac": 0.6037937892,
"autogenerated": false,
"ratio": 2.6670746634026927,
"config_test": false,
"... |
import cv2
import h5py
import codecs
import numpy as np
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.regularizers import l2
letters = list('0123456789abcdefghijklmnopqrstuvwxyz')
weigh... | {
"repo_name": "lllcho/CAPTCHA-breaking",
"path": "test_type5.py",
"copies": "1",
"size": "3732",
"license": "mit",
"hash": -245623544536188740,
"line_mean": 41.8965517241,
"line_max": 112,
"alpha_frac": 0.6637191854,
"autogenerated": false,
"ratio": 2.6887608069164264,
"config_test": false,
"... |
__author__ = 'lloy3317'
import os.path
import re
directoryToReadFiles = "3.9custom/esri"
fileToSave = "assets_in_esri_dijits.txt"
urlItems = []
fileContents = ""
def fileSeparationComment(filePath):
comment = "// -------------------------------------------------------------------\n// %s\n// ------------------... | {
"repo_name": "lheberlie/grunt-optimizer-cleanup",
"path": "parse_urls_esri_dijits.py",
"copies": "1",
"size": "1866",
"license": "apache-2.0",
"hash": 6047510154343934000,
"line_mean": 29.606557377,
"line_max": 167,
"alpha_frac": 0.4726688103,
"autogenerated": false,
"ratio": 4.596059113300493,
... |
__author__ = 'lloy3317'
import os.path
import re
themeName = "claro"
fileToRead = "3.9custom/dijit/themes/%s/%s.css" % (themeName, themeName)
fileToRead2 = "3.9custom/dijit/themes/%s/%s_rtl.css" % (themeName, themeName)
fileList = [fileToRead, fileToRead2]
fileToSave = "assets_in_%s_theme.txt" % themeName
#print f... | {
"repo_name": "lheberlie/grunt-optimizer-cleanup",
"path": "parse_urls_dojo_theme.py",
"copies": "1",
"size": "1775",
"license": "apache-2.0",
"hash": 4665591641548429000,
"line_mean": 26.3230769231,
"line_max": 167,
"alpha_frac": 0.5352112676,
"autogenerated": false,
"ratio": 3.9183222958057393,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.