text stringlengths 0 1.05M | meta dict |
|---|---|
import numpy as np
from scipy import linalg
from scipy.io import loadmat
from functools import reduce
import numbers
import random
import theano
import zipfile
import gzip
import os
import glob
import sys
import subprocess
try:
import cPickle as pickle
except ImportError:
import pickle
from theano import tensor... | {
"repo_name": "kastnerkyle/santa_barbaria",
"path": "kdl_template.py",
"copies": "1",
"size": "60964",
"license": "bsd-3-clause",
"hash": -2962697301890701300,
"line_mean": 37.0074812968,
"line_max": 91,
"alpha_frac": 0.5925956302,
"autogenerated": false,
"ratio": 3.4774970053048886,
"config_te... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
# defines the reward/connection graph
r = np.array([[-1, -1, -1, -1, 0, -1],
[-1, -1, -1, 0, -1, 100],
[-1, -1, -1, 0, -1, -1],
[-1, 0, 0, -1, 0, -1],
... | {
"repo_name": "arcyfelix/Courses",
"path": "17-06-05-Machine-Learning-For-Trading/43_painless_qlearning.py",
"copies": "2",
"size": "4944",
"license": "apache-2.0",
"hash": 6578803980123864000,
"line_mean": 30.4968152866,
"line_max": 82,
"alpha_frac": 0.5159789644,
"autogenerated": false,
"ratio"... |
import numpy as np
from scipy import linalg
from scipy.misc import factorial
import theano
from theano import tensor
from theano.tensor.signal.downsample import max_pool_2d
from theano.sandbox.rng_mrg import MRG_RandomStreams
from ..utils import concatenate, as_shared
from ..core import get_name, set_shared, get_shared... | {
"repo_name": "dagbldr/dagbldr",
"path": "dagbldr/nodes/nodes.py",
"copies": "2",
"size": "36350",
"license": "bsd-3-clause",
"hash": 4407267468416611000,
"line_mean": 33.6851145038,
"line_max": 105,
"alpha_frac": 0.611911967,
"autogenerated": false,
"ratio": 3.548765010250903,
"config_test": f... |
import numpy as np
from theano import tensor
import theano
from ..utils import concatenate, get_logger
logger = get_logger()
def binary_crossentropy(predicted_values, true_values):
"""
Bernoulli negative log likelihood of predicted compared to binary
true_values
Parameters
----------
predict... | {
"repo_name": "kastnerkyle/dagbldr",
"path": "dagbldr/nodes/penalties.py",
"copies": "2",
"size": "20204",
"license": "bsd-3-clause",
"hash": -8020395405052720000,
"line_mean": 30.0353302611,
"line_max": 108,
"alpha_frac": 0.6079984162,
"autogenerated": false,
"ratio": 3.43488609316559,
"config... |
import numpy as np
from theano import tensor
import theano
from ..utils import concatenate
def binary_crossentropy(predicted_values, true_values):
"""
Bernoulli negative log likelihood of predicted compared to binary
true_values
Parameters
----------
predicted_values : tensor, shape 2D or 3D
... | {
"repo_name": "dribnet/dagbldr",
"path": "dagbldr/nodes/penalties.py",
"copies": "1",
"size": "7872",
"license": "bsd-3-clause",
"hash": -5321292353748283000,
"line_mean": 28.2639405204,
"line_max": 80,
"alpha_frac": 0.6275406504,
"autogenerated": false,
"ratio": 3.9261845386533665,
"config_tes... |
import numpy as np
import theano
from theano import tensor
from theano.scan_module.scan_utils import infer_shape
from theano.gof.fg import MissingInputError
from collections import OrderedDict
TAG_ID = "_dagbldr_"
DATASETS_ID = "__datasets__"
RANDOM_ID = "__random__"
def safe_zip(*args):
"""Like zip, but ensures... | {
"repo_name": "dribnet/dagbldr",
"path": "dagbldr/utils/utils.py",
"copies": "1",
"size": "14996",
"license": "bsd-3-clause",
"hash": 8192493247604014000,
"line_mean": 38.2565445026,
"line_max": 80,
"alpha_frac": 0.5916911176,
"autogenerated": false,
"ratio": 3.741516966067864,
"config_test": f... |
import numpy as np
import theano
from theano import tensor
from ..utils import as_shared
def c(x):
return np.cast["float32"](x)
def gradient_clipping(grads, rescale=5.):
grad_norm = tensor.sqrt(sum(map(lambda x: tensor.sqr(x).sum(), grads)))
scaling_num = rescale
scaling_den = tensor.maximum(rescale... | {
"repo_name": "kastnerkyle/dagbldr",
"path": "dagbldr/optimizers/optimizers.py",
"copies": "2",
"size": "8746",
"license": "bsd-3-clause",
"hash": 4948048110615524000,
"line_mean": 35.5941422594,
"line_max": 83,
"alpha_frac": 0.5565973016,
"autogenerated": false,
"ratio": 3.62453377538334,
"con... |
import numpy as np
import theano
from theano import tensor
class sgd(object):
"""
Vanilla SGD
"""
def __init__(self, params):
pass
def updates(self, params, grads, learning_rate):
updates = []
for n, (param, grad) in enumerate(zip(params, grads)):
updates.appen... | {
"repo_name": "dribnet/dagbldr",
"path": "dagbldr/optimizers/optimizers.py",
"copies": "1",
"size": "5072",
"license": "bsd-3-clause",
"hash": 683806564279423700,
"line_mean": 35.4892086331,
"line_max": 80,
"alpha_frac": 0.532137224,
"autogenerated": false,
"ratio": 3.6647398843930636,
"config_... |
import random
import os
import glob
import subprocess
import numpy as np
from itertools import cycle
def _get_js_path():
module_path = os.path.dirname(__file__)
js_path = os.path.join(module_path, "js_plot_dependencies")
return js_path
def _filled_js_template_from_results_dict(results_dict, default_show... | {
"repo_name": "dribnet/dagbldr",
"path": "dagbldr/utils/plot_utils.py",
"copies": "1",
"size": "6874",
"license": "bsd-3-clause",
"hash": 4700521551375559000,
"line_mean": 39.4352941176,
"line_max": 80,
"alpha_frac": 0.5762292697,
"autogenerated": false,
"ratio": 3.3895463510848125,
"config_tes... |
import re
import numpy as np
import theano
from theano import tensor
from collections import OrderedDict
from ..core import safe_zip
from ..core import get_type
from ..core import get_file_matches
from ..core import get_checkpoint_dir
from ..core import dunpickle
from ..core import set_shared_variables_in_function
fro... | {
"repo_name": "kastnerkyle/dagbldr",
"path": "dagbldr/utils/utils.py",
"copies": "2",
"size": "5198",
"license": "bsd-3-clause",
"hash": -3360822018189343000,
"line_mean": 30.125748503,
"line_max": 79,
"alpha_frac": 0.6288957291,
"autogenerated": false,
"ratio": 3.870439314966493,
"config_test"... |
import numpy as np
from scipy.linalg import eigh
from scipy.misc import imresize
def ind2sub(array_shape, ind):
# Gives repeated indices, replicates matlabs ind2sub
rows = (ind.astype("int32") // array_shape[1])
cols = (ind.astype("int32") % array_shape[1])
return (rows, cols)
def graphcut(im, n_sp... | {
"repo_name": "kastnerkyle/dagbldr",
"path": "dagbldr/datasets/image_utils/image_tools.py",
"copies": "2",
"size": "3705",
"license": "bsd-3-clause",
"hash": 360660900306873700,
"line_mean": 27.5,
"line_max": 66,
"alpha_frac": 0.5608636977,
"autogenerated": false,
"ratio": 3.129222972972973,
"c... |
try:
import urllib.reques as urllib
except ImportError:
import urllib2 as urllib
def download(url, server_fname, local_fname=None, progress_update_percentage=6):
"""
An internet download utility modified from
http://stackoverflow.com/questions/22676/
how-do-i-download-a-file-over-http-using-p... | {
"repo_name": "callaghanmt/PyCon2015",
"path": "utils.py",
"copies": "2",
"size": "1356",
"license": "bsd-3-clause",
"hash": -2153570806748210700,
"line_mean": 32.0731707317,
"line_max": 80,
"alpha_frac": 0.5494100295,
"autogenerated": false,
"ratio": 3.7355371900826446,
"config_test": false,
... |
from music21 import converter, interval, pitch, harmony, analysis, spanner, midi, meter
import numpy as np
from collections import Counter
from scipy.io import loadmat, wavfile
from scipy.linalg import svd
from functools import reduce
import shutil
import string
import tarfile
import fnmatch
import zipfile
import gzip
... | {
"repo_name": "kastnerkyle/pachet_experiments",
"path": "datasets.py",
"copies": "1",
"size": "33639",
"license": "bsd-3-clause",
"hash": -8299911535359946000,
"line_mean": 35.2489224138,
"line_max": 155,
"alpha_frac": 0.5535241832,
"autogenerated": false,
"ratio": 3.630760928224501,
"config_te... |
import numpy as np
import theano
import theano.tensor as T
from scipy import linalg
class sgd(object):
# Only here for API conformity with other optimizers
def __init__(self, params):
pass
def updates(self, params, grads, learning_rate):
updates = []
for n, (param, grad) in enumer... | {
"repo_name": "kastnerkyle/crikey",
"path": "chirp_tests/amplitude_modulation_rnn.py",
"copies": "1",
"size": "6310",
"license": "bsd-3-clause",
"hash": 9058666588517518000,
"line_mean": 31.193877551,
"line_max": 80,
"alpha_frac": 0.681141046,
"autogenerated": false,
"ratio": 2.879963486992241,
... |
import numpy as np
from scipy.cluster.vq import vq
def minibatch_kmedians(X, M=None, n_components=10, n_iter=100,
minibatch_size=100, random_state=None):
n_clusters = n_components
if M is not None:
assert M.shape[0] == n_components
assert M.shape[1] == X.shape[1]
if ... | {
"repo_name": "kastnerkyle/crikey",
"path": "conditional_audio/kmedians.py",
"copies": "1",
"size": "2472",
"license": "bsd-3-clause",
"hash": 4287762686260229600,
"line_mean": 35.8955223881,
"line_max": 91,
"alpha_frac": 0.5914239482,
"autogenerated": false,
"ratio": 3.1896774193548385,
"confi... |
import sys
import numpy as np
import cv2 as cv
import py_compile
def main(filename):
# Open video capture for webcam
vidcap = cv.VideoCapture(0)
frames = [0]*3
prevFrame = [0]*2
threshold = 100;
#capture first frame (background)
success, prevBack = vidcap.read()
size = np.shape(prevBack)
cv.imshow('Frame',p... | {
"repo_name": "SlightyTilted/Image-Processing",
"path": "basics/BackgroundSubtraction.py",
"copies": "1",
"size": "1054",
"license": "unlicense",
"hash": -7563429294856421000,
"line_mean": 21.4255319149,
"line_max": 109,
"alpha_frac": 0.6840607211,
"autogenerated": false,
"ratio": 2.8181818181818... |
import sys
import numpy as np
import cv2 as cv
def main(filename):
# Open webcam capture
vidcap = cv.VideoCapture(0)
thr = 20;
# capture frame at T(i-1)
success, prevBack = vidcap.read()
size = np.shape(prevBack)
# sclsize = [30,30]
prevBack = cv.cvtColor(prevBack,cv.COLOR_BGR2GRAY)
out=prevBack
while (Tru... | {
"repo_name": "SlightyTilted/Image-Processing",
"path": "basics/FrameDifference.py",
"copies": "1",
"size": "1072",
"license": "unlicense",
"hash": 4733241370469422000,
"line_mean": 22.3043478261,
"line_max": 121,
"alpha_frac": 0.6688432836,
"autogenerated": false,
"ratio": 2.627450980392157,
"... |
__author__ = 'Kyle'
import math
import re
import matplotlib.pyplot as plt
import numpy as np
class Variable:
"""Represent a variable as a class."""
def __init__(self, coef, exp):
"""Set coefficient and exponent."""
self.coef = coef
self.exp = exp
def __str__(self):
"""C... | {
"repo_name": "kylecorry31/KyPy",
"path": "kypy/mathematics/__init__.py",
"copies": "1",
"size": "13567",
"license": "mit",
"hash": 7420158757506269000,
"line_mean": 28.1784946237,
"line_max": 118,
"alpha_frac": 0.5632785435,
"autogenerated": false,
"ratio": 3.544148380355277,
"config_test": tr... |
import sys
import numpy as np
import cv2 as cv
def main(filename):
# Open video capture
vidcap = cv.VideoCapture(0)
threshold = 20
lr=0.05
# capture frame at T(i-1)
success, prevBack = vidcap.read()
size = np.shape(prevBack)
sclsize = [int(round(size[0]/2)),int(round(size[1]/2))]
prevBack = cv.cvtColor(pr... | {
"repo_name": "SlightyTilted/Image-Processing",
"path": "basics/RunningAv.py",
"copies": "1",
"size": "1284",
"license": "unlicense",
"hash": 4733370704926898000,
"line_mean": 21.5263157895,
"line_max": 76,
"alpha_frac": 0.6604361371,
"autogenerated": false,
"ratio": 2.5078125,
"config_test": f... |
__author__ = 'Kyle'
speed_of_light = 299792458
R_ideal = 0.0821
gravity = 9.81
def ideal_gas_law(p=None, v=None, n=None, t=None, precision=2):
"""Find the pressure, volume, amount, or temperature of a gas.
Calculate pressure, volume, amount, or temperature of a gas based on the parameters.
Parameters ar... | {
"repo_name": "kylecorry31/KyPy",
"path": "kypy/science/__init__.py",
"copies": "1",
"size": "1786",
"license": "mit",
"hash": 1939528219456845600,
"line_mean": 33.3653846154,
"line_max": 109,
"alpha_frac": 0.6461366181,
"autogenerated": false,
"ratio": 3.4280230326295587,
"config_test": false,... |
__author__ = 'kyle_xiao'
import tornado.httpclient
import urllib
import json
import hashlib
class AccessTicket(object):
def __init__(self, timestamp, appId, key, nonceStr):
"""
:param timestamp:
:param appId:
:param key:
:param nonceStr:
"""
... | {
"repo_name": "kylexiaox/WechatWebShareJs",
"path": "apiAccess.py",
"copies": "1",
"size": "1927",
"license": "apache-2.0",
"hash": -8153358249669474000,
"line_mean": 29.0806451613,
"line_max": 114,
"alpha_frac": 0.5059678256,
"autogenerated": false,
"ratio": 4.189130434782609,
"config_test": f... |
__author__ = 'kyle_xiao'
import tornado.ioloop
import tornado.web
import pyrestful.rest
from services import Auth
import time
from pyrestful import mediatypes
from pyrestful.rest import get, post, put, delete
class WechatShareResource(pyrestful.rest.RestHandler):
@get(_path="/H5/{name}", _produces=me... | {
"repo_name": "kylexiaox/WechatWebShareJs",
"path": "rest.py",
"copies": "1",
"size": "1148",
"license": "apache-2.0",
"hash": 6459808647420519000,
"line_mean": 28.2631578947,
"line_max": 102,
"alpha_frac": 0.6245644599,
"autogenerated": false,
"ratio": 3.9180887372013653,
"config_test": false,... |
__author__ = 'Lab Hatter'
# from panda3d.core import ConfigVariablString
# from panda3d.core import GeomVertexFormat, GeomVertexData, GeomLines
# from panda3d.core import Geom, GeomNode, GeomTriangles, GeomVertexWriter, ModelNode, NodePath
from direct.showbase.ShowBase import ShowBase
from panda3d.core import ... | {
"repo_name": "jkcavin1/creepy-duck",
"path": "Pathfinding.py",
"copies": "1",
"size": "3741",
"license": "mit",
"hash": 5817819468524162000,
"line_mean": 36.1734693878,
"line_max": 135,
"alpha_frac": 0.6198877306,
"autogenerated": false,
"ratio": 2.985634477254589,
"config_test": false,
"has... |
__author__ = 'Lab Hatter'
from panda3d.core import Point3
def getSharedEdgeStr(triA, triB):
"""Returns the edge that B shares w/ A i.e. If B lies on A's 12 edge, returns '12', otherwise returns '' or '1'"""
if triA is None or triB is None:
return ''
pointsA = triA.getPoints()
poin... | {
"repo_name": "jkcavin1/creepy-duck",
"path": "PolygonUtils/Triangle.py",
"copies": "1",
"size": "3182",
"license": "mit",
"hash": 5820654631454253000,
"line_mean": 27.462962963,
"line_max": 119,
"alpha_frac": 0.5021998743,
"autogenerated": false,
"ratio": 3.3076923076923075,
"config_test": fal... |
__author__ = 'Lab Hatter'
from panda3d.core import Point3
# TODO: change the CcwShapes points to points instead of vectors as they are now DUMMY!!!
def HorseShoeCentered():
"""Returns a horseshoe shape, thus behaving like a constructor."""
hole1 = []
hole1.append(Point3(-2, -2, 0))
hole1.append... | {
"repo_name": "jkcavin1/creepy-duck",
"path": "CcwShapes.py",
"copies": "1",
"size": "3175",
"license": "mit",
"hash": -4696476135897584000,
"line_mean": 28.8446601942,
"line_max": 89,
"alpha_frac": 0.5552755906,
"autogenerated": false,
"ratio": 2.250177179305457,
"config_test": false,
"has_n... |
__author__ = 'Lab Hatter'
# from panda3d.core import Triangulator
from panda3d.core import Point2D, Point3, Vec4, Vec3
from panda3d.core import GeomVertexFormat, GeomVertexData, GeomLines, Triangulator
from panda3d.core import Geom, GeomNode, GeomTriangles, GeomVertexWriter, ModelNode, NodePath
from math import ... | {
"repo_name": "jkcavin1/creepy-duck",
"path": "PolygonUtils/AdjacencyList.py",
"copies": "1",
"size": "15009",
"license": "mit",
"hash": 8055556136420988000,
"line_mean": 38.785326087,
"line_max": 121,
"alpha_frac": 0.5303484576,
"autogenerated": false,
"ratio": 3.4314128943758573,
"config_test... |
__author__ = 'Lab Hatter'
from panda3d.core import Vec3, Vec4, Point3
from math import sqrt, pow
def getDistance(pt1, pt2):
return sqrt(pow(pt1.x - pt2.x, 2) + pow(pt1.y - pt2.y, 2) + pow(pt1.z - pt2.z, 2))
def getDistance2d(pt1, pt2):
return sqrt(pow(pt1.x - pt2.x, 2) + pow(pt1.y - pt2.y, 2))... | {
"repo_name": "jkcavin1/creepy-duck",
"path": "PolygonUtils/PolygonUtils.py",
"copies": "1",
"size": "7438",
"license": "mit",
"hash": -254217354320338050,
"line_mean": 38.8681318681,
"line_max": 116,
"alpha_frac": 0.6210002689,
"autogenerated": false,
"ratio": 3.33542600896861,
"config_test": ... |
__author__ = 'Lab Hatter'
import math
import heapq
from panda3d.core import Vec3, Point3, LineSegs
from PolygonUtils.PolygonUtils import getDistance, getCenterOfPoints3D, getNearestPointOnLine,\
getLeftPt, makeTriangleCcw, triangleContainsPoint, getDistToLine, isPointInWedge
from PolygonUtils.AdjacencyLis... | {
"repo_name": "jkcavin1/creepy-duck",
"path": "TriangulationAStarR.py",
"copies": "1",
"size": "45676",
"license": "mit",
"hash": 2007545224505250800,
"line_mean": 49.1511758119,
"line_max": 173,
"alpha_frac": 0.5057579473,
"autogenerated": false,
"ratio": 4.009128412182919,
"config_test": fals... |
__author__ = 'Lab Hatter'
# http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain#Python
def convex_hull(points):
"""Computes the convex hull of a set of 2D points.
Input: an iterable sequence of (x, y) pairs representing the points.
Output: a list of verti... | {
"repo_name": "jkcavin1/creepy-duck",
"path": "utilities/ConvexHull.py",
"copies": "1",
"size": "1976",
"license": "mit",
"hash": -6177664340288187000,
"line_mean": 35.320754717,
"line_max": 99,
"alpha_frac": 0.6194331984,
"autogenerated": false,
"ratio": 3.5412186379928317,
"config_test": fals... |
__author__ = 'lab'
from os import walk
import json
import csv
def same_direction(sub_sheets):
same_direction_sub_sheets = []
for sub_sheet in sub_sheets:
direction = -1 if sub_sheet[0] < 0 else 1
if ((sub_sheet[1]*direction > 0) and (sub_sheet[2]*direction > 0)):
same_direction_sub... | {
"repo_name": "NirBenTalLab/proorigami-cde-package",
"path": "pattern_recognition.py",
"copies": "1",
"size": "4426",
"license": "mit",
"hash": -398562330315943300,
"line_mean": 39.9907407407,
"line_max": 266,
"alpha_frac": 0.6168097605,
"autogenerated": false,
"ratio": 3.5809061488673137,
"con... |
__author__ = 'labx'
import numpy
import Shadow
# Import elements from common Glossary
from optics.driver.abstract_driver import AbstractDriver
from optics.magnetic_structures.bending_magnet import BendingMagnet
from optics.beamline.beamline_position import BeamlinePosition
from optics.beamline.optical_elements.lens... | {
"repo_name": "radiasoft/optics",
"path": "code_drivers/shadow/driver/shadow_driver.py",
"copies": "1",
"size": "6385",
"license": "apache-2.0",
"hash": -4932061766768812000,
"line_mean": 38.1717791411,
"line_max": 111,
"alpha_frac": 0.5926389977,
"autogenerated": false,
"ratio": 3.86735311932162... |
__author__ = 'labx'
"""
Implements a bending magnet.
"""
from optics.magnetic_structures.magnetic_structure import MagneticStructure
from collections import OrderedDict
class BendingMagnet(MagneticStructure):
def __init__(self, radius, magnetic_field, length):
"""
Constructor.
:param radiu... | {
"repo_name": "radiasoft/optics",
"path": "optics/magnetic_structures/bending_magnet.py",
"copies": "1",
"size": "1343",
"license": "apache-2.0",
"hash": 2867862049342723000,
"line_mean": 39.7272727273,
"line_max": 116,
"alpha_frac": 0.5971705138,
"autogenerated": false,
"ratio": 3.93841642228739... |
__author__ = 'labx'
import copy, numpy
import Shadow
from optics.driver.abstract_driver_result import AbstractDriverResult
class ShadowOEHistoryItem(object):
def __init__(self, oe_number=0, shadow_source_start=None, shadow_source_end=None, shadow_oe_start=None, shadow_oe_end=None):
self._oe_number = oe_... | {
"repo_name": "radiasoft/optics",
"path": "code_drivers/shadow/driver/shadow_beam.py",
"copies": "1",
"size": "4936",
"license": "apache-2.0",
"hash": -608839128858733800,
"line_mean": 37.2635658915,
"line_max": 133,
"alpha_frac": 0.5792139384,
"autogenerated": false,
"ratio": 3.77947932618683,
... |
__author__ = 'labx'
import Shadow
class ShadowSource(object):
def __init__(self):
self._oe_number = 0
def toNativeShadowSource(self):
raise NotImplementedError()
def fromNativeShadowSource(self, src):
raise NotImplementedError()
def fromNativeShadowSourceFile(self, file_name... | {
"repo_name": "radiasoft/optics",
"path": "code_drivers/shadow/sources/shadow_source.py",
"copies": "1",
"size": "5638",
"license": "apache-2.0",
"hash": 6031250197429644000,
"line_mean": 39.8623188406,
"line_max": 57,
"alpha_frac": 0.4625753813,
"autogenerated": false,
"ratio": 3.101210121012101... |
__author__ = 'labx'
import sys
import code
import keyword
import itertools
from PyQt5 import QtGui, QtWidgets
from PyQt5.QtCore import QItemSelectionModel
from PyQt5.QtGui import (
QTextCursor, QFont, QColor, QPalette
)
from PyQt5.QtCore import Qt, QRegExp
def text_format(foreground=Qt.black, weight=QFont.Nor... | {
"repo_name": "srio/oasys-comsyl",
"path": "orangecontrib/comsyl/util/python_script.py",
"copies": "1",
"size": "11082",
"license": "mit",
"hash": -6961247022370488000,
"line_mean": 31.4035087719,
"line_max": 100,
"alpha_frac": 0.5544125609,
"autogenerated": false,
"ratio": 3.9791741472172353,
... |
__author__ = 'labx'
import sys
import code
import keyword
import itertools
from PyQt5 import QtGui, QtWidgets
from PyQt5.QtGui import (
QTextCursor, QFont, QColor, QPalette
)
from PyQt5.QtCore import Qt, QRegExp, QItemSelectionModel
def text_format(foreground=Qt.black, weight=QFont.Normal):
fmt = QtGui.QT... | {
"repo_name": "srio/Orange-XOPPY",
"path": "orangecontrib/xoppy/util/script/python_script.py",
"copies": "1",
"size": "10921",
"license": "bsd-2-clause",
"hash": 7306740056246201000,
"line_mean": 31.5029761905,
"line_max": 77,
"alpha_frac": 0.5525135061,
"autogenerated": false,
"ratio": 3.9799562... |
__author__ = 'labx'
import Shadow
import numpy
from code_drivers.shadow.driver.shadow_driver_setting import ShadowDriverSetting
from code_drivers.shadow.sources.shadow_source import ShadowSource
class ShadowBendingMagnet(ShadowSource):
def __init__(self, electron_beam, bending_magnet, energy_min, energy_max):
... | {
"repo_name": "radiasoft/optics",
"path": "code_drivers/shadow/sources/shadow_bending_magnet.py",
"copies": "1",
"size": "6029",
"license": "apache-2.0",
"hash": 4516591434745032000,
"line_mean": 36.9182389937,
"line_max": 158,
"alpha_frac": 0.6319455963,
"autogenerated": false,
"ratio": 3.327262... |
__author__ = 'lachlan'
import logging
class ServiceLayerError(Exception):
pass
class DataService(object):
def __init__(self, db_session):
self.db = db_session
self.tablename = None
self.bad_keys = ['id'] # Fields that should not be created or updated using uploaded data. They need to... | {
"repo_name": "QuicklyRainbow/FieldGuideAU",
"path": "Flask_App/utils/models/data_service.py",
"copies": "1",
"size": "7774",
"license": "mit",
"hash": 1720140140062181400,
"line_mean": 41.2554347826,
"line_max": 140,
"alpha_frac": 0.5304862362,
"autogenerated": false,
"ratio": 4.467816091954023,... |
__author__ = 'lac'
import datetime
from django.http import HttpResponse,Http404
from django.shortcuts import render,render_to_response
from django.template import RequestContext
from myblog.models import BlogPost
from django.http import Http404, HttpResponseRedirect
from django.views.decorators.cache import cache_page... | {
"repo_name": "liaicheng/lacblog",
"path": "code/myblog/views.py",
"copies": "1",
"size": "3993",
"license": "mit",
"hash": 2771484950009839600,
"line_mean": 31.2252252252,
"line_max": 133,
"alpha_frac": 0.6717920045,
"autogenerated": false,
"ratio": 2.772868217054264,
"config_test": false,
"... |
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
matplotlib.style.use('ggplot') # Look Pretty
#
# TODO: To procure the dataset, follow these steps:
# 1. Navigate to: https://data.cityofchicago.org/Public-Safety/Crimes-2001-to-present/ijzp-q8t2
# ... | {
"repo_name": "LamaHamadeh/Microsoft-DAT210x",
"path": "Module 5/assignment1.py",
"copies": "1",
"size": "3075",
"license": "mit",
"hash": 4293941906934180000,
"line_mean": 27.854368932,
"line_max": 129,
"alpha_frac": 0.6666666667,
"autogenerated": false,
"ratio": 2.997076023391813,
"config_tes... |
__author__ = 'lamter'
from error import *
''' 表头最小列数 '''
HEADS_MIN_SIZE = 2
class Item():
@classmethod
def read(cls, heads, datas):
# 生成实例
item = cls(heads)
for proName in heads.keys():
if not hasattr(item, proName):
raise InitItemFaild('未定义的属性:%s' % pro... | {
"repo_name": "lamter/stflowing",
"path": "item.py",
"copies": "1",
"size": "2154",
"license": "mit",
"hash": 1629601890219958300,
"line_mean": 30.3898305085,
"line_max": 76,
"alpha_frac": 0.3758099352,
"autogenerated": false,
"ratio": 3.0866666666666664,
"config_test": false,
"has_no_keyword... |
__author__ = 'lamter'
import logging
import json
import datetime
from collections import OrderedDict
import xlrd
import openpyxl
from error import *
from item import Item
# 表中至少要有几行数据
ITEM_NUM_MIN_SIZE = 1
''' 证券公司 '''
HUATAI = '华泰证券_交割流水'
class Flowing():
"""
将一个 excel 文件解析并返回
"""
with open(... | {
"repo_name": "lamter/stflowing",
"path": "flowing.py",
"copies": "1",
"size": "6460",
"license": "mit",
"hash": 5906608047502232000,
"line_mean": 20.4809160305,
"line_max": 93,
"alpha_frac": 0.4987562189,
"autogenerated": false,
"ratio": 2.93125,
"config_test": false,
"has_no_keywords": fals... |
__author__ = 'landini'
try:
import epz as tempEpz
import inspect
_,_,keys,_ = inspect.getargspec(tempEpz.CMD.__init__())
if 'tag' not in keys:
from libs.epz import epz as tempEpz
epz = tempEpz
except:
from epz import epz
from time import sleep
# N set the triggers. The triggers are, i... | {
"repo_name": "elandini/CoMPlEx",
"path": "libs/epzInterpreter.py",
"copies": "1",
"size": "10363",
"license": "mit",
"hash": 8617049504682899000,
"line_mean": 22.4457013575,
"line_max": 184,
"alpha_frac": 0.6218276561,
"autogenerated": false,
"ratio": 3.254711055276382,
"config_test": false,
... |
__author__ = 'larry'
import heapq
import os
import tempfile
def file_chunk_lines(f, chunk_size=65536):
"""Read chunks of lines and yield them one by one
We default to a smaller chunk than the buffer size because we will be reading this from many files at the same time
- **parameters**, **types**, **retu... | {
"repo_name": "benchi/big_file_sort",
"path": "big_file_sort/__init__.py",
"copies": "1",
"size": "4235",
"license": "apache-2.0",
"hash": 4094745231246166000,
"line_mean": 37.5090909091,
"line_max": 119,
"alpha_frac": 0.6427390791,
"autogenerated": false,
"ratio": 4.0838958534233365,
"config_t... |
###########################################################################################
import sys
#SainSmart 16 relay board with USB HID control from here:
#https://github.com/tatobari/hidrelaypy/blob/master/hidrelay.py
sys.path.insert(0, '/home/larsborm/Documents/Haptic_input/hidrelaypy-master/')
#If you get ... | {
"repo_name": "larsborm/Haptic_input",
"path": "Haptic_input_py27.py",
"copies": "1",
"size": "12252",
"license": "apache-2.0",
"hash": -145400445372623550,
"line_mean": 36.4678899083,
"line_max": 115,
"alpha_frac": 0.4776363043,
"autogenerated": false,
"ratio": 4.1086519114688125,
"config_test... |
import numbers
import numpy as np
import scipy.sparse as sp
from . import _hashing
from ..base import BaseEstimator, TransformerMixin
def _iteritems(d):
"""Like d.iteritems, but accepts any collections.Mapping."""
return d.iteritems() if hasattr(d, "iteritems") else d.items()
class FeatureHasher(BaseEsti... | {
"repo_name": "jmargeta/scikit-learn",
"path": "sklearn/feature_extraction/hashing.py",
"copies": "7",
"size": "5492",
"license": "bsd-3-clause",
"hash": -424021463166437900,
"line_mean": 39.3823529412,
"line_max": 79,
"alpha_frac": 0.6363801894,
"autogenerated": false,
"ratio": 4.270606531881804... |
import numpy as np
from ..base import BaseEstimator
from .base import SelectorMixin
from ..utils import atleast2d_or_csr
from ..utils.sparsefuncs_fast import csr_mean_variance_axis0
class VarianceThreshold(BaseEstimator, SelectorMixin):
"""Feature selector that removes all low-variance features.
This featur... | {
"repo_name": "treycausey/scikit-learn",
"path": "sklearn/feature_selection/variance_threshold.py",
"copies": "4",
"size": "2443",
"license": "bsd-3-clause",
"hash": 998455876208000800,
"line_mean": 30.7272727273,
"line_max": 79,
"alpha_frac": 0.6009005321,
"autogenerated": false,
"ratio": 4.0648... |
import numpy as np
from ..base import BaseEstimator
from .base import SelectorMixin
from ..utils import atleast2d_or_csr
from ..utils.sparsefuncs import csr_mean_variance_axis0
class VarianceThreshold(BaseEstimator, SelectorMixin):
"""Feature selector that removes all low-variance features.
This feature sel... | {
"repo_name": "Tong-Chen/scikit-learn",
"path": "sklearn/feature_selection/variance_threshold.py",
"copies": "7",
"size": "2438",
"license": "bsd-3-clause",
"hash": -9104916025617647000,
"line_mean": 30.6623376623,
"line_max": 79,
"alpha_frac": 0.6004922067,
"autogenerated": false,
"ratio": 4.070... |
import numpy as np
from ..base import BaseEstimator
from .base import SelectorMixin
from ..utils import check_array
from ..utils.sparsefuncs_fast import csr_mean_variance_axis0
class VarianceThreshold(BaseEstimator, SelectorMixin):
"""Feature selector that removes all low-variance features.
This feature sel... | {
"repo_name": "eickenberg/scikit-learn",
"path": "sklearn/feature_selection/variance_threshold.py",
"copies": "1",
"size": "2440",
"license": "bsd-3-clause",
"hash": -4278775274497638400,
"line_mean": 30.6883116883,
"line_max": 79,
"alpha_frac": 0.5995901639,
"autogenerated": false,
"ratio": 4.10... |
import numpy as np
from ..base import BaseEstimator
from .base import SelectorMixin
from ..utils import check_array
from ..utils.sparsefuncs import mean_variance_axis
from ..utils.validation import check_is_fitted
class VarianceThreshold(BaseEstimator, SelectorMixin):
"""Feature selector that removes all low-var... | {
"repo_name": "0asa/scikit-learn",
"path": "sklearn/feature_selection/variance_threshold.py",
"copies": "26",
"size": "2532",
"license": "bsd-3-clause",
"hash": -5021695372532731000,
"line_mean": 30.65,
"line_max": 79,
"alpha_frac": 0.6015007899,
"autogenerated": false,
"ratio": 4.103727714748785... |
import numpy as np
from ..base import BaseEstimator
from .base import SelectorMixin
from ..utils import check_array
from ..utils.sparsefuncs import mean_variance_axis
class VarianceThreshold(BaseEstimator, SelectorMixin):
"""Feature selector that removes all low-variance features.
This feature selection alg... | {
"repo_name": "hitszxp/scikit-learn",
"path": "sklearn/feature_selection/variance_threshold.py",
"copies": "12",
"size": "2440",
"license": "bsd-3-clause",
"hash": 554965265549517800,
"line_mean": 30.6883116883,
"line_max": 79,
"alpha_frac": 0.5979508197,
"autogenerated": false,
"ratio": 4.121621... |
import numpy as np
from .base import SelectorMixin
from ..base import BaseEstimator
from ..utils import check_array
from ..utils.sparsefuncs import mean_variance_axis
from ..utils.validation import check_is_fitted
class VarianceThreshold(BaseEstimator, SelectorMixin):
"""Feature selector that removes all low-va... | {
"repo_name": "DailyActie/Surrogate-Model",
"path": "01-codes/scikit-learn-master/sklearn/feature_selection/variance_threshold.py",
"copies": "1",
"size": "2594",
"license": "mit",
"hash": 987579293204285400,
"line_mean": 30.2530120482,
"line_max": 79,
"alpha_frac": 0.6033153431,
"autogenerated": f... |
from array import array
from collections import Mapping
from operator import itemgetter
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator, TransformerMixin
from ..externals import six
from ..externals.six.moves import xrange
from ..utils import atleast2d_or_csr, tosequence
def _tosequen... | {
"repo_name": "flightgong/scikit-learn",
"path": "sklearn/feature_extraction/dict_vectorizer.py",
"copies": "2",
"size": "10162",
"license": "bsd-3-clause",
"hash": -2065929917666044700,
"line_mean": 33.4474576271,
"line_max": 79,
"alpha_frac": 0.56435741,
"autogenerated": false,
"ratio": 4.35017... |
from random import Random
import numpy as np
import scipy.sparse as sp
from nose.tools import assert_equal
from nose.tools import assert_true
from nose.tools import assert_false
from numpy.testing import assert_array_equal
from sklearn.feature_extraction import DictVectorizer
from sklearn.feature_selection import Se... | {
"repo_name": "fspaolo/scikit-learn",
"path": "sklearn/feature_extraction/tests/test_dict_vectorizer.py",
"copies": "7",
"size": "3089",
"license": "bsd-3-clause",
"hash": 4601343812832602000,
"line_mean": 29.89,
"line_max": 76,
"alpha_frac": 0.5875687925,
"autogenerated": false,
"ratio": 3.27571... |
from random import Random
import numpy as np
import scipy.sparse as sp
from numpy.testing import assert_array_equal
from sklearn.utils.testing import (assert_equal, assert_in,
assert_false, assert_true)
from sklearn.feature_extraction import DictVectorizer
from sklearn.feature_sele... | {
"repo_name": "flightgong/scikit-learn",
"path": "sklearn/feature_extraction/tests/test_dict_vectorizer.py",
"copies": "8",
"size": "3217",
"license": "bsd-3-clause",
"hash": -7520504853654523000,
"line_mean": 29.9326923077,
"line_max": 76,
"alpha_frac": 0.5732048492,
"autogenerated": false,
"rat... |
import numbers
import numpy as np
import scipy.sparse as sp
from . import _hashing
from ..base import BaseEstimator, TransformerMixin
def _iteritems(d):
"""Like d.iteritems, but accepts any collections.Mapping."""
return d.iteritems() if hasattr(d, "iteritems") else d.items()
class FeatureHasher(BaseEsti... | {
"repo_name": "pompiduskus/scikit-learn",
"path": "sklearn/feature_extraction/hashing.py",
"copies": "183",
"size": "6155",
"license": "bsd-3-clause",
"hash": 7724119603494434000,
"line_mean": 39.2287581699,
"line_max": 79,
"alpha_frac": 0.6251827782,
"autogenerated": false,
"ratio": 4.1531713900... |
from array import array
from collections import Mapping
from operator import itemgetter
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator, TransformerMixin
from ..externals import six
from ..externals.six.moves import xrange
from ..utils import atleast2d_or_csr, tosequence
def _tosequen... | {
"repo_name": "jmargeta/scikit-learn",
"path": "sklearn/feature_extraction/dict_vectorizer.py",
"copies": "2",
"size": "9352",
"license": "bsd-3-clause",
"hash": -2070886073262876700,
"line_mean": 33.5092250923,
"line_max": 78,
"alpha_frac": 0.5616980325,
"autogenerated": false,
"ratio": 4.301747... |
from array import array
from collections import Mapping, Sequence
from operator import itemgetter
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator, TransformerMixin
from ..externals import six
from ..externals.six.moves import xrange
from ..utils import atleast2d_or_csr, tosequence
def... | {
"repo_name": "florian-f/sklearn",
"path": "sklearn/feature_extraction/dict_vectorizer.py",
"copies": "1",
"size": "9362",
"license": "bsd-3-clause",
"hash": -8534799006196423000,
"line_mean": 33.5461254613,
"line_max": 78,
"alpha_frac": 0.5619525742,
"autogenerated": false,
"ratio": 4.3023897058... |
from collections import Mapping, Sequence
from operator import itemgetter
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator, TransformerMixin
from ..utils import atleast2d_or_csr
def _tosequence(X):
"""Turn X into a sequence or ndarray, avoiding a copy if possible."""
if isinsta... | {
"repo_name": "sgenoud/scikit-learn",
"path": "sklearn/feature_extraction/dict_vectorizer.py",
"copies": "3",
"size": "8421",
"license": "bsd-3-clause",
"hash": 7750008816707437000,
"line_mean": 31.766536965,
"line_max": 78,
"alpha_frac": 0.544472153,
"autogenerated": false,
"ratio": 4.3206772703... |
from random import Random
import numpy as np
import scipy.sparse as sp
from nose.tools import assert_equal
from nose.tools import assert_true
from nose.tools import assert_false
from numpy.testing import assert_array_equal
from sklearn.feature_extraction import DictVectorizer
from sklearn.feature_selection import Se... | {
"repo_name": "sgenoud/scikit-learn",
"path": "sklearn/feature_extraction/tests/test_dict_vectorizer.py",
"copies": "3",
"size": "2866",
"license": "bsd-3-clause",
"hash": -8341885411096492000,
"line_mean": 30.152173913,
"line_max": 76,
"alpha_frac": 0.599790649,
"autogenerated": false,
"ratio": ... |
"""
================================
Cluster a batch of saved records
================================
This example does some extremely simplistic clustering of
PubMed abstracts. It shows how to tie PyMed to scikit-learn.
Results will vary between runs because the k-means clustering
is initialized randomly.
(Try ru... | {
"repo_name": "PyMed/PyMed",
"path": "examples/cluster_records.py",
"copies": "1",
"size": "1785",
"license": "bsd-3-clause",
"hash": 7077450322252110000,
"line_mean": 29.775862069,
"line_max": 78,
"alpha_frac": 0.6896358543,
"autogenerated": false,
"ratio": 3.445945945945946,
"config_test": fa... |
import numpy as np
from ..base import BaseEstimator
from .base import SelectorMixin
from ..utils import check_array
from ..utils.sparsefuncs import mean_variance_axis, min_max_axis
from ..utils.validation import check_is_fitted
class VarianceThreshold(BaseEstimator, SelectorMixin):
"""Feature selector that remov... | {
"repo_name": "chrsrds/scikit-learn",
"path": "sklearn/feature_selection/variance_threshold.py",
"copies": "2",
"size": "3014",
"license": "bsd-3-clause",
"hash": 706808932206458200,
"line_mean": 31.7608695652,
"line_max": 79,
"alpha_frac": 0.5912408759,
"autogenerated": false,
"ratio": 4.0951086... |
import numpy as np
from ..base import BaseEstimator
from .base import SelectorMixin
from ..utils import check_array
from ..utils.sparsefuncs import mean_variance_axis
from ..utils.validation import check_is_fitted
class VarianceThreshold(BaseEstimator, SelectorMixin):
"""Feature selector that removes all low-var... | {
"repo_name": "vortex-ape/scikit-learn",
"path": "sklearn/feature_selection/variance_threshold.py",
"copies": "123",
"size": "2572",
"license": "bsd-3-clause",
"hash": -4482994862180511000,
"line_mean": 30.3658536585,
"line_max": 79,
"alpha_frac": 0.6026438569,
"autogenerated": false,
"ratio": 4.... |
import numpy as np
from ..base import BaseEstimator
from ._base import SelectorMixin
from ..utils.sparsefuncs import mean_variance_axis, min_max_axis
from ..utils.validation import check_is_fitted
class VarianceThreshold(SelectorMixin, BaseEstimator):
"""Feature selector that removes all low-variance features.
... | {
"repo_name": "kevin-intel/scikit-learn",
"path": "sklearn/feature_selection/_variance_threshold.py",
"copies": "1",
"size": "3505",
"license": "bsd-3-clause",
"hash": -8834983785453004000,
"line_mean": 31.4537037037,
"line_max": 79,
"alpha_frac": 0.5791726106,
"autogenerated": false,
"ratio": 4.... |
import numbers
import warnings
import numpy as np
import scipy.sparse as sp
from . import _hashing
from ..base import BaseEstimator, TransformerMixin
def _iteritems(d):
"""Like d.iteritems, but accepts any collections.Mapping."""
return d.iteritems() if hasattr(d, "iteritems") else d.items()
class Featur... | {
"repo_name": "ldirer/scikit-learn",
"path": "sklearn/feature_extraction/hashing.py",
"copies": "5",
"size": "6830",
"license": "bsd-3-clause",
"hash": 4188175495849244700,
"line_mean": 39.8982035928,
"line_max": 79,
"alpha_frac": 0.6251830161,
"autogenerated": false,
"ratio": 4.239602731222843,
... |
import numbers
import warnings
import numpy as np
import scipy.sparse as sp
from ..utils import IS_PYPY
from ..base import BaseEstimator, TransformerMixin
if not IS_PYPY:
from ._hashing import transform as _hashing_transform
else:
def _hashing_transform(*args, **kwargs):
raise NotImplementedError(
... | {
"repo_name": "vortex-ape/scikit-learn",
"path": "sklearn/feature_extraction/hashing.py",
"copies": "10",
"size": "7180",
"license": "bsd-3-clause",
"hash": -8916624234863460000,
"line_mean": 38.8888888889,
"line_max": 79,
"alpha_frac": 0.6228412256,
"autogenerated": false,
"ratio": 4.23848878394... |
import numbers
import numpy as np
import scipy.sparse as sp
from . import _hashing
from ..base import BaseEstimator, TransformerMixin
def _iteritems(d):
"""Like d.iteritems, but accepts any collections.Mapping."""
return d.iteritems() if hasattr(d, "iteritems") else d.items()
class FeatureHasher(BaseEsti... | {
"repo_name": "waterponey/scikit-learn",
"path": "sklearn/feature_extraction/hashing.py",
"copies": "74",
"size": "6153",
"license": "bsd-3-clause",
"hash": -8583959654112133000,
"line_mean": 39.2156862745,
"line_max": 79,
"alpha_frac": 0.6266861693,
"autogenerated": false,
"ratio": 4.17435549525... |
import numbers
import numpy as np
import scipy.sparse as sp
from ..utils import IS_PYPY
from ..base import BaseEstimator, TransformerMixin
if not IS_PYPY:
from ._hashing_fast import transform as _hashing_transform
else:
def _hashing_transform(*args, **kwargs):
raise NotImplementedError(
... | {
"repo_name": "kevin-intel/scikit-learn",
"path": "sklearn/feature_extraction/_hash.py",
"copies": "3",
"size": "6679",
"license": "bsd-3-clause",
"hash": 4375080845973833000,
"line_mean": 38.0584795322,
"line_max": 79,
"alpha_frac": 0.6188052104,
"autogenerated": false,
"ratio": 4.15877957658779... |
import numbers
import numpy as np
import scipy.sparse as sp
from ..utils import IS_PYPY
from ..base import BaseEstimator, TransformerMixin
if not IS_PYPY:
from ._hashing import transform as _hashing_transform
else:
def _hashing_transform(*args, **kwargs):
raise NotImplementedError(
'... | {
"repo_name": "chrsrds/scikit-learn",
"path": "sklearn/feature_extraction/hashing.py",
"copies": "2",
"size": "6509",
"license": "bsd-3-clause",
"hash": 1359889735516882400,
"line_mean": 38.2108433735,
"line_max": 79,
"alpha_frac": 0.6220617606,
"autogenerated": false,
"ratio": 4.180475272960822,... |
import numbers
import numpy as np
import scipy.sparse as sp
from ..utils import IS_PYPY
from ..utils.validation import _deprecate_positional_args
from ..base import BaseEstimator, TransformerMixin
if not IS_PYPY:
from ._hashing_fast import transform as _hashing_transform
else:
def _hashing_transform(*args, ... | {
"repo_name": "huzq/scikit-learn",
"path": "sklearn/feature_extraction/_hash.py",
"copies": "2",
"size": "6747",
"license": "bsd-3-clause",
"hash": 7765032303471307000,
"line_mean": 38,
"line_max": 79,
"alpha_frac": 0.6222024604,
"autogenerated": false,
"ratio": 4.157116451016636,
"config_test"... |
__author__ = 'lauft'
import os
from stat import *
class CheckPath(object):
"""
check whether a path meets certain requirements
"""
def __init__(self, path):
self.path = path
def does_exist(self):
"""
:rtype : bool
"""
return os.path.exists(self.path)
... | {
"repo_name": "lauft/pyCheck",
"path": "pycheck/checkpath.py",
"copies": "1",
"size": "1147",
"license": "mit",
"hash": -4513810582040387000,
"line_mean": 21.5098039216,
"line_max": 62,
"alpha_frac": 0.5797733217,
"autogenerated": false,
"ratio": 3.4238805970149255,
"config_test": false,
"has... |
import http.server
import socketserver
import threading
import socket
import requests
## Text methods
# Remove integers
def removeIntegers(text):
for i in range(10):
text = text.split(str(i))
text = ''.join(text)
return text
# De-duplicate chars
def deDuplicate(text):
# Have to use a dict... | {
"repo_name": "ldeks/simple-server",
"path": "server.py",
"copies": "1",
"size": "2618",
"license": "mit",
"hash": 1331111202413684200,
"line_mean": 31.725,
"line_max": 105,
"alpha_frac": 0.6268143621,
"autogenerated": false,
"ratio": 3.8107714701601165,
"config_test": false,
"has_no_keywords... |
import sys, os
file_ext = [".php", ".class"]
search_type = ["istart", "iend", "eval(", "base64_decode(", "base64_encode("]
def is_file_ext(file, exts):
o = False
for ext in exts:
if file.endswith(ext):
return True
return False
def dir_lookup(path, file_list, exts):
for file in o... | {
"repo_name": "Toroxx/phpcode-scanner",
"path": "scanner.py",
"copies": "1",
"size": "1781",
"license": "mit",
"hash": -107569620494242300,
"line_mean": 23.7361111111,
"line_max": 81,
"alpha_frac": 0.4912970241,
"autogenerated": false,
"ratio": 3.492156862745098,
"config_test": false,
"has_no... |
__author__ = 'layip'
import easygui
import logging
import os
import pytz
SETTINGS_FILE_NAME = "easygui_settings.dat"
class Settings(easygui.EgStore):
def __init__(self, filename):
logging.info("Initialising settings...")
self.filename = filename
self.timezone_name = ""
self.debug_m... | {
"repo_name": "LiaungYip/kooltou",
"path": "settings_interface.py",
"copies": "1",
"size": "3747",
"license": "mit",
"hash": -8272971426794401000,
"line_mean": 38.4526315789,
"line_max": 129,
"alpha_frac": 0.5513744329,
"autogenerated": false,
"ratio": 4.177257525083612,
"config_test": false,
... |
import sys, random
def auto_incorrect(args):
# usage:
# argument 1: -s flag means input is string, -f means filename
# 2: string, could be filename if specified -f
# 3: (optional) non-negative int to specify how many times
# in 100 that a word should have a spelli... | {
"repo_name": "lazho/auto-incorrect",
"path": "auto_incorrect.py",
"copies": "1",
"size": "3103",
"license": "unlicense",
"hash": 5579427700392294000,
"line_mean": 28.8365384615,
"line_max": 229,
"alpha_frac": 0.5191749919,
"autogenerated": false,
"ratio": 3.637749120750293,
"config_test": fals... |
'''author:lazyp
email :lazy_p@163.com
date :2014-06-11
'''
#-*- coding:utf-8 -*-
import hashlib
import urllib
import httplib
import json
import time
class OKCoinAPI:
__DOMAIN__ = "www.okcoin.cn"
__OKCOIN_TICKER_API__ = "https://www.okcoin.cn/api/ticker.do?symbol=btc_cny"
__OKCOIN_TRADE_... | {
"repo_name": "lazyp/cointrade",
"path": "OKCoinAPI.py",
"copies": "1",
"size": "4404",
"license": "apache-2.0",
"hash": -7554731616739923000,
"line_mean": 39.4036697248,
"line_max": 99,
"alpha_frac": 0.4904632153,
"autogenerated": false,
"ratio": 4.16650898770104,
"config_test": false,
"has_... |
__author__ = 'lberrocal'
import logging
logger = logging.getLogger(__name__)
class AbstractProjectCreateUpdateMixin(object):
formset_classes = None
def get_context_data(self, **kwargs):
assert self.formset_classes is not None, "No formset class specified"
context = super().get_context_data(**... | {
"repo_name": "luiscberrocal/homeworkpal",
"path": "homeworkpal_project/project_admin/mixins.py",
"copies": "1",
"size": "1964",
"license": "mit",
"hash": -4161573658092681000,
"line_mean": 39.0816326531,
"line_max": 82,
"alpha_frac": 0.5870672098,
"autogenerated": false,
"ratio": 4.0494845360824... |
__author__ = 'lee'
import MySQLdb
import sys
from functools import wraps
class Configuration:
def __init__(self, env):
if env == "Prod":
self.host = ""
elif env == "Test":
self.host = ""
def d2b(sql):
_conf = Configuration(env="Prod")
def on_sql_error(err):
... | {
"repo_name": "DingaGa/awe2some",
"path": "awe2some/tools/db.py",
"copies": "1",
"size": "1211",
"license": "cc0-1.0",
"hash": 8380620209266531000,
"line_mean": 23.7142857143,
"line_max": 67,
"alpha_frac": 0.4962840628,
"autogenerated": false,
"ratio": 3.9446254071661238,
"config_test": false,
... |
__author__ = "Lee Salzman"
__url__ = ['http://lee.fov120.com/iqm']
__version__ = "2013-10-2"
__bpydoc__ = """\
This script is an exporter to the IQM and IQE file formats.
"""
# This script is licensed as public domain.
bl_addon_info = {
"name": "Export Inter-Quake Model (.iqm/.iqe)",
"author": "Lee... | {
"repo_name": "lsalzman/iqm",
"path": "blender-2.56/iqm_export.py",
"copies": "1",
"size": "44240",
"license": "mit",
"hash": -23291526868676016,
"line_mean": 39.8939393939,
"line_max": 395,
"alpha_frac": 0.5245253165,
"autogenerated": false,
"ratio": 3.5443037974683542,
"config_test": false,
... |
global mysql_user
mysql_user = os.getenv('DSTAT_MYSQL_USER') or os.getenv('USER')
global mysql_pwd
mysql_pwd = os.getenv('DSTAT_MYSQL_PWD')
global mysql_host
mysql_host = os.getenv('DSTAT_MYSQL_HOST')
global mysql_port
mysql_port = os.getenv('DSTAT_MYSQL_PORT')
class dstat_plugin(dstat):
"""
Plugin for M... | {
"repo_name": "dongyoungy/dbseer_middleware",
"path": "rs-sysmon2/plugins/dstat_mysql5_log_size.py",
"copies": "1",
"size": "1660",
"license": "apache-2.0",
"hash": 8730470749324635000,
"line_mean": 28.1228070175,
"line_max": 117,
"alpha_frac": 0.5620481928,
"autogenerated": false,
"ratio": 3.242... |
global postgres_user
postgres_user = os.getenv('DSTAT_POSTGRES_USER') or os.getenv('USER')
global postgres_pwd
postgres_pwd = os.getenv('DSTAT_POSTGRES_PWD')
global postgres_host
postgres_host = os.getenv('DSTAT_POSTGRES_HOST')
global postgres_port
postgres_port = os.getenv('DSTAT_POSTGRES_PORT')
global postgres_d... | {
"repo_name": "barzan/dbseer",
"path": "middleware_old/dstat_for_server/plugins/dstat_postgres_all1.py",
"copies": "3",
"size": "3305",
"license": "apache-2.0",
"hash": -5331212341893692000,
"line_mean": 32.7244897959,
"line_max": 147,
"alpha_frac": 0.5721633888,
"autogenerated": false,
"ratio": ... |
global mysql_user
mysql_user = os.getenv('DSTAT_MYSQL_USER') or os.getenv('USER')
global mysql_pwd
mysql_pwd = os.getenv('DSTAT_MYSQL_PWD')
class dstat_plugin(dstat):
"""
Plugin for MySQL 5 connections.
"""
def __init__(self):
self.name = 'mysql5 conn'
self.nick = ('ThCon', '%Con')
... | {
"repo_name": "dongyoungy/dbseer_middleware",
"path": "rs-sysmon2/plugins/dstat_mysql5_conn.py",
"copies": "1",
"size": "1490",
"license": "apache-2.0",
"hash": -7501835936021138000,
"line_mean": 28.2156862745,
"line_max": 79,
"alpha_frac": 0.5348993289,
"autogenerated": false,
"ratio": 3.5990338... |
global mysql_user
mysql_user = os.getenv('DSTAT_MYSQL_USER') or os.getenv('USER')
global mysql_pwd
mysql_pwd = os.getenv('DSTAT_MYSQL_PWD')
class dstat_plugin(dstat):
"""
Plugin for MySQL 5 Keys.
"""
def __init__(self):
self.name = 'mysql5 key status'
self.nick = ('used', 'read', 'w... | {
"repo_name": "dongyoungy/dbseer_middleware",
"path": "rs-sysmon2/plugins/dstat_mysql5_keys.py",
"copies": "1",
"size": "1432",
"license": "apache-2.0",
"hash": -4884773931495014000,
"line_mean": 27.64,
"line_max": 109,
"alpha_frac": 0.5251396648,
"autogenerated": false,
"ratio": 3.49268292682926... |
global mysql_user
mysql_user = os.getenv('DSTAT_MYSQL_USER') or os.getenv('USER')
global mysql_pwd
mysql_pwd = os.getenv('DSTAT_MYSQL_PWD')
global mysql_host
mysql_host = os.getenv('DSTAT_MYSQL_HOST')
global mysql_port
mysql_port = os.getenv('DSTAT_MYSQL_PORT')
global mysql_socket
mysql_socket = os.getenv('DSTAT_... | {
"repo_name": "SpamapS/dstat-plugins",
"path": "dstat_plugins/plugins/dstat_mysql5_keys.py",
"copies": "4",
"size": "1976",
"license": "apache-2.0",
"hash": -5833833975986675000,
"line_mean": 26.8309859155,
"line_max": 109,
"alpha_frac": 0.5197368421,
"autogenerated": false,
"ratio": 3.5927272727... |
global mysql_user
mysql_user = os.getenv('DSTAT_MYSQL_USER') or os.getenv('USER')
global mysql_pwd
mysql_pwd = os.getenv('DSTAT_MYSQL_PWD')
class dstat_plugin(dstat):
"""
Plugin for MySQL 5 commands.
"""
def __init__(self):
self.name = 'mysql5 cmds'
self.nick = ('sel', 'ins','upd','de... | {
"repo_name": "SpamapS/dstat-plugins",
"path": "dstat_plugins/plugins/dstat_mysql5_cmds.py",
"copies": "2",
"size": "1494",
"license": "apache-2.0",
"hash": 3557517636113391600,
"line_mean": 30.125,
"line_max": 87,
"alpha_frac": 0.5093708166,
"autogenerated": false,
"ratio": 3.5152941176470587,
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
def install():
"""
Ref:
1. https://github.com/dhiltgen/docker-machine-kvm
2. https://www.howtoforge.com/how-to-install-kvm-and-libvirt-on-centos-6.2-with-bridged-networking
3. http://blog.arungupta.me/docker-machine-swarm-compose-couchbase-wildfly
4. h... | {
"repo_name": "legendlee1314/ooni",
"path": "docker.py",
"copies": "1",
"size": "1579",
"license": "mit",
"hash": -3948599489617508000,
"line_mean": 41.6756756757,
"line_max": 215,
"alpha_frac": 0.7055098163,
"autogenerated": false,
"ratio": 3.019120458891013,
"config_test": false,
"has_no_ke... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import requests
from bs4 import BeautifulSoup as soup
from pymongo import MongoClient as mc
head = 'http://www.nba.com'
host = 'mongodb://172.16.104.62:20001'
def getLinks():
cache = open('links.tmp', 'a')
navigation = '{}/2016/news/archive/{}/index.... | {
"repo_name": "legendlee1314/ooni",
"path": "grab.py",
"copies": "1",
"size": "1876",
"license": "mit",
"hash": 62456296693571820,
"line_mean": 24.0133333333,
"line_max": 68,
"alpha_frac": 0.5863539446,
"autogenerated": false,
"ratio": 3.308641975308642,
"config_test": false,
"has_no_keywords... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup as bs
from bson.json_util import loads
from pymongo import MongoClient as mc
import pydoop.hdfs as hdfs
import hashlib
import re
import time
host = 'mongodb://172.16.104.62:20001'
db = 'hdb'
username = 'hdb_admin'
def json_from_hdfs(url):
... | {
"repo_name": "legendlee1314/ooni",
"path": "hdfs2mongo.py",
"copies": "1",
"size": "2417",
"license": "mit",
"hash": -902583322804284000,
"line_mean": 26.1573033708,
"line_max": 67,
"alpha_frac": 0.5436491518,
"autogenerated": false,
"ratio": 3.5387994143484627,
"config_test": false,
"has_no... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import os
import re
MASTER_IP = '172.16.104.62'
MESOS_PATH = '/data/opt/mesos-1.4.0/build'
WORK_DIR = '/tmp/mesos/work_dir'
MASTER_SH = 'bin/mesos-master.sh'
WORKER_SH = 'bin/mesos-agent.sh'
def print_cmd(cmd, tag=None):
if not tag:
print cmd
... | {
"repo_name": "legendlee1314/ooni",
"path": "mesos.py",
"copies": "1",
"size": "1625",
"license": "mit",
"hash": -1237587841138717200,
"line_mean": 24.7936507937,
"line_max": 87,
"alpha_frac": 0.616,
"autogenerated": false,
"ratio": 2.943840579710145,
"config_test": false,
"has_no_keywords": ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup as bs
from bson.json_util import loads
from pymongo import MongoClient as mc
import pymongo
import pydoop.hdfs as hdfs
import zmq
import hashlib
import os
import random
import re
import sys
import time
server_tcp = "tcp://*:20003"
client_tcp =... | {
"repo_name": "legendlee1314/ooni",
"path": "hdfs2mongo_distributed.py",
"copies": "1",
"size": "3868",
"license": "mit",
"hash": 9111941768153386000,
"line_mean": 25.3129251701,
"line_max": 63,
"alpha_frac": 0.5343846949,
"autogenerated": false,
"ratio": 3.712092130518234,
"config_test": false... |
__author__ = "Leif Azzopardi"
from measures.eval_measures_2018 import UtilityBasedMeasure, AreaBasedMeasures, MAPBasedMeasures
from measures.eval_measures_2018 import DescriptionMeasures, CountBasedMeasures, GainBasedMeasures
from measures.eval_measures_2018 import LossBasedMeasures, RecallBasedMeasures
class TarAgg... | {
"repo_name": "leifos/tar",
"path": "scripts/measures/tar_rulers_2018.py",
"copies": "1",
"size": "5273",
"license": "mit",
"hash": -4750916114475175000,
"line_mean": 36.3971631206,
"line_max": 100,
"alpha_frac": 0.5359377963,
"autogenerated": false,
"ratio": 3.970632530120482,
"config_test": f... |
__author__ = "Leif Azzopardi"
from measures.eval_measures import CostBasedMeasure, AreaBasedMeasures, MAPBasedMeasures
from measures.eval_measures import DescriptionMeasures, CountBasedMeasures, GainBasedMeasures
from measures.eval_measures import LossBasedMeasures
class TarAggRuler(object):
def __init__(self):... | {
"repo_name": "leifos/tar",
"path": "scripts/measures/tar_rulers.py",
"copies": "1",
"size": "4005",
"license": "mit",
"hash": -6249906520844574000,
"line_mean": 36.0833333333,
"line_max": 93,
"alpha_frac": 0.5218476904,
"autogenerated": false,
"ratio": 4.12037037037037,
"config_test": false,
... |
__author__ = "Leif Azzopardi"
import math
class EvalMeasure(object):
def __init__(self, topic_id, num_docs, num_rels):
self.topic_id = topic_id
self.num_docs = num_docs
self.num_rels = num_rels
self.thresholding = False
# For each of the different measures you create,
... | {
"repo_name": "leifos/tar",
"path": "scripts/measures/eval_measures_2018.py",
"copies": "1",
"size": "20543",
"license": "mit",
"hash": 5558671038082616000,
"line_mean": 38.7350096712,
"line_max": 156,
"alpha_frac": 0.5894465268,
"autogenerated": false,
"ratio": 3.4096265560165975,
"config_test... |
__author__ = "Leif Azzopardi"
import os
import sys
from seeker.trec_qrel_handler import TrecQrelHandler
def save_topic(cFileHandler, topic_id, doc_dict):
"""
http://docs.quantifiedcode.com/python-anti-patterns/readability/not_using_items_to_iterate_over_a_dictionary.html
"""
print("Saving Topic: {0}"... | {
"repo_name": "leifos/tar",
"path": "scripts/create_combined_qrels.py",
"copies": "1",
"size": "4768",
"license": "mit",
"hash": 6005851558333578000,
"line_mean": 31.8827586207,
"line_max": 117,
"alpha_frac": 0.5815855705,
"autogenerated": false,
"ratio": 3.313412091730368,
"config_test": false... |
__author__ = "Leif Azzopardi"
import os
import sys
import re
import math
from measures.tar_rulers_2018 import TarRulerTask2, TarRulerTask1, TarAggRuler
from seeker.trec_qrel_handler import TrecQrelHandler
def main(task, results_file, qrel_file):
qrh = TrecQrelHandler(qrel_file)
#print(qrh.get_doc_list('CD00... | {
"repo_name": "leifos/tar",
"path": "scripts/tar_eval_2018.py",
"copies": "1",
"size": "4538",
"license": "mit",
"hash": -2790803776783009000,
"line_mean": 30.9577464789,
"line_max": 115,
"alpha_frac": 0.4773027766,
"autogenerated": false,
"ratio": 3.5453125,
"config_test": false,
"has_no_key... |
__author__ = "Leif Azzopardi"
import os
import sys
def main(filename, format):
record = False
topic_id = ""
doc_dict = {}
with open(filename, "r") as f:
while f:
line = f.readline()
if not line:
break
if record:
doc_id = li... | {
"repo_name": "leifos/tar",
"path": "scripts/extract_parts_from_topic.py",
"copies": "1",
"size": "2580",
"license": "mit",
"hash": -7070721938130951000,
"line_mean": 27.0434782609,
"line_max": 94,
"alpha_frac": 0.5186046512,
"autogenerated": false,
"ratio": 3.6134453781512605,
"config_test": f... |
__author__ = "Leif Azzopardi"
class EvalMeasure(object):
def __init__(self, topic_id, num_docs, num_rels):
self.topic_id = topic_id
self.num_docs = num_docs
self.num_rels = num_rels
# For each of the different measures you create,
# you need to specify which ones should be... | {
"repo_name": "leifos/tar",
"path": "scripts/measures/eval_measures.py",
"copies": "1",
"size": "18130",
"license": "mit",
"hash": -2563101881048108500,
"line_mean": 34.1356589147,
"line_max": 120,
"alpha_frac": 0.5541643685,
"autogenerated": false,
"ratio": 3.401500938086304,
"config_test": fa... |
__author__ = "Leif Azzopardi"
import os
import sys
import re
from measures.tar_rulers import TarRuler, TarAggRuler
from seeker.trec_qrel_handler import TrecQrelHandler
def main(results_file, qrel_file):
qrh = TrecQrelHandler(qrel_file)
#print(qrh.get_topic_list()) # show what qrel topics have been read in
... | {
"repo_name": "leifos/tar",
"path": "scripts/tar_eval.py",
"copies": "1",
"size": "3991",
"license": "mit",
"hash": 8817103058116042000,
"line_mean": 29.2348484848,
"line_max": 115,
"alpha_frac": 0.4647957905,
"autogenerated": false,
"ratio": 3.56021409455843,
"config_test": false,
"has_no_ke... |
"""@author: Leif Johnson <leif@cs.utexas.edu>"""
import BaseHTTPServer
import condor
import datetime
import socket
import sys
import threading
logger = condor.log.get_logger(__name__, default_level = "INFO")
TEMPLATE = '''\
<!doctype html>
<html>
<head>
<title>UT Condor</title>
<link href="//netdna.bootstrapcdn.com/... | {
"repo_name": "borg-project/utcondor",
"path": "condor/managers/http_status.py",
"copies": "1",
"size": "3226",
"license": "mit",
"hash": -7742278843541348000,
"line_mean": 31.5858585859,
"line_max": 111,
"alpha_frac": 0.5694358338,
"autogenerated": false,
"ratio": 3.417372881355932,
"config_te... |
__author__ = 'leif'
from asg_project import settings
from django.core.management import setup_environ
setup_environ(settings)
from django.contrib.auth.models import User
from asg.models import GameExperiment, UserProfile
def add_game_exp(name, config, desc,level=1):
ge = GameExperiment.objects.get_or_create(name=... | {
"repo_name": "leifos/boxes",
"path": "asg_project/populate_asg_db.py",
"copies": "1",
"size": "1274",
"license": "mit",
"hash": 689547225151814700,
"line_mean": 30.875,
"line_max": 94,
"alpha_frac": 0.6577708006,
"autogenerated": false,
"ratio": 3.192982456140351,
"config_test": false,
"has_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.