text stringlengths 0 1.05M | meta dict |
|---|---|
import sys
import numpy as np
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import SkipTest
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import asse... | {
"repo_name": "mugizico/scikit-learn",
"path": "sklearn/decomposition/tests/test_sparse_pca.py",
"copies": "142",
"size": "5990",
"license": "bsd-3-clause",
"hash": 7408535622196023000,
"line_mean": 35.975308642,
"line_max": 79,
"alpha_frac": 0.6313856427,
"autogenerated": false,
"ratio": 3.13612... |
import sys
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_equal
from .. import SparsePCA, MiniBatchSparsePCA, dict_learning_online
from ..sparse_pca import _update_code, _update_code_parallel
from ...utils import check_random_state
def generate_toy_data(n_atoms, n_samples, image_siz... | {
"repo_name": "joshbohde/scikit-learn",
"path": "sklearn/decomposition/tests/test_sparse_pca.py",
"copies": "1",
"size": "5976",
"license": "bsd-3-clause",
"hash": 3081326530110033400,
"line_mean": 36.8227848101,
"line_max": 79,
"alpha_frac": 0.6316934404,
"autogenerated": false,
"ratio": 3.04431... |
import sys
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_equal
from .. import SparsePCA, MiniBatchSparsePCA
from ...utils import check_random_state
def generate_toy_data(n_atoms, n_samples, image_size, random_state=None):
n_features = image_size[0] * image_size[1]
rng = ch... | {
"repo_name": "ominux/scikit-learn",
"path": "sklearn/decomposition/tests/test_sparse_pca.py",
"copies": "1",
"size": "5066",
"license": "bsd-3-clause",
"hash": -1772487469017851100,
"line_mean": 36.25,
"line_max": 79,
"alpha_frac": 0.6241610738,
"autogenerated": false,
"ratio": 3.092796092796093... |
import warnings
import numpy as np
from nose.tools import assert_raises
from numpy.testing import assert_equal, assert_array_almost_equal
from .. import orthogonal_mp, orthogonal_mp_gram, OrthogonalMatchingPursuit
from ...utils.fixes import count_nonzero
from ...datasets import make_sparse_coded_signal
n_samples, n... | {
"repo_name": "ominux/scikit-learn",
"path": "sklearn/linear_model/tests/test_omp.py",
"copies": "1",
"size": "4659",
"license": "bsd-3-clause",
"hash": -4914455812116596000,
"line_mean": 34.8384615385,
"line_max": 76,
"alpha_frac": 0.6252414681,
"autogenerated": false,
"ratio": 3.083388484447386... |
import dynet as dy
import numpy as np
class Dense(dy.Saveable):
def __init__(self, activation, shape, model):
self.activation = activation
self.W = model.add_parameters(shape)
self.b = model.add_parameters(shape[0])
self.shape = shape
def __call__(self, x):
b = dy.par... | {
"repo_name": "vene/marseille",
"path": "marseille/dynet_utils.py",
"copies": "1",
"size": "3315",
"license": "bsd-3-clause",
"hash": 4789905832488413000,
"line_mean": 28.8648648649,
"line_max": 76,
"alpha_frac": 0.5441930618,
"autogenerated": false,
"ratio": 3.372329603255341,
"config_test": f... |
from __future__ import print_function
from __future__ import division
import numpy as np
from sklearn.base import BaseEstimator, ClassifierMixin, RegressorMixin
from sklearn.utils.extmath import safe_sparse_dot
from sklearn.isotonic import isotonic_regression
from sklearn.preprocessing import LabelBinarizer
from fi... | {
"repo_name": "vene/pyowl",
"path": "pyowl.py",
"copies": "1",
"size": "6603",
"license": "bsd-3-clause",
"hash": 1235011509821442000,
"line_mean": 30.5933014354,
"line_max": 79,
"alpha_frac": 0.6056338028,
"autogenerated": false,
"ratio": 3.2704309063893016,
"config_test": false,
"has_no_key... |
import numpy as np
from nltk import Tree
import json
from marseille.indicators import STAB_GUREVYCH_2015, POS_ATTRIB, MODALS
from marseille.preprocess import _transitive
def root_verb_ix(sentence):
words = sentence['tokens']
deps = sorted(sentence['basic-dependencies'],
key=lambda x: x['de... | {
"repo_name": "vene/marseille",
"path": "marseille/features.py",
"copies": "1",
"size": "22661",
"license": "bsd-3-clause",
"hash": 8046049222790847000,
"line_mean": 34.352574103,
"line_max": 79,
"alpha_frac": 0.5604783549,
"autogenerated": false,
"ratio": 3.1504240233560408,
"config_test": fal... |
import numpy as np
from numpy.testing import assert_array_almost_equal
from pyowl import prox_owl
rng = np.random.RandomState(0)
# cf. scikit-learn-contrib/lightning impl/penalty.py
def project_simplex(v, z=1):
if np.sum(v) <= z:
return v
n_features = v.shape[0]
u = np.sort(v)[::-1]
cssv = n... | {
"repo_name": "vene/pyowl",
"path": "test_pyowl.py",
"copies": "1",
"size": "1472",
"license": "bsd-3-clause",
"hash": -4497105174599270400,
"line_mean": 24.8245614035,
"line_max": 57,
"alpha_frac": 0.5998641304,
"autogenerated": false,
"ratio": 2.7617260787992497,
"config_test": false,
"has_... |
import warnings
try:
from pystruct.models.utils import loss_augment_unaries
except ImportError:
def loss_augment_unaries(unary_potentials, y, class_weight):
warnings.warn("PyStruct not installed, slow loss_augment_unaries.")
n_states = unary_potentials.shape[1]
for i in range(unary_pot... | {
"repo_name": "vene/marseille",
"path": "marseille/inference.py",
"copies": "1",
"size": "1421",
"license": "bsd-3-clause",
"hash": -6886144530358879000,
"line_mean": 32.0465116279,
"line_max": 75,
"alpha_frac": 0.5172413793,
"autogenerated": false,
"ratio": 3.59746835443038,
"config_test": fal... |
"""Lexicons from literature.
STAB_GUREVYCH_2015 refers to "Parsing Argumentation Structures in Persuasive
Essays" by Christian Stab and Iryna Gurevych, Computational Linguistics, 2015.
See Table C1 therein.
"""
STAB_GUREVYCH_2015 = {
'forward': ["As a result", "As the consequence", "Because", "Clearly",
... | {
"repo_name": "vene/marseille",
"path": "marseille/indicators.py",
"copies": "1",
"size": "6514",
"license": "bsd-3-clause",
"hash": 1278808074659080400,
"line_mean": 47.977443609,
"line_max": 94,
"alpha_frac": 0.5055265582,
"autogenerated": false,
"ratio": 3.1227229146692235,
"config_test": fa... |
import re
yes_variants = [
"yes",
"yea",
"yep",
"yup",
"yeah",
"ya",
"ok"]
agree = yes_variants + [
"i agree",
"i concur"
"you're right",
"you are right",
"you're probably right",
"you are probably right",
"sounds right",
"looks right",
"sounds correct"... | {
"repo_name": "conversationai/wikidetox",
"path": "experimental/conversation_go_awry/feature_extraction/utils/constructive/agree.py",
"copies": "1",
"size": "1566",
"license": "apache-2.0",
"hash": -6617628567226190000,
"line_mean": 19.88,
"line_max": 71,
"alpha_frac": 0.537037037,
"autogenerated":... |
__author__ = 'vlad'
import numpy
import numpy.linalg
import Substance
import itertools
import Substance_db
import math
def check_data_availability(substances, temperature):
ok = True
for substance in substances:
if not substance.has_data(temperature):
ok = False
return ok
def generat... | {
"repo_name": "unicyclist/cea",
"path": "ReactionGenerator.py",
"copies": "1",
"size": "4066",
"license": "mit",
"hash": -8817728862871516000,
"line_mean": 25.7583892617,
"line_max": 100,
"alpha_frac": 0.6372303061,
"autogenerated": false,
"ratio": 3.291494632535095,
"config_test": false,
"ha... |
__author__ = 'vlad'
import ReactionGenerator
import numpy
import Phys
import math
import scipy.optimize
import ReactionPrettyPrinter
def equilibrium_constant(substance_list, coefficient_list, temperature):
"""
Вычисление константы равновесия химической реакции
@param substance_list: список веществ
@pa... | {
"repo_name": "unicyclist/cea",
"path": "VillarsSolver.py",
"copies": "1",
"size": "7298",
"license": "mit",
"hash": -2304621434157216500,
"line_mean": 39.2558139535,
"line_max": 108,
"alpha_frac": 0.6010400116,
"autogenerated": false,
"ratio": 3.357419980601358,
"config_test": false,
"has_no... |
__author__ = 'vlad'
import math
def careful_int(number):
eps = 1e-6
if abs(math.floor(number) - number) < eps:
return math.floor(number)
elif abs(math.ceil(number) - number) < eps:
return math.ceil(number)
else:
return number
def print_reaction(reaction, substances):
if ... | {
"repo_name": "unicyclist/cea",
"path": "ReactionPrettyPrinter.py",
"copies": "1",
"size": "1239",
"license": "mit",
"hash": -719085037860545900,
"line_mean": 30.7692307692,
"line_max": 96,
"alpha_frac": 0.5496368039,
"autogenerated": false,
"ratio": 3.082089552238806,
"config_test": false,
"... |
__author__ = 'Vlad Popovici'
__version__ = 0.1
import sys
sys.setrecursionlimit(10000)
import glob
import pickle
import numpy as np
from numpy import float32
import theano
from lasagne.layers import get_output, InputLayer, DenseLayer, Upscale2DLayer, ReshapeLayer
from lasagne.nonlinearities import rectify, leaky_... | {
"repo_name": "higex/qpath",
"path": "encode/cnn.py",
"copies": "1",
"size": "4676",
"license": "mit",
"hash": -1382086537016940000,
"line_mean": 33.3823529412,
"line_max": 106,
"alpha_frac": 0.5958083832,
"autogenerated": false,
"ratio": 3.138255033557047,
"config_test": false,
"has_no_keywo... |
class dstat_plugin(dstat):
"""
Numa policy hit/miss statistics.
https://www.kernel.org/doc/Documentation/numastat.txt
"""
def __init__(self):
self.vars_ = ('numa_hit','numa_miss','numa_foreign','interleave_hit','local_node','other_node')
self.nick = ('hit','miss','frgn','int','loc'... | {
"repo_name": "CERIT-SC/dstat-plugins",
"path": "dstat_numastat.py",
"copies": "1",
"size": "1920",
"license": "mit",
"hash": -2795652355178413000,
"line_mean": 33.9090909091,
"line_max": 103,
"alpha_frac": 0.546875,
"autogenerated": false,
"ratio": 3.4782608695652173,
"config_test": false,
"... |
__author__ = 'vllazarenko'
from nsbaseresource import NSBaseResource
class NSFeature(NSBaseResource):
# Configuration for NS Features.
def __init__(self, json_data=None):
"""
Supplied with json_data the object can be pre-filled
"""
super(NSFea... | {
"repo_name": "zojoncj/cleanthehead",
"path": "nsnitro/nsresources/nsfeature.py",
"copies": "1",
"size": "4566",
"license": "apache-2.0",
"hash": 7633518347552003000,
"line_mean": 29.2450331126,
"line_max": 74,
"alpha_frac": 0.3926850635,
"autogenerated": false,
"ratio": 5.224256292906179,
"con... |
__author__ = 'vlovets'
from model.contact import Contact
from model.group import GroupNew
import random
from fixture.orm import ORMFixture
def test_add_contact_to_group(app):
db = ORMFixture(host='127.0.0.1', name='addressbook', user='root', password='')
group_name = 'new group for contact'
if len(db.chec... | {
"repo_name": "VLovets/python_01",
"path": "test/test_add_contact_to_group.py",
"copies": "1",
"size": "1168",
"license": "apache-2.0",
"hash": 1510348059830611500,
"line_mean": 43.9230769231,
"line_max": 98,
"alpha_frac": 0.6883561644,
"autogenerated": false,
"ratio": 3.049608355091384,
"confi... |
__author__ = 'vlovets'
from model.contact import Contact
from model.group import GroupNew
import random
from fixture.orm import ORMFixture
def test_delete_contact_from_group(app):
db = ORMFixture(host='127.0.0.1', name='addressbook', user='root', password='')
group_name = 'new group for contact'
if len(db... | {
"repo_name": "VLovets/python_01",
"path": "test/test_delete_contact_from_group.py",
"copies": "1",
"size": "1427",
"license": "apache-2.0",
"hash": 2731816807918983000,
"line_mean": 46.5666666667,
"line_max": 98,
"alpha_frac": 0.6762438683,
"autogenerated": false,
"ratio": 3.1157205240174672,
... |
__author__ = 'vlovets'
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 group', 'file'])
except getopt.GetoptError as err:
print(err)
getopt.usage()
sys.exit(2)
n = ... | {
"repo_name": "VLovets/python_01",
"path": "generator/contact.py",
"copies": "1",
"size": "1852",
"license": "apache-2.0",
"hash": 9212422709472429000,
"line_mean": 38.4255319149,
"line_max": 120,
"alpha_frac": 0.596112311,
"autogenerated": false,
"ratio": 3.474671669793621,
"config_test": fals... |
__author__ = 'vlovets'
from model.contact import Contact
import random
import string
def random_string(prefix, maxlen):
symbols = string.ascii_letters + string.digits + string.punctuation + ' '*5
return prefix + ''.join([random.choice(symbols) for i in range(random.randrange(maxlen))])
testdata = [Contact(fir... | {
"repo_name": "VLovets/python_01",
"path": "data/contacts.py",
"copies": "1",
"size": "1301",
"license": "apache-2.0",
"hash": -7781159998593289000,
"line_mean": 60.9523809524,
"line_max": 120,
"alpha_frac": 0.5918524212,
"autogenerated": false,
"ratio": 3.7819767441860463,
"config_test": false... |
__author__ = 'vlovets'
from pony.orm import *
from datetime import datetime
from model.group import GroupNew
from model.contact import Contact
from pymysql.converters import decoders
class ORMFixture:
db = Database()
class ORMGroup(db.Entity):
_table_ = 'group_list'
id = PrimaryKey(int, colu... | {
"repo_name": "VLovets/python_01",
"path": "fixture/orm.py",
"copies": "1",
"size": "2834",
"license": "apache-2.0",
"hash": -6120353842467440000,
"line_mean": 40.6764705882,
"line_max": 133,
"alpha_frac": 0.6647847565,
"autogenerated": false,
"ratio": 3.610191082802548,
"config_test": false,
... |
__author__ = 'vlovets'
from random import randrange
import re
from model.contact import Contact
def test_phones_on_home_page(app):
if app.contact.count() == 0:
app.contact.create(Contact(firstname='new contact for edit'))
old_contacts = app.contact.get_contact_list()
index = randrange(len(old_cont... | {
"repo_name": "VLovets/python_01",
"path": "test/test_phones.py",
"copies": "1",
"size": "1424",
"license": "apache-2.0",
"hash": -1833623313639192300,
"line_mean": 43.53125,
"line_max": 115,
"alpha_frac": 0.6643258427,
"autogenerated": false,
"ratio": 3.2962962962962963,
"config_test": false,
... |
__author__ = 'vlovets'
from sys import maxsize
class Contact:
def __init__(self, firstname=None, middlename=None, lastname=None,
nickname=None, title=None, company=None, address=None, home=None, mobile=None, work=None,
fax=None, email2=None, email=None, email3=None, homepage=None... | {
"repo_name": "VLovets/python_01",
"path": "model/contact.py",
"copies": "1",
"size": "1745",
"license": "apache-2.0",
"hash": -3514296065717464600,
"line_mean": 36.9565217391,
"line_max": 113,
"alpha_frac": 0.5925501433,
"autogenerated": false,
"ratio": 3.355769230769231,
"config_test": false,... |
__author__ = 'vlovets'
import mysql.connector
from model.group import GroupNew
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
self.connection = my... | {
"repo_name": "VLovets/python_01",
"path": "fixture/db.py",
"copies": "1",
"size": "2129",
"license": "apache-2.0",
"hash": -8414107601272689000,
"line_mean": 37.7272727273,
"line_max": 188,
"alpha_frac": 0.5857209958,
"autogenerated": false,
"ratio": 4.078544061302682,
"config_test": false,
... |
__author__ = 'vlovets'
from model.contact import Contact
import re
from selenium.webdriver.support.ui import Select
class ContactHelper:
def __init__(self, app):
self.app = app
def open_contact_page(self):
wd = self.app.wd
if not (wd.current_url.endswith('edit.php') and (len(wd.find_... | {
"repo_name": "VLovets/python_01",
"path": "fixture/contact.py",
"copies": "1",
"size": "8070",
"license": "apache-2.0",
"hash": -3992880644865380000,
"line_mean": 40.5979381443,
"line_max": 158,
"alpha_frac": 0.5985130112,
"autogenerated": false,
"ratio": 3.4739560912613,
"config_test": false,... |
__author__ = 'vlovets'
from model.group import GroupNew
from selenium.webdriver.support.ui import Select
class GroupHelper:
def __init__(self, app):
self.app = app
def change_field_value(self, field_name, text):
wd = self.app.wd
if text is not None:
wd.find_element_by_nam... | {
"repo_name": "VLovets/python_01",
"path": "fixture/group.py",
"copies": "1",
"size": "3782",
"license": "apache-2.0",
"hash": 1694229925616131300,
"line_mean": 31.8956521739,
"line_max": 100,
"alpha_frac": 0.5933368588,
"autogenerated": false,
"ratio": 3.4102795311091074,
"config_test": false,... |
__author__ = 'vlovets'
import pytest
from fixture.application import Application
import json
import os.path
import importlib
import jsonpickle
from fixture.db import DbFixture
fixture = None
target = None
def load_config(file):
global target
if target is None:
config_file = os.path.join(os.path.dirn... | {
"repo_name": "VLovets/python_01",
"path": "conftest.py",
"copies": "1",
"size": "2461",
"license": "apache-2.0",
"hash": 6409692581475851000,
"line_mean": 29.775,
"line_max": 129,
"alpha_frac": 0.6781796018,
"autogenerated": false,
"ratio": 3.6567607726597324,
"config_test": true,
"has_no_ke... |
__author__ = 'vlovets'
class SessionHelperAll:
def __init__(self, app):
self.app = app
def log_in(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").send_keys(username)
... | {
"repo_name": "VLovets/python_01",
"path": "fixture/session.py",
"copies": "1",
"size": "1342",
"license": "apache-2.0",
"hash": -1341040886303100000,
"line_mean": 28.1956521739,
"line_max": 73,
"alpha_frac": 0.5618479881,
"autogenerated": false,
"ratio": 3.2811735941320292,
"config_test": fals... |
__author__ = 'v-lshen'
from NativeCall import *
from InterOpLookupTable import *
import time
count_time = 0
current_time = 0
last_time = 0
class ErrorCode:
__error = None
def __init__(self, int_err = None, ErrorCode = None, string_err = None):
if(int_err != None):
self.__error = int_err
... | {
"repo_name": "rDSN-Projects/rDSN.Python",
"path": "src/dev/python/Utils.py",
"copies": "2",
"size": "1818",
"license": "mit",
"hash": -5663590020748422000,
"line_mean": 24.9714285714,
"line_max": 108,
"alpha_frac": 0.5649064906,
"autogenerated": false,
"ratio": 3.4431818181818183,
"config_test... |
__author__ = 'v-lshen'
from Utils import *
from RpcStream import *
class Clientlet:
@staticmethod
def build_address(argv1, argv2):
return Native.dsn_address_build(argv1, argv2)
@staticmethod
def call_async(evt, callback_owner, callback, hash = 0, delay_milliseconds = 0, timer_interval_mill... | {
"repo_name": "mcfatealan/rDSN.Python",
"path": "src/dev/python/Clientlet.py",
"copies": "2",
"size": "1531",
"license": "mit",
"hash": -7389133497108334000,
"line_mean": 32.2826086957,
"line_max": 121,
"alpha_frac": 0.653821032,
"autogenerated": false,
"ratio": 3.5195402298850573,
"config_test... |
__author__ = 'v-lshen'
import sys
import os
import time
from EchoCodeDefinition import *
from EchoServer import *
from EchoClient import *
class EchoServiceClient(ServiceApp):
__server = None
__echo_client = None
__task = None
def start(self, argv):
# client obj start
if(len(argv) <... | {
"repo_name": "mcfatealan/rDSN.Python",
"path": "src/apps/echo/app_package/EchoAppExample.py",
"copies": "2",
"size": "1611",
"license": "mit",
"hash": -6875298798698001000,
"line_mean": 27.2631578947,
"line_max": 89,
"alpha_frac": 0.608317815,
"autogenerated": false,
"ratio": 3.6040268456375837,... |
__author__ = 'Volodka'
import re
from random import randrange
from model.group import Group
def test_contact_info_on_home_page(app):
if app.group.count() == 0:
app.group.create(Group(name='Test'))
records_list = app.record.get_record_list()
index = randrange(len(records_list))
records_from_hom... | {
"repo_name": "Spasley/python",
"path": "test/test_record_contacts.py",
"copies": "1",
"size": "1694",
"license": "apache-2.0",
"hash": 1191232283227322400,
"line_mean": 46.0555555556,
"line_max": 128,
"alpha_frac": 0.6210153483,
"autogenerated": false,
"ratio": 3.478439425051335,
"config_test"... |
__author__ = 'Volodka'
import re
def clear(s):
return re.sub("[() -]", "", s)
def merge_phones_like_on_homepage(RecordFields):
return "\n".join(filter(lambda x: x != "",
map(lambda x: clear(x),
filter(lambda x: x is not None,
... | {
"repo_name": "Spasley/python",
"path": "test/test_phones.py",
"copies": "1",
"size": "1167",
"license": "apache-2.0",
"hash": -3970442574539476000,
"line_mean": 39.2413793103,
"line_max": 120,
"alpha_frac": 0.6529562982,
"autogenerated": false,
"ratio": 3.206043956043956,
"config_test": false,... |
__author__ = 'Volodya'
from model.group import Group
import pytest
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)
n = 5
f ... | {
"repo_name": "Spasley/python",
"path": "generator/group.py",
"copies": "1",
"size": "1038",
"license": "apache-2.0",
"hash": 8807457701220552000,
"line_mean": 24.975,
"line_max": 113,
"alpha_frac": 0.6445086705,
"autogenerated": false,
"ratio": 3.1743119266055047,
"config_test": false,
"has_... |
__author__ = 'Volodya'
from model.recordfields import RecordFields
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 records', 'file'])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 5
f... | {
"repo_name": "Spasley/python",
"path": "generator/record.py",
"copies": "1",
"size": "1285",
"license": "apache-2.0",
"hash": -7205875446188924000,
"line_mean": 30.3658536585,
"line_max": 142,
"alpha_frac": 0.646692607,
"autogenerated": false,
"ratio": 3.454301075268817,
"config_test": false,
... |
__author__ = 'Volodya'
from pony.orm import *
from datetime import datetime
from model.group import Group
from model.recordfields import RecordFields
from pymysql.converters import decoders
class ORMfixture:
db = Database()
class ORMGroup(db.Entity):
_table_ = 'group_list'
id = PrimaryKey(in... | {
"repo_name": "Spasley/python",
"path": "fixture/orm.py",
"copies": "1",
"size": "2813",
"license": "apache-2.0",
"hash": -3374050373807737000,
"line_mean": 39.1857142857,
"line_max": 109,
"alpha_frac": 0.6605047991,
"autogenerated": false,
"ratio": 3.643782383419689,
"config_test": false,
"h... |
__author__ = 'Volodya'
import mysql.connector
from model.group import Group
from model.recordfields import RecordFields
class DbFixture:
def __init__(self, host, name, user, password):
self.name = name
self.host = host
self.user = user
self.password = password
self.connect... | {
"repo_name": "Spasley/python",
"path": "fixture/db.py",
"copies": "1",
"size": "1879",
"license": "apache-2.0",
"hash": -3660730816618696000,
"line_mean": 33.8148148148,
"line_max": 134,
"alpha_frac": 0.5939329431,
"autogenerated": false,
"ratio": 4.157079646017699,
"config_test": false,
"ha... |
__author__ = 'Volodymyr Varchuk'
__email__ = "vladimir.varchuk@rackspace.com"
from gizer.opdelete import *
import json
import pprint
from test_util import *
from psycopg2.extensions import AsIs
from psycopg2 import ProgrammingError
from os import environ
"""
Tests are using postgres database
For succesfully running... | {
"repo_name": "YaroslavLitvinov/gizer",
"path": "tests/test_opdelete.py",
"copies": "1",
"size": "28838",
"license": "apache-2.0",
"hash": 4370281733769115600,
"line_mean": 61.150862069,
"line_max": 253,
"alpha_frac": 0.5991400236,
"autogenerated": false,
"ratio": 3.3552065154159396,
"config_te... |
__author__ = 'Volodymyr Varchuk'
schema = {
"comments": [{
"_id": {
"oid": "STRING",
"bsontype": "INT"
},
"body": "STRING",
"updated_at": "TIMESTAMP",
"created_at": "TIMESTAMP"
}],
"title": "STRING",
"body": "STRING",
"user_id": "STRIN... | {
"repo_name": "VarchukVladimir/gizer",
"path": "tests/update_test_data.py",
"copies": "1",
"size": "16759",
"license": "apache-2.0",
"hash": 6732603367954991000,
"line_mean": 20.9934383202,
"line_max": 75,
"alpha_frac": 0.4373769318,
"autogenerated": false,
"ratio": 2.4380273494326445,
"config_... |
class arcsightInterface():
def __init__(self):
import logging
import os
import sys
logger = logging.getLogger('serviceNowInterface')
varExportFolder = "/opt/arcsight/manager/archive/exports"
varImportFolder = "/opt/arcsight/manager/archive/imports"
varTempla... | {
"repo_name": "ooRickoo/ArcSightServiceNowIntegration",
"path": "arcsightIOInterface.py",
"copies": "1",
"size": "13661",
"license": "apache-2.0",
"hash": -1380959800509090000,
"line_mean": 46.1068965517,
"line_max": 158,
"alpha_frac": 0.6164995242,
"autogenerated": false,
"ratio": 4.218962322421... |
""" Author-voter interaction modeling module
----------------------------------------
Models author-voter relation set of features comparative features, both
regarding preference similarity and interaction in trust network.
Usage:
Used only as a module, not directly callable.
"""
from math imp... | {
"repo_name": "lucianamaroun/review_recommendation",
"path": "prep/interaction_modeling.py",
"copies": "1",
"size": "8928",
"license": "mit",
"hash": 3917083170069552000,
"line_mean": 34.1496062992,
"line_max": 82,
"alpha_frac": 0.6631944444,
"autogenerated": false,
"ratio": 3.4285714285714284,
... |
__author__ = 'vps'
import timeit
from sklearn.base import BaseEstimator
from DenoisingAutoencoder import DenoisingAutoencoder
class StackedDenoisingAutoencoders(BaseEstimator):
def __init__(self, hidden_layers_sizes, learning_rate=0.1, training_epochs=15, corruption_level=0.0, batch_size=20, verbose=False):
... | {
"repo_name": "sumanyu/ece457b",
"path": "StackedDenoisingAutoencoders.py",
"copies": "1",
"size": "1878",
"license": "apache-2.0",
"hash": -2663919122161253000,
"line_mean": 31.9473684211,
"line_max": 135,
"alpha_frac": 0.5638977636,
"autogenerated": false,
"ratio": 4.012820512820513,
"config_... |
import numpy as np
import pandas as pd
import lightgbm as lgb
import gc
from sklearn.preprocessing import StandardScaler
from Utils import CreateOutput
trainDf = pd.read_csv('train_featured.csv')
Xtrain = trainDf.drop(['price_doc','w'],1)
w = trainDf.w.values
Ytrain = trainDf.price_doc
# scaler = StandardSc... | {
"repo_name": "LenzDu/Kaggle-Competition-Sberbank",
"path": "lightGBM.py",
"copies": "1",
"size": "1566",
"license": "mit",
"hash": -8985672626069837000,
"line_mean": 34.4186046512,
"line_max": 75,
"alpha_frac": 0.6602809706,
"autogenerated": false,
"ratio": 2.62751677852349,
"config_test": fal... |
__author__ = "Vrubel Dmitrii"
__date__ = "$${date} ${time}$"
import sys
import os
from datetime import datetime
from zipfile import ZipFile, is_zipfile
from shutil import move
class AgentZip(ZipFile):
'''Class for zip file with agent for MarioAi: two new methods and some new attributes. Required zipfile and os mod... | {
"repo_name": "zvoykish/marioai",
"path": "new/agent_class.py",
"copies": "17",
"size": "3489",
"license": "bsd-3-clause",
"hash": -6902293713781722000,
"line_mean": 31.6074766355,
"line_max": 123,
"alpha_frac": 0.671539123,
"autogenerated": false,
"ratio": 3.1207513416815744,
"config_test": fa... |
__author__ = 'Vu Cao'
import sqlite3
import sys
class Database(object):
'''Class to handle connection to sqlite3 database'''
def __init__(self, db_file = 'C:/Users/Stormer/Documents/Github/ISSAMemberManager/db/memberdb.sqlite3'):
'''This function initiates the Database class and connect to the databa... | {
"repo_name": "defron/ISSAMemberManager",
"path": "ISSA/MemberMailer/Objects/database.py",
"copies": "1",
"size": "7861",
"license": "mpl-2.0",
"hash": 181129158517949600,
"line_mean": 31.2213114754,
"line_max": 123,
"alpha_frac": 0.5653224781,
"autogenerated": false,
"ratio": 3.688878460816518,
... |
__author__ = 'vvlad'
import time
from random import randint, seed
# if you can install bx python then uncomment the line below
#
# from bx.intervals.operations.quicksect import IntervalNode
# otherwise just download the quickset module as shown above
# and place it in next to your program
#
from quicksect import Inte... | {
"repo_name": "smartkiwi/interval_calculator",
"path": "interval_calculator/bx/biotest.py",
"copies": "1",
"size": "1743",
"license": "mit",
"hash": 5382514645768143000,
"line_mean": 25.8307692308,
"line_max": 74,
"alpha_frac": 0.6919104991,
"autogenerated": false,
"ratio": 3.351923076923077,
"... |
__author__ = 'vvlasov'
import generate_products as gp
package = "package com.othelle.jtuples;"
if __name__ == '__main__':
template = open('ZipUtils1.java', 'rb').read()
for arity in xrange(2, gp.max_products): #gp.max_products + 1):
code = template
# writer = open('../java/org/jtuples/IValue{... | {
"repo_name": "vasilyvlasov/jtuples",
"path": "gen/generate_zip.py",
"copies": "1",
"size": "1669",
"license": "apache-2.0",
"hash": 108366471031237250,
"line_mean": 42.9210526316,
"line_max": 122,
"alpha_frac": 0.4457759137,
"autogenerated": false,
"ratio": 3.3115079365079363,
"config_test": f... |
__author__ = 'vvlasov'
max_products = 16
package = "package com.othelle.jtuples;"
class_begin = "public class Product{0}<{1}> extends Product implements Tuple{0}<{1}>"
jackson_import = "\nimport org.codehaus.jackson.annotate.JsonCreator;\nimport org.codehaus.jackson.annotate.JsonProperty;\n"
o_bracket = "{"
serial_ve... | {
"repo_name": "vasilyvlasov/jtuples",
"path": "gen/generate_products.py",
"copies": "1",
"size": "2875",
"license": "apache-2.0",
"hash": -6728552560678145000,
"line_mean": 37.3333333333,
"line_max": 141,
"alpha_frac": 0.571826087,
"autogenerated": false,
"ratio": 3.3823529411764706,
"config_te... |
__author__ = 'vvu'
import urllib
from lxml.html import fromstring
for year in range(2005, 2015):
f = open('data/' + str(year) + '.csv', 'w')
url = 'http://www.shanghairanking.com/ARWU' + str(year) + '.html'
content = urllib.urlopen(url).read()
doc = fromstring(content)
doc.make_links_absolute(url)
... | {
"repo_name": "rnadrag/SecondaryDataAnalysis",
"path": "generateCSV.py",
"copies": "1",
"size": "2937",
"license": "mit",
"hash": -6757954231764046000,
"line_mean": 35.2716049383,
"line_max": 107,
"alpha_frac": 0.5103847463,
"autogenerated": false,
"ratio": 3.648447204968944,
"config_test": fal... |
__author__ = 'vvu'
import urllib
from lxml.html import fromstring
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111,projection='3d')
oX = []
oY = []
oZ = []
for year in range(2005, 2015):
for i in range(11):
oX.append(ye... | {
"repo_name": "rnadrag/SecondaryDataAnalysis",
"path": "generateCSVGeneral.py",
"copies": "1",
"size": "6720",
"license": "mit",
"hash": 8850542178354120000,
"line_mean": 26.4326530612,
"line_max": 199,
"alpha_frac": 0.5130952381,
"autogenerated": false,
"ratio": 3.032490974729242,
"config_test... |
__author__ = 'v-whao'
import sys
import subprocess
import time
DST = "10.11.9.3"
SRC_MAP = [
"10.11.6.2",
"10.11.6.3",
"10.11.6.4",
"10.11.7.2",
"10.11.7.3",
"10.11.7.4",
"10.11.8.2",
"10.11.8.3",
"10.11.8.4",
"10.11.9.2"
]
if __name__ == '__main__':
conf = sys.argv[1... | {
"repo_name": "chapter09/FlowGen",
"path": "socket/controller.py",
"copies": "1",
"size": "1167",
"license": "apache-2.0",
"hash": -3742393313328102000,
"line_mean": 16.9538461538,
"line_max": 83,
"alpha_frac": 0.4832904884,
"autogenerated": false,
"ratio": 2.818840579710145,
"config_test": fal... |
__author__ = 'v-whao'
import time
from SocketServer import *
from socket import error as SocketError
import sys
class TCPHandler(StreamRequestHandler):
def handle(self):
log_fd = open("./FlowGen.txt", "a")
start_time = time.clock()
size = 0
try:
while 1:
... | {
"repo_name": "chapter09/FlowGen",
"path": "socket/server.py",
"copies": "1",
"size": "1250",
"license": "apache-2.0",
"hash": -2810186963269697000,
"line_mean": 26.7777777778,
"line_max": 86,
"alpha_frac": 0.536,
"autogenerated": false,
"ratio": 3.7993920972644375,
"config_test": false,
"has... |
__author__ = 'v-whao'
import asyncore
import socket
import time
import sys
from socket import error as SocketError
class EchoHandler(asyncore.dispatcher_with_send):
def handle_read(self):
size = 0
start_time = time.time()
try:
while 1:
data = self.recv(12800... | {
"repo_name": "chapter09/FlowGen",
"path": "socket/anyncore_server.py",
"copies": "1",
"size": "1292",
"license": "apache-2.0",
"hash": -4827299488806855000,
"line_mean": 22.9259259259,
"line_max": 65,
"alpha_frac": 0.5441176471,
"autogenerated": false,
"ratio": 3.8224852071005917,
"config_test... |
__author__ = 'v-whao'
import sys
import os
def usage():
print "python parser.py path //path could be a file or a directory"
def cal(file_path):
results = []
with open(file_path) as fd:
for line in fd.readlines():
if line.strip():
l_items = line.split(" ")
... | {
"repo_name": "chapter09/FlowGen",
"path": "results/parser.py",
"copies": "1",
"size": "1798",
"license": "apache-2.0",
"hash": -8951989539067502000,
"line_mean": 25.4411764706,
"line_max": 80,
"alpha_frac": 0.5266963293,
"autogenerated": false,
"ratio": 3.269090909090909,
"config_test": false,... |
__author__ = 'vyshakh.babji'
import time
from rcsdk import RCSDK
from threading import Thread
from time import sleep
from rcsdk.subscription import EVENTS
#Instantiating the SDK
RC_SERVER_PRODUCTION = 'https://platform.ringcentral.com'
RC_SERVER_SANDBOX = 'https://platform.devtest.ringcentral.com'
YOUR_APPKEY = ''
YO... | {
"repo_name": "vyshakhbabji/ringcentral-python-sdk-with-slate-sample-code",
"path": "Python-samples-for-slate.py",
"copies": "1",
"size": "3209",
"license": "mit",
"hash": 5366816856714514000,
"line_mean": 25.5289256198,
"line_max": 95,
"alpha_frac": 0.6999065129,
"autogenerated": false,
"ratio":... |
__author__ = 'Wade'
# my_int is set to 7 below. What do you think
# will happen if we reset it to 3 and print the result?
my_int = 7
# Change the value of my_int to 3 on line 8!
my_int = 3
# Here's some code that will print my_int to the console:
# The print keyword will be covered in detail soon!
print my_int
pr... | {
"repo_name": "machton/hello-world",
"path": "testing_ground.py",
"copies": "1",
"size": "2788",
"license": "mit",
"hash": 6912685971107771000,
"line_mean": 19.2028985507,
"line_max": 80,
"alpha_frac": 0.649928264,
"autogenerated": false,
"ratio": 3.067106710671067,
"config_test": false,
"has... |
__author__ = 'waf04'
import math
def simpleLinearRegressionForXY(x, y):
"""
Simple function to calculate the actual linear regression formula for the data given
Prints the b0 +b1x formula with the r (correlation) coefficient
Returns the linear function ready for use
:param x (list of x values):
... | {
"repo_name": "williamFalcon/WPyStat",
"path": "WStat.py",
"copies": "1",
"size": "1291",
"license": "mit",
"hash": 941501562671664300,
"line_mean": 21.6666666667,
"line_max": 88,
"alpha_frac": 0.604182804,
"autogenerated": false,
"ratio": 3.1411192214111923,
"config_test": false,
"has_no_key... |
__author__ = 'wagnerca'
from os import listdir
from os.path import isfile, join
import scipy.stats as stats
import numpy as np
import pandas as pd
import pylab as plt
from scipy.stats import itemfreq
import sys
import util as ut
import re
import os
import seaborn as sns
from statsmodels.formula.api impo... | {
"repo_name": "clauwag/WikipediaGenderInequality",
"path": "src/GoogleTrendAnalyzer.py",
"copies": "1",
"size": "19323",
"license": "mit",
"hash": -3225091040832895500,
"line_mean": 44.3429256595,
"line_max": 209,
"alpha_frac": 0.5717538684,
"autogenerated": false,
"ratio": 3.7666666666666666,
... |
__author__ = 'wagnerca'
from pytrends.pyGTrends import pyGTrends
import time
from random import randint
import pandas as pd
import os.path
import sys
import codecs
import numpy as np
import re
import urllib2
print sys.stdout.encoding
class GoogleTrendCrawler:
def __init__(self, path, startyea... | {
"repo_name": "clauwag/WikipediaGenderInequality",
"path": "src/GoogleTrendCrawler.py",
"copies": "1",
"size": "6803",
"license": "mit",
"hash": 5161044071067355000,
"line_mean": 33.8052631579,
"line_max": 118,
"alpha_frac": 0.5369689843,
"autogenerated": false,
"ratio": 4.061492537313433,
"con... |
__author__ = 'walter'
from .config import Client, STATUS_UNTESTED, STATUS_OK, STATUS_BAD
import socket
import logging
log = logging.getLogger('Claire')
socket.setdefaulttimeout(10)
class Server(object):
def __init__(self, config, hostname):
self.config = config
self.hostname = hostname
se... | {
"repo_name": "devilicecream/Claire",
"path": "claire/server.py",
"copies": "1",
"size": "1564",
"license": "bsd-2-clause",
"hash": 5954004344745880000,
"line_mean": 30.9183673469,
"line_max": 78,
"alpha_frac": 0.5524296675,
"autogenerated": false,
"ratio": 4.227027027027027,
"config_test": tru... |
__author__ = 'walter'
from .config import STATUS_UNTESTED, STATUS_OK, STATUS_BAD, pretty
from collections import OrderedDict
from time import sleep
import re
import logging
log = logging.getLogger('Claire')
class Process(object):
def __init__(self, name, instances=1, failure=None):
self.name = name
... | {
"repo_name": "devilicecream/Claire",
"path": "claire/process.py",
"copies": "1",
"size": "2655",
"license": "bsd-2-clause",
"hash": 455530121271373900,
"line_mean": 36.3943661972,
"line_max": 100,
"alpha_frac": 0.4757062147,
"autogenerated": false,
"ratio": 4.530716723549488,
"config_test": fa... |
__author__ = 'walter'
from .document import Document
class CollectionMethodProxy(object):
"""
A proxy for the collection methods.
"""
def __init__(self, collection, method):
self.collection = collection
self.method = method
def __call__(self, *args, **kwargs):
"""
... | {
"repo_name": "devilicecream/pymorm",
"path": "pymorm/query.py",
"copies": "1",
"size": "2087",
"license": "mit",
"hash": -5528808883572196000,
"line_mean": 36.2678571429,
"line_max": 109,
"alpha_frac": 0.5955917585,
"autogenerated": false,
"ratio": 4.617256637168142,
"config_test": false,
"h... |
__author__ = 'walter'
from .mapped_manipulator import MappedSONManipulator
from .query import Query
from .document import Document
from bson import ObjectId
from pymongo.errors import OperationFailure
import logging
log = logging.getLogger('pymorm')
class MongoObjectMeta(type):
"""
Metaclass for the Pymorm m... | {
"repo_name": "devilicecream/pymorm",
"path": "pymorm/mongo_object.py",
"copies": "1",
"size": "7404",
"license": "mit",
"hash": 6096529665392053000,
"line_mean": 43.0714285714,
"line_max": 117,
"alpha_frac": 0.5984602917,
"autogenerated": false,
"ratio": 4.489993935718617,
"config_test": false... |
__author__ = 'walter'
import requests
from xml.etree import ElementTree as ET
OCS_ADMIN = 'ocs/v1.php/cloud'
class StatusCodeException(Exception):
def __init__(self,status,statusCode,message):
self.status = status
self.statusCode = statusCode
self.message = message
def __str__(self):... | {
"repo_name": "wlorenzetti/owncloudAdminClient",
"path": "owncloudadmin/__init__.py",
"copies": "1",
"size": "3119",
"license": "mit",
"hash": 3803821092457979000,
"line_mean": 27.0990990991,
"line_max": 83,
"alpha_frac": 0.5405578711,
"autogenerated": false,
"ratio": 3.99359795134443,
"config_... |
__author__ = 'walter'
import unittest
from owncloudadmin import Client, StatusCodeException
import requests
from xml.etree import ElementTree as ET
from config import Config
class TestConfig(unittest.TestCase):
def setUp(self):
self.client = Client(Config['owncloud_url'],Config['owncloud_username'],Confi... | {
"repo_name": "wlorenzetti/owncloudAdminClient",
"path": "owncloudadmin/test/test.py",
"copies": "1",
"size": "1479",
"license": "mit",
"hash": 834175884634145500,
"line_mean": 31.8888888889,
"line_max": 108,
"alpha_frac": 0.6632860041,
"autogenerated": false,
"ratio": 3.8616187989556137,
"conf... |
__author__ = "walter"
try:
import logging
import multiprocessing
except:
pass
import sys
py_version = sys.version_info[:2]
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
... | {
"repo_name": "devilicecream/pymorm",
"path": "setup.py",
"copies": "1",
"size": "1187",
"license": "mit",
"hash": -2590268281898559000,
"line_mean": 25.9772727273,
"line_max": 80,
"alpha_frac": 0.6402695872,
"autogenerated": false,
"ratio": 4.023728813559322,
"config_test": false,
"has_no_ke... |
__author__ = 'walthermaciel'
from geopy.geocoders import DataBC
from geopy.exc import GeopyError
from time import sleep
import sys
import csv
import random
from ssl import SSLError
import os.path
local_db = {}
def main(path_in):
geolocator = DataBC()
print 'loading', path_in
fpin = open(path_in, 'r')
... | {
"repo_name": "wmaciel/van-crime",
"path": "src/convert_property_tax_address_to_latlong.py",
"copies": "1",
"size": "2996",
"license": "mit",
"hash": 1896419518399947800,
"line_mean": 29.8865979381,
"line_max": 137,
"alpha_frac": 0.4953271028,
"autogenerated": false,
"ratio": 3.4006810442678774,
... |
__author__ = 'walthermaciel'
import pandas as pd
import numpy as np
def load_csv(path):
# Load
print 'Loading', path
df = pd.read_csv(path)
# Remove unwanted columns
print 'Dropping unwanted columns'
df = df[['PID', 'TAX_ASSESSMENT_YEAR', 'CURRENT_LAND_VALUE', 'STREET_NAME', 'TO_CIVIC_NUMBER'... | {
"repo_name": "wmaciel/van-crime",
"path": "src/clean_property_file.py",
"copies": "1",
"size": "1151",
"license": "mit",
"hash": 66324841961146020,
"line_mean": 28.5128205128,
"line_max": 99,
"alpha_frac": 0.6081668115,
"autogenerated": false,
"ratio": 3.1192411924119243,
"config_test": false,... |
__author__ = 'walzer'
__copyright__ = "M. Walzer"
__license__ = "BSD"
__maintainer__ = "walzer"
__email__ = "walzer<at>informatik.uni-tuebingen.de"
import warnings
import bisect
from Bio import SeqIO
class FastaDB:
def __init__(self, name='fdb'):
"""
FastaDB class to give quick access to entries ... | {
"repo_name": "mwalzer/pyBioConveniences",
"path": "FastaDB.py",
"copies": "1",
"size": "6503",
"license": "bsd-3-clause",
"hash": 1516985406439444200,
"line_mean": 41.5032679739,
"line_max": 119,
"alpha_frac": 0.5431339382,
"autogenerated": false,
"ratio": 4.176621708413616,
"config_test": fal... |
__author__ = 'walzer'
__copyright__ = "M. Walzer"
__license__ = "BSD"
__maintainer__ = "walzer"
__email__ = "walzer<at>informatik.uni-tuebingen.de"
import xlrd
import xlwt
from xlutils.copy import copy
import string
def xlsDictReader(f, sheet_index=0, sheet_name='', no_header=False):
"""
reads a sheet of a x... | {
"repo_name": "mwalzer/pyBioConveniences",
"path": "XlsDictAdapter.py",
"copies": "1",
"size": "3432",
"license": "bsd-3-clause",
"hash": -1094615405086195600,
"line_mean": 35.5106382979,
"line_max": 183,
"alpha_frac": 0.5716783217,
"autogenerated": false,
"ratio": 3.651063829787234,
"config_te... |
import pyb
import ugfx
import buttons
import onboard
COLOUR_BACK = ugfx.BLACK
COLOUR_LIST = [ugfx.RED, ugfx.GREEN, ugfx.BLUE]
PIXEL_WIDTH = 5
PIXEL_HEIGHT = 5
HASH_COUNT_LIMIT = 20
def get_random(count):
return pyb.rng() % count
def get_colour(colour_current = None):
while True:
colour = COLOUR_LI... | {
"repo_name": "wamonite/emfbadge_2016_life",
"path": "life/main.py",
"copies": "1",
"size": "8268",
"license": "mit",
"hash": -8016711294399123000,
"line_mean": 26.744966443,
"line_max": 134,
"alpha_frac": 0.4960087083,
"autogenerated": false,
"ratio": 3.7822506861848124,
"config_test": false,
... |
__author__ = 'wangchao'
import urllib2
import urllib
import sys
from bs4 import BeautifulSoup
from pyquery import PyQuery as pq
url = 'http://trace.yto.net.cn:8022/TraceSimple.aspx'
waybillNo = 'xxxxxxxxx'
data = {'waybillNo': waybillNo}
header = {
'Host': '127.0.0.1',
'Connection': 'keep-alive',
'Accept'... | {
"repo_name": "wang153723482/HelloWorld_my",
"path": "HelloWorld_python/http_spider/yuantong/getInforByYT.py",
"copies": "1",
"size": "1431",
"license": "apache-2.0",
"hash": -693689761250548500,
"line_mean": 26.0188679245,
"line_max": 129,
"alpha_frac": 0.6163522013,
"autogenerated": false,
"rat... |
__author__ = 'wangfeng'
import time
import os
import shutil
from functools import wraps
from oslo.config import cfg
from libcloud.compute.types import StorageVolumeState,NodeState
from libcloud.compute.base import NodeSize, NodeImage,NodeAuthSSHKey
from libcloud.storage.types import ObjectDoesNotExistError
import sshc... | {
"repo_name": "HybridF5/hybrid-jacket",
"path": "nova_jacket/virt/jacket/aws/driver.py",
"copies": "1",
"size": "147015",
"license": "apache-2.0",
"hash": 306350209091962800,
"line_mean": 45.5826996198,
"line_max": 138,
"alpha_frac": 0.5534537292,
"autogenerated": false,
"ratio": 4.22056670398759... |
__author__ = 'wangfeng'
import time
import os
import shutil
from oslo.config import cfg
from libcloud.compute.types import StorageVolumeState,NodeState
from libcloud.compute.base import NodeSize, NodeImage
from libcloud.storage.types import ObjectDoesNotExistError
import sshclient
from nova import utils
from nova im... | {
"repo_name": "Hybrid-Cloud/badam",
"path": "fs_patches_of_hybrid_cloud/cherry_for_111T/nova_cascaded/nova/virt/aws/driver.py",
"copies": "1",
"size": "68520",
"license": "apache-2.0",
"hash": -5990488979095547000,
"line_mean": 43.9901510177,
"line_max": 130,
"alpha_frac": 0.5347343841,
"autogenera... |
__author__ = 'wangfeng'
try:
from lxml import etree as ET
except ImportError:
from xml.etree import ElementTree as ET
import copy
import base64
from hashlib import sha1
import hmac
import sys
import ssl
import time
import uuid
import warnings
from libcloud.compute.base import KeyPair
from libcloud.utils.iso860... | {
"repo_name": "HybridF5/hybrid-jacket",
"path": "nova_jacket/virt/jacket/aws/adapter.py",
"copies": "2",
"size": "144549",
"license": "apache-2.0",
"hash": -3854844581242838500,
"line_mean": 41.5519576097,
"line_max": 170,
"alpha_frac": 0.5814083805,
"autogenerated": false,
"ratio": 4.19944220098... |
__author__ = 'wangfeng'
try:
from lxml import etree as ET
except ImportError:
from xml.etree import ElementTree as ET
import base64
from hashlib import sha1
import hmac
import sys
import ssl
import time
import uuid
import warnings
from libcloud.compute.base import KeyPair
from libcloud.utils.iso8601 import pa... | {
"repo_name": "Hybrid-Cloud/badam",
"path": "patches_tool/vcloud_patch/code/nova/virt/aws/adapter.py",
"copies": "2",
"size": "115725",
"license": "apache-2.0",
"hash": 6604041669624523000,
"line_mean": 41.2199927034,
"line_max": 150,
"alpha_frac": 0.5808597969,
"autogenerated": false,
"ratio": 4... |
__author__ = 'wangguojin'
class ShaderConst(object):
#key for callback
keysharp = "#"
keystruct = "struct"
keyfunction = "function"
keymacro = "macros"
keyvariable = "inervar"
#tag for variable name
tagvariables = ['uniform','void','int','bool','float','float2','float3','float... | {
"repo_name": "wangguojin/UnityShaderAutoCompletion",
"path": "ShaderParseTool/ShaderConsts.py",
"copies": "1",
"size": "1226",
"license": "mit",
"hash": -498852750477973800,
"line_mean": 25.652173913,
"line_max": 87,
"alpha_frac": 0.5464926591,
"autogenerated": false,
"ratio": 3.7378048780487805... |
__author__ = 'wanghao'
import subprocess
import threading
import SocketServer
import socket
import Pyro4
import sys
import os
class TCPHander(SocketServer.StreamRequestHandler):
def handle(self):
recv_data = ""
while 1:
data = self.request.recv(1024)
if not data:
... | {
"repo_name": "chapter09/FlowGen",
"path": "worker.py",
"copies": "1",
"size": "1963",
"license": "apache-2.0",
"hash": -4626448336650405000,
"line_mean": 24.8289473684,
"line_max": 79,
"alpha_frac": 0.5710646969,
"autogenerated": false,
"ratio": 3.833984375,
"config_test": false,
"has_no_key... |
__author__ = 'wanghao'
# import threading
import sys
import socket
from struct import *
import time
import threading
def run_flow(dst_ip, port, size):
def run(dst_ip, port, size):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# data = os.urandom(size)
data = pack('c', 'a')
... | {
"repo_name": "chapter09/FlowGen",
"path": "socket/client.py",
"copies": "1",
"size": "1567",
"license": "apache-2.0",
"hash": 1872153993885454000,
"line_mean": 23.1076923077,
"line_max": 64,
"alpha_frac": 0.5194639438,
"autogenerated": false,
"ratio": 3.3698924731182798,
"config_test": false,
... |
__author__="wanghuafeng"
#coding:utf-8
import re
import os
import io
import sys
import time
import codecs
def splitdrive(p):#from os.path
"""Split a pathname into drive and path specifiers. Returns a 2-tuple
"(drive,path)"; either part may be empty"""
if p[1:2] == ':':
return p[0:2], p[2:]
return ... | {
"repo_name": "wanghuafeng/spider_tools",
"path": "rong_tools/utils.py",
"copies": "1",
"size": "4549",
"license": "mit",
"hash": 5233260234785208000,
"line_mean": 35.1707317073,
"line_max": 126,
"alpha_frac": 0.6194650483,
"autogenerated": false,
"ratio": 3.098189415041783,
"config_test": fals... |
__author__ = 'wanghuafeng'
#coding:utf-8
import struct
import os, sys, glob
def read_utf16_str (f, offset=-1, len=2):
if offset >= 0:
f.seek(offset)
str = f.read(len)
return str.decode('UTF-16LE')
def read_uint16 (f):
return struct.unpack ('<H', f.read(2))[0]
def get_word_from_sogou_cell_dict... | {
"repo_name": "wanghuafeng/spider_tools",
"path": "rong_tools/sougouCell2txt.py",
"copies": "1",
"size": "3425",
"license": "mit",
"hash": 2740047192144071700,
"line_mean": 28.9385964912,
"line_max": 155,
"alpha_frac": 0.5675358922,
"autogenerated": false,
"ratio": 2.8899237933954276,
"config_t... |
__author__ = 'wang'
import Config.PipelineConfig as config
import subprocess
class Fmrilm():
def __init__(self, sqlObject):
self.input_file, self.output_file, self.unsmoothed_image, self.output_folder = self.parseSql(sqlObject)
self.execute(self.input_file, self.output_file, self.unsmoothed_image, ... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Pipelines/ADNI_Fmri/Fmrilm.py",
"copies": "1",
"size": "1105",
"license": "apache-2.0",
"hash": 2479032437546653000,
"line_mean": 45.0833333333,
"line_max": 111,
"alpha_frac": 0.6488687783,
"autogenerated": false,
"ratio": 3.6111111111111... |
__author__ = 'wang'
import glob, subprocess, re
from Utils.DbUtils import DbUtils
import os
from distutils import file_util, dir_util
import shutil
DBClient = DbUtils()
def recurseCivetFolder():
# Recurse through the main folder
fileList = []
for mainFolder in glob.glob('/data/data02/ADNI/CBRAIN/?????*/')... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Utils/addOldCivetFiles.py",
"copies": "1",
"size": "4692",
"license": "apache-2.0",
"hash": 652160235160014500,
"line_mean": 39.8086956522,
"line_max": 243,
"alpha_frac": 0.5846121057,
"autogenerated": false,
"ratio": 3.2448132780082988,
... |
__author__ = 'wang'
import os
import Config.LIB_PATH as libpath
from Utils.DbUtils import DbUtils
from Pipelines.ADNI_Fmri.ADNI_V1_FMRI import ADNI_V1_FMRI
def setEnvironmentVariables():
os.environ['PATH'] = ':'.join(libpath.PATH)
os.environ['LD_LIBRARY_PATH'] = ':'.join(libpath.LD_LIBRARY_PATH)
os.environ... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Utils/testingFmriNiakPreprocessing.py",
"copies": "1",
"size": "1432",
"license": "apache-2.0",
"hash": -1707873550200815600,
"line_mean": 46.7666666667,
"line_max": 236,
"alpha_frac": 0.6822625698,
"autogenerated": false,
"ratio": 3.0928... |
__author__ = 'wang'
from Utils.DbUtils import DbUtils
import ast
from Pipelines.ADNI_Fmri.Niak import Niak
import Pipelines.ADNI_Fmri.SmoothFmriFile as smoothing
from Utils.PipelineLogger import PipelineLogger
class ProcessingItemObj:
def __init__(self, processingItem):
self.processing_rid = processingIt... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Pipelines/ADNI_Fmri/ADNI_V1_FMRI.py",
"copies": "1",
"size": "2039",
"license": "apache-2.0",
"hash": 396809842784083500,
"line_mean": 36.7777777778,
"line_max": 119,
"alpha_frac": 0.6743501717,
"autogenerated": false,
"ratio": 3.81835205... |
__author__ = 'wang'
import csv
import Config.CsvImportConfig as config
import sys
class csvToDatabase:
def __init__(self, sqlDatabase, csvFile, sqlTable):
# Insert csv file content per row
header = 1
for row in csv.reader(line.replace('\0', '') for line in csvFile):
if header: ... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Manager/CsvImport/csvToDatabase.py",
"copies": "1",
"size": "1858",
"license": "apache-2.0",
"hash": -4930651963007991000,
"line_mean": 39.4130434783,
"line_max": 109,
"alpha_frac": 0.5748116254,
"autogenerated": false,
"ratio": 4.4771084... |
__author__ = 'wang'
import glob
import os
import csv
import Config.CsvImportConfig as config
import openpyxl
from openpyxl.styles import Font
inputFolder = '/data/data01/wang/adni_csv'
outputFile = '/home/wang/Downloads/header.xlsx'
def extractHeader(csvFile, sqlTable, bookSheet, i):
# Export the headers from t... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Utils/extractCsvHeaders.py",
"copies": "1",
"size": "1215",
"license": "apache-2.0",
"hash": -3517700617496342000,
"line_mean": 25.4347826087,
"line_max": 88,
"alpha_frac": 0.6205761317,
"autogenerated": false,
"ratio": 3.5526315789473686... |
__author__ = 'wangzhaoyi'
import MySQLdb
from zhihu import Question
from zhihu import User
from zhihu import Collection
from zhihu import Search
class ConnectItem:
def __init__(self,user=None, host=None, password=None, dbname=None):
self.user = user
self.host = host
self.password = passwo... | {
"repo_name": "Ulden/WormForZhihu",
"path": "worm.py",
"copies": "2",
"size": "3907",
"license": "mit",
"hash": -4138417472516061000,
"line_mean": 39.6979166667,
"line_max": 175,
"alpha_frac": 0.6160737138,
"autogenerated": false,
"ratio": 3.627669452181987,
"config_test": false,
"has_no_keyw... |
__author__ = 'wardcoessens'
numbers = 'zero, one, two, three, four, five, six, seven, eight, nine'.split(', ')
speciallekes = {11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen',
16: 'sixteen', 17: 'seventeen', 18: 'eighteen', 19: 'nineteen'}
tientallen = 'zero, ten, twenty, th... | {
"repo_name": "fahrrad/euler",
"path": "euler_17.py",
"copies": "1",
"size": "1666",
"license": "apache-2.0",
"hash": 6897759527205328000,
"line_mean": 21.2266666667,
"line_max": 98,
"alpha_frac": 0.4705882353,
"autogenerated": false,
"ratio": 2.892361111111111,
"config_test": false,
"has_no_... |
__author__ = 'warenix'
import sqlite3 as lite
SOURCE_TYPE_591 = 1
SOURCE_TYPE_CENTANET = 2
SOURCE_TYPE_HSE28 = 3
REVERSE_GEOCODING_STATUS_PENDING = 0
REVERSE_GEOCODING_STATUS_FAIL = 1
REVERSE_GEOCODING_STATUS_SUCCESS = 2
class HousingDB(object):
con = None
def dict_factory(self, cursor, row):
d = {... | {
"repo_name": "warenix/renthse",
"path": "renthse/core/db.py",
"copies": "1",
"size": "3163",
"license": "mit",
"hash": -9048749795182881000,
"line_mean": 28.0183486239,
"line_max": 107,
"alpha_frac": 0.4849826114,
"autogenerated": false,
"ratio": 4.076030927835052,
"config_test": false,
"has... |
__author__ = 'waroquiers'
import abc
from monty.json import MSONable
class AbstractEnvironmentNode(MSONable):
"""
Abstract class used to define an environment as a node in a graph.
"""
COORDINATION_ENVIRONMENT = 0
NUMBER_OF_NEIGHBORING_COORDINATION_ENVIRONMENTS = 1
NUMBER_OF_NEIGHBORING_CES ... | {
"repo_name": "gVallverdu/pymatgen",
"path": "pymatgen/analysis/chemenv/connectivity/environment_nodes.py",
"copies": "3",
"size": "9331",
"license": "mit",
"hash": -6160603400304696000,
"line_mean": 40.8430493274,
"line_max": 118,
"alpha_frac": 0.6183688779,
"autogenerated": false,
"ratio": 3.88... |
__author__ = "waroquiers"
import numpy as np
from pymatgen.analysis.chemenv.connectivity.environment_nodes import EnvironmentNode
from pymatgen.analysis.chemenv.utils.graph_utils import (
MultiGraphCycle,
SimpleGraphCycle,
get_delta,
)
from pymatgen.util.testing import PymatgenTest
class FakeNode(object... | {
"repo_name": "davidwaroquiers/pymatgen",
"path": "pymatgen/analysis/chemenv/utils/tests/test_graph_utils.py",
"copies": "1",
"size": "29262",
"license": "mit",
"hash": 2487051334786314000,
"line_mean": 36.0405063291,
"line_max": 114,
"alpha_frac": 0.5498598865,
"autogenerated": false,
"ratio": 3... |
__author__ = 'watsy'
from django.db import models
from django.utils.translation import gettext_lazy as _
class Category(models.Model):
title = models.CharField(max_length=32)
def __unicode__(self):
return self.title
class BasePost(models.Model):
DRAFT = 0
LIVE = 1
CLOSED = 2
... | {
"repo_name": "watsy0007/qiqiBlog",
"path": "QiQiBlog/blog/models.py",
"copies": "1",
"size": "1106",
"license": "mit",
"hash": 8173043939830392000,
"line_mean": 22.5319148936,
"line_max": 65,
"alpha_frac": 0.6130198915,
"autogenerated": false,
"ratio": 3.662251655629139,
"config_test": false,
... |
import os
curDir = os.getcwd()
#App Directory
appDir = str(curDir + "/app")
#App Sub Directories
shareDir = str(appDir + "/Shared")
compDir = str(appDir + "/Components")
#shareDir Sub directories
navDir = str(shareDir + "/Navigation")
#compDir Sub Directories
homeDir = str(compDir + "/home")
#assets directory
as... | {
"repo_name": "nvwlspls/AngularLauncher",
"path": "launchAngular.py",
"copies": "1",
"size": "1392",
"license": "bsd-3-clause",
"hash": -5199082938215546000,
"line_mean": 20.75,
"line_max": 70,
"alpha_frac": 0.7104885057,
"autogenerated": false,
"ratio": 2.806451612903226,
"config_test": false,... |
__author__ = 'Wayne'
from django import forms
from django.contrib.auth import authenticate
from messenger.models import Officer
from django.utils.safestring import mark_safe
class LoginForm(forms.Form):
username = forms.CharField(max_length=100, label='User ID')
password = forms.CharField(widget=forms.Passwor... | {
"repo_name": "watbe/defero",
"path": "messenger/forms.py",
"copies": "1",
"size": "3513",
"license": "mit",
"hash": 8752766680338286000,
"line_mean": 45.8533333333,
"line_max": 121,
"alpha_frac": 0.5502419584,
"autogenerated": false,
"ratio": 5.151026392961877,
"config_test": false,
"has_no_... |
__author__ = 'Wayne'
from django.shortcuts import render_to_response, RequestContext, HttpResponseRedirect
from messenger.forms import MessageForm, ReplyForm
from messenger import views
import messenger.messenger_methods as messenger
from django.contrib.auth import get_user_model
from datetime import datetime
# import... | {
"repo_name": "watbe/defero",
"path": "messenger/messenger_views.py",
"copies": "1",
"size": "5226",
"license": "mit",
"hash": 5251395204203182000,
"line_mean": 34.0805369128,
"line_max": 111,
"alpha_frac": 0.6511672407,
"autogenerated": false,
"ratio": 4.252237591537836,
"config_test": false,
... |
__author__ = 'Wayne'
from uuid import uuid4
from messenger.models import Conversation, BaseMessage, Officer
from django.contrib.auth import get_user_model
import re
from datetime import datetime
from random import randint
from django.core.mail import send_mail
# import the logging library
import logging
logger = loggi... | {
"repo_name": "watbe/defero",
"path": "messenger/messenger_methods.py",
"copies": "1",
"size": "5053",
"license": "mit",
"hash": 6533367584001388000,
"line_mean": 32.25,
"line_max": 117,
"alpha_frac": 0.6447654858,
"autogenerated": false,
"ratio": 4.242653232577666,
"config_test": false,
"has... |
__author__ = 'Wayne'
import api_connection as api
from models import Match, World
def get_worlds():
"""
http://wiki.guildwars2.com/wiki/API:1/world_names
"""
for w in api.api_request('world_names'):
world = World(world_id=w['id'], name=w['name'])
world.save()
return World.objects.... | {
"repo_name": "watbe/gw2-battle-tools",
"path": "gw2api/wvw_requests.py",
"copies": "1",
"size": "1040",
"license": "mit",
"hash": 8247722743522548000,
"line_mean": 26.3947368421,
"line_max": 71,
"alpha_frac": 0.5855769231,
"autogenerated": false,
"ratio": 3.1044776119402986,
"config_test": fal... |
__author__ = 'waziz'
from itertools import izip
import numpy as np
def scaled_fmap(fmap, scaling=1.0):
"""Returns a feature map scaled by a constant"""
if type(fmap) is dict:
return {k: v*scaling for k, v in fmap.iteritems()}
else:
return {k: v*scaling for k, v in fmap}
def fmap_dot(fma... | {
"repo_name": "wilkeraziz/chisel",
"path": "python/chisel/util/__init__.py",
"copies": "1",
"size": "2047",
"license": "apache-2.0",
"hash": 2440916373282697700,
"line_mean": 32.0161290323,
"line_max": 122,
"alpha_frac": 0.6394723986,
"autogenerated": false,
"ratio": 3.20846394984326,
"config_t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.