text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'sibirrer'
import numpy as np
class SIS_truncate(object):
"""
this class contains the function and the derivatives of the Singular Isothermal Sphere
"""
def function(self, x, y, theta_E, r_trunc, center_x=0, center_y=0):
x_shift = x - center_x
y_shift = y - center_y
... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/LensingProfiles/sis_truncate.py",
"copies": "1",
"size": "4232",
"license": "mit",
"hash": 226532273029453300,
"line_mean": 30.3555555556,
"line_max": 124,
"alpha_frac": 0.4326559546,
"autogenerated": false,
"ratio": 2.8517520215633425,
"co... |
__author__ = 'sibirrer'
import numpy as np
from lenstronomy.FunctionSet.barkana_integrals import BarkanaIntegrals
class SPEMD(BarkanaIntegrals):
"""
class whitch contains the softened power-law elliptical mass distribution (SPEMD) from Barkana 1998
the "function" is the double integral of the SPEMD as k... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/LensingProfiles/spemd_own.py",
"copies": "1",
"size": "5963",
"license": "mit",
"hash": -7806615573151931000,
"line_mean": 32.3184357542,
"line_max": 193,
"alpha_frac": 0.4641958746,
"autogenerated": false,
"ratio": 2.4701739850869924,
"con... |
__author__ = 'sibirrer'
import scipy.interpolate
import numpy as np
import astrofunc.util as util
class Interpol_func(object):
"""
class which uses an interpolation of a lens model and its first and second order derivatives
"""
def __init__(self, grid=True):
self._grid = grid
def functio... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/LensingProfiles/interpol.py",
"copies": "1",
"size": "7240",
"license": "mit",
"hash": -8023718473291112000,
"line_mean": 47.9256756757,
"line_max": 150,
"alpha_frac": 0.535359116,
"autogenerated": false,
"ratio": 2.680488707885968,
"config... |
__author__ = 'sibirrer'
import scipy.stats as stats
from scipy.interpolate import interp1d
import numpy as np
class SkewGaussian(object):
"""
class for the Skew Gaussian distribution
"""
def pdf(self, x, e=0., w=1., a=0.):
"""
probability density function
see: https://en.wikip... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/prob_density.py",
"copies": "1",
"size": "4064",
"license": "mit",
"hash": 9216176726674430000,
"line_mean": 25.3961038961,
"line_max": 100,
"alpha_frac": 0.5157480315,
"autogenerated": false,
"ratio": 3.3013809910641756,
"config_test": fal... |
__author__ = 'sibirrer'
from astrofunc.LensingProfiles.nfw import NFW
from astrofunc.LensingProfiles.nfw_ellipse import NFW_ELLIPSE
import numpy as np
import numpy.testing as npt
import pytest
class TestNFW(object):
"""
tests the Gaussian methods
"""
def setup(self):
self.nfw = NFW()
d... | {
"repo_name": "sibirrer/astrofunc",
"path": "test/test_nfw.py",
"copies": "1",
"size": "4093",
"license": "mit",
"hash": -7196790299368749000,
"line_mean": 33.6949152542,
"line_max": 79,
"alpha_frac": 0.5912533594,
"autogenerated": false,
"ratio": 2.7141909814323606,
"config_test": true,
"has... |
__author__ = 'sibirrer'
from astrofunc.LensingProfiles.no_lens import NoLens
import numpy as np
import pytest
class TestSIS(object):
"""
tests the Gaussian methods
"""
def setup(self):
self.noLens = NoLens()
def test_function(self):
x = np.array([1])
y = np.array([2])
... | {
"repo_name": "sibirrer/astrofunc",
"path": "test/test_no_lens.py",
"copies": "1",
"size": "1556",
"license": "mit",
"hash": -7642925688495252000,
"line_mean": 22.9384615385,
"line_max": 59,
"alpha_frac": 0.4749357326,
"autogenerated": false,
"ratio": 2.908411214953271,
"config_test": true,
"... |
__author__ = 'sibirrer'
from astrofunc.LensingProfiles.spp import SPP
import numpy as np
import numpy.testing as npt
import astrofunc.constants as const
import pytest
class TestSIS(object):
"""
tests the Gaussian methods
"""
def setup(self):
self.spp = SPP()
self.rho0_kgm3 = const.r... | {
"repo_name": "sibirrer/astrofunc",
"path": "test/test_unit_conversion.py",
"copies": "1",
"size": "1808",
"license": "mit",
"hash": 4794209044428741000,
"line_mean": 38.3260869565,
"line_max": 174,
"alpha_frac": 0.6111725664,
"autogenerated": false,
"ratio": 2.5146036161335186,
"config_test": ... |
__author__ = 'sibirrer'
from cosmoHammer import ParticleSwarmOptimizer
from cosmoHammer import MpiParticleSwarmOptimizer
from cosmoHammer import LikelihoodComputationChain
from cosmoHammer import CosmoHammerSampler
from cosmoHammer import MpiCosmoHammerSampler
from cosmoHammer.util import MpiUtil
from cosmoHammer.uti... | {
"repo_name": "DES-SL/EasyLens",
"path": "easylens/Fitting/mcmc.py",
"copies": "1",
"size": "8589",
"license": "mit",
"hash": 5891214549386377000,
"line_mean": 35.0882352941,
"line_max": 146,
"alpha_frac": 0.5701478635,
"autogenerated": false,
"ratio": 3.6517857142857144,
"config_test": false,
... |
__author__ = 'sibirrer'
import astropy.io.fits as pyfits
import astropy.wcs as pywcs
import numpy as np
from easylens.Data.image_analysis import ImageAnalysis
import easylens.util as util
class Exposure(object):
"""
class to handle an exposure
"""
def __init__(self, ra_center, dec_center):
s... | {
"repo_name": "DES-SL/EasyLens",
"path": "easylens/Data/exposure.py",
"copies": "1",
"size": "7291",
"license": "mit",
"hash": 1002031320138870500,
"line_mean": 33.5545023697,
"line_max": 136,
"alpha_frac": 0.578932931,
"autogenerated": false,
"ratio": 3.3171064604185623,
"config_test": false,
... |
__author__ = 'sibirrer'
import numpy as np
import scipy.special as special
class SPP(object):
"""
class for Softened power-law elliptical potential (SPEP)
"""
def function(self, x, y, theta_E, gamma, center_x=0, center_y=0):
"""
:param x: set of x-coordinates
:type x: array ... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/LensingProfiles/spp.py",
"copies": "1",
"size": "6464",
"license": "mit",
"hash": -1198170018582683600,
"line_mean": 26.2784810127,
"line_max": 146,
"alpha_frac": 0.4574566832,
"autogenerated": false,
"ratio": 3.0333176912247772,
"config_te... |
__author__ = 'sibirrer'
import numpy as np
class Dipole(object):
"""
class for dipole response of two massive bodies (experimental)
"""
def function(self, x, y, com_x, com_y, phi_dipole, coupling):
# coordinate shift
x_shift = x - com_x
y_shift = y - com_y
# rotation... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/LensingProfiles/dipole.py",
"copies": "1",
"size": "3111",
"license": "mit",
"hash": -2333370141770725000,
"line_mean": 28.6285714286,
"line_max": 112,
"alpha_frac": 0.5226615236,
"autogenerated": false,
"ratio": 2.753097345132743,
"config_... |
__author__ = 'sibirrer'
import numpy as np
class SPEP(object):
"""
class for Softened power-law elliptical potential (SPEP)
"""
def function(self, x, y, theta_E, gamma, q, phi_G, center_x=0, center_y=0):
"""
:param x: set of x-coordinates
:type x: array of size (n)
:p... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/LensingProfiles/spep.py",
"copies": "1",
"size": "3920",
"license": "mit",
"hash": -5172185744892143000,
"line_mean": 31.9495798319,
"line_max": 95,
"alpha_frac": 0.4642857143,
"autogenerated": false,
"ratio": 2.5721784776902887,
"config_te... |
__author__ = 'sibirrer'
#this file contains a class to compute the Navaro-Frank-White function in mass/kappa space
#the potential therefore is its integral
import numpy as np
from astrofunc.LensingProfiles.nfw import NFW
class NFW_ELLIPSE(object):
"""
this class contains functions concerning the NFW profile
... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/LensingProfiles/nfw_ellipse.py",
"copies": "1",
"size": "2971",
"license": "mit",
"hash": -9073109769152898000,
"line_mean": 33.5465116279,
"line_max": 109,
"alpha_frac": 0.5365196903,
"autogenerated": false,
"ratio": 2.6338652482269502,
"c... |
__author__ = 'sibirrer'
#this file contains a class to compute the Navaro-Frank-White function in mass/kappa space
#the potential therefore is its integral
import numpy as np
class NFW(object):
"""
this class contains functions concerning the NFW profile
relation are: R_200 = c * Rs
"""
def fun... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/LensingProfiles/nfw.py",
"copies": "1",
"size": "10391",
"license": "mit",
"hash": 8355831265524654000,
"line_mean": 29.5617647059,
"line_max": 116,
"alpha_frac": 0.4812818785,
"autogenerated": false,
"ratio": 3.0188843695525858,
"config_te... |
__author__ = 'sibirrer'
#this file contains a class to make a sersic profile
import numpy as np
from astrofunc.LensingProfiles.sersic_utils import SersicUtil
class Sersic(SersicUtil):
"""
this class contains functions to evaluate an spherical Sersic function
"""
def function(self, x, y, I0_sersic, ... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/LightProfiles/sersic.py",
"copies": "1",
"size": "7178",
"license": "mit",
"hash": 5735406411660509000,
"line_mean": 38.6629834254,
"line_max": 136,
"alpha_frac": 0.5614377264,
"autogenerated": false,
"ratio": 2.782170542635659,
"config_tes... |
__author__ = 'sibirrer'
#this file is ment to be a shell script to be run with Monch cluster
# set up the scene
from cosmoHammer.util.MpiUtil import MpiPool
import time
import sys
import pickle
import dill
start_time = time.time()
#path2load = '/mnt/lnec/sibirrer/input.txt'
path2load = str(sys.argv[1])
f = open(pa... | {
"repo_name": "DES-SL/EasyLens",
"path": "easylens/Scripts/des_script.py",
"copies": "1",
"size": "1168",
"license": "mit",
"hash": -2345322793075233300,
"line_mean": 28.2,
"line_max": 148,
"alpha_frac": 0.7011986301,
"autogenerated": false,
"ratio": 2.9127182044887783,
"config_test": false,
... |
__author__ = 'sibirrer'
#this file contains a class to make a gaussian
import numpy as np
from astrofunc.LensingProfiles.sersic_ellipse import SersicEllipse
class SersicDouble(object):
"""
this class contains functions to evaluate a Sersic mass profile: https://arxiv.org/pdf/astro-ph/0311559.pdf
"""
... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/LensingProfiles/sersic_double.py",
"copies": "1",
"size": "1795",
"license": "mit",
"hash": 3706561916932002300,
"line_mean": 42.7804878049,
"line_max": 112,
"alpha_frac": 0.5793871866,
"autogenerated": false,
"ratio": 2.4555403556771545,
"... |
__author__ = 'sibirrer'
#this file contains a class to make a gaussian
import numpy as np
from astrofunc.LensingProfiles.sersic import Sersic
class SersicEllipse(object):
"""
this class contains functions to evaluate a Sersic mass profile: https://arxiv.org/pdf/astro-ph/0311559.pdf
"""
def __init__(s... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/LensingProfiles/sersic_ellipse.py",
"copies": "1",
"size": "2601",
"license": "mit",
"hash": -6569361283449051000,
"line_mean": 34.6438356164,
"line_max": 119,
"alpha_frac": 0.5324875048,
"autogenerated": false,
"ratio": 2.6704312114989732,
... |
__author__ = 'sibirrer'
#this file contains a class to make a gaussian
import numpy as np
import astrofunc.util as util
from astrofunc.LensingProfiles.sersic_utils import SersicUtil
import astrofunc.LensingProfiles.calc_util as calc_util
class Sersic(SersicUtil):
"""
this class contains functions to evalua... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/LensingProfiles/sersic.py",
"copies": "1",
"size": "2561",
"license": "mit",
"hash": -3187150951711086000,
"line_mean": 36.115942029,
"line_max": 111,
"alpha_frac": 0.5224521671,
"autogenerated": false,
"ratio": 2.486407766990291,
"config_t... |
__author__ = 'sibirrer'
#this file contains a class to make a gaussian
import numpy as np
import scipy.special
import scipy.integrate as integrate
from astrofunc.LensingProfiles.gaussian import Gaussian
class GaussianKappa(object):
"""
this class contains functions to evaluate a Gaussian function and calculat... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/LensingProfiles/gaussian_kappa.py",
"copies": "1",
"size": "5479",
"license": "mit",
"hash": -7189596111806807000,
"line_mean": 29.1043956044,
"line_max": 114,
"alpha_frac": 0.492060595,
"autogenerated": false,
"ratio": 2.898941798941799,
"... |
__author__ = 'sibirrer'
#this file contains a class to make a gaussian
import numpy as np
class Gaussian(object):
"""
this class contains functions to evaluate a Gaussian function and calculates its derivative and hessian matrix
"""
def function(self, x, y, amp, sigma_x, sigma_y, center_x=0, center_y... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/LensingProfiles/gaussian.py",
"copies": "1",
"size": "1380",
"license": "mit",
"hash": -8495933178116406000,
"line_mean": 37.3333333333,
"line_max": 114,
"alpha_frac": 0.5463768116,
"autogenerated": false,
"ratio": 2.787878787878788,
"confi... |
__author__ = 'Sidath'
from flask import Flask, render_template, json, request, redirect
import json
import sys, traceback
import urllib
from Quiz import Quiz
# noinspection PyUnresolvedReferences
from flask.ext.mysql import MySQL
from flask import jsonify
from werkzeug import generate_password_hash, check_pa... | {
"repo_name": "SGCreations/kdumooc",
"path": "Python app/app_backup.py",
"copies": "1",
"size": "4450",
"license": "mit",
"hash": -137122600026209950,
"line_mean": 38.8256880734,
"line_max": 181,
"alpha_frac": 0.5249438202,
"autogenerated": false,
"ratio": 4.005400540054006,
"config_test": fals... |
__author__ = 'Siddharth Pramod'
__email__ = 'spramod1@umbc.edu'
__docformat__ = 'restructedtext en'
import numpy as np
import theano
import theano.tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
from neuralnets_theano.support import DispatchTable
from neuralnets_theano.nn_funcs import activat... | {
"repo_name": "sidps/neuralnets_theano",
"path": "nn_layers.py",
"copies": "1",
"size": "2534",
"license": "mit",
"hash": -2285145794568400100,
"line_mean": 40.5573770492,
"line_max": 119,
"alpha_frac": 0.5978689818,
"autogenerated": false,
"ratio": 3.63558106169297,
"config_test": false,
"ha... |
__author__ = 'Siddharth Pramod'
__email__ = 'spramod1@umbc.edu'
__docformat__ = 'restructedtext en'
def print_table(table):
""" Pretty print a table provided as a list of rows."""
col_size = [max(len(str(val)) for val in column) for column in zip(*table)]
print ('==========================================... | {
"repo_name": "sidps/neuralnets_theano",
"path": "support.py",
"copies": "1",
"size": "1512",
"license": "mit",
"hash": 8230011407627405000,
"line_mean": 35.0238095238,
"line_max": 93,
"alpha_frac": 0.5271164021,
"autogenerated": false,
"ratio": 4.369942196531792,
"config_test": false,
"has_n... |
__author__ = 'Siddharth Pramod'
__email__ = 'spramod1@umbc.edu'
__docformat__ = 'restructedtext en'
import numpy as np
from copy import deepcopy
from collections import deque
import theano
import theano.tensor as T
# TODO: rename this file and document
def sgd_loop(classifier, training_function, training_input, va... | {
"repo_name": "sidps/neuralnets_theano",
"path": "optimizations.py",
"copies": "1",
"size": "6149",
"license": "mit",
"hash": 4154348619027815400,
"line_mean": 47.8095238095,
"line_max": 118,
"alpha_frac": 0.6274190925,
"autogenerated": false,
"ratio": 3.7654623392529087,
"config_test": false,
... |
__author__ = 'Siddharth Pramod'
__email__ = 'spramod1@umbc.edu'
__docformat__ = 'restructedtext en'
import numpy as np
class Preprocessor(object):
def __init__(self, mean=None, variance=None):
self.mean = mean
self.variance = variance
def set_mean(self, numpy_2darray, axis=0):
self.... | {
"repo_name": "sidps/neuralnets_theano",
"path": "data_processing.py",
"copies": "1",
"size": "1104",
"license": "mit",
"hash": 6104468423342591000,
"line_mean": 29.6944444444,
"line_max": 56,
"alpha_frac": 0.6512681159,
"autogenerated": false,
"ratio": 3.1363636363636362,
"config_test": false,... |
__author__ = 'Siddharth Pramod'
import pickle
import argparse
import os
import errno
import warnings
import csv
def parse_cmd():
""" Parse command line arguments."""
cmd = argparse.ArgumentParser(description='Run Classifier')
cmd.add_argument('-single', default=False, type=bool, help='Train on... | {
"repo_name": "sidps/kaggle-telematics-challenge",
"path": "source/utils.py",
"copies": "1",
"size": "5730",
"license": "mit",
"hash": 7249343306936157000,
"line_mean": 47.1596638655,
"line_max": 121,
"alpha_frac": 0.6109947644,
"autogenerated": false,
"ratio": 3.6037735849056602,
"config_test"... |
__author__ = "Sidd Karamcheti, Calvin Huang"
import wpilib
from config import sp, hid_sp, dt, ds
import time
#auto = basicauto # replace with auto of choice
class MyRobot(wpilib.SimpleRobot):
def Disabled(self):
#auto.stop_autonomous()
while self.IsDisabled():
tinit = time.time()
... | {
"repo_name": "grt192/2012rebound-rumble",
"path": "py/robot.py",
"copies": "1",
"size": "1411",
"license": "mit",
"hash": 8231383399014602000,
"line_mean": 25.6226415094,
"line_max": 60,
"alpha_frac": 0.5584691708,
"autogenerated": false,
"ratio": 3.518703241895262,
"config_test": false,
"ha... |
__author__ = 'Sid Pramod'
__all__ = ['load_driver', 'load_all', 'get_driver_from_all']
import numpy as np
import pandas as pd
import os
import pickle
from collections import deque
def _load_trip(file_path, features=None, target_length=1800):
""" Load featurized data for the given trip."""
if not features:
... | {
"repo_name": "sidps/kaggle-telematics-challenge",
"path": "source/load_data.py",
"copies": "1",
"size": "8514",
"license": "mit",
"hash": -3581798647617397000,
"line_mean": 48.7953216374,
"line_max": 117,
"alpha_frac": 0.6118158327,
"autogenerated": false,
"ratio": 3.0825488776249097,
"config_... |
__author__ = 'Sid Pramod'
import lasagne
from source.fok_batchnorm.batch_norm import batch_norm
from source.utils import load_model
def _set_pretrained_params(net, pretrained_params):
new_params = lasagne.layers.get_all_param_values(net)
try:
new_params[:-2] = pretrained_params[:-2] #... | {
"repo_name": "sidps/kaggle-telematics-challenge",
"path": "source/models.py",
"copies": "1",
"size": "2561",
"license": "mit",
"hash": 4873267057337318000,
"line_mean": 37.2388059701,
"line_max": 119,
"alpha_frac": 0.6638032019,
"autogenerated": false,
"ratio": 3.6274787535410766,
"config_test... |
__author__ = 'Sid Pramod'
import numpy as np
import theano
import theano.tensor as T
import lasagne
from source.utils import log_metrics, runtime_display
def _create_theano_funcs(net, learning_rate=0.01, momentum=0.9, minibatch_size=100):
""" Create Theano functions for training and testing."""
x_var = T.ft... | {
"repo_name": "sidps/kaggle-telematics-challenge",
"path": "source/train_test_funcs.py",
"copies": "1",
"size": "4391",
"license": "mit",
"hash": 6980889880469083000,
"line_mean": 45.7234042553,
"line_max": 109,
"alpha_frac": 0.6194488727,
"autogenerated": false,
"ratio": 3.433150899139953,
"co... |
__author__ = 'Siemienik'
import languages as dataset
class CharCounterForNN():
def __init__(self, input_data):
self.literals = []
self.probabilities = {}
self.languages = []
self.input_data = input_data
self.data = []
def count(self):
"""
Count pro... | {
"repo_name": "Gryzone/NeuralNetwork",
"path": "LanguagesNN/CharCounterForNN.py",
"copies": "1",
"size": "1786",
"license": "mit",
"hash": 7055953251531594000,
"line_mean": 30.3333333333,
"line_max": 70,
"alpha_frac": 0.5268756999,
"autogenerated": false,
"ratio": 4.2829736211031175,
"config_te... |
__author__ = "signalpillar"
from . import model
from .config import get_by_name as get_config_by_name
from flask import (
Flask,
jsonify,
make_response,)
def create_app(config_name):
app = Flask(__name__)
config = get_config_by_name(config_name)
app.config.from_object(config)
config.i... | {
"repo_name": "py-amigos/adengine",
"path": "adengine/app.py",
"copies": "1",
"size": "1380",
"license": "artistic-2.0",
"hash": 7749846363453527000,
"line_mean": 24.0909090909,
"line_max": 89,
"alpha_frac": 0.6710144928,
"autogenerated": false,
"ratio": 3.5844155844155843,
"config_test": true,... |
__author__ = 'silencedut'
import urllib2
import json
from bs4 import BeautifulSoup
import lxml
import datetime
from util import third_party_api
class GameDate(object):
def __init__(self):
self.gamedate_url =third_party_api.gamedateapi
self.user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKi... | {
"repo_name": "SilenceDut/nbaplus-server",
"path": "spider/games.py",
"copies": "1",
"size": "3701",
"license": "apache-2.0",
"hash": 4817712660954772000,
"line_mean": 43.0714285714,
"line_max": 137,
"alpha_frac": 0.5495811943,
"autogenerated": false,
"ratio": 3.6107317073170733,
"config_test":... |
__author__ = '@siliconchris'
from flask import Flask
from flask import json
from flask import request
from flask import render_template
import sys
app = Flask(__name__)
class rest_writer:
@app.route('/')
def api_root():
return render_template('info.html')
@app.route('/messageform')
def api_f... | {
"repo_name": "siliconchris1973/PyLCDWriter",
"path": "rest_writer_class.py",
"copies": "1",
"size": "1975",
"license": "apache-2.0",
"hash": 2315139956315017000,
"line_mean": 29.859375,
"line_max": 70,
"alpha_frac": 0.493164557,
"autogenerated": false,
"ratio": 4.302832244008715,
"config_test"... |
__author__ = '@siliconchris'
from flask import Flask
import argparse
import sys
from hd44780_class import HD44780
from rest_writer_class import rest_writer
app = Flask(__name__)
if __name__ == '__main__':
lcd = HD44780()
app.debug = True
inetaddr = '0.0.0.0'
inetport = 5000
security_enable = F... | {
"repo_name": "siliconchris1973/PyLCDWriter",
"path": "__main__.py",
"copies": "1",
"size": "2409",
"license": "apache-2.0",
"hash": 8930756636363341000,
"line_mean": 39.8305084746,
"line_max": 161,
"alpha_frac": 0.6293067663,
"autogenerated": false,
"ratio": 3.981818181818182,
"config_test": f... |
__author__ = '@siliconchris'
from flask import json
from flask import request
from flask import Flask
from flask import render_template
import argparse
import sys
app = Flask(__name__)
@app.route('/')
def api_root():
return render_template('info.html')
@app.route('/messageform')
def api_form():
return re... | {
"repo_name": "siliconchris1973/PyLCDWriter",
"path": "rest_writer.py",
"copies": "1",
"size": "4040",
"license": "apache-2.0",
"hash": -214676841382525700,
"line_mean": 33.2372881356,
"line_max": 161,
"alpha_frac": 0.5824257426,
"autogenerated": false,
"ratio": 3.992094861660079,
"config_test"... |
__author__ = '@siliconchris'
from flask import json
from flask import request
from flask import Flask
from flask import render_template
import RPi.GPIO as GPIO
from time import sleep, time
import argparse
import sys
app = Flask(__name__)
class HD44780:
def __init__(self, pin_rs=4, pin_e=17, pins_db=[18, 22, 2... | {
"repo_name": "siliconchris1973/PyLCDWriter",
"path": "orig_rest_writer.py",
"copies": "1",
"size": "5758",
"license": "apache-2.0",
"hash": 7055498566960336000,
"line_mean": 30.6373626374,
"line_max": 161,
"alpha_frac": 0.5635637374,
"autogenerated": false,
"ratio": 3.667515923566879,
"config_... |
__author__ = 'silkspace'
from collections import Counter
import numpy as np
from time import time
import operator
def checkIfFloatOrCategorical(entry):
try:
float(entry)
return 'float'
except:
return 'categorical'
def removeMissingValuesFromSet(items, missingValues):
items = set(... | {
"repo_name": "Tachyon5/dev",
"path": "matrixCategorical.py",
"copies": "1",
"size": "6434",
"license": "bsd-3-clause",
"hash": 7398741826481995000,
"line_mean": 41.3289473684,
"line_max": 130,
"alpha_frac": 0.699098539,
"autogenerated": false,
"ratio": 4.341430499325236,
"config_test": false,
... |
__author__ = 'silkspace'
import numpy as np
from sklearn.decomposition import ProjectedGradientNMF
from time import time
import logging
from scipy.optimize import nnls
# take in an inhomoneous array of arrays of labels and build a matrix
data = [['foo',4], ['foo','bar',4], ['bar','nest',7]] #this will break if you ha... | {
"repo_name": "Tachyon5/dev",
"path": "matrixUtils.py",
"copies": "1",
"size": "7833",
"license": "bsd-3-clause",
"hash": -2587867347683553000,
"line_mean": 33.96875,
"line_max": 163,
"alpha_frac": 0.6021958381,
"autogenerated": false,
"ratio": 3.3923776526634906,
"config_test": false,
"has_n... |
__author__ = 'silvia'
import sys, getopt
from faker import Factory
#----------------------------------------------------------------------
def main(argv):
""""""
delm = '|'
num_rows = 10000000
try:
opts, args = getopt.getopt(argv,"hr:",["rows="])
except getopt.GetoptError:
print 'Us... | {
"repo_name": "jordancheah/hadoopsummit-2015",
"path": "data_creation/datacreation_narrow.py",
"copies": "1",
"size": "1088",
"license": "apache-2.0",
"hash": -322942890065490240,
"line_mean": 30.0857142857,
"line_max": 82,
"alpha_frac": 0.4852941176,
"autogenerated": false,
"ratio": 3.2672672672... |
__author__ = 'silvia'
import difflib
from collections import Counter, defaultdict
#from nltk.tokenize import word_tokenize
import csv
def csv_from_tuplelist(csvfile, tuplelist):
"""
create a csv file from a dictionary with a tuple list
"""
csv_name = open(csvfile, 'w', encoding='latin1', newline='')
... | {
"repo_name": "silviaegt/bdcv_metadata",
"path": "Clustering/CountDiff.py",
"copies": "1",
"size": "4073",
"license": "mit",
"hash": 3637275248820195300,
"line_mean": 30.7795275591,
"line_max": 151,
"alpha_frac": 0.6189296333,
"autogenerated": false,
"ratio": 2.8994252873563218,
"config_test": ... |
__author__ = 'sim'
class Node:
def __init__(self, index, name, rel=None):
"""
:param index: index of the node (makes sense for trees)
:param name: name of the node, such as word or word index
"""
self.index = index
self.name = name
self.rel = rel
sel... | {
"repo_name": "rug-compling/hmm-reps",
"path": "trees/node.py",
"copies": "1",
"size": "1343",
"license": "mit",
"hash": 4443277310338560500,
"line_mean": 22.1724137931,
"line_max": 65,
"alpha_frac": 0.5651526433,
"autogenerated": false,
"ratio": 4.196875,
"config_test": false,
"has_no_keywor... |
__author__ = 'SimonBernal'
import pandas as pd
from pandas import ExcelWriter
from stravalib import Client
import datetime
import os
_col_names = ['ID', 'Date', 'Start Time', 'City', 'Country',
'Type', 'Name','Elapsed Time', 'Moving Time',
'Distance', 'Total Elevation Gain', 'Gear',
... | {
"repo_name": "simbernal/strava2excel",
"path": "strava2excel.py",
"copies": "1",
"size": "4227",
"license": "mit",
"hash": 6032783618154980000,
"line_mean": 28.5524475524,
"line_max": 111,
"alpha_frac": 0.6081400852,
"autogenerated": false,
"ratio": 3.7070175438596493,
"config_test": false,
... |
__author__ = 'Simon Birrer'
"""
this file contains standard routines
"""
from collections import namedtuple
import numpy as np
import scipy.ndimage.interpolation as interp
import scipy
from numpy import linspace, meshgrid
import copy
import mpmath
def dictionary_to_namedtuple(dictionary):
dictionary.pop("__nam... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/util.py",
"copies": "1",
"size": "33823",
"license": "mit",
"hash": -2452789802486210000,
"line_mean": 29.8041894353,
"line_max": 197,
"alpha_frac": 0.5945362623,
"autogenerated": false,
"ratio": 2.9982271075259286,
"config_test": false,
... |
from __future__ import print_function, absolute_import
import argparse
import subprocess
def parse_options():
"""
Helper method to parse command line arguments. Returns the parsed command line arguments as string.
:returns: returns the command line arguments as string
:rtype: list(str)
"""
p... | {
"repo_name": "cbg-ethz/NGS-pipe",
"path": "scripts/run_deseq.py",
"copies": "1",
"size": "1302",
"license": "apache-2.0",
"hash": -8920196815754209000,
"line_mean": 31.55,
"line_max": 105,
"alpha_frac": 0.6359447005,
"autogenerated": false,
"ratio": 3.875,
"config_test": false,
"has_no_keywo... |
__author__ = 'Simon Hofmann'
from nb_classifier import NaiveBayesClassifier as NBC
from preprocessor import Preprocessor as Prep
class Evaluator:
__data = []
__label = None
__nb = None
__prep = None
__total_data = []
__total_labels = []
__verbose = False
__level = 0
def __init__(s... | {
"repo_name": "s1hofmann/NBClassification",
"path": "src/evalutator.py",
"copies": "1",
"size": "2106",
"license": "apache-2.0",
"hash": 5513614365979155000,
"line_mean": 30.9090909091,
"line_max": 83,
"alpha_frac": 0.4981006648,
"autogenerated": false,
"ratio": 4.0735009671179885,
"config_test... |
__author__ = 'Simon Hofmann'
from nltk.corpus import stopwords
from nltk import word_tokenize, pos_tag
from nltk.stem.wordnet import WordNetLemmatizer
from string import punctuation
from math import log
class TextClassifier:
def __init__(self):
pass
# Insert something useful here
class Preprocessor:
... | {
"repo_name": "s1hofmann/NBClassification",
"path": "src/naive_bayes.py",
"copies": "1",
"size": "5514",
"license": "apache-2.0",
"hash": -5137604166404097000,
"line_mean": 45.7288135593,
"line_max": 341,
"alpha_frac": 0.6592310482,
"autogenerated": false,
"ratio": 3.837160751565762,
"config_te... |
from __future__ import absolute_import
from time import strptime, mktime
from datetime import datetime
import fnmatch
import os
from astropy.units import Unit, nm, equivalencies
from sqlalchemy import Column, Integer, Float, String, DateTime, Boolean,\
Table, ForeignKey
from sqlalchemy.orm import relationship
fro... | {
"repo_name": "Alex-Ian-Hamilton/sunpy",
"path": "sunpy/database/tables.py",
"copies": "1",
"size": "23790",
"license": "bsd-2-clause",
"hash": 9194928296703224000,
"line_mean": 35.656394453,
"line_max": 90,
"alpha_frac": 0.6138293401,
"autogenerated": false,
"ratio": 3.9829231541938723,
"confi... |
from abc import ABCMeta, abstractmethod, abstractproperty
from collections import OrderedDict, Counter
from collections.abc import MutableMapping
__all__ = ['BaseCache', 'LRUCache', 'LFUCache']
class BaseCache(object, metaclass=ABCMeta):
"""
BaseCache is a class that saves and operates on an OrderedDict. It... | {
"repo_name": "dpshelio/sunpy",
"path": "sunpy/database/caching.py",
"copies": "2",
"size": "8312",
"license": "bsd-2-clause",
"hash": 8887022111593539000,
"line_mean": 29.8996282528,
"line_max": 91,
"alpha_frac": 0.5991337825,
"autogenerated": false,
"ratio": 4.242981112812659,
"config_test": ... |
from datetime import datetime
import pytest
from astropy import units as u
from sunpy.database.database import Database
from sunpy.database import tables
from sunpy.database.attrs import walker, Starred, Tag, Path, DownloadTime,\
FitsHeaderEntry
from sunpy.net.attr import DummyAttr, AttrAnd, AttrOr
from sunpy.ne... | {
"repo_name": "Alex-Ian-Hamilton/sunpy",
"path": "sunpy/database/tests/test_attrs.py",
"copies": "1",
"size": "16696",
"license": "bsd-2-clause",
"hash": 2120947855011966000,
"line_mean": 36.3512304251,
"line_max": 79,
"alpha_frac": 0.6215860086,
"autogenerated": false,
"ratio": 3.312698412698413... |
from datetime import datetime
import pytest
import astropy.units as u
from sunpy.database.database import Database
from sunpy.database import tables
from sunpy.database.attrs import walker, Starred, Tag, Path, DownloadTime,\
FitsHeaderEntry
from sunpy.net.attr import DummyAttr, AttrAnd, AttrOr
from sunpy.net imp... | {
"repo_name": "dpshelio/sunpy",
"path": "sunpy/database/tests/test_attrs.py",
"copies": "2",
"size": "18677",
"license": "bsd-2-clause",
"hash": -8486855100728463000,
"line_mean": 38.5699152542,
"line_max": 87,
"alpha_frac": 0.600149917,
"autogenerated": false,
"ratio": 3.4013840830449826,
"con... |
from __future__ import absolute_import
from abc import ABCMeta, abstractmethod, abstractproperty
from collections import MutableMapping, OrderedDict, Counter
from sunpy.extern import six
__all__ = ['BaseCache', 'LRUCache', 'LFUCache']
@six.add_metaclass(ABCMeta)
class BaseCache(object):
"""
BaseCache is a... | {
"repo_name": "Alex-Ian-Hamilton/sunpy",
"path": "sunpy/database/caching.py",
"copies": "1",
"size": "8382",
"license": "bsd-2-clause",
"hash": -6503600852038991000,
"line_mean": 29.7032967033,
"line_max": 91,
"alpha_frac": 0.6004533524,
"autogenerated": false,
"ratio": 4.222670025188917,
"conf... |
from __future__ import absolute_import
from abc import ABCMeta, abstractmethod
import os
from sqlalchemy.orm import make_transient
from sqlalchemy.exc import InvalidRequestError
from sunpy.extern import six
from sunpy.extern.six.moves import range
__all__ = [
'EmptyCommandStackError', 'NoSuchEntryError', 'Non... | {
"repo_name": "Alex-Ian-Hamilton/sunpy",
"path": "sunpy/database/commands.py",
"copies": "1",
"size": "13403",
"license": "bsd-2-clause",
"hash": -3001424397088358400,
"line_mean": 34.7413333333,
"line_max": 81,
"alpha_frac": 0.624412445,
"autogenerated": false,
"ratio": 4.343162670123137,
"con... |
from __future__ import absolute_import
from sqlalchemy import or_, and_, not_
from sunpy.time import parse_time
from sunpy.net.vso import attrs as vso_attrs
from sunpy.net.attr import AttrWalker, Attr, ValueAttr, AttrAnd, AttrOr
from sunpy.database.tables import DatabaseEntry, Tag as TableTag,\
FitsHeaderEntry a... | {
"repo_name": "Alex-Ian-Hamilton/sunpy",
"path": "sunpy/database/attrs.py",
"copies": "1",
"size": "8499",
"license": "bsd-2-clause",
"hash": 6278023651585669000,
"line_mean": 30.594795539,
"line_max": 118,
"alpha_frac": 0.5919519944,
"autogenerated": false,
"ratio": 3.806090461262875,
"config_... |
from __future__ import absolute_import
import itertools
import operator
from datetime import datetime
from contextlib import contextmanager
import os.path
from sqlalchemy import create_engine, exists
from sqlalchemy.orm import sessionmaker, scoped_session
from astropy import units
import sunpy
from sunpy.database ... | {
"repo_name": "Alex-Ian-Hamilton/sunpy",
"path": "sunpy/database/database.py",
"copies": "1",
"size": "38573",
"license": "bsd-2-clause",
"hash": 1299742094802431500,
"line_mean": 37.6503006012,
"line_max": 127,
"alpha_frac": 0.6145749618,
"autogenerated": false,
"ratio": 4.374347924699478,
"co... |
import itertools
import operator
from datetime import datetime
from contextlib import contextmanager
import os.path
from sqlalchemy import create_engine, exists
from sqlalchemy.orm import sessionmaker, scoped_session
from astropy import units
import sunpy
from sunpy.database import commands, tables
from sunpy.datab... | {
"repo_name": "dpshelio/sunpy",
"path": "sunpy/database/database.py",
"copies": "2",
"size": "43426",
"license": "bsd-2-clause",
"hash": -101617494740003260,
"line_mean": 38.4781818182,
"line_max": 104,
"alpha_frac": 0.6080688988,
"autogenerated": false,
"ratio": 4.38336529726456,
"config_test"... |
__author__ = 'simon'
from abstract_update_method import AbstractUpdateMethod
import numpy as np
class IRpropPlus(AbstractUpdateMethod):
"""
Variation of Rprop - see http://en.wikipedia.org/wiki/Rprop.
"""
def __init__(self, layer_sizes, rate_pos=1.2, rate_neg=0.5,
init_step=0.0001, ... | {
"repo_name": "xapharius/mrEnsemble",
"path": "Engine/src/algorithms/neuralnetwork/updatemethods/irprop_plus.py",
"copies": "2",
"size": "3724",
"license": "mit",
"hash": -5378431305679956000,
"line_mean": 41.3295454545,
"line_max": 77,
"alpha_frac": 0.5209452202,
"autogenerated": false,
"ratio":... |
__author__ = 'simon'
from abstract_update_method import AbstractUpdateMethod
import numpy as np
class Rprop(AbstractUpdateMethod):
"""
Resilient propagation (Rprop) - see
http://en.wikipedia.org/wiki/Rprop.
"""
def __init__(self, layer_sizes, rate_pos=1.2, rate_neg=0.5,
init_step... | {
"repo_name": "xapharius/HadoopML",
"path": "Engine/src/algorithms/neuralnetwork/updatemethods/rprop.py",
"copies": "2",
"size": "2535",
"license": "mit",
"hash": -4852645013809888000,
"line_mean": 39.253968254,
"line_max": 85,
"alpha_frac": 0.558974359,
"autogenerated": false,
"ratio": 3.7611275... |
__author__ = 'Simon'
from imapclient import IMAPClient
class IdleInterrupt(Exception):
"""
Raised when an idle() action occurs.
"""
def __init__(self):
super(IdleInterrupt, self).__init__()
class IMAP_Connection(object):
def __init__(self,host='imap.gmail.com',user='altamontlunchbot@gma... | {
"repo_name": "simontomlinson/altamontlunchbot",
"path": "LunchBot/IMAP.py",
"copies": "1",
"size": "1498",
"license": "mit",
"hash": 2560489426089450000,
"line_mean": 25.75,
"line_max": 135,
"alpha_frac": 0.5587449933,
"autogenerated": false,
"ratio": 3.841025641025641,
"config_test": false,
... |
__author__ = 'Simon'
import random
import cProfile
def merge_sort(array):
if len(array) == 1:
return array
mid = len(array)/2
left = array[:mid]
right = array[mid:]
left = merge_sort(left)
right = merge_sort(right)
return merge(left, right)
def merge(left, right):
merged = []
... | {
"repo_name": "sso2712/python",
"path": "merge_sort.py",
"copies": "2",
"size": "1055",
"license": "mit",
"hash": -4292960917174807000,
"line_mean": 24.119047619,
"line_max": 51,
"alpha_frac": 0.4739336493,
"autogenerated": false,
"ratio": 3.613013698630137,
"config_test": false,
"has_no_keyw... |
__author__ = 'Simon'
from dice_fnc import *
from dice_classes import *
import os
def cls():
os.system(['clear','cls'][os.name == 'nt'])
print("Welcome to easy-dice-roll!")
print("You can fork me on github!")
print("https://github.com/Winter259/easy-dice-roll")
def display_menu():
# cls()
print("Current dice bein... | {
"repo_name": "purrcat259/easy-dice-roll",
"path": "easydiceroll.py",
"copies": "2",
"size": "1091",
"license": "mit",
"hash": -3263269654832210400,
"line_mean": 21.2653061224,
"line_max": 59,
"alpha_frac": 0.6498625115,
"autogenerated": false,
"ratio": 2.7275,
"config_test": false,
"has_no_k... |
__author__ = 'Simon'
from os import getcwd
from os.path import join, exists
import configparser
class configuration:
def __init__(self, file_name, location=getcwd()):
self.file_name = file_name
self.location = location
self.path = join(location, file_name)
if not exists(self.path):... | {
"repo_name": "purrcat259/start-arma-dedi",
"path": "evergreen.py",
"copies": "2",
"size": "4375",
"license": "mit",
"hash": -1537096815602554600,
"line_mean": 39.8971962617,
"line_max": 172,
"alpha_frac": 0.6338285714,
"autogenerated": false,
"ratio": 4.081156716417911,
"config_test": true,
... |
__author__ = 'simon'
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
# with open(path.join(here, 'README.md'), encoding='utf-8') as f:
# long_description = f.read()
long_description... | {
"repo_name": "thimoonxy/subnetting",
"path": "setup.py",
"copies": "1",
"size": "4266",
"license": "mit",
"hash": 7300274542570377,
"line_mean": 37.4324324324,
"line_max": 101,
"alpha_frac": 0.6568213783,
"autogenerated": false,
"ratio": 3.953660797034291,
"config_test": false,
"has_no_keywo... |
__author__ = 'Simon'
import asyncio
import os
import inspect
import logging
import functools
from urllib import parse
from aiohttp import web
from apis import APIError
def get(path):
'''
Define decorator @get('/path')
:param path: url request path
:return:
'''
def decorator(func):
... | {
"repo_name": "snovian/PyWebBasic",
"path": "www/coreweb.py",
"copies": "1",
"size": "6458",
"license": "apache-2.0",
"hash": -2104826809339988000,
"line_mean": 31.29,
"line_max": 112,
"alpha_frac": 0.5475379374,
"autogenerated": false,
"ratio": 4.018668326073429,
"config_test": false,
"has_n... |
__author__ = 'Simon'
import email
from bs4 import BeautifulSoup
import re
class Mail(object):
def __init__(self,mail_string):
print(type(mail_string))
self.mail = email.message_from_string(mail_string)
def get_text(self):
if self.mail.is_multipart(): # Fancy data, most likely an at... | {
"repo_name": "simontomlinson/altamontlunchbot",
"path": "LunchBot/Mail.py",
"copies": "1",
"size": "2410",
"license": "mit",
"hash": -8683548666354855000,
"line_mean": 36.65625,
"line_max": 115,
"alpha_frac": 0.531120332,
"autogenerated": false,
"ratio": 4.265486725663717,
"config_test": false... |
__author__ = 'Simon'
import email
class Attachment(object):
def __init__(self,msg_part):
open(msg_part.get_filename(), 'wb').write(msg_part.get_payload(decode=True))
self.data = open(msg_part.get_filename(),'r').read()
self.data_type = msg_part.get_content_type()
self.file_name = ... | {
"repo_name": "simontomlinson/altamontlunchbot",
"path": "LunchBot/message.py",
"copies": "1",
"size": "1391",
"license": "mit",
"hash": -1187796577037514500,
"line_mean": 26.2745098039,
"line_max": 84,
"alpha_frac": 0.6110711718,
"autogenerated": false,
"ratio": 3.7594594594594595,
"config_tes... |
__author__ = 'Simon'
import json
import re
import html
import string
import urllib
#h = HTMLParser.HTMLParser()
sqfTypes = ['Array','Boolean','Group','Number','Object','Side','String','Code','Config','Control','Display','Script','Structured Text','Task','Team Member','Namespace','Trans','Orient','Target','Vector','Ed... | {
"repo_name": "simon84/language-arma-atom",
"path": "rsc/parseOperators.py",
"copies": "1",
"size": "7940",
"license": "mit",
"hash": -7052712472488805000,
"line_mean": 39.9278350515,
"line_max": 380,
"alpha_frac": 0.5942065491,
"autogenerated": false,
"ratio": 3.5685393258426967,
"config_test"... |
__author__ = 'Simon'
import json
import re
import HTMLParser
import urllib
h = HTMLParser.HTMLParser()
fnc_base_url = 'https://dev.withsix.com/docs/cba/index/'
fncPrefix = 'CBA_fnc_'
macro_base_url = 'https://dev.withsix.com/docs/cba/files/main/script_macros_common-hpp.html'
f = urllib.urlopen(macro_base_url)
conte... | {
"repo_name": "simon84/language-arma-atom",
"path": "rsc/cbadoc.py",
"copies": "1",
"size": "2565",
"license": "mit",
"hash": 7185090451525213000,
"line_mean": 31.8846153846,
"line_max": 171,
"alpha_frac": 0.6183235867,
"autogenerated": false,
"ratio": 3.1588669950738915,
"config_test": false,
... |
__author__ = 'Simon'
import json
import re
import urllib.parse
import html
import string
sqfTypes = ['Array','Boolean','Bool','Group','Number','Object','Side','String','Code','Config','Control','Display','Script','Structured Text','Task','Team Member','Namespace','Trans','Orient','Target','Vector','Editor Object','An... | {
"repo_name": "acemod/language-arma-atom",
"path": "rsc/parseOperators.py",
"copies": "1",
"size": "7455",
"license": "mit",
"hash": -7827697607361660000,
"line_mean": 39.2972972973,
"line_max": 418,
"alpha_frac": 0.6488262911,
"autogenerated": false,
"ratio": 3.2740447957839263,
"config_test":... |
__author__ = 'Simon'
import json
import re
import urllib.request
import html
fnc_base_url = 'http://cbateam.github.io/CBA_A3/docs/index/'
fnc_page_names = ['Functions', 'Functions2']
fncPrefix = 'CBA_fnc_'
macro_base_url = 'http://cbateam.github.io/CBA_A3/docs/files/main/script_macros_common-hpp.html'
f = urllib.req... | {
"repo_name": "acemod/language-arma-atom",
"path": "rsc/cbadoc.py",
"copies": "1",
"size": "2795",
"license": "mit",
"hash": 7837370233982114000,
"line_mean": 34.3797468354,
"line_max": 165,
"alpha_frac": 0.6511627907,
"autogenerated": false,
"ratio": 3.011853448275862,
"config_test": false,
... |
__author__ = 'Simon'
import json
import re
import urllib.request
params = {'format': 'json',
'action': 'query',
'list': 'categorymembers',
'cmtitle': 'Category:Scripting_Commands',
'cmtype':'page',
'cmlimit':500,
'cmcontinue':0}
f = urllib.request.urlopen("... | {
"repo_name": "acemod/language-arma-atom",
"path": "rsc/armadoc.py",
"copies": "1",
"size": "2927",
"license": "mit",
"hash": 7695939708876602000,
"line_mean": 33.4352941176,
"line_max": 117,
"alpha_frac": 0.603348138,
"autogenerated": false,
"ratio": 3.241417497231451,
"config_test": false,
... |
__author__ = 'simon'
import numpy as np
from sqlalchemy import func
from sqlalchemy.sql import expression
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore", UserWarning)
from dblib import CatalogDBObject, ChunkIterator
class Table(CatalogDBObject):
skipRegistration = True
... | {
"repo_name": "nanchenchen/lsst-comaf",
"path": "new_showMaf/lsst/sims/maf/db/Table.py",
"copies": "1",
"size": "4943",
"license": "mit",
"hash": 8974053920564242000,
"line_mean": 41.6120689655,
"line_max": 118,
"alpha_frac": 0.6020635242,
"autogenerated": false,
"ratio": 4.302001740644038,
"co... |
__author__ = 'simon'
import os
import struct
import numpy as np
import numpyutils as nputils
from skimage import img_as_float
import skimage.io as io
from skimage.transform import resize
def load_image(img_file, normalize=False, scale_to=None):
img = img_as_float(io.imread(img_file, as_grey=True))
if scale_t... | {
"repo_name": "xapharius/mrEnsemble",
"path": "Engine/src/utils/imageutils.py",
"copies": "2",
"size": "2898",
"license": "mit",
"hash": -5669485258454691000,
"line_mean": 32.6976744186,
"line_max": 132,
"alpha_frac": 0.6066252588,
"autogenerated": false,
"ratio": 3.0569620253164556,
"config_te... |
__author__ = 'Simon'
import random
dice_types = [4,6,8,10,12,20,20,100]
def choose_dice_type():
print("Current Dice types available: ")
for dice in dice_types:
print(dice, end=' ')
print("\n")
try:
dice_choice = int(input("Enter the number of sides the dice you wish to use has: "))
... | {
"repo_name": "purrcat259/easy-dice-roll",
"path": "dice_fnc.py",
"copies": "2",
"size": "2399",
"license": "mit",
"hash": 6168690440237050000,
"line_mean": 35.9076923077,
"line_max": 128,
"alpha_frac": 0.6327636515,
"autogenerated": false,
"ratio": 3.497084548104956,
"config_test": false,
"h... |
__author__ = 'Simon'
import re
class Schedule(object): #Bullds a schedule object
def __init__(self,data):
"""
data is a string 7 lines long. Consists of period \n elective_a | elective_b \n period etc...
"""
self.schedule = self.read_data(data)
def read_data(self,data):
... | {
"repo_name": "simontomlinson/altamontlunchbot",
"path": "LunchBot/schedule.py",
"copies": "1",
"size": "4400",
"license": "mit",
"hash": -2850421573585125400,
"line_mean": 26.6729559748,
"line_max": 150,
"alpha_frac": 0.5097727273,
"autogenerated": false,
"ratio": 3.609515996718622,
"config_te... |
__author__ = 'Simon'
import re,sys,traceback
class TracebackDecorator(object):
def __init__(self,func):
self.func = func
def process_tb(self,file=None):
traceback.print_exc(file=file)
def __call__(self,*args):
try:
self.func(*args)
except:
exc_type... | {
"repo_name": "simontomlinson/altamontlunchbot",
"path": "LunchBot/Main.py",
"copies": "1",
"size": "4913",
"license": "mit",
"hash": -8988311520710146000,
"line_mean": 33.8439716312,
"line_max": 169,
"alpha_frac": 0.5857927946,
"autogenerated": false,
"ratio": 3.8352849336455894,
"config_test"... |
__author__ = 'Simon'
import urllib
import json
import re
params = {'format': 'json',
'action': 'query',
'list': 'categorymembers',
'cmtitle': 'Category:Scripting_Commands_Arma_3',
'cmtype':'page',
'cmlimit':500,
'cmcontinue':0}
#f = urllib.urlopen("https://c... | {
"repo_name": "simon84/language-arma-atom",
"path": "rsc/armadoc.py",
"copies": "1",
"size": "3250",
"license": "mit",
"hash": 6792134575075681000,
"line_mean": 35.1111111111,
"line_max": 123,
"alpha_frac": 0.5689230769,
"autogenerated": false,
"ratio": 3.399581589958159,
"config_test": false,
... |
__author__ = 'Simon'
import urllib.request
import re
from datetime import timedelta,date
from bs4 import BeautifulSoup
from datetime_timezone import LocalTime
url = 'http://www.altamontschool.org/calendars/index.aspx?ModuleID=52:53:93' # URL for website calendar page containing relevant data. 52 = letter day, 53 =... | {
"repo_name": "simontomlinson/altamontlunchbot",
"path": "LunchBot/scrape.py",
"copies": "1",
"size": "7675",
"license": "mit",
"hash": 7655944869679301000,
"line_mean": 32.0862068966,
"line_max": 177,
"alpha_frac": 0.5927035831,
"autogenerated": false,
"ratio": 3.6916786916786917,
"config_test... |
__author__ = 'Simon'
'''
JSON API definition.
'''
class APIError(Exception):
'''
the base APIError which contains error(required), data(optional) and message(optional).
'''
def __init__(self, error, data='', message=''):
super(APIError, self).__init__(message)
self.error = error
... | {
"repo_name": "snovian/PyWebBasic",
"path": "www/apis.py",
"copies": "1",
"size": "1142",
"license": "apache-2.0",
"hash": -5351969369240884000,
"line_mean": 24.9545454545,
"line_max": 100,
"alpha_frac": 0.6348511384,
"autogenerated": false,
"ratio": 4.183150183150183,
"config_test": false,
"... |
__author__ = 'Simon'
# This figures out what time it is in Alabama, regardless of where the script is hosted.
# It really shouldn't have to be this long, but the datetime module is stupid.
from datetime import datetime,timedelta
class LocalTime:
def __init__(self,timezone=-6):
self.timezone = timedelta(... | {
"repo_name": "simontomlinson/altamontlunchbot",
"path": "LunchBot/datetime_timezone.py",
"copies": "1",
"size": "1501",
"license": "mit",
"hash": -8046222273467306000,
"line_mean": 30.2916666667,
"line_max": 128,
"alpha_frac": 0.6075949367,
"autogenerated": false,
"ratio": 3.6520681265206814,
... |
__author__ = 'Simon'
import data
import timeslots
NO_SLOTS = 8
NO_ROOMS = 6
class Main(object):
"""Control class to coordinate data loading and start processes"""
def __init__(self):
self.data = data.Data()
self.error = False
def run(self, type):
if not self.loadda... | {
"repo_name": "sisch/ak_verteilung",
"path": "main.py",
"copies": "1",
"size": "1300",
"license": "mit",
"hash": -7912449794761121000,
"line_mean": 27.5454545455,
"line_max": 70,
"alpha_frac": 0.5207692308,
"autogenerated": false,
"ratio": 3.7142857142857144,
"config_test": false,
"has_no_key... |
__author__ = 'Simon'
import json
import random
class Data(object):
"""Class data holds information about persons and working groups
aks is a dictionary with ID(key) and dict(value)
dict is dictionary Name|Leiter|Halbleiter and str|int|[int]
personen is a dictionary with name(key) and ... | {
"repo_name": "sisch/ak_verteilung",
"path": "data.py",
"copies": "1",
"size": "4046",
"license": "mit",
"hash": 3712686779320950000,
"line_mean": 36.5047619048,
"line_max": 95,
"alpha_frac": 0.5142221123,
"autogenerated": false,
"ratio": 3.7365988909426986,
"config_test": false,
"has_no_keyw... |
__author__ = 'Simon'
class TimeSlots(object):
def __init__(self, slots, rooms):
self.slots = list()
for s in range(0, slots):
self.slots.append(list())
for r in range(0, rooms):
self.slots[s].append("s%ir%i" % (s+1, r+1))
self.akpunkte = di... | {
"repo_name": "sisch/ak_verteilung",
"path": "timeslots.py",
"copies": "1",
"size": "3853",
"license": "mit",
"hash": -3744708734695435300,
"line_mean": 37.3265306122,
"line_max": 109,
"alpha_frac": 0.450674974,
"autogenerated": false,
"ratio": 3.5081967213114753,
"config_test": false,
"has_n... |
__author__ = 'Simons'
from main import*
from nltk.corpus import stopwords
from collections import Counter
from nltk import*
import types
import tfidf
def preProcessReviews(list):
porter = nltk.PorterStemmer()
stop = stopwords.words("english")
temp = []
i = 0;
G = []
for row in lis... | {
"repo_name": "Sapphirine/Yelp_Recommendation",
"path": "Review_functions.py",
"copies": "1",
"size": "2119",
"license": "mit",
"hash": -7073627222495404000,
"line_mean": 22.0795454545,
"line_max": 76,
"alpha_frac": 0.5356300142,
"autogenerated": false,
"ratio": 3.428802588996764,
"config_test"... |
__author__ = 'sina'
import sys
import os
import time
import resource
def openFile(argv):
'''
Fuction is responsible for reading two fasta files. First file is stored in one string, and second file,
with multiple sequences, is stored in list of strings.
'''
with open (argv[0], "r") as genomeFile:
... | {
"repo_name": "Tea-J/Rabin-Karp-algorithm",
"path": "fs45825/RabinKarp.py",
"copies": "1",
"size": "4213",
"license": "mit",
"hash": -7306730198656392000,
"line_mean": 34.7033898305,
"line_max": 120,
"alpha_frac": 0.6133396629,
"autogenerated": false,
"ratio": 3.785265049415993,
"config_test": ... |
__author__ = 'sinis'
#Thanks Hannah
import os
picture_list = [".jpg", ".png", ".gif"]
document_list = [".doc", ".pdf"]
movie_list = [".mp4", "webm"]
print("Please enter the directory")
target_directory = raw_input(">")
os.makedirs(target_directory+'\\Pictures')
os.makedirs(target_directory+'\\Documents')
os.makedir... | {
"repo_name": "jabedude/0x2",
"path": "fileSort.py",
"copies": "1",
"size": "1341",
"license": "mit",
"hash": -7470262508915850000,
"line_mean": 36.25,
"line_max": 89,
"alpha_frac": 0.6316181954,
"autogenerated": false,
"ratio": 3.4296675191815855,
"config_test": false,
"has_no_keywords": fal... |
__author__ = 'siredvin'
import argparse
import util
import json
import logging
from functools import reduce
import markdowncovert as md
import latexconvert as tex
from jinja2 import Environment, FileSystemLoader
import os
import subprocess
def markdown_generation(_resume, _localizations, _output, _output_directory, ... | {
"repo_name": "SirEdvin/ResumeConvertor",
"path": "convertor.py",
"copies": "1",
"size": "4571",
"license": "apache-2.0",
"hash": -2160439817517046800,
"line_mean": 50.988372093,
"line_max": 117,
"alpha_frac": 0.6922388727,
"autogenerated": false,
"ratio": 3.5232466509062252,
"config_test": fal... |
__author__ = 'Sixty North'
class Record(object):
'''A class to which any attribute can be added at construction.'''
def __init__(self, **kwargs):
'''Initialise a Record with an attribute for each keyword argument.
The attributes of a Record are mutable and may be read from and writt... | {
"repo_name": "rob-smallshire/asq",
"path": "asq/record.py",
"copies": "1",
"size": "1633",
"license": "mit",
"hash": -7758524930173370000,
"line_mean": 32.0208333333,
"line_max": 112,
"alpha_frac": 0.5725658298,
"autogenerated": false,
"ratio": 4.626062322946176,
"config_test": false,
"has_n... |
__author__ = 'Siyuan'
from sklearn.cluster import KMeans
from matplotlib import pyplot
import numpy as np
k = 10
data1 = []
data2 = []
name1 = []
name2 = []
point1 = []
point2 = []
users = []
scores = []
dim1 = open("output.txt", 'r') # the file of the result of emotion quantification in 1 or 2 dimen... | {
"repo_name": "Sapphirine/Emotion-Based-Recommendation",
"path": "Clustering/clustering.py",
"copies": "1",
"size": "2864",
"license": "mit",
"hash": -367137472644522700,
"line_mean": 23.1228070175,
"line_max": 103,
"alpha_frac": 0.531075419,
"autogenerated": false,
"ratio": 3.273142857142857,
... |
from collections import OrderedDict
from datetime import datetime, timedelta, timezone
import os.path as op
import re
from copy import deepcopy
from itertools import takewhile
from collections import Counter
from collections.abc import Iterable
import warnings
from textwrap import shorten
import numpy as np
from .uti... | {
"repo_name": "olafhauk/mne-python",
"path": "mne/annotations.py",
"copies": "4",
"size": "44624",
"license": "bsd-3-clause",
"hash": 5306207271232845000,
"line_mean": 38.7292965272,
"line_max": 97,
"alpha_frac": 0.5644387664,
"autogenerated": false,
"ratio": 4.123093983920155,
"config_test": f... |
from datetime import datetime
from itertools import repeat
from collections import OrderedDict
import os.path as op
import pytest
from pytest import approx
from numpy.testing import (assert_equal, assert_array_equal,
assert_array_almost_equal, assert_allclose)
import numpy as np
import m... | {
"repo_name": "adykstra/mne-python",
"path": "mne/tests/test_annotations.py",
"copies": "1",
"size": "38925",
"license": "bsd-3-clause",
"hash": -8613596838520972000,
"line_mean": 39.5046826223,
"line_max": 79,
"alpha_frac": 0.6078869621,
"autogenerated": false,
"ratio": 3.3701298701298703,
"co... |
from datetime import datetime
import time
import numpy as np
from .externals.six import string_types
class Annotations(object):
"""Annotation object for annotating segments of raw data.
Annotations are added to instance of :class:`mne.io.Raw` as an attribute
named ``annotations``. See the example belo... | {
"repo_name": "jmontoyam/mne-python",
"path": "mne/annotations.py",
"copies": "3",
"size": "5635",
"license": "bsd-3-clause",
"hash": -6470612611012545000,
"line_mean": 41.6893939394,
"line_max": 89,
"alpha_frac": 0.6360248447,
"autogenerated": false,
"ratio": 4.01067615658363,
"config_test": t... |
from datetime import datetime, timedelta
import time
import os.path as op
import re
from copy import deepcopy
from itertools import takewhile
import collections
import numpy as np
from .utils import (_pl, check_fname, _validate_type, verbose, warn, logger,
_check_pandas_installed, _mask_to_onsets... | {
"repo_name": "adykstra/mne-python",
"path": "mne/annotations.py",
"copies": "1",
"size": "36164",
"license": "bsd-3-clause",
"hash": -4507113546199666000,
"line_mean": 38.1809317443,
"line_max": 97,
"alpha_frac": 0.5610828448,
"autogenerated": false,
"ratio": 4.102552467385139,
"config_test": ... |
from collections import OrderedDict
from datetime import datetime, timedelta, timezone
import os.path as op
import re
from copy import deepcopy
from itertools import takewhile
import json
from collections import Counter
from collections.abc import Iterable
import warnings
from textwrap import shorten
import numpy as n... | {
"repo_name": "mne-tools/mne-python",
"path": "mne/annotations.py",
"copies": "1",
"size": "51935",
"license": "bsd-3-clause",
"hash": 1960546797313166000,
"line_mean": 38.5785060976,
"line_max": 97,
"alpha_frac": 0.5640225701,
"autogenerated": false,
"ratio": 4.066008926474042,
"config_test": ... |
class Shape(object):
def __init__(self, color):
self.color = color
def get_area(self):
pass
def to_string(self):
return str(self.color)
class Rectangle(Shape):
def __init__(self, color, length, width):
Shape.__init__(self, color)
self.length = length
... | {
"repo_name": "jakefish/Note-Exchange",
"path": "note_exchange/media/documents/2016/04/11/shape.py",
"copies": "1",
"size": "1367",
"license": "mit",
"hash": -400935847588517800,
"line_mean": 24.7924528302,
"line_max": 127,
"alpha_frac": 0.6122896854,
"autogenerated": false,
"ratio": 3.3587223587... |
import numpy as np
def pairwise_python_nested_for_loops(data):
n_samples, n_features = data.shape
distances = np.empty((n_samples, n_samples), dtype=data.dtype)
#"omp parallel for private(j, d, k, tmp)"
for i in range(n_samples):
for j in range(n_samples):
d = 0.0
for ... | {
"repo_name": "numfocus/python-benchmarks",
"path": "pairwise/pairwise_python.py",
"copies": "1",
"size": "1274",
"license": "mit",
"hash": -1135752318946686200,
"line_mean": 27.3111111111,
"line_max": 74,
"alpha_frac": 0.6028257457,
"autogenerated": false,
"ratio": 3.0847457627118646,
"config_... |
__all__ = ['LinearRegression', 'Ridge', 'Lasso']
import inspect
import types
import imp
import numpy as np
from sklearn import linear_model as sklearn_linear_model
from .base import BaseEstimator
class LinearModel(BaseEstimator):
"""Base class for Linear regression with errors in y"""
def fit(self, X, y, ... | {
"repo_name": "erichseamon/siglearn",
"path": "siglearn/linear_model.py",
"copies": "2",
"size": "4923",
"license": "bsd-2-clause",
"hash": 4807247916939538000,
"line_mean": 32.0402684564,
"line_max": 79,
"alpha_frac": 0.5632744262,
"autogenerated": false,
"ratio": 3.831128404669261,
"config_te... |
import sys
import time
from mako.template import Template
import numpy as np
import pyopencl as cl
mf = cl.mem_flags
PROFILING = 1
ctx = cl.create_some_context()
if PROFILING:
queue = cl.CommandQueue(
ctx,
properties=cl.command_queue_properties.PROFILING_ENABLE)
else:
queue = cl.CommandQueu... | {
"repo_name": "jaberg/python-benchmarks-pyopencl",
"path": "pybench_pyopencl/gemm_pyopencl.py",
"copies": "1",
"size": "19220",
"license": "bsd-3-clause",
"hash": 7574964045519887000,
"line_mean": 28.6147919877,
"line_max": 113,
"alpha_frac": 0.4265868887,
"autogenerated": false,
"ratio": 3.34086... |
import theano
import theano.tensor as TT
def pairwise_theano_tensor_prepare(dtype):
X = TT.matrix(dtype=str(dtype))
dists = TT.sqrt(
TT.sum(
TT.sqr(X[:, None, :] - X),
axis=2))
name = 'pairwise_theano_broadcast_' + dtype
rval = theano.function([X],
... | {
"repo_name": "numfocus/python-benchmarks",
"path": "pairwise/pairwise_theano.py",
"copies": "1",
"size": "1114",
"license": "mit",
"hash": -937815715265091300,
"line_mean": 28.3157894737,
"line_max": 64,
"alpha_frac": 0.5754039497,
"autogenerated": false,
"ratio": 3.3963414634146343,
"config_t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.