text stringlengths 0 1.05M | meta dict |
|---|---|
import numpy as np
from vtk import vtkPolyData, vtkPoints, vtkCellArray, vtkTriangle
from vtk.util.numpy_support import vtk_to_numpy, numpy_to_vtk, get_numpy_array_type, get_vtk_to_numpy_typemap, \
numpy_to_vtkIdTypeArray
from vtk import vtkPoints, VTK_UNSIGNED_CHAR
from vtk import vtkCellArray, vtkPolyData
de... | {
"repo_name": "mmolero/pcloudpy",
"path": "pcloudpy/core/io/converters.py",
"copies": "1",
"size": "4283",
"license": "bsd-3-clause",
"hash": 4846513369076534000,
"line_mean": 28.1428571429,
"line_max": 112,
"alpha_frac": 0.6684566892,
"autogenerated": false,
"ratio": 3.4154704944178627,
"confi... |
import numpy as np
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import pyqtSignal as Signal
from vtk import vtkInteractorStyleImage, vtkInteractorStyleTrackballCamera, vtkActor, vtkImageActor
from vtk import vtkAreaPicker, vtkContourWidget, vtkOrientedGlyph... | {
"repo_name": "mmolero/pcloudpy",
"path": "pcloudpy/gui/components/ViewWidget.py",
"copies": "1",
"size": "13005",
"license": "bsd-3-clause",
"hash": -7140284387233391000,
"line_mean": 37.5934718101,
"line_max": 125,
"alpha_frac": 0.6650519031,
"autogenerated": false,
"ratio": 3.7306368330464714,... |
from vtk import vtkDelaunay2D, vtkPolyData
from pcloudpy.core.filters.base import FilterBase
class Delaunay2D(FilterBase):
"""
2D Delaunay triangulation method
Delaunay2d is a filter that constructs a 2D Delaunay triangulation from a vtkPolyData object
Parameters
----------
PolyData: vtkPol... | {
"repo_name": "mmolero/pcloudpy",
"path": "pcloudpy/core/filters/Delaunay2D.py",
"copies": "1",
"size": "1526",
"license": "bsd-3-clause",
"hash": 1466627593822748200,
"line_mean": 29.52,
"line_max": 127,
"alpha_frac": 0.6566186107,
"autogenerated": false,
"ratio": 3.7401960784313726,
"config_t... |
__author__ = 'miguel'
from bokeh.plotting import *
def make_outliers_ds(df, start=None, end=None, coordinates='absolute'):
""" construct data source """
r = df
ds = ColumnDataSource()
x = np.append(r.index, np.flipud(r.index))
if coordinates == 'absolute':
y = np.append(r.q1 - r.neutral,... | {
"repo_name": "xlhtc007/osqf2015",
"path": "bokeh_plots.py",
"copies": "2",
"size": "1875",
"license": "mit",
"hash": 7160636951315597000,
"line_mean": 37.2653061224,
"line_max": 124,
"alpha_frac": 0.6245333333,
"autogenerated": false,
"ratio": 2.741228070175439,
"config_test": false,
"has_no... |
__author__ = 'Miguel Vaz'
import numpy as np
import pandas as pd
import networkx as nx
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure
def edges_datasource(g, layout=None, line_width=None, line_color=None):
"""
Creates a bokeh ColumnDataSource with the computed parameters for dr... | {
"repo_name": "mvaz/financial-correlation-networks",
"path": "fincorrnets/viz.py",
"copies": "1",
"size": "8294",
"license": "mit",
"hash": -6564299404949750000,
"line_mean": 31.2723735409,
"line_max": 122,
"alpha_frac": 0.5553412105,
"autogenerated": false,
"ratio": 3.196146435452794,
"config_... |
__author__ = "Mihaela Rosca"
__contact__ = "mihaela.c.rosca@gmail.com"
import cPickle as pickle
from sklearn import cross_validation
import argparse
import numpy as np
from lib import deepbelief as db
from lib import restrictedBoltzmannMachine as rbm
from lib.common import *
from read.readfacedatabases import *
fr... | {
"repo_name": "Warvito/pydeeplearn",
"path": "code/tests.py",
"copies": "3",
"size": "3204",
"license": "bsd-3-clause",
"hash": -204300982107891260,
"line_mean": 25.9243697479,
"line_max": 89,
"alpha_frac": 0.6869538077,
"autogenerated": false,
"ratio": 3.76056338028169,
"config_test": false,
... |
__author__ = "Mihaela Rosca"
__contact__ = "mihaela.c.rosca@gmail.com"
import heapq
import matplotlib
import numpy
import os
import scipy
import scipy.linalg
import warnings
from os.path import isfile, join
from scipy import misc
# Import all common functions
from lib.common import *
import matplotlib
import os
hav... | {
"repo_name": "mihaelacr/pydeeplearn",
"path": "code/PCA.py",
"copies": "1",
"size": "8385",
"license": "bsd-3-clause",
"hash": 1874802432649614800,
"line_mean": 28.1180555556,
"line_max": 101,
"alpha_frac": 0.720810972,
"autogenerated": false,
"ratio": 3.656781508940253,
"config_test": false,
... |
__author__ = "Mihaela Rosca"
__contact__ = "mihaela.c.rosca@gmail.com"
import heapq
import matplotlib.pyplot as plt
import numpy
import os
import scipy
import scipy.linalg
from os.path import isfile, join
from scipy import misc
# Import all common functions
from common import *
# The directory path to the images
P... | {
"repo_name": "mihaelacr/pydeeplearn",
"path": "code/old-version/PCA.py",
"copies": "3",
"size": "7818",
"license": "bsd-3-clause",
"hash": -6897258778061071000,
"line_mean": 27.9592592593,
"line_max": 101,
"alpha_frac": 0.7225633154,
"autogenerated": false,
"ratio": 3.6532710280373832,
"config... |
__author__ = "Mihaela Rosca"
__contact__ = "mihaela.c.rosca@gmail.com"
import numpy as np
import restrictedBoltzmannMachine as rbm
# TODO: use conjugate gradient for backpropagation instead of steepest descent
# see here for a theano example http://deeplearning.net/tutorial/code/logistic_cg.py
# TODO: add weight de... | {
"repo_name": "mihaelacr/pydeeplearn",
"path": "code/old-version/deepbelief.py",
"copies": "3",
"size": "9738",
"license": "bsd-3-clause",
"hash": -8089054988897531000,
"line_mean": 37.0390625,
"line_max": 114,
"alpha_frac": 0.6823783118,
"autogenerated": false,
"ratio": 3.9860826852230864,
"co... |
__author__ = "Mihaela Rosca"
__contact__ = "mihaela.c.rosca@gmail.com"
import numpy as np
"""
Arguments:
vec: A numpy 1-D vector.
size: A 2D tuple
Returns:
A 2-D vector of dimension 'size', only if 'vec' has compatible dimensions.
Otherwise it throws an error.
"""
def vectorToImage(vec, size):
return vec.r... | {
"repo_name": "mihaelacr/pydeeplearn",
"path": "code/old-version/common.py",
"copies": "3",
"size": "3824",
"license": "bsd-3-clause",
"hash": -4876726789127845000,
"line_mean": 26.7101449275,
"line_max": 90,
"alpha_frac": 0.7110355649,
"autogenerated": false,
"ratio": 3.5050412465627865,
"conf... |
from time import sleep
import pyupm_grove as grove
# New knob on AIO pin 0
knob = grove.GroveRotary(0)
# Loop indefinitely
while True:
# Read values
abs = knob.abs_value()
absdeg = knob.abs_deg()
absrad = knob.abs_rad()
rel = knob.rel_value()
reldeg = knob.rel_deg()
relrad = knob.rel_ra... | {
"repo_name": "0xD34D/upm",
"path": "examples/python/groverotary.py",
"copies": "18",
"size": "1718",
"license": "mit",
"hash": -8848726392295290000,
"line_mean": 37.1777777778,
"line_max": 100,
"alpha_frac": 0.7136204889,
"autogenerated": false,
"ratio": 3.4223107569721116,
"config_test": fals... |
import time, signal
import pyupm_tm1637 as tm1637
# Register exit handler for normal Ctrl+C exit
def SIGINTHandler(signum, frame):
raise SystemExit
signal.signal(signal.SIGINT, SIGINTHandler)
# Create a display object on pins 0 CLK and 1 DIO
display = tm1637.TM1637(0, 1)
dots = True
# Get local time
myTime = ti... | {
"repo_name": "tripzero/upm",
"path": "examples/python/tm1637.py",
"copies": "16",
"size": "2002",
"license": "mit",
"hash": -458112287289341700,
"line_mean": 36.0740740741,
"line_max": 79,
"alpha_frac": 0.7532467532,
"autogenerated": false,
"ratio": 3.721189591078067,
"config_test": false,
"... |
# This example demonstrates how to use one of the ADS1115 ADCs on the
# DFRobot Joule Shield with devices that output a small differential
# voltage (e.g. geophones, piezoelectric bands or pads, thermocouples).
from __future__ import print_function
from threading import Timer
from time import sleep
from upm import py... | {
"repo_name": "nitirohilla/upm",
"path": "examples/python/ads1115.py",
"copies": "7",
"size": "3049",
"license": "mit",
"hash": -6087977799857881000,
"line_mean": 34.4534883721,
"line_max": 81,
"alpha_frac": 0.7008855362,
"autogenerated": false,
"ratio": 3.5955188679245285,
"config_test": false... |
# This example demonstrates how to use one the ADS1015 ADC on the Grove Joule
# Shield or the Sparkfun ADC Block for Edison with devices that output a small
# differential voltage (e.g. geophones, piezoelectric bands or pads,
# thermocouples).
from __future__ import print_function
from threading import Timer
from tim... | {
"repo_name": "nitirohilla/upm",
"path": "examples/python/ads1015.py",
"copies": "7",
"size": "2834",
"license": "mit",
"hash": 817162908502118000,
"line_mean": 33.1445783133,
"line_max": 81,
"alpha_frac": 0.7050105857,
"autogenerated": false,
"ratio": 3.6473616473616475,
"config_test": false,
... |
__author__ = 'Miha Jenko'
import json
import numpy
from sklearn.cluster import KMeans
def projects_backed_per_user(users):
counts = {}
nr_of_projects = 0
for uid, projects in users.items():
# how many projects did the user back?
projects_supported = len(projects)
# figure out the... | {
"repo_name": "mihajenko/mihajenko.github.io",
"path": "old/sekai-project-kickstarter-analysis/stats.py",
"copies": "1",
"size": "5548",
"license": "mit",
"hash": -4943011303731229000,
"line_mean": 28.8279569892,
"line_max": 78,
"alpha_frac": 0.5281182408,
"autogenerated": false,
"ratio": 3.31421... |
__author__ = 'Miha Jenko'
import os
import json
import pprint
from bs4 import BeautifulSoup
def load_page(path):
with open(path, 'r', encoding='UTF-8') as fp:
return fp.read()
def process_page(page):
soup = BeautifulSoup(page, 'html5lib')
rows = soup.select('.NS_backers__backing_row')
back... | {
"repo_name": "mihajenko/mihajenko.github.io",
"path": "old/sekai-project-kickstarter-analysis/scrapper.py",
"copies": "1",
"size": "1472",
"license": "mit",
"hash": 6435782335491934000,
"line_mean": 24.3793103448,
"line_max": 65,
"alpha_frac": 0.5951086957,
"autogenerated": false,
"ratio": 3.538... |
__author__ = 'mikael.brandin@devolver.se'
# coding=utf-8
import os
import subprocess
import io
import sys
from urllib.parse import urlparse
from client import exceptions
from client import protocol
class ClientException(exceptions.ArmoryException):
def __init__(self, msg):
super(ClientException, self)._... | {
"repo_name": "mikaelbrandin/armory",
"path": "client/base_client.py",
"copies": "1",
"size": "4078",
"license": "apache-2.0",
"hash": 161879287981931800,
"line_mean": 26.5608108108,
"line_max": 123,
"alpha_frac": 0.5669445807,
"autogenerated": false,
"ratio": 3.928709055876686,
"config_test": ... |
# Stdlib imports
import math
import datetime
def red(txt):
return '\033[1;31m%s\033[0m' % txt
def green(txt):
return '\033[1;32m%s\033[0m' % txt
def yellow(txt):
return '\033[1;33m%s\033[0m' % txt
def blue(txt):
return '\033[1;34m%s\033[0m' % txt
def purple(txt):
return '\033[1;35m%s\033[0m' %... | {
"repo_name": "fuzzy/mvm",
"path": "mvm/term.py",
"copies": "1",
"size": "2114",
"license": "bsd-2-clause",
"hash": -3800385947498027000,
"line_mean": 25.425,
"line_max": 92,
"alpha_frac": 0.5468306528,
"autogenerated": false,
"ratio": 2.915862068965517,
"config_test": false,
"has_no_keywords... |
# Stdlib imports
import os
import json
# Internal imports
from mvm.term import *
from mvm.package import *
class MvmCmdList(object):
def ListPackages(self, installed=True, output=True):
# TODO: list available packages
self.instPkgs = []
if installed:
if output:
... | {
"repo_name": "fuzzy/mvm",
"path": "mvm/commands/pkglist.py",
"copies": "1",
"size": "3236",
"license": "bsd-2-clause",
"hash": -6240359738588144000,
"line_mean": 38.950617284,
"line_max": 79,
"alpha_frac": 0.3723733004,
"autogenerated": false,
"ratio": 4.4944444444444445,
"config_test": false,... |
# Stdlib imports
import os
import re
import sys
import json
import shutil
# Internal imports
from mvm.term import *
class Package(object):
def __init__(self, cfg, path):
# External use stuff
self.Path = path
self.SessionID = os.getenv('MVM_SESSION_ID')
data = path.s... | {
"repo_name": "fuzzy/mvm",
"path": "mvm/package.py",
"copies": "1",
"size": "6193",
"license": "bsd-2-clause",
"hash": 6575715282199762000,
"line_mean": 36.0838323353,
"line_max": 88,
"alpha_frac": 0.4886161796,
"autogenerated": false,
"ratio": 3.7924066135946113,
"config_test": false,
"has_n... |
# Stdlib imports
import os
import re
import sys
import json
import time
import subprocess
import multiprocessing
try:
from urllib2 import urlopen
str_types = (str, unicode)
except ImportError:
from urllib.request import urlopen
str_types = (str,)
# Internal imports
from mvm.term import *
class Packa... | {
"repo_name": "fuzzy/mvm",
"path": "mvm/pkgspec.py",
"copies": "1",
"size": "8524",
"license": "bsd-2-clause",
"hash": 1545058608240609500,
"line_mean": 43.1658031088,
"line_max": 93,
"alpha_frac": 0.4151806664,
"autogenerated": false,
"ratio": 4.333502796136248,
"config_test": true,
"has_no_... |
# Stdlib imports
import os
import re
import sys
import json
# Internal imports
from mvm.term import *
class Edict(dict):
def __init__(self, data={}):
for key in data:
if isinstance(data[key], dict):
self.__setitem__(key, Edict(data[key]))
else:
self... | {
"repo_name": "fuzzy/mvm",
"path": "mvm/config.py",
"copies": "1",
"size": "1680",
"license": "bsd-2-clause",
"hash": 3257144575451708400,
"line_mean": 31.3076923077,
"line_max": 83,
"alpha_frac": 0.5238095238,
"autogenerated": false,
"ratio": 3.7333333333333334,
"config_test": false,
"has_no... |
# Stdlib imports
import os
import sys
# Internal imports
from mvm.term import *
from mvm.package import *
class MvmCmdRemove(object):
def RemovePackage(self, arg=None, session=True):
if session:
cdir = self.config.dirs.sessionroot+'/'+self.SessionID
else:
cdir = self.c... | {
"repo_name": "fuzzy/mvm",
"path": "mvm/commands/remove.py",
"copies": "1",
"size": "1324",
"license": "bsd-2-clause",
"hash": 5065686342043031000,
"line_mean": 30.5238095238,
"line_max": 74,
"alpha_frac": 0.5158610272,
"autogenerated": false,
"ratio": 3.8488372093023258,
"config_test": false,
... |
__author__ = 'Mike Gleicher'
"""
Utilities for dealing with Serendipity Topic Models
"""
# warning! you need to set these correctly from outside
# these are the defaults for me!
defaultMetadataDir = "C:/Users/Eric/Documents/Madison/VEP_Core/vep_core/Data/Metadata"
defaultModel = "ShakespeareChunkedOptimized_50"
# ex... | {
"repo_name": "uwgraphics/SerendipSlim",
"path": "MikeTM.py",
"copies": "1",
"size": "6798",
"license": "bsd-2-clause",
"hash": -3444815831754275300,
"line_mean": 34.40625,
"line_max": 104,
"alpha_frac": 0.5709032068,
"autogenerated": false,
"ratio": 3.591125198098257,
"config_test": false,
"... |
__author__ = 'mikemax'
import math
"""
By replacing the 1st digit of the 2-digit number *3, it turns out that six of the
nine possible values: 13, 23, 43, 53, 73, and 83, are all prime.
By replacing the 3rd and 4th digits of 56**3 with the same digit, this 5-digit
number is the first example having seven primes among... | {
"repo_name": "mmax5/project-euler",
"path": "Problem 51.py",
"copies": "1",
"size": "1712",
"license": "apache-2.0",
"hash": 1325348882708187600,
"line_mean": 28.0169491525,
"line_max": 82,
"alpha_frac": 0.6255841121,
"autogenerated": false,
"ratio": 3.3114119922630563,
"config_test": false,
... |
__author__ = 'mikemax'
"""
High Card: Highest value card.
One Pair: Two cards of the same value.
Two Pairs: Two different pairs.
Three of a Kind: Three cards of the same value.
Straight: All cards are consecutive values.
Flush: All cards of the same suit.
Full House: Three of a kind and a pair.
Four of a Kind: Four car... | {
"repo_name": "mmax5/project-euler",
"path": "Problem 54.py",
"copies": "1",
"size": "5002",
"license": "apache-2.0",
"hash": -6332966911933466000,
"line_mean": 24.2676767677,
"line_max": 73,
"alpha_frac": 0.487604958,
"autogenerated": false,
"ratio": 3.5151089248067464,
"config_test": false,
... |
__author__ = 'mikemax'
"""
The prime 41, can be written as the sum of six consecutive primes:
41 = 2 + 3 + 5 + 7 + 11 + 13
This is the longest sum of consecutive primes that adds to a prime below
one-hundred.
The longest sum of consecutive primes below one-thousand that adds to a prime,
contains 21 terms, and is equa... | {
"repo_name": "mmax5/project-euler",
"path": "Problem 50.py",
"copies": "1",
"size": "1110",
"license": "apache-2.0",
"hash": -4001871542608488000,
"line_mean": 19.5740740741,
"line_max": 78,
"alpha_frac": 0.5963963964,
"autogenerated": false,
"ratio": 3.3433734939759034,
"config_test": false,
... |
__author__ = 'Mike'
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ispp8.settings")
from django.conf import settings
import urllib3
import json
from plan.models import Activity
from datetime import datetime, timedelta
from pytz import timezone
import pytz
def get_references(keywords, latitud, longitud, ra... | {
"repo_name": "NOWASTI/web-deprecated",
"path": "ispp8/ActivitiesSearch.py",
"copies": "1",
"size": "3685",
"license": "apache-2.0",
"hash": -4859781053541815000,
"line_mean": 39.9555555556,
"line_max": 157,
"alpha_frac": 0.6130257802,
"autogenerated": false,
"ratio": 3.3439201451905625,
"confi... |
__author__ = 'mike'
import cPickle as pickle
from time import time
import numpy as np
import theano
from Clockwork import ClockworkRNN
from utils import adam, quadratic_loss, variance, float32, int32, relu, sgd, cross_entropy
floatX = theano.config.floatX
def hot_to_sparse(data, size=88):
result = []
length... | {
"repo_name": "makistsantekidis/clockworkrnn",
"path": "piano_prediction.py",
"copies": "1",
"size": "2563",
"license": "mit",
"hash": 2806991685129923600,
"line_mean": 34.1232876712,
"line_max": 143,
"alpha_frac": 0.5989075302,
"autogenerated": false,
"ratio": 3.324254215304799,
"config_test":... |
__author__ = 'mike'
import socket
import time
import threading
import Queue
class http_main():
def __init__(self, Q, TARGET_IP, TARGET_PORT, RATE, GET, PROCESSES, CONNECTIONS):
#threading.Thread.__init__(self) # Required for thread class
self.target = TARGET_IP
self.port = TARGET_PORT
... | {
"repo_name": "mikeberkelaar/controlleddos",
"path": "Attack_Agent/attacks/httpflood.py",
"copies": "1",
"size": "4051",
"license": "apache-2.0",
"hash": -2676545634913732600,
"line_mean": 31.408,
"line_max": 105,
"alpha_frac": 0.5223401629,
"autogenerated": false,
"ratio": 3.800187617260788,
"... |
__author__ = 'mike'
import sys
import itertools
from blocks.bricks import Sigmoid
from blocks.initialization import Constant
import theano
import numpy as np
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from blocks.initialization import IsotropicGaussian
from utils import Mismulitclassificat... | {
"repo_name": "makistsantekidis/rnnrbm",
"path": "training.py",
"copies": "1",
"size": "4051",
"license": "mit",
"hash": -5889335588583578000,
"line_mean": 32.4876033058,
"line_max": 100,
"alpha_frac": 0.6502098247,
"autogenerated": false,
"ratio": 3.0947288006111537,
"config_test": false,
"h... |
__author__ = 'mike'
import sys
from blocks.bricks.base import application
from blocks.bricks.recurrent import BaseRecurrent, recurrent
from blocks.bricks import Linear, Sigmoid, lazy, Initializable
from blocks.initialization import IsotropicGaussian, Constant
import theano
import theano.tensor as T
import numpy as np... | {
"repo_name": "makistsantekidis/rnnrbm",
"path": "models/rnnrbm.py",
"copies": "1",
"size": "8797",
"license": "mit",
"hash": -443776804928569340,
"line_mean": 43.8826530612,
"line_max": 117,
"alpha_frac": 0.5842900989,
"autogenerated": false,
"ratio": 3.2569418733802293,
"config_test": false,
... |
__author__ = 'mike'
import sys
from blocks.bricks.recurrent import BaseRecurrent, LSTM, recurrent, Initializable, SimpleRecurrent
from blocks.bricks import Linear, MLP, Tanh, Sigmoid
from blocks.initialization import IsotropicGaussian, Constant
import theano
import numpy as np
sys.setrecursionlimit(10000)
from the... | {
"repo_name": "makistsantekidis/rnnrbm",
"path": "models/rnn.py",
"copies": "1",
"size": "5576",
"license": "mit",
"hash": -8454730818489821000,
"line_mean": 46.6666666667,
"line_max": 98,
"alpha_frac": 0.5078909613,
"autogenerated": false,
"ratio": 4.084981684981685,
"config_test": false,
"h... |
__author__ = 'mike'
import sys
from blocks.bricks.recurrent import BaseRecurrent, recurrent
from blocks.bricks import Sigmoid, lazy, Initializable
from blocks.utils import shared_floatx_nans
from blocks.roles import add_role, WEIGHT, BIAS, has_roles
import theano
import theano.tensor as T
import numpy as np
from bloc... | {
"repo_name": "makistsantekidis/rnnrbm",
"path": "models/rbm.py",
"copies": "1",
"size": "3741",
"license": "mit",
"hash": -8807467815532178000,
"line_mean": 34.9711538462,
"line_max": 101,
"alpha_frac": 0.5883453622,
"autogenerated": false,
"ratio": 3.3521505376344085,
"config_test": false,
... |
__author__ = 'mike'
import theano
from theano.ifelse import ifelse
from theano import tensor as T
from blocks.bricks.cost import Cost
from blocks.bricks.base import application, Brick
from blocks.bricks import Activation
from blocks.roles import add_role, WEIGHT, BIAS
floatX = theano.config.floatX
threshold = 0.5
... | {
"repo_name": "makistsantekidis/rnnrbm",
"path": "utils.py",
"copies": "1",
"size": "2516",
"license": "mit",
"hash": 960372071481804300,
"line_mean": 30.0617283951,
"line_max": 100,
"alpha_frac": 0.6013513514,
"autogenerated": false,
"ratio": 3.0720390720390722,
"config_test": false,
"has_no... |
__author__ = 'mike'
import theano
from theano.ifelse import ifelse
from theano import tensor as T
import numpy as np
def float32(k):
return np.cast['float32'](k)
def int32(k):
return np.cast['int32'](k)
def relu(x):
return T.maximum(0, x)
def variance(input_size):
return 2.0 / input_size
def ... | {
"repo_name": "makistsantekidis/clockworkrnn",
"path": "utils.py",
"copies": "1",
"size": "5947",
"license": "mit",
"hash": 812662089919269800,
"line_mean": 36.6392405063,
"line_max": 119,
"alpha_frac": 0.6135866824,
"autogenerated": false,
"ratio": 3.313091922005571,
"config_test": false,
"h... |
__author__ = 'mike'
## WIP not to be used
import sys
from blocks.bricks.recurrent import BaseRecurrent, LSTM, recurrent
from blocks.bricks import Linear, Tanh, Initializable
from blocks.initialization import IsotropicGaussian, Constant
import theano
import numpy as np
from theano.sandbox.rng_mrg import MRG_RandomStr... | {
"repo_name": "makistsantekidis/rnnrbm",
"path": "prototyping.py",
"copies": "1",
"size": "2211",
"license": "mit",
"hash": -1424146931839089200,
"line_mean": 37.1206896552,
"line_max": 112,
"alpha_frac": 0.5766621438,
"autogenerated": false,
"ratio": 3.8789473684210525,
"config_test": false,
... |
import gpi
import numpy as np
from gpi import QtCore, QtGui
class ExternalNode(gpi.NodeAPI):
""" Array compression for virtual channels
Reduce the number of channels to a user defined number based on the publication by Buehrer Martin et al, MRM 2007
"""
def initUI(self):
# Widgets
... | {
"repo_name": "jhu-cardiac-mri/jhu-gpi-nodes",
"path": "math/GPI/VirtualChannels_GPI.py",
"copies": "1",
"size": "20071",
"license": "mit",
"hash": -8208907783586139000,
"line_mean": 46.7880952381,
"line_max": 143,
"alpha_frac": 0.5432713866,
"autogenerated": false,
"ratio": 3.641988749773181,
... |
__author__ = 'Mike Solomon'
__author_email__ = '<mas63 @t cornell d0t edu>'
__version__ = '0.7.15'
__license__ = 'BSD License'
import imp
from compiler.util import Compiler, add_common_options
class Template(object):
def __init__(self, txt):
self.txt = txt
self.tmp = None
def __call__(self, n... | {
"repo_name": "infin8/spitfire",
"path": "spitfire/__init__.py",
"copies": "1",
"size": "1320",
"license": "bsd-3-clause",
"hash": -3250256951791854000,
"line_mean": 39,
"line_max": 479,
"alpha_frac": 0.6325757576,
"autogenerated": false,
"ratio": 3.52,
"config_test": false,
"has_no_keywords"... |
__author__ = "Mike Stabile, Jeremy Nelson"
import time
import datetime
import inspect
import logging
import gc
import os
import pdb
import time
import threading
import copy
import json
from elasticsearch_dsl import Search
# logging.basicConfig(level=logging.DEBUG)
# lg_r = logging.getLogger("requests")
# lg_r.setLeve... | {
"repo_name": "KnowledgeLinks/rdfframework",
"path": "rdfframework/search/esloaders.py",
"copies": "1",
"size": "18616",
"license": "mit",
"hash": 278846497469684930,
"line_mean": 37.0695296524,
"line_max": 85,
"alpha_frac": 0.467877095,
"autogenerated": false,
"ratio": 4.170250896057348,
"conf... |
__author__ = "Mike Stabile, Jeremy Nelson"
import datetime
import inspect
import logging
# import os
# import rdflib
# import requests
# import sys
# import uuid
import pdb
# import urllib
import time
# import queue
import threading
# import json
# import socket
try:
MNAME = inspect.stack()[0][1]
except:
MNAM... | {
"repo_name": "KnowledgeLinks/rdfframework",
"path": "rdfframework/search/esloaders_temp.py",
"copies": "1",
"size": "5164",
"license": "mit",
"hash": -4015617162943576000,
"line_mean": 35.1118881119,
"line_max": 79,
"alpha_frac": 0.5453137103,
"autogenerated": false,
"ratio": 3.752906976744186,
... |
__author__ = "Mike Stabile"
from . import PREFIX
from sparql.general import *
ADD_ISO6391_TO_RDF_TYPE_AND_DELETE_EXTRA_FIELDS = """#ADD_ISO6391_TO_RDF_TYPE_AND_DELETE_EXTRA_FIELDS
""" + PREFIX + """
DELETE
{
?langid <http://www.loc.gov/mads/rdf/v1#isMemberOfMADSCollection> <http://id.loc.gov/vocabulary/iso639-1/col... | {
"repo_name": "KnowledgeLinks/graph-utilities",
"path": "sparql/languages.py",
"copies": "1",
"size": "28899",
"license": "apache-2.0",
"hash": -8241577176379683000,
"line_mean": 24.9883093525,
"line_max": 149,
"alpha_frac": 0.6683968303,
"autogenerated": false,
"ratio": 2.4666268350973026,
"co... |
__author__ = "Mike Stabile"
from . import PREFIX
from sparql.general import *
SUBJECTS_CONVERT_RDF_TYPE = """#SUBJECTS_CONVERT_RDF_TYPE
""" + PREFIX + """
DELETE
{
?subJId <http://www.loc.gov/mads/rdf/v1#isMemberOfMADSCollection> ?rdfType
}
INSERT
{
?subjId a ?rdfType
}
WHERE
{
?subjId <http://www.loc.go... | {
"repo_name": "KnowledgeLinks/graph-utilities",
"path": "sparql/subjects.py",
"copies": "1",
"size": "5240",
"license": "apache-2.0",
"hash": 5294281426351110000,
"line_mean": 21.7826086957,
"line_max": 127,
"alpha_frac": 0.6715648855,
"autogenerated": false,
"ratio": 2.3309608540925266,
"confi... |
__author__ = 'Mikhail.Golubev'
__all__ = ['S1', 'S2']
__version__ = '0.1'
from typing_extensions import TypeAlias
S1_ok = "foo"
S2_ok = "foo.bar"
S3_ok = "foo.bar[baz]"
too_long_string = "foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo"
natural_t... | {
"repo_name": "smmribeiro/intellij-community",
"path": "python/testData/stubs/TypeAliasStubs.py",
"copies": "10",
"size": "1215",
"license": "apache-2.0",
"hash": 3903560984747751000,
"line_mean": 23.7959183673,
"line_max": 139,
"alpha_frac": 0.6823045267,
"autogenerated": false,
"ratio": 2.67032... |
__author__ = 'Mikhail.Golubev'
__all__ = ['S1', 'S2']
__version__ = '0.1'
S1_ok = "foo"
S2_ok = "foo.bar"
S3_ok = "foo.bar[baz]"
too_long_string = "foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo"
natural_text = "Foo is baz."
glued_string = 'foo' ... | {
"repo_name": "goodwinnk/intellij-community",
"path": "python/testData/stubs/TypeAliasStubs.py",
"copies": "16",
"size": "1073",
"license": "apache-2.0",
"hash": 3499210580236883000,
"line_mean": 23.3863636364,
"line_max": 139,
"alpha_frac": 0.6747437092,
"autogenerated": false,
"ratio": 2.617073... |
__author__ = 'Mikhail'
def add_line(line_one, line_two):
"""
>>> line_one = [1, 2, 3]
>>> line_two = [1, 2, 3]
>>> add_line(line_one, line_two)
>>> line_one
[2, 4, 6]
>>> line_two
[1, 2, 3]
>>> add_line(line_two, line_one)
>>> line_one
[2, 4, 6]
>>> line_two
[3, 6, ... | {
"repo_name": "MikeLaptev/sandbox_python",
"path": "stepic/discrete_math/gauss_method.py",
"copies": "1",
"size": "7371",
"license": "apache-2.0",
"hash": -2969214517822798300,
"line_mean": 39.0597826087,
"line_max": 119,
"alpha_frac": 0.555962556,
"autogenerated": false,
"ratio": 2.8826750097770... |
__author__ = 'Mikhail Vilgelm'
# import pprint
def load(filename):
simulation = {}
f = open('in/'+filename)
lines = f.readlines()
f.close()
i = 0
while True:
if i==0:
line_data = lines[i].split(' ')
simulation['rows'] = int(line_data[0])
simulatio... | {
"repo_name": "csieber/ghashcode2016",
"path": "load.py",
"copies": "1",
"size": "2347",
"license": "mit",
"hash": -914207324452173200,
"line_mean": 26.6117647059,
"line_max": 105,
"alpha_frac": 0.4793353217,
"autogenerated": false,
"ratio": 3.834967320261438,
"config_test": false,
"has_no_ke... |
__author__ = "Miklos Vajna <vmiklos@frugalware.org>"
__version__ = "0.1"
__date__ = "Sun, 10 Sep 2006 00:25:02 +0200"
__copyright__ = "Copyright (c) 2006 Miklos Vajna"
__license__ = "GPL"
from sgmllib import SGMLParser
import urllib, string, sys, os
class BaseHTMLProcessor(SGMLParser):
def reset(self):
self.pieces... | {
"repo_name": "vmiklos/vmexam",
"path": "python/imdb2fortune.py",
"copies": "1",
"size": "1715",
"license": "mit",
"hash": 8038065599296762000,
"line_mean": 24.2205882353,
"line_max": 70,
"alpha_frac": 0.5941690962,
"autogenerated": false,
"ratio": 2.614329268292683,
"config_test": false,
"ha... |
__author__ = 'miko'
from de.hochschuletrier.jpy.candidates.Candidate import Candidate, SerializableCandidate
from de.hochschuletrier.jpy.jason.JSONBackupHandler import JSONBackupHandler
from de.hochschuletrier.jpy.Constants import Constants
class CandidateManager:
def __init__(self, master):
self.candidates = []
... | {
"repo_name": "FSI-HochschuleTrier/hacker-jeopardy",
"path": "de/hochschuletrier/jpy/candidates/CandidateManager.py",
"copies": "1",
"size": "1101",
"license": "mit",
"hash": -8625223144158497000,
"line_mean": 32.3636363636,
"line_max": 99,
"alpha_frac": 0.7683923706,
"autogenerated": false,
"rat... |
__author__ = 'miko'
from de.hochschuletrier.jpy.jason.JSONBackupHandler import JSONBackupHandler
from de.hochschuletrier.jpy.console.JPYLogger import JPYLogger
class BackupManager:
def __init__(self, root):
self.root = root
self.usebackup = False
self.dobackup = True
self.logger = JPYLogger(self)
self.file... | {
"repo_name": "FSI-HochschuleTrier/hacker-jeopardy",
"path": "de/hochschuletrier/jpy/backup/BackupManager.py",
"copies": "1",
"size": "1060",
"license": "mit",
"hash": -8873565265173980000,
"line_mean": 34.3333333333,
"line_max": 83,
"alpha_frac": 0.7886792453,
"autogenerated": false,
"ratio": 3.... |
__author__ = 'miko'
from de.hochschuletrier.jpy.jason.JSONHandler import JSONHandler
from de.hochschuletrier.jpy.jason.JSONBackupHandler import JSONBackupHandler
class QuestionManager:
def __init__(self, master, questiondir):
self.master = master
self.questiondir = questiondir
self.questions = {}
self.answer... | {
"repo_name": "FSI-HochschuleTrier/hacker-jeopardy",
"path": "de/hochschuletrier/jpy/questions/QuestionManager.py",
"copies": "1",
"size": "1287",
"license": "mit",
"hash": 3154921887649222000,
"line_mean": 26.9782608696,
"line_max": 79,
"alpha_frac": 0.7327117327,
"autogenerated": false,
"ratio"... |
__author__ = 'miko'
from de.hochschuletrier.jpy.overlays.DoubleOverlay import DoubleOverlay
from de.hochschuletrier.jpy.overlays.QuestionOverlay import QuestionOverlay
from de.hochschuletrier.jpy.overlays.UsernameOverlay import UsernameOverlay
class OverlayManager:
def __init__(self, root):
self.root = root
self... | {
"repo_name": "FSI-HochschuleTrier/hacker-jeopardy",
"path": "de/hochschuletrier/jpy/overlays/OverlayManager.py",
"copies": "1",
"size": "1153",
"license": "mit",
"hash": -6006722564790061000,
"line_mean": 35.03125,
"line_max": 85,
"alpha_frac": 0.7580225499,
"autogenerated": false,
"ratio": 3.09... |
__author__ = 'miko'
from de.hochschuletrier.jpy.ui.JPYLabel import JPYLabel
from de.hochschuletrier.jpy.ui.JPYUserLabel import JPYUserLabel
from de.hochschuletrier.jpy.ui.JPYButton import JPYButton
from math import ceil
from de.hochschuletrier.jpy.jason.JSONHandler import JSONHandler
class TableProcessor:
cols = 6
... | {
"repo_name": "FSI-HochschuleTrier/hacker-jeopardy",
"path": "de/hochschuletrier/jpy/ui/TableProcessor.py",
"copies": "1",
"size": "1988",
"license": "mit",
"hash": 2359967158925538300,
"line_mean": 32.1333333333,
"line_max": 107,
"alpha_frac": 0.6976861167,
"autogenerated": false,
"ratio": 2.971... |
__author__ = 'miko'
from tkFont import Font
class Constants:
SCREENW = 0
SCREENH = 0
COLORS = ["red", "green", "purple", "brown", "black", "yellow"]
class Fonts:
MONEY_BIG = 0
MONEY_SMALL = 0
MONEY_MEDIUM = 0
SYSTEM_REGULAR = 0
SYSTEM_BIG = 0
USER_LABEL_NAME = 0
USER_LABEL_NAME_BIG = 0
@staticmethod
de... | {
"repo_name": "FSI-HochschuleTrier/hacker-jeopardy",
"path": "de/hochschuletrier/jpy/Constants.py",
"copies": "1",
"size": "1105",
"license": "mit",
"hash": 7996127695536058000,
"line_mean": 32.4848484848,
"line_max": 95,
"alpha_frac": 0.6968325792,
"autogenerated": false,
"ratio": 2.695121951219... |
__author__ = 'miko'
import sys
from de.hochschuletrier.jpy.console.JPYLogger import JPYLogger
from de.hochschuletrier.jpy.input.InputController import InputController
class PseudoInputController(InputController):
def __init__(self, root):
self.root = root
self.logger = JPYLogger(self)
self.logger.log("PseudoIn... | {
"repo_name": "FSI-HochschuleTrier/hacker-jeopardy",
"path": "de/hochschuletrier/jpy/input/PseudoInputController.py",
"copies": "1",
"size": "1255",
"license": "mit",
"hash": -5252706071776535000,
"line_mean": 45.4814814815,
"line_max": 107,
"alpha_frac": 0.7442231076,
"autogenerated": false,
"ra... |
__author__ = 'miko'
import sys
from Tkinter import Tk
from de.hochschuletrier.jpy.console.JPYLogger import JPYLogger
class InputController:
blockBuzzer = False
introPlaying = False
def __init__(self, root):
self.root = root
self.logger = JPYLogger(self)
self.logger.log("Input controller initialisiert")
m... | {
"repo_name": "FSI-HochschuleTrier/hacker-jeopardy",
"path": "de/hochschuletrier/jpy/input/InputController.py",
"copies": "1",
"size": "5799",
"license": "mit",
"hash": -2819250354927192600,
"line_mean": 42.9318181818,
"line_max": 129,
"alpha_frac": 0.7785825142,
"autogenerated": false,
"ratio": ... |
__author__ = 'miko'
from Tkinter import *
from tkFont import Font
from de.hochschuletrier.jpy.Constants import Constants, Fonts
from de.hochschuletrier.jpy.input.InputController import InputController
from de.hochschuletrier.jpy.console.JPYLogger import JPYLogger
import time
class JPYButton(Frame):
def __init__(sel... | {
"repo_name": "FSI-HochschuleTrier/hacker-jeopardy",
"path": "de/hochschuletrier/jpy/ui/JPYButton.py",
"copies": "1",
"size": "3813",
"license": "mit",
"hash": -5048094823558470000,
"line_mean": 36.3823529412,
"line_max": 108,
"alpha_frac": 0.7395751377,
"autogenerated": false,
"ratio": 3.0974817... |
__author__ = 'MikO'
import sys
from de.hochschuletrier.jpy.states.GameStateManager import GameStateManager
from de.hochschuletrier.jpy.candidates.CandidateManager import CandidateManager
from de.hochschuletrier.jpy.questions.QuestionManager import QuestionManager
from de.hochschuletrier.jpy.ui.MainWindow import MainWi... | {
"repo_name": "FSI-HochschuleTrier/hacker-jeopardy",
"path": "jeopardy.py",
"copies": "1",
"size": "1440",
"license": "mit",
"hash": -5957930857798495000,
"line_mean": 34.1219512195,
"line_max": 84,
"alpha_frac": 0.7868055556,
"autogenerated": false,
"ratio": 3.130434782608696,
"config_test": f... |
import logging
from ipaqe_provision_hosts.errors import IPAQEProvisionerError
from ipaqe_provision_hosts.utils import load_yaml, get_os_version
log = logging.getLogger(__name__)
class UnknownHostDomainError(IPAQEProvisionerError):
pass
class StaticInventory(object):
"""Staticly configured topology resou... | {
"repo_name": "apophys/ipaqe-provision-hosts",
"path": "ipaqe_provision_hosts/static_inventory.py",
"copies": "1",
"size": "3555",
"license": "mit",
"hash": -3418365651058661400,
"line_mean": 31.027027027,
"line_max": 77,
"alpha_frac": 0.5893108298,
"autogenerated": false,
"ratio": 4.007891770011... |
import logging
from ipaqe_provision_hosts import errors
from ipaqe_provision_hosts.backend.base import IDMBackendBase
from ipaqe_provision_hosts.static_inventory import (
StaticInventory, UnknownHostDomainError)
log = logging.getLogger(__name__)
class TopologyInventoryError(errors.IPAQEProvisionerError):
... | {
"repo_name": "apophys/ipaqe-provision-hosts",
"path": "ipaqe_provision_hosts/topology_manager.py",
"copies": "1",
"size": "5461",
"license": "mit",
"hash": 6451074718203111000,
"line_mean": 38.0071428571,
"line_max": 80,
"alpha_frac": 0.6052005127,
"autogenerated": false,
"ratio": 4.573701842546... |
__author__ = 'Milinda Pathirage'
import os
import io
import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
import tempfile
from . import utils
class DataAPIClient:
def __init__(self, endpoint=None, client_id=None, client_secret=None, token_endpoint=None):
if... | {
"repo_name": "milinda/htrc-sdk-for-python",
"path": "htrc/dataapi.py",
"copies": "1",
"size": "1932",
"license": "apache-2.0",
"hash": 22072741748524652,
"line_mean": 30.6721311475,
"line_max": 116,
"alpha_frac": 0.6314699793,
"autogenerated": false,
"ratio": 3.736943907156673,
"config_test": ... |
__author__ = 'Milinda Pathirage'
import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
import json
import zipfile
import os
def get_oauth2_token(token_endpoint, client_id, client_secret):
headers = {'content-type': 'application/x-www-form-urlencoded'}
# request ... | {
"repo_name": "milinda/htrc-sdk-for-python",
"path": "htrc/utils.py",
"copies": "1",
"size": "2236",
"license": "apache-2.0",
"hash": -4501055113929197000,
"line_mean": 35.0806451613,
"line_max": 116,
"alpha_frac": 0.6310375671,
"autogenerated": false,
"ratio": 3.929701230228471,
"config_test":... |
__author__ = 'Milinda Perera'
from charm.toolbox.ecgroup import G, ZR, ECGroup
from charm.toolbox.eccurve import prime192v2
class ElGamalExp(object):
"""
Implements the ElGamal cryptosystem where messages are encoded in the exponent.
"""
def keygen(self):
group = ECGroup(prime192v2)
... | {
"repo_name": "mcoder/private-set-intersection",
"path": "modules/pkenc_elgamal_exp.py",
"copies": "1",
"size": "1827",
"license": "mit",
"hash": -1187478042676999700,
"line_mean": 28.4677419355,
"line_max": 114,
"alpha_frac": 0.5221674877,
"autogenerated": false,
"ratio": 2.951534733441034,
"c... |
__author__ = 'Milinda Perera'
from charm.toolbox.integergroup import random, integer
from pkenc_elgamal_exp import ElGamalExp
from utils_poly import poly_eval_horner, poly_from_roots
class PSI2RoundElGamal(object):
"""
Implements the 2-round PSI protocol based on ElGamal cryptosystem
"""
def client... | {
"repo_name": "mcoder/private-set-intersection",
"path": "modules/psi_2_round_elgamal.py",
"copies": "1",
"size": "1560",
"license": "mit",
"hash": 5867299390777174000,
"line_mean": 35.2790697674,
"line_max": 101,
"alpha_frac": 0.6224358974,
"autogenerated": false,
"ratio": 3.2842105263157895,
... |
__author__ = 'Milinda Perera'
from charm.toolbox.integergroup import random, integer
from pkenc_paillier import Paillier
from utils_poly import poly_eval_horner, poly_from_roots
class PSI2RoundPaillier(object):
"""
Implements the 2-round PSI protocol based on Paillier cryptosystem
"""
def __init__(... | {
"repo_name": "mcoder/private-set-intersection",
"path": "modules/psi_2_round_paillier.py",
"copies": "1",
"size": "1581",
"license": "mit",
"hash": -4302959811993666000,
"line_mean": 34.9318181818,
"line_max": 93,
"alpha_frac": 0.6382036686,
"autogenerated": false,
"ratio": 3.3854389721627407,
... |
__author__ = 'Milinda Perera'
from charm.toolbox.integergroup import random, integer
from pkenc_paillier import Paillier
from utils_poly import poly_eval_horner, poly_from_roots
class PSI3RoundPaillier(object):
"""
Implements the 3-round PSI protocol based on Paillier cryptosystem
"""
def __init__(... | {
"repo_name": "mcoder/private-set-intersection",
"path": "modules/psi_3_round_paillier.py",
"copies": "1",
"size": "1654",
"license": "mit",
"hash": -7684967515457486000,
"line_mean": 34.1914893617,
"line_max": 93,
"alpha_frac": 0.638452237,
"autogenerated": false,
"ratio": 3.4173553719008263,
... |
__author__ = 'Milinda Perera'
from charm.toolbox.integergroup import random, randomPrime, isPrime, gcd, lcm, integer
class Paillier(object):
"""
Implements the Paillier cryptosystem.
"""
def L(self, u, n):
return integer(int(u) - 1) / n
def keygen(self, secparam=1024):
while Tru... | {
"repo_name": "mcoder/private-set-intersection",
"path": "modules/pkenc_paillier.py",
"copies": "1",
"size": "2003",
"license": "mit",
"hash": 1381666949187543300,
"line_mean": 24.6923076923,
"line_max": 86,
"alpha_frac": 0.4648027958,
"autogenerated": false,
"ratio": 2.7742382271468142,
"confi... |
__author__ = 'Milinda Perera'
import random as pyrandom
from time import time
from modules.psi_3_round_paillier import PSI3RoundPaillier
from modules.psi_2_round_paillier import PSI2RoundPaillier
from modules.psi_2_round_elgamal import PSI2RoundElGamal
def timer(func, *pargs, **kargs):
"""
Measures the time... | {
"repo_name": "mcoder/private-set-intersection",
"path": "simulate_psi.py",
"copies": "1",
"size": "3466",
"license": "mit",
"hash": -263777740500042850,
"line_mean": 38.8505747126,
"line_max": 167,
"alpha_frac": 0.6759953837,
"autogenerated": false,
"ratio": 3.263653483992467,
"config_test": f... |
__author__ = 'Milinda Perera'
def poly_from_roots(roots, neg_one, one):
"""
Interpolates the unique polynomial that encodes the given roots.
The function also requires the one and the negative one of the underlying ring.
"""
zero = one + neg_one
coefs = [neg_one * roots[0], one]
for r in r... | {
"repo_name": "mcoder/private-set-intersection",
"path": "modules/utils_poly.py",
"copies": "1",
"size": "2284",
"license": "mit",
"hash": -5099866051144992000,
"line_mean": 29.4533333333,
"line_max": 100,
"alpha_frac": 0.612084063,
"autogenerated": false,
"ratio": 3.552099533437014,
"config_te... |
__author__ = 'Milo'
from flask.ext.mongoengine import MongoEngine
from mongoengine import *
class Cards(Document):
"""The card class."""
name = StringField()
multiverseid = IntField()
text = StringField()
type = StringField()
supertypes = ListField(StringField())
types = ListField(StringField())
su... | {
"repo_name": "milogert/mtgsearch",
"path": "db.py",
"copies": "1",
"size": "1539",
"license": "mit",
"hash": -2113900743875640600,
"line_mean": 19.52,
"line_max": 45,
"alpha_frac": 0.6822612086,
"autogenerated": false,
"ratio": 4.060686015831134,
"config_test": false,
"has_no_keywords": fals... |
import os
import sys
import json
import boto3
import requests
from uuid import uuid4
from io import BytesIO
from PIL import Image, ImageOps
s3_client = boto3.client('s3')
def s3_put(fp, key):
"""
Put object to s3 bucket (output: dict)
"""
bucket = os.environ['BUCKET'] if os.environ.get('BUCKET') else ''
... | {
"repo_name": "psyhomb/serverless",
"path": "aws-lambda/imgmod/handler.py",
"copies": "1",
"size": "4568",
"license": "mit",
"hash": -1184692117227418400,
"line_mean": 21.84,
"line_max": 71,
"alpha_frac": 0.5757443082,
"autogenerated": false,
"ratio": 3.3988095238095237,
"config_test": false,
... |
import os
import sys
import json
import requests
from io import BytesIO
from PIL import Image, ImageOps
def json2dict(data):
"""
Convert json to dict (output: dict)
"""
try:
return json.loads(data)
except ValueError as e:
print('error: Bad JSON format: {}'.format(e), file=sys.stderr)
sys.exit()... | {
"repo_name": "psyhomb/serverless",
"path": "openfaas/imgmod/function/handler.py",
"copies": "1",
"size": "3370",
"license": "mit",
"hash": 7690290966682220000,
"line_mean": 23.0714285714,
"line_max": 76,
"alpha_frac": 0.5765578635,
"autogenerated": false,
"ratio": 3.3835341365461846,
"config_t... |
import json
import boto3
ec2_client = boto3.client('ec2')
def collect_tags(instance_id):
"""
Collect tags for specified instance id (output: dict)
"""
r = ec2_client.describe_tags(
Filters = [
{
'Name': 'resource-type',
'Values': [
'instance'
]
},
{
... | {
"repo_name": "psyhomb/serverless",
"path": "aws-lambda/ftags/handler.py",
"copies": "1",
"size": "1366",
"license": "mit",
"hash": -2022508617829623800,
"line_mean": 17.7123287671,
"line_max": 75,
"alpha_frac": 0.5614934114,
"autogenerated": false,
"ratio": 3.467005076142132,
"config_test": fa... |
__author__ = 'Milos Prchlik'
__copyright__ = 'Copyright 2010 - 2012, Milos Prchlik'
__contact__ = 'happz@happz.cz'
__license__ = 'http://www.php-suit.com/dpl'
import hlib.api
import handlers
from hlib.api import api
from handlers import p... | {
"repo_name": "happz/settlers",
"path": "src/handlers/home.py",
"copies": "1",
"size": "2046",
"license": "mit",
"hash": 1929139043074481700,
"line_mean": 23.3571428571,
"line_max": 174,
"alpha_frac": 0.5909090909,
"autogenerated": false,
"ratio": 3.2476190476190476,
"config_test": false,
"ha... |
__author__ = 'Milos Prchlik'
__copyright__ = 'Copyright 2010 - 2014, Milos Prchlik'
__contact__ = 'happz@happz.cz'
__license__ = 'http://www.php-suit.com/dpl'
import collections
import random
import lib.datalayer
import tournaments
import tournaments.engines
import hlib.database
__all__ = []
class RoundStats(hlib.... | {
"repo_name": "happz/settlers",
"path": "src/tournaments/engines/swiss.py",
"copies": "1",
"size": "9329",
"license": "mit",
"hash": 7993659206182756000,
"line_mean": 26.6824925816,
"line_max": 90,
"alpha_frac": 0.5828063029,
"autogenerated": false,
"ratio": 3.1442534546680148,
"config_test": f... |
__author__ = 'Milos Prchlik'
__copyright__ = 'Copyright 2010 - 2014, Milos Prchlik'
__contact__ = 'happz@happz.cz'
__license__ = 'http://www.php-suit.com/dpl'
import collections
import threading
from collections import OrderedDict
import hlib.api
import hlib.events
import hlib.input
import hlib.error
import games
i... | {
"repo_name": "happz/settlers",
"path": "src/tournaments/__init__.py",
"copies": "1",
"size": "10433",
"license": "mit",
"hash": -7098979679432293000,
"line_mean": 30.4246987952,
"line_max": 159,
"alpha_frac": 0.6653886706,
"autogenerated": false,
"ratio": 3.2032545287073995,
"config_test": fal... |
__author__ = 'Milos Prchlik'
__copyright__ = 'Copyright 2014, Milos Prchlik'
__contact__ = 'happz@happz.cz'
__license__ = 'http://www.php-suit.com/dpl'
import random
import tournaments.engines
__all__ = []
class Engine(tournaments.engines.Engine):
player_class = tournaments.Player
def create_groups(self):
... | {
"repo_name": "happz/settlers",
"path": "src/tournaments/engines/randomized.py",
"copies": "1",
"size": "1771",
"license": "mit",
"hash": -7955048812517128000,
"line_mean": 24.6666666667,
"line_max": 109,
"alpha_frac": 0.6081309994,
"autogenerated": false,
"ratio": 3.2435897435897436,
"config_t... |
__author__ = 'miltador'
'''
Setup script for building win32 aceproxy dist with python, executable and installer using cx_Freeze
Command to make a distro: python setup_win32.py bdist_msi
!!! IMPORTANT NOTICE !!!
By default cx_Freeze created installer will generate shortcuts without working dir that's why plugins will n... | {
"repo_name": "deseven/aceproxy",
"path": "setup_win32.py",
"copies": "5",
"size": "1374",
"license": "mit",
"hash": 1672959750234515200,
"line_mean": 48.1071428571,
"line_max": 116,
"alpha_frac": 0.6746724891,
"autogenerated": false,
"ratio": 3.870422535211268,
"config_test": false,
"has_no_... |
__author__ = 'miltador'
'''
Torrent-telik.com Playlist Downloader Plugin
(based on ytv plugin by ValdikSS)
http://ip:port/torrent-telik || http://ip:port/torrent-telik/?type=ttv = torrent-tv playlist
http://ip:port/torrent-telik/?type=mob_ttv = torrent-tv mobile playlist
http://ip:port/torrent-telik/?type=allfon = allf... | {
"repo_name": "deseven/aceproxy",
"path": "plugins/torrenttelik_plugin.py",
"copies": "4",
"size": "2858",
"license": "mit",
"hash": 4005307482662555000,
"line_mean": 29.7311827957,
"line_max": 112,
"alpha_frac": 0.621763471,
"autogenerated": false,
"ratio": 3.8673883626522327,
"config_test": f... |
import shapefile
kTrajectoryFile = '/home/linyufly/GitHub/vfkm/data/atlantic_storms.txt'
kClusterFilePrefix = '/home/linyufly/GitHub/vfkm/output/curves_r_'
kOutputFilePrefix = './output/cluster_'
kNumberOfClusters = 7
def writer_test():
w = shapefile.Writer(shapefile.POLYGON)
w.poly(parts = [[[1, 5], [5, 5], [5,... | {
"repo_name": "linyufly/PythonPlayground",
"path": "shapefile_test.py",
"copies": "1",
"size": "3071",
"license": "mit",
"hash": -4431320659674422000,
"line_mean": 39.9466666667,
"line_max": 695,
"alpha_frac": 0.5157929013,
"autogenerated": false,
"ratio": 2.0638440860215055,
"config_test": fal... |
import sys
import numpy as np
def smooth_1(state, num_repetitions):
print state
if num_repetitions > 0:
new_state = [None] * len(state)
new_state[0] = state[1]
new_state[-1] = state[-2]
for index in range(1, len(state) - 1):
new_state[index] = (state[index - 1] + state[index + 1]) / 2... | {
"repo_name": "linyufly/SmoothingTest",
"path": "smoothing_test.py",
"copies": "1",
"size": "1181",
"license": "mit",
"hash": -4132741680951069700,
"line_mean": 23.1020408163,
"line_max": 68,
"alpha_frac": 0.5808636749,
"autogenerated": false,
"ratio": 2.7401392111368907,
"config_test": false,
... |
import csv
from re import search
from os import path, listdir, remove, devnull
from shutil import copyfile
import subprocess
from subprocess import call, check_call, check_output, CalledProcessError
def main():
code_dir = path.realpath('./Code')
print 'code_dir = {0}'.format(code_dir)
f_null = open(devnull, 'w... | {
"repo_name": "linyufly/QLearningMP",
"path": "AutoTest/CodeCollector.py",
"copies": "1",
"size": "1602",
"license": "bsd-3-clause",
"hash": 6444470381475104000,
"line_mean": 36.2558139535,
"line_max": 121,
"alpha_frac": 0.6242197253,
"autogenerated": false,
"ratio": 3.2962962962962963,
"config... |
__author__ = 'mingjian.deng'
import os
import os.path
import pprint
import traceback
import zstacklib.utils.daemon as daemon
import zstacklib.utils.http as http
import zstacklib.utils.jsonobject as jsonobject
from zstacklib.utils.bash import *
from zstacklib.utils import shell
import shutil
import base64
import re
l... | {
"repo_name": "zstackio/zstack-utility",
"path": "appbuildsystem/appbuildsystem/appbuildsystem.py",
"copies": "1",
"size": "13443",
"license": "apache-2.0",
"hash": -6293576386615446000,
"line_mean": 33.829015544,
"line_max": 114,
"alpha_frac": 0.6093877855,
"autogenerated": false,
"ratio": 3.592... |
__author__ = 'Ming'
import numpy as np
import cv2
import serial
import pygame
from pygame.locals import *
import socket
class TextPrint:
def __init__(self):
self.reset()
self.font = pygame.font.Font(None, 20)
self.x = 10
self.y = 10
self.line_height = 15
self.black ... | {
"repo_name": "lurenlym/BPnetwork_smartcar",
"path": "computer/computer_training_date_collect.py",
"copies": "1",
"size": "6846",
"license": "apache-2.0",
"hash": 5888477907911640000,
"line_mean": 34.65625,
"line_max": 105,
"alpha_frac": 0.4950335963,
"autogenerated": false,
"ratio": 3.9367452558... |
__author__ = 'Ming'
import numpy as np
import cv2
import socket
"""
Reference:
PiCamera documentation
https://picamera.readthedocs.org/en/release-1.10/recipes2.html
"""
import io
import socket
import struct
import time
import picamera
# create socket and bind host
client_socket = socket.socket(socket.AF_INET, soc... | {
"repo_name": "lurenlym/BPnetwork_smartcar",
"path": "raspberry_pi/pi_stream.py",
"copies": "1",
"size": "1260",
"license": "apache-2.0",
"hash": -7882354687894519000,
"line_mean": 25.8085106383,
"line_max": 84,
"alpha_frac": 0.6126984127,
"autogenerated": false,
"ratio": 3.876923076923077,
"co... |
__author__ = 'Ming'
import threading
import socket
import serial
import cv2
import numpy as np
import math
import sys
# distance data measured by ultrasonic sensor
sensor_data =b""
class NeuralNetwork(object):
def __init__(self):
self.annmodel = cv2.ml.ANN_MLP_load('mlp_mlp2.xml')
def predict(self... | {
"repo_name": "lurenlym/BPnetwork_smartcar",
"path": "computer/computer_mydriver.py",
"copies": "1",
"size": "2953",
"license": "apache-2.0",
"hash": 3078718319147029500,
"line_mean": 30.0842105263,
"line_max": 123,
"alpha_frac": 0.5343718253,
"autogenerated": false,
"ratio": 3.7285353535353534,
... |
__author__ = 'minhtule'
from exception import ValidateException
from utility import *
import types
import re
import urllib
import random
import sys
REGEX_OBJECT_TYPE = type(re.compile(""))
class Parameter(object):
"""Parameter of http request specified by Google Analytics
Details at https://developers.goog... | {
"repo_name": "Labgoo/google-analytics-for-python",
"path": "gap/parameter.py",
"copies": "1",
"size": "31263",
"license": "mit",
"hash": 2507570788079127600,
"line_mean": 35.5649122807,
"line_max": 118,
"alpha_frac": 0.4637750696,
"autogenerated": false,
"ratio": 4.716807483403742,
"config_tes... |
__author__ = 'minhtule'
from parameter import *
import urllib2
import logging
import utility
def append_parameter(parameters, parameter_creator_func, value, is_required=False):
if is_required or value is not None:
param = parameter_creator_func(value)
parameters.append(param)
class HTTPRequest(... | {
"repo_name": "Labgoo/google-analytics-for-python",
"path": "gap/request.py",
"copies": "1",
"size": "5184",
"license": "mit",
"hash": 6650677459828306000,
"line_mean": 44.0782608696,
"line_max": 173,
"alpha_frac": 0.7013888889,
"autogenerated": false,
"ratio": 3.857142857142857,
"config_test":... |
__author__ = 'minhtule'
from request import *
class Tracker(object):
"""
"""
def __init__(self, tracking_id, visitor):
self.__tracking_id = tracking_id
self.__visitor = visitor
self.__debug_enabled = False
@property
def tracking_id(self):
return self.__tracking_... | {
"repo_name": "Labgoo/google-analytics-for-python",
"path": "gap/tracker.py",
"copies": "1",
"size": "2493",
"license": "mit",
"hash": 3348523199095739400,
"line_mean": 26.1086956522,
"line_max": 172,
"alpha_frac": 0.6173285199,
"autogenerated": false,
"ratio": 4.305699481865285,
"config_test":... |
__author__ = 'minhtule'
from tracker import *
from visitor import *
import webapp2
class GAP(object):
def __init__(self, request_handler):
self.default_tracker = None
self.__trackers = {}
if isinstance(request_handler, webapp2.RequestHandler):
self.__request_handler = request... | {
"repo_name": "Labgoo/google-analytics-for-python",
"path": "gap/gap.py",
"copies": "1",
"size": "1251",
"license": "mit",
"hash": -4546815226879439400,
"line_mean": 31.9473684211,
"line_max": 63,
"alpha_frac": 0.5587529976,
"autogenerated": false,
"ratio": 4.389473684210526,
"config_test": fal... |
__author__ = 'minhtule'
from uuid import uuid4
import webapp2
GA_TRACKING_COOKIE_NAME = "ga_tracking"
GA_TRACKING_COOKIE_MAX_AGE = 63072000 # 2years * 365days * 24h * 60m * 60s
class Visitor(object):
""" Visitor object contains information of the user from whom the request is sent.
These information are ... | {
"repo_name": "Labgoo/google-analytics-for-python",
"path": "gap/visitor.py",
"copies": "1",
"size": "2241",
"license": "mit",
"hash": 421776450051987400,
"line_mean": 33.4923076923,
"line_max": 102,
"alpha_frac": 0.6126729139,
"autogenerated": false,
"ratio": 4.3599221789883265,
"config_test":... |
__author__ = 'MiquelTur'
import urllib2
import json
import xml.etree.ElementTree as ET
import xml.dom.minidom as minidom
url_header = "http://pro.viewdns.info/"
params = "/?domain=%s&apikey=%s&output=%s"
def abuse_contact_lookup(key,target,output):
url = url = url_header + "abuselookup" + params %(target,key,out... | {
"repo_name": "MiquelT/viewdns-api",
"path": "viewdns/bin/apiRequests.py",
"copies": "1",
"size": "3948",
"license": "bsd-3-clause",
"hash": 1927239719131229200,
"line_mean": 22.6407185629,
"line_max": 105,
"alpha_frac": 0.6742654509,
"autogenerated": false,
"ratio": 3.1584,
"config_test": fals... |
__author__ = 'mirko'
# -*- coding: iso-8859-15 -*-
import json
import urllib2
import time
import traceback
import logging
import config as cgf
access_token=cgf.instagram['access_token']
client_id=cgf.instagram['client_id']
client_secret=cgf.instagram['client_secret']
tags=["anstenagusia","bbklive"]
logging.basi... | {
"repo_name": "mirkolai/understanding_the_attraction_dynamics_of_geolocated_hashtags",
"path": "000 - instagram API - tag.py",
"copies": "1",
"size": "1280",
"license": "mit",
"hash": 5960446753501280000,
"line_mean": 21.8571428571,
"line_max": 99,
"alpha_frac": 0.58828125,
"autogenerated": false,
... |
__author__ = 'mirko'
import cpu
from time import sleep, clock
f_path = "/home/mirko/pysysmon.data"
f = open(f_path, "w")
def get_info():
cpu_u = cpu.get_cpu_time()
ids = cpu.get_proc_ids()
procs = {}
sm, count = 0,0
for id in ids:
t1 = clock()
try: procs[id] = cpu.get_proc_time(i... | {
"repo_name": "mirkogrcic/pysysmon",
"path": "pysysmon.py",
"copies": "1",
"size": "1108",
"license": "mit",
"hash": -3829527434468995600,
"line_mean": 20.3269230769,
"line_max": 50,
"alpha_frac": 0.5676895307,
"autogenerated": false,
"ratio": 2.8929503916449084,
"config_test": false,
"has_no... |
__author__ = 'mirko'
import re, os
#TODO add __slots__
class CPUTime:
def __init__(self, user, userLow, sys, idle):
"""
user: time spent in userspace, int, seconds
userLow: time spent in userspace with low priority, int, seconds
sys: time spent in kernel space, int, seconds
... | {
"repo_name": "mirkogrcic/pysysmon",
"path": "cpu.py",
"copies": "1",
"size": "6231",
"license": "mit",
"hash": 5389595825303653000,
"line_mean": 25.0711297071,
"line_max": 106,
"alpha_frac": 0.5207831809,
"autogenerated": false,
"ratio": 3.344605475040258,
"config_test": false,
"has_no_keywo... |
__author__ = 'mirko'
import cpu
from time import sleep, clock
def get_info():
cpu_u = cpu.get_cpu_time()
ids = cpu.get_proc_ids()
procs = {}
sm, count = 0,0
for id in ids:
t1 = clock()
try: procs[id] = cpu.get_proc_time(id)
except: pass # exited
t2 = clock()
... | {
"repo_name": "mirkogrcic/pysysmon",
"path": "tests/top.py",
"copies": "1",
"size": "1516",
"license": "mit",
"hash": 6229479793895149000,
"line_mean": 24.2666666667,
"line_max": 84,
"alpha_frac": 0.5316622691,
"autogenerated": false,
"ratio": 2.9667318982387476,
"config_test": false,
"has_no... |
__author__ = 'mirko'
import ddbscan
import json
import numpy
import datetime
from pymongo import Connection
import random
connection = Connection('localhost', 27017)
db = connection.understanding_the_attraction_dynamics_of_geolocated_hashtags
mindate=9999999999999
maxdate=0
posts=[]
for data in db.astenagusia.find... | {
"repo_name": "mirkolai/understanding_the_attraction_dynamics_of_geolocated_hashtags",
"path": "002 - cluster analysis hours.py",
"copies": "1",
"size": "2889",
"license": "mit",
"hash": -795403134835225300,
"line_mean": 33.8192771084,
"line_max": 116,
"alpha_frac": 0.5614399446,
"autogenerated": f... |
__author__ = 'mirko'
import sys, os, ctypes as ct, random, math
from time import clock, sleep
import OpenGL
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from ctypes import *
try:
import gui.histograph as h
except:
import histograph as h
def display():
glClear(GL_COLOR_BUF... | {
"repo_name": "mirkogrcic/pysysmon",
"path": "tests/guiTestStress.py",
"copies": "1",
"size": "5419",
"license": "mit",
"hash": 7462729400050911000,
"line_mean": 23.0888888889,
"line_max": 121,
"alpha_frac": 0.5748293043,
"autogenerated": false,
"ratio": 3.1341816078658185,
"config_test": false... |
__author__ = 'mirko'
import sys, os, ctypes as ct, random
from time import clock, sleep
import OpenGL
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from ctypes import *
try:
import gui.histograph as h
except:
import histograph as h
def display():
glClear(GL_COLOR_BUFFER_BI... | {
"repo_name": "mirkogrcic/pysysmon",
"path": "tests/guiTest.py",
"copies": "1",
"size": "4463",
"license": "mit",
"hash": -2736470052730586000,
"line_mean": 21.432160804,
"line_max": 121,
"alpha_frac": 0.5984763612,
"autogenerated": false,
"ratio": 2.9892833221701274,
"config_test": false,
"h... |
__author__ = 'Mirko Rossini'
BUILD_FILE_TEMPLATE = """
from pybuilder.core import use_plugin, init
from pybuilder_django_enhanced_plugin import django_test
use_plugin("python.core")
name = "integration-test"
default_task = ["django_test"]
@init
def init (project):
project.set_property('django_project', 'testpr... | {
"repo_name": "MirkoRossini/pybuilder_django_enhanced_plugin",
"path": "src/integrationtest/python/common.py",
"copies": "1",
"size": "3876",
"license": "bsd-3-clause",
"hash": 6917802216958744000,
"line_mean": 25.1959459459,
"line_max": 101,
"alpha_frac": 0.7249742002,
"autogenerated": false,
"r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.