text stringlengths 0 1.05M | meta dict |
|---|---|
___author___ = "Olga Titova"
import copy
class BranchAndBound(object):
def __init__(self, e=(),c=()):
n = len(e)
self.Coef = c
self.Elem = e
self.X = 0
self.C = 0
self.Adress = [0 for _ in range(n+1)]
self.Adress[0] = 1
self.FixedValue... | {
"repo_name": "stonelake/pyoptimization",
"path": "pyopt/discrete/branchandbound.py",
"copies": "1",
"size": "4508",
"license": "apache-2.0",
"hash": -8580142936516173000,
"line_mean": 32.4122137405,
"line_max": 92,
"alpha_frac": 0.4653948536,
"autogenerated": false,
"ratio": 3.5664556962025316,
... |
___author___ = "Olga Titova"
import itertools as it
from branchandbound import BranchAndBound
from combinatorial_set import CombinatorialSet
class CyclePermutationSet(CombinatorialSet):
"""
Describes the set of permutations
"""
def __init__(self, s=()):
super(CyclePermutationSet, ... | {
"repo_name": "stonelake/pyoptimization",
"path": "pyopt/discrete/cycle_permutations.py",
"copies": "1",
"size": "1400",
"license": "apache-2.0",
"hash": 4446647511259326500,
"line_mean": 29.1111111111,
"line_max": 97,
"alpha_frac": 0.545,
"autogenerated": false,
"ratio": 3.3175355450236967,
"c... |
__author__ = 'oliverhuang'
import requests
from bs4 import BeautifulSoup
def getData():
items = list()
website = "http://www.amazon.cn/gp/feature.html/ref=sa_menu_kindle_l3_f126758?ie=UTF8&docId=126758"
# w1 = "http://www.google.com"
res = requests.get(website)
# print res.status_code
soup = Be... | {
"repo_name": "v42me/daily-collection",
"path": "app/getAmazon.py",
"copies": "1",
"size": "1152",
"license": "mit",
"hash": 4702764647379761000,
"line_mean": 28.5384615385,
"line_max": 103,
"alpha_frac": 0.5607638889,
"autogenerated": false,
"ratio": 3.217877094972067,
"config_test": false,
... |
__author__ = "Oliver Lindemann"
from pickle import dumps, loads
from expyriment import io, misc
from .. import __version__ as forceDAQVersion
from .._lib.misc import SensorHistory
from .._lib.types import ForceData, Thresholds, GUIRemoteControlCommands as RcCmd
from ..force.sensor_process import SensorProcess
from ... | {
"repo_name": "lindemann09/pyForceDAQ",
"path": "forceDAQ/gui/_gui_status.py",
"copies": "1",
"size": "13931",
"license": "mit",
"hash": -1012759267734370300,
"line_mean": 44.6754098361,
"line_max": 105,
"alpha_frac": 0.5551647405,
"autogenerated": false,
"ratio": 4.141200951248513,
"config_tes... |
__author__ = 'Oliver Lindemann'
# helper functions
import os
from time import strftime
import pygame
from expyriment import stimuli
from expyriment.misc import constants
from .. import __version__ as forceDAQVersion
colours = [constants.C_RED,
constants.C_GREEN,
constants.C_YELLOW,
... | {
"repo_name": "lindemann09/pyForceDAQ",
"path": "forceDAQ/gui/_layout.py",
"copies": "1",
"size": "4616",
"license": "mit",
"hash": -2597686139431588000,
"line_mean": 43.3846153846,
"line_max": 91,
"alpha_frac": 0.5649913345,
"autogenerated": false,
"ratio": 3.609069585613761,
"config_test": fa... |
__author__ = 'Oliver Lindemann'
import atexit
import ctypes as ct
from multiprocessing import Process, Event, sharedctypes, Pipe
import logging
from .._lib.types import DAQEvents
from .._lib.timer import app_timer
from .._lib.polling_time_profile import PollingTimeProfile
from .._lib.process_priority_manager import g... | {
"repo_name": "lindemann09/pyForceDAQ",
"path": "forceDAQ/force/sensor_process.py",
"copies": "1",
"size": "7935",
"license": "mit",
"hash": 587679354981359400,
"line_mean": 34.1150442478,
"line_max": 91,
"alpha_frac": 0.5577819786,
"autogenerated": false,
"ratio": 3.9894419306184012,
"config_t... |
__author__ = 'Oliver Lindemann'
import ctypes as ct
from .misc import MinMaxDetector as _MinMaxDetector
# tag in data output
TAG_COMMENTS = "#"
TAG_DAQEVENT = TAG_COMMENTS + "T"
TAG_UDPDATA = TAG_COMMENTS + "UDP"
CTYPE_FORCES = ct.c_float * 600
CTYPE_TRIGGER = ct.c_float * 2
class PollingPriority(object):
NORM... | {
"repo_name": "lindemann09/pyForceDAQ",
"path": "forceDAQ/_lib/types.py",
"copies": "1",
"size": "11594",
"license": "mit",
"hash": -1019228052867290100,
"line_mean": 28.5790816327,
"line_max": 103,
"alpha_frac": 0.5704674832,
"autogenerated": false,
"ratio": 3.759403372243839,
"config_test": f... |
__author__ = 'Oliver Lindemann'
import numpy as np
import logging
from .._lib.timer import Timer
from ._config import NUM_SAMPS_PER_CHAN, TIMEOUT, NI_DAQ_BUFFER_SIZE
class DAQReadAnalog(object):
NUM_SAMPS_PER_CHAN = NUM_SAMPS_PER_CHAN
TIMEOUT = TIMEOUT
NI_DAQ_BUFFER_SIZE = NI_DAQ_BUFFER_SIZE
DAQ_TYPE... | {
"repo_name": "lindemann09/pyForceDAQ",
"path": "forceDAQ/daq/_daq_read_Analog_dummy.py",
"copies": "1",
"size": "2172",
"license": "mit",
"hash": -9018369114698942000,
"line_mean": 26.8461538462,
"line_max": 78,
"alpha_frac": 0.5713627993,
"autogenerated": false,
"ratio": 3.6442953020134228,
"... |
__author__ = 'olivermoege'
from django.contrib.auth import authenticate, login, logout
from django.template import RequestContext
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.template import loader
from django.views.decorator... | {
"repo_name": "FHBrandenburg/MTDjango",
"path": "Multitenancy/university_test_app/views.py",
"copies": "1",
"size": "2640",
"license": "apache-2.0",
"hash": 354219054805486500,
"line_mean": 27.6956521739,
"line_max": 85,
"alpha_frac": 0.6935606061,
"autogenerated": false,
"ratio": 4.1574803149606... |
__author__ = 'Oliver'
from models import Tutor
import collections
import random
class NoSearchTerms(Exception):
pass
def remove_values_from_list(the_list, val):
return [ value for value in the_list if value.lower() not in val and len(value) >= 2 ]
def strSearchTutors(search_terms = ''):
"""
This fu... | {
"repo_name": "EngTurtle/skule_tutors2",
"path": "tutors/search.py",
"copies": "2",
"size": "1984",
"license": "mit",
"hash": -4299326719256031000,
"line_mean": 31.0161290323,
"line_max": 90,
"alpha_frac": 0.6023185484,
"autogenerated": false,
"ratio": 3.764705882352941,
"config_test": false,
... |
__author__ = 'Oliver'
from django import forms
from course_manage.models import Course
from tutors.models import Tutor
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
def is_email_used(email):
tutors = Tutor.objects.filter(email=email)
users = User.objects.filter... | {
"repo_name": "EngTurtle/skule_tutors2",
"path": "tutors/forms.py",
"copies": "2",
"size": "2785",
"license": "mit",
"hash": -6701801776264599000,
"line_mean": 41.196969697,
"line_max": 120,
"alpha_frac": 0.5709156194,
"autogenerated": false,
"ratio": 4.484702093397746,
"config_test": false,
... |
__author__ = 'Oliver'
from models import *
from django.contrib import admin
class TutorAdmin(admin.ModelAdmin):
# list options
list_display = [ 'name', 'email', 'rate', 'approved' ]
list_editable = [ 'approved' ]
list_filter = [ 'rate', 'last_updated', 'approved' ]
actions = [ 'approveTutor', 'di... | {
"repo_name": "EngTurtle/skule_tutors2",
"path": "tutors/admin.py",
"copies": "2",
"size": "1845",
"license": "mit",
"hash": -8093907004263112000,
"line_mean": 37.4583333333,
"line_max": 108,
"alpha_frac": 0.6395663957,
"autogenerated": false,
"ratio": 3.8357588357588357,
"config_test": false,
... |
__author__ = 'Oliver Roess'
import re
from cStringIO import StringIO
def parseStderr(stderr):
"""Parse output and return CSV StringIO object.
:param stderr: a file object containing the stderr of ycsb (using -s)
"""
csvString = StringIO()
# write header
print >>csvString, "Time (s),Operation... | {
"repo_name": "cloudyday/BenchMon",
"path": "YCSBOutputParser.py",
"copies": "1",
"size": "6670",
"license": "mit",
"hash": -1566588133150726000,
"line_mean": 27.75,
"line_max": 96,
"alpha_frac": 0.5223388306,
"autogenerated": false,
"ratio": 3.601511879049676,
"config_test": false,
"has_no_k... |
from __future__ import print_function
from time import time
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.decomposition import NMF, LatentDirichletAllocation
from sklearn.datasets import fetch_20newsgroups
from scipy.stats import entropy
from numpy.linalg import norm
impor... | {
"repo_name": "marquesarthur/BugAnalysisRecommender",
"path": "dataset/ml/topic.py",
"copies": "1",
"size": "7022",
"license": "mit",
"hash": -1073667992745265500,
"line_mean": 32.4380952381,
"line_max": 200,
"alpha_frac": 0.6389917402,
"autogenerated": false,
"ratio": 3.3501908396946565,
"conf... |
from __future__ import print_function
from time import time
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.decomposition import LatentDirichletAllocation
from sklearn.datasets import fetch_20newsgroups
import nltk
from sklearn.feature_extraction.text import CountVectorizer
import feedparser
... | {
"repo_name": "gtrdp/twitter-clustering",
"path": "clustering-lda.py",
"copies": "1",
"size": "2885",
"license": "mit",
"hash": -5793991871805920000,
"line_mean": 29.0520833333,
"line_max": 123,
"alpha_frac": 0.6391681109,
"autogenerated": false,
"ratio": 3.059384941675504,
"config_test": false... |
import numpy as np
from scipy import sparse
from scipy import linalg
from numpy.testing import assert_equal
from numpy.testing import assert_almost_equal
from nose.tools import assert_true
from sklearn.utils.extmath import randomized_svd
from sklearn.datasets.samples_generator import make_low_rank_matrix
def test_... | {
"repo_name": "cdegroc/scikit-learn",
"path": "sklearn/utils/tests/test_svd.py",
"copies": "1",
"size": "5365",
"license": "bsd-3-clause",
"hash": 4285709285158193700,
"line_mean": 34.7666666667,
"line_max": 78,
"alpha_frac": 0.65722274,
"autogenerated": false,
"ratio": 3.3869949494949494,
"con... |
import numpy as np
from scipy import sparse
from scipy import linalg
from numpy.testing import assert_equal
from numpy.testing import assert_almost_equal
from sklearn.utils.extmath import fast_svd
from sklearn.datasets.samples_generator import make_low_rank_matrix
def test_fast_svd_low_rank():
"""Check that ex... | {
"repo_name": "joshbohde/scikit-learn",
"path": "sklearn/utils/tests/test_svd.py",
"copies": "2",
"size": "5128",
"license": "bsd-3-clause",
"hash": 5532409941389286000,
"line_mean": 33.8843537415,
"line_max": 84,
"alpha_frac": 0.6468408736,
"autogenerated": false,
"ratio": 3.345075016307893,
"... |
import numpy as np
from nose.tools import assert_equal, assert_true
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
from sklearn.externals.six import b, u
from sklearn.utils.murmurhash import murmurhash3_32
def test_mmhash3_int():
assert_equal(murmurhash3_32(3), 8... | {
"repo_name": "DailyActie/Surrogate-Model",
"path": "01-codes/scikit-learn-master/sklearn/utils/tests/test_murmurhash.py",
"copies": "1",
"size": "2838",
"license": "mit",
"hash": -126604131589458580,
"line_mean": 34.475,
"line_max": 73,
"alpha_frac": 0.6610288936,
"autogenerated": false,
"ratio"... |
import numpy as np
from sklearn.externals.six import b, u
from sklearn.utils.murmurhash import murmurhash3_32
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
from sklearn.utils.testing import assert_equal, assert_true
def test_mmhash3_int():
assert_equal(murmurhas... | {
"repo_name": "JPFrancoia/scikit-learn",
"path": "sklearn/utils/tests/test_murmurhash.py",
"copies": "79",
"size": "2849",
"license": "bsd-3-clause",
"hash": 6036184449999118000,
"line_mean": 34.6125,
"line_max": 73,
"alpha_frac": 0.661986662,
"autogenerated": false,
"ratio": 3.037313432835821,
... |
import numpy as np
from sklearn.utils.murmurhash import murmurhash3_32
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
from nose.tools import assert_equal, assert_true
def test_mmhash3_int():
assert_equal(murmurhash3_32(3), 847579505)
assert_equal(murmurhash3_... | {
"repo_name": "sgenoud/scikit-learn",
"path": "sklearn/utils/tests/test_murmurhash.py",
"copies": "6",
"size": "2784",
"license": "bsd-3-clause",
"hash": -8818216530239232000,
"line_mean": 34.2405063291,
"line_max": 73,
"alpha_frac": 0.6623563218,
"autogenerated": false,
"ratio": 3.01298701298701... |
__author__ = 'Olivier Pieters'
"""Dynamic Number module.
This module adds a variable (and more generally, even string) export option to LaTeX. This way, symbolic links between Python and LaTeX are possible so variables are always up to date, even within paragraphs.
"""
class dn:
"""Dynamic Number class
Dyn... | {
"repo_name": "opieters/DynamicNumber",
"path": "languages/python/dn.py",
"copies": "1",
"size": "2153",
"license": "mit",
"hash": -2418929538219609600,
"line_mean": 34.2950819672,
"line_max": 208,
"alpha_frac": 0.573153739,
"autogenerated": false,
"ratio": 4.024299065420561,
"config_test": fal... |
"""
Simple .ht (HyperText Template) document tree Writer.
.ht tmeplate files are essentially normal HTML, with
an option set of RFC 2822-like headers at the top of
the file. There must be at least one blank line between
the last header and the start of the body HTML.
See http://ht2html.sf.net/ for more information o... | {
"repo_name": "dbcls/dbcls-galaxy",
"path": "lib/galaxy/util/docutils_ext/htmlfrag.py",
"copies": "3",
"size": "5839",
"license": "mit",
"hash": 824154034777856900,
"line_mean": 41.6204379562,
"line_max": 78,
"alpha_frac": 0.6007878061,
"autogenerated": false,
"ratio": 4.088935574229692,
"confi... |
__author__ = 'omer'
import os
import sys
import subprocess
import traceback
import time
from Daemon import Daemon
from Logger import Logger
class Runner(Daemon):
TWEET_PID_NAME = "Tweet_PID"
BUBBLE_PID_NAME = "OpticBubble_PID"
def __init__(self):
Daemon.__init__(self, pidfile="Runner_PID", st... | {
"repo_name": "bashao/FermBot",
"path": "Runner.py",
"copies": "1",
"size": "2403",
"license": "mit",
"hash": -3898633547509972500,
"line_mean": 32.3888888889,
"line_max": 107,
"alpha_frac": 0.4943820225,
"autogenerated": false,
"ratio": 4.086734693877551,
"config_test": false,
"has_no_keywor... |
__author__ = 'omniscope'
import numpy as np
import optparse, sys, os
script_path = os.path.dirname(os.path.realpath(__file__))
labels = ['Synchrotron', 'CMB', 'HI', 'Dust1', 'Dust2', 'Free-Free']
n_comp = len(labels)
kB = 1.38065e-23
C = 2.99792e8
h = 6.62607e-34
T = 2.725
hoverk = h / kB
def K_CMB2MJysr(K_CMB, nu):#... | {
"repo_name": "jeffzhen/gsm2016",
"path": "create_map.py",
"copies": "1",
"size": "4819",
"license": "mit",
"hash": -771836213065153500,
"line_mean": 34.6962962963,
"line_max": 240,
"alpha_frac": 0.652417514,
"autogenerated": false,
"ratio": 2.7968659315148,
"config_test": false,
"has_no_keyw... |
__author__ = 'Omry_Nachman'
from numpy import median, std, mean
from time import time
class Sensor(object):
def __init__(self, name, measure_func, pre_measure=None, post_measure=None,
samples_count=10, max_std=None, min_value=None, max_value=None):
self.name = name
self.measurePro... | {
"repo_name": "omryn/ph-meter",
"path": "sensors/abstractsensors.py",
"copies": "1",
"size": "4548",
"license": "mit",
"hash": 7790752453633203000,
"line_mean": 37.8803418803,
"line_max": 114,
"alpha_frac": 0.6083992964,
"autogenerated": false,
"ratio": 3.5952569169960475,
"config_test": false,... |
__author__ = 'Omry_Nachman'
from time import sleep
class Tap(object):
def __init__(self, pi_face, output_pin, open_value=True):
self.pi_face = pi_face
self.output_pin = output_pin
self.open_value = open_value
self.state = None
self.close()
def switch(self, open_tap=Tru... | {
"repo_name": "omryn/ph-meter",
"path": "behaviors/taps.py",
"copies": "1",
"size": "1970",
"license": "mit",
"hash": 2452347475050676000,
"line_mean": 30.2698412698,
"line_max": 115,
"alpha_frac": 0.6045685279,
"autogenerated": false,
"ratio": 3.456140350877193,
"config_test": false,
"has_no... |
__author__ = 'Omry_Nachman'
from .Adafruit_ADS1x15 import ADS1x15
from pifacedigitalio import PiFaceDigital
from .abstractsensors import *
from time import sleep
class SensorWithPower(Sensor):
def __init__(self, name, power_pin=2, ads_channel=1, pga=4096,
pi_face=PiFaceDigital(), ads=ADS1x15(ic=... | {
"repo_name": "omryn/ph-meter",
"path": "sensors/physicalsensors.py",
"copies": "1",
"size": "1848",
"license": "mit",
"hash": 90071440705527180,
"line_mean": 34.5576923077,
"line_max": 104,
"alpha_frac": 0.5757575758,
"autogenerated": false,
"ratio": 3.236427320490368,
"config_test": false,
... |
__author__ = 'Omry_Nachman'
import time
def noop():
return None
class RetryPolicy(object):
def __init__(self, wait_before_recheck=10, max_retries=10, recheck_when=True,
recheck_on_error=True, on_failed_all=noop):
self.wait_before_recheck = wait_before_recheck
self.recheck_w... | {
"repo_name": "omryn/ph-meter",
"path": "behaviors/behavior.py",
"copies": "1",
"size": "2880",
"license": "mit",
"hash": -7228302553496907000,
"line_mean": 33.2976190476,
"line_max": 94,
"alpha_frac": 0.5871527778,
"autogenerated": false,
"ratio": 3.8247011952191237,
"config_test": false,
"h... |
__author__ = 'ones'
import os, signal
errors = {'Ones':['.FALSE.', '.TRUE.']}
def tail(f, n, offset=0):
stdin,stdout = os.popen2("tail -n "+str(n)+ str(offset)+" "+f)
stdin.close()
lines = stdout.readlines()
stdout.close()
return lines
def check_error_logfile(directory, pid):
incar_f = open(directo... | {
"repo_name": "cwandtj/A2P2",
"path": "a2p2_170111updated/error_handling.py",
"copies": "1",
"size": "1601",
"license": "mit",
"hash": 4669238057670062000,
"line_mean": 24.8225806452,
"line_max": 64,
"alpha_frac": 0.45908807,
"autogenerated": false,
"ratio": 3.646924829157175,
"config_test": fa... |
__author__ = 'ones'
import os, sys, threading
import error_handling
working_dir = os.getcwd()
directories = []
zombies = []
if len(sys.argv) == 1:
os.system('find -mindepth 3 -type d > compounds_directories')
elif len(sys.argv) == 2:
root = sys.argv[1]
depth = root.count('/')
os.system('find ./'+ro... | {
"repo_name": "cwandtj/A2P2",
"path": "a2p2_170111updated/run_jobs.py",
"copies": "1",
"size": "1464",
"license": "mit",
"hash": -4252385490913392000,
"line_mean": 16.8536585366,
"line_max": 91,
"alpha_frac": 0.599726776,
"autogenerated": false,
"ratio": 2.981670061099796,
"config_test": false,... |
__author__ = 'onur'
from celery import Celery
import drenaj_api.config.server_celeryconfig as celeryconfig
app_object = Celery()
app_object.config_from_object(celeryconfig)
@app_object.task
def deneme(x, seconds):
print "Sleeping for printing %s for %s seconds.." % (x, seconds)
import time
time.sleep(s... | {
"repo_name": "boun-cmpe-soslab/drenaj",
"path": "drenaj/drenaj_api/celery_app/server_endpoint.py",
"copies": "1",
"size": "7823",
"license": "mit",
"hash": 6782901999453933000,
"line_mean": 46.7073170732,
"line_max": 244,
"alpha_frac": 0.5954237505,
"autogenerated": false,
"ratio": 3.11549183592... |
__author__ = 'onur'
# import logging
# import logging.handlers
#
# logger = logging.getLogger("httpstream")
# logger.addHandler(logging.handlers.RotatingFileHandler("neo4j.log", maxBytes=10000000, backupCount=10))
from py2neo import Graph, Node, neo4j, Relationship, watch
from py2neo.core import GraphError, ClientErr... | {
"repo_name": "boun-cmpe-soslab/drenaj",
"path": "drenaj/drenaj_api/utils/drenajneo4jmanager.py",
"copies": "1",
"size": "14406",
"license": "mit",
"hash": -4331768939007542000,
"line_mean": 40.7565217391,
"line_max": 459,
"alpha_frac": 0.592808552,
"autogenerated": false,
"ratio": 3.130378096479... |
__author__ = 'onur'
import time
from drenaj.utils.drnj_time import py_time2drnj_time
import requests
def main():
import argparse
parser = argparse.ArgumentParser(description='get tweets by campaign id')
parser.add_argument('campaign_id', default='2014avrasya1', help='campaign id')
parser.add_argument... | {
"repo_name": "boun-cmpe-soslab/drenaj",
"path": "drenaj/client/utils/get_tweets_by_campaign.py",
"copies": "1",
"size": "1612",
"license": "mit",
"hash": -5691677763640351000,
"line_mean": 34.0652173913,
"line_max": 223,
"alpha_frac": 0.658808933,
"autogenerated": false,
"ratio": 3.1857707509881... |
__author__ = 'oonarfiandwi'
from flask import Flask
from flask import request
from google.appengine.api import taskqueue, memcache
from google.appengine.datastore import entity_pb
from google.appengine.ext import ndb
from model_profile import Profile
from datetime import datetime, timedelta
from os import environ
from... | {
"repo_name": "oonid/dilingkari",
"path": "db_indonesia.py",
"copies": "1",
"size": "16309",
"license": "mit",
"hash": -8406888380287091000,
"line_mean": 48.874617737,
"line_max": 118,
"alpha_frac": 0.6672389478,
"autogenerated": false,
"ratio": 3.295413214790867,
"config_test": false,
"has_n... |
__author__ = 'oonarfiandwi'
from flask import Flask, request
from google.appengine.api import urlfetch, memcache
from os import path, environ
from model_profile import Profile
from google.appengine.ext import ndb
import jinja2
import urllib
import simplejson as json
import logging
app = Flask(__name__)
app.config['... | {
"repo_name": "oonid/dilingkari",
"path": "web_dilingkari.py",
"copies": "1",
"size": "5052",
"license": "mit",
"hash": 456114988592407700,
"line_mean": 32.6866666667,
"line_max": 111,
"alpha_frac": 0.626682502,
"autogenerated": false,
"ratio": 3.4937759336099585,
"config_test": false,
"has_n... |
__author__ = 'oonarfiandwi'
from flask import Flask, request
from oauth2client.appengine import AppAssertionCredentials
from google.appengine.api import memcache, urlfetch
from google.appengine.ext import ndb
from apiclient import discovery
from datetime import datetime, timedelta
from model_profile import Profile
im... | {
"repo_name": "oonid/dilingkari",
"path": "api_activity.py",
"copies": "1",
"size": "3323",
"license": "mit",
"hash": 822880602732363500,
"line_mean": 37.6511627907,
"line_max": 110,
"alpha_frac": 0.5991573879,
"autogenerated": false,
"ratio": 4.315584415584415,
"config_test": false,
"has_no_... |
__author__ = 'oonarfiandwi'
import simplejson as json
"""
Sample implementation of Class in Python
https://docs.python.org/2/tutorial/classes.html
"""
class People:
"""
People is a model from Google+ API People
https://developers.google.com/+/api/latest/people
"""
def __init__(se... | {
"repo_name": "oonid/dilingkari",
"path": "People.py",
"copies": "1",
"size": "1517",
"license": "mit",
"hash": -3962079346245561300,
"line_mean": 35.119047619,
"line_max": 100,
"alpha_frac": 0.5952537904,
"autogenerated": false,
"ratio": 3.4555808656036446,
"config_test": false,
"has_no_keyw... |
__author__ = 'Orange'
from database import Base
from sqlalchemy import Table, Column, Integer, String, ForeignKey
from sqlalchemy.orm import relationship, backref
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.ext.declarative import declarative_base
class Book(Base):
__tablename__ = ... | {
"repo_name": "orange22/microblog",
"path": "app/models.py",
"copies": "1",
"size": "1477",
"license": "bsd-3-clause",
"hash": -5894060716494564000,
"line_mean": 29.7708333333,
"line_max": 74,
"alpha_frac": 0.6310088016,
"autogenerated": false,
"ratio": 3.9281914893617023,
"config_test": false,... |
__author__ = 'orange'
import pprint
from app import app
from app.models import *
from app.forms import *
from sqlalchemy import desc, or_
from database import db_session
from flask import render_template, session, request, redirect, url_for
from functools import wraps
def login_required(f):
@wraps(f)
def deco... | {
"repo_name": "orange22/microblog",
"path": "app/views.py",
"copies": "1",
"size": "5064",
"license": "bsd-3-clause",
"hash": 2191763208161748200,
"line_mean": 31.4615384615,
"line_max": 103,
"alpha_frac": 0.637835703,
"autogenerated": false,
"ratio": 3.417004048582996,
"config_test": false,
... |
__author__ = 'orchie'
import sys
import json
import logging
import numpy as np
from lmfit import minimize, Parameters
from lmfit import Model
def parsePoint(point):
if point['y'] and point['x']:
return point
class Point:
def __init__(self,xvalue,yvalue,sequence=0):
self.sequenceNumber=sequen... | {
"repo_name": "massfords/we99",
"path": "we99-domain-impl/src/main/resources/curveFitting.py",
"copies": "3",
"size": "4231",
"license": "apache-2.0",
"hash": 7632642170525631000,
"line_mean": 30.1176470588,
"line_max": 142,
"alpha_frac": 0.613330182,
"autogenerated": false,
"ratio": 3.2951713395... |
__author__ = 'orhan'
from convexhull.base import ConvexHullBase
class GrahamScan(ConvexHullBase):
def calculate(self):
self.bottom_right = self.get_bottom_right_point()
sorted_list = [point for point in sorted(self.points, cmp=self.__compare_with_x_angle) if point != self.bottom_right]
... | {
"repo_name": "ocozalp/Algorithms",
"path": "convexhull/grahamscan.py",
"copies": "1",
"size": "1397",
"license": "apache-2.0",
"hash": 6120505313422087000,
"line_mean": 29.3913043478,
"line_max": 125,
"alpha_frac": 0.5626342162,
"autogenerated": false,
"ratio": 3.21889400921659,
"config_test":... |
__author__ = 'Orthocenter'
from math import *
import constants
def check_tile_coor(tx, ty, level):
if level > constants.max_level or level < 0:
raise CoordinateError("Invalid level.")
n = 2 ** level
if tx < 0 or tx >= n:
raise CoordinateError("Invalid tile X.")
if ty < 0 or ty >= n:
... | {
"repo_name": "Orthocenter/YuxinMap",
"path": "Utility/coordinate.py",
"copies": "1",
"size": "3850",
"license": "mit",
"hash": -588416367270655900,
"line_mean": 27.1094890511,
"line_max": 95,
"alpha_frac": 0.5451948052,
"autogenerated": false,
"ratio": 3.1224655312246554,
"config_test": false,... |
__author__ = 'Orthocenter'
from Plotter.plot import Plot
import Utility.constants as constants
import os
import sys
import time
preprocessor_path = "Preprocessor/Preprocessor"
osm_path = sys.argv[1]
osm_path_abs = os.path.abspath(osm_path)
level_filter_config_path = "Configs/level_filter_config.xml"
level_filter_conf... | {
"repo_name": "Orthocenter/YuxinMap",
"path": "gen_tiles.py",
"copies": "1",
"size": "2023",
"license": "mit",
"hash": -3822077038363081700,
"line_mean": 35.7818181818,
"line_max": 128,
"alpha_frac": 0.6925358379,
"autogenerated": false,
"ratio": 2.8097222222222222,
"config_test": true,
"has_... |
__author__ = 'Orthocenter'
import cv2
import numpy as np
import Utility.constants as constants
from plot_method import Plot_Method
from Utility.color import Color
class Line(Plot_Method):
def __init__(self, level, conf):
Plot_Method.__init__(self, level, conf)
color = Color()
color.setHex(... | {
"repo_name": "Orthocenter/YuxinMap",
"path": "Plotter/Methods/line.py",
"copies": "1",
"size": "1537",
"license": "mit",
"hash": -3871856104804677600,
"line_mean": 38.4358974359,
"line_max": 127,
"alpha_frac": 0.61223162,
"autogenerated": false,
"ratio": 3.501138952164009,
"config_test": false... |
__author__ = 'Orthocenter'
import Utility.constants as constants
import numpy as np
import cv2
import time
import Methods.methods as methods
# utilities
from Utility.get_name import get_name
from Utility.coordinate import Coordinate
import os
try:
import xml.etree.cElementTree as ET
except ImportError:
import... | {
"repo_name": "Orthocenter/YuxinMap",
"path": "Plotter/plot.py",
"copies": "1",
"size": "2110",
"license": "mit",
"hash": 6183895499441634000,
"line_mean": 35.3965517241,
"line_max": 106,
"alpha_frac": 0.6402843602,
"autogenerated": false,
"ratio": 3.3124018838304554,
"config_test": false,
"h... |
import serial
import socket
import time
# Arduino class
# Inherits from serial.Serial
# Opens a serial port and handles the communication with the Arduino
# connected to it.
class Arduino(serial.Serial):
def __init__(self, address="", rate=115200):
serial.Serial.__init__(self, port=address, baudrate=rate... | {
"repo_name": "osamadel/ROV-Hydra",
"path": "RPi/nodes.py",
"copies": "1",
"size": "3900",
"license": "mit",
"hash": -2256428583941564400,
"line_mean": 30.9672131148,
"line_max": 105,
"alpha_frac": 0.5651282051,
"autogenerated": false,
"ratio": 3.8613861386138613,
"config_test": false,
"has_n... |
__author__ = 'OSAMA'
# This file tests serial communication with Arduino UNO
# when sending a message of data very quickly; Also,
# examine the initialization flag.
# Imports
import serial
import time
import threading
import socket
def main():
# All the main code resides here.
def read():
try:
... | {
"repo_name": "osamadel/ROV-Hydra",
"path": "RPi/serialcommunication.py",
"copies": "1",
"size": "1191",
"license": "mit",
"hash": 57630493233402720,
"line_mean": 22.3725490196,
"line_max": 71,
"alpha_frac": 0.5575146935,
"autogenerated": false,
"ratio": 3.829581993569132,
"config_test": false,... |
__author__ = 'Oshri&Yaacov'
from google.appengine.api import mail
from google.appengine.ext.webapp import template
import webapp2
from models.user import User
class SupportHandler(webapp2.RequestHandler):
def get(self):
template_params = {}
user = None
if self.request.cookie... | {
"repo_name": "yaakov300/ForexApp",
"path": "web/pages/support.py",
"copies": "1",
"size": "1410",
"license": "mit",
"hash": -1834843978742508800,
"line_mean": 32.4390243902,
"line_max": 108,
"alpha_frac": 0.6226950355,
"autogenerated": false,
"ratio": 3.821138211382114,
"config_test": false,
... |
import gevent
from gevent.wsgi import WSGIServer
from gevent.queue import Queue
from flask import Flask, Response
import time
# SSE "protocol" is described here: http://mzl.la/UPFyxY
class ServerSentEvent(object):
def __init__(self, data):
self.data = data
self.event = None
self.id = Non... | {
"repo_name": "mmqm4544/rta",
"path": "sse_demo/run.py",
"copies": "1",
"size": "2403",
"license": "mit",
"hash": -7311527891365695000,
"line_mean": 23.5204081633,
"line_max": 69,
"alpha_frac": 0.5530586767,
"autogenerated": false,
"ratio": 3.8820678513731823,
"config_test": false,
"has_no_ke... |
import gevent
from time import gmtime, strftime
from gevent.wsgi import WSGIServer
from gevent.queue import Queue
from flask import Flask, Response, url_for, send_from_directory
import time
# what state is each team in?
# note: there are 5 elements so we don't have to keep adjusting by 1
# to map team numbers to st... | {
"repo_name": "gmporter/usd_mips",
"path": "mips.py",
"copies": "1",
"size": "2576",
"license": "bsd-3-clause",
"hash": 387974526616199360,
"line_mean": 23.7692307692,
"line_max": 68,
"alpha_frac": 0.5838509317,
"autogenerated": false,
"ratio": 3.481081081081081,
"config_test": false,
"has_no... |
AUTHOR = 'Osmosoft'
AUTHOR_EMAIL = 'tiddlyspace@osmosoft.com'
NAME = 'tiddlywebplugins.tiddlyspace'
DESCRIPTION = 'A discoursive social model for Tiddlers'
VERSION = '1.2.26' # NB: duplicate of tiddlywebplugins.tiddlyspace.__init__
import os
from setuptools import setup, find_packages
setup(
namespace_packages... | {
"repo_name": "TiddlySpace/tiddlyspace",
"path": "setup.py",
"copies": "1",
"size": "2003",
"license": "bsd-3-clause",
"hash": 3703018957845181000,
"line_mean": 32.3833333333,
"line_max": 86,
"alpha_frac": 0.6360459311,
"autogenerated": false,
"ratio": 3.0815384615384613,
"config_test": false,
... |
AUTHOR = 'Osmosoft'
AUTHOR_EMAIL = 'tiddlyspace@osmosoft.com'
NAME = 'tiddlywebplugins.tiddlyspace'
DESCRIPTION = 'A discoursive social model for TiddlyWiki'
VERSION = '1.0.76' # NB: duplicate of tiddlywebplugins.tiddlyspace.__init__
import os
from setuptools import setup, find_packages
setup(
namespace_packag... | {
"repo_name": "FND/tiddlyspace",
"path": "setup.py",
"copies": "1",
"size": "1806",
"license": "bsd-3-clause",
"hash": -3236218756791546400,
"line_mean": 31.8363636364,
"line_max": 86,
"alpha_frac": 0.6356589147,
"autogenerated": false,
"ratio": 3.0714285714285716,
"config_test": false,
"has_... |
__author__ = 'Ostico <ostico@gmail.com>'
import unittest
import os
import sys
os.environ['DEBUG'] = "1"
os.environ['DEBUG_VERBOSE'] = "0"
# if os.path.realpath('../') not in sys.path:
# sys.path.insert(0, os.path.realpath('../'))
#
# if os.path.realpath('.') not in sys.path:
# sys.path.insert(0, os.path.realpa... | {
"repo_name": "lebedov/pyorient",
"path": "tests/test_Factory_and_usage.py",
"copies": "1",
"size": "11313",
"license": "apache-2.0",
"hash": -3711704881678137000,
"line_mean": 36.0950819672,
"line_max": 120,
"alpha_frac": 0.551401043,
"autogenerated": false,
"ratio": 3.503561474140601,
"config... |
__author__ = 'Ostico <ostico@gmail.com>'
import unittest
import os
os.environ['DEBUG'] = "0"
os.environ['DEBUG_VERBOSE'] = "0"
# if os.path.realpath('../') not in sys.path:
# sys.path.insert(0, os.path.realpath('../'))
#
# if os.path.realpath('.') not in sys.path:
# sys.path.insert(0, os.path.realpath('.'))
i... | {
"repo_name": "SPSCommerce/pyorient",
"path": "test/test_new_Iface.py",
"copies": "3",
"size": "9734",
"license": "apache-2.0",
"hash": -3287828980557013500,
"line_mean": 34.5291970803,
"line_max": 100,
"alpha_frac": 0.5333881241,
"autogenerated": false,
"ratio": 3.8337928318235526,
"config_tes... |
__author__ = 'Ostico <ostico@gmail.com>'
from ..exceptions import PyOrientBadMethodCallException
from .base import BaseMessage
from ..constants import CONNECT_OP, FIELD_BYTE, FIELD_INT, FIELD_SHORT, \
FIELD_STRINGS, FIELD_BOOLEAN, FIELD_STRING, NAME, \
SERIALIZATION_DOCUMENT2CSV, SUPPORTED_PROTOCOL, \
VERS... | {
"repo_name": "optimuspaul/pyorient",
"path": "pyorient/messages/connection.py",
"copies": "3",
"size": "4086",
"license": "apache-2.0",
"hash": 4888409085321168000,
"line_mean": 27.9858156028,
"line_max": 77,
"alpha_frac": 0.5795398923,
"autogenerated": false,
"ratio": 4.102409638554217,
"conf... |
__author__ = 'Ostico <ostico@gmail.com>'
from .orient import OrientDB, OrientSocket
from .messages.cluster import Information
from .exceptions import *
from .types import *
from .constants import *
from .scripts import Scripts
# # Orient User Primitives
# DB_TYPE_DOCUMENT = 'document'
# DB_TYPE_GRAPH = 'gr... | {
"repo_name": "ziyangzeng/pyorient",
"path": "pyorient/__init__.py",
"copies": "1",
"size": "1069",
"license": "apache-2.0",
"hash": 7362203267835788000,
"line_mean": 31.3939393939,
"line_max": 79,
"alpha_frac": 0.7305893358,
"autogenerated": false,
"ratio": 2.820580474934037,
"config_test": fa... |
__author__ = 'Ostico <ostico@gmail.com>'
import os
from pyorient.exceptions import PyOrientConnectionException, \
PyOrientDatabaseException
def is_debug_active():
if 'DEBUG' in os.environ:
if os.environ['DEBUG'].lower() in ( '1', 'true' ):
return True
return False
def is_debug_verbo... | {
"repo_name": "optimuspaul/pyorient",
"path": "pyorient/utils.py",
"copies": "2",
"size": "2821",
"license": "apache-2.0",
"hash": 2949633776100552000,
"line_mean": 27.22,
"line_max": 81,
"alpha_frac": 0.599078341,
"autogenerated": false,
"ratio": 4.035765379113019,
"config_test": false,
"has... |
__author__ = 'Ostico <ostico@gmail.com>'
import os
import sys
from pyorient.exceptions import PyOrientConnectionException, \
PyOrientDatabaseException
from pyorient.otypes import OrientRecordLink
def is_debug_active():
if 'DEBUG' in os.environ:
if os.environ['DEBUG'].lower() in ( '1', 'true' ):
... | {
"repo_name": "Ostico/pyorient",
"path": "pyorient/utils.py",
"copies": "4",
"size": "3580",
"license": "apache-2.0",
"hash": 7994454283618886000,
"line_mean": 26.7519379845,
"line_max": 81,
"alpha_frac": 0.5980446927,
"autogenerated": false,
"ratio": 3.9040348964013085,
"config_test": false,
... |
__author__ = 'Ostico <ostico@gmail.com>'
import os
import sys
from pyorient.exceptions import PyOrientConnectionException, \
PyOrientDatabaseException
from pyorient.types import OrientRecordLink
def is_debug_active():
if 'DEBUG' in os.environ:
if os.environ['DEBUG'].lower() in ( '1', 'true' ):
... | {
"repo_name": "ziyangzeng/pyorient",
"path": "pyorient/utils.py",
"copies": "1",
"size": "3239",
"license": "apache-2.0",
"hash": -7567396420428908000,
"line_mean": 27.1652173913,
"line_max": 81,
"alpha_frac": 0.6035813523,
"autogenerated": false,
"ratio": 3.984009840098401,
"config_test": fals... |
__author__ = 'Ostico <ostico@gmail.com>'
import os
import sys
import unittest
from pyorient.constants import CLUSTER_TYPE_PHYSICAL
from pyorient.messages.database import DbOpenMessage, DbReloadMessage
from pyorient.messages.cluster import DataClusterDataRangeMessage, \
DataClusterDropMessage, DataClusterAddMessa... | {
"repo_name": "lebedov/pyorient",
"path": "tests/test_data_cluster.py",
"copies": "1",
"size": "4220",
"license": "apache-2.0",
"hash": -8673307486450145000,
"line_mean": 34.4705882353,
"line_max": 96,
"alpha_frac": 0.6097156398,
"autogenerated": false,
"ratio": 4.085188770571152,
"config_test"... |
__author__ = 'Ostico <ostico@gmail.com>'
import struct
import sys
from ..exceptions import PyOrientBadMethodCallException, \
PyOrientCommandException
from ..types import OrientRecord, OrientRecordLink
from ..hexdump import hexdump
from ..constants import BOOLEAN, BYTE, BYTES, CHAR, FIELD_BOOLEAN, FIELD_BYTE, \
... | {
"repo_name": "ziyangzeng/pyorient",
"path": "pyorient/messages/base.py",
"copies": "1",
"size": "14639",
"license": "apache-2.0",
"hash": 8773076560887092000,
"line_mean": 32.3462414579,
"line_max": 82,
"alpha_frac": 0.5238062709,
"autogenerated": false,
"ratio": 4.310659599528858,
"config_tes... |
__author__ = 'Ostico <ostico@gmail.com>'
import struct
import sys
from ..exceptions import PyOrientBadMethodCallException, \
PyOrientCommandException, PyOrientNullRecordException
from ..otypes import OrientRecord, OrientRecordLink
from ..hexdump import hexdump
from ..constants import BOOLEAN, BYTE, BYTES, CHAR, ... | {
"repo_name": "lebedov/pyorient",
"path": "pyorient/messages/base.py",
"copies": "1",
"size": "16409",
"license": "apache-2.0",
"hash": -4835025050254504000,
"line_mean": 33.1143451143,
"line_max": 131,
"alpha_frac": 0.5294655372,
"autogenerated": false,
"ratio": 4.288813382122321,
"config_test... |
__author__ = 'Ostico <ostico@gmail.com>'
import sys
import os
import unittest
from pyorient.exceptions import *
from pyorient import OrientSocket
from pyorient.messages.connection import *
from pyorient.messages.database import *
from pyorient.messages.commands import *
from pyorient.messages.records import *
from p... | {
"repo_name": "mogui/pyorient",
"path": "tests/test_raw_messages_3.py",
"copies": "2",
"size": "6298",
"license": "apache-2.0",
"hash": 2254781679575050500,
"line_mean": 33.9888888889,
"line_max": 105,
"alpha_frac": 0.5416005081,
"autogenerated": false,
"ratio": 3.8852560148056754,
"config_test... |
#This code implements a light version of the Eigenvalue Decay regularizer for
#the Keras deep learning library, approximating the dominant eigenvalue by a
#soft function given by the power method. (It only works with Theano backend)
#The syntax for Eigenvalue Decay is similar to the other Keras weight regularizers, e... | {
"repo_name": "oswaldoludwig/Eigenvalue-Decay-Regularizer-for-Keras",
"path": "EigenvalueDecay.py",
"copies": "1",
"size": "2389",
"license": "bsd-2-clause",
"hash": -4946897530498480000,
"line_mean": 33.6231884058,
"line_max": 148,
"alpha_frac": 0.6718292172,
"autogenerated": false,
"ratio": 3.5... |
__author__ = 'Oswaldo Ludwig'
__version__ = '1.01'
#This code automatically derive (from the COCO annotations) the VIEW-style training annotation: training_sentences.csv and training_target.
#In case of publication, cite:
##@ARTICLE{2016arXiv160308474L,
## author = {Oswaldo Ludwig and Xiao Liu and Parisa Kordjamshi... | {
"repo_name": "oswaldoludwig/visually-informed-embedding-of-word-VIEW-",
"path": "generating_training_data_1.02.py",
"copies": "1",
"size": "4514",
"license": "bsd-2-clause",
"hash": -4749316851324067000,
"line_mean": 28.1225806452,
"line_max": 203,
"alpha_frac": 0.552724856,
"autogenerated": false... |
__author__ = 'Oswaldo Ludwig'
__version__ = '1.01'
#This code plots the PCA projection of VIEW vectors corresponding to some words (see line 43).
#In case of publication, cite:
##@ARTICLE{2016arXiv160308474L,
## author = {Oswaldo Ludwig and Xiao Liu and Parisa Kordjamshidi and Marie-Francine Moens
## },
## title... | {
"repo_name": "oswaldoludwig/visually-informed-embedding-of-word-VIEW-",
"path": "PCA_projection_1.02.py",
"copies": "1",
"size": "4194",
"license": "bsd-2-clause",
"hash": -5123230190211950000,
"line_mean": 29.8382352941,
"line_max": 203,
"alpha_frac": 0.640438722,
"autogenerated": false,
"ratio... |
__author__ = 'Oswaldo Ludwig'
__version__ = '1.01'
#This code saves the VIEW vectors, corresponding to the file "vocabulary" containing the 5000 most frequent words in MS-COCO, in the file "embedding_for_vocabulary".
#In case of publication, cite:
##@ARTICLE{2016arXiv160308474L,
## author = {{Ludwig}, O. and {Li... | {
"repo_name": "oswaldoludwig/visually-informed-embedding-of-word-VIEW-",
"path": "saving_embedding_1.01.py",
"copies": "1",
"size": "3317",
"license": "bsd-2-clause",
"hash": 7896729842480339000,
"line_mean": 28.6160714286,
"line_max": 203,
"alpha_frac": 0.6698824239,
"autogenerated": false,
"rat... |
__author__ = 'Oswaldo Ludwig'
__version__ = '1.02'
#This code saves the VIEW vectors, corresponding to the file "vocabulary" containing the 5000 most frequent words in MS-COCO, in the file "embedding_for_vocabulary".
#In case of publication, cite:
##@ARTICLE{2016arXiv160308474L,
## author = {{Ludwig}, O. and {Li... | {
"repo_name": "oswaldoludwig/visually-informed-embedding-of-word-VIEW-",
"path": "saving_embedding_1.02.py",
"copies": "1",
"size": "3838",
"license": "bsd-2-clause",
"hash": 6629239773143314000,
"line_mean": 29.4682539683,
"line_max": 203,
"alpha_frac": 0.6584158416,
"autogenerated": false,
"rat... |
from collections import namedtuple
import re
Instruction = namedtuple("Instruction", "name args ops")
list_instructions = [
Instruction("AND",2, ("0x00", "0x01")), Instruction("OR", 2, ("0x02", "0x03")),
Instruction("XOR", 2, ("0x04", "0x05")), Instruction("NOT", 1, ("0x06",... | {
"repo_name": "FreddieV4/DailyProgrammerChallenges",
"path": "Intermediate Challenges/Challenge 0132 Intermediate - Tiny Assembler/solutions/solution.py",
"copies": "1",
"size": "3716",
"license": "mit",
"hash": -790672739434598400,
"line_mean": 35.431372549,
"line_max": 100,
"alpha_frac": 0.47685683... |
__author__ = 'oussama'
import httplib
import simplejson
import json
from classes import *
from django.contrib.sessions.backends.db import SessionStore
import datetime
SERVER = "localhost:8000"
############### Global utils ###############
def get_trytond_response(db_name, method, params, session=None):
"""
... | {
"repo_name": "o5k/bootcamp-ihealth",
"path": "bootcamp/ihealth/utils.py",
"copies": "1",
"size": "3598",
"license": "mit",
"hash": -5296629855592712000,
"line_mean": 31.1339285714,
"line_max": 180,
"alpha_frac": 0.655086159,
"autogenerated": false,
"ratio": 3.3815789473684212,
"config_test": f... |
__author__ = 'oussama'
class Party(object):
code = ""
create_date = ""
citizenship = ""
photo = ""
alternative_identification = ""
sex = ""
insurance_company_type = ""
internal_user = ""
activation_date = ""
alternative_ids = []
full_name = ""
vat_number = ""
insura... | {
"repo_name": "o5k/bootcamp-ihealth",
"path": "bootcamp/ihealth/classes.py",
"copies": "1",
"size": "2890",
"license": "mit",
"hash": 1764268997598860300,
"line_mean": 19.0763888889,
"line_max": 52,
"alpha_frac": 0.4716262976,
"autogenerated": false,
"ratio": 3.494558645707376,
"config_test": f... |
"""Bridges between the Twisted reactor and Tornado IOLoop.
This module lets you run applications and libraries written for
Twisted in a Tornado application. It can be used in two modes,
depending on which library's underlying event loop you want to use.
This module has been tested with Twisted versions 11.0.0 and ne... | {
"repo_name": "sserrot/champion_relationships",
"path": "venv/Lib/site-packages/tornado/platform/twisted.py",
"copies": "2",
"size": "5038",
"license": "mit",
"hash": 8678495623621157000,
"line_mean": 37.4580152672,
"line_max": 83,
"alpha_frac": 0.6661373561,
"autogenerated": false,
"ratio": 4.18... |
import asyncio
import logging
import signal
import unittest
import warnings
from tornado.escape import utf8
from tornado import gen
from tornado.httpclient import AsyncHTTPClient
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.testing import bind_unused_port, AsyncTestCase, ge... | {
"repo_name": "NoyaInRain/tornado",
"path": "tornado/test/twisted_test.py",
"copies": "4",
"size": "7880",
"license": "apache-2.0",
"hash": 8454139578785132000,
"line_mean": 32.3898305085,
"line_max": 86,
"alpha_frac": 0.6331218274,
"autogenerated": false,
"ratio": 4.291938997821351,
"config_te... |
# Note: This module's docs are not currently extracted automatically,
# so changes must be made manually to twisted.rst
# TODO: refactor doc build process to use an appropriate virtualenv
"""A Twisted reactor built on the Tornado IOLoop.
This module lets you run applications and libraries written for
Twisted in a To... | {
"repo_name": "edisonlz/fruit",
"path": "web_project/base/site-packages/tornado/platform/twisted.py",
"copies": "5",
"size": "12340",
"license": "apache-2.0",
"hash": 426949722402361900,
"line_mean": 36.3939393939,
"line_max": 79,
"alpha_frac": 0.6159643436,
"autogenerated": false,
"ratio": 4.234... |
# Note: This module's docs are not currently extracted automatically,
# so changes must be made manually to twisted.rst
# TODO: refactor doc build process to use an appropriate virtualenv
"""Bridges between the Twisted reactor and Tornado IOLoop.
This module lets you run applications and libraries written for
Twiste... | {
"repo_name": "nbargnesi/tornado",
"path": "tornado/platform/twisted.py",
"copies": "45",
"size": "21485",
"license": "apache-2.0",
"hash": -7937204743436534000,
"line_mean": 35.7264957265,
"line_max": 80,
"alpha_frac": 0.6181521992,
"autogenerated": false,
"ratio": 4.233497536945813,
"config_t... |
"""
Unittest for the twisted-style reactor.
"""
from __future__ import absolute_import, division, print_function, with_statement
import os
import shutil
import signal
import tempfile
import threading
try:
import fcntl
from twisted.internet.defer import Deferred, inlineCallbacks, returnValue
from twisted... | {
"repo_name": "yuyangit/tornado",
"path": "tornado/test/twisted_test.py",
"copies": "1",
"size": "24310",
"license": "apache-2.0",
"hash": 4453894681571480600,
"line_mean": 35.3922155689,
"line_max": 81,
"alpha_frac": 0.6362402304,
"autogenerated": false,
"ratio": 4.1726742190181945,
"config_te... |
"""
Unittest for the twisted-style reactor.
"""
import os
import thread
import threading
import unittest
try:
import fcntl
import twisted
from twisted.internet.defer import Deferred
from twisted.internet.interfaces import IReadDescriptor, IWriteDescriptor
from twisted.internet.protocol import Pro... | {
"repo_name": "e1ven/Waymoot",
"path": "libs/tornado-2.2/tornado/test/twisted_test.py",
"copies": "3",
"size": "17317",
"license": "mit",
"hash": -4734171498239944000,
"line_mean": 35.5337552743,
"line_max": 80,
"alpha_frac": 0.642432292,
"autogenerated": false,
"ratio": 4.095789971617786,
"con... |
"""
Unittest for the twisted-style reactor.
"""
import os
import thread
import threading
import unittest
try:
import fcntl
import twisted
from twisted.internet.interfaces import IReadDescriptor, IWriteDescriptor
from tornado.platform.twisted import TornadoReactor
from zope.interface import implem... | {
"repo_name": "twitchyliquid64/R2K9",
"path": "tornado/test/twisted_test.py",
"copies": "4",
"size": "10603",
"license": "mit",
"hash": -4529316542853226500,
"line_mean": 32.983974359,
"line_max": 78,
"alpha_frac": 0.6568895596,
"autogenerated": false,
"ratio": 3.9860902255639097,
"config_test"... |
__author__ = 'Owner'
import os
from configparser import ConfigParser
from datetime import datetime
def config_assert(config_item):
assert os.path.exists(config_item), "{} file does not exist in cls_config folder".format(config_item)
class ClsConfig(object):
def __init__(self, root_folder):
self.roo... | {
"repo_name": "amryfitra/cls_python",
"path": "cls_python/config_loader.py",
"copies": "1",
"size": "2316",
"license": "mit",
"hash": 2327512625105398000,
"line_mean": 35.7619047619,
"line_max": 105,
"alpha_frac": 0.6373056995,
"autogenerated": false,
"ratio": 3.4413075780089155,
"config_test":... |
__author__ = 'oxle019'
import fptest
class CreateInternetServiceSuccess(fptest.FpTest):
def test_outgoing_workorders_in_correct_order(self):
expected_workorders = ['radcheck_delete', 'radreply_delete', 'radcheck_insert', 'radreply_insert',
'CreateSubscriber', 'SetPlan', 'Pr... | {
"repo_name": "oxo42/FpTest",
"path": "samples/test_InternetService_Create.py",
"copies": "1",
"size": "6531",
"license": "apache-2.0",
"hash": 6128566228730846000,
"line_mean": 35.6966292135,
"line_max": 113,
"alpha_frac": 0.4797121421,
"autogenerated": false,
"ratio": 4.383221476510067,
"conf... |
__author__ = 'oza'
# # Functions to help the package
import netifaces
import csv
import re
from uuid import getnode as get_mac
import netaddr
def get_manufacturer():
mac = str(hex(get_mac()))[0:6]
man_list = []
print mac
regex = re.compile("(?P<mac_add>[0-9A-Fa-f]{6})\s*.*(?P<man_name>.*)")
wit... | {
"repo_name": "adriansoghoian/security-at-home",
"path": "helpers.py",
"copies": "1",
"size": "5431",
"license": "mit",
"hash": 6073474291573502000,
"line_mean": 28.1989247312,
"line_max": 117,
"alpha_frac": 0.5461241024,
"autogenerated": false,
"ratio": 3.394375,
"config_test": false,
"has_n... |
__author__ = 'Pabitra'
from django.test import TestCase
from django.contrib.auth.models import User
from hs_core import hydroshare
from hs_core.models import GenericResource
class TestGetResourceByShortkeyAPI(TestCase):
def setUp(self):
pass
def tearDown(self):
User.objects.all().delete()
... | {
"repo_name": "hydroshare/hydroshare_temp",
"path": "hs_core/tests/api/native/test_get_resource_by_shortkey.py",
"copies": "1",
"size": "1167",
"license": "bsd-3-clause",
"hash": 65779603482155390,
"line_mean": 27.487804878,
"line_max": 66,
"alpha_frac": 0.5989717224,
"autogenerated": false,
"rat... |
__author__ = 'Pabitra'
from django.test import TestCase
from django.contrib.auth.models import User
from hs_core import hydroshare
from hs_core.models import GenericResource
class TestResourceModifiedAPI(TestCase):
def setUp(self):
pass
def tearDown(self):
User.objects.all().delete()
G... | {
"repo_name": "hydroshare/hydroshare_temp",
"path": "hs_core/tests/api/native/test_resource_modified.py",
"copies": "1",
"size": "2098",
"license": "bsd-3-clause",
"hash": -909095377499516700,
"line_mean": 37.1636363636,
"line_max": 116,
"alpha_frac": 0.6496663489,
"autogenerated": false,
"ratio"... |
__author__ = 'Pabitra'
from django.test import TestCase
from django.contrib.auth.models import User
from hs_core import hydroshare
from hs_core.models import GenericResource
class TestSetResourceOwnerAPI(TestCase):
def setUp(self):
pass
def tearDown(self):
User.objects.all().delete()
G... | {
"repo_name": "hydroshare/hydroshare_temp",
"path": "hs_core/tests/api/native/test_set_resource_owner.py",
"copies": "1",
"size": "2387",
"license": "bsd-3-clause",
"hash": -2607289105156205600,
"line_mean": 30.4078947368,
"line_max": 94,
"alpha_frac": 0.5823209049,
"autogenerated": false,
"ratio... |
__author__ = 'Pabitra'
from django.test import TestCase
from django.contrib.auth.models import User
from mezzanine.generic.models import Rating, ThreadedComment
from hs_core import hydroshare
from hs_core.models import GenericResource
class TestEndorseCommentAPI(TestCase):
def setUp(self):
pass
def te... | {
"repo_name": "hydroshare/hydroshare_temp",
"path": "hs_core/tests/api/native/test_endorse_comment.py",
"copies": "1",
"size": "5168",
"license": "bsd-3-clause",
"hash": 7547762190932679000,
"line_mean": 39.0620155039,
"line_max": 122,
"alpha_frac": 0.6292569659,
"autogenerated": false,
"ratio": ... |
__author__ = 'pabitra'
import ckan.lib.base as base
import ckan.plugins as p
import logging
from sqlalchemy import *
from ckan import model
tk = p.toolkit
_ = tk._ # translator function
log = logging.getLogger('ckan.logic')
def table(name):
return Table(name, model.meta.metadata, autoload=True)
def is_user_ow... | {
"repo_name": "UCHIC/CKANDev",
"path": "src/ckanext-Metadata/ckanext/Metadata/helpers.py",
"copies": "1",
"size": "1836",
"license": "bsd-3-clause",
"hash": 1841401997608298500,
"line_mean": 35.74,
"line_max": 114,
"alpha_frac": 0.6775599129,
"autogenerated": false,
"ratio": 3.7393075356415477,
... |
__author__ = 'pabitra'
import ckan.lib.base as base
import logging
import ckan.plugins as p
from ckan.controllers import storage
from datetime import datetime
from ckan.common import _
import ckan.lib.uploader as uploader
import ckan.lib.munge as munge
import os
import shutil
import httplib
import zipfile
import glob
i... | {
"repo_name": "CI-WATER/portal",
"path": "src/ckanext-delineate/ckanext/delineate/controllers/delineatewatershed.py",
"copies": "1",
"size": "20830",
"license": "bsd-3-clause",
"hash": -1861115797149440300,
"line_mean": 47.8990610329,
"line_max": 147,
"alpha_frac": 0.5778204513,
"autogenerated": fa... |
__author__ = 'pabitra'
import ckan.plugins as p
import ckan.plugins.toolkit as tk
from ckan.logic.action.update import package_update
import validators as custom_owner_org_validator
from ckan.logic.validators import owner_org_validator as core_owner_org_validator
# ref: see this link below for explanation of validatio... | {
"repo_name": "CI-WATER/portal",
"path": "src/ckanext-customdataset/ckanext/customdataset/plugin.py",
"copies": "1",
"size": "44360",
"license": "bsd-3-clause",
"hash": -3842368590972074000,
"line_mean": 42.532875368,
"line_max": 117,
"alpha_frac": 0.6244815149,
"autogenerated": false,
"ratio": 4... |
__author__ = 'Pabitra'
from unittest import TestCase
from hs_core.hydroshare import resource, get_resource_by_shortkey
from hs_core.hydroshare import users
from hs_core import hydroshare
from hs_core.models import GenericResource
from django.contrib.auth.models import User, Group
import datetime as dt
class TestUpda... | {
"repo_name": "hydroshare/hydroshare_temp",
"path": "hs_core/tests/api/native/test_update_resource.py",
"copies": "1",
"size": "6403",
"license": "bsd-3-clause",
"hash": 4341070118621224400,
"line_mean": 53.2711864407,
"line_max": 152,
"alpha_frac": 0.6237701078,
"autogenerated": false,
"ratio": ... |
__author__ = 'pacopablo'
__display_name__ = r'Bottle Service'
__description__ = r'Bottle.py Server'
__virtualenv_directory__ = None
import sys
import os
import select
import traceback
import win32serviceutil
import win32service
import win32event
from threading import Thread, Event
if __virtualenv_di... | {
"repo_name": "pacopablo/bottle-nt-service",
"path": "bottle_service.py",
"copies": "1",
"size": "6015",
"license": "mit",
"hash": -4678513470451115000,
"line_mean": 30.5135135135,
"line_max": 111,
"alpha_frac": 0.5975062344,
"autogenerated": false,
"ratio": 4.07520325203252,
"config_test": fal... |
__author__ = 'padraic'
import subprocess
from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MP3
import requests
import arrow
import json
import time
import threading
import logging
import multiprocessing
from pathlib import Path
basedir = Path('/var/www/archive.marsfm.ie/htdocs')
# TODO: Extend logging to pr... | {
"repo_name": "MUMarsFM/Archiver",
"path": "StreamManager.py",
"copies": "1",
"size": "5359",
"license": "mit",
"hash": 6315700059846233000,
"line_mean": 41.872,
"line_max": 113,
"alpha_frac": 0.6023511849,
"autogenerated": false,
"ratio": 3.6480599046970728,
"config_test": false,
"has_no_key... |
__author__ = 'PaleNeutron'
from urllib.request import Request
from urllib.parse import unquote
import urllib.parse
import requests
import re
from pyquery import PyQuery as pq
import html2text
import messager
requests.utils.default_user_agent = lambda : "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
# class DeceptionOp... | {
"repo_name": "PaleNeutron/EpubBuilder",
"path": "web_info.py",
"copies": "1",
"size": "10498",
"license": "apache-2.0",
"hash": 5650386217402340000,
"line_mean": 44.3452914798,
"line_max": 136,
"alpha_frac": 0.5513251582,
"autogenerated": false,
"ratio": 3.093300703579076,
"config_test": false... |
__author__ = 'PaleNeutron'
import os
from urllib.parse import urlparse, unquote
import sys
from PyQt5 import QtWidgets, QtCore, QtGui
class MyMainWindow(QtWidgets.QMainWindow):
file_loaded = QtCore.pyqtSignal(str)
image_loaded = QtCore.pyqtSignal(QtGui.QImage)
def __init__(self):
su... | {
"repo_name": "PaleNeutron/EpubBuilder",
"path": "my_mainwindow.py",
"copies": "1",
"size": "3933",
"license": "apache-2.0",
"hash": 639876416659211000,
"line_mean": 36.07,
"line_max": 107,
"alpha_frac": 0.5314060447,
"autogenerated": false,
"ratio": 3.672779922779923,
"config_test": false,
"... |
from unittest import TestCase
import numpy as np
import base.data_handler as dh
class TestProcessSet(TestCase):
def setUp(self):
self.spectra = []
number_of_spectra = 100
wavelength_limits = (6300.0, 6600.0)
features_limits = (1000, 2000)
for i in range(number_of_spectra):
... | {
"repo_name": "vodev/vocloud-preprocessing",
"path": "test/test_data_handler.py",
"copies": "2",
"size": "1242",
"license": "mit",
"hash": -8257229424643499000,
"line_mean": 37.8125,
"line_max": 101,
"alpha_frac": 0.616747182,
"autogenerated": false,
"ratio": 3.6964285714285716,
"config_test": ... |
__author__ = 'palmer'
from django.conf.urls import url, include
from django.contrib.auth import views as auth_views
from . import views
from .views import SpectraListView
urlpatterns = [
url(r'^$', views.home_page),
url(r'^stats/$', views.library_stats, name='stats'),
url(r'^adduct/add/$', views.adduct_ad... | {
"repo_name": "alexandrovteam/curatr",
"path": "mcf_standard_browser/standards_review/urls.py",
"copies": "1",
"size": "3454",
"license": "apache-2.0",
"hash": -3770567364053223000,
"line_mean": 65.4230769231,
"line_max": 120,
"alpha_frac": 0.6687898089,
"autogenerated": false,
"ratio": 3.2160148... |
__author__ = 'palmer'
import argparse
import numpy as np
def centroid_imzml(input_filename, output_filename, step=[], apodization=False, w_size=10, min_intensity=1e-5, prevent_duplicate_pixels=False):
# write a file to imzml format (centroided)
"""
:type input_filename string - source file path (must be .... | {
"repo_name": "andy-d-palmer/pyIMS",
"path": "pyImagingMSpec/convert/imzml.py",
"copies": "2",
"size": "3759",
"license": "apache-2.0",
"hash": 78389099817155040,
"line_mean": 49.7972972973,
"line_max": 159,
"alpha_frac": 0.641660016,
"autogenerated": false,
"ratio": 3.3324468085106385,
"config... |
__author__ = 'palmer'
import numpy as np
ms_types = ['orbitrap','tof']
class sim_data():
def __init__(self,output_filename,layers,ms_info):
assert ms_info["ms_type"] in ms_types, "ms_type not in {}".format(ms_types)
self.output_filename=output_filename
self.ms_info=ms_info
self.layer... | {
"repo_name": "andy-d-palmer/pyims_simulate_evaluate",
"path": "simulate.py",
"copies": "1",
"size": "5696",
"license": "mit",
"hash": -4335468075804622000,
"line_mean": 43.1627906977,
"line_max": 116,
"alpha_frac": 0.591116573,
"autogenerated": false,
"ratio": 3.2382035247299603,
"config_test"... |
__author__ = 'palmer'
import numpy as np
def apply_normalisation(counts,type_str=""):
"""
helper function to apply a normalisation function (with some input testing etc)
:param counts: numpy array of values to normalise
:param type_str: normalisation type to apply (name)
:return: numpy array of nor... | {
"repo_name": "andy-d-palmer/pyMS",
"path": "normalisation.py",
"copies": "1",
"size": "2873",
"license": "apache-2.0",
"hash": 2328019216565008000,
"line_mean": 26.8932038835,
"line_max": 106,
"alpha_frac": 0.6463626871,
"autogenerated": false,
"ratio": 3.8771929824561404,
"config_test": false... |
__author__ = 'palmer'
import numpy as np
def get_true_sumformula_adduct_list(ground_truth):
"""
Gets a global list of sumformula_adduct from layers
:return:
a list
"""
layer_names = ground_truth['layers_list'].keys()
sf_a_list = []
layer_names = ground_truth['layers_list'].keys()
... | {
"repo_name": "andy-d-palmer/pyims_simulate_evaluate",
"path": "evaluate.py",
"copies": "1",
"size": "3652",
"license": "mit",
"hash": 8158518290942099000,
"line_mean": 34.125,
"line_max": 116,
"alpha_frac": 0.6141840088,
"autogenerated": false,
"ratio": 3.7456410256410257,
"config_test": false... |
__author__ = 'palmer'
def calc_fdr_df(target_df,decoy_df,col='mult',ascending=False):
import numpy as np
import pandas as pd
if len(target_df) != len(decoy_df):
raise TypeError('target should be same length as decoy {} {}'.format(len(target_df),len(decoy_df)))
score_vect = pd.concat((target_df,... | {
"repo_name": "andy-d-palmer/pySpatialMetabolomics",
"path": "fdr_measures.py",
"copies": "1",
"size": "7834",
"license": "apache-2.0",
"hash": 1683182105951162600,
"line_mean": 42.2817679558,
"line_max": 123,
"alpha_frac": 0.6333929027,
"autogenerated": false,
"ratio": 2.8738077769625825,
"con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.