text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'prossi'
import base64
import requests
from lxml import objectify, etree
import skyscape_vapp
import skyscape_vcloud_methods
import skyscape_error
import skyscape_task
import skyscape_orgvdc
import skyscape_vappnetwork
import skyscape_vapptemplate
import skyscape_vcloud_types
import skyscape_vm
import sky... | {
"repo_name": "skyscape-cloud-services/skyscape_python",
"path": "skyscape/__init__.py",
"copies": "1",
"size": "8656",
"license": "apache-2.0",
"hash": 769254524969161500,
"line_mean": 43.3948717949,
"line_max": 163,
"alpha_frac": 0.6414048059,
"autogenerated": false,
"ratio": 3.7799126637554585... |
__author__ = 'prossi'
import skyscape
class Vcloud_Types:
def __init__(self, data, connection):
self.connection = connection
if hasattr(data, 'VMRecord'):
self.cloudtype = 'VM'
self.data = data.VMRecord
self.count = data.VMRecord.__len__()
elif hasattr(... | {
"repo_name": "skyscape-cloud-services/skyscape_python",
"path": "skyscape/skyscape_vcloud_types.py",
"copies": "1",
"size": "3221",
"license": "apache-2.0",
"hash": 255934237881725760,
"line_mean": 43.75,
"line_max": 91,
"alpha_frac": 0.596398634,
"autogenerated": false,
"ratio": 3.9913258983890... |
__author__ = 'psteam'
import mock
from nova import context
from nova import db
from nova import test
from nova.tests import utils as test_utils
from nova.virt.hpux import driver as hpux_driver
from nova.virt.hpux import hostops
from nova.virt.hpux import vparops
from oslo.config import cfg
CONF = cfg.CONF
class HP... | {
"repo_name": "leilihh/nova",
"path": "nova/tests/virt/hpux/test_hpux.py",
"copies": "1",
"size": "10428",
"license": "apache-2.0",
"hash": -7907142962648382000,
"line_mean": 43.186440678,
"line_max": 78,
"alpha_frac": 0.5794975067,
"autogenerated": false,
"ratio": 3.390117035110533,
"config_te... |
__author__ = 'psteam'
"""
A HP-UX Nova Compute driver.
"""
from nova import db
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.virt import driver
from nova.virt.hpux import hostops
from nova.virt.hpux import vparops
from oslo.confi... | {
"repo_name": "leilihh/nova",
"path": "nova/virt/hpux/driver.py",
"copies": "1",
"size": "9092",
"license": "apache-2.0",
"hash": -3021989320498559500,
"line_mean": 37.0418410042,
"line_max": 79,
"alpha_frac": 0.5834799824,
"autogenerated": false,
"ratio": 4.186003683241252,
"config_test": fals... |
__author__ = 'psteam'
"""
A HP-UX Nova Compute driver.
"""
import pexpect
from nova import exception
from nova.openstack.common.gettextutils import _
from oslo.config import cfg
CONF = cfg.CONF
class ExecRemoteCmd(object):
def exec_remote_cmd(self, **remote_cmd_info):
execute_result = None
try... | {
"repo_name": "leilihh/nova",
"path": "nova/virt/hpux/utils.py",
"copies": "1",
"size": "1516",
"license": "apache-2.0",
"hash": -7561828967327292000,
"line_mean": 32.6888888889,
"line_max": 74,
"alpha_frac": 0.5257255937,
"autogenerated": false,
"ratio": 4.664615384615384,
"config_test": false... |
__author__ = 'psteam'
"""
Management class for host operations.
"""
from nova import context
from nova import db
from nova.openstack.common.gettextutils import _
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.virt.hpux import utils
from oslo.config import cfg
fr... | {
"repo_name": "leilihh/nova",
"path": "nova/virt/hpux/hostops.py",
"copies": "1",
"size": "9878",
"license": "apache-2.0",
"hash": -8650344340530707000,
"line_mean": 37.737254902,
"line_max": 77,
"alpha_frac": 0.5326989269,
"autogenerated": false,
"ratio": 3.912079207920792,
"config_test": fals... |
__author__ = 'psuresh'
from pyramid.interfaces import ISession
from pyramid.compat import PY3, pickle
from pyramid.session import manage_changed
from zope.interface import implementer
import time
import dateutil.parser
import requests
from pyramid_okta.utils import clear_session
from pyramid_okta.utils import OktaErro... | {
"repo_name": "coolnay309/pyramid_okta",
"path": "pyramid_okta/session.py",
"copies": "1",
"size": "6606",
"license": "mit",
"hash": 8792571062432586000,
"line_mean": 31.5467980296,
"line_max": 74,
"alpha_frac": 0.5214956101,
"autogenerated": false,
"ratio": 4.6784702549575075,
"config_test": f... |
__author__ = 'psuresh'
import argparse
import asyncio
import logging
import sys
import time
import warnings
parser = argparse.ArgumentParser('debugging asyncio')
parser.add_argument(
'-v',
dest='verbose',
default=False,
action='store_true',
)
args = parser.parse_args()
logging.basicConfig(
level=... | {
"repo_name": "coolnay309/async-design-patterns",
"path": "debugging-ioloop/debugging.py",
"copies": "1",
"size": "2820",
"license": "apache-2.0",
"hash": -5937883215963724000,
"line_mean": 33.3902439024,
"line_max": 508,
"alpha_frac": 0.7166666667,
"autogenerated": false,
"ratio": 3.547169811320... |
__author__ = 'psuresh'
import asyncio
import concurrent.futures
import functools
def predicate(n):
return n % 2 == 0
@asyncio.coroutine
def consumer(condition, n):
try:
with (yield from condition):
print('consumer {} is waiting'.format(n))
yield from condition.wait_for(functo... | {
"repo_name": "coolnay309/async-design-patterns",
"path": "coroutine-conditions/conditional_wake_up.py",
"copies": "1",
"size": "2434",
"license": "apache-2.0",
"hash": 8974555548940366000,
"line_mean": 23.34,
"line_max": 74,
"alpha_frac": 0.6676253081,
"autogenerated": false,
"ratio": 4.17495711... |
__author__ = 'psuresh'
import asyncio
import concurrent.futures
import logging
import sys
import time
def blocks(n):
log = logging.getLogger('blocks({})'.format(n))
log.info('running')
time.sleep(0.1)
log.info('done')
return n ** 2
@asyncio.coroutine
def run_blocking_tasks(executor):
log = ... | {
"repo_name": "coolnay309/async-design-patterns",
"path": "blocking-executor/process_executor.py",
"copies": "1",
"size": "2209",
"license": "apache-2.0",
"hash": -1852146987616309500,
"line_mean": 27.3333333333,
"line_max": 86,
"alpha_frac": 0.6007243096,
"autogenerated": false,
"ratio": 3.66943... |
__author__ = 'psuresh'
import asyncio
@asyncio.coroutine
def bug():
raise Exception("not consumed")
loop = asyncio.get_event_loop()
task = asyncio.ensure_future(bug())
loop.run_until_complete(task)
# Output
# python uncaught_exception.py
# Traceback (most recent call last):
# File "uncaught_exception.py", li... | {
"repo_name": "coolnay309/async-design-patterns",
"path": "coroutine-exceptions/uncaught_exception.py",
"copies": "1",
"size": "1080",
"license": "apache-2.0",
"hash": -2844800110643287600,
"line_mean": 36.2413793103,
"line_max": 130,
"alpha_frac": 0.7148148148,
"autogenerated": false,
"ratio": 3... |
__author__ = 'psuresh'
import asyncio
@asyncio.coroutine
def task_func():
print('in task_func')
return 'the result'
@asyncio.coroutine
def main(loop):
print('creating task')
task = loop.create_task(task_func())
print('waiting for {!r}'.format(task))
return_value = yield from task
print('... | {
"repo_name": "coolnay309/async-design-patterns",
"path": "task-management/create_task.py",
"copies": "1",
"size": "1067",
"license": "apache-2.0",
"hash": 2964503703311246300,
"line_mean": 30.3823529412,
"line_max": 173,
"alpha_frac": 0.6298031865,
"autogenerated": false,
"ratio": 3.556666666666... |
__author__ = 'psuresh'
import asyncio
@asyncio.coroutine
def consumer(n, q):
print('consumer {}: starting'.format(n))
while True:
print('consumer {}: waiting for item'.format(n))
item = yield from q.get()
print('consumer {}: has item {}'.format(n, item))
if item is None:
... | {
"repo_name": "coolnay309/async-design-patterns",
"path": "coroutine-queue/producer-consumer.py",
"copies": "1",
"size": "2774",
"license": "apache-2.0",
"hash": -5597832558024578000,
"line_mean": 27.5979381443,
"line_max": 70,
"alpha_frac": 0.6463590483,
"autogenerated": false,
"ratio": 3.805212... |
__author__ = 'psuresh'
import asyncio
import concurrent.futures
import logging
import sys
import time
def blocks(n):
log = logging.getLogger('blocks({})'.format(n))
log.info('running')
time.sleep(0.1)
log.info('done')
return n ** 2
@asyncio.coroutine
def run_blocking_tasks(executor):
log =... | {
"repo_name": "coolnay309/async-design-patterns",
"path": "blocking-executor/thread_executor.py",
"copies": "1",
"size": "2214",
"license": "apache-2.0",
"hash": -8011654412950641000,
"line_mean": 26.6875,
"line_max": 74,
"alpha_frac": 0.5980126468,
"autogenerated": false,
"ratio": 3.671641791044... |
__author__ = 'psuresh'
# Use when the number of tasks fired are unknown and dynamic
import asyncio
@asyncio.coroutine
def phase(i):
print('in phase {}'.format(i))
yield from asyncio.sleep(0.1 * i)
print('done with phase {}'.format(i))
return 'phase {} result'.format(i)
@asyncio.coroutine
def main(n... | {
"repo_name": "coolnay309/async-design-patterns",
"path": "task-management/fire_and_collect.py",
"copies": "1",
"size": "1269",
"license": "apache-2.0",
"hash": 2017924794805979600,
"line_mean": 23.8823529412,
"line_max": 121,
"alpha_frac": 0.6201733649,
"autogenerated": false,
"ratio": 3.5646067... |
__author__ = 'psymphonic'
#coding=utf-8
import urllib
import simplejson as json
import uuid
import requests
from collections import deque
## @package psynth
# psynth is the official python package for generating graphs in Psymphonic Psynth
allowed_queries = ['createmap', 'getfilelist', 'renamemap', 'getwholegraph', '... | {
"repo_name": "shawnrushefsky/python_psynth",
"path": "psynth/psynth.py",
"copies": "1",
"size": "45747",
"license": "mit",
"hash": -670482795801733500,
"line_mean": 33.842345773,
"line_max": 226,
"alpha_frac": 0.518831836,
"autogenerated": false,
"ratio": 3.746069439895185,
"config_test": fals... |
__author__ = 'psymphonic'
from random import randint
from psynth.psynth import *
# Create a Graph
g = create_graph(
name='api test',
url='http://psynth.psymphonic.com/',
username='user@company.com',
key='yourapikey'
)
# Create 10 Nodes
for i in range(0,10):
n = Node(name='Node '+str(i))
g.a... | {
"repo_name": "shawnrushefsky/python_psynth",
"path": "test.py",
"copies": "1",
"size": "1119",
"license": "mit",
"hash": 98410268036926160,
"line_mean": 20.1132075472,
"line_max": 84,
"alpha_frac": 0.6210902592,
"autogenerated": false,
"ratio": 2.8401015228426396,
"config_test": false,
"has_... |
__author__ = 'psymphonic'
import os
from setuptools import setup
setup(
name="psynth",
packages=['psynth'],
version="0.1.3",
description="The official open-source Python library for generating graphs in Psymphonic Psynth.",
url="http://shawnrushefsky.github.io/python_psynth",
download_url='http... | {
"repo_name": "shawnrushefsky/python_psynth",
"path": "Setup.py",
"copies": "1",
"size": "1521",
"license": "mit",
"hash": 5539044738589536000,
"line_mean": 40.1351351351,
"line_max": 102,
"alpha_frac": 0.6397107166,
"autogenerated": false,
"ratio": 3.910025706940874,
"config_test": false,
"h... |
__author__ = 'ptonini'
import os
import sys
import socket
import time
import subprocess
import re
import psutil
class CommandRunner:
devnull = open(os.devnull, 'w')
class Service(CommandRunner):
need_restart = False
def __init__(self, name, pidfile, script, port, is_java, sampling, threshold):
... | {
"repo_name": "ptonini/m2m-watchdog",
"path": "lib/classes.py",
"copies": "1",
"size": "5152",
"license": "unlicense",
"hash": -8527109830323208000,
"line_mean": 30.4207317073,
"line_max": 118,
"alpha_frac": 0.4974767081,
"autogenerated": false,
"ratio": 4.250825082508251,
"config_test": false,... |
__author__ = 'ptonini'
import re
import os
import sys
import math
import time
from ConfigParser import ConfigParser
from pymongo import MongoClient
from gmusicapi import Musicmanager
from gmusicapi import Mobileclient
from gmusicapi import Webclient
import lib.classes as classes
def get_vars(filename):
config =... | {
"repo_name": "ptonini/Stratus",
"path": "lib/func.py",
"copies": "1",
"size": "4804",
"license": "unlicense",
"hash": 7781525938177946000,
"line_mean": 31.0333333333,
"line_max": 104,
"alpha_frac": 0.5861781848,
"autogenerated": false,
"ratio": 3.791633780584057,
"config_test": true,
"has_no... |
__author__ = 'ptoth'
import config.sr_network_configuration_test as base_config
import config.sym_network_config_test as base_config
import unittest
from recurrent_network.Network import *
import numpy as np
import matplotlib.pyplot as plt
from sklearn import preprocessing
class SRNetworkTest(unittest.TestCase):
... | {
"repo_name": "eidonfiloi/SparseRecurrentNetwork",
"path": "tests/SRNetworkTest.py",
"copies": "1",
"size": "6984",
"license": "mit",
"hash": -3912817543220304000,
"line_mean": 47.1724137931,
"line_max": 107,
"alpha_frac": 0.4256872852,
"autogenerated": false,
"ratio": 2.4207972270363953,
"conf... |
__author__ = 'ptoth'
def get_config():
params = {}
params['global'] = {
'epochs': 1
}
update_epochs = 1
verbose = 1
activation_function = "Sigmoid"
loss_function = "MSE"
activation_threshold = 0.5
min_w = -1.0
max_w = 1.0
lifetime_sparsity = 0.014
duty_cycle... | {
"repo_name": "eidonfiloi/SparseRecurrentNetwork",
"path": "config/sr_network_configuration.py",
"copies": "1",
"size": "14835",
"license": "mit",
"hash": 5271138337197189000,
"line_mean": 36.0875,
"line_max": 71,
"alpha_frac": 0.5276710482,
"autogenerated": false,
"ratio": 3.9204545454545454,
... |
__author__ = 'ptoth'
def get_config():
params = {}
params['global'] = {
'epochs': 30
}
update_epochs = 1
verbose = 1
activation_function = "Sigmoid"
activation_threshold = 0.5
min_w = -1.0
max_w = 1.0
lifetime_sparsity = 0.014
duty_cycle_decay = 0.006
w_lr =... | {
"repo_name": "eidonfiloi/SparseRecurrentNetwork",
"path": "config/alpha_network_configuration.py",
"copies": "1",
"size": "11401",
"license": "mit",
"hash": -6783137357763720000,
"line_mean": 35.1936507937,
"line_max": 71,
"alpha_frac": 0.5260064907,
"autogenerated": false,
"ratio": 3.9004447485... |
__author__ = 'ptoth'
def get_config():
params = {}
params['global'] = {
'epochs': 5
}
update_epochs = 1
verbose = 1
activation_function = "Sigmoid"
loss_function = "MSE"
activation_threshold = 0.5
min_w = -1.0
max_w = 1.0
lifetime_sparsity = 0.014
duty_cycle... | {
"repo_name": "eidonfiloi/SparseRecurrentNetwork",
"path": "config/forecast_network_configuration.py",
"copies": "1",
"size": "11470",
"license": "mit",
"hash": -8810158123979747000,
"line_mean": 35.2974683544,
"line_max": 71,
"alpha_frac": 0.5283347864,
"autogenerated": false,
"ratio": 3.9186880... |
__author__ = 'ptoth'
def get_config():
params = {}
params['global'] = {
'epochs': 70
}
update_epochs = 1
verbose = 1
activation_function = "Sigmoid"
loss_function = "MSE"
activation_threshold = 0.5
min_w = -1.0
max_w = 1.0
lifetime_sparsity = 0.014
duty_cycl... | {
"repo_name": "eidonfiloi/SparseRecurrentNetwork",
"path": "config/sr_network_configuration_test.py",
"copies": "1",
"size": "8061",
"license": "mit",
"hash": -8239911904063533000,
"line_mean": 33.8961038961,
"line_max": 71,
"alpha_frac": 0.5284704131,
"autogenerated": false,
"ratio": 3.892322549... |
__author__ = 'purg'
import abc
import logging
import mimetypes
import os
import tempfile
from smqtk.utils import safe_create_dir
MIMETYPES = mimetypes.MimeTypes()
class DataElement (object):
"""
Base abstract class for a data element.
Basic data elements have a UUID, some byte content, and a content ... | {
"repo_name": "anguoyang/SMQTK",
"path": "python/smqtk/data_rep/data_element_abstract.py",
"copies": "1",
"size": "3457",
"license": "bsd-3-clause",
"hash": 3108173787038855700,
"line_mean": 26.656,
"line_max": 80,
"alpha_frac": 0.5779577668,
"autogenerated": false,
"ratio": 4.597074468085107,
... |
__author__ = 'purg'
import abc
import logging
import numpy
class DescriptorElement (object):
"""
Abstract descriptor vector container. The intent of this structure is to
hide the specific method of storage of data (e.g. memory, file, database,
etc.).
"""
__metaclass__ = abc.ABCMeta
@prop... | {
"repo_name": "anguoyang/SMQTK",
"path": "python/smqtk/data_rep/descriptor_element_abstract.py",
"copies": "1",
"size": "1273",
"license": "bsd-3-clause",
"hash": 3117198822849508400,
"line_mean": 22.5740740741,
"line_max": 77,
"alpha_frac": 0.5373134328,
"autogenerated": false,
"ratio": 4.546428... |
__author__ = 'purg'
import base64
import hashlib
import time
import uuid
from smqtk.data_rep import DataElement
class DataMemoryElement (DataElement):
"""
In-memory representation of data stored in a byte list
"""
@classmethod
def from_base64(cls, b64_str, content_type):
"""
Cre... | {
"repo_name": "anguoyang/SMQTK",
"path": "python/smqtk/data_rep/data_element_impl/memory_element.py",
"copies": "1",
"size": "1921",
"license": "bsd-3-clause",
"hash": 2004557455358726000,
"line_mean": 24.9594594595,
"line_max": 79,
"alpha_frac": 0.5918792296,
"autogenerated": false,
"ratio": 4.2... |
__author__ = 'purg'
import cPickle
import numpy
import os.path as osp
from smqtk.data_rep import DescriptorElement
class DescriptorMemoryElement (DescriptorElement):
"""
In-memory representation of descriptor elements.
"""
def __init__(self, uuid, vector):
"""
Initialize in-memory d... | {
"repo_name": "anguoyang/SMQTK",
"path": "python/smqtk/data_rep/descriptor_element_impl/local_elements.py",
"copies": "1",
"size": "3042",
"license": "bsd-3-clause",
"hash": -1250927797844270600,
"line_mean": 27.9714285714,
"line_max": 80,
"alpha_frac": 0.6117685733,
"autogenerated": false,
"rati... |
__author__ = 'purg'
import cPickle
import multiprocessing
import os
import re
from smqtk.data_rep import DataElement, DataSet
from smqtk.utils import safe_create_dir
from smqtk.utils.file_utils import iter_directory_files
from smqtk.utils.string_utils import partition_string
class DataFileSet (DataSet):
"""
... | {
"repo_name": "anguoyang/SMQTK",
"path": "python/smqtk/data_rep/data_set_impl/file_set.py",
"copies": "1",
"size": "6210",
"license": "bsd-3-clause",
"hash": -7954666462188819000,
"line_mean": 32.5675675676,
"line_max": 80,
"alpha_frac": 0.5674718196,
"autogenerated": false,
"ratio": 4.2447026657... |
__author__ = 'purg'
import hashlib
import mimetypes
import os.path as osp
import time
import uuid
from smqtk.data_rep import DataElement
class DataFileElement (DataElement):
"""
File-based data element
"""
def __init__(self, filepath):
"""
Create a new FileElement.
:param f... | {
"repo_name": "anguoyang/SMQTK",
"path": "python/smqtk/data_rep/data_element_impl/file_element.py",
"copies": "1",
"size": "3145",
"license": "bsd-3-clause",
"hash": 7440037392578889000,
"line_mean": 27.3333333333,
"line_max": 80,
"alpha_frac": 0.5834658188,
"autogenerated": false,
"ratio": 4.355... |
__author__ = 'purg'
import hashlib
import mimetypes
import requests
import time
import uuid
from smqtk.data_rep import DataElement
MIMETYPES = mimetypes.MimeTypes()
class DataUrlElement (DataElement):
"""
Representation of data loadable via a web URL address.
"""
def __init__(self, url_address):
... | {
"repo_name": "anguoyang/SMQTK",
"path": "python/smqtk/data_rep/data_element_impl/url_element.py",
"copies": "1",
"size": "2089",
"license": "bsd-3-clause",
"hash": 8053509475103049000,
"line_mean": 26.4868421053,
"line_max": 80,
"alpha_frac": 0.5648635711,
"autogenerated": false,
"ratio": 4.1366... |
__author__ = 'purg'
import imageio
import logging
import mimetypes
import os
import shutil
from smqtk.utils import safe_create_dir, video_utils
MIMETYPES = mimetypes.MimeTypes()
class PreviewCache (object):
"""
Create and cache saved located of preview images for data elements.
"""
# Preview gene... | {
"repo_name": "anguoyang/SMQTK",
"path": "python/smqtk/utils/preview_cache.py",
"copies": "1",
"size": "4875",
"license": "bsd-3-clause",
"hash": -6798869355834698000,
"line_mean": 35.1111111111,
"line_max": 86,
"alpha_frac": 0.5878974359,
"autogenerated": false,
"ratio": 4.152470187393527,
"co... |
__author__ = 'purg'
import logging
import hashlib
import multiprocessing
import os
import re
import shutil
import subprocess
import time
from smqtk.utils import file_utils, safe_create_dir, string_utils
import smqtk_config
class VideoMetadata (object):
"""
Simple container for video file metadata values
... | {
"repo_name": "anguoyang/SMQTK",
"path": "python/smqtk/utils/video_utils.py",
"copies": "1",
"size": "12526",
"license": "bsd-3-clause",
"hash": -8669977260701529000,
"line_mean": 35.3072463768,
"line_max": 80,
"alpha_frac": 0.5890946831,
"autogenerated": false,
"ratio": 4.108232207281076,
"con... |
__author__ = 'Purg'
import numpy
import os
import PIL.Image
import struct
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
def _read_int(f):
return struct.unpack('i', ''.join(reversed(f.read(4))))[0]
def _unpack_image_file(filepath):
with open(filepath, "rb") as f:
# make sure magic number m... | {
"repo_name": "Purg/pyBrainThing",
"path": "data/__init__.py",
"copies": "1",
"size": "1945",
"license": "mit",
"hash": -2432449682384801300,
"line_mean": 28.4696969697,
"line_max": 81,
"alpha_frac": 0.6066838046,
"autogenerated": false,
"ratio": 3.3304794520547945,
"config_test": false,
"has... |
__author__ = 'purg'
import os
def iter_directory_files(d, recurse=True):
"""
Iterates through files in the directory structure at the given directory.
:param d: base directory path
:type d: str
:param recurse: If true, we recursively descend into directories in the
given directory. If f... | {
"repo_name": "anguoyang/SMQTK",
"path": "python/smqtk/utils/file_utils.py",
"copies": "1",
"size": "1717",
"license": "bsd-3-clause",
"hash": -996310780601294300,
"line_mean": 28.1016949153,
"line_max": 78,
"alpha_frac": 0.6027955737,
"autogenerated": false,
"ratio": 4.097852028639618,
"config... |
'''
Author's model in blog sources. Maps a section in an ini file containing all
authors of the blog.
'''
import lpbm.models.configmodel as cm_module
import lpbm.tools as ltools
class Author(cm_module.Model):
'''
Author's model in blog sources. Maps a section in an ini file containing
all authors of the... | {
"repo_name": "fmichea/lpbm",
"path": "lpbm/models/authors.py",
"copies": "1",
"size": "2179",
"license": "bsd-3-clause",
"hash": 6802622762074928000,
"line_mean": 31.0441176471,
"line_max": 83,
"alpha_frac": 0.5924736117,
"autogenerated": false,
"ratio": 3.737564322469983,
"config_test": false... |
__author__ = 'pyled'
import yaml
def register_tags(server_root):
def join(loader, node):
seq = loader.construct_sequence(node, deep=True)
return ''.join([str(i) for i in seq])
def root(loader, node):
return server_root + ('' if server_root.endswith('/') else '/')
def replace(load... | {
"repo_name": "dustyrockpyle/ipyng",
"path": "server/yaml_tags.py",
"copies": "1",
"size": "1154",
"license": "mit",
"hash": -2027941649221865000,
"line_mean": 30.2162162162,
"line_max": 71,
"alpha_frac": 0.5849220104,
"autogenerated": false,
"ratio": 3.783606557377049,
"config_test": false,
... |
__author__ = 'Pysarev'
from pony.orm import *
from datetime import datetime
from model.group import Group
from model.contact import Contact
from pymysql.converters import decoders
class ORMFixture:
db = Database()
class ORMGroup(db.Entity):
_table_ = 'group_list'
id = PrimaryKey(int, column='... | {
"repo_name": "pysarevm/python_homework",
"path": "fixture/orm.py",
"copies": "1",
"size": "2489",
"license": "apache-2.0",
"hash": -8116369420274439000,
"line_mean": 39.8196721311,
"line_max": 126,
"alpha_frac": 0.6689433507,
"autogenerated": false,
"ratio": 3.665684830633284,
"config_test": f... |
__author__ = 'Pysarev'
import mysql.connector
from model.group import Group
from model.contact import Contact
class DbFixture:
def __init__(self, host, name, user, password):
self.host = host
self.name = name
self.user = user
self.password = password
self.connection = mysq... | {
"repo_name": "pysarevm/python_homework",
"path": "fixture/db.py",
"copies": "1",
"size": "5226",
"license": "apache-2.0",
"hash": 245303180808999650,
"line_mean": 41.1532258065,
"line_max": 130,
"alpha_frac": 0.5566398775,
"autogenerated": false,
"ratio": 4.157517899761337,
"config_test": fals... |
__author__ = 'python cookbook'
import time
import resource
from DistributedStorageBenchmarkTool.DataTask import DataTask
from threading import Thread, Event
class LaunchAndMeasureDataTask:
def __init__(self, log, sock, clientName, chunkSize, maxFileSize, dataThreadName, countDownStoppedEvent):
self._runnin... | {
"repo_name": "shadoobie/dbench",
"path": "DistributedStorageBenchmarkTool/LaunchAndMeasureDataTask.py",
"copies": "1",
"size": "3335",
"license": "mit",
"hash": 79077595568548020,
"line_mean": 44.0810810811,
"line_max": 175,
"alpha_frac": 0.6191904048,
"autogenerated": false,
"ratio": 4.01323706... |
__author__ = 'pythonishvili, Tom James Holub'
import LatLon
def distance(lat1, lon1, lat2, lon2): # km distance
return LatLon.LatLon(lat1, lon2).distance(LatLon.LatLon(lat2, lon2))
def distance_old(lat1, lon1, lat2, lon2, use_miles=False):
# from http://stackoverflow.com/questions/19412462/getting-distance-betw... | {
"repo_name": "tomholub/tooth",
"path": "tooth/geo.py",
"copies": "1",
"size": "1298",
"license": "bsd-3-clause",
"hash": -5635213579025670000,
"line_mean": 35.0833333333,
"line_max": 127,
"alpha_frac": 0.7018489985,
"autogenerated": false,
"ratio": 2.840262582056893,
"config_test": false,
"h... |
__author__ = 'pythoo'
class Campaigns:
"""
Campaign Monitor is used to make Email campaign.
"""
@staticmethod
def campaign_factory(type):
"""
This is the Factory method
:return:
"""
if type == 'MC':
return MailChimp()
if type == 'CM':
... | {
"repo_name": "PythoO/Contest",
"path": "core/campaign.py",
"copies": "1",
"size": "1334",
"license": "mit",
"hash": 5565679806767220000,
"line_mean": 19.5384615385,
"line_max": 53,
"alpha_frac": 0.5374812594,
"autogenerated": false,
"ratio": 4.2756410256410255,
"config_test": false,
"has_no_... |
__author__ = "pyton_guy"
"""
Commands for the #/r/nyc Freenode IRC bot
This module is used by bot.py and is separate so that it can be hot-swapped.
So if a command breaks, or a new one needs to be added, we don't need to
disconnect the bot from IRC to fix it. This bot is built for five-nines!
"""
import sys
import r... | {
"repo_name": "uniite/rnyc_irc",
"path": "commands.py",
"copies": "1",
"size": "10326",
"license": "mit",
"hash": 6131808503533325000,
"line_mean": 35.2315789474,
"line_max": 187,
"alpha_frac": 0.5865775712,
"autogenerated": false,
"ratio": 3.463938275746394,
"config_test": false,
"has_no_key... |
__author__ = "pyton_guy"
"""
Triggers for the #/r/nyc Freenode IRC bot
This module is used by bot.py and is separate so that it can be hot-swapped.
So if a trigger breaks, or a new one needs to be added, we don't need to
disconnect the bot from IRC to fix it. This bot is built for five-nines!
"""
import re
# Vario... | {
"repo_name": "uniite/rnyc_irc",
"path": "triggers.py",
"copies": "1",
"size": "1562",
"license": "mit",
"hash": -1415525883920751400,
"line_mean": 30.26,
"line_max": 76,
"alpha_frac": 0.5755441741,
"autogenerated": false,
"ratio": 3.5101123595505617,
"config_test": false,
"has_no_keywords": ... |
__author__ = 'pzdeb'
from core.config import lazy_config
import logging
import os
import shutil
class BaseProcessor(object):
def __init__(self, dir):
self.log = logging.getLogger(self.__class__.__name__)
self.conf = lazy_config()
def process(self, path):
raise NotImplementedError
... | {
"repo_name": "peterzdeb/torrent-gateway",
"path": "src/python/processors/__init__.py",
"copies": "1",
"size": "2349",
"license": "bsd-3-clause",
"hash": -5948247532194090000,
"line_mean": 36.8870967742,
"line_max": 92,
"alpha_frac": 0.5253299276,
"autogenerated": false,
"ratio": 3.88264462809917... |
__author__ = 'pzdeb'
from core.consts import *
import logging
import os
from processors.music import MP3Processor
from processors.films import FilmsProcessor
class FileAnalyzer():
def __init__(self, dir=None):
self.log = logging.getLogger('analyzer')
self.dir = dir
self.processors = {}
... | {
"repo_name": "peterzdeb/torrent-gateway",
"path": "src/python/processors/file_analyzer.py",
"copies": "1",
"size": "1753",
"license": "bsd-3-clause",
"hash": -1112285813168012200,
"line_mean": 34.06,
"line_max": 107,
"alpha_frac": 0.5579007416,
"autogenerated": false,
"ratio": 4.029885057471264,... |
#!/usr/bin/python
#-*-coding:utf-8-*-
import os
import h5py
from keras.models import Sequential
from keras.optimizers import SGD, Adadelta, Adam
from keras.models import Model
from keras.layers import Input, Dense, Convolution2D, MaxPooling2D, AveragePooling2D, ZeroPadding2D, Dropout, Flatten, \
merge, Re... | {
"repo_name": "samleoqh/machine-ln",
"path": "src/ft_models.py",
"copies": "1",
"size": "11518",
"license": "mit",
"hash": -6218418269114382000,
"line_mean": 42.1302681992,
"line_max": 122,
"alpha_frac": 0.6312727904,
"autogenerated": false,
"ratio": 3.220917225950783,
"config_test": false,
"... |
__author__ = 'qinpeng'
from decimal import Decimal
from supersaver.constants import RETAILER_SUPERVALUE
from category.models import Category
from dealcrawler.util import *
from dealcrawler.model.items import ProductItem
from product.models import Product
from .SpecialDealAllStoresSiteSpider import SpecialDealAllSto... | {
"repo_name": "ftkghost/SuperSaver",
"path": "crawler/dealcrawler/spiders/dev/nzsupermarket/SuperValueSpecialDealSpider.py",
"copies": "1",
"size": "5574",
"license": "bsd-2-clause",
"hash": 5695606612707018000,
"line_mean": 49.6727272727,
"line_max": 117,
"alpha_frac": 0.5552565483,
"autogenerated... |
__author__ = 'qinpeng'
import logging
import random
from datetime import datetime, timedelta
import scrapy
from dateutil import parser as dateparser
from dealcrawler.model.items import ProductItem
from dealcrawler.spiders.BaseSpider import DealSpider
from dealcrawler.util import *
from product.models import ProductP... | {
"repo_name": "ftkghost/SuperSaver",
"path": "crawler/dealcrawler/spiders/nz/LasooCoNzDealSpider.py",
"copies": "1",
"size": "11930",
"license": "bsd-2-clause",
"hash": 7437094861499412000,
"line_mean": 41.4555160142,
"line_max": 114,
"alpha_frac": 0.5665549036,
"autogenerated": false,
"ratio": 3... |
DADADADUM=['r4:2','g','g','g','eb:8','r:2','f','f','f','d:8']
ENTERTAINER=['d4:1','d#','e','c5:2','e4:1','c5:2','e4:1','c5:3','c:1','d','d#','e','c','d','e:2','b4:1','d5:2','c:4']
PRELUDE=['c4:1','e','g','c5','e','g4','c5','e','c4','e','g','c5','e','g4','c5','e','c4','d','g','d5','f','g4','d5','f','c4','d','g','d5','f... | {
"repo_name": "xbed/Mixly_Arduino",
"path": "mixly_arduino/mpBuild/ESP32_MixGo/lib/music.py",
"copies": "1",
"size": "10163",
"license": "apache-2.0",
"hash": 6602949753513884000,
"line_mean": 38.8588235294,
"line_max": 578,
"alpha_frac": 0.4415034931,
"autogenerated": false,
"ratio": 2.327226929... |
DADADADUM = ['r4:2', 'g', 'g', 'g', 'eb:8', 'r:2', 'f', 'f', 'f', 'd:8']
ENTERTAINER = [
'd4:1', 'd#', 'e', 'c5:2', 'e4:1', 'c5:2', 'e4:1', 'c5:3', 'c:1', 'd',
'd#', 'e', 'c', 'd', 'e:2', 'b4:1', 'd5:2', 'c:4'
]
PRELUDE = [
'c4:1', 'e', 'g', 'c5', 'e', 'g4', 'c5', 'e', 'c4', 'e', 'g', 'c5', 'e',
'g4'... | {
"repo_name": "xbed/Mixly_Arduino",
"path": "mixly_arduino/mpBuild/common/lib/music_backup.py",
"copies": "1",
"size": "7997",
"license": "apache-2.0",
"hash": -4877306097707047000,
"line_mean": 30.8645418327,
"line_max": 87,
"alpha_frac": 0.3937726647,
"autogenerated": false,
"ratio": 1.93024378... |
__author__ = 'Q'
import os
import getpass
def fill_in_ascii(phrase):
for character in phrase:
if not character.isalnum() and not character.isspace():
if character != '.':
phrase = phrase.replace(character, "&#{ascii}".format(ascii=ord(character)), 1)
return phrase
def ge... | {
"repo_name": "Qblack/Bookmarks-To-Html",
"path": "FavouriteBarToHtml.py",
"copies": "1",
"size": "2019",
"license": "mit",
"hash": 3418530742435811300,
"line_mean": 30.546875,
"line_max": 100,
"alpha_frac": 0.5324418029,
"autogenerated": false,
"ratio": 3.4631217838765007,
"config_test": false... |
__author__ = 'Qra'
import urllib.request
import urllib.parse
import json
import logging
logger = logging.getLogger(__name__)
url_api = 'https://theoldreader.com/reader/api/0/'
url_login = 'https://theoldreader.com/accounts/ClientLogin'
def make_request(url, var, header={}, use_get=True):
var_json = {'output': ... | {
"repo_name": "the01/theoldreader",
"path": "theoldreader.py",
"copies": "1",
"size": "6677",
"license": "mit",
"hash": -3944935631078932000,
"line_mean": 30.7952380952,
"line_max": 84,
"alpha_frac": 0.5796016175,
"autogenerated": false,
"ratio": 3.78300283286119,
"config_test": false,
"has_n... |
__author__ = 'Qra'
__version__ = "0.1.0a0"
import requests
import logging
logger = logging.getLogger(__name__)
url_api = 'https://theoldreader.com/reader/api/0/'
url_login = 'https://theoldreader.com/accounts/ClientLogin'
class Connection(object):
""" Connection to TheOldReader API """
def __init__(self,... | {
"repo_name": "KurochkinVasiliy/theoldreader",
"path": "theoldreader/tor.py",
"copies": "1",
"size": "9529",
"license": "mit",
"hash": -6288084370435954000,
"line_mean": 30.7633333333,
"line_max": 79,
"alpha_frac": 0.5600797565,
"autogenerated": false,
"ratio": 3.944122516556291,
"config_test":... |
__author__ = 'Quadrifrons'
import threading
import SocketServer
import socket
#import serial
import cv2
import numpy as np
import math
# distance data measured by ultrasonic sensor
sensor_data = " "
host=''
class NeuralNetwork(object):
def __init__(self):
self.model = cv2.ANN_MLP()
def create(self)... | {
"repo_name": "Quadrifrons/AutoRCCar",
"path": "nithin/rc_driver.py",
"copies": "1",
"size": "11020",
"license": "bsd-2-clause",
"hash": -7691109408863402000,
"line_mean": 33.5454545455,
"line_max": 125,
"alpha_frac": 0.516969147,
"autogenerated": false,
"ratio": 3.857192859642982,
"config_test... |
__author__ = 'Quentin Gemine'
from numpy import array
import numpy as np
from scipy.stats import multivariate_normal
class Sampler(object):
def __init__(self, params, seas_mean=np.array([0.0]), seas_std=np.array([1.0]), T=1):
self.mixt_size, self.order = params["means"].shape[0], params["means"].shape[1]-... | {
"repo_name": "qgemine/anm",
"path": "models.py",
"copies": "1",
"size": "34138",
"license": "mit",
"hash": -8020717501445254000,
"line_mean": 68.5295315682,
"line_max": 161,
"alpha_frac": 0.4283789326,
"autogenerated": false,
"ratio": 2.9419165804894862,
"config_test": false,
"has_no_keyword... |
__author__ = 'qyou'
marks = {
'_z&e3B': '.',
'AzdH3F': '/',
'_z2C$q': ':',
}
dictionary = {
'o': 'w',
'v': 'c',
'g': 'n',
'5': 'o',
'4': 'm',
'i': 'h',
'p': 't',
'r': 'p',
'j': 'e',
'f': 's',
'8': '1',
'0': '7',
'l': '9',
'x': 'x',
't': 'i... | {
"repo_name": "qyou/bdimg_codecs",
"path": "decode.py",
"copies": "1",
"size": "1477",
"license": "mit",
"hash": -4887300204178448000,
"line_mean": 17.012195122,
"line_max": 55,
"alpha_frac": 0.4427894381,
"autogenerated": false,
"ratio": 2.6003521126760565,
"config_test": false,
"has_no_keyw... |
__author__ = 'rabbiabram@gmail.com'
from server import gossip
from random import randint
import sys
import getopt
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "hopm:v", ["help", "output=", 'port=', 'master-port='])
except getopt.GetoptError as err:
# print help information and exi... | {
"repo_name": "Python-Unicorns/Innocenty",
"path": "run.py",
"copies": "1",
"size": "1202",
"license": "mit",
"hash": 42650283449793080,
"line_mean": 25.7333333333,
"line_max": 104,
"alpha_frac": 0.5266222962,
"autogenerated": false,
"ratio": 3.6204819277108435,
"config_test": false,
"has_no_... |
__author__ = 'raca'
def generate_primes(n=1000000):
primes = []
prime_flags = [0] * (n + 1)
for prime in xrange(2, n):
if prime_flags[prime] == 0:
primes.append(prime)
else:
continue
mult = 2
while mult * prime < n:
prime_flags[mult * pri... | {
"repo_name": "racamirko/proj_euler2014",
"path": "problem077.py",
"copies": "1",
"size": "1351",
"license": "bsd-3-clause",
"hash": -1469615739508802300,
"line_mean": 22.701754386,
"line_max": 58,
"alpha_frac": 0.496669134,
"autogenerated": false,
"ratio": 3.171361502347418,
"config_test": fal... |
__author__ = 'raca'
'''
The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly
believe that 49/98 = 4/8, which is correct, is obtained by cancelling the 9s.
We shall consider fractions like, 30/50 = 3/5, to be trivial examples.
There are exactly four ... | {
"repo_name": "racamirko/proj_euler2014",
"path": "problem033.py",
"copies": "1",
"size": "2847",
"license": "bsd-3-clause",
"hash": 8296062266384442000,
"line_mean": 35.987012987,
"line_max": 120,
"alpha_frac": 0.5461889708,
"autogenerated": false,
"ratio": 3.563204005006258,
"config_test": fa... |
"""Module to parse or download images from deviantart page.
The basis of this was built by
[rachmadaniHaryono](https://github.com/rachmadaniHaryono) with additions and
modifications from jtara1 & contributers of [tpt]
(https://github.com/jtara1/tpt)
"""
try: # py2
from urllib2 import urlopen
except ImportError: ... | {
"repo_name": "jtara1/turbo_palm_tree",
"path": "turbo_palm_tree/downloaders/deviantart.py",
"copies": "1",
"size": "2663",
"license": "apache-2.0",
"hash": 5253395951545554000,
"line_mean": 32.2875,
"line_max": 81,
"alpha_frac": 0.6293653774,
"autogenerated": false,
"ratio": 3.247560975609756,
... |
__author__ = 'radlab'
#from pyaruco import detect_markers
import logging
logging.basicConfig(level=logging.DEBUG)
import cv
import cv2
import os
import sys
import numpy as np
from numpy import array
#from PIL import Image
# import ctypes
# import ctypes.util
# name = ctypes.util.find_library(r'C:\Users\radlab\dro... | {
"repo_name": "richstoner/pyaruco",
"path": "main.py",
"copies": "1",
"size": "1668",
"license": "mit",
"hash": 8821342486619498000,
"line_mean": 23.8955223881,
"line_max": 122,
"alpha_frac": 0.6834532374,
"autogenerated": false,
"ratio": 3.1892925430210326,
"config_test": true,
"has_no_keywo... |
__author__ = 'radlab'
import ctypes as ct
# Enums
_ARUCO_FAILURE = -1
_ARUCO_SUCCESS = 0
_ARUCO_FALSE = 0
_ARUCO_TRUE = 1
# Structures
class _Size(ct.Structure):
_fields_ = [
('width', ct.c_int),
('height', ct.c_int),
]
class _Image(ct.Structure):
_fields_ = [
('data', ct.POINTER(ct.c_uint... | {
"repo_name": "richstoner/pyaruco",
"path": "pyaruco.py",
"copies": "1",
"size": "16730",
"license": "mit",
"hash": 767020921790797400,
"line_mean": 31.3597678917,
"line_max": 120,
"alpha_frac": 0.6805738195,
"autogenerated": false,
"ratio": 3.1471030850263357,
"config_test": true,
"has_no_ke... |
__author__ = 'Radoslaw Matusiak'
__copyright__ = 'Copyright (c) 2017 Radoslaw Matusiak'
__license__ = 'MIT'
__version__ = '0.1'
import clr
import imp
import os
import sys
import tempfile
MANAGED_HEAPS = [] # List of tupples (start_address, stop_address, details) describing managed heaps
def on_load(... | {
"repo_name": "rsc-dev/ishtar",
"path": "Ishtar/Ishtar/scripts/ishtar.py",
"copies": "1",
"size": "3084",
"license": "mit",
"hash": -8217230383321518000,
"line_mean": 26.3008849558,
"line_max": 101,
"alpha_frac": 0.5460440986,
"autogenerated": false,
"ratio": 3.5694444444444446,
"config_test": ... |
__author__ = 'raek'
# -*- coding: utf-8 -*-
import copy
import datetime as dt
from icemodelling import constants as const
from experimental import energybalancedefaults as defaults
from utilities import doconversions as dc
from icemodelling import parameterization as dp
from math import log, exp, sin, cos, pi, fabs, s... | {
"repo_name": "ragnarekker/Ice-modelling",
"path": "experimental/energybalance.py",
"copies": "1",
"size": "42689",
"license": "mit",
"hash": -3083275596045452300,
"line_mean": 39.4312796209,
"line_max": 178,
"alpha_frac": 0.6098229985,
"autogenerated": false,
"ratio": 3.0407043056743657,
"conf... |
__author__ = 'raek'
# -*- coding: utf-8 -*-
import datetime as dt
import setenvironment as se
import copy
from icemodelling import ice as ice, weatherelement as we
def read_weather(from_date, to_date, filename):
"""Reads date, temperature, snow and snowchange from a file formated with coluns for
date, snow c... | {
"repo_name": "ragnarekker/Ice-modelling",
"path": "utilities/getfiledata.py",
"copies": "1",
"size": "6991",
"license": "mit",
"hash": 3367696696503158000,
"line_mean": 34.6632653061,
"line_max": 122,
"alpha_frac": 0.5682403433,
"autogenerated": false,
"ratio": 3.2894117647058825,
"config_test... |
__author__ = 'raek'
""""""
import math
rho_fw = 1000. # density of freshwater (kg m-3)
temp_f = 0 # freezing temp
rho_new_snow=250 #new-snow density (kg m-3)
max_rho_snow=450 #maximum snow density (kg m-3)
rho_si = rho_ice
rho_slush = rho_fw
k_ice = 2.24 # ice heat conduction coe... | {
"repo_name": "ragnarekker/Ice-modelling",
"path": "experimental/myLakeIceCoverModule.py",
"copies": "1",
"size": "4520",
"license": "mit",
"hash": -8800874029504792000,
"line_mean": 41.2336448598,
"line_max": 162,
"alpha_frac": 0.5510068599,
"autogenerated": false,
"ratio": 2.8710292249047016,
... |
#we need split
import string
from film import Film
#read field data in file
def field_parser(raw_field):
return string.split(raw_field, "&&")
def parser():
#init matrix
M = []
#the file could not be here, so...
try:
raw = open("./peliculas100.dat")
raw = file.readlines(raw)
... | {
"repo_name": "UB-info/estructura-datos",
"path": "RafaelArqueroGimeno_S2/main.py",
"copies": "1",
"size": "1148",
"license": "mit",
"hash": -5831458243420863000,
"line_mean": 25.0909090909,
"line_max": 162,
"alpha_frac": 0.5670731707,
"autogenerated": false,
"ratio": 3.4578313253012047,
"confi... |
#we need split
import string
#read field data in file
def field_parser(raw_field):
return tuple(string.split(raw_field, "&&"))
def parser():
#init matrix
M = []
#the file could not be here, so...
try:
raw = open("./peliculas100.dat")
raw = file.readlines(raw)
#trick: avo... | {
"repo_name": "UB-info/estructura-datos",
"path": "RafaelArqueroGimeno_Sesion1.py",
"copies": "1",
"size": "1379",
"license": "mit",
"hash": 590957926854726700,
"line_mean": 27.1428571429,
"line_max": 162,
"alpha_frac": 0.5467730239,
"autogenerated": false,
"ratio": 3.554123711340206,
"config_t... |
__author__ = "Rafael Arquero Gimeno"
from ABB_Rafael_Arquero_Gimeno import ABB
class User:
def __init__(self, uid, age, gender, country, songs_played, relevance):
self.__uid = uid
self.__age = age
self.__gender = gender
self.__country = country
self.__songs_played = songs_... | {
"repo_name": "UB-info/estructura-datos",
"path": "RafaelArqueroGimeno_S5/model.py",
"copies": "1",
"size": "4216",
"license": "mit",
"hash": 4472447624132483000,
"line_mean": 31.6821705426,
"line_max": 115,
"alpha_frac": 0.5450664137,
"autogenerated": false,
"ratio": 3.9182156133828996,
"confi... |
__author__ = "Rafael Arquero Gimeno"
from copy import copy
from model import *
import view
import parserLastFM
def add(parser):
return parser.next()
def search(queue, minimum=0.0, maximum=1.0):
"""Filter a priority queue by relevance user attribute (between maximum and minimum)"""
assert 0 <= minimum ... | {
"repo_name": "UB-info/estructura-datos",
"path": "RafaelArqueroGimeno_S5/PColaInterface.py",
"copies": "1",
"size": "1923",
"license": "mit",
"hash": -1096652217648563600,
"line_mean": 29.046875,
"line_max": 110,
"alpha_frac": 0.6604264171,
"autogenerated": false,
"ratio": 3.908536585365854,
"... |
__author__ = "Rafael Arquero Gimeno"
from model import *
import view
import parserLastFM
def add(parser):
"""
:param parser: File parser
:return: A Binary Search Tree containing old + parsed values
"""
return parser.next()
def search(tree, minimum=0.0, maximum=1.0):
"""Returns an iterator t... | {
"repo_name": "UB-info/estructura-datos",
"path": "RafaelArqueroGimeno_S5/ABBInterface.py",
"copies": "1",
"size": "1697",
"license": "mit",
"hash": -9142138031295504000,
"line_mean": 26.3709677419,
"line_max": 101,
"alpha_frac": 0.6711844431,
"autogenerated": false,
"ratio": 3.779510022271715,
... |
__author__ = "Rafael Arquero Gimeno"
import random
from time import time
import PColaInterface
import ABBInterface
def benchmarkFunction(function):
start = time()
tmp = function()
end = time()
return tmp, end - start
def benchmarkModule(module):
"""returns a tuple with the cost of add and sear... | {
"repo_name": "UB-info/estructura-datos",
"path": "RafaelArqueroGimeno_S5/benchmark.py",
"copies": "1",
"size": "1508",
"license": "mit",
"hash": 4969376212197212000,
"line_mean": 27.4528301887,
"line_max": 112,
"alpha_frac": 0.6412466844,
"autogenerated": false,
"ratio": 3.411764705882353,
"co... |
__author__ = "Rafael Arquero Gimeno"
import Tkinter
import tkMessageBox
from benchmark import benchmarkFunction as benchmark
class MainApp(Tkinter.Tk): # inherit from Tk makes view handling cleaner
def __init__(self, parser, add, search, remove, users, *args, **kwargs):
"""Users LastFM interface Constr... | {
"repo_name": "UB-info/estructura-datos",
"path": "RafaelArqueroGimeno_S5/view.py",
"copies": "1",
"size": "6063",
"license": "mit",
"hash": -4959439673282266000,
"line_mean": 42,
"line_max": 119,
"alpha_frac": 0.625432954,
"autogenerated": false,
"ratio": 3.634892086330935,
"config_test": fals... |
__author__ = "Rafael Arquero Gimeno"
class Node():
def __init__(self):
self.data = []
self.left = None
self.right = None
def clear(self):
"""Empty Node"""
self.data = []
self.left = None
self.right = None
def clearData(self):
"""Empty store... | {
"repo_name": "UB-info/estructura-datos",
"path": "RafaelArqueroGimeno_S5/ABB_Rafael_Arquero_Gimeno.py",
"copies": "1",
"size": "7901",
"license": "mit",
"hash": -4026459542537694700,
"line_mean": 31.2530612245,
"line_max": 119,
"alpha_frac": 0.5522085812,
"autogenerated": false,
"ratio": 4.48410... |
__author__ = "Rafael Ferreira da Silva"
DB_VERSION = 0
import logging
from sqlalchemy.exc import *
from Pegasus.db.admin.admin_loader import *
from Pegasus.db.admin.versions.base_version import *
from Pegasus.db.schema import *
log = logging.getLogger(__name__)
class Version(BaseVersion):
def __init__(self, ... | {
"repo_name": "pegasus-isi/pegasus",
"path": "packages/pegasus-python/src/Pegasus/db/admin/versions/v0.py",
"copies": "1",
"size": "2515",
"license": "apache-2.0",
"hash": 6080519291316536000,
"line_mean": 32.5333333333,
"line_max": 95,
"alpha_frac": 0.531610338,
"autogenerated": false,
"ratio": ... |
__author__ = "Rafael Ferreira da Silva"
DB_VERSION = 1
import logging
from sqlalchemy.exc import *
from Pegasus.db.admin.admin_loader import *
from Pegasus.db.admin.versions.base_version import *
log = logging.getLogger(__name__)
class Version(BaseVersion):
def __init__(self, connection):
super().__i... | {
"repo_name": "pegasus-isi/pegasus",
"path": "packages/pegasus-python/src/Pegasus/db/admin/versions/v1.py",
"copies": "1",
"size": "5861",
"license": "apache-2.0",
"hash": -1342904030139351300,
"line_mean": 39.986013986,
"line_max": 135,
"alpha_frac": 0.5348916567,
"autogenerated": false,
"ratio"... |
__author__ = "Rafael Ferreira da Silva"
DB_VERSION = 2
import logging
from sqlalchemy.exc import *
from Pegasus.db.admin.admin_loader import *
from Pegasus.db.admin.versions.base_version import *
from Pegasus.db.schema import *
log = logging.getLogger(__name__)
class Version(BaseVersion):
def __init__(self, ... | {
"repo_name": "pegasus-isi/pegasus",
"path": "packages/pegasus-python/src/Pegasus/db/admin/versions/v2.py",
"copies": "1",
"size": "4214",
"license": "apache-2.0",
"hash": 6397162662648372000,
"line_mean": 31.6666666667,
"line_max": 104,
"alpha_frac": 0.5605125771,
"autogenerated": false,
"ratio"... |
__author__ = 'Rafa Haro <rh@athento.com>'
def test_hocr():
import os
from hocr_parser.parser import HOCRDocument
filename = "output.hocr"
dir_path = os.path.dirname(os.path.abspath(__file__))
full_path = os.path.join(dir_path, filename)
document = HOCRDocument(full_path, is_path=True)
asse... | {
"repo_name": "athento/hocr-parser",
"path": "tests/hocr/test_hocr.py",
"copies": "1",
"size": "1372",
"license": "apache-2.0",
"hash": -601750815195312600,
"line_mean": 28.1914893617,
"line_max": 103,
"alpha_frac": 0.6822157434,
"autogenerated": false,
"ratio": 3.2589073634204277,
"config_test... |
__author__ = 'Rafa Haro <rh@athento.com>'
from abc import ABCMeta, abstractmethod
from bs4 import BeautifulSoup
import re
class HOCRElement:
__metaclass__ = ABCMeta
COORDINATES_PATTERN = re.compile("bbox\s(-?[0-9]+)\s(-?[0-9]+)\s(-?[0-9]+)\s(-?[0-9]+)")
def __init__(self, hocr_html, parent, next_tag, ... | {
"repo_name": "athento/hocr-parser",
"path": "src/hocr_parser/parser.py",
"copies": "1",
"size": "5481",
"license": "apache-2.0",
"hash": -9016179952153402000,
"line_mean": 24.0319634703,
"line_max": 94,
"alpha_frac": 0.5508118956,
"autogenerated": false,
"ratio": 3.726036709721278,
"config_tes... |
__author__ = 'Rafa Haro <rh@athento.com>'
from restkit import Connection, request, RequestError
from socketpool import ConnectionPool
import eventlet
class StanbolConnectionError(Exception):
pass
class _RestClient(object):
def __init__(self, endpoint, **kwargs):
__pool = ConnectionPool(factory=Co... | {
"repo_name": "athento/pystanbol",
"path": "pystanbol/client.py",
"copies": "1",
"size": "2160",
"license": "apache-2.0",
"hash": -1959412991924929000,
"line_mean": 30.7647058824,
"line_max": 100,
"alpha_frac": 0.6157407407,
"autogenerated": false,
"ratio": 4.186046511627907,
"config_test": fal... |
"""Author: Rafal Slota
Copyright (C) 2015 ACK CYFRONET AGH
This software is released under the MIT license cited in 'LICENSE.txt'
Brings up a couchbase cluster.
"""
from __future__ import print_function
import re
import requests
import sys
import time
from timeouts import *
from . import common, docker, dns as dns_... | {
"repo_name": "onedata/web-client",
"path": "bamboos/docker/environment/couchbase.py",
"copies": "1",
"size": "4046",
"license": "mit",
"hash": -3149425509593527000,
"line_mean": 34.1826086957,
"line_max": 126,
"alpha_frac": 0.6161641127,
"autogenerated": false,
"ratio": 3.668177697189483,
"con... |
__author__ = 'Rafał'
from PySide import QtCore
from socketIO_client import SocketIO, LoggingNamespace
import json
class BlueNode(QtCore.QThread):
new_data = QtCore.Signal(object)
def __init__(self, login, password):
QtCore.QThread.__init__(self, parent=None)
self.login = {'email': login, 'pas... | {
"repo_name": "KozikR/wirelessHome_local_panel",
"path": "blueNode.py",
"copies": "1",
"size": "2474",
"license": "bsd-3-clause",
"hash": -2055576631888059100,
"line_mean": 32.8904109589,
"line_max": 106,
"alpha_frac": 0.6494136676,
"autogenerated": false,
"ratio": 3.599708879184862,
"config_te... |
__author__ = 'Rafał'
from PySide import QtCore, QtGui
import sys
import signal
from gui import Ui_MainWindow
from bt import *
from blueNode import *
from device import *
from time import time
"""
GUI creat: pyside-uic MainWindow.ui -o gui.py
"""
class blueCat(QtGui.QMainWindow):
def __init__(self, app, parent=N... | {
"repo_name": "KozikR/wirelessHome_local_panel",
"path": "blueCat.py",
"copies": "1",
"size": "5783",
"license": "bsd-3-clause",
"hash": 6557922703609757000,
"line_mean": 39.7183098592,
"line_max": 124,
"alpha_frac": 0.5971982013,
"autogenerated": false,
"ratio": 3.6851497769279797,
"config_tes... |
__author__ = 'Raghava'
import random
from sys import exit
import pygame
from pygame.locals import *
data = open("data.bin", 'a') # Create file for high score
data.close()
pygame.init()
pygame.mixer.init()
SCREEN_SIZE = (800, 600) # This size is for the snake to move around
Display_Size = (1000, 600) # this size is... | {
"repo_name": "RaghavaDhanya/Snake",
"path": "game.py",
"copies": "1",
"size": "6677",
"license": "mit",
"hash": 1434399960897096400,
"line_mean": 40.2160493827,
"line_max": 118,
"alpha_frac": 0.4855474015,
"autogenerated": false,
"ratio": 3.4101123595505616,
"config_test": false,
"has_no_key... |
__author__ = 'Raghav Sidhanti'
# contains all the basic local file system operations
import os
import message
from shutil import rmtree
from inout import StdIn
def exists(path=None):
if path is None:
return False
return os.path.exists(abs_path(path))
def read_line(path=None):
line = ''
if... | {
"repo_name": "sudohippie/fog",
"path": "fog/fsutil.py",
"copies": "1",
"size": "2473",
"license": "mit",
"hash": -2026881074591884000,
"line_mean": 20.8849557522,
"line_max": 97,
"alpha_frac": 0.6126162556,
"autogenerated": false,
"ratio": 3.4442896935933147,
"config_test": false,
"has_no_ke... |
__author__ = 'Raghav Sidhanti'
from nose.tools import *
from fog.command import *
class TestCommandParser(object):
_psr = None
def setup(self):
self._psr = CommandParser()
# empty commands
def test_empty(self):
args_list = [None, [], [''], [' '], ['', ' ', ' ', '']]
for a... | {
"repo_name": "sudohippie/fog",
"path": "tests/command_tests.py",
"copies": "1",
"size": "11877",
"license": "mit",
"hash": -1690671627575697000,
"line_mean": 33.9352941176,
"line_max": 140,
"alpha_frac": 0.5498021386,
"autogenerated": false,
"ratio": 3.347519729425028,
"config_test": true,
"... |
__author__ = 'Raghav Sidhanti'
from nose.tools import *
from fog.fsutil import *
def setup():
pass
def teardown():
pass
# UNIX platform
def test_unix_abspath_empty():
eq_(abs_path(None), None)
eq_(abs_path(''), None)
def test_unix_abspath_absolute():
eq_(abs_path('/tmp/test/logs'), '/tmp/te... | {
"repo_name": "sudohippie/fog",
"path": "tests/fsutil_tests.py",
"copies": "1",
"size": "3254",
"license": "mit",
"hash": -6229979691655091000,
"line_mean": 29.6981132075,
"line_max": 118,
"alpha_frac": 0.5799016595,
"autogenerated": false,
"ratio": 3.202755905511811,
"config_test": true,
"ha... |
__author__ = 'Raghav Sidhanti'
from string import Template
# info
REMOTE_EXISTS = '$drive is tracked. Try "remote rm" to un-track and try again or $help.'
HOME_EXISTS = 'Fog already initialized, configuration will be overwritten. $continue'
HELP = '"help" for usage'
MARK = '*'
NO_MARK = ' '
STATUS = '[$mark] $drive'
... | {
"repo_name": "sudohippie/fog",
"path": "fog/message.py",
"copies": "1",
"size": "2011",
"license": "mit",
"hash": 6024195445891511000,
"line_mean": 37.6730769231,
"line_max": 104,
"alpha_frac": 0.6981601193,
"autogenerated": false,
"ratio": 3.48526863084922,
"config_test": false,
"has_no_key... |
__author__ = 'Raghav Sidhanti'
from terrace.db import item_dao
from flask import Blueprint
from flask import request, jsonify
from httplib import BAD_REQUEST, NOT_FOUND, OK
item_api = Blueprint('item_api', __name__)
@item_api.route('/items', methods=['GET', 'POST'])
def all_items():
results = None
if reque... | {
"repo_name": "sudohippie/terrace",
"path": "terrace/api/item.py",
"copies": "1",
"size": "1567",
"license": "mit",
"hash": -4472719401870708700,
"line_mean": 23.873015873,
"line_max": 72,
"alpha_frac": 0.5666879387,
"autogenerated": false,
"ratio": 3.5372460496613995,
"config_test": false,
"... |
__author__ = 'Raghav Sidhanti'
from terrace.db import list_dao
from flask import Blueprint
from flask import request, jsonify
from httplib import BAD_REQUEST, NOT_FOUND, OK
list_api = Blueprint('list_api', __name__)
@list_api.route('/lists', methods=['GET', 'POST'])
def all_lists():
results = None
if reque... | {
"repo_name": "sudohippie/terrace",
"path": "terrace/api/list.py",
"copies": "1",
"size": "1568",
"license": "mit",
"hash": -8265739073594823000,
"line_mean": 23.5,
"line_max": 72,
"alpha_frac": 0.5663265306,
"autogenerated": false,
"ratio": 3.539503386004515,
"config_test": false,
"has_no_ke... |
__author__ = 'Raghav Sidhanti'
from terrace import flask_app
from flask.ext.sqlalchemy import SQLAlchemy
from datetime import datetime
db = SQLAlchemy(flask_app)
class List(db.Model):
__tablename__ = 'list'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(lengt... | {
"repo_name": "sudohippie/terrace",
"path": "terrace/db/model.py",
"copies": "1",
"size": "2424",
"license": "mit",
"hash": -4278738803333330000,
"line_mean": 30.4805194805,
"line_max": 105,
"alpha_frac": 0.5882838284,
"autogenerated": false,
"ratio": 3.543859649122807,
"config_test": false,
... |
__author__ = 'Raghav Sidhanti'
import device
import message
import fsutil
from inout import StdIn
from inout import StdOut
from configuration import Conf
from configuration import ConfUtil
# defines all the available fog commands.
# every command defines default pre and post steps.
# executes appropriate methods on ... | {
"repo_name": "sudohippie/fog",
"path": "fog/command.py",
"copies": "1",
"size": "12650",
"license": "mit",
"hash": -3444546462737979000,
"line_mean": 26.2043010753,
"line_max": 116,
"alpha_frac": 0.5668774704,
"autogenerated": false,
"ratio": 4.191517561298873,
"config_test": false,
"has_no_... |
__author__ = 'Raghav Sidhanti'
import fsutil
class DriveConf(object):
kw = None
def __init__(self, **kwargs):
self.kw = kwargs
def get(self, key=''):
return self.kw.get(key)
class Conf(object):
# standard
HOME = '.fog'
LOGS = ''.join([HOME, '/logs'])
CHECKOUT = ''.join... | {
"repo_name": "sudohippie/fog",
"path": "fog/configuration.py",
"copies": "1",
"size": "2646",
"license": "mit",
"hash": -438542975793644160,
"line_mean": 21.6153846154,
"line_max": 78,
"alpha_frac": 0.5835222978,
"autogenerated": false,
"ratio": 3.467889908256881,
"config_test": false,
"has_... |
__author__ = 'Raghav Sidhanti'
import message
import fsutil
import pprint
import mimetypes
from inout import StdIn
from inout import StdOut
from configuration import Conf
from configuration import ConfUtil
from apiclient.discovery import build
from apiclient.errors import HttpError
from apiclient.http import MediaFi... | {
"repo_name": "sudohippie/fog",
"path": "fog/device.py",
"copies": "1",
"size": "12689",
"license": "mit",
"hash": -3169345494953019000,
"line_mean": 33.2021563342,
"line_max": 114,
"alpha_frac": 0.5351879581,
"autogenerated": false,
"ratio": 4.232488325550367,
"config_test": false,
"has_no_k... |
__author__ = 'rahit'
from django.conf import settings
# A string describing the Facebook application's ID.
FACEBOOK_APPLICATION_ID = getattr(settings, 'FACEBOOK_APPLICATION_ID')
# A string describing the URL to redirect to upon authorizing users.
FACEBOOK_AUTHORIZATION_REDIRECT_URL = getattr(settings, 'FACEBOOK_AUTH... | {
"repo_name": "rahit/faceit",
"path": "faceit/setting.py",
"copies": "1",
"size": "1130",
"license": "mit",
"hash": -1869041397803111000,
"line_mean": 38,
"line_max": 110,
"alpha_frac": 0.7212389381,
"autogenerated": false,
"ratio": 3.830508474576271,
"config_test": false,
"has_no_keywords": ... |
__author__ ='Rahul Chatterjee'
import os, sys, json, csv
import string, re
import unittest, string
from collections import defaultdict
from .correctors import fast_modify, EDITS_NAME_FUNC_MAP
from pwmodel import HistPw, NGramPw
# import heapq
from .common import (PW_FILTER, DATA_DIR_PATH,
get_most_... | {
"repo_name": "rchatterjee/mistypography",
"path": "typofixer/checker.py",
"copies": "1",
"size": "10029",
"license": "mit",
"hash": -4593691663365455400,
"line_mean": 35.4690909091,
"line_max": 99,
"alpha_frac": 0.5630671054,
"autogenerated": false,
"ratio": 3.327471798274718,
"config_test": f... |
__author__ ='Rahul Chatterjee'
import os, sys
import tarfile, gzip
import itertools
import string
import bz2
THIS_DIR = os.path.dirname(__file__)
DATA_DIR_PATH = os.path.join(THIS_DIR, 'data/')
MIN_PROB = 1e-8 # default probability of a password, if not found in the dict.
MIN_LENGHT_PW = 6 # Only consider password... | {
"repo_name": "rchatterjee/mistypography",
"path": "typofixer/common.py",
"copies": "1",
"size": "5736",
"license": "mit",
"hash": -7332258242780769000,
"line_mean": 26.5769230769,
"line_max": 100,
"alpha_frac": 0.5390516039,
"autogenerated": false,
"ratio": 3.0921832884097036,
"config_test": f... |
__author__ ='Rahul Chatterjee'
"""
LICENSED to modify and distribute any or all parts of the code.
"""
import os, sys, json, csv
import string, re
import unittest, string
from collections import defaultdict, Iterable
from .common import (ALLOWED_EDITS, SHIFT_KEY, CAPS_KEY, ALLOWED_KEYS)
try:
from word2keypress imp... | {
"repo_name": "rchatterjee/mistypography",
"path": "typofixer/correctors.py",
"copies": "1",
"size": "14023",
"license": "mit",
"hash": 8091590011456161000,
"line_mean": 34.2336683417,
"line_max": 106,
"alpha_frac": 0.6041503245,
"autogenerated": false,
"ratio": 3.260404557079749,
"config_test"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.