text stringlengths 0 1.05M | meta dict |
|---|---|
# Purpose: Set windows to lock itself(upon timeout) with a screensaver
# if no internet connection found.
from _winreg import *
import urllib2, socket
debug = False
########################## TO RUN ####################################
# schedule to run every x mins
########################### DEF ######... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/578200_Set_windows_7_lock_itself_uptimeout_if_no/recipe-578200.py",
"copies": "1",
"size": "2753",
"license": "mit",
"hash": -8702876904705356000,
"line_mean": 28.2872340426,
"line_max": 82,
"alpha_frac": 0.5706501998,
"autogenerated": false... |
__author__ = 'cadu'
from django.db import models
import os
import logging
# Get logger.
logger = logging.getLogger(__name__)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webservices.settings")
FONT_SIZE_OPTIONS = (
('S', 'Small'),
('M', 'Medium'),
('L', 'Large'),
)
LANGUAGE_OPTIONS = (
('ES', '... | {
"repo_name": "scieloorg/pulsemob_webservices",
"path": "pulsemob_webservices/webservices/models.py",
"copies": "2",
"size": "4587",
"license": "bsd-2-clause",
"hash": 4055441822873019000,
"line_mean": 32.9851851852,
"line_max": 180,
"alpha_frac": 0.6801831262,
"autogenerated": false,
"ratio": 3.... |
__author__ = 'cagataytengiz'
import configparser
from common import init_app
import bottle
from common import appconf, baseApp
def do_setup():
"""
:return:
"""
#todo: setup
"""
if bottle.request.method == 'GET':
return bottle.template('setup')
else:
prms = bottle.reques... | {
"repo_name": "ctengiz/firewad",
"path": "firstrun.py",
"copies": "1",
"size": "1140",
"license": "mit",
"hash": -5315543160328054000,
"line_mean": 20.9230769231,
"line_max": 83,
"alpha_frac": 0.5815789474,
"autogenerated": false,
"ratio": 3.5514018691588785,
"config_test": true,
"has_no_keyw... |
__author__ = 'cagataytengiz'
import os
import sys
import importlib
from bottle import BaseTemplate, debug, run, template, static_file, request, redirect
from beaker.middleware import SessionMiddleware
from sub import db, ddl, login, mon, qry
from common import appconf, baseApp, init_app, init_session, render, highli... | {
"repo_name": "ctengiz/firewad",
"path": "app.py",
"copies": "1",
"size": "2173",
"license": "mit",
"hash": 2999111756139001000,
"line_mean": 26.5063291139,
"line_max": 96,
"alpha_frac": 0.6148182237,
"autogenerated": false,
"ratio": 3.499194847020934,
"config_test": false,
"has_no_keywords":... |
__author__ = 'caioseguin'
from ..query_data_structures.constraint import Constraint
from ..query_data_structures.element import Variable, Constant, Wildcard
from ..query_data_structures.query import *
from ..query_data_structures.relation import RelationInQuery
# Operators used in this module
ruleOperator = ':-'
dis... | {
"repo_name": "saltzm/yadi",
"path": "yadi/datalog2sql/tokens2ast/rule_handler.py",
"copies": "1",
"size": "6261",
"license": "bsd-3-clause",
"hash": -5334839601984947000,
"line_mean": 30.305,
"line_max": 99,
"alpha_frac": 0.6152371826,
"autogenerated": false,
"ratio": 4.094833224329627,
"confi... |
__author__ = 'caioseguin'
from .rule_handler import RuleHandler
from ..query_data_structures.query import *
# This class acts as the middle man between the Datalog parser and the SQL translator.
# It transforms the parser's output into a list of conjunctiveQueries and a list of disjunctiveQueries.
class ASTBuilder:
... | {
"repo_name": "saltzm/yadi",
"path": "yadi/datalog2sql/tokens2ast/ast_builder.py",
"copies": "1",
"size": "2447",
"license": "bsd-3-clause",
"hash": -6967365647376108000,
"line_mean": 33.9571428571,
"line_max": 119,
"alpha_frac": 0.6738863915,
"autogenerated": false,
"ratio": 4.20446735395189,
... |
__author__ = 'caja'
import rospy
import time
import shlex
import subprocess
from threading import Thread
from BAL.Interfaces.Runnable import Runnable
TIME_OUT = 5000
class KeepAliveHandler(Runnable):
is_init = False
def __init__(self, topic_name, msg_type):
if not KeepAliveHandler.is_init:
... | {
"repo_name": "robotican/ric",
"path": "ric_board/scripts/RiCTraffic/BAL/Handlers/keepAliveHandler.py",
"copies": "1",
"size": "1062",
"license": "bsd-3-clause",
"hash": 3849739717352863000,
"line_mean": 30.2352941176,
"line_max": 82,
"alpha_frac": 0.604519774,
"autogenerated": false,
"ratio": 3.... |
__author__ = 'Caleb Madrigal'
__email__ = 'caleb.madrigal@gmail.com'
__version__ = '0.0.2'
__apiversion__ = 1
__config__ = {'power': -100, 'log_level': 'ERROR', 'trigger_cooldown': 1}
class Trigger:
def __init__(self):
# dev_id -> [timestamp1, timestamp2, ...]
self.packets_seen = 0
self.un... | {
"repo_name": "calebmadrigal/trackerjacker",
"path": "plugin_examples/plugin_template.py",
"copies": "2",
"size": "1426",
"license": "mit",
"hash": -2862591626625458000,
"line_mean": 37.5405405405,
"line_max": 112,
"alpha_frac": 0.4670406732,
"autogenerated": false,
"ratio": 3.8230563002680964,
... |
__author__ = 'Caleb'
from urllib2 import urlopen, HTTPError, URLError
import datetime
from math import sqrt, sin,cos,atan,degrees,radians
import numpy as np
import sys
from os import path
import json
import argparse
def localDataSpec(buoy):
try:
f = open(path.join('c:\\node', buoy + '.data_spec... | {
"repo_name": "calebvandenberg/py-ndbc-buoy-spectra",
"path": "ndbc.py",
"copies": "1",
"size": "14708",
"license": "mit",
"hash": -1333847909483867600,
"line_mean": 42.3012048193,
"line_max": 196,
"alpha_frac": 0.5265841719,
"autogenerated": false,
"ratio": 3.2332380743020446,
"config_test": f... |
__author__ = 'Calle'
from builtins import bytes, str, filter, map
import unittest
from zetacrypt import ciphers, utility
from zetacrypt.conversions import *
from collections import OrderedDict
class TestXORFunctions(unittest.TestCase):
def test_single_byte_xor(self):
plaintext = ascii_to_bytes... | {
"repo_name": "ZetaTwo/zetacrypto",
"path": "tests/test_ciphers.py",
"copies": "1",
"size": "5043",
"license": "mit",
"hash": -8857690431121592000,
"line_mean": 37.7086614173,
"line_max": 136,
"alpha_frac": 0.6313702161,
"autogenerated": false,
"ratio": 3.4352861035422344,
"config_test": true,
... |
__author__ = 'Calle Svensson <calle.svensson@zeta-two.com>'
import math, scipy
def levenshtein_swap(seq1, seq2):
"""Returns the number of pairwise swaps are needed to turn seq1 into seq2"""
res = 0
for i1 in range(len(seq1)):
i2 = seq2.index(seq1[i1])
res += abs(i1 - i2)
re... | {
"repo_name": "ZetaTwo/zetacrypto",
"path": "zetacrypt/mathtools.py",
"copies": "1",
"size": "1532",
"license": "mit",
"hash": 825495650909233000,
"line_mean": 29.2653061224,
"line_max": 81,
"alpha_frac": 0.6103133159,
"autogenerated": false,
"ratio": 3.057884231536926,
"config_test": false,
... |
__author__ = "Calvin Huang"
import threading
import time
class Sensor(object):
"""
Abstract sensor class.
Stores data as class attributes, updated when poll() is called.
Take care to not accidentally override vital class attributes
with update_state.
"""
def __init__(self):
self.l... | {
"repo_name": "grt192/2012rebound-rumble",
"path": "py/grt/core.py",
"copies": "1",
"size": "7343",
"license": "mit",
"hash": -4488672601108266000,
"line_mean": 25.5090252708,
"line_max": 93,
"alpha_frac": 0.539425303,
"autogenerated": false,
"ratio": 4.482905982905983,
"config_test": false,
... |
__author__ = "Calvin Huang"
from wpilib import CounterBase
from wpilib import Encoder as WEncoder
from grt.core import Sensor
class Encoder(Sensor):
"""
Sensor wrapper for a quadrature encoder.
Has double attributes distance, rate (distance/second);
boolean attributes stopped and direction.
"""
... | {
"repo_name": "grt192/2012rebound-rumble",
"path": "py/grt/sensors/encoder.py",
"copies": "1",
"size": "1126",
"license": "mit",
"hash": -6215613438262429000,
"line_mean": 29.4324324324,
"line_max": 81,
"alpha_frac": 0.6198934281,
"autogenerated": false,
"ratio": 3.7039473684210527,
"config_tes... |
__author__ = "Calvin Huang"
from wpilib import DriverStation
from grt.core import Sensor
# button/pin pair list
BUTTON_TABLE = [('button1', 1), ('button2', 3), ('button3', 5),
('button4', 7), ('button5', 9), ('button6', 11),
('button7', 13), ('button8', 15),
('l_toggle'... | {
"repo_name": "grt192/2012rebound-rumble",
"path": "py/grt/sensors/buttonboard.py",
"copies": "1",
"size": "1430",
"license": "mit",
"hash": 1120790211648922000,
"line_mean": 29.4255319149,
"line_max": 78,
"alpha_frac": 0.5874125874,
"autogenerated": false,
"ratio": 3.4541062801932365,
"config_... |
__author__ = "Calvin Huang"
from wpilib import Joystick
from grt.core import Sensor
BUTTON_TABLE = ['a_button', 'b_button', 'x_button', 'y_button',
'l_shoulder', 'r_shoulder', 'back_button',
'start_button']
class XboxJoystick(Sensor):
"""
Sensor wrapper for the Xbox Controlle... | {
"repo_name": "grt192/2012rebound-rumble",
"path": "py/grt/sensors/xbox_joystick.py",
"copies": "1",
"size": "1394",
"license": "mit",
"hash": -8848539947045994000,
"line_mean": 30.6818181818,
"line_max": 66,
"alpha_frac": 0.5846484935,
"autogenerated": false,
"ratio": 3.1325842696629214,
"conf... |
__author__ = "Calvin Huang"
from wpilib import Joystick
from grt.core import Sensor
BUTTON_TABLE = ['trigger', 'button2', 'button3',
'button4', 'button5', 'button6',
'button7', 'button8', 'button9',
'button10', 'button11']
class Attack3Joystick(Sensor):
"""
Se... | {
"repo_name": "grt192/2012rebound-rumble",
"path": "py/grt/sensors/attack_joystick.py",
"copies": "1",
"size": "1134",
"license": "mit",
"hash": -2572354073711708000,
"line_mean": 27.35,
"line_max": 66,
"alpha_frac": 0.5582010582,
"autogenerated": false,
"ratio": 3.5772870662460567,
"config_tes... |
__author__ = "Calvin Huang"
"""
Executes macros in a list/tuple/whatever sequentially.
"""
from grt.core import GRTMacro
class SequentialMacros(GRTMacro):
"""
Executes macros sequentially. Less efficient compared to GRTMacroController,
but has timeout functionality.
"""
curr_macro = None
cur... | {
"repo_name": "grt192/2012rebound-rumble",
"path": "py/grt/macro/sequential_macros.py",
"copies": "1",
"size": "1151",
"license": "mit",
"hash": -6887749457581128000,
"line_mean": 27.0731707317,
"line_max": 80,
"alpha_frac": 0.5994787142,
"autogenerated": false,
"ratio": 3.8754208754208754,
"co... |
__author__ = "Calvin Huang, Sidd Karamcheti"
class DriveTrain:
"""
Standard 6-motor drivetrain, with standard tankdrive.
"""
power = 1.0
def __init__(self,
left_motor, right_motor,
left_shifter=None, right_shifter=None,
left_encoder=None, right_e... | {
"repo_name": "grt192/2012rebound-rumble",
"path": "py/grt/mechanism/drivetrain.py",
"copies": "1",
"size": "1709",
"license": "mit",
"hash": -3928417575894446000,
"line_mean": 28.9824561404,
"line_max": 67,
"alpha_frac": 0.5664131071,
"autogenerated": false,
"ratio": 3.6991341991341993,
"confi... |
__author__ = 'calvin'
from weakref import WeakSet
from future.utils import iteritems
from . import Property
"""
Create a dictionary of conversion methods between US Standard and Metric distance unit systems.
"""
from_meter_conversions = {'km': 1 / 1000., 'm': 1, 'cm': 100., 'mm': 1000.,
'ft'... | {
"repo_name": "lobocv/eventdispatcher",
"path": "eventdispatcher/unitproperty.py",
"copies": "1",
"size": "2016",
"license": "mit",
"hash": -2556336244475727000,
"line_mean": 37.7692307692,
"line_max": 114,
"alpha_frac": 0.6438492063,
"autogenerated": false,
"ratio": 3.536842105263158,
"config_... |
__author__ = 'calvin'
import collections
from functools import partial
from . import Property
class ObservableSet(collections.MutableSet):
def __init__(self, dictionary, dispatch_method):
self.set = dictionary.copy()
self.dispatch = dispatch_method
def __repr__(self):
return self.set... | {
"repo_name": "lobocv/eventdispatcher",
"path": "eventdispatcher/setproperty.py",
"copies": "1",
"size": "2995",
"license": "mit",
"hash": 4538365209133760500,
"line_mean": 25.5132743363,
"line_max": 110,
"alpha_frac": 0.576293823,
"autogenerated": false,
"ratio": 3.993333333333333,
"config_tes... |
__author__ = 'calvin'
import collections
from future.utils import iteritems, iterkeys, itervalues
from functools import partial
from . import Property
class __DoesNotExist__:
# Custom class used as a flag
pass
class ObservableDict(collections.MutableMapping):
def __init__(self, dictionary, dispatch_met... | {
"repo_name": "lobocv/eventdispatcher",
"path": "eventdispatcher/dictproperty.py",
"copies": "1",
"size": "4221",
"license": "mit",
"hash": 7021586282009213000,
"line_mean": 27.9178082192,
"line_max": 111,
"alpha_frac": 0.5922767117,
"autogenerated": false,
"ratio": 4.480891719745223,
"config_t... |
author = 'calvin'
import gettext
from builtins import str as basestring, str as unicode
from eventdispatcher import Property
# The translation (gettext) function to be used
def no_translation(s):
return s
translator = no_translation
def fake_translation(s):
"""
A fake translation function to 'french' t... | {
"repo_name": "lobocv/eventdispatcher",
"path": "eventdispatcher/stringproperty.py",
"copies": "1",
"size": "8219",
"license": "mit",
"hash": 6443505379839428000,
"line_mean": 33.1078838174,
"line_max": 117,
"alpha_frac": 0.5869327169,
"autogenerated": false,
"ratio": 4.533370104798676,
"config... |
__author__ = 'calvin'
import unittest
from eventdispatcher import EventDispatcher, BindError
from eventdispatcher import StringProperty, _
from . import EventDispatcherTest
class Dispatcher(EventDispatcher):
p1 = StringProperty(_('abc'))
p2 = StringProperty(_('xyz'))
class StringPropertyTest(EventDispatcher... | {
"repo_name": "lobocv/eventdispatcher",
"path": "tests/test_stringproperty.py",
"copies": "1",
"size": "1778",
"license": "mit",
"hash": 4025437366396801000,
"line_mean": 32.5471698113,
"line_max": 84,
"alpha_frac": 0.6445444319,
"autogenerated": false,
"ratio": 3.799145299145299,
"config_test"... |
__author__ = 'calvin'
from copy import deepcopy
from eventdispatcher import Property
from weakref import ref
class WeakRefProperty(Property):
"""
Property that stores it's values as weak references in order to facilitate garbage collection.
"""
def __init__(self, default_value, **additionals):
... | {
"repo_name": "lobocv/eventdispatcher",
"path": "eventdispatcher/weakrefproperty.py",
"copies": "1",
"size": "1405",
"license": "mit",
"hash": 5078926944512989000,
"line_mean": 30.9545454545,
"line_max": 98,
"alpha_frac": 0.6014234875,
"autogenerated": false,
"ratio": 4.376947040498442,
"config... |
__author__ = 'calvin'
from crashreporter_hq import app
import getopt
import sys
def usage():
print "Command line parameters:"
print " -d Sets debug"
print " -h host ip"
print " -p port"
print " -s enable profiling"
print " --help Display help"
try:
opts, args =... | {
"repo_name": "lobocv/crashreporter_hq",
"path": "run_hq.py",
"copies": "1",
"size": "1505",
"license": "mit",
"hash": -8281816247016882000,
"line_mean": 25.875,
"line_max": 109,
"alpha_frac": 0.6265780731,
"autogenerated": false,
"ratio": 3.5,
"config_test": false,
"has_no_keywords": false,
... |
__author__ = 'calvin'
from . import Property
class LimitProperty(Property):
def __init__(self, default_value, min, max):
super(LimitProperty, self).__init__(default_value, min=min, max=max)
def __get__(self, obj, objtype=None):
return obj.event_dispatcher_properties[self.name]['value']
... | {
"repo_name": "lobocv/eventdispatcher",
"path": "eventdispatcher/limitproperty.py",
"copies": "1",
"size": "1969",
"license": "mit",
"hash": -8540679286268938000,
"line_mean": 32.9482758621,
"line_max": 90,
"alpha_frac": 0.5464702895,
"autogenerated": false,
"ratio": 4.308533916849015,
"config_... |
__author__ = 'calvin'
from time import time
from .clock import Clock
import threading
import logging
class ScheduledEvent(object):
""" Creates a trigger to the scheduler generator that is thread-safe."""
RUNNING = 1
KILL = 0
clock = None
def __init__(self, func, timeout=0):
self.func = ... | {
"repo_name": "lobocv/eventdispatcher",
"path": "eventdispatcher/scheduledevent.py",
"copies": "1",
"size": "8274",
"license": "mit",
"hash": -8008861290460042000,
"line_mean": 32.9098360656,
"line_max": 113,
"alpha_frac": 0.5837563452,
"autogenerated": false,
"ratio": 4.599221789883268,
"confi... |
__author__ = 'calvin'
import collections
from functools import partial
from copy import copy
import numpy as np
from . import Property
class ObservableList(collections.MutableSequence):
def __init__(self, l, dispatch_method, dtype=None):
if not type(l) == list and not type(l) == tuple and not isinstance... | {
"repo_name": "lobocv/eventdispatcher",
"path": "eventdispatcher/listproperty.py",
"copies": "1",
"size": "3703",
"license": "mit",
"hash": -2892995514664435700,
"line_mean": 28.624,
"line_max": 113,
"alpha_frac": 0.5779098029,
"autogenerated": false,
"ratio": 4.184180790960452,
"config_test": ... |
__author__ = 'calvin'
import ConfigParser
import datetime
import logging
import os
import csv
import re
import json
import sqlite3
import threading
import time
import socket
import requests
from tables import Table, Statistic, State, Timer, Sequence, NO_STATE
from .exceptions import TableConflictError
from .tools imp... | {
"repo_name": "lobocv/anonymoususage",
"path": "anonymoususage/anonymoususage.py",
"copies": "1",
"size": "20534",
"license": "mit",
"hash": -944652960972041600,
"line_mean": 40.7357723577,
"line_max": 139,
"alpha_frac": 0.5734391741,
"autogenerated": false,
"ratio": 4.3578098471986415,
"config... |
__author__ = 'calvin'
import contextlib
from future.utils import iteritems
from .property import Property
from .exceptions import *
class EventDispatcher(object):
def __init__(self, *args, **kwargs):
self.event_dispatcher_event_callbacks = {}
self.event_dispatcher_properties = {}
bindings... | {
"repo_name": "lobocv/eventdispatcher",
"path": "eventdispatcher/eventdispatcher.py",
"copies": "1",
"size": "9709",
"license": "mit",
"hash": -4728681955628951000,
"line_mean": 44.1581395349,
"line_max": 117,
"alpha_frac": 0.6037696982,
"autogenerated": false,
"ratio": 4.663304514889529,
"conf... |
__author__ = 'calvin'
import cProfile
import logging
from pyperform import StringIO
import os
import pstats
import sys
import threading
import multiprocessing
Thread = threading.Thread # Start off using threading.Thread until changed
Process = multiprocessing.Process
BaseThread = threading.Thread # Sto... | {
"repo_name": "lobocv/pyperform",
"path": "pyperform/thread.py",
"copies": "1",
"size": "5327",
"license": "mit",
"hash": -861369947747774300,
"line_mean": 34.5133333333,
"line_max": 115,
"alpha_frac": 0.6322507978,
"autogenerated": false,
"ratio": 3.9605947955390333,
"config_test": false,
"h... |
__author__ = 'calvin'
import datetime
import ftplib
import logging
import sqlite3
logger = logging.getLogger('AnonymousUsage')
__all__ = ['create_table', 'get_table_list', 'get_table_columns', 'check_table_exists', 'get_rows',
'merge_databases', 'ftp_download', 'get_datetime_sorted_rows', 'delete_row', 'g... | {
"repo_name": "lobocv/anonymoususage",
"path": "anonymoususage/tools.py",
"copies": "1",
"size": "9624",
"license": "mit",
"hash": -3781117665796098000,
"line_mean": 30.5540983607,
"line_max": 123,
"alpha_frac": 0.6183499584,
"autogenerated": false,
"ratio": 3.7259001161440186,
"config_test": f... |
__author__ = 'calvin'
import datetime
import logging
import sqlite3
from .table import Table
from ..tools import insert_row
logger = logging.getLogger('AnonymousUsage')
class Statistic(Table):
"""
Tracks the usage of a certain statistic over time.
Usage:
tracker.track_statistic(stat_name)
... | {
"repo_name": "lobocv/anonymoususage",
"path": "anonymoususage/tables/statistic.py",
"copies": "1",
"size": "2343",
"license": "mit",
"hash": 1203164716134595800,
"line_mean": 25.9425287356,
"line_max": 114,
"alpha_frac": 0.5565514298,
"autogenerated": false,
"ratio": 3.9846938775510203,
"confi... |
__author__ = 'calvin'
import datetime
import logging
import time
logger = logging.getLogger('AnonymousUsage')
from .statistic import Statistic
class Timer(Statistic):
"""
A timer is a special case of a Statistic where the count is the number of elapsed seconds. A Timer object can be
started and stoppe... | {
"repo_name": "lobocv/anonymoususage",
"path": "anonymoususage/tables/timer.py",
"copies": "1",
"size": "4509",
"license": "mit",
"hash": 3819615764258477000,
"line_mean": 33.6846153846,
"line_max": 116,
"alpha_frac": 0.5522288756,
"autogenerated": false,
"ratio": 4.073170731707317,
"config_tes... |
__author__ = 'calvin'
import datetime
import sqlite3
import logging
from itertools import imap
from operator import eq
from collections import deque
from .table import Table
from ..tools import insert_row
from anonymoususage.exceptions import InvalidCheckpointError
logger = logging.getLogger('AnonymousUsage')
clas... | {
"repo_name": "lobocv/anonymoususage",
"path": "anonymoususage/tables/sequence.py",
"copies": "1",
"size": "3465",
"license": "mit",
"hash": -1988268276325119500,
"line_mean": 30.7889908257,
"line_max": 114,
"alpha_frac": 0.5847041847,
"autogenerated": false,
"ratio": 4.62,
"config_test": false... |
__author__ = 'calvin'
import datetime
import sqlite3
import logging
from .table import Table
from ..tools import insert_row
logger = logging.getLogger('AnonymousUsage')
NO_STATE = type('NO_STATE', (object, ), {})
class State(Table):
"""
Tracks the state of a certain attribute over time.
Usage:
... | {
"repo_name": "lobocv/anonymoususage",
"path": "anonymoususage/tables/state.py",
"copies": "1",
"size": "2343",
"license": "mit",
"hash": 8459950217837209000,
"line_mean": 28.6582278481,
"line_max": 120,
"alpha_frac": 0.5770379855,
"autogenerated": false,
"ratio": 3.8472906403940885,
"config_te... |
__author__ = 'calvin'
import inspect
import logging
import re
import traceback
from types import FunctionType, MethodType, ModuleType, BuiltinMethodType, BuiltinFunctionType
try:
import numpy as np
_NUMPY_INSTALLED = True
except ImportError:
_NUMPY_INSTALLED = False
obj_ref_regex = re.compile("[A-z]+[0-... | {
"repo_name": "lobocv/crashreporter",
"path": "crashreporter/tools.py",
"copies": "1",
"size": "5988",
"license": "mit",
"hash": -361811620085533060,
"line_mean": 31.7267759563,
"line_max": 118,
"alpha_frac": 0.5868403474,
"autogenerated": false,
"ratio": 3.880751782242385,
"config_test": false... |
__author__ = 'calvin'
import inspect
import timeit
from types import FunctionType
from pyperform import StringIO
from .tools import *
class Benchmark(object):
enable = True
def __init__(self, setup=None, classname=None, timeit_repeat=3, timeit_number=1000, largs=None, kwargs=None):
self.setup = setu... | {
"repo_name": "lobocv/pyperform",
"path": "pyperform/benchmark.py",
"copies": "1",
"size": "3456",
"license": "mit",
"hash": 6642760858431099000,
"line_mean": 36.5652173913,
"line_max": 120,
"alpha_frac": 0.5885416667,
"autogenerated": false,
"ratio": 3.9815668202764978,
"config_test": false,
... |
__author__ = 'calvin'
import logging
from anonymoususage.tools import *
from anonymoususage.exceptions import *
from threading import RLock
logger = logging.getLogger('AnonymousUsage')
class Table(object):
time_fmt = "%d/%m/%Y %H:%M:%S"
table_args = ("UUID", "INTEGER"), ("Count", "REAL"), ("Time", "TEXT")
... | {
"repo_name": "lobocv/anonymoususage",
"path": "anonymoususage/tables/table.py",
"copies": "1",
"size": "4124",
"license": "mit",
"hash": -5679674408484384000,
"line_mean": 35.4955752212,
"line_max": 117,
"alpha_frac": 0.5935984481,
"autogenerated": false,
"ratio": 3.6657777777777776,
"config_t... |
__author__ = 'calvin'
import logging
from .benchmark import Benchmark
from .benchmarkedfunction import BenchmarkedFunction
from .tools import convert_time_units
from .exceptions import ValidationError
class BenchmarkedClass(Benchmark):
bound_functions = {}
def __init__(self, setup=None, largs=None, kwargs=... | {
"repo_name": "lobocv/pyperform",
"path": "pyperform/benchmarkedclass.py",
"copies": "1",
"size": "2917",
"license": "mit",
"hash": -5180241561821178000,
"line_mean": 44.578125,
"line_max": 112,
"alpha_frac": 0.5735344532,
"autogenerated": false,
"ratio": 4.393072289156627,
"config_test": false... |
__author__ = 'calvin'
import re
import sys
from math import log10
if sys.version[0] == '3':
pass
else:
range = xrange
classdef_regex = re.compile(r"\S*def .*#!|class .*#!")
tagged_line_regex = re.compile(r".*#!")
def convert_time_units(t):
""" Convert time in seconds into reasonable time units. """
... | {
"repo_name": "lobocv/pyperform",
"path": "pyperform/tools.py",
"copies": "1",
"size": "4519",
"license": "mit",
"hash": -7149361426149947000,
"line_mean": 29.7482993197,
"line_max": 107,
"alpha_frac": 0.5264439035,
"autogenerated": false,
"ratio": 3.960560911481157,
"config_test": false,
"ha... |
__author__ = 'calvin'
import requests
import json
import logging
HQ_DEFAULT_TIMEOUT = 10
SMTP_DEFAULT_TIMEOUT = 5
def upload_report(server, payload, timeout=HQ_DEFAULT_TIMEOUT):
"""
Upload a report to the server.
:param payload: Dictionary (JSON serializable) of crash data.
:return: server response... | {
"repo_name": "lobocv/crashreporter",
"path": "crashreporter/api.py",
"copies": "1",
"size": "1228",
"license": "mit",
"hash": -7973952015720329000,
"line_mean": 23.56,
"line_max": 89,
"alpha_frac": 0.6506514658,
"autogenerated": false,
"ratio": 3.8984126984126983,
"config_test": false,
"has_... |
__author__ = 'calvin'
import time
import json
import socket
from threading import Thread
def run(port, cmds):
HOST = '127.0.0.1'
DISCOVER_PORT = 1213
def communicate(sock, cmd):
"""
Send a command and print it's response
:param cmd:
:return:
"""
if not isin... | {
"repo_name": "lobocv/anonymoususage",
"path": "test_multi_ipc.py",
"copies": "1",
"size": "4173",
"license": "mit",
"hash": -2274354280981620000,
"line_mean": 45.8988764045,
"line_max": 125,
"alpha_frac": 0.5530793194,
"autogenerated": false,
"ratio": 3.4920502092050207,
"config_test": false,
... |
__author__ = 'calvin'
class AnonymousUsageError(Exception):
"""
Base class for errors in this module
"""
pass
@property
def message(self):
return str(self)
class IntervalError(AnonymousUsageError):
def __init__(self, value):
self.value = value
def __str__(self):
... | {
"repo_name": "lobocv/anonymoususage",
"path": "anonymoususage/exceptions.py",
"copies": "1",
"size": "1220",
"license": "mit",
"hash": 6863221816800177000,
"line_mean": 23.9183673469,
"line_max": 114,
"alpha_frac": 0.593442623,
"autogenerated": false,
"ratio": 4.518518518518518,
"config_test":... |
__author__ = 'calvin'
class Property(object):
def __init__(self, default_value, **additionals):
self.instances = {}
self.default_value = default_value
self._additionals = additionals
def __get__(self, obj, objtype=None):
return obj.event_dispatcher_properties[self.name]['valu... | {
"repo_name": "lobocv/eventdispatcher",
"path": "eventdispatcher/property.py",
"copies": "1",
"size": "1262",
"license": "mit",
"hash": 5882357895837380000,
"line_mean": 35.0571428571,
"line_max": 105,
"alpha_frac": 0.6259904913,
"autogenerated": false,
"ratio": 4.277966101694915,
"config_test"... |
__author__ = 'calvin'
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
import flask.ext.login as flask_login
# Mock database / persistence layer
app = Flask(__name__)
app.config.from_object('crashreporter_hq.config')
login_manager = flask_login.LoginManager()
login_manager.init_app(app)
login_ma... | {
"repo_name": "lobocv/crashreporter_hq",
"path": "crashreporter_hq/__init__.py",
"copies": "1",
"size": "1616",
"license": "mit",
"hash": -5850590493590650000,
"line_mean": 28.4,
"line_max": 75,
"alpha_frac": 0.6757425743,
"autogenerated": false,
"ratio": 3.8846153846153846,
"config_test": fals... |
__author__ = 'Calvin'
"""
This example demonstrates how pyperform can be used to benchmark class functions. In this example we use
ComparisonBenchmarks to compare the speed of two methods which calculates a person's savings.
** Note that when benchmarking class methods, the classname argument to ComparisonBenchmark mu... | {
"repo_name": "lobocv/pyperform",
"path": "examples/benchmark_class_functions.py",
"copies": "1",
"size": "2488",
"license": "mit",
"hash": 341621671546112800,
"line_mean": 45.9622641509,
"line_max": 120,
"alpha_frac": 0.6921221865,
"autogenerated": false,
"ratio": 3.7754172989377843,
"config_t... |
__author__ = 'Calvin'
try:
from builtins import range
except ImportError:
range = xrange
from pyperform import *
class SomeClass(object): #!
def __init__(self, n):
self.n = n
self.count = 0
if n > 0:
self.a = SomeClass(n-1)
def func(self):
self.count += 1
... | {
"repo_name": "lobocv/pyperform",
"path": "examples/generator_state_overhead.py",
"copies": "1",
"size": "1394",
"license": "mit",
"hash": -934522311877461200,
"line_mean": 23.8928571429,
"line_max": 116,
"alpha_frac": 0.5645624103,
"autogenerated": false,
"ratio": 3.649214659685864,
"config_te... |
import sys
import serial
import time
import math
class Navigate:
port1 = "/dev/ttyPCH1"
port2 = "/dev/ttyPCH2"
baudRate = 38400
ser1 = None
ser2 = None
def __init__(self):
self.ser1 = serial.Serial(self.port1, self.baudRate)
self.ser2 = serial.Serial(self.port2, self.baudRate)... | {
"repo_name": "cletusw/goal-e",
"path": "src/goale/scripts/Navigate.py",
"copies": "1",
"size": "7208",
"license": "mit",
"hash": -973178070804465200,
"line_mean": 32.6822429907,
"line_max": 131,
"alpha_frac": 0.5668701443,
"autogenerated": false,
"ratio": 3.1795324217026906,
"config_test": fal... |
import sys
import serial
import time
import math
theta = float(sys.argv[1])
x = float(sys.argv[2])
y = float(sys.argv[3])
port1 = "/dev/ttyPCH1"
port2 = "/dev/ttyPCH2"
baudRate = 38400
ser1 = serial.Serial(port1,baudRate)
ser2 = serial.Serial(port2,baudRate)
def serialSend1(send):
for i in send:
se... | {
"repo_name": "cletusw/goal-e",
"path": "misc/backup_navigate/backup8_navigate.py",
"copies": "1",
"size": "6050",
"license": "mit",
"hash": -7294911487062982000,
"line_mean": 28.2270531401,
"line_max": 113,
"alpha_frac": 0.6190082645,
"autogenerated": false,
"ratio": 2.8713811105837683,
"confi... |
__author__ = 'canderson'
class Person():
def __init__(self, name, age, weight, gender=""):
self.name = name
self.age = age
self.weight = weight
self.gender = gender
def summary(self):
if self.gender is "male":
return self.name + " is " + self.age + " years ... | {
"repo_name": "W0mpRat/user-signup",
"path": "Logic/classes.py",
"copies": "1",
"size": "1269",
"license": "unlicense",
"hash": 5573841582841412000,
"line_mean": 17.6764705882,
"line_max": 99,
"alpha_frac": 0.5460992908,
"autogenerated": false,
"ratio": 3.212658227848101,
"config_test": false,
... |
__author__ = 'caninemwenja'
from pyparsing import Word, alphanums, alphas, Literal, Suppress, ZeroOrMore, Optional, Group, oneOf
opening_bracket = Suppress("(")
closing_bracket = Suppress(")")
semicolon = Suppress(";")
comma = Suppress(",")
star = Literal("*")
identifier = Word(alphas, alphanums + "_")
values = Word... | {
"repo_name": "caninemwenja/siafu",
"path": "grammar.py",
"copies": "2",
"size": "2769",
"license": "mit",
"hash": -3566651239908189700,
"line_mean": 37.4583333333,
"line_max": 122,
"alpha_frac": 0.6579992777,
"autogenerated": false,
"ratio": 3.276923076923077,
"config_test": false,
"has_no_k... |
__author__ = 'caninemwenja'
from twisted.protocols.basic import LineReceiver
from twisted.internet import reactor
from twisted.internet.protocol import ClientFactory
import sys
def quit():
reactor.stop()
print "Bye!"
class Console(object):
def __init__(self):
self.history = []
def write(... | {
"repo_name": "kmwenja/siafu",
"path": "client.py",
"copies": "2",
"size": "2388",
"license": "mit",
"hash": -7641163170949932000,
"line_mean": 24.1368421053,
"line_max": 95,
"alpha_frac": 0.6122278057,
"autogenerated": false,
"ratio": 4.02020202020202,
"config_test": false,
"has_no_keywords"... |
__author__ = 'canliu'
"""
Save the alignment matrix in XML format. Like the following:
<sentence>
<source> </source>
<target> <target>
<alignment>
<sourceword> x,x,x... </sourceword>
<sourceword> x,x,x... </sourceword>
</alignment>
</sentence>
The number of rows is equal to the number o... | {
"repo_name": "cshanbo/nematus",
"path": "nematus/alignment_util.py",
"copies": "2",
"size": "7989",
"license": "bsd-3-clause",
"hash": -1449208181047120000,
"line_mean": 33.8864628821,
"line_max": 115,
"alpha_frac": 0.5879334084,
"autogenerated": false,
"ratio": 3.5443655723158827,
"config_tes... |
__author__ = 'can'
class Trie(dict):
def add_word(self, word):
trie = self
for letter in word:
trie = trie.setdefault(letter, Trie())
trie['.'] = None
def get_sub_trie(self, word):
trie = self
for letter in word:
if letter in trie:
... | {
"repo_name": "canguler/kelime_avi",
"path": "kelime_avi.py",
"copies": "1",
"size": "1968",
"license": "mit",
"hash": -1713063609492163300,
"line_mean": 22.4285714286,
"line_max": 88,
"alpha_frac": 0.4842479675,
"autogenerated": false,
"ratio": 3.364102564102564,
"config_test": false,
"has_n... |
__author__ = "Can Ozbek Arnav"
import pandas as pd
import numpy as np
import pylab
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
import sys
# sys.path.append("/Users/ahmetcanozbek/Desktop/EE660/660Project/Code_Final_Used/functions")
import ml_aux_functions as ml_aux
import crop_rock
imp... | {
"repo_name": "nishantnath/MusicPredictiveAnalysis_EE660_USCFall2015",
"path": "Code/Machine_Learning_Algos/training_t5.py",
"copies": "1",
"size": "6128",
"license": "mit",
"hash": -6134500176210941000,
"line_mean": 40.1275167785,
"line_max": 114,
"alpha_frac": 0.740535248,
"autogenerated": false,... |
__author__ = "Can Ozbek Arnav"
import pandas as pd
import numpy as np
import pylab
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
import sys
sys.path.append("/Users/ahmetcanozbek/Desktop/EE660/660Project/Code_Final_Used/functions")
import ml_aux_functions as ml_aux
import crop_rock
#PR... | {
"repo_name": "nishantnath/MusicPredictiveAnalysis_EE660_USCFall2015",
"path": "Code/Machine_Learning_Algos/training_fullset.py",
"copies": "1",
"size": "5923",
"license": "mit",
"hash": -949988992994559900,
"line_mean": 39.5684931507,
"line_max": 112,
"alpha_frac": 0.7627891271,
"autogenerated": f... |
__author__ = "Can Ozbek"
import os
import hdf5_getters
import featureExtractionFunctions
import time
import numpy
abspath = os.path.abspath(os.getcwd())
dirname = os.path.dirname(abspath)
#cd into million song subset folder
dataFolderPath = "/Resources/MillionSongSubset/data"
os.chdir(dirname + dataFolderPath)
print "... | {
"repo_name": "nishantnath/MusicPredictiveAnalysis_EE660_USCFall2015",
"path": "Code/Data Generation & Manipulation/MSD_Data_Extract_writeFeaturesToFile_10kSet.py",
"copies": "1",
"size": "5069",
"license": "mit",
"hash": 5237976647483685000,
"line_mean": 43.0869565217,
"line_max": 108,
"alpha_frac":... |
__author__ = "Can Ozbek"
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
import numpy as np
def getUniqueCount(df_column):
"""
Returns a dictionary of unique counts
:param df_column: pandas series, (column)
:return: dictionary containing unique counts
"""
unique_va... | {
"repo_name": "nishantnath/MusicPredictiveAnalysis_EE660_USCFall2015",
"path": "Code/functions/ml_aux_functions.py",
"copies": "1",
"size": "3435",
"license": "mit",
"hash": -549396424844916860,
"line_mean": 34.0510204082,
"line_max": 82,
"alpha_frac": 0.5650655022,
"autogenerated": false,
"ratio... |
__author__ = "Can Ozbek"
import hdf5_getters
import numpy
#Continuous variable feature functions
def getBarDuration(h5):
#Returns the average duration of bars in a song
barsVector = hdf5_getters.get_bars_start(h5)
#If there is no information, return None
if len(barsVector) < 2:
return ["nan"]
... | {
"repo_name": "nishantnath/MusicPredictiveAnalysis_EE660_USCFall2015",
"path": "Code/functions/featureExtractionFunctions.py",
"copies": "1",
"size": "5079",
"license": "mit",
"hash": -3977255454482863000,
"line_mean": 28.1896551724,
"line_max": 83,
"alpha_frac": 0.6544595393,
"autogenerated": fals... |
__author__ = "Can Ozbek"
import pandas as pd
import numpy as np
import pylab
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
import ml_aux_functions as ml_aux
#Read the files
df = pd.read_pickle("/Users/ahmetcanozbek/Desktop/660Stuff/msd.pkl")
df_train = pd.read_pickle("/Users/ahmetcanozb... | {
"repo_name": "nishantnath/MusicPredictiveAnalysis_EE660_USCFall2015",
"path": "Code/Visualizations & Insights/visualize_data.py",
"copies": "1",
"size": "1056",
"license": "mit",
"hash": 5542411333617014000,
"line_mean": 38.1111111111,
"line_max": 86,
"alpha_frac": 0.7604166667,
"autogenerated": f... |
__author__ = "Can Ozbek"
import pandas as pd
import numpy as np
import pylab
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
def getUniqueCount(df_column):
"""
Returns a dictionary of unique counts
:param df_column: pandas series, (column)
:return: dictionary containing u... | {
"repo_name": "nishantnath/MusicPredictiveAnalysis_EE660_USCFall2015",
"path": "Code/Machine_Learning_Algos/10k_Tests/ml_classification_svm2.py",
"copies": "1",
"size": "4905",
"license": "mit",
"hash": 1026919178911309600,
"line_mean": 32.8275862069,
"line_max": 108,
"alpha_frac": 0.6862385321,
"a... |
"""
Things left to do:
- Get date to increment by interval
- Add recurisive call
"""
from google_flight import google_flight_api
import datetime
def findBestRoute(array, start):
g = google_flight_api.GoogleFlight('')
temp = {}
end = {}
cheapest = array[0]
for i in range(0,len(array)):
if... | {
"repo_name": "caoimheharvey/Backpacking_Solution",
"path": "tsp.py",
"copies": "1",
"size": "2341",
"license": "mit",
"hash": -3767526770407553500,
"line_mean": 28.6329113924,
"line_max": 93,
"alpha_frac": 0.4882528834,
"autogenerated": false,
"ratio": 4.195340501792114,
"config_test": false,
... |
__author__ = 'caoxudong'
"""
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
push(x) -- Push element x onto stack.
pop() -- Removes the element on top of the stack.
top() -- Get the top element.
getMin() -- Retrieve the minimum element in the stack.
https:/... | {
"repo_name": "caoxudong/code_practice",
"path": "leetcode/155_MinStack.py",
"copies": "1",
"size": "1094",
"license": "mit",
"hash": 1319830387036717800,
"line_mean": 22.9090909091,
"line_max": 97,
"alpha_frac": 0.5639853748,
"autogenerated": false,
"ratio": 3.8118466898954706,
"config_test": ... |
__author__ = 'CarbonBlack, byt3smith'
# stdlib imports
import re
import sys
import time
import urllib.request, urllib.parse, urllib.error
import json
import optparse
import socket
import base64
import hashlib
# cb imports
sys.path.insert(0, "../../")
from .cbfeeds.feed import CbReport
from .cbfeeds.feed import CbFeed... | {
"repo_name": "byt3smith/Forager",
"path": "forager/cb/generate_feed.py",
"copies": "1",
"size": "4088",
"license": "mit",
"hash": 3923757986954018000,
"line_mean": 25.8947368421,
"line_max": 92,
"alpha_frac": 0.5741193738,
"autogenerated": false,
"ratio": 3.6895306859205776,
"config_test": fal... |
from simpleai.search import SearchProblem, hill_climbing_random_restarts
import sys
import pdb
import random
import time
class KnapsackProblem(SearchProblem):
def __init__(self,numObjects,maxWeight,weights,values):
super(KnapsackProblem, self)
self.weights = weights
self.values = values
... | {
"repo_name": "carmonc/assignment5",
"path": "CarmoneyHwk5.py",
"copies": "1",
"size": "2080",
"license": "mit",
"hash": -1284401116163399200,
"line_mean": 26.7333333333,
"line_max": 89,
"alpha_frac": 0.6048076923,
"autogenerated": false,
"ratio": 3.0498533724340176,
"config_test": false,
"ha... |
class Precise:
def __init__(self, number, decimals=0):
is_string = isinstance(number, str)
is_int = isinstance(number, int)
if not (is_string or is_int):
raise RuntimeError('Precise class initiated with something other than a string or int')
if is_int:
self.... | {
"repo_name": "ccxt/ccxt",
"path": "python/ccxt/base/precise.py",
"copies": "1",
"size": "5743",
"license": "mit",
"hash": 7739194745821787000,
"line_mean": 33.0773809524,
"line_max": 99,
"alpha_frac": 0.5930131004,
"autogenerated": false,
"ratio": 4.034531360112755,
"config_test": false,
"ha... |
#Imports
from emokit import emotiv
from pykeyboard import PyKeyboard
from sklearn.cross_validation import train_test_split
from time import sleep
from winsound import Beep as beep
import gevent
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import platform
import pyttsx
import time
... | {
"repo_name": "camm0991/ThesisProject",
"path": "Scripts/01 Signal recording/EEG sampling procedure.py",
"copies": "1",
"size": "3912",
"license": "mit",
"hash": -4394811692026668500,
"line_mean": 29.0923076923,
"line_max": 248,
"alpha_frac": 0.6124744376,
"autogenerated": false,
"ratio": 3.17274... |
import re, sys, math
from bs4 import BeautifulSoup
STOP_WORDS = ["a", "about", "above", "above", "across", "after", "afterwards", \
"again", "against", "all", "almost", "alone", "along", "already",\
"also","although","always","am","among", "amongst", "amoungst",\
"amount", ... | {
"repo_name": "elmadjian/pcs5735",
"path": "aula3/exercise03.py",
"copies": "1",
"size": "9424",
"license": "mpl-2.0",
"hash": -6139875195463779000,
"line_mean": 45.6534653465,
"line_max": 85,
"alpha_frac": 0.4644524618,
"autogenerated": false,
"ratio": 3.6148830072880704,
"config_test": false,... |
from __future__ import print_function
import numpy as np
import sys
import matplotlib.pyplot as plt
from keras.datasets import reuters
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras.utils import np_utils
from keras.callbacks import Callback
#Necessary to recover acc... | {
"repo_name": "elmadjian/pcs5735",
"path": "aula2/exercise04.py",
"copies": "1",
"size": "3344",
"license": "mpl-2.0",
"hash": -6357290127504135000,
"line_mean": 32.42,
"line_max": 96,
"alpha_frac": 0.6029323758,
"autogenerated": false,
"ratio": 3.793416572077185,
"config_test": true,
"has_no... |
import numpy as np
#Class to model a single neuron
#------------------------------
class Neuron():
def __init__(self, idx, eta, inputs):
self.idx = idx
self.eta = eta
self.weight = [0.0 for i in range(inputs+1)]
self.input = [1.0 for i in range(inputs+1)]
self.f_links = ... | {
"repo_name": "elmadjian/pcs5735",
"path": "aula2/exercise01.py",
"copies": "1",
"size": "3304",
"license": "mpl-2.0",
"hash": 6453538485390030000,
"line_mean": 28.2300884956,
"line_max": 77,
"alpha_frac": 0.5165001514,
"autogenerated": false,
"ratio": 3.0754189944134076,
"config_test": false,
... |
import sys
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import numpy as np
theta_list = []
x_list = []
y_list = []
def main():
if len(sys.argv) != 2:
print("modo de usar: <este_programa> <arquivo_csv>")
sys.exit()
csv_file = sys.argv[1]
with open(csv_file, "r") a... | {
"repo_name": "elmadjian/pcs5735",
"path": "aula1/logistic_regression.py",
"copies": "1",
"size": "3369",
"license": "mpl-2.0",
"hash": -1257968575261042400,
"line_mean": 30.7169811321,
"line_max": 86,
"alpha_frac": 0.5214158239,
"autogenerated": false,
"ratio": 2.8491525423728814,
"config_test... |
import sys
import matplotlib.pyplot as plt
import numpy as np
theta_list = []
x_list = []
y_list = []
def main():
if len(sys.argv) != 2:
print("modo de usar: <este_programa> <arquivo_csv>")
sys.exit()
csv_file = sys.argv[1]
with open(csv_file, "r") as arquivo:
classes = arquivo.r... | {
"repo_name": "elmadjian/pcs5735",
"path": "aula1/linear_regression.py",
"copies": "1",
"size": "3543",
"license": "mpl-2.0",
"hash": -2575507641784892000,
"line_mean": 31.4678899083,
"line_max": 96,
"alpha_frac": 0.5289629839,
"autogenerated": false,
"ratio": 3.1071115013169446,
"config_test":... |
__author__ = 'Carlos'
from django.db import models
from django.core.management.base import BaseCommand, CommandError
from boe_api.state_documents.models import Diario ,Documento, Departamento, Rango, Origen_legislativo, DocumentoAnuncio, \
Modalidad, Tipo, Tramitacion, Precio, Procedimiento, DocumentoBORME
from boe... | {
"repo_name": "BOE-API/new_boe_api",
"path": "boe_api/state_documents/processDocument.py",
"copies": "1",
"size": "15113",
"license": "mit",
"hash": 3265050563054032400,
"line_mean": 46.6782334385,
"line_max": 133,
"alpha_frac": 0.6115265004,
"autogenerated": false,
"ratio": 3.325924295774648,
... |
__author__ = 'Carlos'
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from principal.forms import NewForm
from django.template import RequestContext
from django.contrib.auth.decorators import permission_required
from django.contrib import messages
from django.u... | {
"repo_name": "carborgar/gestionalumnostfg",
"path": "principal/views/NewViews.py",
"copies": "1",
"size": "2853",
"license": "mit",
"hash": -595759007780091900,
"line_mean": 37.5675675676,
"line_max": 102,
"alpha_frac": 0.6498422713,
"autogenerated": false,
"ratio": 4.046808510638298,
"config_... |
__author__ = 'Carlos'
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from principal.forms import StudentProfileForm, AddressForm
from principal.models import Alumno, Profesor
from django.template import RequestContext
from django.contrib.auth.decorators import... | {
"repo_name": "carborgar/gestionalumnostfg",
"path": "principal/views/ProfileViews.py",
"copies": "1",
"size": "4601",
"license": "mit",
"hash": -420105140865261440,
"line_mean": 42,
"line_max": 110,
"alpha_frac": 0.7007172354,
"autogenerated": false,
"ratio": 3.9324786324786323,
"config_test":... |
__author__ = 'Carlos'
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import permission_required
from django.utils.translation import ugettext as _
from principal.services import PeticionCitaServ... | {
"repo_name": "carborgar/gestionalumnostfg",
"path": "principal/views/TutorialViews.py",
"copies": "1",
"size": "7256",
"license": "mit",
"hash": 1658312349691194000,
"line_mean": 40.4628571429,
"line_max": 150,
"alpha_frac": 0.6491179713,
"autogenerated": false,
"ratio": 3.7929952953476214,
"c... |
__author__ = 'Carlos'
from principal.models import Alumno, Profesor, Peticioncita
from datetime import timedelta
import hashlib
from principal.views import EmailViews
def create(form, student_id):
lecturer = Profesor.objects.get(id=form.cleaned_data['lecturer'])
return Peticioncita(
alumno=Alumno.obj... | {
"repo_name": "carborgar/gestionalumnostfg",
"path": "principal/services/PeticionCitaService.py",
"copies": "1",
"size": "4412",
"license": "mit",
"hash": 1180575532143875600,
"line_mean": 36.7179487179,
"line_max": 120,
"alpha_frac": 0.6883499547,
"autogenerated": false,
"ratio": 3.4043209876543... |
__author__ = 'Carlos'
from principal.models import Ficha, Alumno, Profesor
from principal.services import AddressService
def reconstruct_and_save(form, formset, student_id):
student = Alumno.objects.get(id=student_id)
if student.ficha:
# Use existing data
data = student.ficha
else:
... | {
"repo_name": "carborgar/gestionalumnostfg",
"path": "principal/services/ProfileService.py",
"copies": "1",
"size": "3280",
"license": "mit",
"hash": 3959899477551156000,
"line_mean": 33.8936170213,
"line_max": 118,
"alpha_frac": 0.6533536585,
"autogenerated": false,
"ratio": 3.4453781512605044,
... |
__author__ = 'Carlos'
from principal.models import Tutoria
def update(tutorial_form, lecturer):
old_id = tutorial_form.cleaned_data['tutorial_id']
if old_id:
# Edit the current tutorial
old_tutorial = Tutoria.objects.get(id=old_id)
assert old_tutorial.profesor == lecturer
old_... | {
"repo_name": "carborgar/gestionalumnostfg",
"path": "principal/services/TutorialService.py",
"copies": "1",
"size": "1040",
"license": "mit",
"hash": -7851903776225163000,
"line_mean": 31.5,
"line_max": 74,
"alpha_frac": 0.6653846154,
"autogenerated": false,
"ratio": 3.25,
"config_test": false... |
__author__ = 'carlpearson'
import csv
def seeds():
res = []
with open("rdat.csv", newline="") as csvfile:
lines_reader = csv.reader(csvfile)
lines_reader.__next__()
for x in range(0, 5):
dat = lines_reader.__next__()
res.append(int(dat[1].strip()))
return re... | {
"repo_name": "AIMS-Ghana/cams",
"path": "disorganized/dostuff.py",
"copies": "2",
"size": "1634",
"license": "cc0-1.0",
"hash": -3806814497113424000,
"line_mean": 26.7118644068,
"line_max": 61,
"alpha_frac": 0.4663402693,
"autogenerated": false,
"ratio": 3.536796536796537,
"config_test": false... |
__author__ = 'Caroline Beyne'
from PyQt4 import QtGui, QtCore
import sys
from FrameLayout import FrameLayout
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
win = QtGui.QMainWindow()
w = QtGui.QWidget()
w.setMinimumWidth(350)
win.setCentralWidget(w)
l = QtGui.QVBoxLayout()
... | {
"repo_name": "By0ute/pyqt-collapsable-widget",
"path": "code/main.py",
"copies": "1",
"size": "1244",
"license": "mit",
"hash": -791179006238507400,
"line_mean": 25.4680851064,
"line_max": 57,
"alpha_frac": 0.5844051447,
"autogenerated": false,
"ratio": 3.214470284237726,
"config_test": false,... |
__author__ = 'carolinux'
"""Functionality that requires knowledge of the lastFM api"""
import json
import requests
from datetime import datetime
class LastFmException(Exception):
pass
def create_url(user_name, api_key, page, to_date):
return "http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&u... | {
"repo_name": "carolinux/lastfm-fetch",
"path": "lastfm.py",
"copies": "1",
"size": "1332",
"license": "mit",
"hash": 8853960768056567000,
"line_mean": 29.976744186,
"line_max": 95,
"alpha_frac": 0.6403903904,
"autogenerated": false,
"ratio": 3.3979591836734695,
"config_test": false,
"has_no_... |
__author__ = 'carolinux'
import abc
import os
import pandas as pd
import numpy as np
from datetime import datetime
"""Classes to help store and load the user song data"""
class DataStore:
"""Abstract base class to define interface for functionality.
Could extend this to a number of concrete implementations
... | {
"repo_name": "carolinux/lastfm-fetch",
"path": "datastore.py",
"copies": "1",
"size": "2479",
"license": "mit",
"hash": 974635955201682400,
"line_mean": 29.9875,
"line_max": 95,
"alpha_frac": 0.6135538524,
"autogenerated": false,
"ratio": 3.556671449067432,
"config_test": false,
"has_no_keyw... |
__author__ = 'carol'
import os
import sys
import tempfile
import mimetypes
import webbrowser
# Import the email modules we'll need
from email import policy
from email.parser import BytesParser
# An imaginary module that would make this work and be safe.
from imaginary import magic_html_parser
# In a real program yo... | {
"repo_name": "willingc/tone-tuner",
"path": "emailprocessor.py",
"copies": "1",
"size": "2928",
"license": "mit",
"hash": 6593710908728064000,
"line_mean": 37.025974026,
"line_max": 80,
"alpha_frac": 0.6854508197,
"autogenerated": false,
"ratio": 3.655430711610487,
"config_test": false,
"has... |
__author__ = 'carol'
#!/usr/bin/env python3
import smtplib
from email.message import EmailMessage
from email.headerregistry import Address
from email.utils import make_msgid
# Create the base text message.
msg = EmailMessage()
msg['Subject'] = "Ayons asperges pour le déjeuner"
msg['From'] = Address("Pepé Le Pew", "... | {
"repo_name": "willingc/tone-tuner",
"path": "emailcreator.py",
"copies": "1",
"size": "1735",
"license": "mit",
"hash": -6102754864440518000,
"line_mean": 28.7931034483,
"line_max": 82,
"alpha_frac": 0.6724537037,
"autogenerated": false,
"ratio": 2.918918918918919,
"config_test": false,
"has... |
__author__ = 'carpedm20'
__date__ = '2014.07.25'
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
# http://movie.naver.com/movie/sdb/rank/rmovie.nhn?sel=cnt&date=20050207&tg=0
from scrapy.item import Item, Field
class Movie(Item):
name = Field()
url = Field()
rank = Fie... | {
"repo_name": "carpedm20/voxoffice",
"path": "scrapy/tutorial/spiders/spider.py",
"copies": "1",
"size": "1665",
"license": "bsd-3-clause",
"hash": 7751475743897971000,
"line_mean": 23.8507462687,
"line_max": 82,
"alpha_frac": 0.590990991,
"autogenerated": false,
"ratio": 3.2905138339920947,
"c... |
__author__ = 'carpedm20'
__date__ = '2014.07.25'
from scrapy.spider import BaseSpider
# http://movie.naver.com/movie/sdb/rank/rmovie.nhn?sel=cnt&date=20050207&tg=0
from scrapy.item import Item, Field
class Movie(Item):
name = Field()
url = Field()
rank = Field()
date = Field()
#tgs = range(20)
#tgs... | {
"repo_name": "carpedm20/voxoffice",
"path": "scrapy/tutorial/spiders/people.py",
"copies": "1",
"size": "1642",
"license": "bsd-3-clause",
"hash": -559398472010503700,
"line_mean": 24.2615384615,
"line_max": 83,
"alpha_frac": 0.5889159562,
"autogenerated": false,
"ratio": 3.277445109780439,
"c... |
__author__ = 'carpedm20'
__date__ = '2014.07.25'
from scrapy.spider import BaseSpider
# http://music.naver.com/listen/history/index.nhn?type=TOTAL&year=2008&month=01&week=3
from scrapy.item import Item, Field
class Music(Item):
name = Field()
artist = Field()
artist_id = Field()
track_id = Field()
... | {
"repo_name": "carpedm20/voxoffice",
"path": "scrapy/tutorial/spiders/music.py",
"copies": "1",
"size": "3090",
"license": "bsd-3-clause",
"hash": 4313880998598796300,
"line_mean": 29,
"line_max": 105,
"alpha_frac": 0.5187702265,
"autogenerated": false,
"ratio": 3.5930232558139537,
"config_test... |
__author__ = 'Casey Bajema'
from jcudc24ingesterapi import typed, APIDomainObject, ValidationError
from jcudc24ingesterapi.models.data_sources import _DataSource
from jcudc24ingesterapi.models.locations import LocationOffset
class Dataset(APIDomainObject):
"""
Represents a single dataset and contains the infor... | {
"repo_name": "jcu-eresearch/jcu.dc24.ingesterapi",
"path": "jcudc24ingesterapi/models/dataset.py",
"copies": "1",
"size": "1941",
"license": "bsd-3-clause",
"hash": 8533389889003021000,
"line_mean": 47.525,
"line_max": 140,
"alpha_frac": 0.658423493,
"autogenerated": false,
"ratio": 4.0863157894... |
__author__ = 'Casey Bajema'
from jcudc24ingesterapi import typed, APIDomainObject, ValidationError
class Region(APIDomainObject):
"""
Represents a 2D area on earth, possible a sub-region of another regions.
An example would be that Queensland is a sub-region of Australia
"""
__xmlrpc_class... | {
"repo_name": "jcu-eresearch/jcu.dc24.ingesterapi",
"path": "jcudc24ingesterapi/models/locations.py",
"copies": "1",
"size": "3232",
"license": "bsd-3-clause",
"hash": -1037607897714154000,
"line_mean": 40.4358974359,
"line_max": 120,
"alpha_frac": 0.603960396,
"autogenerated": false,
"ratio": 4.... |
__author__ = 'Casey Bajema'
import logging
from jcudc24ingesterapi import typed, APIDomainObject, ValidationError
from jcudc24ingesterapi.schemas.data_types import DataType
logger = logging.getLogger(__name__)
class TypedList(list):
def __init__(self, valid_type):
self.valid_type = valid_type
def app... | {
"repo_name": "jcu-eresearch/jcu.dc24.ingesterapi",
"path": "jcudc24ingesterapi/schemas/__init__.py",
"copies": "1",
"size": "3547",
"license": "bsd-3-clause",
"hash": 6785203315810967000,
"line_mean": 32.7904761905,
"line_max": 104,
"alpha_frac": 0.6143219622,
"autogenerated": false,
"ratio": 4.... |
__author__ = 'Casey Bajema'
import re
from jcudc24ingesterapi import typed
RE_ATTR_NAME = re.compile("^[A-Za-z][A-Za-z0-9_]*$")
class DataType(object):
"""
Base data type schema defines an empty dictionary that can have fields added to it dynamically,
these fields will then be used by the ingester platfo... | {
"repo_name": "jcu-eresearch/jcu.dc24.ingesterapi",
"path": "jcudc24ingesterapi/schemas/data_types.py",
"copies": "1",
"size": "1690",
"license": "bsd-3-clause",
"hash": -2948329365884264400,
"line_mean": 30.8867924528,
"line_max": 104,
"alpha_frac": 0.674556213,
"autogenerated": false,
"ratio": ... |
__author__ = 'casey'
from collections import Iterable
import numpy as np
from coverage_model.coverage import AbstractCoverage, ComplexCoverageType, SimplexCoverage
from coverage_model.coverages.aggregate_coverage import AggregateCoverage
from coverage_model.coverages.coverage_extents import ReferenceCoverageExtents, E... | {
"repo_name": "ooici/coverage-model",
"path": "coverage_model/coverages/complex_coverage.py",
"copies": "1",
"size": "8186",
"license": "bsd-2-clause",
"hash": -5764268990815822000,
"line_mean": 52.8552631579,
"line_max": 154,
"alpha_frac": 0.5973613486,
"autogenerated": false,
"ratio": 4.4200863... |
__author__ = 'casey'
from coverage_model.storage.span_storage import SpanStorage
class InMemoryStorage(SpanStorage):
def __init__(self):
self.coverage_dict = {}
def write_span(self, span):
if span.coverage_id not in self.coverage_dict:
self.coverage_dict[span.coverage_id] = []
... | {
"repo_name": "ooici/coverage-model",
"path": "coverage_model/storage/in_memory_storage.py",
"copies": "1",
"size": "1185",
"license": "bsd-2-clause",
"hash": -8144909106374799000,
"line_mean": 37.2258064516,
"line_max": 124,
"alpha_frac": 0.6312236287,
"autogenerated": false,
"ratio": 3.87254901... |
__author__ = 'casey'
from ooi.logging import log
from coverage_model.coverage import *
from coverage_model.parameter import ParameterDictionary
from coverage_model.parameter_data import NumpyDictParameterData
from coverage_model.parameter_values import get_value_class
from coverage_model.persistence import is_persiste... | {
"repo_name": "ooici/coverage-model",
"path": "coverage_model/coverages/aggregate_coverage.py",
"copies": "1",
"size": "21044",
"license": "bsd-2-clause",
"hash": -3729567070958117400,
"line_mean": 43.7744680851,
"line_max": 197,
"alpha_frac": 0.571231705,
"autogenerated": false,
"ratio": 4.19621... |
__author__ = 'casey'
import ast
class AddressFactory(object):
@staticmethod
def from_db_str(st):
try:
if len(st) > 0 and ':::' in st:
s = st.split(":::")
if s[0] == BrickAddress.__name__:
return BrickAddress.from_db_str(st)
... | {
"repo_name": "ooici/coverage-model",
"path": "coverage_model/address.py",
"copies": "1",
"size": "11055",
"license": "bsd-2-clause",
"hash": 1367302892378781000,
"line_mean": 30.5885714286,
"line_max": 99,
"alpha_frac": 0.5354138399,
"autogenerated": false,
"ratio": 3.8830347734457322,
"config... |
__author__ = 'casey'
import json
from coverage_model.basic_types import Dictable
from coverage_model.util.jsonable import Jsonable, unicode_convert
class ReferenceCoverageExtents(Jsonable):
def __init__(self, name, reference_coverage_id, time_extents=None, domain_extents=None):
self.name = str(name)
... | {
"repo_name": "ooici/coverage-model",
"path": "coverage_model/coverages/coverage_extents.py",
"copies": "1",
"size": "2671",
"license": "bsd-2-clause",
"hash": 1720814195428947700,
"line_mean": 38.2794117647,
"line_max": 143,
"alpha_frac": 0.6169973793,
"autogenerated": false,
"ratio": 3.61924119... |
__author__ = 'casey'
def get_overlap(first, second):
if first is None and second is None:
return None
elif first is None and second is not None:
return second
elif first is not None and second is None:
return first
else:
if isinstance(first, (tuple, list, set)) and isin... | {
"repo_name": "ooici/coverage-model",
"path": "coverage_model/util/extent_utils.py",
"copies": "1",
"size": "2756",
"license": "bsd-2-clause",
"hash": -5248907677937872000,
"line_mean": 34.3461538462,
"line_max": 125,
"alpha_frac": 0.4716981132,
"autogenerated": false,
"ratio": 4.416666666666667,... |
__author__ = 'casey'
from nose.plugins.attrib import attr
import numpy as np
import os, shutil, tempfile
import unittest
from pyon.core.bootstrap import CFG
from pyon.datastore.datastore_common import DatastoreFactory
import psycopg2
import psycopg2.extras
from coverage_model import *
from coverage_model.address impo... | {
"repo_name": "ooici/coverage-model",
"path": "coverage_model/test/test_span_index.py",
"copies": "1",
"size": "22832",
"license": "bsd-2-clause",
"hash": -2708333229908296700,
"line_mean": 45.5010183299,
"line_max": 296,
"alpha_frac": 0.6236422565,
"autogenerated": false,
"ratio": 3.512075065374... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.