text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'Juergen Simon'
__email__ = 'juergen.simon@uni-bonn.de'
__version__ = '1.6.0'
__url__ = 'http://git.meteo.uni-bonn.de/projects/meanie3d'
__all__ = ['app', 'visualisation', 'resources']
import os.path
import sys
def getVersion():
'''
:return:meanie3D package version
'''
from . import __ver... | {
"repo_name": "meteo-ubonn/meanie3D",
"path": "python/meanie3D/__init__.py",
"copies": "1",
"size": "1170",
"license": "mit",
"hash": -4710363857468843000,
"line_mean": 35.5625,
"line_max": 463,
"alpha_frac": 0.6769230769,
"autogenerated": false,
"ratio": 2.917705735660848,
"config_test": false... |
__author__ = 'juke'
# -*- coding: utf-8 -*-
import re
import urllib2
from xml.dom import minidom
from irckaaja.botscript import BotScript
APIURL = "http://gdata.youtube.com/feeds/api/videos/"
class YoutubeAnnouncer(BotScript):
def on_channel_message(self, nick, target, message, full_mask):
ids = self._p... | {
"repo_name": "jukeks/irckaaja",
"path": "irckaaja/scripts/youtubeannouncer.py",
"copies": "1",
"size": "1193",
"license": "bsd-3-clause",
"hash": -8670069855658913000,
"line_mean": 26.7441860465,
"line_max": 96,
"alpha_frac": 0.5155071249,
"autogenerated": false,
"ratio": 3.8483870967741933,
"... |
__author__ = 'juke'
# -*- coding: utf-8 -*-
from irckaaja.botscript import BotScript
import shove
import re
import time
import urlparse
class IrcLinkHistory(BotScript):
def __init__(self, server_connection, config):
BotScript.__init__(self, server_connection, config)
self.store_path = config['s... | {
"repo_name": "jukeks/irckaaja",
"path": "irckaaja/scripts/irclinkhistory.py",
"copies": "1",
"size": "2613",
"license": "bsd-3-clause",
"hash": 7055700244327127000,
"line_mean": 35.7183098592,
"line_max": 120,
"alpha_frac": 0.5220560031,
"autogenerated": false,
"ratio": 3.5614754098360657,
"co... |
__author__ = 'jules'
from scipy.stats import rv_continuous
import numpy as np
from scipy.misc import factorial
from scipy.special import gammainc, gamma, erf
from scipy.linalg import expm
class Hyperexp2_gen(rv_continuous):
def __init__(self,name, lambda1, lambda2, p):
rv_continuous.__init__(self, name)
... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "deepThought/stats/customDistributions.py",
"copies": "1",
"size": "5990",
"license": "mit",
"hash": -110710482693600670,
"line_mean": 27.1267605634,
"line_max": 130,
"alpha_frac": 0.4988313856,
"autogenerated": false,
"ratio": 2.804307116104869,
... |
__author__ = 'jules'
import argparse
from deepThought.ORM.ORM import deserialize
from deepThought.util import Logger, TypeConversion
import sys
import pickle
from deepThought.multiprocessing.multicoreSimulation import process_job_parallel
from deepThought.simulator.simulator import simulate_schedule
from deepThought.sc... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "deepThought/optimizer/optimizer.py",
"copies": "1",
"size": "3444",
"license": "mit",
"hash": 702620744926051200,
"line_mean": 32.7745098039,
"line_max": 157,
"alpha_frac": 0.5656213705,
"autogenerated": false,
"ratio": 3.482305358948433,
"config... |
__author__ = 'jules'
from deepThought.scheduler.scheduler import Scheduler
from deepThought.scheduler.RBRS import RBRS
from deepThought.scheduler.genetic.ListGA import ListGA
from deepThought.scheduler.genetic.ArcGA import ArcGA
from deepThought.util import Logger
from deepThought.scheduler.MfssRb import MfssRB
"""
Th... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "deepThought/scheduler/PPPolicies.py",
"copies": "1",
"size": "3022",
"license": "mit",
"hash": 7054624982405324000,
"line_mean": 37.7564102564,
"line_max": 122,
"alpha_frac": 0.599602912,
"autogenerated": false,
"ratio": 3.434090909090909,
"confi... |
__author__ = 'jules'
from deepThought.scheduler.scheduler import Scheduler
from deepThought.scheduler.RBRS import RBRS
from deepThought.scheduler.genetic.ListGA import ListGA
from deepThought.util import Logger
from deepThought.scheduler.DomainRB import DomainRB
"""
This class is the implementation of our own Algorith... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "deepThought/scheduler/JFPol.py",
"copies": "1",
"size": "1863",
"license": "mit",
"hash": 4028450454539444000,
"line_mean": 33.5185185185,
"line_max": 99,
"alpha_frac": 0.6704240472,
"autogenerated": false,
"ratio": 3.5485714285714285,
"config_te... |
__author__ = 'jules'
from deepThought.scheduler.scheduler import Scheduler
from deepThought.util import UnfeasibleScheduleException
from deepThought.util import Logger
"""
This class represents ABPolicies. They are also known as priority lists. This is extended with the minimum feasible set
"""
class MfssAB(Scheduler)... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "deepThought/scheduler/MfssAb.py",
"copies": "1",
"size": "2016",
"license": "mit",
"hash": -5284004853940166000,
"line_mean": 39.34,
"line_max": 119,
"alpha_frac": 0.5868055556,
"autogenerated": false,
"ratio": 3.712707182320442,
"config_test": f... |
__author__ = 'jules'
from deepThought.scheduler.scheduler import Scheduler
from deepThought.util import UnfeasibleScheduleException
import copy
from deepThought.util import Logger
"""
implementation of the resource based policy scheduling heuristic extended with the minimum forbidden set
"""
class DomainRB(Scheduler):... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "deepThought/scheduler/DomainRB.py",
"copies": "1",
"size": "2846",
"license": "mit",
"hash": -1248759800317661700,
"line_mean": 44.9193548387,
"line_max": 170,
"alpha_frac": 0.5801124385,
"autogenerated": false,
"ratio": 3.7795484727755646,
"conf... |
__author__ = 'jules'
from deepThought.scheduler.scheduler import Scheduler
from deepThought.util import UnfeasibleScheduleException
import copy
"""
This class represents ABPolicies. They are also known as priority lists.
"""
class RBPolicy(Scheduler):
def __init__(self, job, order_list = None):
super(RBPo... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "deepThought/scheduler/RBPolicy.py",
"copies": "1",
"size": "1072",
"license": "mit",
"hash": -7165372030047593000,
"line_mean": 33.6129032258,
"line_max": 86,
"alpha_frac": 0.6016791045,
"autogenerated": false,
"ratio": 3.6587030716723548,
"confi... |
__author__ = 'jules'
from deepThought.scheduler.scheduler import Scheduler
from deepThought.util import UnfeasibleScheduleException
"""
This class represents ABPolicies. They are also known as priority lists.
"""
class ABPolicy(Scheduler):
def __init__(self, job, order_list = None):
super(ABPolicy, self).... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "deepThought/scheduler/ABPolicy.py",
"copies": "1",
"size": "1082",
"license": "mit",
"hash": 7654852303914908000,
"line_mean": 33.935483871,
"line_max": 114,
"alpha_frac": 0.5942698706,
"autogenerated": false,
"ratio": 3.6928327645051193,
"config... |
__author__ = 'jules'
import argparse
import sys
from deepThought.util import Logger
from deepThought.simulator.simulationResult import load_simulation_result
from deepThought.visualizer.gantt import plot_gantt
import matplotlib.pyplot as plt
def main():
arg_parser = argparse.ArgumentParser()
arg_parser.add_a... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "deepThought/visualizer/visualizer.py",
"copies": "1",
"size": "2025",
"license": "mit",
"hash": 7572927053950626000,
"line_mean": 31.6774193548,
"line_max": 122,
"alpha_frac": 0.652345679,
"autogenerated": false,
"ratio": 3.7850467289719627,
"con... |
__author__ = 'jules'
import deepThought.ORM.ORM as ORM
import matplotlib.pyplot as plt
import numpy as np
def main():
job = ORM.deserialize("/tmp/output.pickle")
results = sorted(job.tasks.values(), key=lambda x: len(x.execution_history), reverse=True)
set1 = results[0].execution_history
set2 = res... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "tools/stat_inference/stat_inference.py",
"copies": "1",
"size": "2034",
"license": "mit",
"hash": -5711699816044529000,
"line_mean": 28.9117647059,
"line_max": 132,
"alpha_frac": 0.604719764,
"autogenerated": false,
"ratio": 2.8368200836820083,
"... |
__author__ = 'jules'
import numpy as np
import deepThought.ORM.ORM as ORM
from scipy.optimize import fmin
from deepThought.stats.Pmf import MakePmfFromList
from deepThought.util import list_to_ccdf
import matplotlib.pyplot as plt
import pylab as pylab
def main():
job = ORM.deserialize("/tmp/output.pickle")
r... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "tools/stat_inference/maximum_likelihood.py",
"copies": "1",
"size": "1695",
"license": "mit",
"hash": 1518736165660602000,
"line_mean": 24.696969697,
"line_max": 99,
"alpha_frac": 0.5864306785,
"autogenerated": false,
"ratio": 2.7516233766233764,
... |
__author__ = 'jules'
import numpy as np
from scipy.stats import uniform
from customDistributions import Hyperexp2_gen, Erlangk_gen, Gamma, BranchingErlang, TruncatedErlangk_gen, MixtureNormUni, TruncatedHyperexp2
import math
def infer_distribution(job):
X = np.array(job.execution_history)
mean = np.mean(X... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "deepThought/stats/phase_type.py",
"copies": "1",
"size": "4615",
"license": "mit",
"hash": 1510671074721730600,
"line_mean": 28.9675324675,
"line_max": 140,
"alpha_frac": 0.5757313109,
"autogenerated": false,
"ratio": 2.643184421534937,
"config_t... |
__author__ = 'jules'
import pymc as mc
from model import _model
import numpy as np
import pylab
import deepThought.ORM.ORM as ORM
from deepThought.util import list_to_ccdf
from numpy import mean
import matplotlib.pyplot as plt
import pylab as pylab
def main():
job = ORM.deserialize("/tmp/output.pickle")
resu... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "tools/stat_inference/baysean_markov_chain_monte_carlo.py",
"copies": "1",
"size": "1679",
"license": "mit",
"hash": 847099367604355200,
"line_mean": 24.4545454545,
"line_max": 108,
"alpha_frac": 0.625967838,
"autogenerated": false,
"ratio": 2.83136... |
__author__ = 'jules'
import simpy
import argparse
import sys
import copy
import deepThought.ORM.ORM as ORM
from deepThought.scheduler.referenceScheduler import ReferenceScheduler
from deepThought.scheduler.optimizedDependencyScheduler import OptimizedDependencyScheduler
from deepThought.scheduler.RBRS import RBRS
fro... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "deepThought/simulator/simulator.py",
"copies": "1",
"size": "5950",
"license": "mit",
"hash": 5382314658171113000,
"line_mean": 35.7345679012,
"line_max": 118,
"alpha_frac": 0.6623529412,
"autogenerated": false,
"ratio": 3.909329829172142,
"confi... |
__author__ = 'jules'
"""
Implementation of the regret-based biased random sampling for creation of initial population
"""
from deepThought.scheduler.scheduler import Scheduler, ScheduledTask
import deepThought.util as util
class RBRS(Scheduler):
def __init__(self, job):
super(RBRS, self).__init__(job)
... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "deepThought/scheduler/RBRS.py",
"copies": "1",
"size": "1361",
"license": "mit",
"hash": -2305058585063329500,
"line_mean": 25.6862745098,
"line_max": 97,
"alpha_frac": 0.5135929464,
"autogenerated": false,
"ratio": 3.728767123287671,
"config_tes... |
__author__ = 'jules'
import matplotlib.pylab as plt
import numpy as np
import deepThought.ORM.ORM as ORM
from deepThought.util import list_to_ccdf
from deepThought.stats import Pmf
def hyperexp2(lambda1, lambda2, p, x):
return p * lambda1 * np.exp(-lambda1 * x) + (1-p) * lambda2 * np.exp(-lambda2 * x)
def hy... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "tools/plot_hyperexp2.py",
"copies": "1",
"size": "1645",
"license": "mit",
"hash": -4992721741115804000,
"line_mean": 27.8771929825,
"line_max": 103,
"alpha_frac": 0.6455927052,
"autogenerated": false,
"ratio": 2.2878998609179417,
"config_test": ... |
__author__ = 'jules'
"""
This algorithm creates the initial Population for the PPPolicy
"""
import numpy as np
from deap import tools, base, creator
from deepThought.scheduler.RBPolicy import RBPolicy
from deepThought.scheduler.ABPolicy import ABPolicy
from deepThought.util import UnfeasibleScheduleException, Logger
i... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "deepThought/scheduler/genetic/ListGA.py",
"copies": "1",
"size": "5312",
"license": "mit",
"hash": -3145045904702354000,
"line_mean": 34.6577181208,
"line_max": 149,
"alpha_frac": 0.6165286145,
"autogenerated": false,
"ratio": 3.625938566552901,
... |
__author__ = 'jules'
"""
This algorithm selects further precedence constrains to add to the List of
"""
from deap import tools, base, creator, algorithms
from deepThought.scheduler.RBPolicy import RBPolicy
from deepThought.scheduler.MfssRb import MfssRB
from deepThought.util import Logger, UnfeasibleScheduleException
... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "deepThought/scheduler/genetic/ArcGA.py",
"copies": "1",
"size": "7249",
"license": "mit",
"hash": 3703781548141366000,
"line_mean": 37.1526315789,
"line_max": 150,
"alpha_frac": 0.5762174093,
"autogenerated": false,
"ratio": 3.9183783783783785,
"... |
__author__ = 'jules'
#see http://nbviewer.ipython.org/github/timstaley/ipython-notebooks/blob/compiled/probabilistic_programming/convolving_distributions_illustration.ipynb
import deepThought.ORM.ORM as ORM
from deepThought.util import list_to_cdf
from deepThought.stats.phase_type import infer_distribution
import num... | {
"repo_name": "juliusf/Genetic-SRCPSP",
"path": "tools/stat_inference/fft_convolve.py",
"copies": "1",
"size": "1569",
"license": "mit",
"hash": 7692927240021155000,
"line_mean": 28.0740740741,
"line_max": 151,
"alpha_frac": 0.6577437859,
"autogenerated": false,
"ratio": 2.949248120300752,
"con... |
__author__ = 'Julian Togelius and Tom Schaul, tom@idsia.ch'
from random import shuffle
from pybrain.optimization.optimizer import BlackBoxOptimizer
class ES(BlackBoxOptimizer):
""" Standard evolution strategy, (mu + lambda). """
mu = 50
lambada = 50
evaluatorIsNoisy = False
... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/optimization/populationbased/es.py",
"copies": "3",
"size": "2353",
"license": "mit",
"hash": 2004309413704318700,
"line_mean": 35.765625,
"line_max": 91,
"alpha_frac": 0.5558861028,
"autogenerated": false,
"ratio... |
__author__ = 'Julian Togelius and Tom Schaul, tom@idsia.ch'
from random import shuffle
from pybrain.optimization.optimizer import BlackBoxOptimizer
class ES(BlackBoxOptimizer):
""" Standard evolution strategy, (mu +/, lambda). """
mu = 50
lambada = 50
evaluatorIsNoisy = False
storeHallOfFame ... | {
"repo_name": "taylorhxu/pybrain",
"path": "pybrain/optimization/populationbased/es.py",
"copies": "25",
"size": "2622",
"license": "bsd-3-clause",
"hash": -8903976500251601000,
"line_mean": 31.3703703704,
"line_max": 107,
"alpha_frac": 0.5968726163,
"autogenerated": false,
"ratio": 3.64166666666... |
__author__ = 'Julian Togelius and Tom Schaul, tom@idsia.ch'
from random import shuffle
from pybrain.rl.learners.learner import Learner
class ES(Learner):
""" Standard evolution strategy, (mu + lambda). """
mu = 50
lambada = 50
noisy = False
def __init__(self, evaluator, e... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/learners/search/es.py",
"copies": "1",
"size": "2757",
"license": "bsd-3-clause",
"hash": -2384726042751677000,
"line_mean": 34.8181818182,
"line_max": 85,
"alpha_frac": 0.5593035909,
"autogenerated": false,
"ratio": 3.8830985915492957,
... |
__author__ = ('Julian Togelius, julian@idsia.ch',
'Justin S Bayer, bayer.justin@googlemail.com')
import scipy
import logging
from pybrain.optimization.optimizer import ContinuousOptimizer
def fullyConnected(lst):
return dict((i, lst) for i in lst)
def ring(lst):
leftist = lst[1:] + lst[0:1]
... | {
"repo_name": "jackru/pybrain",
"path": "pybrain/optimization/populationbased/pso.py",
"copies": "26",
"size": "4252",
"license": "bsd-3-clause",
"hash": 1280173701687945500,
"line_mean": 30.7313432836,
"line_max": 83,
"alpha_frac": 0.6215898401,
"autogenerated": false,
"ratio": 4.049523809523809... |
__author__ = 'Julian Togelius, julian@idsia.ch'
from pybrain.rl.environments import Environment
from math import sqrt
import socket
import string
from scipy import zeros
class SimpleraceEnvironment(Environment):
firstCarScore = 0
secondCarScore = 0
lastStepCurrentWp = [0, 0]
lastStepNextWp = [0, ... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/environments/simplerace/simpleracetcp.py",
"copies": "3",
"size": "4102",
"license": "mit",
"hash": 132299884973456270,
"line_mean": 36.2909090909,
"line_max": 153,
"alpha_frac": 0.5134080936,
"autogenerated": fa... |
__author__ = 'julien'
import SimpleITK as sitk
import numpy as np
# from __future__ import print_function
import matplotlib.pyplot as plt
# %matplotlib inline
# from IPython.html.widgets import interact, fixed
OUTPUT_DIR = "Output"
print(sitk.Version())
import numpy as np
def point2str(point, precision=1):
"... | {
"repo_name": "neuropoly/spinalcordtoolbox",
"path": "dev/itk_transfo/mat_to_displacement.py",
"copies": "1",
"size": "6848",
"license": "mit",
"hash": 2181437980637365000,
"line_mean": 39.7619047619,
"line_max": 193,
"alpha_frac": 0.6931950935,
"autogenerated": false,
"ratio": 3.2907256126862086... |
__author__ = 'julius'
import numbers
class Classifier:
'''
Takes a feature vector and and a post as input,
then computes the difference between the ideal feature vector and the
post features
--> maybe there are some features that are leading to multiple feature vectors, f.e. if a=10 then b=true e... | {
"repo_name": "jgonsior/reddit-web-crawler",
"path": "Classifier.py",
"copies": "1",
"size": "8739",
"license": "mit",
"hash": -3069438536177531000,
"line_mean": 53.2857142857,
"line_max": 207,
"alpha_frac": 0.5507495137,
"autogenerated": false,
"ratio": 4.055220417633411,
"config_test": false,... |
__author__ = 'julius'
import sqlite3
import json
import numbers
import datetime
import re
import dateutil.parser
from User import User
from Post import Post
class DbConnector:
""" Class that encapsulates all the database connection """
def __init__(self):
self.locale_connection = sqlite3.connect('f... | {
"repo_name": "jgonsior/reddit-web-crawler",
"path": "DbConnector.py",
"copies": "1",
"size": "17627",
"license": "mit",
"hash": 5280029514925217000,
"line_mean": 43.0625,
"line_max": 304,
"alpha_frac": 0.4897588652,
"autogenerated": false,
"ratio": 4.623557187827912,
"config_test": false,
"h... |
__author__ = 'julius'
import threading
from queue import Queue
import pprint
import numbers
import matplotlib.pyplot as pyplot
import matplotlib
import DbConnector
import Trainer
import Classifier
lock = threading.Lock()
k_list = [10] # try different ones!, even 0
'''
weights = {"nComments": 3.19,
"in... | {
"repo_name": "jgonsior/reddit-web-crawler",
"path": "Main.py",
"copies": "1",
"size": "8335",
"license": "mit",
"hash": 2920430352342443000,
"line_mean": 30.938697318,
"line_max": 119,
"alpha_frac": 0.5580083983,
"autogenerated": false,
"ratio": 3.4371134020618554,
"config_test": false,
"has... |
__author__ = 'juliusskye'
import os, sys
sys.path.append('..')
from py.Rectangle import Rectangle
from py.CompareRectangles import CompareRectangles
from PIL import Image
import glob
import cv2
from scipy import misc
import numpy as np
import os.path
import time
class SimpleTest(object):
def __init__(self,a,b):
... | {
"repo_name": "jskye/car-classifier-research",
"path": "src/hyp.verification.tools/py/test/SimpleTest.py",
"copies": "1",
"size": "9699",
"license": "mit",
"hash": 8464950691844972000,
"line_mean": 32.9125874126,
"line_max": 163,
"alpha_frac": 0.552324982,
"autogenerated": false,
"ratio": 3.00185... |
__author__ = 'July'
# http://agiliq.com/blog/2013/09/understanding-threads-in-python/
import time
import threading
from threading import Thread
from threading import Lock
lock = Lock()
class CreateListThreadBad(Thread):
def run(self):
self.entries = []
for i in range(10):
time.sleep(1)
... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "ThreadPrac/ListThread.py",
"copies": "1",
"size": "1390",
"license": "apache-2.0",
"hash": 2954219098777951000,
"line_mean": 23.8392857143,
"line_max": 65,
"alpha_frac": 0.5856115108,
"autogenerated": false,
"ratio": 3.7669376693766936,
"config... |
__author__ = 'July'
# http://agiliq.com/blog/2013/09/understanding-threads-in-python/
#define a global variable
from threading import Thread
from threading import Lock
some_var = 0
lock = Lock()
class IncrementThreadRace(Thread):
def run(self):
#we want to read a global variable
#and then increme... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "ThreadPrac/URL_RACE_CONDITION.py",
"copies": "1",
"size": "1651",
"license": "apache-2.0",
"hash": -2707890400527178000,
"line_mean": 27.9824561404,
"line_max": 76,
"alpha_frac": 0.6178073895,
"autogenerated": false,
"ratio": 3.5202558635394454,
... |
__author__ = 'July'
# http://chriskiehl.com/article/parallelism-in-one-line/
# http://jeffknupp.com/blog/2013/06/30/pythons-hardest-problem-revisited/
# http://www.dabeaz.com/python/UnderstandingGIL.pdf
'''
The idea is simple: if a single instance of the Python interpreter is constrained by the GIL,
one can achieve gai... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "ThreadPrac/multiProcessing.py",
"copies": "1",
"size": "2850",
"license": "apache-2.0",
"hash": 4844164292969880000,
"line_mean": 31.3977272727,
"line_max": 117,
"alpha_frac": 0.7,
"autogenerated": false,
"ratio": 3.249714937286203,
"config_tes... |
__author__ = 'July'
# http://chriskiehl.com/article/parallelism-in-one-line/
import time
import threading
import Queue
import urllib2
class Consumer(threading.Thread):
def __init__(self, queue):
threading.Thread.__init__(self)
self._queue = queue
def run(self):
while True:
content = self._queue.... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "ThreadPrac/ConsumerProducerThreadPool.py",
"copies": "1",
"size": "1178",
"license": "apache-2.0",
"hash": 3066739752636141600,
"line_mean": 21.6538461538,
"line_max": 63,
"alpha_frac": 0.6349745331,
"autogenerated": false,
"ratio": 3.31830985915... |
__author__ = 'July'
# http://chriskiehl.com/article/parallelism-in-one-line/
'''
Standard Producer/Consumer Threading Pattern
'''
import time
import threading
import Queue
class Consumer(threading.Thread):
def __init__(self, queue):
threading.Thread.__init__(self)
self._queue = queue
def run(self):
w... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "ThreadPrac/ConsumerProducerJava.py",
"copies": "1",
"size": "1549",
"license": "apache-2.0",
"hash": 5618633408098995000,
"line_mean": 24.8166666667,
"line_max": 60,
"alpha_frac": 0.642995481,
"autogenerated": false,
"ratio": 3.6107226107226107,
... |
__author__ = 'July'
# http://www.bogotobogo.com/python/Multithread/python_multithreading_Event_Objects_between_Threads.php
"""
"""
import threading
import time
import logging
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-9s) %(message)s',)
def wait_for_event(e):
logging.debu... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "ThreadPrac/EventObj.py",
"copies": "1",
"size": "1223",
"license": "apache-2.0",
"hash": -547409480735486100,
"line_mean": 27.4651162791,
"line_max": 102,
"alpha_frac": 0.5838103025,
"autogenerated": false,
"ratio": 3.514367816091954,
"config_t... |
__author__ = 'July'
# http://www.bogotobogo.com/python/Multithread/python_multithreading_Synchronization_Lock_Objects_Acquire_Release.php
import threading
import time
import logging
import random
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-9s) %(message)s',)
class Counter(objec... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "ThreadPrac/Locker.py",
"copies": "1",
"size": "1278",
"license": "apache-2.0",
"hash": -2573357809263477000,
"line_mean": 27.4222222222,
"line_max": 117,
"alpha_frac": 0.5993740219,
"autogenerated": false,
"ratio": 3.8035714285714284,
"config_t... |
__author__ = 'July'
# http://www.bogotobogo.com/python/Multithread/python_multithreading_Synchronization_Semaphore_Objects_Thread_Pool.php
import threading
import time
import logging
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-9s) %(message)s',)
class ThreadPool(object):
de... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "ThreadPrac/semaphore.py",
"copies": "1",
"size": "1153",
"license": "apache-2.0",
"hash": -3741757194388915700,
"line_mean": 30.1891891892,
"line_max": 118,
"alpha_frac": 0.6079791847,
"autogenerated": false,
"ratio": 3.637223974763407,
"config... |
__author__ = 'July'
import threading
import time
import logging
FORMAT = '[%(levelname)s %(asctime)-8s] (%(threadName)-30s) %(message)s'
logging.basicConfig(level=logging.DEBUG, format=FORMAT, )
#more about logging https://docs.python.org/2/library/logging.html
def f(id):
logging.debug('Starting')
time.slee... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "ThreadPrac/ThreadBasic.py",
"copies": "1",
"size": "1790",
"license": "apache-2.0",
"hash": -1345945604734769400,
"line_mean": 27.8709677419,
"line_max": 112,
"alpha_frac": 0.648603352,
"autogenerated": false,
"ratio": 3.3457943925233646,
"conf... |
__author__ = 'July'
import time
import urllib2
import threading
# Single threaded way:
class singleThread:
def get_responses(self):
urls = ['http://www.google.com', 'http://www.amazon.com', 'http://www.ebay.com', 'http://www.facebook.com', 'https://en.wikipedia.org/wiki/Main_Page']
start = time.ti... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "ThreadPrac/ThreadWithUrl.py",
"copies": "1",
"size": "1990",
"license": "apache-2.0",
"hash": -6029072935952385000,
"line_mean": 35.8518518519,
"line_max": 158,
"alpha_frac": 0.664321608,
"autogenerated": false,
"ratio": 3.7977099236641223,
"co... |
__author__ = 'July'
"""
Condition object allows one or more threads to wait until notified by another thread. Taken from here.
Consumer should wait when the queue is empty and resume only when it gets notified by the producer.
Producer should notify only after it adds something to the queue.
So after notification fro... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "ThreadPrac/ConsumerProducerConditionMaxSize.py",
"copies": "1",
"size": "3005",
"license": "apache-2.0",
"hash": 232620659001813700,
"line_mean": 39.6216216216,
"line_max": 126,
"alpha_frac": 0.6579034942,
"autogenerated": false,
"ratio": 4.41911... |
__author__ = 'July'
# Explanantion: python is neither both pass by value nor pass by ref
# In Python a variable is not an alias for a location in memory. Rather, it is simply a binding to a Python object.
'''
"call-by-object," or "call-by-object-reference" is a more accurate way of describing it.
In Python, (almost) e... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "newQ/playground.py",
"copies": "1",
"size": "1775",
"license": "apache-2.0",
"hash": -2094916474842420700,
"line_mean": 26.75,
"line_max": 127,
"alpha_frac": 0.5650704225,
"autogenerated": false,
"ratio": 3.3745247148288975,
"config_test": fals... |
__author__ = 'July'
# http://interactivepython.org/courselib/static/pythonds/SortSearch/TheQuickSort.html
class t1:
def quickSort(self, alist):
self.quickSortHelper(alist,0,len(alist)-1)
def quickSortHelper(self, alist,first,last):
if first<last:
splitpoint = self.partition(alist,fir... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "cs15211/0Note_QuickSort.py",
"copies": "1",
"size": "3999",
"license": "apache-2.0",
"hash": 8459596274303771000,
"line_mean": 35.6972477064,
"line_max": 93,
"alpha_frac": 0.4863715929,
"autogenerated": false,
"ratio": 4.33261105092091,
"config... |
__author__ = 'July'
import threading
import logging
import random
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-0s) %(message)s',)
def show(d):
try:
val = d.val
except AttributeError:
logging.debug('No value yet')
else:
logging.debug('value=%s... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "ThreadPrac/threading_local.py",
"copies": "1",
"size": "1274",
"license": "apache-2.0",
"hash": -6388872348642104000,
"line_mean": 18.303030303,
"line_max": 61,
"alpha_frac": 0.5604395604,
"autogenerated": false,
"ratio": 3.3177083333333335,
"c... |
__author__ = 'July'
import threading
import time
import logging
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-9s) %(message)s',)
def locker(lock):
logging.debug('Starting')
while True:
lock.acquire()
try:
logging.debug('Locking')
t... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "ThreadPrac/Locker2.py",
"copies": "1",
"size": "1316",
"license": "apache-2.0",
"hash": 1743878351266263300,
"line_mean": 24.8235294118,
"line_max": 73,
"alpha_frac": 0.5463525836,
"autogenerated": false,
"ratio": 3.8705882352941177,
"config_te... |
__author__ = 'July'
import threading
import time
import logging
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-9s) %(message)s',)
def wait_for_event(e):
logging.debug('wait_for_event starting')
event_is_set = e.wait()
logging.debug('event set: %s', event_is_set)
def ... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "ThreadPrac/Event.py",
"copies": "1",
"size": "1112",
"license": "apache-2.0",
"hash": -6933971971104008000,
"line_mean": 26.825,
"line_max": 61,
"alpha_frac": 0.5647482014,
"autogenerated": false,
"ratio": 3.5641025641025643,
"config_test": fal... |
__author__ = 'July'
q = '''
第一题跟leetcode的merge interval很像,要求返回总区间去重后的累积长度 leetcode 56,57
第二题跟word break很像。要求写一个split函数如下
List<String> split(String s, List<String>)
根据第二个参数去分割字符串.
eg 输入"abcdefg", ["c", "ef"]
返回 [''ab", "d", "g"]
然后问的是偏System design,high level描述一个系统,有前端网页dashboard,
每次用户登陆的时候都要选一个系统里的问题叫everyday questi... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "newQ/Twitch.py",
"copies": "1",
"size": "4590",
"license": "apache-2.0",
"hash": -8726784981702121000,
"line_mean": 28.8257575758,
"line_max": 126,
"alpha_frac": 0.5950203252,
"autogenerated": false,
"ratio": 2.4661654135338344,
"config_test": ... |
__author__ = 'July'
# return all sub set of a set
class Solution:
#recursion
def getSubSets(self, bigset, index):
allsubset = []
if len(bigset) == index:
allsubset.append([])
else:
allsubset = self.getSubSets(bigset, index + 1)
item = bigset[index]
... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "cc150/getSubSet.py",
"copies": "1",
"size": "1206",
"license": "apache-2.0",
"hash": 2952092741688447000,
"line_mean": 23.612244898,
"line_max": 58,
"alpha_frac": 0.4610281924,
"autogenerated": false,
"ratio": 4.074324324324325,
"config_test": ... |
__author__ = 'July'
# write a method to compute all permutation of a string
# write a methof to compute all combinatino of a string
import re
class Solution:
# no ordering
def getPermutation(self, str):
result = self.getPermutationRecu(str)
for i in xrange(len(result)):
result[i] = re... | {
"repo_name": "JulyKikuAkita/PythonPrac",
"path": "cc150/PermutationOfString.py",
"copies": "1",
"size": "1563",
"license": "apache-2.0",
"hash": 53924844658002420,
"line_mean": 27.4363636364,
"line_max": 69,
"alpha_frac": 0.527831094,
"autogenerated": false,
"ratio": 4.007692307692308,
"config... |
__author__ = 'junaid'
import sys
import os.path
import logging
# Program variables
HOME_DIR = os.path.expanduser('~')
DEFAULT_DB_FILE_NAME = 'onebackup.db'
# Logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
def main():
logger.info("Launching OneBackup")
return 0
def con... | {
"repo_name": "junaidali/onebackup",
"path": "src/onebackup/app.py",
"copies": "1",
"size": "1278",
"license": "mit",
"hash": 7061673323871113000,
"line_mean": 30.975,
"line_max": 115,
"alpha_frac": 0.6885758998,
"autogenerated": false,
"ratio": 3.956656346749226,
"config_test": true,
"has_no... |
__author__ = 'Junhaaooooo'
import sys
from PyQt4 import QtCore, QtGui
from genPopUp import Ui_genPopup
from Crypto.PublicKey import RSA
import ConfigParser
import os
class KeyGeneratorUI(QtGui.QMainWindow):
def setIconImage(self):
app_icon = QtGui.QIcon()
app_icon.addFile('images/cryptoknocker_resi... | {
"repo_name": "bb111189/CryptoKnocker",
"path": "Client/keyGeneratorDialog.py",
"copies": "1",
"size": "2605",
"license": "mit",
"hash": 3189509710567805000,
"line_mean": 35.1944444444,
"line_max": 83,
"alpha_frac": 0.6310940499,
"autogenerated": false,
"ratio": 3.5980662983425415,
"config_test... |
'''
Sudoku Backtracking algorithm
'''
from collections import deque
import math
#Init sudoku grid
Grid = [['-' for h in range(9)] for v in range(9)]
#Create queue
queue = deque()
#Setup
def Setup(fileName):
sudokuFile = open(fileName, "r")
#populate grid from the txt file
for h in range(9):
i = 0
sudoku... | {
"repo_name": "JunJi-T/SudokuBackTrack",
"path": "SudokuBackTrack.py",
"copies": "1",
"size": "2380",
"license": "mit",
"hash": -1328517590679129000,
"line_mean": 16.9022556391,
"line_max": 76,
"alpha_frac": 0.5705882353,
"autogenerated": false,
"ratio": 2.6298342541436464,
"config_test": false... |
__author__ = 'Junki Ishida'
from mbserializer import Model
from mbserializer.fields import attribute_fields as attrs, element_fields as elems, list_fields as lists, text_fields as texts
class NoElementChild(Model):
__tag__ = 'nechild'
__xmlns__ = 'http://mbserializer.com/nechild'
str_text = texts.Str()
... | {
"repo_name": "gomafutofu/mbserializer",
"path": "mbserializer/tests/models.py",
"copies": "2",
"size": "1705",
"license": "mit",
"hash": -733092468863214700,
"line_mean": 28.3965517241,
"line_max": 126,
"alpha_frac": 0.6498533724,
"autogenerated": false,
"ratio": 3.396414342629482,
"config_tes... |
__author__ = 'juraseg'
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, FormRequest
from product_spiders.items import Product, ProductLoader
import logging
import re
class CurrysCoUkSpiderSagemcom(BaseSpider):
name = 'currys.co.uk_sagemcom'
... | {
"repo_name": "ddy88958620/lib",
"path": "Python/scrapy/sagemcom/curryscouk_sagemcom.py",
"copies": "2",
"size": "4744",
"license": "apache-2.0",
"hash": -7735508295026135000,
"line_mean": 41.3571428571,
"line_max": 127,
"alpha_frac": 0.5984401349,
"autogenerated": false,
"ratio": 3.1128608923884... |
__author__ = 'juraseg'
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, FormRequest
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from product_spiders.items import Product, ProductLoader
import logging
cla... | {
"repo_name": "ddy88958620/lib",
"path": "Python/scrapy/sagemcom/dixonscouk.py",
"copies": "2",
"size": "4737",
"license": "apache-2.0",
"hash": -5380033805497064000,
"line_mean": 41.6756756757,
"line_max": 127,
"alpha_frac": 0.6092463585,
"autogenerated": false,
"ratio": 3.075974025974026,
"co... |
__author__ = 'juraseg'
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request
from product_spiders.items import Product, ProductLoader
import logging
class AsdaComSpider(BaseSpider):
name = 'asda.com'
allowed_domains = ['asda.com']
start_urls =... | {
"repo_name": "0--key/lib",
"path": "portfolio/Python/scrapy/sagemcom/asdacom.py",
"copies": "2",
"size": "4141",
"license": "apache-2.0",
"hash": 1901310417605083100,
"line_mean": 38.4380952381,
"line_max": 122,
"alpha_frac": 0.5568703212,
"autogenerated": false,
"ratio": 3.8271719038817005,
"... |
__author__ = 'juraseg'
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from product_spiders.items import Product, ProductLoader
import logging
class AmazonCoUk... | {
"repo_name": "0--key/lib",
"path": "portfolio/Python/scrapy/sagemcom/amazoncouk_sagemcom.py",
"copies": "2",
"size": "8271",
"license": "apache-2.0",
"hash": 3948568436550821000,
"line_mean": 49.7423312883,
"line_max": 214,
"alpha_frac": 0.5966630395,
"autogenerated": false,
"ratio": 2.917460317... |
__author__ = 'Jus'
import string
import math
import json
class string_challenges:
def __init__(self):
self.string_input_1 = None
self.string_input_2 = None
self.string_output = None
self.boolean_return = None
self.hash_table_1 = {}
self.hash_table_2 = {}
s... | {
"repo_name": "jssandh2/String_Challenges",
"path": "strings_manipulations.py",
"copies": "1",
"size": "8110",
"license": "apache-2.0",
"hash": 765098077499971300,
"line_mean": 42.8378378378,
"line_max": 110,
"alpha_frac": 0.4728729963,
"autogenerated": false,
"ratio": 3.689717925386715,
"confi... |
__author__ = 'juspreetsandhu1'
# NOTES:
# 1) The solution has comments in order to explain most functions in a fair amount of detail.
# 2) The solution generously uses hash-maps.
# 3) Time Complexity:
# - Assuming the existence of a good hash-function, SET, UNSET, BEGIN, GET, NUMEQUALTO all run in O(1) time.
# - R... | {
"repo_name": "jssandh2/Timestamp_Database",
"path": "final_database.py",
"copies": "1",
"size": "9620",
"license": "apache-2.0",
"hash": 1867801517197691400,
"line_mean": 44.8095238095,
"line_max": 119,
"alpha_frac": 0.5641372141,
"autogenerated": false,
"ratio": 3.942622950819672,
"config_tes... |
__author__ = 'justasic'
from django.db import models
from django.contrib.auth.models import User
from NutmegCRM.apps.crm.models import Customer
class Ticket(models.Model):
"""
This is the ticket model used for customer tickets.
The ticket crm is fairly simple. You have customer information linked in the ... | {
"repo_name": "Justasic/NutmegCRM",
"path": "NutmegCRM/apps/tickets/models.py",
"copies": "1",
"size": "2737",
"license": "bsd-2-clause",
"hash": -8798973187776253000,
"line_mean": 33.225,
"line_max": 95,
"alpha_frac": 0.6382900986,
"autogenerated": false,
"ratio": 3.838709677419355,
"config_te... |
__author__ = 'justasic'
from django.shortcuts import render, render_to_response
from django.http import HttpResponse
from django.template.context import RequestContext
from NutmegCRM.apps.crm.models import Customer
from NutmegCRM.apps.tickets.models import Ticket, Comment
from NutmegCRM.apps.crm.models import Customer... | {
"repo_name": "Justasic/NutmegCRM",
"path": "NutmegCRM/apps/overview/views.py",
"copies": "1",
"size": "1295",
"license": "bsd-2-clause",
"hash": -750458223954240600,
"line_mean": 31.4,
"line_max": 100,
"alpha_frac": 0.7127413127,
"autogenerated": false,
"ratio": 3.8656716417910446,
"config_tes... |
__author__ = 'justasic'
from django.shortcuts import render_to_response, render, get_object_or_404, get_list_or_404
from django.http import HttpResponse
from NutmegCRM.apps.crm.models import Customer
from NutmegCRM.apps.tickets.models import Ticket, Comment
from django.template.context import RequestContext
from django... | {
"repo_name": "Justasic/NutmegCRM",
"path": "NutmegCRM/apps/tickets/views.py",
"copies": "1",
"size": "1504",
"license": "bsd-2-clause",
"hash": 4810317571174958000,
"line_mean": 31.0212765957,
"line_max": 91,
"alpha_frac": 0.71875,
"autogenerated": false,
"ratio": 3.8564102564102565,
"config_t... |
__author__ = 'justasic'
# Django settings for StackSmash project.
import os
from django.core.exceptions import ImproperlyConfigured
# Always assume Debug is false for non-production.
DEBUG = False
TEMPLATE_DEBUG = DEBUG
# Some useful functions.
def rel_path(p):
return os.path.join(os.path.abspath(os.path.split(_... | {
"repo_name": "Justasic/StackSmash",
"path": "StackSmash/settings/base.py",
"copies": "1",
"size": "5765",
"license": "bsd-2-clause",
"hash": -7568449394029203000,
"line_mean": 32.323699422,
"line_max": 105,
"alpha_frac": 0.7092801388,
"autogenerated": false,
"ratio": 3.5498768472906406,
"confi... |
__author__ = 'justasic'
# To make your own dev file, copy this one and tell manage.py to run with
# the following option:
# ./manage.py [whatever] --settings=StackSmash.settings.dev_justasic
#
# Where dev_justasic is the python file you made.
from .dev import *
# Our settings key
SECRET_KEY = 'j3yo7knxot%4g#0(3&e_y!... | {
"repo_name": "Justasic/StackSmash",
"path": "StackSmash/settings/dev_nix.py",
"copies": "1",
"size": "1514",
"license": "bsd-2-clause",
"hash": 5663644622769819000,
"line_mean": 36.875,
"line_max": 131,
"alpha_frac": 0.6657859974,
"autogenerated": false,
"ratio": 3.3056768558951966,
"config_te... |
__author__ = 'justicesuh'
import requests, json, time
class SMSBomber:
PLIVO = 0
TWILIO = 1
plivo_url = "https://api.plivo.com/v1/Account/%s/Message/"
twilio_url = "https://api.twilio.com/2010-04-01/Accounts/%s/Messages.json"
def __init__(self, service, auth_id, auth_token):
self.service = service
self.au... | {
"repo_name": "justicesuh/smsbomber",
"path": "smsbomber.py",
"copies": "1",
"size": "1688",
"license": "mit",
"hash": 3914656627673225000,
"line_mean": 28.1206896552,
"line_max": 101,
"alpha_frac": 0.6546208531,
"autogenerated": false,
"ratio": 2.726978998384491,
"config_test": false,
"has_n... |
__author__ = 'justinarmstrong'
import copy
import pygame as pg
from .. import setup, observer, tools
from .. import constants as c
class NextArrow(pg.sprite.Sprite):
"""Flashing arrow indicating more dialogue"""
def __init__(self):
super(NextArrow, self).__init__()
self.image = setup.GFX['fanc... | {
"repo_name": "2Guys1Python/Project-Cacophonum",
"path": "data/components/textbox.py",
"copies": "1",
"size": "12461",
"license": "mit",
"hash": -6471809714696638000,
"line_mean": 39.5895765472,
"line_max": 89,
"alpha_frac": 0.519781719,
"autogenerated": false,
"ratio": 4.155051683894632,
"conf... |
__author__ = 'justinarmstrong'
import os, random, copy
import pygame as pg
from . import constants as c
from entityclasses import *
from compositeclasses import *
class Control(object):
"""
Control class for entire project. Contains the game loop, and contains
the event_loop which passes events to States... | {
"repo_name": "2Guys1Python/Project-Cacophonum",
"path": "data/tools.py",
"copies": "1",
"size": "8193",
"license": "mit",
"hash": -5517265666953073000,
"line_mean": 30.5115384615,
"line_max": 81,
"alpha_frac": 0.5874527035,
"autogenerated": false,
"ratio": 3.551365409622887,
"config_test": fal... |
__author__ = 'justinarmstrong'
import os, random
import pygame as pg
from . import constants as c
class Control(object):
"""
Control class for entire project. Contains the game loop, and contains
the event_loop which passes events to States as needed. Logic for flipping
states is also found here.
... | {
"repo_name": "justinmeister/The-Stolen-Crown-RPG",
"path": "data/tools.py",
"copies": "1",
"size": "7996",
"license": "mit",
"hash": 69219354874041850,
"line_mean": 30.234375,
"line_max": 81,
"alpha_frac": 0.5212606303,
"autogenerated": false,
"ratio": 3.9062042012701514,
"config_test": false,... |
__author__ = 'Justin Bayer, bayer.justin@googlemail.com'
# TODO: fails with this error:
#scipy.weave.build_tools.CompileError: error: Command "g++ -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -fPIC -I/usr/lib/python2.5/site-packages/scipy/weave -I/usr/lib/python2.5/site-packages/scipy/weave/scxx -I/usr/lib/pyth... | {
"repo_name": "daanwierstra/pybrain",
"path": "examples/lsh/lsh.py",
"copies": "1",
"size": "3922",
"license": "bsd-3-clause",
"hash": 4804771496589354000,
"line_mean": 34.3423423423,
"line_max": 599,
"alpha_frac": 0.6183069862,
"autogenerated": false,
"ratio": 3.404513888888889,
"config_test":... |
__author__ = 'Justin Bayer, Tom Schaul, {justin,tom}@idsia.ch'
from scipy import array
from pybrain.optimization.populationbased.ga import GA
from pybrain.tools.nondominated import non_dominated_front, crowding_distance, non_dominated_sort
# TODO: not very elegant, because of the conversions between tuples and arra... | {
"repo_name": "abhishekgahlot/pybrain",
"path": "pybrain/optimization/populationbased/multiobjective/nsga2.py",
"copies": "3",
"size": "3299",
"license": "bsd-3-clause",
"hash": -7730959926475986000,
"line_mean": 38.2738095238,
"line_max": 108,
"alpha_frac": 0.5889663534,
"autogenerated": false,
... |
__author__ = 'Justin Bayer, Tom Schaul, {justin,tom}@idsia.ch'
import collections
from scipy import array, tile, sum
def crowding_distance(individuals, fitnesses):
""" Crowding distance-measure for multiple objectives. """
distances = collections.defaultdict(lambda: 0)
individuals = list(individuals)
... | {
"repo_name": "pybrain2/pybrain2",
"path": "pybrain/tools/nondominated.py",
"copies": "25",
"size": "10020",
"license": "bsd-3-clause",
"hash": 2183038763623935700,
"line_mean": 33.7951388889,
"line_max": 97,
"alpha_frac": 0.5746506986,
"autogenerated": false,
"ratio": 3.5108619481429573,
"conf... |
import sys
import Image, ImageDraw
def georgbarep(origvalue):
r,b,g = georgbrep(origvalue)
return (r,g,b,255)
def georgbrep(origvalue):
value = origvalue
if value <= 0:
raise InternalError('value '+str(value)+' is not allowed for count')
if value == 1:
return (192,192,192)
if value <= 10:
r... | {
"repo_name": "SeattleTestbed/ipinfo",
"path": "drawmap.py",
"copies": "1",
"size": "2485",
"license": "mit",
"hash": 4955604275917887000,
"line_mean": 21.7981651376,
"line_max": 75,
"alpha_frac": 0.6317907445,
"autogenerated": false,
"ratio": 2.754988913525499,
"config_test": false,
"has_no_... |
__author__ = "Justin Fear"
__copyright__ = "Copyright 2016, Justin Fear"
__email__ = "justin.m.fear@gmail.com"
__license__ = "MIT"
from snakemake.shell import shell
try:
extra = snakemake.params.extra
except AttributeError:
extra = ""
if snakemake.log:
log = "> {} 2>&1".format(snakemake.log)
else:
lo... | {
"repo_name": "lcdb/lcdb-workflows",
"path": "wrappers/bowtie2/align/wrapper.py",
"copies": "1",
"size": "1361",
"license": "mit",
"hash": -2000888948034888000,
"line_mean": 27.3541666667,
"line_max": 99,
"alpha_frac": 0.6605437179,
"autogenerated": false,
"ratio": 3.0447427293064875,
"config_t... |
__author__ = 'Justin McClure'
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from random import choice
from lib.api_calls import APIException
class AccountPickupViewsTestCase(TestCase):
fixtures = ['AccountPickup_views_test_data.json']
HOST = 'testserver'
INDEX = r... | {
"repo_name": "hhauer/myinfo",
"path": "AccountPickup/tests/test_views.py",
"copies": "1",
"size": "15908",
"license": "mit",
"hash": 6343401221935781000,
"line_mean": 42.7032967033,
"line_max": 109,
"alpha_frac": 0.63408348,
"autogenerated": false,
"ratio": 3.3532883642495785,
"config_test": t... |
__author__ = 'justin'
import re
TAG_OPEN = '{'
TAG_CLOSE = '}'
def parse_tags_from_string(string):
pattern = '(' + TAG_OPEN + '.*?' + TAG_CLOSE + ')'
matches = re.findall(pattern, string)
return matches
def build_string_from_collection(template, collection):
string = template
tags = parse_tags... | {
"repo_name": "Shapeways/coyote_framework",
"path": "coyote_framework/util/apps/templating/template.py",
"copies": "1",
"size": "1437",
"license": "mit",
"hash": -5041249639221839000,
"line_mean": 29.5744680851,
"line_max": 85,
"alpha_frac": 0.5831593598,
"autogenerated": false,
"ratio": 4.165217... |
__author__ = 'justin'
import urllib2
def validate_url(url, allowed_response_codes=None):
"""Validates that the url can be opened and responds with an allowed response code; ignores javascript: urls
url -- the string url to ping
allowed_response_codes -- a list of response codes that the validator will i... | {
"repo_name": "Shapeways/coyote_framework",
"path": "coyote_framework/mixins/URLValidator.py",
"copies": "1",
"size": "1364",
"license": "mit",
"hash": -5048185509551986000,
"line_mean": 34.9210526316,
"line_max": 112,
"alpha_frac": 0.6920821114,
"autogenerated": false,
"ratio": 4.249221183800623... |
__author__ = 'justin'
class Locator(object):
ID = 'id'
CSS = 'css'
XPATH = 'xpath'
CLASS_NAME = 'class_name'
LINK_TEXT = 'link_text'
PARTIAL_LINK_TEXT = 'partial_link_text'
NAME = 'name'
TAG_NAME = 'tag_name'
TEXT = 'text'
PARTIAL_TEXT = 'partial_text'
def __init__(self, ... | {
"repo_name": "Shapeways/coyote_framework",
"path": "coyote_framework/webdriver/webdriverwrapper/support/locator.py",
"copies": "1",
"size": "1063",
"license": "mit",
"hash": 9021063532719222000,
"line_mean": 30.2941176471,
"line_max": 87,
"alpha_frac": 0.5954844779,
"autogenerated": false,
"rati... |
__author__ = 'justin'
def encode_collection(collection, encoding='utf-8'):
"""Encodes all the string keys and values in a collection with specified encoding"""
if isinstance(collection, dict):
return dict((encode_collection(key), encode_collection(value)) for key, value in collection.iteritems())
... | {
"repo_name": "Shapeways/coyote_framework",
"path": "coyote_framework/mixins/stringconversion.py",
"copies": "1",
"size": "1613",
"license": "mit",
"hash": -3877691069488944600,
"line_mean": 42.6216216216,
"line_max": 119,
"alpha_frac": 0.6831990081,
"autogenerated": false,
"ratio": 4.22251308900... |
__author__ = 'Justin S Bayer, bayer.justin@googlemail.com'
from pybrain.structure.connections.connection import Connection
from pybrain.structure.parametercontainer import ParameterContainer
class LinearConnection(Connection, ParameterContainer):
"""Connection that just forwards by multiplying the output of the... | {
"repo_name": "cmorgan/pybrain",
"path": "pybrain/structure/connections/linear.py",
"copies": "2",
"size": "1675",
"license": "bsd-3-clause",
"hash": 2086080599094945800,
"line_mean": 39.8536585366,
"line_max": 105,
"alpha_frac": 0.6847761194,
"autogenerated": false,
"ratio": 4.197994987468672,
... |
__author__ = 'Justin Scholz'
__copyright__ = "Copyright 2015 - 2017, Justin Scholz"
def recognize_user_input_yes_or_no(user_choice: str, default: bool):
user_input_understood = False
yes = str
no = str
user_choice_answer = "x"
if default:
yes = ""
no = "no"
elif not default:
... | {
"repo_name": "JMoVS/JUMP",
"path": "UserInput.py",
"copies": "1",
"size": "12906",
"license": "mit",
"hash": -3127569087227712500,
"line_mean": 45.4244604317,
"line_max": 126,
"alpha_frac": 0.593134976,
"autogenerated": false,
"ratio": 4.273509933774834,
"config_test": false,
"has_no_keyword... |
__author__ = 'jvial'
import pandas as pd
import numpy as np
lith = pd.read_csv('corrected_lithology.csv')
geo = pd.read_csv('Complete_Geophysics.csv')
# Read in all ATV data once.
atv_dictionary = {}
print('Read in lith and geo')
def get_label(bore_id, depth, rtype=False):
"""
Function to get the label, wil... | {
"repo_name": "johnny555/2d3g",
"path": "utils.py",
"copies": "1",
"size": "7610",
"license": "bsd-2-clause",
"hash": 94097754452458000,
"line_mean": 29.0790513834,
"line_max": 95,
"alpha_frac": 0.4536136662,
"autogenerated": false,
"ratio": 2.9291762894534257,
"config_test": false,
"has_no_k... |
__author__ = "jwely"
from datetime import datetime
from metric import time_series
from metric.textio.read_ds3505 import read_DS3505
def extract_wx_data(time_obj, wx_path):
"""
This function was writen to reenstate wx file parsing for tha greed upon NOAA
obsgrid data format for any study area within the ... | {
"repo_name": "dgketchum/MT_Rsense",
"path": "metric/extract_wx_data.py",
"copies": "1",
"size": "2995",
"license": "apache-2.0",
"hash": 6782516120536691000,
"line_mean": 40.0273972603,
"line_max": 129,
"alpha_frac": 0.6393989983,
"autogenerated": false,
"ratio": 3.1659619450317127,
"config_te... |
__author__ = 'Jwely'
from py.tex import csv_to_tex
from py.config import *
import os
def build_tex_tables():
"""
Execution of this file will build .tex files from .csv files in in the `tables`
directory. The function calls have been simplified as much as possible to allow
nicely formatted tables that... | {
"repo_name": "Jwely/pivpr",
"path": "py/controler/build_tex_tables.py",
"copies": "1",
"size": "1842",
"license": "mit",
"hash": 5825735872112886000,
"line_mean": 38.1914893617,
"line_max": 103,
"alpha_frac": 0.6340933768,
"autogenerated": false,
"ratio": 3.759183673469388,
"config_test": fals... |
__author__ = 'Jwely'
from py.tex import TeXRunFigurePage
from py.piv import construct_experiments
from py.piv import shorthand_to_tex as stt
from py.config import *
from py.utils import merge_dicts
def build_tex_figs_by_run(run_id, include_cartesian=False, include_dynamic=False, force_recalc=False):
"""
Mast... | {
"repo_name": "Jwely/pivpr",
"path": "py/controler/build_tex_figs_by_run.py",
"copies": "1",
"size": "12068",
"license": "mit",
"hash": 3198591378265488000,
"line_mean": 55.3925233645,
"line_max": 136,
"alpha_frac": 0.6001823003,
"autogenerated": false,
"ratio": 3.198515769944341,
"config_test"... |
__author__ = 'Jwely'
from py.utils.get_rel_humidity import get_rel_humidity
import json
class Experiment:
def __init__(self, experiment_id, n_samples, z_location, v_nominal, dt, test_date,
v_fs_mean, v_fs_sigma, q, pres_atm, temp_tunnel, wet_bulb, dry_bulb, eta_p):
"""
Class to ... | {
"repo_name": "Jwely/pivpr",
"path": "py/piv/Experiment.py",
"copies": "1",
"size": "3592",
"license": "mit",
"hash": -5920908922608271000,
"line_mean": 41.7619047619,
"line_max": 107,
"alpha_frac": 0.6105233853,
"autogenerated": false,
"ratio": 3.5078125,
"config_test": true,
"has_no_keyword... |
__author__ = "Jwely"
from scipy import interpolate, signal
import numpy as np
def smooth_filt(x, y, numpoints, M, std, convolve_mode='same', order=1):
"""
smooths noisy point data
:param x: x series
:param y: y series
:param numpoints: length of vectors, proporti... | {
"repo_name": "Jwely/pivpr",
"path": "py/utils/smooth_filt.py",
"copies": "1",
"size": "1431",
"license": "mit",
"hash": -8915087793709976000,
"line_mean": 28.8125,
"line_max": 96,
"alpha_frac": 0.5981830887,
"autogenerated": false,
"ratio": 3.542079207920792,
"config_test": false,
"has_no_ke... |
__author__ = 'Jwely'
# general imports
import cPickle
import os
import math
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
import matplotlib.ticker as mtick
# package imports
from shorthand_to_tex import shorthand_to_tex
from py.piv.MeanVecFieldCartesian import MeanVecFieldCa... | {
"repo_name": "Jwely/pivpr",
"path": "py/piv/AxialVortex.py",
"copies": "1",
"size": "62472",
"license": "mit",
"hash": 3683001718880439300,
"line_mean": 44.9352941176,
"line_max": 121,
"alpha_frac": 0.573488923,
"autogenerated": false,
"ratio": 3.5547968589962444,
"config_test": false,
"has_... |
__author__ = 'Jwely'
import json
import numpy as np
from matplotlib import pyplot as plt
from py.piv import VecFieldCartesian
class ArtificialVecField(VecFieldCartesian):
"""
Class for evaluating performance of PIV to resolve images synthesized
by the ArtificialPIV class with precisely known particle mo... | {
"repo_name": "Jwely/pivpr",
"path": "py/uncertainty/ArtificialVecField.py",
"copies": "1",
"size": "5496",
"license": "mit",
"hash": 7270081266818182000,
"line_mean": 37.7112676056,
"line_max": 103,
"alpha_frac": 0.5900655022,
"autogenerated": false,
"ratio": 3.9426111908177903,
"config_test":... |
__author__ = "Jwely"
import math
import numpy
class LambOseenVortex:
def __init__(self, circulation_strength, viscosity):
"""
Creates a Lamb Oseen vortex
:param circulation_strength: The circulation strength of the vortex
:param viscosity: The kinematic viscosity ... | {
"repo_name": "Jwely/pivpr",
"path": "py/vortex_theory/LambOseenVortex.py",
"copies": "1",
"size": "3487",
"license": "mit",
"hash": 6221639623613457000,
"line_mean": 38.6363636364,
"line_max": 115,
"alpha_frac": 0.6111270433,
"autogenerated": false,
"ratio": 3.819277108433735,
"config_test": f... |
__author__ = "Jwely"
import math
class AshVortex:
def __init__(self, core_radius, circulation_strength=None, viscosity=None,
pressure_relaxation=None, vtheta_max=None):
"""
Based on work by Robert Ash, Irfan Zardadkhan, Allan Zuckerwar in
"The influence of pressure relaxa... | {
"repo_name": "Jwely/pivpr",
"path": "py/vortex_theory/AshVortex.py",
"copies": "1",
"size": "2746",
"license": "mit",
"hash": -5888086255898278000,
"line_mean": 30.5632183908,
"line_max": 108,
"alpha_frac": 0.5870356883,
"autogenerated": false,
"ratio": 3.77716643741403,
"config_test": false,
... |
__author__ = "Jwely"
import math
class RankineVortex:
def __init__(self, core_radius, circulation_strength):
"""
Creates a Rankine vortex
:param core_radius: the core radius in (meters)
:param circulation_strength: the circulation strength of the vortex
:return:
"... | {
"repo_name": "Jwely/pivpr",
"path": "py/vortex_theory/RankineVortex.py",
"copies": "1",
"size": "1061",
"license": "mit",
"hash": -1909211235128788700,
"line_mean": 26.2051282051,
"line_max": 75,
"alpha_frac": 0.5975494816,
"autogenerated": false,
"ratio": 3.6586206896551725,
"config_test": fa... |
__author__ = "Jwely"
import numpy as np
import math
def dbz(a, b):
"""
divides two nd arrays element wise, but returns 0 if either denomenator
or numerator is zero.
:param a: the numerator
:param b: the denominator
:return: a / b
"""
if isinstance(a, np.ma.MaskedArray):
m... | {
"repo_name": "Jwely/pivpr",
"path": "py/utils/get_spatial_derivative.py",
"copies": "1",
"size": "1788",
"license": "mit",
"hash": 6736078420906519000,
"line_mean": 23.1621621622,
"line_max": 87,
"alpha_frac": 0.5598434004,
"autogenerated": false,
"ratio": 2.6968325791855206,
"config_test": fa... |
__author__ = 'Jwely'
import os
from libtiff import TIFF
def scale_array(array, new_min, new_max, type="linear"):
"""
simple numeric scaling function to adjust the dynamic range
of some input set.
:param array: array
:param new_min: new maximum value for input array
:param new_max: new mini... | {
"repo_name": "Jwely/pivpr",
"path": "py/utils/tiff_tools.py",
"copies": "1",
"size": "1526",
"license": "mit",
"hash": 6643881917699756000,
"line_mean": 22.859375,
"line_max": 68,
"alpha_frac": 0.6114023591,
"autogenerated": false,
"ratio": 3.4446952595936793,
"config_test": false,
"has_no_k... |
__author__ = 'Jwely'
import os
from py.piv import AxialVortex
def construct_axial_vortex(v3d_dir, pkl_dir, name_tag, include_dynamic=False,
velocity_fs=None, z_location=None, eta_p=None, min_points=20, force_recalc=False):
"""
Returns an AxialVortex instance. Manages pickling of cl... | {
"repo_name": "Jwely/pivpr",
"path": "py/piv/construct_axial_vortex.py",
"copies": "1",
"size": "2852",
"license": "mit",
"hash": 1403691758602924500,
"line_mean": 49.9464285714,
"line_max": 109,
"alpha_frac": 0.6788218794,
"autogenerated": false,
"ratio": 3.4993865030674844,
"config_test": fal... |
__author__ = 'Jwely'
import os
from py.tex.TeXWriter import TeXWriter
from py.piv import Experiment, shorthand_to_tex
class TeXRunFigurePage(TeXWriter):
def __init__(self, main_path, tex_title, experiment_instance, force_recalc=False):
"""
This class uses constructors to build up a data set from ... | {
"repo_name": "Jwely/pivpr",
"path": "py/tex/TeXRunFigurePage.py",
"copies": "1",
"size": "11215",
"license": "mit",
"hash": 9050051327802290000,
"line_mean": 46.5254237288,
"line_max": 118,
"alpha_frac": 0.641997325,
"autogenerated": false,
"ratio": 3.92407277816655,
"config_test": false,
"h... |
__author__ = 'Jwely'
import os
from py.uncertainty import ArtificialPIV
from py.config import *
def synthesize_piv_uncertainty_images(uncertainty_image_dir):
"""
Builds a bunch of test images for monte carlo uncertainty analysis. This function
creates outputs specifically to work with Insight PIV softwar... | {
"repo_name": "Jwely/pivpr",
"path": "py/controler/synthesize_piv_uncertainty_images.py",
"copies": "1",
"size": "2023",
"license": "mit",
"hash": 4940135040657056000,
"line_mean": 38.6666666667,
"line_max": 101,
"alpha_frac": 0.5580820564,
"autogenerated": false,
"ratio": 3.68488160291439,
"co... |
__author__ = 'Jwely'
import os
from TeXFigureGenerator import TeXFigureGenerator
class TeXWriter:
def __init__(self, main_path, texfile_path):
self.main_path = os.path.abspath(main_path)
self.texfile_path = os.path.abspath(texfile_path)
self.content = [] # a list of content s... | {
"repo_name": "Jwely/pivpr",
"path": "py/tex/TeXWriter.py",
"copies": "1",
"size": "2467",
"license": "mit",
"hash": 5437553514199299000,
"line_mean": 33.7464788732,
"line_max": 93,
"alpha_frac": 0.5747871909,
"autogenerated": false,
"ratio": 4.160202360876897,
"config_test": false,
"has_no_k... |
__author__ = "Jwely"
import os
import json
import pandas as pd
from py.tex import csv_to_tex
from py.piv import construct_experiments
from py.config import *
def process_experiments(outname, table_caption, ids=None, min_points=DEFAULT_MIN_POINTS,
include_dynamic=False, force_recalc=False):
... | {
"repo_name": "Jwely/pivpr",
"path": "py/controler/process_experiments.py",
"copies": "1",
"size": "2688",
"license": "mit",
"hash": -3538526363642433500,
"line_mean": 39.1194029851,
"line_max": 119,
"alpha_frac": 0.5621279762,
"autogenerated": false,
"ratio": 3.1810650887573964,
"config_test":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.