text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'igobrilhante'
import matplotlib.mlab as mlab
import numpy as np
import random
import utils
def read_distribution(f):
print f
# Compute probability distribution
# return an array of cumulative probability
def compute_probability_distribution(arr, is_cum_sum=True):
# stats used - count
agg... | {
"repo_name": "igobrilhante/random-trajectory-generator",
"path": "utils/distribution_utils.py",
"copies": "1",
"size": "2830",
"license": "mit",
"hash": 8828591096958942000,
"line_mean": 23.6086956522,
"line_max": 71,
"alpha_frac": 0.6431095406,
"autogenerated": false,
"ratio": 3.600508905852417... |
__author__ = 'igobrilhante'
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
from mpltools import style
import brewer2mpl
from mpltools import layout
style.use('ggplot')
figsize = layout.figaspect(scale=0.8)
fig, axes = plt.subplots(figsize=figsize)
axes.xaxis.label.set_color('#000000')
axes.yaxis.lab... | {
"repo_name": "igobrilhante/random-trajectory-generator",
"path": "plots/plot_community_size.py",
"copies": "1",
"size": "1895",
"license": "mit",
"hash": -6729874216452556000,
"line_mean": 25.6901408451,
"line_max": 172,
"alpha_frac": 0.6928759894,
"autogenerated": false,
"ratio": 2.703281027104... |
__author__ = 'igobrilhante'
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import numpy as np
from mpltools import style
import brewer2mpl
from mpltools import layout
style.use('ggplot')
figsize = layout.figaspect(scale=0.8)
fig, axes = plt.subplots(figsize=figsize)
axes.xaxis.label.set_color('#0000... | {
"repo_name": "igobrilhante/random-trajectory-generator",
"path": "plots/plot_compactness.py",
"copies": "1",
"size": "3027",
"license": "mit",
"hash": 7757040280202226000,
"line_mean": 34.1976744186,
"line_max": 214,
"alpha_frac": 0.6597291047,
"autogenerated": false,
"ratio": 2.76691042047532,
... |
__author__ = 'igobrilhante'
import psycopg2
import numpy as np
import matplotlib.mlab as mlab
import utils
DSN = "dbname=igo"
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
def query(q):
conn = psycopg2.connect(DSN)
curs = conn.cursor()
curs.execute(q)
res = curs.fetchall()
r = []
for e in res:
... | {
"repo_name": "igobrilhante/random-trajectory-generator",
"path": "utils/db_utils.py",
"copies": "1",
"size": "7979",
"license": "mit",
"hash": 2524793548721946000,
"line_mean": 30.7888446215,
"line_max": 165,
"alpha_frac": 0.5241258303,
"autogenerated": false,
"ratio": 3.4392241379310344,
"con... |
__author__ = 'igobrilhante'
import math
import numpy as np
import matplotlib.mlab as mpl
R_EARTH = 6371000
def meters2degree( meters ):
return meters * (180 / math.pi / R_EARTH)
def degree2meters( degree ):
return degree / (180 / math.pi / R_EARTH)
# Compute the distance between two places
# return the... | {
"repo_name": "igobrilhante/random-trajectory-generator",
"path": "utils/utils.py",
"copies": "1",
"size": "1771",
"license": "mit",
"hash": -7072921468975375000,
"line_mean": 20.8765432099,
"line_max": 79,
"alpha_frac": 0.6036137775,
"autogenerated": false,
"ratio": 2.8890701468189235,
"config... |
__author__ = 'igomez'
t9_map = {"2": ["a", "b", "c", ],
"3": ["d", "e", "f", ],
"4": ["g", "h", "i", ],
"5": ["j", "k", "l", ],
"6": ["m", "n", "o", ],
"7": ["p", "q", "r", "s", ],
"8": ["t", "u", "v", ],
"9": ["w", "x", "y", "z", ],
"0": ... | {
"repo_name": "imarban/CodeJam",
"path": "Python/t9_spelling/T9.py",
"copies": "1",
"size": "1248",
"license": "apache-2.0",
"hash": 7594561253821860000,
"line_mean": 26.1304347826,
"line_max": 82,
"alpha_frac": 0.4166666667,
"autogenerated": false,
"ratio": 3.183673469387755,
"config_test": fa... |
__author__ = 'Igor Jurkowski'
from serial.tools.list_ports import comports
from serial import Serial
import serial
def get_ports():
global port_dictionary
ports = comports()
port_dictionary = dict([(x, y) for y, x, _ in ports]) # dictionary Readable -> Name accepted py Serial
return sorted(port_dict... | {
"repo_name": "p4r4noj4/spectroscope-connector",
"path": "connector/rs232.py",
"copies": "1",
"size": "1262",
"license": "mit",
"hash": 2630098319540788000,
"line_mean": 20.0333333333,
"line_max": 119,
"alpha_frac": 0.6259904913,
"autogenerated": false,
"ratio": 3.1083743842364533,
"config_test... |
__author__ = 'igorkhomenko'
from boto.glacier.layer1 import Layer1
from boto.glacier.concurrent import ConcurrentUploader
class GlacierService:
def __init__(self, target_vault_name, region_name):
self.target_vault_name = target_vault_name
self.region_name = region_name
def upload_archive(se... | {
"repo_name": "soulfly/AWS-Glacier-backup-script",
"path": "glacier_service.py",
"copies": "1",
"size": "2831",
"license": "mit",
"hash": -6033084541957675000,
"line_mean": 32.7142857143,
"line_max": 108,
"alpha_frac": 0.5895443306,
"autogenerated": false,
"ratio": 3.78475935828877,
"config_tes... |
__author__ = 'igorkhomenko'
import httplib
class RestClient:
__API_URL__ = "https://api.quickblox.com"
def __init__(self, app_id, auth_key, auth_secret):
self.app_id = app_id
self.auth_key = auth_key
self.auth_secret = auth_secret
self.token = None
def create_session(se... | {
"repo_name": "soulfly/MehDoh-q-municate-chat-xmpp-bot",
"path": "rest_client.py",
"copies": "1",
"size": "2784",
"license": "mit",
"hash": 930706094028592900,
"line_mean": 31.0114942529,
"line_max": 117,
"alpha_frac": 0.6027298851,
"autogenerated": false,
"ratio": 3.845303867403315,
"config_te... |
__author__ = "Igor Maculan <n3wtron@gmail.com>"
import json
import logging
import time
from threading import Thread
import websocket
log = logging.getLogger("pushbullet.Listener")
WEBSOCKET_URL = "wss://stream.pushbullet.com/websocket/"
class Listener(Thread, websocket.WebSocketApp):
def __init__(self, accoun... | {
"repo_name": "randomchars/pushbullet.py",
"path": "pushbullet/listener.py",
"copies": "1",
"size": "2633",
"license": "mit",
"hash": 6063250074597747000,
"line_mean": 28.9204545455,
"line_max": 105,
"alpha_frac": 0.5742499051,
"autogenerated": false,
"ratio": 3.7507122507122506,
"config_test":... |
__author__ = 'Igor Maculan <n3wtron@gmail.com>'
import logging
import time
import json
from threading import Thread
import requests
import websocket
log = logging.getLogger('pushbullet.Listener')
WEBSOCKET_URL = 'wss://stream.pushbullet.com/websocket/'
class Listener(Thread, websocket.WebSocketApp):
def __in... | {
"repo_name": "duncanhawthorne/robot-robot",
"path": "libs/pushbullet/listener.py",
"copies": "2",
"size": "2712",
"license": "mit",
"hash": 3691885295388132400,
"line_mean": 31.6746987952,
"line_max": 109,
"alpha_frac": 0.5475663717,
"autogenerated": false,
"ratio": 4.005908419497785,
"config_... |
__author__ = 'igor'
import math
import random
def integr(a,b,n, func):
'''Метод правых прямоугольников'''
h = (b - a)/n
sm = 0
for i in range(0,n):
y = func(a+h*i)
sm += y*h
return sm
def integr_l(a,b,n, func):
'''Метод левых прямоугольников'''
h = (b - a)/n
sm = 0
... | {
"repo_name": "nesterione/problem-solving-and-algorithms",
"path": "algorithms/Python/integral.py",
"copies": "1",
"size": "3267",
"license": "apache-2.0",
"hash": -4200088300496762400,
"line_mean": 26.2522522523,
"line_max": 86,
"alpha_frac": 0.5373677249,
"autogenerated": false,
"ratio": 2.3351... |
__author__ = 'igor'
import pickle
import numpy as np
from loadData import *
from sklearn.ensemble import RandomForestClassifier
import pandas as pd
train, clean_train_views = load(remove_stopwords=True)
test, clean_test_views = load(test=True, remove_stopwords=True)
with open("data/clustring.pickle", "rb") as f:
... | {
"repo_name": "IgowWang/MyKaggle",
"path": "BagOfWordsMeetsBagsOfPopcorn/centroidmap.py",
"copies": "1",
"size": "1640",
"license": "apache-2.0",
"hash": 7673278870833924000,
"line_mean": 28.3035714286,
"line_max": 81,
"alpha_frac": 0.7115853659,
"autogenerated": false,
"ratio": 3.094339622641509... |
__author__ = 'igorpodobnik'
import datetime
from google.appengine.ext import ndb
class Sporocilo(ndb.Model):
sender = ndb.StringProperty()
reciever = ndb.StringProperty()
message = ndb.StringProperty()
created = ndb.DateTimeProperty(auto_now_add=True)
new = ndb.BooleanProperty(default=True)
cla... | {
"repo_name": "igorpodobnik/koncniprojek",
"path": "lib/models.py",
"copies": "1",
"size": "1237",
"license": "apache-2.0",
"hash": -1786415782627510500,
"line_mean": 30.7435897436,
"line_max": 53,
"alpha_frac": 0.722716249,
"autogenerated": false,
"ratio": 3.379781420765027,
"config_test": fal... |
__author__ = 'Igor'
import pandas as pd
from loadData import *
import nltk
import pickle
# Load the punkt tokenizer
tokenizer = nltk.data.load("tokenizers/punkt/english.pickle")
# 读取数据
train = pd.read_csv("data/labeledTrainData.tsv", header=0, delimiter="\t", quoting=3)
test = pd.read_csv("data/testData.... | {
"repo_name": "IgowWang/MyKaggle",
"path": "BagOfWordsMeetsBagsOfPopcorn/preprocess.py",
"copies": "1",
"size": "1492",
"license": "apache-2.0",
"hash": 4449739865669939000,
"line_mean": 28.0416666667,
"line_max": 97,
"alpha_frac": 0.6636615811,
"autogenerated": false,
"ratio": 3.2477477477477477... |
__author__ = 'Igor'
import pandas as pd
import nltk
from nltk.corpus import stopwords
import re
from bs4 import BeautifulSoup
TRAIN_FILE_PATH = "data/labeledTrainData.tsv"
TEST_FILE_PATH = "data/testData.tsv"
def load(test=False, remove_stopwords=False):
if test:
path = TEST_FILE_PATH
e... | {
"repo_name": "IgowWang/MyKaggle",
"path": "BagOfWordsMeetsBagsOfPopcorn/loadData.py",
"copies": "1",
"size": "1453",
"license": "apache-2.0",
"hash": 9113217691833196000,
"line_mean": 27.2666666667,
"line_max": 88,
"alpha_frac": 0.6066818527,
"autogenerated": false,
"ratio": 2.74375,
"config_t... |
__author__ = 'igorsf@gmail.com (Igor Fridman)'
import logging
import requests
logger = logging.getLogger(__name__)
class OutlookService():
OUTLOOK_SERVICE_URL = "https://outlook.office365.com/api/v1.0/users('{0}')"
def __init__(self, credentials):
self.credentials = credentials
def messages(se... | {
"repo_name": "igorsf/office365-api-python-client",
"path": "service.py",
"copies": "1",
"size": "3733",
"license": "mit",
"hash": -7308076423383992000,
"line_mean": 31.7543859649,
"line_max": 137,
"alpha_frac": 0.5464773641,
"autogenerated": false,
"ratio": 4.208568207440812,
"config_test": fa... |
__author__ = 'igorsf@gmail.com (Igor Fridman)'
import requests
import datetime
import logging
import uuid
import time
import json
import base64
import rsa
from requests.auth import HTTPBasicAuth
logger = logging.getLogger(__name__)
# Constant strings for OAuth2 flow
# The OAuth authority
AUTHORITY = 'https://login.m... | {
"repo_name": "igorsf/office365-api-python-client",
"path": "client.py",
"copies": "1",
"size": "8641",
"license": "mit",
"hash": -9038692574413716000,
"line_mean": 32.75390625,
"line_max": 119,
"alpha_frac": 0.6190255757,
"autogenerated": false,
"ratio": 3.9223785746709035,
"config_test": fals... |
__author__ = 'II'
# encoding: UTF-8
import csvkit
import urllib
'''Func to get addr from moscow-buildings.csv (from reformazkh, from hubofdata.ru dataset of buildings age)
we must from 'проезд Загорьевский д.11' get '%EF%F0%EE%E5%E7%E4%20%C7%E0%E3%EE%F0%FC%E5%E2%F1%EA%E8%E9%20%E4.11' '''
def reencode(file):
for... | {
"repo_name": "mithron/GMRParser",
"path": "addr_prep.py",
"copies": "1",
"size": "1039",
"license": "mit",
"hash": 2312251781273398000,
"line_mean": 38.2692307692,
"line_max": 133,
"alpha_frac": 0.6529411765,
"autogenerated": false,
"ratio": 2.865168539325843,
"config_test": false,
"has_no_k... |
from traits.api import HasTraits, Str, Int, Array, List, \
Instance, on_trait_change, Property, Button
from pyface.api import GUI
from traitsui.api import View, Item, HGroup, Group, \
ListEditor, TabularEditor, spring, TextEditor, Controller, VSplit
from traitsui.tabular_adapter import TabularAdapter
from... | {
"repo_name": "alexandreleroux/mayavi",
"path": "mayavi/tools/data_wizards/csv_loader.py",
"copies": "5",
"size": "7005",
"license": "bsd-3-clause",
"hash": 4577896895442275300,
"line_mean": 32.8405797101,
"line_max": 78,
"alpha_frac": 0.4499643112,
"autogenerated": false,
"ratio": 4.954031117397... |
# TODO: should derive from HasTraits
import csv
# FIXME: see loadtxt.py (should really be the loadtxt from numpy)
from mayavi.tools.data_wizards.loadtxt import loadtxt
class Sniff(object):
""" Sniff a CSV file and determine some of it's properties.
The properties determined here allow an CSV of unknow... | {
"repo_name": "liulion/mayavi",
"path": "mayavi/tools/data_wizards/csv_sniff.py",
"copies": "2",
"size": "6242",
"license": "bsd-3-clause",
"hash": -5835927646618694000,
"line_mean": 30.5252525253,
"line_max": 77,
"alpha_frac": 0.512816405,
"autogenerated": false,
"ratio": 4.14200398142004,
"co... |
"""\
egginst is a simple tool for installing and uninstalling eggs. The tool
is brain dead in the sense that it does not care if the eggs it installs
are for the correct platform, it's dependencies got installed, another
package needs to be uninstalled prior to the install, and so on. Those tasks
are responsibilities... | {
"repo_name": "jwiggins/keyenst",
"path": "egginst/main.py",
"copies": "1",
"size": "12507",
"license": "bsd-3-clause",
"hash": 7407255016950273000,
"line_mean": 30.0347394541,
"line_max": 79,
"alpha_frac": 0.5344207244,
"autogenerated": false,
"ratio": 3.783121597096189,
"config_test": false,
... |
"""\
ironpkg is a simple tool for installing and uninstalling eggs. The tool
is brain dead in the sense that it does not care if the eggs it installs
are for the correct platform, it's dependencies got installed, another
package needs to be uninstalled prior to the install, and so on. Those tasks
are responsibilities... | {
"repo_name": "ilanschnell/ironpkg",
"path": "egginst/main.py",
"copies": "1",
"size": "8978",
"license": "bsd-3-clause",
"hash": -3385187553315304400,
"line_mean": 29.4338983051,
"line_max": 79,
"alpha_frac": 0.5351971486,
"autogenerated": false,
"ratio": 3.8188005104210974,
"config_test": fal... |
__author__ = 'Ilan Smoly'
import logging, os.path
class Logger:
"""
This class will provide the interface for a logger.
Author
------
Ilan Smoly
Parameters
----------
name : String
The name of this logger.
log_dir : String
The path for the log... | {
"repo_name": "bashao/FermBot",
"path": "Logger.py",
"copies": "1",
"size": "2872",
"license": "mit",
"hash": -1645214546947950300,
"line_mean": 25.8411214953,
"line_max": 93,
"alpha_frac": 0.5344707521,
"autogenerated": false,
"ratio": 4.404907975460123,
"config_test": false,
"has_no_keyword... |
__author__ = 'ilblackdragon@gmail.com'
from pymisc import log, decorators
class RegisterSystem(object):
interfaces = []
classes = []
@classmethod
@decorators.logprint(log)
def register(self, cls):
if cls.__name__[0] == 'I':
print("Regirstring interface `%s`" % cls.__name__)
... | {
"repo_name": "ilblackdragon/pymisc",
"path": "pymisc/abstract.py",
"copies": "1",
"size": "1152",
"license": "mit",
"hash": -1944659748462521900,
"line_mean": 27.8,
"line_max": 84,
"alpha_frac": 0.5529513889,
"autogenerated": false,
"ratio": 3.931740614334471,
"config_test": false,
"has_no_k... |
__author__ = 'Illia Daynatowicz'
import sys
sys.stderr = open("errors.txt", "w+")
class DMatrix:
def __init__(self, n):
self.n = n
self.stage = 0
self.matrix = []
self.path_matrix = []
for i in range(0, n):
self.matrix.append([])
self.path... | {
"repo_name": "BeatC/FloydPython",
"path": "main.py",
"copies": "1",
"size": "3940",
"license": "mit",
"hash": -7953490044272402000,
"line_mean": 38.2040816327,
"line_max": 105,
"alpha_frac": 0.454822335,
"autogenerated": false,
"ratio": 3.1774193548387095,
"config_test": false,
"has_no_keywo... |
'''
第 0000 题:
将你的 QQ 头像(或者微博头像)右上角加上红色的数字,
类似于微信未读信息数量那种提示效果.
'''
from PIL import Image, ImageDraw, ImageFont
import sys, shutil
# backup file
# @return nothing
def back_file(filename):
p = filename.rfind('.')
shutil.copyfile(filename, filename[:p] + '_bak' + filename[p:])
# add number to right top corner... | {
"repo_name": "wangjun/python",
"path": "illuz/0000/0000_add_number_to_image.py",
"copies": "40",
"size": "1863",
"license": "mit",
"hash": -4003431119436176000,
"line_mean": 25.1029411765,
"line_max": 86,
"alpha_frac": 0.5735211268,
"autogenerated": false,
"ratio": 2.7182235834609494,
"config_... |
__author__ = 'iLTeoooD'
import os
__max = 999999999
def __inputcheck(msg, n=0):
while n <= 0:
try:
n = int(input(msg))
except ValueError:
print("[ERROR]: Input not valid.")
n = 0
return n
if __name__=="__main__":
n = __inputcheck("How many file do you ... | {
"repo_name": "ilteoood/PyScript-Collection",
"path": "FileGen.py",
"copies": "1",
"size": "1098",
"license": "unlicense",
"hash": 5549838028004759000,
"line_mean": 29.5277777778,
"line_max": 103,
"alpha_frac": 0.5009107468,
"autogenerated": false,
"ratio": 3.530546623794212,
"config_test": fal... |
__author__ = 'iLTeoooD'
import os
__max = 999999999
path = "";inp = " ";n=0
input("***WARNING: THIS WILL OVERWRITE YOUR FILE, USE AT YOUR OWN RISK***\nPress enter to continue...")
while inp != "":
inp = input("Insert the path of the file: ")
if inp == "":
break
elif os.path.exists(i... | {
"repo_name": "ilteoood/PyScript-Collection",
"path": "FileDestroyer.py",
"copies": "1",
"size": "1237",
"license": "unlicense",
"hash": 6493561656820138000,
"line_mean": 31.5789473684,
"line_max": 103,
"alpha_frac": 0.5060630558,
"autogenerated": false,
"ratio": 3.4553072625698324,
"config_tes... |
__author__ = 'iLTeoooD'
from io import StringIO
from telebot import types
from SiteAlert import *
TOKEN = os.environ['SITE_ALERT_TOKEN']
site_alert = SiteAlert()
leng = ""
Array = {}
gen_markup = types.ReplyKeyboardRemove(selective=False)
wlcm_msg = "!\nWelcome to @SiteAlert_bot.\nCommands available:\n... | {
"repo_name": "ilteoood/SiteAlert-Python",
"path": "SiteAlert_bot.py",
"copies": "1",
"size": "10510",
"license": "bsd-2-clause",
"hash": -3264964404081654000,
"line_mean": 41.6099585062,
"line_max": 593,
"alpha_frac": 0.6378686965,
"autogenerated": false,
"ratio": 3.3450031826861872,
"config_t... |
import ffm
import numpy as np
from .base import FactorizationMachine
from sklearn.utils.testing import assert_array_equal
from .validation import check_array, assert_all_finite
class FMRecommender(FactorizationMachine):
""" Factorization Machine Recommender with pairwise (BPR) loss solver.
Parameters
-... | {
"repo_name": "ibayer/fastFM-fork",
"path": "fastFM/bpr.py",
"copies": "1",
"size": "2859",
"license": "bsd-3-clause",
"hash": -6673849315683306000,
"line_mean": 30.0760869565,
"line_max": 77,
"alpha_frac": 0.6002098636,
"autogenerated": false,
"ratio": 3.618987341772152,
"config_test": false,
... |
import ffm
import numpy as np
from sklearn.base import RegressorMixin
from .validation import check_consistent_length, check_array
from .base import (FactorizationMachine, BaseFMClassifier,
_validate_class_labels, _check_warm_start)
class FMRegression(FactorizationMachine, RegressorMixin):
"""... | {
"repo_name": "ibayer/fastFM-fork",
"path": "fastFM/als.py",
"copies": "1",
"size": "6016",
"license": "bsd-3-clause",
"hash": 2619725186698281500,
"line_mean": 30.8306878307,
"line_max": 80,
"alpha_frac": 0.5681515957,
"autogenerated": false,
"ratio": 3.764705882352941,
"config_test": false,
... |
import numbers
import warnings
import numpy as np
import scipy.sparse as sparse
def kendall_tau(a, b):
n_samples = a.shape[0]
assert a.shape == b.shape
n_concordant = 0
n_disconcordant = 0
for i in range(n_samples):
for j in range(i+1, n_samples):
if a[i] > a[j] and b[i] > b... | {
"repo_name": "macks22/fastFM",
"path": "fastFM/utils.py",
"copies": "1",
"size": "10695",
"license": "bsd-3-clause",
"hash": 471490950470523500,
"line_mean": 39.5113636364,
"line_max": 85,
"alpha_frac": 0.5995324918,
"autogenerated": false,
"ratio": 3.9876957494407157,
"config_test": false,
... |
import numpy as np
from sklearn.base import RegressorMixin
import ffm
from utils import check_array, check_consistent_length
from base import FactorizationMachine, BaseFMClassifier, _validate_class_labels
class FMRegression(FactorizationMachine, RegressorMixin):
""" Factorization Machine Regression trained wit... | {
"repo_name": "macks22/fastFM",
"path": "fastFM/sgd.py",
"copies": "1",
"size": "5433",
"license": "bsd-3-clause",
"hash": -2837293368369928700,
"line_mean": 28.8516483516,
"line_max": 79,
"alpha_frac": 0.5897294313,
"autogenerated": false,
"ratio": 3.6635198921105867,
"config_test": false,
"... |
import numpy as np
from sklearn.base import RegressorMixin
import ffm
from utils import check_consistent_length, check_array
from base import (FactorizationMachine, BaseFMClassifier,
_validate_class_labels, _check_warm_start)
class FMRegression(FactorizationMachine, RegressorMixin):
""" Facto... | {
"repo_name": "macks22/fastFM",
"path": "fastFM/als.py",
"copies": "1",
"size": "6002",
"license": "bsd-3-clause",
"hash": 3588655229663697000,
"line_mean": 30.5894736842,
"line_max": 80,
"alpha_frac": 0.5679773409,
"autogenerated": false,
"ratio": 3.777218376337319,
"config_test": false,
"ha... |
import numpy as np
import scipy.sparse as sp
from fastFM import bpr
from fastFM import utils
def get_test_problem(task='regression'):
X = sp.csc_matrix(np.array([[6, 1],
[2, 3],
[3, 0],
[6, 1],
... | {
"repo_name": "ibayer/fastFM-fork",
"path": "fastFM/tests/test_ranking.py",
"copies": "1",
"size": "1599",
"license": "bsd-3-clause",
"hash": 7639773201000078000,
"line_mean": 28.0727272727,
"line_max": 65,
"alpha_frac": 0.5053158224,
"autogenerated": false,
"ratio": 2.9232175502742233,
"config... |
import numpy as np
import scipy.sparse as sp
from sklearn import metrics
from fastFM import als
def get_test_problem(task='regression'):
X = sp.csc_matrix(np.array([[6, 1],
[2, 3],
[3, 0],
[6, 1],
... | {
"repo_name": "ibayer/fastFM-fork",
"path": "fastFM/tests/test_base.py",
"copies": "2",
"size": "1180",
"license": "bsd-3-clause",
"hash": 302530364943058000,
"line_mean": 27.7804878049,
"line_max": 60,
"alpha_frac": 0.5152542373,
"autogenerated": false,
"ratio": 2.972292191435768,
"config_test... |
import numpy as np
import scipy.sparse as sp
from sklearn import metrics
from fastFM import mcmc
from fastFM.datasets import make_user_item_regression
from sklearn.metrics import mean_squared_error
from sklearn.utils.testing import assert_almost_equal, assert_array_equal
def get_test_problem(task='regression'):
... | {
"repo_name": "macks22/fastFM",
"path": "fastFM/tests/test_mcmc.py",
"copies": "1",
"size": "4424",
"license": "bsd-3-clause",
"hash": 8285480043173266000,
"line_mean": 33.2945736434,
"line_max": 87,
"alpha_frac": 0.6123417722,
"autogenerated": false,
"ratio": 2.7025045815516187,
"config_test":... |
import numpy as np
import scipy.sparse as sp
from sklearn.metrics import mean_squared_error, r2_score
from .validation import check_random_state
from ffm import ffm_predict
def make_user_item_regression(random_state=123, n_user=20, n_item=20,
label_stdev=0.4, rank=2, bias=True,
... | {
"repo_name": "ibayer/fastFM-fork",
"path": "fastFM/datasets.py",
"copies": "1",
"size": "2177",
"license": "bsd-3-clause",
"hash": -2906903532921626000,
"line_mean": 35.2833333333,
"line_max": 75,
"alpha_frac": 0.5980707395,
"autogenerated": false,
"ratio": 2.872031662269129,
"config_test": tr... |
import numpy as np
import ffm
from utils import check_array, assert_all_finite
from base import FactorizationMachine
class FMRecommender(FactorizationMachine):
""" Factorization Machine Recommender with pairwise (BPR) loss solver.
Parameters
----------
n_iter : int, optional
The number of ... | {
"repo_name": "macks22/fastFM",
"path": "fastFM/bpr.py",
"copies": "1",
"size": "2807",
"license": "bsd-3-clause",
"hash": -4164117171759651000,
"line_mean": 29.5108695652,
"line_max": 77,
"alpha_frac": 0.5960099751,
"autogenerated": false,
"ratio": 3.6172680412371134,
"config_test": false,
"... |
import scipy.sparse as sparse
import numpy as np
def multiclass_to_ranking(X, y):
n_classes = y.shape[1]
n_samples = X.shape[0]
# create extended X matrix
X_features = X.copy()
for i in range(n_classes - 1):
X_features = sparse.vstack([X_features, X])
X_labels = None
for i in ra... | {
"repo_name": "macks22/fastFM",
"path": "fastFM/transform.py",
"copies": "1",
"size": "3281",
"license": "bsd-3-clause",
"hash": 8529885332386772000,
"line_mean": 24.8346456693,
"line_max": 71,
"alpha_frac": 0.5812252362,
"autogenerated": false,
"ratio": 3.832943925233645,
"config_test": false,... |
import ffm
import numpy as np
from sklearn.base import RegressorMixin
from .validation import check_array, check_consistent_length
from .base import (FactorizationMachine, BaseFMClassifier,
_validate_class_labels)
class FMRegression(FactorizationMachine, RegressorMixin):
""" Factorization Ma... | {
"repo_name": "ibayer/fastFM-fork",
"path": "fastFM/sgd.py",
"copies": "1",
"size": "5465",
"license": "bsd-3-clause",
"hash": 7360759665518100000,
"line_mean": 28.8633879781,
"line_max": 79,
"alpha_frac": 0.5875571821,
"autogenerated": false,
"ratio": 3.665325285043595,
"config_test": false,
... |
import logging, sys, getopt, re
class vcf:
def __init__(self, proband_index = None, num_affected = None, absent = None, snv = None, indel = None, pedigree = None, output = None):
self.proband = None
if proband_index != None:
self.proband = int(proband_index)
self.num_affected = None
if num_affected !=... | {
"repo_name": "jf-test/solve-brain-jf",
"path": "vcf.py",
"copies": "2",
"size": "15738",
"license": "mit",
"hash": -5169150311107324000,
"line_mean": 36.5608591885,
"line_max": 639,
"alpha_frac": 0.6587241073,
"autogenerated": false,
"ratio": 2.7688247712878256,
"config_test": false,
"has_no... |
__author__ = 'imyousuf'
import ConfigParser
from abc import ABCMeta
import random
class AbstractBaseLoadGeneratorConfiguration(object):
__metaclass__ = ABCMeta
def __init__(self):
self._concurrent_requests = 10
self._runs_per_thread = 10
@property
def concurrent_requests(self):
... | {
"repo_name": "imyousuf/py-loadgen",
"path": "loadgen/configuration.py",
"copies": "1",
"size": "5955",
"license": "apache-2.0",
"hash": -8934431069143289000,
"line_mean": 38.7,
"line_max": 137,
"alpha_frac": 0.6297229219,
"autogenerated": false,
"ratio": 4.232409381663113,
"config_test": true,... |
__author__ = 'imyousuf'
import datetime
__BASE = datetime.datetime.fromtimestamp(0)
def get_current_time_in_millis():
a = datetime.datetime.now()
c = a - __BASE
return int((c.days * 24 * 60 * 60 + c.seconds) * 1000 + c.microseconds / 1000.0)
class ExecutionStat(object):
def __init__(self, group_name... | {
"repo_name": "imyousuf/py-loadgen",
"path": "loadgen/stat.py",
"copies": "1",
"size": "3562",
"license": "apache-2.0",
"hash": -8690507130509301000,
"line_mean": 29.186440678,
"line_max": 117,
"alpha_frac": 0.5962942167,
"autogenerated": false,
"ratio": 3.7181628392484343,
"config_test": false... |
__author__ = 'Indah'
def bin2decimal(binaryArray):
denominator=0;
numerator=0;
for i in range(0, len(binaryArray)):
denominator=denominator+(binaryArray[i] * (2 ** -(i + 1)))
numerator=numerator+(2**-(i+1))
genVal =denominator/numerator
return genVal
def binaryDecoding(ind, nVa... | {
"repo_name": "AiLaboratoryTelU/simple-genetic-algorithm",
"path": "simple_ga/module/chromosome.py",
"copies": "1",
"size": "1910",
"license": "apache-2.0",
"hash": -6798455324334750000,
"line_mean": 33.1071428571,
"line_max": 116,
"alpha_frac": 0.5931937173,
"autogenerated": false,
"ratio": 2.94... |
__author__ = 'Indah'
import random
from random import shuffle
# Crossover methods
# n point crossover can be used for binary representation and integer representation
def nPointCrossover(n, cr, indSize, parent1, parent2):
# cp=random.randrange(1,indSize)
cpr=random.random()
# random.random() choose rando... | {
"repo_name": "AiLaboratoryTelU/simple-genetic-algorithm",
"path": "simple_ga/module/evolutionOperator.py",
"copies": "1",
"size": "5243",
"license": "apache-2.0",
"hash": -7545902161986406000,
"line_mean": 29.488372093,
"line_max": 91,
"alpha_frac": 0.6070951745,
"autogenerated": false,
"ratio":... |
__author__ = 'Indah'
import random
import simple_ga.module.population as population
import simple_ga.module.chromosome as chromosome
import simple_ga.module.parentSelection as parentSelection
import simple_ga.module.evolutionOperator as evolutionOperator
import simple_ga.dataModel.inputDataModel as id
import simple_g... | {
"repo_name": "AiLaboratoryTelU/simple-genetic-algorithm",
"path": "simple_ga/module/geneticAlgorithmModule.py",
"copies": "1",
"size": "7296",
"license": "apache-2.0",
"hash": 6945844400148719000,
"line_mean": 37.8085106383,
"line_max": 114,
"alpha_frac": 0.5479714912,
"autogenerated": false,
"r... |
__author__ = 'Indah'
import random
import simple_ga.utility.utility as util
def binInit(popSize, indSize):
pop=[]
for i in range(0,popSize):
ind = [random.randrange(0,2) for x in range(indSize)]
# randrange(0, 2) chooses an integer in the range [0, 2)
pop.append(ind)
return pop
de... | {
"repo_name": "AiLaboratoryTelU/simple-genetic-algorithm",
"path": "simple_ga/module/population.py",
"copies": "1",
"size": "2917",
"license": "apache-2.0",
"hash": -7053414072480931000,
"line_mean": 30.7173913043,
"line_max": 99,
"alpha_frac": 0.6660953034,
"autogenerated": false,
"ratio": 3.535... |
__author__ = 'Indah'
import random
def randParentSelection(popSize):
idx1=random.randrange(0,popSize)
idx2=random.randrange(0,popSize)
while (idx1==idx2):
idx2=random.randrange(0,popSize)
return idx1,idx2
def rouletteWheel(popSize, fitness):
cf=[]
cVal=0;
for i in range(0,popSize... | {
"repo_name": "AiLaboratoryTelU/simple-genetic-algorithm",
"path": "simple_ga/module/parentSelection.py",
"copies": "1",
"size": "3321",
"license": "apache-2.0",
"hash": -515589362178775100,
"line_mean": 26.6833333333,
"line_max": 97,
"alpha_frac": 0.6437819934,
"autogenerated": false,
"ratio": 2... |
'''Author Indexer collects document authors, generating author pages.'''
import os
from mako.template import Template
from mako.lookup import TemplateLookup
from models import document as doc
from handlers.article_handler import article_handler
import markdown
class Indexer():
'''Provides indexer impl... | {
"repo_name": "NathanCastle/FoxyDox",
"path": "indexers/author_indexer/author_indexer.py",
"copies": "1",
"size": "4698",
"license": "mit",
"hash": 7656619500205191000,
"line_mean": 47.9787234043,
"line_max": 187,
"alpha_frac": 0.6128139634,
"autogenerated": false,
"ratio": 4.298261665141812,
"... |
__author__ = "Indika Piyasena"
import logging
import unittest
import re
from mappings.translate import Translate
logger = logging.getLogger(__name__)
class FrictionlessRegex:
def __init__(self):
pass
@staticmethod
def replace_one_keystroke(source, fmap):
# <keyboard-shortcut first-keys... | {
"repo_name": "indika/frictionless",
"path": "pycharm-remap/frictionless/frictionless_regex.py",
"copies": "1",
"size": "3608",
"license": "mit",
"hash": 5022616759006060000,
"line_mean": 34.3725490196,
"line_max": 149,
"alpha_frac": 0.6080931264,
"autogenerated": false,
"ratio": 3.79390115667718... |
__author__ = 'indiquant'
import os
import sqlite3
from qrymaker import qry_createtable
_DB = r'C:\temp\strat\webdata.sqlite3'
def dbname():
return _DB
def createfileifmissing(fname):
if not os.path.exists(fname):
open(fname, 'w')
def createtable(dbname, tname, colnames, coltypes, pkeys):
con... | {
"repo_name": "indiquant/webdata",
"path": "webdata/utils/dbhelper.py",
"copies": "1",
"size": "2127",
"license": "mit",
"hash": -4282408742074436600,
"line_mean": 17.4956521739,
"line_max": 66,
"alpha_frac": 0.5655853315,
"autogenerated": false,
"ratio": 3.2178517397881996,
"config_test": fals... |
__author__ = 'indiquant'
from datetime import date, datetime, time
from bs4 import BeautifulSoup
import time as tm
from webdata.scrapers.nse import *
from webdata.utils.dbhelper import *
DB = r'C:\temp\webdata.sqlite3'
NSE_OPN_EST = time(11, 30, 0)
NSE_CLS_EST = time(6, 30, 0)
NSE_OPTION_EXPIRIES = ['2016-09-29... | {
"repo_name": "indiquant/webdata",
"path": "examples/nse_options.py",
"copies": "1",
"size": "3204",
"license": "mit",
"hash": -1421567207618336800,
"line_mean": 27.8738738739,
"line_max": 97,
"alpha_frac": 0.574906367,
"autogenerated": false,
"ratio": 3.3514644351464433,
"config_test": false,
... |
__author__ = 'indiquant'
import urllib2
from bs4 import BeautifulSoup
from datetime import datetime
from enum import Enum
import pandas as pd
import logging
logging.basicConfig(format='%(levelname)s %(asctime)s:%(message)s', level=logging.DEBUG)
def get_options_nse(undl):
try:
undltype = _undltypes[und... | {
"repo_name": "indiquant/findl",
"path": "findl/weblib/nse.py",
"copies": "1",
"size": "8877",
"license": "mit",
"hash": 2517932015962085000,
"line_mean": 22.6746666667,
"line_max": 106,
"alpha_frac": 0.4898051143,
"autogenerated": false,
"ratio": 3.411606456571868,
"config_test": false,
"has... |
__author__ = 'indrajit'
__email__ = 'eendroroy@gmail.com'
class CaloricIntake(object):
def __init__(self, gender=None, weight=None, height=None, age=None, physical_activity_level=None):
self.__gender = gender
self.__weight = weight
self.__height = height
self.__age = age
se... | {
"repo_name": "openhealthalgorithms/openhealthalgorithms",
"path": "OHA/helpers/calculators/CaloricIntake.py",
"copies": "1",
"size": "2096",
"license": "apache-2.0",
"hash": -1089310826289405400,
"line_mean": 33.3606557377,
"line_max": 102,
"alpha_frac": 0.5691793893,
"autogenerated": false,
"ra... |
__author__ = 'indrajit'
__email__ = 'eendroroy@gmail.com'
class DiabetesParamsBuilder(object):
def __init__(self):
self.__gender = 'M'
self.__age = 40
self.__sbp = 135
self.__dbp = 145
self.__weight = 70
self.__weight_unit = 'kg'
self.__height = 1.75
... | {
"repo_name": "openhealthalgorithms/openhealthalgorithms",
"path": "OHA/param_builders/diabetes_param_builder.py",
"copies": "1",
"size": "1798",
"license": "apache-2.0",
"hash": 923569199628237700,
"line_mean": 24.6857142857,
"line_max": 47,
"alpha_frac": 0.4905450501,
"autogenerated": false,
"r... |
__author__ = 'indrajit'
__email__ = 'eendroroy@gmail.com'
class FraminghamParamsBuilder(object):
def __init__(self):
self.__gender = 'M'
self.__age = 40
self.__sbp = 140
self.__t_chol = None
self.__t_chol_unit = 'mg/dl'
self.__hdl_chol = None
self.__hdl_chol... | {
"repo_name": "openhealthalgorithms/openhealthalgorithms",
"path": "OHA/param_builders/framingham_param_builder.py",
"copies": "1",
"size": "1760",
"license": "apache-2.0",
"hash": -2923412311745271000,
"line_mean": 26.5,
"line_max": 57,
"alpha_frac": 0.5284090909,
"autogenerated": false,
"ratio"... |
__author__ = 'indrajit'
__email__ = 'eendroroy@gmail.com'
class SGFraminghamParamsBuilder(object):
def __init__(self):
self.__gender = 'male'
self.__ethnicity = 'chinese'
self.__age = 40
self.__sbp = 140
self.__t_chol = None
self.__t_chol_unit = 'mg/dl'
self... | {
"repo_name": "openhealthalgorithms/openhealthalgorithms",
"path": "OHA/param_builders/sg_framingham_param_builder.py",
"copies": "1",
"size": "1975",
"license": "apache-2.0",
"hash": -8244694642022296000,
"line_mean": 26.8169014085,
"line_max": 57,
"alpha_frac": 0.5321518987,
"autogenerated": fals... |
__author__ = 'indrajit'
__email__ = 'eendroroy@gmail.com'
class WhoParamsBuilder(object):
def __init__(self):
self.__gender = 'M'
self.__age = 40
self.__sbp1 = 140
self.__sbp2 = 160
self.__chol = 5
self.__chol_unit = 'mmol/l'
self.__smoker = False
se... | {
"repo_name": "openhealthalgorithms/openhealthalgorithms",
"path": "OHA/param_builders/who_param_builder.py",
"copies": "1",
"size": "1506",
"license": "apache-2.0",
"hash": -1284016368543633000,
"line_mean": 23.6885245902,
"line_max": 53,
"alpha_frac": 0.51062417,
"autogenerated": false,
"ratio"... |
__author__ = 'Inego'
import re
vowels = ('а', 'я', 'э', 'е', 'ы', 'и', 'о', 'ё', 'у', 'ю')
rare = ('х', 'ц', 'ч', 'ш', 'щ')
voiceless = ('к', 'п', 'с', 'т', 'ф', 'х', 'ц', 'ч', 'ш', 'щ')
NO_OBSCENE = True
def bad_A(p, grp, grqty, prev):
if grp < 0:
return True
return False
def bad_B(p, grp, grq... | {
"repo_name": "Inego/CyrNumbers",
"path": "CyrNumbers.py",
"copies": "1",
"size": "8628",
"license": "unlicense",
"hash": -9183512123411369000,
"line_mean": 19.9826732673,
"line_max": 108,
"alpha_frac": 0.5056033974,
"autogenerated": false,
"ratio": 2.8803941556235135,
"config_test": false,
"... |
from graphics import *
import time
f = open('generated_input.txt', 'r')
win = GraphWin('Coordinate Plane', 1000, 1000) # give title and dimensions
given_point_order = []
for line in f:
print line
numbers = line.split();
x = int(numbers[0])
y = int(numbers[1])
pt = Point( x, y )
pt.draw(win)
... | {
"repo_name": "gwydirsam/315_traveling_salesman_analyzer",
"path": "analyzer.py",
"copies": "2",
"size": "1288",
"license": "mit",
"hash": 6972898543296029000,
"line_mean": 28.9534883721,
"line_max": 75,
"alpha_frac": 0.524068323,
"autogenerated": false,
"ratio": 3.27735368956743,
"config_test"... |
import time
import string
import circuits as c
from graphics import *
#previous is kept to check if the file has changed
prev_steps = -1
steps = []
class Canvas:
"""Object responsible for the drawing window and holds all steps to be drawn"""
#graphics.py window to bind to
window = None
#Keeps window f... | {
"repo_name": "gwydirsam/Eugenics",
"path": "lookingglass/visualize.py",
"copies": "1",
"size": "5334",
"license": "mit",
"hash": -9217519993244710000,
"line_mean": 32.5471698113,
"line_max": 104,
"alpha_frac": 0.5,
"autogenerated": false,
"ratio": 4.016566265060241,
"config_test": false,
"ha... |
import RPi.GPIO as GPIO
import time
import os
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT)
# Now we will start with a PWM signal at 50Hz at pin 11.
# 50Hz should work for many servos very will. If not you can play with
# the frequency if you like.
Servo = GPIO.PWM(4, 50)
#Servo.start(2.5... | {
"repo_name": "just4chill/imageprocessing",
"path": "python/servotest.py",
"copies": "2",
"size": "1265",
"license": "mit",
"hash": 4737992987841091000,
"line_mean": 22,
"line_max": 94,
"alpha_frac": 0.6790513834,
"autogenerated": false,
"ratio": 2.685774946921444,
"config_test": false,
"has_... |
__author__ = "Ionut Gorgos"
__copyright__ = "Copyright (C) 2016 Ionut Gorgos"
__license__ = "Public Domain"
__version__ = "1.0"
# This file implements a class for communication with FT245RL chip from FTDI
import pyftdi.ftdi
import pyftdi.bits
import pyftdi.spi
import pyftdi.usbtools
import time
class FTDI_USB:
d... | {
"repo_name": "IonutGorgos/fpga_comm",
"path": "FT245RL_ftdi.py",
"copies": "1",
"size": "1041",
"license": "bsd-3-clause",
"hash": -6076367581161343000,
"line_mean": 28.7428571429,
"line_max": 79,
"alpha_frac": 0.5033621518,
"autogenerated": false,
"ratio": 3.717857142857143,
"config_test": fa... |
__author__ = "Ionut Gorgos"
__copyright__ = "Copyright (C) 2016 Ionut Gorgos"
__license__ = "Public Domain"
__version__ = "1.0"
# This file implements a class for SASEBO_G
# Thanks AIST and Toshihiro Katashita
# http://web.archive.org/web/20110723090912/http://www.aist.go.jp/aist_e
# /research_results/publications/syn... | {
"repo_name": "IonutGorgos/fpga_comm",
"path": "sasebo_ftdi.py",
"copies": "1",
"size": "4605",
"license": "bsd-3-clause",
"hash": 1312279752505086700,
"line_mean": 36.1370967742,
"line_max": 79,
"alpha_frac": 0.4399565689,
"autogenerated": false,
"ratio": 3.4365671641791047,
"config_test": fal... |
__author__ = "Ionut Gorgos"
__copyright__ = "Copyright (C) 2016 Ionut Gorgos"
__license__ = "Public Domain"
__version__ = "1.0"
# This file implements a command line script to encrypt data to SASEBO G
import sasebo_ftdi
import binascii
from Crypto import Random
from Crypto.Cipher import AES
import argparse
def main... | {
"repo_name": "IonutGorgos/fpga_comm",
"path": "Ciphertext.py",
"copies": "1",
"size": "1938",
"license": "bsd-3-clause",
"hash": 7325548078117429000,
"line_mean": 27.9253731343,
"line_max": 77,
"alpha_frac": 0.5717234262,
"autogenerated": false,
"ratio": 3.588888888888889,
"config_test": false... |
__author__ = 'Ionut Gorgos'
from cnc_comm import *
from pico import *
from ciphertext import *
from sasebo_ftdi import *
from cnc_cmd import *
from picocmd import *
import struct
from array import array
def run_crypto(key, n_captures):
hw = sasebo_ftdi.SASEBO()
hw.open()
rand = Random.new()
hw.setK... | {
"repo_name": "IonutGorgos/fpga_comm",
"path": "clis.py",
"copies": "1",
"size": "9579",
"license": "bsd-3-clause",
"hash": 5253140199021898000,
"line_mean": 33.0889679715,
"line_max": 86,
"alpha_frac": 0.4423217455,
"autogenerated": false,
"ratio": 3.964817880794702,
"config_test": true,
"ha... |
__author__ = 'ioparaskev'
import re
import logging
class Response(object):
def __init__(self):
self.p_ans = tuple()
self.csens = 'off'
self.ans_restrict = None
self.regx = r''
self.str_restriction = lambda x: False
self.restrictions = dict(str_restr=False, regx=Fals... | {
"repo_name": "ioparaskev/schulze_voting",
"path": "prompt_handles.py",
"copies": "1",
"size": "5817",
"license": "mit",
"hash": 9070901347038717000,
"line_mean": 32.0568181818,
"line_max": 83,
"alpha_frac": 0.59583978,
"autogenerated": false,
"ratio": 4.478060046189376,
"config_test": false,
... |
__author__ = 'ioparaskev'
from collections import OrderedDict
from prompt_handles import PromptWrapper
class Voter(object):
def __init__(self, name):
self.__name = name
self.preference = None
def set_preference(self, pref):
self.preference = pref
@property
def name(self):
... | {
"repo_name": "ioparaskev/schulze_voting",
"path": "svote.py",
"copies": "1",
"size": "5186",
"license": "mit",
"hash": 2470074609652722000,
"line_mean": 34.5273972603,
"line_max": 106,
"alpha_frac": 0.5838796761,
"autogenerated": false,
"ratio": 3.766158315177923,
"config_test": false,
"has_... |
__author__ = 'ioparaskev'
from unittest import TestCase, mock
import prompt_handles
def mock_input(func):
def mock_input_builtin(*args):
with mock.patch('builtins.input', return_value=args[-1]):
return func(*args)
return mock_input_builtin
class TestPromptWrapper(TestCas... | {
"repo_name": "ioparaskev/schulze_voting",
"path": "tests/prompt_handles_tests.py",
"copies": "1",
"size": "4289",
"license": "mit",
"hash": 8155562111691982000,
"line_mean": 38.7222222222,
"line_max": 74,
"alpha_frac": 0.6507344369,
"autogenerated": false,
"ratio": 3.8260481712756467,
"config_... |
__author__ = 'iqbal'
import requests
from haversine import distance as compute_distance
def find_neighborhood(place_name, key):
try:
url1 = "https://maps.googleapis.com/maps/api/place/textsearch/json?query={0}&key={1}".format(place_name, key)
json_obj1 = requests.get(url1).json()
if "er... | {
"repo_name": "iqbalhusen/look_around",
"path": "look_around.py",
"copies": "1",
"size": "2659",
"license": "mit",
"hash": 8776751160218943000,
"line_mean": 39.2878787879,
"line_max": 183,
"alpha_frac": 0.5900714554,
"autogenerated": false,
"ratio": 3.80945558739255,
"config_test": false,
"ha... |
from fixture.orm import ORMFixture
from model.contact import Contact
from model.group import Group
import random
import pytest
db = ORMFixture(host="127.0.0.1", name="addressbook", user="root", password="")
# добавление первого попавшегося контакта в первую попавшуюся группу
def test_add_any_contact_in_any... | {
"repo_name": "IrishaCh/python_training",
"path": "test/test_add_contact_in_group.py",
"copies": "1",
"size": "2730",
"license": "apache-2.0",
"hash": -9001918257290550000,
"line_mean": 55.1086956522,
"line_max": 114,
"alpha_frac": 0.5907879711,
"autogenerated": false,
"ratio": 3.1919805589307413... |
from model.contact import Contact
import re
import pytest
def test_phones_on_home_page(app):
if app.contact.count() == 0:
with pytest.allure.step('If there is no contact I will add a new one'):
app.contact.add_contact(Contact(first_name="test" + app.libs.substring),
... | {
"repo_name": "IrishaCh/python_training",
"path": "test/test_phones.py",
"copies": "1",
"size": "2056",
"license": "apache-2.0",
"hash": 111188462677512620,
"line_mean": 50.7179487179,
"line_max": 127,
"alpha_frac": 0.6181906615,
"autogenerated": false,
"ratio": 3.5265866209262438,
"config_test... |
from model.group import Group
from model.contact import Contact
import re
import datetime
class CommonLib:
def __init__(self, app):
self.app = app
t = datetime.datetime.now()
self.substring = "_" + t.strftime("%d%m%Y") + "_" + t.strftime("%H%M%S")
def change_field_value(... | {
"repo_name": "IrishaCh/python_training",
"path": "fixture/libs.py",
"copies": "1",
"size": "1318",
"license": "apache-2.0",
"hash": -2735127664390130000,
"line_mean": 32.6842105263,
"line_max": 80,
"alpha_frac": 0.5735963581,
"autogenerated": false,
"ratio": 3.514666666666667,
"config_test": f... |
from model.group import Group
import random
import pytest
def test_delete_some_group(app, db, check_ui):
if len(db.get_group_list()) == 0:
with pytest.allure.step('If there is no group I will add a new one: Group(name="test")'):
app.group.create(Group(name="test"))
with pytest.all... | {
"repo_name": "IrishaCh/python_training",
"path": "test/test_del_group.py",
"copies": "1",
"size": "1263",
"license": "apache-2.0",
"hash": -282582736668200450,
"line_mean": 48.52,
"line_max": 106,
"alpha_frac": 0.6516231196,
"autogenerated": false,
"ratio": 3.5779036827195467,
"config_test": t... |
from model.group import Group
class GroupHelper:
def __init__(self, app):
self.app = app
def open_groups_page(self):
wd = self.app.wd
if not (wd.current_url.endswith("/group.php") and len(wd.find_elements_by_name("new")) > 0):
wd.find_element_by_link_text("grou... | {
"repo_name": "IrishaCh/python_training",
"path": "fixture/group.py",
"copies": "1",
"size": "4100",
"license": "apache-2.0",
"hash": 323084432091987840,
"line_mean": 32.7457627119,
"line_max": 100,
"alpha_frac": 0.5831707317,
"autogenerated": false,
"ratio": 3.037037037037037,
"config_test": f... |
from pony.orm import *
from datetime import datetime
from model.group import Group
from model.contact import Contact
from pymysql.converters import decoders
class ORMFixture:
db = Database()
class ORMGroup(db.Entity):
_table_ = 'group_list'
id = PrimaryKey(int, column='group_id'... | {
"repo_name": "IrishaCh/python_training",
"path": "fixture/orm.py",
"copies": "1",
"size": "3014",
"license": "apache-2.0",
"hash": 8602276713891131000,
"line_mean": 39.3150684932,
"line_max": 126,
"alpha_frac": 0.6516257465,
"autogenerated": false,
"ratio": 3.6666666666666665,
"config_test": f... |
__author__ = 'Irina.Chegodaeva'
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
from fixture.libs import CommonLib
class Application:
def __init__(self, browser, base_url):
if browser == "fir... | {
"repo_name": "IrishaCh/python_training",
"path": "fixture/application.py",
"copies": "1",
"size": "1376",
"license": "apache-2.0",
"hash": -7473315377919508000,
"line_mean": 32.4,
"line_max": 123,
"alpha_frac": 0.5959302326,
"autogenerated": false,
"ratio": 4.023391812865497,
"config_test": fa... |
__author__ = 'Irina.Chegodaeva'
from sys import maxsize
class Contact:
def __init__(self, first_name=None, middle_name=None, last_name=None, nickname=None, pic=None, title=None,
company_name=None, company_address=None, home_phone=None, mobile_phone=None, work_phone=None,
f... | {
"repo_name": "IrishaCh/python_training",
"path": "model/contact.py",
"copies": "1",
"size": "1988",
"license": "apache-2.0",
"hash": 7581464124822907000,
"line_mean": 39.4166666667,
"line_max": 117,
"alpha_frac": 0.5870221328,
"autogenerated": false,
"ratio": 3.4216867469879517,
"config_test":... |
import mysql.connector
from model.group import Group
from model.contact import Contact
from contextlib import closing
import urllib
class DbFixture:
pass
def __init__(self, host, name, user, password):
self.host = host
self.name = name
self.user = user
self.passw... | {
"repo_name": "IrishaCh/python_training",
"path": "fixture/db.py",
"copies": "1",
"size": "4013",
"license": "apache-2.0",
"hash": -3324661673366832600,
"line_mean": 45.2117647059,
"line_max": 120,
"alpha_frac": 0.4714677299,
"autogenerated": false,
"ratio": 4.315053763440861,
"config_test": fa... |
from pytest_bdd import given, when, then
from model.group import Group
import random
import pytest
@pytest.allure.step('Given a group list')
@given('a group list')
def group_list(db):
return db.get_group_list()
@pytest.allure.step('Given a group with name={name}, header={header} and footer={footer... | {
"repo_name": "IrishaCh/python_training",
"path": "bdd/group_steps.py",
"copies": "1",
"size": "2475",
"license": "apache-2.0",
"hash": -1838619036387519500,
"line_mean": 35.5303030303,
"line_max": 106,
"alpha_frac": 0.6674747475,
"autogenerated": false,
"ratio": 3.3,
"config_test": true,
"ha... |
import random
import string
import os.path
import jsonpickle
import sys
import getopt
from model.contact import Contact
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/contac... | {
"repo_name": "IrishaCh/python_training",
"path": "generator/contact.py",
"copies": "1",
"size": "3033",
"license": "apache-2.0",
"hash": 1857092468256818700,
"line_mean": 31.3296703297,
"line_max": 94,
"alpha_frac": 0.5044510386,
"autogenerated": false,
"ratio": 3.9034749034749034,
"config_tes... |
import random
import string
import os.path
import jsonpickle
import sys
import getopt
from model.group import Group
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/groups.jso... | {
"repo_name": "IrishaCh/python_training",
"path": "generator/group.py",
"copies": "1",
"size": "1099",
"license": "apache-2.0",
"hash": 3241475474408434700,
"line_mean": 24.8048780488,
"line_max": 113,
"alpha_frac": 0.6178343949,
"autogenerated": false,
"ratio": 3.1855072463768117,
"config_test... |
import random
import string
import os.path
import sys
import getopt
from model.group import Group
import time
import clr
clr.AddReferenceByName('Microsoft.Office.Interop.Excel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c')
from Microsoft.Office.Interop import Excel
try:
o... | {
"repo_name": "IrishaCh/ironpython_traning",
"path": "generator/group.py",
"copies": "1",
"size": "1476",
"license": "apache-2.0",
"hash": 4253427451158785500,
"line_mean": 21.09375,
"line_max": 124,
"alpha_frac": 0.6436314363,
"autogenerated": false,
"ratio": 2.993914807302231,
"config_test": ... |
__author__ = 'Irina.Chegodaeva'
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username, password):
wd = self.app.wd
self.app.open_home_page()
self.app.libs.change_field_value("user", username)
self.app.libs.change_field_value... | {
"repo_name": "IrishaCh/python_training",
"path": "fixture/session.py",
"copies": "1",
"size": "1288",
"license": "apache-2.0",
"hash": 6038917522787378000,
"line_mean": 27.2727272727,
"line_max": 73,
"alpha_frac": 0.5458074534,
"autogenerated": false,
"ratio": 3.519125683060109,
"config_test":... |
__author__ = 'iriyadays@gmail.com'
import collections
def find_hero_level(player, hero_type):
result = find(player, 'Heros', 'Type', hero_type)
if result:
return result
else:
return {'Level': ''}
def find_army_level(player, army_type):
result = find(player, 'Troops', 'Type', army_ty... | {
"repo_name": "iriya/MengHanYao",
"path": "helper.py",
"copies": "1",
"size": "1429",
"license": "apache-2.0",
"hash": 3092788762715678000,
"line_mean": 22.8166666667,
"line_max": 73,
"alpha_frac": 0.6046186144,
"autogenerated": false,
"ratio": 3.4768856447688563,
"config_test": false,
"has_n... |
__author__ = 'iriyadays@gmail.com'
import settings
import clanapi
import tornado.ioloop
import tornado.options
import tornado.web
import json
import helper
from tornado.options import define, options
define("port", default=8888, help="run on the given port", type=int)
clan_api = clanapi.ClanApi()
class IndexHandle... | {
"repo_name": "iriya/MengHanYao",
"path": "server.py",
"copies": "1",
"size": "1582",
"license": "apache-2.0",
"hash": 1154679488693104600,
"line_mean": 28.2962962963,
"line_max": 68,
"alpha_frac": 0.6359039191,
"autogenerated": false,
"ratio": 3.5233853006681515,
"config_test": false,
"has_n... |
__author__ = 'IronMan'
import io
import re
import email
import jsonpickle
import nlp
from nltk import word_tokenize
class MailParser:
def __init__(self, text):
self.text = text
def parse_thread(self):
msg = email.message_from_bytes(self.text)
print(msg.as_string())
topic = msg... | {
"repo_name": "suparngp/letswikit",
"path": "emails/mail_parser.py",
"copies": "1",
"size": "7145",
"license": "apache-2.0",
"hash": -6962472774151008000,
"line_mean": 34.725,
"line_max": 141,
"alpha_frac": 0.4785164451,
"autogenerated": false,
"ratio": 4.007291082445317,
"config_test": false,
... |
__author__ = 'IronMan'
from nltk import word_tokenize
from nltk import pos_tag
from nltk import sent_tokenize
import re
from nltk.text import Text
from nltk.text import TextCollection
keywords_tags = ['FW', 'JJ', 'JJS', 'JJR', 'JJS', 'NN', 'NNS', 'NNP', 'NNPS', 'VB', 'VBD', 'VBG', 'VBN', 'VBP', 'VBZ']
def keywords_... | {
"repo_name": "suparngp/letswikit",
"path": "emails/nlp.py",
"copies": "1",
"size": "2754",
"license": "apache-2.0",
"hash": 1125875940767803500,
"line_mean": 29.9438202247,
"line_max": 118,
"alpha_frac": 0.5893246187,
"autogenerated": false,
"ratio": 3.50381679389313,
"config_test": false,
"... |
__author__ = 'IRSEN'
# -*- coding: utf-8 -*-
import mysql.connector
from model.group import Group
from model.contact import Contact
class DbFixture:
def __init__(self, host, name, user, password):
self.host = host
self.name = name
self.user = user
self.password = password
... | {
"repo_name": "nyblinnn/python_training_for_testers",
"path": "fixture/db.py",
"copies": "1",
"size": "1816",
"license": "apache-2.0",
"hash": 7474268834264885000,
"line_mean": 38,
"line_max": 120,
"alpha_frac": 0.5883993307,
"autogenerated": false,
"ratio": 3.9844444444444442,
"config_test": f... |
__author__ = 'IRSEN'
# -*- coding: utf-8 -*-
from model.contact import Contact
import random
import string
import os.path
import jsonpickle
import getopt
import sys
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of groups", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit... | {
"repo_name": "nyblinnn/python_training_for_testers",
"path": "generator/contact.py",
"copies": "1",
"size": "1690",
"license": "apache-2.0",
"hash": -3602124660786371600,
"line_mean": 30.3148148148,
"line_max": 112,
"alpha_frac": 0.6414201183,
"autogenerated": false,
"ratio": 3.366533864541833,
... |
__author__ = 'IRSEN'
# -*- coding: utf-8 -*-
from model.group import Group
import random
import string
import os.path
import jsonpickle
import getopt
import sys
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of groups", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
... | {
"repo_name": "nyblinnn/python_training_for_testers",
"path": "generator/group.py",
"copies": "1",
"size": "1193",
"license": "apache-2.0",
"hash": -5496319329523069000,
"line_mean": 26.1363636364,
"line_max": 111,
"alpha_frac": 0.6286672255,
"autogenerated": false,
"ratio": 3.139473684210526,
... |
__author__ = 'IRSEN'
from pony.orm import *
from datetime import datetime
from model.group import Group
from model.contact import Contact
from pymysql.converters import decoders
class ORMFixture:
db = Database()
class ORMGroup(db.Entity):
_table_ = 'group_list'
id = PrimaryKey(int, column='g... | {
"repo_name": "nyblinnn/python_training_for_testers",
"path": "fixture/orm.py",
"copies": "1",
"size": "2576",
"license": "apache-2.0",
"hash": -2556525036512097000,
"line_mean": 39.619047619,
"line_max": 111,
"alpha_frac": 0.6571540266,
"autogenerated": false,
"ratio": 3.6386913229018494,
"con... |
__author__ = 'Irwan Fathurrahman <irwan@kartoza.com>'
__date__ = '10/05/17'
from campaign_manager.models.version import Version
class JsonModel(Version):
"""
Model that use json.
"""
json_path = ''
def parse_json_file(self):
return NotImplemented
def get_attributes(self):
""... | {
"repo_name": "meomancer/field-campaigner",
"path": "flask_project/campaign_manager/models/json_model.py",
"copies": "1",
"size": "1347",
"license": "bsd-3-clause",
"hash": 4016922151880590300,
"line_mean": 27.0625,
"line_max": 77,
"alpha_frac": 0.574610245,
"autogenerated": false,
"ratio": 4.196... |
__author__ = 'Irwan Fathurrahman <irwan@kartoza.com>'
__date__ = '10/05/17'
from datetime import datetime, date, timedelta
import bisect
import math
import copy
import hashlib
import requests
import shutil
import json
import os
import pygeoj
import time
from flask import render_template
from shapely import geometry a... | {
"repo_name": "meomancer/field-campaigner",
"path": "flask_project/campaign_manager/models/campaign.py",
"copies": "1",
"size": "27426",
"license": "bsd-3-clause",
"hash": -7702127226428835000,
"line_mean": 32.4463414634,
"line_max": 79,
"alpha_frac": 0.5297527893,
"autogenerated": false,
"ratio"... |
__author__ = 'Irwan Fathurrahman <irwan@kartoza.com>'
__date__ = '10/05/17'
from flask_wtf import FlaskForm
from wtforms.fields import (
DateField,
SelectField,
SelectMultipleField,
StringField,
SubmitField,
HiddenField,
TextAreaField,
RadioField,
BooleanField
)
from wtforms.validat... | {
"repo_name": "meomancer/field-campaigner",
"path": "flask_project/campaign_manager/forms/campaign.py",
"copies": "1",
"size": "3391",
"license": "bsd-3-clause",
"hash": 1574080366029396500,
"line_mean": 33.2525252525,
"line_max": 79,
"alpha_frac": 0.628133294,
"autogenerated": false,
"ratio": 4.... |
__author__ = 'Irwan Fathurrahman <irwan@kartoza.com>'
__date__ = '12/06/17'
import json
import requests
from app_config import Config
from urllib.error import HTTPError
from campaign_manager.utilities import multi_feature_to_polygon
from campaign_manager.data_providers._abstract_data_provider import (
AbstractData... | {
"repo_name": "meomancer/field-campaigner",
"path": "flask_project/campaign_manager/data_providers/_abstract_osmcha_provider.py",
"copies": "1",
"size": "2293",
"license": "bsd-3-clause",
"hash": 3336424957068854300,
"line_mean": 27.3086419753,
"line_max": 69,
"alpha_frac": 0.5111208024,
"autogener... |
__author__ = 'Irwan Fathurrahman <irwan@kartoza.com>'
__date__ = '13/06/17'
from app_config import Config
from datetime import datetime
from campaign_manager.insights_functions._abstract_insights_function import (
AbstractInsightsFunction
)
from campaign_manager.data_providers.osmcha_features_provider import (
... | {
"repo_name": "meomancer/field-campaigner",
"path": "flask_project/campaign_manager/insights_functions/osmcha_features.py",
"copies": "1",
"size": "3046",
"license": "bsd-3-clause",
"hash": -2609501112143958000,
"line_mean": 30.7291666667,
"line_max": 78,
"alpha_frac": 0.534471438,
"autogenerated":... |
__author__ = 'Irwan Fathurrahman <irwan@kartoza.com>'
__date__ = '16/05/17'
import datetime
import os
import subprocess
from subprocess import call
from app_config import Config
file_path = os.path.dirname(os.path.abspath(__file__))
git_folder = Config.campaigner_data_folder
def git_pull():
""" Pulling git.
... | {
"repo_name": "meomancer/field-campaigner",
"path": "flask_project/campaign_manager/git_utilities.py",
"copies": "1",
"size": "1471",
"license": "bsd-3-clause",
"hash": 6946552035679657000,
"line_mean": 20.3188405797,
"line_max": 69,
"alpha_frac": 0.5723997281,
"autogenerated": false,
"ratio": 3.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.