text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'bakeneko'
import pygame
# Initialize Pygame
pygame.init()
# Set the height and width of the screen
screen_width = 640
screen_height = 480
screen = pygame.display.set_mode([screen_width, screen_height])
logo = pygame.image.load('test_logo.png')
sound = pygame.mixer.Sound('test_sound.ogg')
sound_chann... | {
"repo_name": "nekotiko/workshop_env",
"path": "test/test.py",
"copies": "1",
"size": "1226",
"license": "mit",
"hash": 1772931837571929900,
"line_mean": 20.5087719298,
"line_max": 73,
"alpha_frac": 0.6386623165,
"autogenerated": false,
"ratio": 2.9613526570048307,
"config_test": false,
"has_... |
__author__ = 'bakl'
# CGS
class phys:
h = 6.626068e-27 # erg s
c = 2.9979245800e10 # cm/s
k = 1.3806504e-16 # erg K^-1
sigma_SB = 5.6704e-5 # erg cm^-2 s^-1 K^-4, Stefan-Boltzman Constant
H0 = 68 # Hubble constant [km/c/Mpc]
G = 6.6743e-8 # Newton's gravitational constant cm3 g-1 s-2
... | {
"repo_name": "baklanovp/pystella",
"path": "pystella/util/phys_var.py",
"copies": "1",
"size": "2067",
"license": "mit",
"hash": -5217704563311572000,
"line_mean": 27.8309859155,
"line_max": 100,
"alpha_frac": 0.5847581827,
"autogenerated": false,
"ratio": 2.4456391875746712,
"config_test": fa... |
from bokeh.plotting import *
from bokeh.models import HoverTool, ColumnDataSource
import pandas as pd
from collections import OrderedDict
datafile = pd.read_csv("./annual_averages_by_state.csv")
populations = pd.DataFrame(data=datafile, columns=['STATE','TOTAL_POPULATION'])
employed = pd.DataFrame(data=datafile, co... | {
"repo_name": "OSHADataDoor/OshaBokeh",
"path": "bokehsamples/scattermap2.py",
"copies": "1",
"size": "4783",
"license": "apache-2.0",
"hash": -5106794308927897000,
"line_mean": 32.9290780142,
"line_max": 121,
"alpha_frac": 0.4952958394,
"autogenerated": false,
"ratio": 4.20298769771529,
"confi... |
from bokeh.sampledata import us_states
from bokeh.plotting import *
from bokeh.models import HoverTool, ColumnDataSource
import pandas as pd
from collections import OrderedDict
########################################################################
# Loading us_states from bokeh sampledata library.
# Removing Ala... | {
"repo_name": "OSHADataDoor/OshaBokeh",
"path": "bokehsamples/heatmap.py",
"copies": "1",
"size": "3472",
"license": "apache-2.0",
"hash": -5314071018251472000,
"line_mean": 31.4485981308,
"line_max": 121,
"alpha_frac": 0.4683179724,
"autogenerated": false,
"ratio": 4.09433962264151,
"config_te... |
########################################################################
# Wrote this file to separate out the loading of the data from the
# python file where the actual display happens
########################################################################
import pandas as pd
import csv
#######################... | {
"repo_name": "OSHADataDoor/OshaBokeh",
"path": "bokehsamples/osha_files.py",
"copies": "1",
"size": "2378",
"license": "apache-2.0",
"hash": 2424964485674786300,
"line_mean": 29.4871794872,
"line_max": 95,
"alpha_frac": 0.4007569386,
"autogenerated": false,
"ratio": 5.55607476635514,
"config_t... |
__author__ = 'baniu.yao@gmail.com'
import hashlib
import re
import os
import argparse
class LogKeywordCheck(object):
""" A simple tool to check if keywords exist in log files.
This tool is able to read file at the position it read last time and
it can read keyword from file and command line args.
"""
... | {
"repo_name": "baniuyao/python-log-keyword-check",
"path": "log_keyword_check.py",
"copies": "1",
"size": "5956",
"license": "mit",
"hash": 7011796058342724000,
"line_mean": 35.3170731707,
"line_max": 108,
"alpha_frac": 0.5691739422,
"autogenerated": false,
"ratio": 4.0683060109289615,
"config_... |
__author__ = 'baohua'
from oslo_config import cfg
from tripled.common import config #noqa
from tripled.common.log import error
from tripled.common.credential import get_creds
import keystoneclient.v2_0.client as ksclient
class KeystoneClient(object):
"""
KeystoneClient: client to get keystone resources.
... | {
"repo_name": "yeasy/tripled",
"path": "tripled/stack/keystone.py",
"copies": "1",
"size": "1618",
"license": "apache-2.0",
"hash": 556864122979526300,
"line_mean": 27.8928571429,
"line_max": 70,
"alpha_frac": 0.5784919654,
"autogenerated": false,
"ratio": 4.065326633165829,
"config_test": fals... |
__author__ = 'baohua'
from oslo_config import cfg
from tripled.stack.node import Control, Network, Compute
from tripled.stack.keystone import KeystoneClient
from tripled.stack.nova import NovaClient
from tripled.stack.neutron import NeutronClient
class Stack(object):
"""
An instance of the operational stack... | {
"repo_name": "yeasy/tripled",
"path": "tripled/stack/stack.py",
"copies": "1",
"size": "1681",
"license": "apache-2.0",
"hash": -8217433225972517000,
"line_mean": 27.0166666667,
"line_max": 94,
"alpha_frac": 0.6139202855,
"autogenerated": false,
"ratio": 3.9552941176470586,
"config_test": fals... |
__author__ = 'baohua'
from subprocess import PIPE, Popen
from tripled.common.constants import NODE_ROLES
class Node(object):
"""
An instance of the server in the stack.
"""
def __init__(self, ip, role):
self.ip = ip
self.role = NODE_ROLES.get(role, NODE_ROLES['compute'])
def is... | {
"repo_name": "yeasy/tripled",
"path": "tripled/stack/node.py",
"copies": "1",
"size": "1453",
"license": "apache-2.0",
"hash": -782027910157479600,
"line_mean": 22.0634920635,
"line_max": 86,
"alpha_frac": 0.5581555403,
"autogenerated": false,
"ratio": 3.5876543209876544,
"config_test": false,... |
__author__ = 'baohua'
from tripled.common.credential import get_creds
class ServiceClient(object):
"""
ServiceClient :client to get service resources.
"""
def __init__(self, username=None, tenant_name=None, password=None,
auth_url=None):
d = get_creds()
if d:
... | {
"repo_name": "yeasy/tripled",
"path": "tripled/stack/service_client.py",
"copies": "1",
"size": "1559",
"license": "apache-2.0",
"hash": -4742778416026847000,
"line_mean": 31.4791666667,
"line_max": 79,
"alpha_frac": 0.5490699166,
"autogenerated": false,
"ratio": 3.8304668304668303,
"config_te... |
__author__ = 'baohua'
from tripled.common.log import warn, info, output
from tripled.common.case import Case
class UnderlayConnectivity(Case):
"""
UnderlayConnectivity : the case to detect underlay connectivity problem.
"""
def __init__(self):
super(UnderlayConnectivity, self).__init__()
... | {
"repo_name": "yeasy/tripled",
"path": "tripled/case/system/underlay_connectivity.py",
"copies": "1",
"size": "1672",
"license": "apache-2.0",
"hash": -6616190255260927000,
"line_mean": 33.8333333333,
"line_max": 78,
"alpha_frac": 0.5675837321,
"autogenerated": false,
"ratio": 4.26530612244898,
... |
__author__ = 'baohua'
from tripled.common.log import warn, info, output
from tripled.stack.stack import stack as the_stack
from tripled.common.util import color_str
import sys
class Case(object):
"""
A check case.
"""
def __init__(self, stack=the_stack):
self.success_msg = []
self.fa... | {
"repo_name": "yeasy/tripled",
"path": "tripled/common/case.py",
"copies": "1",
"size": "1506",
"license": "apache-2.0",
"hash": 5465549019019218000,
"line_mean": 27.9615384615,
"line_max": 90,
"alpha_frac": 0.5610889774,
"autogenerated": false,
"ratio": 3.585714285714286,
"config_test": false,... |
__author__ = 'baohua'
import logging
import sys
import types
from oslo_config import cfg
from tripled.common import config # do not remove this line
OUTPUT = 25
LEVELS = {'debug': logging.DEBUG,
'info': logging.INFO,
'output': OUTPUT,
'warning': logging.WARNING,
'error': logg... | {
"repo_name": "yeasy/tripled",
"path": "tripled/common/log.py",
"copies": "1",
"size": "4266",
"license": "apache-2.0",
"hash": 4320883797026556000,
"line_mean": 30.3676470588,
"line_max": 78,
"alpha_frac": 0.5881387717,
"autogenerated": false,
"ratio": 3.8781818181818184,
"config_test": false,... |
__author__ = 'baohua'
import novaclient.v1_1.client as novaclient
from tripled.stack.service_client import ServiceClient
class NovaClient(ServiceClient):
"""
NovaClient :client to get nova resources.
"""
def __init__(self, username=None, tenant_name=None, password=None,
auth_url=Non... | {
"repo_name": "yeasy/tripled",
"path": "tripled/stack/nova.py",
"copies": "1",
"size": "1078",
"license": "apache-2.0",
"hash": 6094419769053550000,
"line_mean": 30.7058823529,
"line_max": 92,
"alpha_frac": 0.5500927644,
"autogenerated": false,
"ratio": 4.178294573643411,
"config_test": false,
... |
__author__ = 'baohua'
import os
from oslo_config import cfg
from tripled.common import config #noqa
def get_creds():
"""Get the Keystone credentials.
:param : none
:returns: a map of credentials or None
"""
d = {}
cfg.CONF(project='tripled')
AUTH = cfg.CONF.AUTH
d['username'] = AUTH... | {
"repo_name": "yeasy/tripled",
"path": "tripled/common/credential.py",
"copies": "1",
"size": "1349",
"license": "apache-2.0",
"hash": 6494320867109138000,
"line_mean": 34.5,
"line_max": 82,
"alpha_frac": 0.5767234989,
"autogenerated": false,
"ratio": 3.6361185983827493,
"config_test": false,
... |
__author__ = 'baohua'
import pkgutil
import subprocess
from tripled.common.log import warn, debug, info, error, output
def color_str(color, raw_str):
"""Format a string with color.
:param color: a color name, can be r, g, b or y
:param raw_str: the string to be formatted
:returns: a colorful string
... | {
"repo_name": "yeasy/tripled",
"path": "tripled/common/util.py",
"copies": "1",
"size": "1977",
"license": "apache-2.0",
"hash": -8445964601010291000,
"line_mean": 24.3461538462,
"line_max": 78,
"alpha_frac": 0.5528578655,
"autogenerated": false,
"ratio": 3.562162162162162,
"config_test": false... |
__author__ = 'baranbartu'
from django.conf import settings
from celery.app.control import Control
from utils import import_object, nested_method
class CeleryClient(object):
_application = None
_control = None
_default_queue = None
def __init__(self):
path = getattr(settings, 'CELERY_APPLICAT... | {
"repo_name": "baranbartu/djcelery-admin",
"path": "sample_project/celeryadmin/client.py",
"copies": "2",
"size": "5152",
"license": "mit",
"hash": -2382648969230712000,
"line_mean": 29.3058823529,
"line_max": 77,
"alpha_frac": 0.5114518634,
"autogenerated": false,
"ratio": 4.654019873532069,
"... |
__author__ = 'baranbartu'
import datetime
from client import CeleryClient
class ContextManager(object):
_client = None
# _dashboard and _tasks are mutable and same object for each instance
# so one instance will be used on the scope always
_dashboard = {}
_events = {}
# todo find a better way... | {
"repo_name": "baranbartu/djcelery-admin",
"path": "celeryadmin/context.py",
"copies": "2",
"size": "2096",
"license": "mit",
"hash": -3157099993042204000,
"line_mean": 31.2461538462,
"line_max": 77,
"alpha_frac": 0.5682251908,
"autogenerated": false,
"ratio": 4.1836327345309385,
"config_test":... |
__author__ = 'baranbartu'
import os
import logging
import inspect
import linecache
from memgraph.plot import make_plot
from memgraph.utils import make_csv, remove_file
logger = logging.getLogger(__name__)
def determine_memory_info(prof, precision=1):
logs = []
for code in prof.code_map:
lines = prof... | {
"repo_name": "baranbartu/memgraph",
"path": "memgraph/profile.py",
"copies": "1",
"size": "2024",
"license": "bsd-2-clause",
"hash": -526635885364405060,
"line_mean": 36.4814814815,
"line_max": 78,
"alpha_frac": 0.5528656126,
"autogenerated": false,
"ratio": 4.039920159680639,
"config_test": f... |
__author__ = 'baranbartu'
import threading
import time
from celery.events import EventReceiver
class EventListener(threading.Thread):
def __init__(self, celery_client, context_manager, enable_events=False):
threading.Thread.__init__(self)
self.daemon = True
self.celery_client = celery_cl... | {
"repo_name": "baranbartu/djcelery-admin",
"path": "sample_project/celeryadmin/events.py",
"copies": "2",
"size": "1272",
"license": "mit",
"hash": 7888891892090209000,
"line_mean": 30.8,
"line_max": 76,
"alpha_frac": 0.5652515723,
"autogenerated": false,
"ratio": 4.608695652173913,
"config_tes... |
__author__ = 'baranbartu'
def import_object(object_path):
"""imports and returns given class string.
:param object_path: Class path as string
:type object_path: str
:returns: Class that has given path
:rtype: class
:Example:
>>> import_object('collections.OrderedDict').__name__
'Or... | {
"repo_name": "baranbartu/djcelery-admin",
"path": "sample_project/celeryadmin/utils.py",
"copies": "2",
"size": "1074",
"license": "mit",
"hash": -6719141217791618000,
"line_mean": 28.027027027,
"line_max": 69,
"alpha_frac": 0.6415270019,
"autogenerated": false,
"ratio": 4.037593984962406,
"co... |
__author__ = 'bartek'
import numpy
class NumpyRow(object):
def __init__(self, array):
self.v = array
def __iter__(self):
for i, el in enumerate(numpy.nditer(self.v)):
if el:
yield i
class NumpyMatrix(object):
def __init__(self, array):
self._m = arr... | {
"repo_name": "szredinger/graph-constr-group-testing",
"path": "graph_constr_group_testing/block_design/matrix_operations.py",
"copies": "1",
"size": "2525",
"license": "mit",
"hash": -6843268085168112000,
"line_mean": 26.7472527473,
"line_max": 103,
"alpha_frac": 0.5912871287,
"autogenerated": fal... |
__author__ = 'bartek'
from py2neo import Relationship
class Security:
def __init__(self):
pass
KNOWS = "KNOWS"
SECURITY = "SECURITY"
IS_MEMBER_OF = "IS_MEMBER_OF"
def __int__(self):
pass
@staticmethod
def create_permission(db, entity, resource, permissions):
se... | {
"repo_name": "mobile2015/neoPyth",
"path": "app/models/security.py",
"copies": "1",
"size": "1214",
"license": "bsd-2-clause",
"hash": 4861220892020832000,
"line_mean": 22.3461538462,
"line_max": 88,
"alpha_frac": 0.6169686985,
"autogenerated": false,
"ratio": 3.878594249201278,
"config_test":... |
from .instance_manager import VRouterHostedManager
from vnc_api.vnc_api import *
from .config_db import VirtualRouterSM, VirtualMachineSM
# Manager for service instances (Docker or KVM) hosted on selected vrouter
class VRouterInstanceManager(VRouterHostedManager):
def _associate_vrouter(self, si, vm):
vro... | {
"repo_name": "eonpatapon/contrail-controller",
"path": "src/config/svc-monitor/svc_monitor/vrouter_instance_manager.py",
"copies": "5",
"size": "2470",
"license": "apache-2.0",
"hash": -8180703730598770000,
"line_mean": 35.3235294118,
"line_max": 75,
"alpha_frac": 0.5534412955,
"autogenerated": fa... |
from .instance_manager import VRouterHostedManager
from vnc_api.vnc_api import *
class VRouterInstanceManager(VRouterHostedManager):
"""
Manager for service instances (Docker or KVM) hosted on selected VRouter
"""
def create_service(self, st_obj, si_obj):
self.logger.log_info("Creating new VR... | {
"repo_name": "srajag/contrail-controller",
"path": "src/config/svc-monitor/svc_monitor/vrouter_instance_manager.py",
"copies": "2",
"size": "4367",
"license": "apache-2.0",
"hash": 8680883868515995000,
"line_mean": 44.4895833333,
"line_max": 79,
"alpha_frac": 0.5321731166,
"autogenerated": false,
... |
import string
import re
import sgmllib
from Bio import File
from Bio.WWW import NCBI
result_handle = NCBI.query(search_command, search_database, term = search_term,doptcmdl = return_format)
search_command = 'Search'
search_database = 'Nucleotide'
return_format = 'FASTA'
search_term = 'Cypripedioideae'
my_browser = 'l... | {
"repo_name": "dziq/biopython",
"path": "scripts/script_test.py",
"copies": "1",
"size": "1032",
"license": "mit",
"hash": 3048500326382344000,
"line_mean": 26.1578947368,
"line_max": 104,
"alpha_frac": 0.6889534884,
"autogenerated": false,
"ratio": 2.789189189189189,
"config_test": false,
"h... |
__author__ = 'basca'
from cysparql import *
import time
q = '''
SELECT ?mail ?phone ?doctor
WHERE {
?professor <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#emailAddress> ?mail .
?professor <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#telephone> ?phone .
?professor <http:... | {
"repo_name": "cosminbasca/cysparql",
"path": "utils/bench_query.py",
"copies": "1",
"size": "4515",
"license": "apache-2.0",
"hash": 8494159827042808000,
"line_mean": 32.4518518519,
"line_max": 162,
"alpha_frac": 0.6631229236,
"autogenerated": false,
"ratio": 2.3626373626373627,
"config_test":... |
__author__ = 'bashao'
import os
import sys
import time
import random
import pickle
import smbus
import time
from temperature import Temperature
import RPi.GPIO as GPIO
import subprocess
import traceback
from Daemon import Daemon
from Logger import Logger
class OpticBubble(Daemon):
#Temp vars
DEVICESDIR = "/sy... | {
"repo_name": "bashao/FermBot",
"path": "OpticBubble.py",
"copies": "1",
"size": "5995",
"license": "mit",
"hash": -1724236513128511200,
"line_mean": 36.46875,
"line_max": 112,
"alpha_frac": 0.470058382,
"autogenerated": false,
"ratio": 3.9833887043189367,
"config_test": false,
"has_no_keywor... |
import logging
# BMP280 default address.
BMP280_I2CADDR = 0x77
BMP280_CHIPID = 0xD0
# BMP280 Registers
BMP280_DIG_T1 = 0x88 # R Unsigned Calibration data (16 bits)
BMP280_DIG_T2 = 0x8A # R Signed Calibration data (16 bits)
BMP280_DIG_T3 = 0x8C # R Signed Calibration data (16 bits)
BMP280_DIG_P1 = 0x8E # R... | {
"repo_name": "josecastroleon/GroveWeatherPi",
"path": "Adafruit_Python_BMP/Adafruit_BMP/BMP280.py",
"copies": "1",
"size": "6652",
"license": "apache-2.0",
"hash": -5876016160522723000,
"line_mean": 39.3151515152,
"line_max": 89,
"alpha_frac": 0.5963619964,
"autogenerated": false,
"ratio": 2.735... |
__author__ = 'Batchu Vishal'
from person import Person
'''
This class defines our player.
It inherits from the Person class since a Player is also a person.
We specialize the person by adding capabilities such as jump etc..
'''
class Player(Person):
def __init__(self, raw_image, position):
super(Player, ... | {
"repo_name": "erilyth/PyGame-Learning-Environment",
"path": "ple/games/donkeykong/player.py",
"copies": "1",
"size": "3213",
"license": "mit",
"hash": 3629559074728778000,
"line_mean": 46.9552238806,
"line_max": 143,
"alpha_frac": 0.5751633987,
"autogenerated": false,
"ratio": 4.092993630573249,... |
__author__ = 'Batchu Vishal'
from .person import Person
'''
This class defines our player.
It inherits from the Person class since a Player is also a person.
We specialize the person by adding capabilities such as jump etc..
'''
class Player(Person):
def __init__(self, raw_image, position, width, height):
... | {
"repo_name": "ntasfi/PyGame-Learning-Environment",
"path": "ple/games/monsterkong/player.py",
"copies": "1",
"size": "3438",
"license": "mit",
"hash": -8764624992329837000,
"line_mean": 44.84,
"line_max": 97,
"alpha_frac": 0.5497382199,
"autogenerated": false,
"ratio": 4.213235294117647,
"conf... |
__author__ = 'Batchu Vishal'
import pygame
import math
import sys
import os
from person import Person
from onBoard import OnBoard
from coin import Coin
from player import Player
from fireball import Fireball
from donkeyKongPerson import DonkeyKongPerson
'''
This class defines our gameboard.
A gameboard contains evert... | {
"repo_name": "erilyth/PyGame-Learning-Environment",
"path": "ple/games/donkeykong/board.py",
"copies": "1",
"size": "15880",
"license": "mit",
"hash": 1802422882069176600,
"line_mean": 47.2674772036,
"line_max": 193,
"alpha_frac": 0.5920654912,
"autogenerated": false,
"ratio": 3.616488271464359,... |
__author__ = 'Batchu Vishal'
import pygame
import math
import sys
import os
from .person import Person
from .onBoard import OnBoard
from .coin import Coin
from .player import Player
from .fireball import Fireball
from .monsterPerson import MonsterPerson
class Board(object):
'''
This class defines our gameboa... | {
"repo_name": "ntasfi/PyGame-Learning-Environment",
"path": "ple/games/monsterkong/board.py",
"copies": "1",
"size": "15293",
"license": "mit",
"hash": 8642456087992719000,
"line_mean": 42.0788732394,
"line_max": 126,
"alpha_frac": 0.5541751128,
"autogenerated": false,
"ratio": 3.8472955974842766... |
__author__ = 'Batchu Vishal'
import pygame
import math
import sys
import os
from person import Person
from onBoard import OnBoard
from coin import Coin
from player import Player
from fireball import Fireball
from monsterPerson import MonsterPerson
class Board(object):
'''
This class defines our gameboard.
... | {
"repo_name": "EndingCredits/PyGame-Learning-Environment",
"path": "ple/games/monsterkong/board.py",
"copies": "1",
"size": "15240",
"license": "mit",
"hash": -4423587379266991600,
"line_mean": 41.9295774648,
"line_max": 126,
"alpha_frac": 0.5539370079,
"autogenerated": false,
"ratio": 3.85627530... |
__author__ = 'Batchu Vishal'
import pygame
import os
from onBoard import OnBoard
class Coin(OnBoard):
"""
This class defines all our coins.
Each coin will increase our score by an amount of 'value'
We animate each coin with 5 images
A coin inherits from the OnBoard class since we will use it as an... | {
"repo_name": "EndingCredits/PyGame-Learning-Environment",
"path": "ple/games/monsterkong/coin.py",
"copies": "1",
"size": "1899",
"license": "mit",
"hash": 362283883979458300,
"line_mean": 44.2142857143,
"line_max": 129,
"alpha_frac": 0.6192733017,
"autogenerated": false,
"ratio": 3.471663619744... |
__author__ = 'Batchu Vishal'
import pygame
import os
from .onBoard import OnBoard
class Coin(OnBoard):
"""
This class defines all our coins.
Each coin will increase our score by an amount of 'value'
We animate each coin with 5 images
A coin inherits from the OnBoard class since we will use it as a... | {
"repo_name": "ntasfi/PyGame-Learning-Environment",
"path": "ple/games/monsterkong/coin.py",
"copies": "1",
"size": "1900",
"license": "mit",
"hash": 7498105909886675000,
"line_mean": 44.2380952381,
"line_max": 129,
"alpha_frac": 0.6189473684,
"autogenerated": false,
"ratio": 3.4671532846715327,
... |
__author__ = 'Batchu Vishal'
import pygame
import os
from onBoard import OnBoard
'''
This class defines all our coins.
Each coin will increase our score by an amount of 'value'
We animate each coin with 5 images
A coin inherits from the OnBoard class since we will use it as an inanimate object on our board.
'''
clas... | {
"repo_name": "erilyth/PyGame-Learning-Environment",
"path": "ple/games/donkeykong/coin.py",
"copies": "1",
"size": "1873",
"license": "mit",
"hash": -248175072479729150,
"line_mean": 43.5952380952,
"line_max": 128,
"alpha_frac": 0.6289375334,
"autogenerated": false,
"ratio": 3.411657559198543,
... |
__author__ = 'Batchu Vishal'
import pygame
import sys
from pygame.constants import K_a, K_d, K_SPACE, K_w, K_s, QUIT, KEYDOWN
from .board import Board
#from ..base import base
#from ple.games import base
from ple.games.base.pygamewrapper import PyGameWrapper
import numpy as np
import os
class MonsterKong(PyGameWrappe... | {
"repo_name": "ntasfi/PyGame-Learning-Environment",
"path": "ple/games/monsterkong/__init__.py",
"copies": "1",
"size": "9882",
"license": "mit",
"hash": -5214852733424396000,
"line_mean": 41.9652173913,
"line_max": 104,
"alpha_frac": 0.5297510625,
"autogenerated": false,
"ratio": 4.0417177914110... |
__author__ = 'Batchu Vishal'
import pygame
import sys
from pygame.constants import K_a, K_d, K_SPACE, K_w, K_s, QUIT, KEYDOWN
from board import Board
from .. import base
import numpy as np
import os
class MonsterKong(base.PyGameWrapper):
def __init__(self):
"""
Parameters
----------
... | {
"repo_name": "EndingCredits/PyGame-Learning-Environment",
"path": "ple/games/monsterkong/__init__.py",
"copies": "1",
"size": "9803",
"license": "mit",
"hash": 1008047170254557200,
"line_mean": 41.9956140351,
"line_max": 104,
"alpha_frac": 0.527287565,
"autogenerated": false,
"ratio": 4.04748142... |
__author__ = 'Batchu Vishal'
import pygame
import sys
from pygame.locals import K_a, K_d, K_SPACE, K_w, K_s, QUIT, KEYDOWN
from board import Board
from .. import base
import numpy as np
import os
'''
This class defines the logic of the game and how player input is taken etc
We run one instance of this class at the sta... | {
"repo_name": "erilyth/PyGame-Learning-Environment",
"path": "ple/games/donkeykong/__init__.py",
"copies": "1",
"size": "9974",
"license": "mit",
"hash": 563379690036897150,
"line_mean": 45.8262910798,
"line_max": 119,
"alpha_frac": 0.5638660517,
"autogenerated": false,
"ratio": 3.894572432643498... |
__author__ = 'Batchu Vishal'
import pygame
class OnBoard(pygame.sprite.Sprite):
'''
This class defines all inanimate objects that we need to display on our board.
Any object that is on the board and not a person, comes under this class (ex. Coins,Ladders,Walls etc)
Sets up the image and its position f... | {
"repo_name": "ntasfi/PyGame-Learning-Environment",
"path": "ple/games/monsterkong/onBoard.py",
"copies": "2",
"size": "1433",
"license": "mit",
"hash": -5277542143081199000,
"line_mean": 35.7435897436,
"line_max": 113,
"alpha_frac": 0.6489881368,
"autogenerated": false,
"ratio": 4.25222551928783... |
__author__ = 'Batchu Vishal'
import pygame
'''
This class defines all inanimate objects that we need to display on our board.
Any object that is on the board and not a person, comes under this class (ex. Coins,Ladders,Walls etc)
Sets up the image and its position for all its child classes.
'''
class OnBoard(pygame.s... | {
"repo_name": "erilyth/PyGame-Learning-Environment",
"path": "ple/games/donkeykong/onBoard.py",
"copies": "1",
"size": "1403",
"license": "mit",
"hash": -645563716666976900,
"line_mean": 35.9210526316,
"line_max": 115,
"alpha_frac": 0.6585887384,
"autogenerated": false,
"ratio": 4.188059701492537... |
__author__ = 'Batchu Vishal'
import pygame
'''
This class defines all living things in the game, ex.Donkey Kong, Player etc
Each of these objects can move in any direction specified.
'''
class Person(pygame.sprite.Sprite):
def __init__(self, raw_image, position):
super(Person, self).__init__()
se... | {
"repo_name": "erilyth/PyGame-Learning-Environment",
"path": "ple/games/donkeykong/person.py",
"copies": "1",
"size": "2540",
"license": "mit",
"hash": 7303924271252697000,
"line_mean": 38.6875,
"line_max": 126,
"alpha_frac": 0.6700787402,
"autogenerated": false,
"ratio": 4.254606365159129,
"co... |
import csv
import argparse
import string
class Csv2Aiken:
"""
CSV (input) file must be formatted as follows:
Question;Answer;Index;Correct
What is the correct answer to this question?;Is it this one;A;
;Maybe this answer;B;
;Possibly this one;C;OK
...
Aiken (out... | {
"repo_name": "bateman/mood-c2a",
"path": "moodc2a/converter.py",
"copies": "1",
"size": "1995",
"license": "mit",
"hash": -2995576909646456300,
"line_mean": 28.3382352941,
"line_max": 113,
"alpha_frac": 0.5243107769,
"autogenerated": false,
"ratio": 3.5625,
"config_test": false,
"has_no_keyw... |
__author__ = 'Bauer'
from graphics import GraphicsWindow
def drawHappyFace(canvas,x,y):
canvas.setColor("yellow")
canvas.setOutline("black")
#canvas.drawOval(100, 100, 30, 30)
canvas.drawOval(x, y, 30, 30)
canvas.setColor("black")
#canvas.drawOval(108, 110, 5, 5)
canvas.drawOval... | {
"repo_name": "joanna-chen/schoolwork",
"path": "Tweets/happy_histogram.py",
"copies": "1",
"size": "3653",
"license": "mit",
"hash": -1931062101751003000,
"line_mean": 36.0520833333,
"line_max": 80,
"alpha_frac": 0.5932110594,
"autogenerated": false,
"ratio": 2.8078401229823213,
"config_test":... |
__author__ = 'bbowman@pacificbiosciences.com'
from collections import namedtuple
from base import BaseTypingReader
from utils import sorted_set, sample_from_file
HlaToolsRecord = namedtuple('HlaToolsRecord', 'name glen gtype gpctid nmis indel clen ctype cpctid type')
class HlaToolsReader(BaseTypingReader):
"""
... | {
"repo_name": "bnbowman/pbhml",
"path": "pbhml/reader/HlaToolsReader.py",
"copies": "1",
"size": "1887",
"license": "bsd-3-clause",
"hash": -1791239878121173200,
"line_mean": 28.5,
"line_max": 105,
"alpha_frac": 0.6131425543,
"autogenerated": false,
"ratio": 4.075593952483802,
"config_test": fa... |
__author__ = 'bbowman@pacificbiosciences.com'
import os
from job import SmrtAnalysisJob
from reader import HlaToolsReader
from SmrtHmlReport import SmrtHmlReport
class SmrtHmlReportWriter:
"""A Class for writing multiple HML Reports from SMRT Sequencing data
"""
def __init__(self, typing, job, output=''... | {
"repo_name": "bnbowman/pbhml",
"path": "pbhml/report/SmrtHmlReportWriter.py",
"copies": "1",
"size": "2143",
"license": "bsd-3-clause",
"hash": -2257070360166263000,
"line_mean": 31.4848484848,
"line_max": 91,
"alpha_frac": 0.6005599627,
"autogenerated": false,
"ratio": 4.193737769080235,
"con... |
__author__ = 'bbowman@pacificbiosciences.com'
import sys
import logging
LOG_FORMAT = "%(asctime)s [%(levelname)s - %(module)s] %(message)s"
TIME_FORMAT = "%Y-%m-%d %H:%M:%S"
FORMATTER = logging.Formatter( LOG_FORMAT, TIME_FORMAT )
def add_stream_handler( logger, stream=sys.stdout, log_level=logging.INFO ):
# Set... | {
"repo_name": "bnbowman/HlaTools",
"path": "src/pbhla/log.py",
"copies": "1",
"size": "1366",
"license": "bsd-3-clause",
"hash": 7307327445073533000,
"line_mean": 33.175,
"line_max": 84,
"alpha_frac": 0.6830161054,
"autogenerated": false,
"ratio": 3.4235588972431077,
"config_test": false,
"ha... |
__author__ = 'bbowman@pacificbiosciences.com'
import xml.etree.ElementTree as et
from utils import sorted_set, family_from_typing, locus_from_typing
class SmrtHmlRecord:
def __init__(self, name, sequence, typing):
self._name = name
self._sequence = sequence
self._typing = typing
se... | {
"repo_name": "bnbowman/pbhml",
"path": "pbhml/report/SmrtHmlReport.py",
"copies": "1",
"size": "4284",
"license": "bsd-3-clause",
"hash": 4035088207309334000,
"line_mean": 33.837398374,
"line_max": 110,
"alpha_frac": 0.5971055089,
"autogenerated": false,
"ratio": 3.543424317617866,
"config_tes... |
__author__ = 'bcarson'
import calendar,time
from datetime import datetime, timedelta
import os,sys
import xively
import requests
import numpy
from scipy.integrate import simps
# Input settings
XIVELY_FEED_ID = os.environ["XIVELY_FEED_ID"]
XIVELY_API_KEY = os.environ["XIVELY_API_KEY"]
xively_api = xively.XivelyAPI... | {
"repo_name": "hebenon/Shamash",
"path": "shamash.py",
"copies": "1",
"size": "5117",
"license": "apache-2.0",
"hash": -6272020048394445000,
"line_mean": 42.3644067797,
"line_max": 174,
"alpha_frac": 0.6898573383,
"autogenerated": false,
"ratio": 3.280128205128205,
"config_test": false,
"has_... |
__author__ = 'bcarson'
import logging
from threading import Timer
from signals import image_analysis, trigger_event
logger = logging.getLogger('root')
class Monitor(object):
def __init__(self, triggers, notification_delay=2):
self.triggers = triggers
self.notification_delay = notification_dela... | {
"repo_name": "hebenon/oversight",
"path": "oversight/monitor.py",
"copies": "1",
"size": "2621",
"license": "apache-2.0",
"hash": -6142605878923368000,
"line_mean": 44.2068965517,
"line_max": 124,
"alpha_frac": 0.6230446395,
"autogenerated": false,
"ratio": 4.818014705882353,
"config_test": fa... |
__author__ = 'bcox, roconnor'
import urllib2
import json
import sys
from collections import defaultdict
baseUrl = 'https://api.groupme.com/v3/'
members = defaultdict(list)
def main(args):
try:
global group_name, image_url
group_name = str(args[1])
access_token = '?token=' + str(args[2])
... | {
"repo_name": "TerraceBoys/GroupMeScripts",
"path": "killScript.py",
"copies": "1",
"size": "2191",
"license": "mit",
"hash": -5878063591179376000,
"line_mean": 37.4385964912,
"line_max": 154,
"alpha_frac": 0.6289365586,
"autogenerated": false,
"ratio": 3.5977011494252875,
"config_test": false,... |
__author__ = 'bdeggleston'
from unittest import skip
from rexpro.tests.base import BaseRexProTestCase, multi_graph
from rexpro import exceptions
class TestConnection(BaseRexProTestCase):
def test_connection_success(self):
""" Development test to aid in debugging """
conn = self.get_connection()... | {
"repo_name": "bdeggleston/rexpro-python",
"path": "rexpro/tests/test_connection.py",
"copies": "1",
"size": "4023",
"license": "mit",
"hash": 5946972977394876000,
"line_mean": 25.642384106,
"line_max": 100,
"alpha_frac": 0.5279642058,
"autogenerated": false,
"ratio": 3.9910714285714284,
"confi... |
__author__ = 'bdeggleston'
import json
import re
import struct
from uuid import uuid1, uuid4
import msgpack
from rexpro import exceptions
from rexpro import utils
class MessageTypes(object):
"""
Enumeration of RexPro send message types
"""
ERROR = 0
SESSION_REQUEST = 1
SESSION_RESPONSE = 2
... | {
"repo_name": "bdeggleston/rexpro-python",
"path": "rexpro/messages.py",
"copies": "1",
"size": "9997",
"license": "mit",
"hash": -1249220188854101500,
"line_mean": 29.2939393939,
"line_max": 135,
"alpha_frac": 0.5792737821,
"autogenerated": false,
"ratio": 4.4293309703145765,
"config_test": fa... |
__author__ = 'bdeutsch'
## do a polynomial fit on the data, calculate the goodness of tweet for each coordinate in tweetspace.
# next, find the gradient and make recommendations.
from sklearn.preprocessing import PolynomialFeatures
import numpy as np
import pandas as pd
import MySQLdb
import matplotlib.pyplot as plt
fr... | {
"repo_name": "aspera1631/TweetScore",
"path": "get_goodness.py",
"copies": "1",
"size": "3295",
"license": "mit",
"hash": 5739844371845408000,
"line_mean": 29.2293577982,
"line_max": 141,
"alpha_frac": 0.7028831563,
"autogenerated": false,
"ratio": 2.9846014492753623,
"config_test": true,
"h... |
__author__ = 'bdeutsch'
import twitter_text as tt
from ttp import ttp
import re
def get_len(list):
len1 = 0
for item in list:
len1 += len(item) + 1
return len1
def count_https(list):
count = 0
for item in list:
if item[:5] =='https':
count += 1
return count
def e... | {
"repo_name": "aspera1631/TS_web_app",
"path": "app/templates/models.py",
"copies": "1",
"size": "1718",
"license": "mit",
"hash": 3385105104428604400,
"line_mean": 28.1355932203,
"line_max": 116,
"alpha_frac": 0.5768335274,
"autogenerated": false,
"ratio": 3.2293233082706765,
"config_test": fa... |
__author__ = 'bdeutsch'
## Calculates and saves the gradient given a "goodness" matrix that measures the quality of every tweet in tweetspace
import numpy as np
import pandas as pd
# function that converts coordinates to index
def make_index(coord):
#new_ind = ""
new_ind = str(coord)
return new_ind
#... | {
"repo_name": "aspera1631/TweetScore",
"path": "gradient.py",
"copies": "1",
"size": "2454",
"license": "mit",
"hash": -5985336824246518000,
"line_mean": 28.9268292683,
"line_max": 117,
"alpha_frac": 0.630399348,
"autogenerated": false,
"ratio": 3.6681614349775784,
"config_test": false,
"has_... |
__author__ = 'bdeutsch'
import json
import MySQLdb
import numpy as np
import pandas as pd
import re
import twitter_text as tt
from ttp import ttp
# Function to replace "&" with "&"
def replace_codes(text):
newtext = text.replace('&','&').replace('>','>').replace('<','<')
return newtext
# Coun... | {
"repo_name": "aspera1631/TweetScore",
"path": "tweetscore.py",
"copies": "1",
"size": "12012",
"license": "mit",
"hash": 7878695082852505000,
"line_mean": 37.5032051282,
"line_max": 181,
"alpha_frac": 0.6323676324,
"autogenerated": false,
"ratio": 3.2667935817242317,
"config_test": false,
"h... |
__author__ = 'bdeutsch'
import json
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
import MySQLdb
def sql_to_df(database, table):
con = MySQLdb.connect(host='localhost', user='root', passwd='', db=database)
df = pd.read_sql_query("select... | {
"repo_name": "aspera1631/TweetScore",
"path": "make_plots.py",
"copies": "1",
"size": "7126",
"license": "mit",
"hash": 4178590702642160600,
"line_mean": 31.0990990991,
"line_max": 141,
"alpha_frac": 0.6668537749,
"autogenerated": false,
"ratio": 2.688042248208223,
"config_test": false,
"has... |
__author__ = 'bdeutsch'
import numpy as np
import pandas as pd
import MySQLdb
def import_data(sql_table):
database = "TweetScore"
table = sql_table
con = MySQLdb.connect(host='localhost', user='root', passwd='', db=database)
df = pd.read_sql_query("select * from %s" % table, con, index_col=None, coer... | {
"repo_name": "aspera1631/TweetScore",
"path": "rebin_dataframe.py",
"copies": "1",
"size": "4005",
"license": "mit",
"hash": 6950713856815547000,
"line_mean": 29.572519084,
"line_max": 141,
"alpha_frac": 0.6229712859,
"autogenerated": false,
"ratio": 2.84850640113798,
"config_test": false,
"... |
__author__ = 'bdeutsch'
import numpy as np
import pandas as pd
import MySQLdb
## Given the gradient, output a file with the top n recommendations
# Import gradient, replace NaN with a very negative gradient (will always avoid those transitions)
gradient = pd.read_pickle('gradient_prob').fillna(-100000000)
# Create ... | {
"repo_name": "aspera1631/TweetScore",
"path": "recommendations.py",
"copies": "1",
"size": "3169",
"license": "mit",
"hash": -3941668439482678300,
"line_mean": 32.7234042553,
"line_max": 254,
"alpha_frac": 0.6784474598,
"autogenerated": false,
"ratio": 3.356991525423729,
"config_test": false,
... |
__author__ = 'bdeutsch'
import numpy as np
import pandas as pd
import MySQLdb
def sql_to_df(database, table):
con = MySQLdb.connect(host='localhost', user='root', passwd='', db=database)
df = pd.read_sql_query("select * from %s" % table, con, index_col=None, coerce_float=True, params=None, parse_dates=None,... | {
"repo_name": "aspera1631/TweetScore",
"path": "prob_weights.py",
"copies": "1",
"size": "1505",
"license": "mit",
"hash": 7804725636362539000,
"line_mean": 26.8888888889,
"line_max": 141,
"alpha_frac": 0.6657807309,
"autogenerated": false,
"ratio": 2.9684418145956606,
"config_test": false,
"... |
__author__ = 'bdeutsch'
import numpy as np
import pandas as pd
def cartesian(arrays, out=None):
arrays = [np.asarray(x) for x in arrays]
dtype = arrays[0].dtype
n = np.prod([x.size for x in arrays])
if out is None:
out = np.zeros([n, len(arrays)], dtype=dtype)
m = n / arrays[0].size
... | {
"repo_name": "aspera1631/TweetScore",
"path": "length_test.py",
"copies": "1",
"size": "1607",
"license": "mit",
"hash": -1947932145841150000,
"line_mean": 24.109375,
"line_max": 129,
"alpha_frac": 0.6241443684,
"autogenerated": false,
"ratio": 2.630114566284779,
"config_test": false,
"has_n... |
__author__ = 'bdeutsch'
import re
import numpy as np
import pandas as pd
# List cards drawn by me and played by opponent
def get_cards(filename):
# Open the file
with open(filename) as f:
mycards = []
oppcards = []
for line in f:
# Generate my revealed card list
... | {
"repo_name": "aspera1631/hs_logreader",
"path": "logreader.py",
"copies": "1",
"size": "4183",
"license": "mit",
"hash": 7330306061523231000,
"line_mean": 25.6496815287,
"line_max": 75,
"alpha_frac": 0.4994023428,
"autogenerated": false,
"ratio": 3.5782720273738238,
"config_test": true,
"has... |
__author__ = 'bdeutsch'
import re
import numpy as np
import pandas as pd
# Make a list of all card IDs and create a dataframe
def get_ids(filename):
# Create an empty list of IDs
idlist = []
with open(filename) as f:
# For each line
for line in f:
# Find the entity ids
... | {
"repo_name": "aspera1631/hs_logreader",
"path": "import_all.py",
"copies": "1",
"size": "2656",
"license": "mit",
"hash": -2516843833235626500,
"line_mean": 27.8804347826,
"line_max": 77,
"alpha_frac": 0.4785391566,
"autogenerated": false,
"ratio": 3.751412429378531,
"config_test": false,
"h... |
__author__ = 'beast'
import simpleldap
class LDAPAuth(object):
def __init__(self, server, port, encryption, user_dn, supported_group):
self.server = server
self.user_dn = user_dn
self.supported_group = supported_group
self.port = port
self.encryption = encryption
def... | {
"repo_name": "mr-robot/granule",
"path": "granule/granular/auth.py",
"copies": "1",
"size": "1086",
"license": "mit",
"hash": -7907744019355515000,
"line_mean": 26.8717948718,
"line_max": 99,
"alpha_frac": 0.5782688766,
"autogenerated": false,
"ratio": 4.292490118577075,
"config_test": false,
... |
__author__ = 'beast'
from flask import Flask, request, g, jsonify
from flask.ext.httpauth import HTTPBasicAuth
from granular.store import get_manager
from granular.work import subscribe
auth = HTTPBasicAuth()
app = Flask(__name__)
def get_granule():
granule = getattr(g, '_granular', None)
if granule is None... | {
"repo_name": "mr-robot/granule",
"path": "granule/application.py",
"copies": "1",
"size": "1848",
"license": "mit",
"hash": -2603262195135216000,
"line_mean": 23.9864864865,
"line_max": 92,
"alpha_frac": 0.6737012987,
"autogenerated": false,
"ratio": 3.323741007194245,
"config_test": false,
... |
__author__ = 'beast'
import base64, hashlib, random
from signals import post_save_activity
import redis
class Store(object):
def __init__(self, host="localhost", port=6379):
self.r = redis.StrictRedis(host=host, port=port, db=0)
self.user_id = None
def close(self):
pass
def logi... | {
"repo_name": "mr-robot/granule",
"path": "granule/granular/store.py",
"copies": "1",
"size": "3362",
"license": "mit",
"hash": -8749583636607866000,
"line_mean": 23.5474452555,
"line_max": 105,
"alpha_frac": 0.5559190958,
"autogenerated": false,
"ratio": 3.591880341880342,
"config_test": false... |
__author__ = 'beast'
import unittest
import requests
import json
class TestRestFunctionalGranule(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_basic_rest_functional(self):
#API calls End point using Basic Auth
payload = {'some': 'data'}
... | {
"repo_name": "mr-robot/granule",
"path": "tests/test_functional.py",
"copies": "1",
"size": "1050",
"license": "mit",
"hash": 4627267885394648000,
"line_mean": 18.1090909091,
"line_max": 108,
"alpha_frac": 0.6371428571,
"autogenerated": false,
"ratio": 4.285714285714286,
"config_test": true,
... |
__author__ = 'beau'
__author__ = 'beau'
import pywt
import numpy as np
x = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
x = np.random.randint(100,size=16)
print x
# haar = pywt.Wavelet('haar')
# dwt_x = pywt.wavedec(x,haar)
# print dwt_x
import math
c = 1/2.0#math.sqrt(2)/2 #'real' haar
dec_lo, dec_hi, rec_lo, rec_hi ... | {
"repo_name": "B3AU/waveTree",
"path": "sklearn/waveTree/tests/starting_code_featuremask.py",
"copies": "1",
"size": "1623",
"license": "bsd-3-clause",
"hash": -5427183008002700000,
"line_mean": 22.2,
"line_max": 82,
"alpha_frac": 0.6229205176,
"autogenerated": false,
"ratio": 2.6390243902439026,... |
import nltk
import re
import os.path
import glob
import sqlite3 as lite
import sys
import time
import geniatagger
#nltk.download()
reload(sys)
sys.setdefaultencoding("utf-8")
#########################################Searching for Ontological concepts############################################
#Searching One_word co... | {
"repo_name": "walidbedhiafi/OntoContext1",
"path": "OntoContext/annot.py",
"copies": "1",
"size": "8039",
"license": "mit",
"hash": 2607152706825569000,
"line_mean": 27.5070921986,
"line_max": 120,
"alpha_frac": 0.5853961936,
"autogenerated": false,
"ratio": 2.466707579011967,
"config_test": f... |
from Tkinter import *
import sqlite3 as lite
import operator
###############################Graphical interface###############################################
class ListBoxChoice(object):
def __init__(self, master=None, title=None, message=None, list=[]):
self.master = master
self.value = None
... | {
"repo_name": "walidbedhiafi/OntoContext1",
"path": "OntoContext/crisscross.py",
"copies": "1",
"size": "8145",
"license": "mit",
"hash": 1446736913631744500,
"line_mean": 31.7108433735,
"line_max": 119,
"alpha_frac": 0.5965623082,
"autogenerated": false,
"ratio": 2.957516339869281,
"config_tes... |
__author__ = 'befulton'
from subprocess import call, Popen, PIPE
from collections import defaultdict
import os
import time
import re
import datetime
import sys
def total_seconds(td):
# Since this function is not available in Python 2.6
return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 1... | {
"repo_name": "HPCHub/trinityrnaseq",
"path": "trinity-plugins/collectl/make_data_files.py",
"copies": "4",
"size": "6626",
"license": "bsd-3-clause",
"hash": -6099578993146510000,
"line_mean": 34.6077348066,
"line_max": 119,
"alpha_frac": 0.5430123755,
"autogenerated": false,
"ratio": 3.37201017... |
__author__ = 'befulton'
import os
import sys
import subprocess
def get_times():
d = dict()
with open("global.time") as f:
for line in f:
s = line.split()
d[s[0]] = s[1:]
return d
times = get_times()
date = times['start'][0]
start = times['start'][1]
end = ... | {
"repo_name": "HPCHub/trinityrnaseq",
"path": "trinity-plugins/collectl/plot.py",
"copies": "4",
"size": "7460",
"license": "bsd-3-clause",
"hash": -656375766330385400,
"line_mean": 40.3977272727,
"line_max": 246,
"alpha_frac": 0.6201072386,
"autogenerated": false,
"ratio": 2.311744654477843,
"... |
__author__ = 'belinkov'
from itertools import izip_longest
from numpy import cumsum
import subprocess
def grouper(iterable, n, fillvalue=None):
args = [iter(iterable)] * n
return izip_longest(*args, fillvalue=fillvalue)
def increment_dict(dic, k):
if k in dic:
dic[k] += 1
else:
di... | {
"repo_name": "boknilev/diacritization",
"path": "utils.py",
"copies": "1",
"size": "1783",
"license": "mit",
"hash": -410875244527967600,
"line_mean": 21.8717948718,
"line_max": 97,
"alpha_frac": 0.5787997757,
"autogenerated": false,
"ratio": 3.4354527938342967,
"config_test": false,
"has_no... |
__author__ = 'belinkov'
from netCDF4 import Dataset
from utils import *
from data_utils import load_extracted_data, Word
import numpy as np
import sys
def collect_predictions(num_labels, pred_filename):
print 'collecting predictions'
pred_classes = []
with open(pred_filename) as f:
count = 0
... | {
"repo_name": "boknilev/diacritization",
"path": "write_currennt_predictions.py",
"copies": "1",
"size": "3560",
"license": "mit",
"hash": -1394506221659742200,
"line_mean": 34.6,
"line_max": 135,
"alpha_frac": 0.581741573,
"autogenerated": false,
"ratio": 3.5528942115768465,
"config_test": fal... |
__author__ = 'belinkov'
import re
import sys
import os
import numpy as np
REGEX_DIACS = re.compile(r'[iauo~FNK`]+')
REGEX_DIACS_NOSHADDA = re.compile(r'[iauoFNK`]+')
DIACS = {'i', 'a', 'u', 'o', '~', 'F', 'N', 'K', '`'}
DIACS_NOSHADDA = {'i', 'a', 'u', 'o', 'F', 'N', 'K', '`'}
PUNCS_STOP = {'!', '.', ':', ';', '?', '... | {
"repo_name": "boknilev/diacritization",
"path": "data_utils.py",
"copies": "1",
"size": "15410",
"license": "mit",
"hash": -7405606961672125000,
"line_mean": 39.1302083333,
"line_max": 158,
"alpha_frac": 0.5618429591,
"autogenerated": false,
"ratio": 3.55232826187183,
"config_test": false,
"... |
__author__ = 'belinkov'
import sys
from data_utils import DIACS, REGEX_DIACS, MADA_LATIN_TAG
def extract_data(rdi_bw_filename, output_word_filename, output_word_diac_filename):
"""
Extract data from an RDI file
:param rdi_bw_filename: file containing raw Arabic text, preprocessed by MADA preprocessor (k... | {
"repo_name": "boknilev/diacritization",
"path": "extract_rdi_data.py",
"copies": "1",
"size": "1874",
"license": "mit",
"hash": 9113141537973358000,
"line_mean": 37.2448979592,
"line_max": 117,
"alpha_frac": 0.5752401281,
"autogenerated": false,
"ratio": 3.413479052823315,
"config_test": false... |
__author__ = 'belinkov'
# write current predictions without using any .nc file
#from netCDF4 import Dataset
from utils import *
from data_utils import load_extracted_data, Word, load_label_indices
import numpy as np
import sys
def collect_predictions(num_labels, pred_filename):
print 'collecting predictions'
... | {
"repo_name": "boknilev/diacritization",
"path": "write_currennt_predictions_nonc.py",
"copies": "1",
"size": "3503",
"license": "mit",
"hash": -1807814872023136800,
"line_mean": 34.3838383838,
"line_max": 140,
"alpha_frac": 0.5860690836,
"autogenerated": false,
"ratio": 3.6262939958592133,
"co... |
__author__ = 'BELLAICHE Adrien'
from os import listdir
from ford_fulkerson import execute_algorithm
corresponding = {"\xeb": "e",
"\xe9": "e",
"\xe8": "e",
"\n": ""}
def clean_line(value):
thing = list(value)
for _ in range(len(thing)):
if thing[_]... | {
"repo_name": "adrien-bellaiche/Repartition_Unpreferred",
"path": "main.py",
"copies": "1",
"size": "1949",
"license": "mit",
"hash": -841187400027989400,
"line_mean": 29.46875,
"line_max": 96,
"alpha_frac": 0.5346331452,
"autogenerated": false,
"ratio": 3.0500782472613457,
"config_test": false... |
__author__ = 'Belyavtsev'
import AStarSearchModel
class TestModel(AStarSearchModel):
"""
Test implementation of model AStarSearchModel.
It contains pole 5x5 with
"""
def __init__(self):
"""
Constructor.
Here will be initialize internal state of object.
@return: Cre... | {
"repo_name": "djbelyak/AStarSearch",
"path": "TestModel.py",
"copies": "1",
"size": "1120",
"license": "mit",
"hash": 4188354282619309600,
"line_mean": 23.347826087,
"line_max": 57,
"alpha_frac": 0.4598214286,
"autogenerated": false,
"ratio": 3.7086092715231787,
"config_test": false,
"has_no... |
__author__ = 'Bene'
import string
# class to hold flow entrys
class FlowTable(object):
def __init__(self, switch=None, tableString=None):
self.switch = switch
self.tableString = tableString
#holds alls entrys of a given switch
self.table = []
#fill table
#split ta... | {
"repo_name": "lsinfo3/BDD-mininet",
"path": "steps/FlowEntrys.py",
"copies": "1",
"size": "10920",
"license": "mit",
"hash": 6235447131816686000,
"line_mean": 47.3185840708,
"line_max": 119,
"alpha_frac": 0.5645604396,
"autogenerated": false,
"ratio": 4.185511690302798,
"config_test": false,
... |
__author__ = 'bengt'
BOARD, WHITE, BLACK, MOVE = 'BOARD', 'WHITE', 'BLACK', 'MOVE'
WIDTH, HEIGHT = 8, 8
NORTH = -HEIGHT
NORTHEAST = -HEIGHT + 1
EAST = 1
SOUTHEAST = HEIGHT + 1
SOUTH = HEIGHT
SOUTHWEST = HEIGHT - 1
WEST = - 1
NORTHWEST = -HEIGHT - 1
DIRECTIONS = (NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WE... | {
"repo_name": "Zolomon/reversi-ai",
"path": "game/settings.py",
"copies": "1",
"size": "1138",
"license": "mit",
"hash": -7497814401301158000,
"line_mean": 24.2888888889,
"line_max": 83,
"alpha_frac": 0.6080843585,
"autogenerated": false,
"ratio": 2.8168316831683167,
"config_test": false,
"ha... |
__author__ = 'Ben Haley & Ryan Jones'
import config as cfg
import shape
import util
from datamapfunctions import DataMapFunctions
import numpy as np
import pandas as pd
from collections import defaultdict
import copy
from datetime import datetime
from demand_subsector_classes import DemandStock, SubDemand, ServiceEffi... | {
"repo_name": "energyPATHWAYS/energyPATHWAYS",
"path": "energyPATHWAYS/demand.py",
"copies": "1",
"size": "217531",
"license": "mit",
"hash": 4647208757354094000,
"line_mean": 63.3012119421,
"line_max": 289,
"alpha_frac": 0.6354956305,
"autogenerated": false,
"ratio": 3.806583137927414,
"config... |
__author__ = 'Ben Haley & Ryan Jones'
import config as cfg
import util
import pandas as pd
import numpy as np
from datamapfunctions import DataMapFunctions, Abstract
import copy
import logging
import time
from util import DfOper
from collections import defaultdict
from supply_measures import BlendMeasure, ExportMeasur... | {
"repo_name": "energyPATHWAYS/energyPATHWAYS",
"path": "energyPATHWAYS/supply.py",
"copies": "1",
"size": "427457",
"license": "mit",
"hash": 7401486428126340000,
"line_mean": 70.8656691325,
"line_max": 542,
"alpha_frac": 0.6277333159,
"autogenerated": false,
"ratio": 3.771790346774905,
"config... |
__author__ = 'Ben Haley & Ryan Jones'
import os
from demand import Demand
import util
from outputs import Output
import shutil
import config as cfg
from supply import Supply
import pandas as pd
import logging
import shape
import pdb
from scenario_loader import Scenario
import copy
import numpy as np
class PathwaysMod... | {
"repo_name": "energyPATHWAYS/energyPATHWAYS",
"path": "energyPATHWAYS/pathways_model.py",
"copies": "1",
"size": "32907",
"license": "mit",
"hash": -8965640394133475000,
"line_mean": 63.1461988304,
"line_max": 217,
"alpha_frac": 0.6495274562,
"autogenerated": false,
"ratio": 3.3712734350988627,
... |
__author__ = 'Ben Haley & Ryan Jones'
import pandas as pd
import numpy as np
from scipy import optimize, interpolate, stats
import util
import logging
import pylab
import pdb
pd.options.mode.chained_assignment = None
class TimeSeries:
@staticmethod
def decay_towards_linear_regression_fill(x, y, newindex, dec... | {
"repo_name": "energyPATHWAYS/energyPATHWAYS",
"path": "energyPATHWAYS/time_series.py",
"copies": "1",
"size": "22911",
"license": "mit",
"hash": -2472377781585807400,
"line_mean": 41.2712177122,
"line_max": 149,
"alpha_frac": 0.6091397145,
"autogenerated": false,
"ratio": 3.616003787878788,
"c... |
__author__ = 'Ben Hughes <bwghughes@gmail.com>'
__version__ = '0.1'
from collections import deque
from decimal import Decimal
STD_DEV = Decimal(2.66)
class InvalidChartDataError(Exception):
pass
class ControlChart(object):
def __init__(self, data=None):
try:
assert data, 'Data cannot ... | {
"repo_name": "bwghughes/controlchart",
"path": "controlchart/__init__.py",
"copies": "1",
"size": "1593",
"license": "isc",
"hash": -3559165458367054300,
"line_mean": 29.6346153846,
"line_max": 93,
"alpha_frac": 0.6120527307,
"autogenerated": false,
"ratio": 3.6122448979591835,
"config_test": ... |
__author__ = 'Beni'
test_data = [
["2014-06-01", "APPL", 100.11],
["2014-06-02", "APPL", 110.61],
["2014-06-03", "APPL", 120.22],
["2014-06-04", "APPL", 100.54],
["2014-06-01", "MSFT", 20.46],
["2014-06-02", "MSFT", 21.25],
["2014-06-03", "MSFT", 32.53],
["2014-06-04", "MSFT", 40.71, "A... | {
"repo_name": "benmuresan/django_work",
"path": "tango_with_django_project/rango/stocks.py",
"copies": "1",
"size": "1249",
"license": "mit",
"hash": 2094336894536686000,
"line_mean": 19.8166666667,
"line_max": 42,
"alpha_frac": 0.4667734187,
"autogenerated": false,
"ratio": 2.2343470483005365,
... |
__author__ = 'benjamin.c.yan'
class Bear(object):
def __init__(self, other=None):
if isinstance(other, (dict, Bear)):
for key in other:
self[key] = other[key]
def __iter__(self):
return iter(self.__dict__)
def __getitem__(self, key):
if not key.startsw... | {
"repo_name": "by46/simplekit",
"path": "simples/bear.py",
"copies": "1",
"size": "1244",
"license": "mit",
"hash": 8483419521361102000,
"line_mean": 23.9,
"line_max": 68,
"alpha_frac": 0.5209003215,
"autogenerated": false,
"ratio": 3.465181058495822,
"config_test": false,
"has_no_keywords": ... |
__author__ = 'benjamindeleener'
from liblo import *
import socket
class MuseIOUDP():
def __init__(self, port, signal=None, viewer=None):
self.signal = signal
self.viewer = viewer
self.game = None
self.port = port
self.udp_ip = '127.0.0.1'
def initializePort(self):
... | {
"repo_name": "gaamy/pyMuse",
"path": "pymuse/ios.py",
"copies": "1",
"size": "3179",
"license": "mit",
"hash": 755585466855846100,
"line_mean": 34.7191011236,
"line_max": 109,
"alpha_frac": 0.5894935514,
"autogenerated": false,
"ratio": 3.462962962962963,
"config_test": false,
"has_no_keywor... |
__author__ = 'benjamindeleener'
from liblo import *
class MuseServer(ServerThread):
# listen for messages on port 5001
def __init__(self, signal, viewer):
self.signal = signal
self.viewer = viewer
ServerThread.__init__(self, 5001)
# receive accelrometer data
@make_method('/mu... | {
"repo_name": "twuilliam/pyMuse",
"path": "pymuse/ios.py",
"copies": "1",
"size": "2416",
"license": "mit",
"hash": 1269422444870522600,
"line_mean": 37.9677419355,
"line_max": 109,
"alpha_frac": 0.5910596026,
"autogenerated": false,
"ratio": 3.388499298737728,
"config_test": false,
"has_no_k... |
__author__ = 'benjamindeleener'
from numpy import fft, linspace
from datetime import datetime
class MuseSignal(object):
def __init__(self, length, acquisition_freq):
self.length = length
self.acquisition_freq = acquisition_freq
self.time = list(linspace(-float(self.length) / self.acquisitio... | {
"repo_name": "twuilliam/pyMuse",
"path": "pymuse/signals.py",
"copies": "2",
"size": "2407",
"license": "mit",
"hash": 2156098996344791600,
"line_mean": 33.884057971,
"line_max": 127,
"alpha_frac": 0.6044869132,
"autogenerated": false,
"ratio": 2.960639606396064,
"config_test": false,
"has_n... |
__author__ = 'benjamindeleener'
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
from datetime import datetime, timedelta
from numpy import linspace
def timeTicks(x, pos):
d = timedelta(milliseconds=x)
return str(d)
class MuseViewer(object):
def __init__(self, acquisition_freq, signal... | {
"repo_name": "twuilliam/pyMuse",
"path": "pymuse/viz.py",
"copies": "1",
"size": "6204",
"license": "mit",
"hash": 8146313915515503000,
"line_mean": 39.5490196078,
"line_max": 135,
"alpha_frac": 0.6223404255,
"autogenerated": false,
"ratio": 3.1349166245578575,
"config_test": false,
"has_no_... |
__author__ = 'benjamindeleener'
import sys
import time
from pymuse.ios import MuseServer
from pymuse.viz import MuseViewerSignal, MuseViewerConcentrationMellow
from pymuse.signals import MuseEEG, MuseConcentration, MuseMellow
from liblo import ServerError
def main():
# initialization of variables
signals, vi... | {
"repo_name": "gaamy/pyMuse",
"path": "eeg_pong.py",
"copies": "1",
"size": "1366",
"license": "mit",
"hash": -8382631122858573000,
"line_mean": 28.6956521739,
"line_max": 133,
"alpha_frac": 0.6932650073,
"autogenerated": false,
"ratio": 3.594736842105263,
"config_test": false,
"has_no_keywor... |
# @AUTHOR: Benjamin Meyers
# @DESCRIPTION: Try to write code to convert text into hAck3r, using regular
# expressions and substitution, where e → 3, i → 1, o → 0,
# l → |, s → 5, . → 5w33t!, ate → 8. Normalize the text to
# lowercase before converting it. Add more substitutions... | {
"repo_name": "meyersbs/misc_nlp_scripts",
"path": "english_to_hack3r.py",
"copies": "1",
"size": "2343",
"license": "mit",
"hash": 975622660034387600,
"line_mean": 39.8596491228,
"line_max": 78,
"alpha_frac": 0.5135251181,
"autogenerated": false,
"ratio": 2.893167701863354,
"config_test": fals... |
__author__ = 'benjamin'
from PIL import Image, ImageDraw
import colorsys
class Sample:
min_lat = min_lon = 10000
max_lat = max_lon = -10000
min_val = 10
max_val = -10
color1 = (46, 239, 67, 255) #green
color2 = (147, 239, 67, 255)
color3 = (199, 239, 67, 255)
color4 = (224, 239, 67, 255... | {
"repo_name": "silva96/geojson-ndvi",
"path": "Sample.py",
"copies": "1",
"size": "2112",
"license": "mit",
"hash": 6420472639804537000,
"line_mean": 29.1714285714,
"line_max": 82,
"alpha_frac": 0.5596590909,
"autogenerated": false,
"ratio": 3.4966887417218544,
"config_test": false,
"has_no_k... |
__author__ = 'benjamin'
class Quad:
# _quadlist and _vertexlist have to be of type np.array!
def __init__(self, _id, _quadlist, _vertexlist):
import numpy as np
if type(_quadlist) is list:
_quadlist = np.array(_quadlist)
if type(_vertexlist) is list:
_vertexlist... | {
"repo_name": "BGCECSE2015/CADO",
"path": "PYTHON/NURBSReconstruction/DualContouring/quad.py",
"copies": "1",
"size": "7540",
"license": "bsd-3-clause",
"hash": -3897038094175691300,
"line_mean": 32.9684684685,
"line_max": 119,
"alpha_frac": 0.5547745358,
"autogenerated": false,
"ratio": 3.670886... |
__author__ = 'Benjamin S. Murphy'
__version__ = '1.4.0'
__doc__ = """
PyKrige
=======
Code by Benjamin S. Murphy and the PyKrige Developers
bscott.murphy@gmail.com
Summary
-------
Kriging toolkit for Python.
ok: Contains class OrdinaryKriging, which is a convenience class for easy
access to 2D ordi... | {
"repo_name": "rth/PyKrige",
"path": "pykrige/__init__.py",
"copies": "1",
"size": "2155",
"license": "bsd-3-clause",
"hash": 3398942906124494000,
"line_mean": 39.4423076923,
"line_max": 76,
"alpha_frac": 0.7354988399,
"autogenerated": false,
"ratio": 3.475806451612903,
"config_test": false,
... |
__author__ = 'ben'
from pprint import pprint
import os
import json
import pandas as pd
from os import walk
import os
import csv
data = {}
phase = 'practice'
easyPrac = [10,12,17,30,34]
hardPrac = [25,26,35,37,42]
mypath = '../build/img/' + phase + '/900'
prac = True
data['batchMeta'] = {
'numBatches':2,
'img... | {
"repo_name": "bdyetton/MODA",
"path": "Tools/errorInvestigation.py",
"copies": "1",
"size": "3026",
"license": "mit",
"hash": -2108043188779607000,
"line_mean": 36.3580246914,
"line_max": 184,
"alpha_frac": 0.6245869134,
"autogenerated": false,
"ratio": 3.0596562184024267,
"config_test": false... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.