text stringlengths 4 1.02M | meta dict |
|---|---|
"""
Test for io_services_test_stubs.py
"""
try:
import asyncio
except ImportError:
asyncio = None
import sys
import threading
import unittest
import tornado.ioloop
import twisted.internet.reactor
from pika.adapters import select_connection
from tests.stubs.io_services_test_stubs import IOServicesTestStubs... | {
"content_hash": "d2240351984c4b4a78c6ffb1dafc3cbb",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 165,
"avg_line_length": 32.32258064516129,
"alnum_prop": 0.6783100465735197,
"repo_name": "pika/pika",
"id": "70857a1a68a3110fa6dc28009b72841e70b28fd5",
"size": "3006",
"... |
from operator import attrgetter
from random import shuffle
class Point:
def __init__(self, x, y):
self.x, self.y = x, y
def sort1(points):
points.sort(key = lambda p: p.x)
def sort2(points):
points.sort(key = attrgetter("x"))
if __name__ == "__main__":
from timeit import Timer
points1 =... | {
"content_hash": "d6f8c4ab997f86db00d5a8a00052c664",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 71,
"avg_line_length": 23.653846153846153,
"alnum_prop": 0.616260162601626,
"repo_name": "tebeka/pythonwise",
"id": "375e1206d45ddeca79aaf6881dded3b3c1a405f4",
"size": "638... |
_A=None
from ._compat import filename_to_ui,get_text_stderr
from .utils import echo
def _join_param_hints(param_hint):
A=param_hint
if isinstance(A,(tuple,list)):return ' / '.join((repr(B)for B in A))
return A
class ClickException(Exception):
exit_code=1
def __init__(B,message):A=message;super().__init__(A);B.mess... | {
"content_hash": "d827c2318c0d34d960665fcf6bddb394",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 149,
"avg_line_length": 43.38157894736842,
"alnum_prop": 0.6803154382772217,
"repo_name": "rochacbruno/dynaconf",
"id": "6cc018904802873a4aa0a3bcfb456fea42ca3e6c",
"size": ... |
"""Utility to generate the header files for BOOST_METAPARSE_STRING"""
# Copyright Abel Sinkovics (abel@sinkovics.hu) 2016.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import argparse
import math
im... | {
"content_hash": "7de114809af33be820fe4b00d4c6d49f",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 78,
"avg_line_length": 30.00293255131965,
"alnum_prop": 0.49819177011044863,
"repo_name": "jmanday/Master",
"id": "2676f3f21e92b443edde8bafda3dcc8124cf79c0",
"size": "1024... |
import os
from south.db import db
from south.v2 import DataMigration
from django.conf import settings
from django.core.files import File
from django.db import models
from cmsplugin_gallery.models import Image
class Migration(DataMigration):
classes = (models.ImageField, models.FileField, )
fields = ('src', ... | {
"content_hash": "5e2bc7991cb686e0acbbe51badcd00e2",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 156,
"avg_line_length": 56.901408450704224,
"alnum_prop": 0.5809405940594059,
"repo_name": "heckfi/cmsplugin_gallery_filer",
"id": "18850cd2d6841f7564a0cc91c3f590f47f497669",... |
"""Radio auto updater."""
# Original code by Mikie (https://github.com/Mikie-Ghost/)
import radio
from radio import RUNDIR, logger, DATA_DIR
import urllib2, tarfile, os, shutil, platform, subprocess, re
from flask import json
# define master repo as user and branch in github repo
user = 'mrkipling'
branch = 'master'
... | {
"content_hash": "0e92ddde7871b92e6b8a7aeae0d9fc05",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 137,
"avg_line_length": 32.21343873517787,
"alnum_prop": 0.6024539877300613,
"repo_name": "hephaestus9/Radio",
"id": "0f4a9fc959fc0db3fd29706c5f7894dda770adad",
"size": "8... |
import theano
import theano.tensor as T
import numpy as np
from ..utils.theano_utils import shared_zeros, floatX, shared_scalar
from .. import activations, initializations
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
#srng = RandomStreams(seed=np.random.randint(10e6))
srng = RandomStreams()
i... | {
"content_hash": "e5d45ca438efdb80033d40ee9c333149",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 116,
"avg_line_length": 32.33108108108108,
"alnum_prop": 0.6033437826541275,
"repo_name": "shenxudeu/deuNN",
"id": "dae8e479d785e3986844a76c82aa83680d253b3f",
"size": "478... |
import sys
from nb.classifier import Classifier
from nb.trainer import Trainer
from support.loader import Loader
from support.writer import Writer
from support.utils import Utils
def main():
print "### NBAC - Naive Bayes Ads Classifier ###","\n"
# Check if the training set limit was given by argv
if len(s... | {
"content_hash": "d1efb282324eb8999f381dca66e85eb1",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 102,
"avg_line_length": 26.933333333333334,
"alnum_prop": 0.5985148514851485,
"repo_name": "marcusmachado/nbac",
"id": "a234b74b70532b4fbf4b4a8c530762562d7715ac",
"size": "... |
import unittest
import mock
import base64
import troposphere
from stacker.lookups.handlers.file import parameterized_codec, handler
class TestFileTranslator(unittest.TestCase):
def test_parameterized_codec_b64(self):
expected = {
'Fn::Base64': {
'Fn::Join': [
... | {
"content_hash": "2c783063f99227dddc0e79bb79921047",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 77,
"avg_line_length": 36.958333333333336,
"alnum_prop": 0.5704622322435174,
"repo_name": "mhahn/stacker",
"id": "bf7074b4020f181b953f4b8492a0a0ff6a3567b0",
"size": "2661",... |
import pygame
def component_Gravity(GameObject, GameState):
GameObject.velocity[1] += 0.1
def component_Movement(GameObject, GameState):
GameObject.pos[0] += GameObject.velocity[0]
GameObject.pos[1] += GameObject.velocity[1]
# added max speed
if GameObject.velocity[0] < -3:
GameObject.vel... | {
"content_hash": "d4269f03853e85118e48e9fbbbf742d5",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 82,
"avg_line_length": 33.63291139240506,
"alnum_prop": 0.5540082800150545,
"repo_name": "MrValdez/PyCon-2015-Gamedev-talk",
"id": "9f825f33159607775cffd6698bb23db545b34976"... |
class ContentTypeMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
# One-time configuration and initialization.
def __call__(self, request):
# Code to be executed for each request before
# the view (and later middleware) are called.
... | {
"content_hash": "881842b7d4b0253195ce3a8e611876ae",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 84,
"avg_line_length": 33.72222222222222,
"alnum_prop": 0.6342668863261944,
"repo_name": "nmalaguti/mini-halite",
"id": "a4fa27a8f5e5b65d2b0882542bb2479375cf8046",
"size": ... |
import os
import sys
import json
import string
import random
import hashlib
import unittest
from cStringIO import StringIO
root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(root_path)
sys.path.append(os.path.join(root_path, 'lib'))
os.environ['SETTINGS_FLAVOR'] = 'test'
impor... | {
"content_hash": "bac623138907c13f0264986d4745e0f3",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 77,
"avg_line_length": 38.45614035087719,
"alnum_prop": 0.5857664233576643,
"repo_name": "airbnb/docker-registry",
"id": "e0b64edd692aadcfaae5342f0567313f0a7ea69b",
"size":... |
import os
import nbformat
from generate_contents import iter_notebooks, NOTEBOOK_DIR
def fix_kernelspec():
for nb_name in iter_notebooks():
nb_file = os.path.join(NOTEBOOK_DIR, nb_name)
nb = nbformat.read(nb_file, as_version=4)
print("- Updating kernelspec for {0}".format(nb_name))
... | {
"content_hash": "4aa13d40f8fc46667d916398de1d52af",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 65,
"avg_line_length": 25.047619047619047,
"alnum_prop": 0.6216730038022814,
"repo_name": "mbeyeler/opencv-machine-learning",
"id": "1472925d41d3ba7ddba4365b180d2df06538108d"... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'finanzas.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^api/', include('finanzas.api.urls'... | {
"content_hash": "e9f0c8b928e34ca92ac03dedb0b1eff2",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 53,
"avg_line_length": 29.545454545454547,
"alnum_prop": 0.6369230769230769,
"repo_name": "jualjiman/finanzas",
"id": "1dfbcf9a930bd058f415f89ead8e8e66b956a32d",
"size": "3... |
from django.shortcuts import render
from django.template.loader import get_template
from django.http import HttpResponse
from datetime import datetime
# Create your views here.
def index(request, tvno='0'):
tv_list = [{'name':'CCTV News', 'tvcode':'yPhFG2I0dE0'},
{'name':'CCTV中文国际', 'tvcode':'E1DTZBy4xr4'},]
tem... | {
"content_hash": "5fc36d97894f85006f06708cae6bfee3",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 57,
"avg_line_length": 27.363636363636363,
"alnum_prop": 0.6799557032115172,
"repo_name": "lichengshuang/python",
"id": "ea4b82308fc942dd22c57330ac2bb1465b19d3ee",
"size": ... |
'''
Defines the base class for any training pipeline
'''
import ecto
class TrainerBase(object):
"""
This is a base class for a training pipeline: you don't need to have your pipeline cell inherit from that class
but if you do, it will be listed as an official training pipeline
You need to call the Blac... | {
"content_hash": "baf3dd3585e7203d988c40ac399b2062",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 120,
"avg_line_length": 38.05882352941177,
"alnum_prop": 0.6290571870170015,
"repo_name": "WalkingMachine/sara_commun",
"id": "c8cead7465084940fdfe83184af3cef09d0e2a95",
"s... |
from __future__ import unicode_literals
import datetime
import os
import tokenize
import unittest
from django.core.validators import RegexValidator, EmailValidator
from django.db import models, migrations
from django.db.migrations.writer import MigrationWriter, SettingsReference
from django.test import TestCase
from ... | {
"content_hash": "d83b678e29d3793108e15d752ebe7955",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 126,
"avg_line_length": 44.28048780487805,
"alnum_prop": 0.6346277425869825,
"repo_name": "aleksandra-tarkowska/django",
"id": "8f8437faf92696acc263c586094d782e013e8d12",
... |
"""Simple benchmark for Marshmallow serialization of a moderately complex object.
Uses the `timeit` module to benchmark serializing an object through Marshmallow.
"""
from __future__ import print_function, unicode_literals, division
import argparse
import cProfile
import gc
import timeit
import time
from marshmallo... | {
"content_hash": "95377726e12edc2db7ebffd21ec9f512",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 98,
"avg_line_length": 31.49230769230769,
"alnum_prop": 0.6042989741084513,
"repo_name": "xLegoz/marshmallow",
"id": "062d247224cf956dfe40a5208d092fdd777a9e85",
"size": "4... |
"""Helper functions for progress callbacks."""
import logging
import sys
from gslib.util import MakeHumanReadable
from gslib.util import UTF8
# Default upper and lower bounds for progress callback frequency.
_START_BYTES_PER_CALLBACK = 1024*64
_MAX_BYTES_PER_CALLBACK = 1024*1024*100
# Max width of URL to display in... | {
"content_hash": "99c1bf97377c9e3324dec96acfdd31de",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 80,
"avg_line_length": 41.34394904458599,
"alnum_prop": 0.6827915575412109,
"repo_name": "sahiljain/catapult",
"id": "69ee3ed725d62eebbcb658cef5a83703fcae553c",
"size": "7... |
import os
import time
import random
import threading
import unittest
from pyspark import SparkContext, SparkConf
class PinThreadTests(unittest.TestCase):
# These tests are in a separate class because it uses
# 'PYSPARK_PIN_THREAD' environment variable to test thread pin feature.
@classmethod
def set... | {
"content_hash": "f88a79e203ffaa1c00b1a5716da08ecc",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 97,
"avg_line_length": 34.114285714285714,
"alnum_prop": 0.5722361809045227,
"repo_name": "skonto/spark",
"id": "657d129fe63bbca908d3c2705459a86e674dc455",
"size": "5560",... |
import copy
from .base import BaseField, MAPPING_TYPES, SEQUENCE_TYPES
__all__ = ['StringField', 'ListField', 'DictField',
'GroupsField', 'ExtrasField']
class StringField(BaseField):
default = None
def validate(self, instance, name, value):
if value is None:
if self.required... | {
"content_hash": "e0132392f317ef8ff1a8375e7b511f8c",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 76,
"avg_line_length": 31.67721518987342,
"alnum_prop": 0.6107892107892108,
"repo_name": "opendatatrentino/ckan-api-client",
"id": "a47f7d073b437ec60202c4c91f9dd98f9378385b"... |
from .sub_resource import SubResource
class VirtualNetworkGatewayIPConfiguration(SubResource):
"""IP configuration for virtual network gateway.
Variables are only populated by the server, and will be ignored when
sending a request.
:param id: Resource ID.
:type id: str
:param private_ip_allo... | {
"content_hash": "0dd6e04e4dfc1d99449c03ffa031e3ad",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 103,
"avg_line_length": 43.907407407407405,
"alnum_prop": 0.6613243357233235,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "96fdc0bec279b91ceb37ebfb8e74cffa5a07efe4",
... |
import six
from heat.common import exception
from heat.common.i18n import _
from heat.engine import properties
from heat.engine import resource
class NeutronSecurityGroup(object):
def __init__(self, sg):
self.sg = sg
self.client = sg.client('neutron')
self.plugin = sg.client_plugin('neut... | {
"content_hash": "9d637849db279e6f6b3d9dd4f15c9296",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 74,
"avg_line_length": 36.71863117870723,
"alnum_prop": 0.5595940768354561,
"repo_name": "noironetworks/heat",
"id": "38b298e8fae07578f31274e3a7cbc9e772759b9c",
"size": "1... |
from . import number_types as N
from .number_types import (UOffsetTFlags, SOffsetTFlags, VOffsetTFlags)
from . import encode
from . import packer
from . import compat
from .compat import range_func
from .compat import memoryview_type
from .compat import import_numpy, NumpyRequiredForThisFeature
np = import_numpy()
#... | {
"content_hash": "b518c7f777d5f4132e38eeb678a2aee7",
"timestamp": "",
"source": "github",
"line_count": 741,
"max_line_length": 83,
"avg_line_length": 33.225371120107965,
"alnum_prop": 0.6128350934199838,
"repo_name": "hgl888/flatbuffers",
"id": "1e96d6fe72e517a81427e31b80af32e12b7cb179",
"size": "... |
import socket, struct, sys, time
from logging import getLogger, DEBUG
from qpid import compat
from qpid import sasl
from qpid.concurrency import synchronized
from qpid.datatypes import RangedSet, Serial
from qpid.framing import OpEncoder, SegmentEncoder, FrameEncoder, \
FrameDecoder, SegmentDecoder, OpDecoder
from ... | {
"content_hash": "d7e077f9862b638d6af71301d68d6b75",
"timestamp": "",
"source": "github",
"line_count": 1432,
"max_line_length": 122,
"avg_line_length": 31.225558659217878,
"alnum_prop": 0.6180476350218047,
"repo_name": "mbroadst/debian-qpid-python",
"id": "146b8188ab8bebed2d3af26f6bfa6c3667af91cd",
... |
from django.db import models
from pdc.apps.common.validators import validate_sigkey
def get_cached_id(cls, cache_field, value, create=False):
"""cached `value` to database `id`"""
if not value:
return None
result = cls.CACHE.get(value, None)
if result is None:
if create:
o... | {
"content_hash": "7a9a8a1143c98ac59401c44631a7fbdf",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 100,
"avg_line_length": 29.32894736842105,
"alnum_prop": 0.5930910722296994,
"repo_name": "tzhaoredhat/automation",
"id": "0ad4dfbd1124d7f3762344678f26006e4731ad7c",
"size"... |
import logging
from datetime import datetime, timedelta
from datetime import time as dttime
import time
import math
# Our imports
from emission.core.get_database import get_section_db, get_uuid_db
import emission.analysis.result.carbon as carbon
import emission.core.common as common
import emission.net.api.stats as st... | {
"content_hash": "e13d4120ee2408e118e1aeb069b4766d",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 145,
"avg_line_length": 44.92613636363637,
"alnum_prop": 0.7395978247122803,
"repo_name": "joshzarrabi/e-mission-server",
"id": "c07edc23d875a98259c90cc85cfe1a16d4db9b99",
... |
"""
Created on Mon Feb 14, 2011
@author:Isabel Restrepo
A script to run (fast) k-means on J sets of random subsamples
"""
import os;
import dbrec3d_batch
import multiprocessing
import Queue
import time
import random
import optparse
import sys
from numpy import log, ceil
from xml.etree.ElementTree import ElementTree
... | {
"content_hash": "df8f6b7a3c13bf53e111029988b4bd39",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 119,
"avg_line_length": 29.98709677419355,
"alnum_prop": 0.5935886402753873,
"repo_name": "mirestrepo/voxels-at-lems",
"id": "5b82268404b68de2498f5346f9a3fd0e961323eb",
"s... |
try:
from setuptools import setup
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
with open("README.pypi.rst") as readmeFile:
long_description = readmeFile.read()
install_requires = []
with open("requirements.txt") as requirementsFile:
for ... | {
"content_hash": "efe23430320894ff75ad1736eb67b936",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 73,
"avg_line_length": 31.06153846153846,
"alnum_prop": 0.6235760277365032,
"repo_name": "david4096/celldb",
"id": "77588e01bd7bb32878d4e3ae0794eb23bb041d9a",
"size": "2176... |
import logging
import tempfile
from telemetry import benchmark
from telemetry.core import bitmap
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.core import video
from telemetry.core.platform import tracing_category_filter
from telemetry.timeline import model
from telemetry.unittes... | {
"content_hash": "bbbf188655a068dba33a059e6872e464",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 80,
"avg_line_length": 37.48351648351648,
"alnum_prop": 0.7229551451187335,
"repo_name": "sencha/chromium-spacewalk",
"id": "2f5cb694fd2dce479096443caac086777ffffc39",
"si... |
"""
WSGI config for happening project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from dj_static import Cling, MediaC... | {
"content_hash": "ee79de243abbe992b73b6bda48c30a81",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 78,
"avg_line_length": 29.40909090909091,
"alnum_prop": 0.7604327666151468,
"repo_name": "jscott1989/happening",
"id": "edee64e3e3d679ceb53e0116afcca90fc00bf7fa",
"size": "... |
from django.db import models
class User(models.Model):
username = models.text()
| {
"content_hash": "a69534d1b44a08be5f9474c68372f73b",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 28,
"avg_line_length": 20.5,
"alnum_prop": 0.7560975609756098,
"repo_name": "crystal-gen/django",
"id": "bbed3d864611591095973ec2accc448332db06ab",
"size": "170",
"binary"... |
from .server import *
from .client import *
| {
"content_hash": "e790729cfb89948668ff2e5853b94fe7",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 21,
"avg_line_length": 22,
"alnum_prop": 0.7272727272727273,
"repo_name": "maxpumperla/elephas",
"id": "ad9c21ab41ddcb20ad648ec2cae3c27ea5d8651a",
"size": "44",
"binary": ... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('game', '0006_game'),
]
operations = [
migrations.AddField(
model_name='game',
name='desc_en',
field=models.TextF... | {
"content_hash": "e1c10f678d6e2310b5a10c838535a644",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 183,
"avg_line_length": 29.806451612903224,
"alnum_prop": 0.5811688311688312,
"repo_name": "stefantsov/blackbox3",
"id": "42b0accb3a9a7a512bc23bc726044647caa333a6",
"size":... |
from __future__ import division
import glob
import logging
import os
import sys
import time
from optparse import OptionParser
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
ROOT_DIR = os.path.dirname(os.path.dirname(SCRIPT_DIR))
DEFAULT_LIBDIR_GLOB = os.path.join(ROOT_DIR, 'lib', 'py', 'build', 'lib.*')
cla... | {
"content_hash": "2cf5649d66b3d6732ff2b76ec55ecf16",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 125,
"avg_line_length": 33.25167785234899,
"alnum_prop": 0.6562720758906045,
"repo_name": "reTXT/thrift",
"id": "f12a9fe76229b81b803275ce71e6bdf0e5e575af",
"size": "10717"... |
import json
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from common.serializers import AbstractFieldsMixin, ContactSerializer
from common.models import Contact, ContactType
from .models import (
CommunityHealthUnit,
CommunityHealthWorker,
CommunityHealthWo... | {
"content_hash": "55dce8f4d0aa5ce53a877e0fd60ce9b7",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 79,
"avg_line_length": 36.24825174825175,
"alnum_prop": 0.6066364425581171,
"repo_name": "Nyto035/Konza_backend",
"id": "65ad302c7a1768270f70442c37f8223d524a45af",
"size":... |
import datetime
import json
import unittest
from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange
from django import forms
from django.contrib.postgres import fields as pg_fields, forms as pg_forms
from django.contrib.postgres.validators import (
RangeMaxValueValidator, RangeMinValueValidator,
)
fr... | {
"content_hash": "73599209c861fd21089a1fb80a76fc94",
"timestamp": "",
"source": "github",
"line_count": 399,
"max_line_length": 158,
"avg_line_length": 36.19799498746867,
"alnum_prop": 0.6093609360936093,
"repo_name": "devops2014/djangosite",
"id": "c26382a15bd243ee97c5852ed206e502eb4c9245",
"size"... |
import sys
import time
import unittest2 as unittest
from pyspider.libs import counter
class TestCounter(unittest.TestCase):
def test_010_TimebaseAverageEventCounter(self):
c = counter.TimebaseAverageEventCounter(2, 1)
for i in range(100):
time.sleep(0.1)
c.event(100+i)
... | {
"content_hash": "9a5b2d39ac8b4e9af141fe0b7c83b206",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 53,
"avg_line_length": 26.964285714285715,
"alnum_prop": 0.5774834437086093,
"repo_name": "VDuda/pyspider",
"id": "39baace3bedfd00cfbcdff528600f32905c3d89c",
"size": "942",... |
from .basededatos import BaseDeDatos
class PerInstitucionMedica(BaseDeDatos):
def obtener_uno(self, id_):
"""
Obtiene y retorna un objeto según el id dado.
:param id_: int >= 0
:return: object
"""
if id_ >= 0:
id_ = (id_,)
sql = 'SELECT * FR... | {
"content_hash": "d53534faf0bdf13c799b7fc703438198",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 88,
"avg_line_length": 33.63013698630137,
"alnum_prop": 0.5389002036659878,
"repo_name": "gabofer82/taller_programacion_2017",
"id": "b406f1ee63afddb885114a592e6e983dd1f4be73... |
class DailyInfo:
def __init__(self, errorCount, tweetCount, dailyFlag, oldFollowers, newFollowers, user):
self.errorCount = errorCount
self.tweetCount = tweetCount
self.dailyFlag = dailyFlag
self.oldFollowers = oldFollowers
self.newFollowers = newFollowers
self.user =... | {
"content_hash": "b08cc6eb2a2e6a6f3ff1cf84716f9cc3",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 92,
"avg_line_length": 40.75,
"alnum_prop": 0.6748466257668712,
"repo_name": "foxof72/botMessager",
"id": "9967a5ab496fce3a2ac3890c955251f73706202a",
"size": "359",
"binar... |
import sys
sys.path.insert(1, "../../")
import h2o, tests
def score_history_test(ip,port):
air_train = h2o.import_file(path=h2o.locate("smalldata/airlines/AirlinesTrain.csv.zip"))
gbm_mult = h2o.gbm(x=air_train[["Origin", "Dest", "Distance", "UniqueCarrier", "IsDepDelayed", "fDayofMonth","fMonth"]]... | {
"content_hash": "4c2a7766b1c19ce2fe353183c1f87c5f",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 124,
"avg_line_length": 32.22222222222222,
"alnum_prop": 0.6155172413793103,
"repo_name": "bospetersen/h2o-3",
"id": "22f7f17880546bb938507e50d0557d35425515fa",
"size": "58... |
import json
import time
import redis
import logging
#
# This server services a status queue defined by the graph terminal node "RABBITMQ_STATUS_QUEUE".
#
# 1. If used as a package the function queue_message is used to send a message to the cloud server
# 2. If used as a main program the program takes messages from the... | {
"content_hash": "749c586ef971c3fea6fa7d53e71170cf",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 128,
"avg_line_length": 32.35897435897436,
"alnum_prop": 0.6048600105652404,
"repo_name": "glenn-edgar/local_controller_3",
"id": "693e4bc0becbdfe3709678c483e6607a7a41b550",... |
"""Network Table."""
from collections import OrderedDict
import psycopg2.extras
from pyiem.util import get_dbconn
class Table:
"""Our class"""
def __init__(self, network, cursor=None, only_online=True):
"""A class representing a network(s) of IEM metadata
Args:
network (str or lis... | {
"content_hash": "b2ca1ed14eafb3f9e7d469dd8a97f1d4",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 79,
"avg_line_length": 37.62135922330097,
"alnum_prop": 0.5447741935483871,
"repo_name": "akrherz/pyIEM",
"id": "d8aabc6607dc7a68653610071c7d17c836197d23",
"size": "3875",... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 Michael Hull.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are ... | {
"content_hash": "99f4a70fe20bb58f36970058f9edc99a",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 195,
"avg_line_length": 37.97841726618705,
"alnum_prop": 0.6978594430763402,
"repo_name": "mikehulluk/morphforge",
"id": "53afcd50b2b82abae1bc6cc49124bf5937f0cc39",
"size"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("fluent_contents", "0001_initial")]
operations = [
migrations.CreateModel(
name="TwitterRecentEntriesItem",
fields=[
(
... | {
"content_hash": "cca95afd7328fe16167a22342ecee2d5",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 143,
"avg_line_length": 37.09230769230769,
"alnum_prop": 0.39257569473247617,
"repo_name": "edoburu/django-fluent-contents",
"id": "9358f0bfa9757553f4a8939dc533af7007fa13a9"... |
import json
import datetime
from decimal import Decimal
from django.core.management.base import BaseCommand
from game.users.models import User
from game.interactive.models import Interactive, InteractiveRound, Survey
class DecimalEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, Decimal)... | {
"content_hash": "7c91d82032f087ff38d095317967178a",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 73,
"avg_line_length": 34.166666666666664,
"alnum_prop": 0.5317073170731708,
"repo_name": "adminq80/Interactive_estimation",
"id": "62400d07bacda4febff0b6e3b0f2b0390f642a8d",... |
"""Sensors."""
import appdirs
import pathlib
import collections
import numpy as np
import toml
from PySide2 import QtCore, QtWidgets
import WrightTools as wt
import yaqc
import pycmds
import pycmds.project.classes as pc
import pycmds.project.widgets as pw
config = toml.load(pathlib.Path(appdirs.user_config_dir... | {
"content_hash": "5c879f4467ce78d8d41222bf40994b2a",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 93,
"avg_line_length": 26.49767441860465,
"alnum_prop": 0.5866245392311743,
"repo_name": "wright-group/PyCMDS",
"id": "b7b471c31da8695bc25470bab6b48114eb3984b1",
"size": "... |
import os.path
import sys
from alembic import command, util, autogenerate as autogen
from alembic.config import Config, CommandLine
from alembic.environment import EnvironmentContext
from alembic.script import ScriptDirectory
from ggrc import settings
import ggrc.app
from ggrc.extensions import get_extension_module, ge... | {
"content_hash": "56b0083c338ffd5eb7cd1cf2556a5f6e",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 77,
"avg_line_length": 35.94078947368421,
"alnum_prop": 0.732930624199158,
"repo_name": "kr41/ggrc-core",
"id": "2072c2c01c8ac2dbf1b50ff3e73a94a36df273bc",
"size": "5576",... |
import subprocess
import sys
import platform
import shutil
import logging
import time
import os
from os.path import dirname, join, abspath
from optparse import OptionParser
###########################
# This variable is important
PROJECT_NAME = 'ATRR'
########################
PROJECT_VERSION = '3.0STD0'
##########... | {
"content_hash": "52e168d3ac84f00b4f016e06fa759078",
"timestamp": "",
"source": "github",
"line_count": 663,
"max_line_length": 110,
"avg_line_length": 29.553544494720967,
"alnum_prop": 0.5453199959171174,
"repo_name": "seawaywen/memodir_skels",
"id": "9f86cdfed21c33dbfde5ea9c05b74a7532a9dade",
"si... |
import os
from ec2 import lookup
from ec2.base.action import Action, CLMException
from ec2.error import InvalidAction, MethodNotAllowed, InvalidArgument, InvalidURI, EC2Exception
from ec2.settings import BUCKETS_PATH
"""@package src.base.s3action
S3 base action
@copyright Copyright (c) 2012 Institute of Nuclear Physi... | {
"content_hash": "295f67179dce35e3aadda1b414157672",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 99,
"avg_line_length": 31.475247524752476,
"alnum_prop": 0.5555206039635106,
"repo_name": "cc1-cloud/cc1",
"id": "1483ea8473547e9dbeadfd41a564a6a20b2963fe",
"size": "3878"... |
#!/opt/local/bin/python2.5
import os, re, base64
image_dir='../../Source/images'
dst='../../Source/images/MifImage.js'
dst_ie='../../Source/images/MifImage.mht'
data={}
for filename in os.listdir(image_dir):
if not re.search('\.(gif|png|jpg)$', filename):
continue
else:
file=os.path.join(image_dir, filename)
... | {
"content_hash": "f1567b62cd904588358bba6a0a53cfb8",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 74,
"avg_line_length": 26.06451612903226,
"alnum_prop": 0.6608910891089109,
"repo_name": "creaven/mif",
"id": "b81b23471edee2ff75daab2949d6b09b9999c827",
"size": "808",
"... |
from docopt_subcommands import command, main
# We need to provide a new top-level documentation template which contains
# our --verbose option.
DOC_TEMPLATE = """{program}
Usage: {program} [options] <command> [<args> ...]
Options:
-h --help Show this screen.
-v --version Show the program version.
--verbos... | {
"content_hash": "f3eb2d9659d1c8276dd2ccaa405cfe72",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 74,
"avg_line_length": 23.736842105263158,
"alnum_prop": 0.6245380635624538,
"repo_name": "abingham/docopt-subcommands",
"id": "d397ebe914426e3b9e166e03fdda4769bb657178",
"... |
"""
Code containing Growler's asyncio.Protocol code for handling all
streaming (TCP) connections.
This module has a 'hard' dependency on asyncio, so if you're using a
diffent event loop (for example, curio) then you should NOT be using
this class.
Alternative Protocol classes may use this as an example.
For more info... | {
"content_hash": "568ce2bbbed5903bb93f71479b298a6f",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 77,
"avg_line_length": 35.306976744186045,
"alnum_prop": 0.647740745619813,
"repo_name": "akubera/Growler",
"id": "6ce163363a9b820ce45ec3a66ff04edc508db485",
"size": "7621... |
import base_solver as base
import game
from lib import helpers
import numpy as np
import redis
r = redis.StrictRedis(host='localhost', port=6379, db=0)
STATE_MISS = 0
STATE_HIT = 1
STATE_UNKNOWN = 2
SHIP_SIZES = helpers.SHIP_SIZES
class OpenCLSolver(base.BaseSolver):
def __init__(self):
super(OpenCLSolver,self).... | {
"content_hash": "7882db69f1315e3a64ea67cd9e62c9bd",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 98,
"avg_line_length": 22.172727272727272,
"alnum_prop": 0.6859368593685937,
"repo_name": "nicofff/baas",
"id": "3857d93c16994e18b3ab24cb6d284086c1210cf7",
"size": "2439",... |
from functools import wraps
from sqlalchemy.orm.collections import InstrumentedList as _InstrumentedList
from .arrow import ArrowType # noqa
from .choice import Choice, ChoiceType # noqa
from .color import ColorType # noqa
from .country import CountryType # noqa
from .currency import CurrencyType # noqa
from .em... | {
"content_hash": "fab73d2563cc12f0fab583002685ab3f",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 76,
"avg_line_length": 29.775862068965516,
"alnum_prop": 0.7371163867979155,
"repo_name": "JackWink/sqlalchemy-utils",
"id": "209b3f29510ab9c38c3eab15fe54a6a07e94ec11",
"si... |
import copy
import inspect
import logging
import os
import sys
import uuid
logger = logging.getLogger(__name__)
class Fixture(object):
def __init__(self, context):
self.context = context
@property
def category(self):
return self.__module__.__name__.rsplit('.', 2)[-2].replace('test_', '')... | {
"content_hash": "1f265b1fa9ce45a5a5dee3b930b5d169",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 115,
"avg_line_length": 25.52857142857143,
"alnum_prop": 0.5223838836038053,
"repo_name": "alunduil/muniments",
"id": "7ca3f37b8376baffd5b8fc2d23aa315274354487",
"size": "... |
from libcloud.autoscale.providers import get_driver as as_get_driver
from libcloud.autoscale.types import Provider as as_provider
ACCESS_ID = 'your access id'
SECRET_KEY = 'your secret key'
as_driver = as_get_driver(as_provider.AWS_AUTOSCALE)(ACCESS_ID, SECRET_KEY)
group = as_driver.list_auto_scale_groups()[0]
polic... | {
"content_hash": "55fde14265c6c9404fc0353e96c1cdcc",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 75,
"avg_line_length": 37.45454545454545,
"alnum_prop": 0.7742718446601942,
"repo_name": "Cloud-Elasticity-Services/as-libcloud",
"id": "2fb70b4e83fcaed56adec796e44d1a055d09a... |
import base64
import hmac
import hashlib
import urllib, urllib2
import logging
import time
from datetime import datetime, tzinfo
try:
import xml.etree.ElementTree as ET
except ImportError:
import elementtree.ElementTree as ET
_log = logging.getLogger("fpys")
def _attr_name_from_tag(tag_name):
# some tag ... | {
"content_hash": "914f20dc7224cfd973381da52f6a0dd9",
"timestamp": "",
"source": "github",
"line_count": 282,
"max_line_length": 135,
"avg_line_length": 40.1063829787234,
"alnum_prop": 0.5562334217506631,
"repo_name": "wadey/fpys2",
"id": "ef697d956676fbc3b8a4c0fa100073f035f2843e",
"size": "11310",
... |
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName(_fromUtf8("Form"))
Form.resize(337, 589)
self.verticalLayout_2 = QtGui.QVBoxLayout(Form)
... | {
"content_hash": "03c63323783cf524514943c1984bb7cf",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 206,
"avg_line_length": 65.29629629629629,
"alnum_prop": 0.7161656267725468,
"repo_name": "liveegor/cluster",
"id": "f682a400fb4d074b926275852f659e5b1ef51047",
"size": "92... |
import mock
from oslo.config import cfg
from neutron.agent.common import config as agent_config
from neutron.agent import l3_agent
from neutron.agent import l3_ha_agent
from neutron.agent.linux import interface
from neutron.common import config as base_config
from neutron.openstack.common import uuidutils
from neutron... | {
"content_hash": "5537b03e26f18aebf498587689f6ab1b",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 78,
"avg_line_length": 36.58659217877095,
"alnum_prop": 0.6066575049625897,
"repo_name": "citrix-openstack-build/neutron-vpnaas",
"id": "441ecdd5644779e6e126918df7e4b35c3de8... |
from sqlalchemy import ForeignKey
from sqlalchemy.schema import Column
from sqlalchemy.schema import MetaData
from sqlalchemy.schema import UniqueConstraint
from trove.db.sqlalchemy.migrate_repo.schema import Boolean
from trove.db.sqlalchemy.migrate_repo.schema import create_tables
from trove.db.sqlalchemy.migrate_rep... | {
"content_hash": "92c4fe230eb624bc597a4b0ddcb9c8c6",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 76,
"avg_line_length": 36.325,
"alnum_prop": 0.7260839642119752,
"repo_name": "openstack/trove",
"id": "e98674a2ebf77021185267a99f1d9f809d9ad3ec",
"size": "2078",
"binary... |
from io import StringIO
from textwrap import dedent
import pytest
from jedi._compatibility import u, is_py3
from jedi.parser.token import NAME, OP, NEWLINE, STRING, INDENT
from jedi.parser import ParserWithRecovery, load_grammar, tokenize
from ..helpers import unittest
class TokenTest(unittest.TestCase):
def ... | {
"content_hash": "2634a8ceb07830ec77081aba3c96613b",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 79,
"avg_line_length": 34.3,
"alnum_prop": 0.5615160349854227,
"repo_name": "NcLang/vimrc",
"id": "e53f85a6446ff4f77075d8fad9977f801ba202ae",
"size": "5215",
"binary": f... |
from beritest_tools import BaseBERITestCase
from nose.plugins.attrib import attr
class test_raw_fpu_trunc_l_d64(BaseBERITestCase):
@attr('float64')
def test_raw_fpu_trunc_l_d64_1(self):
'''Test double precision trunc.l of -0.75'''
self.assertRegisterEqual(self.MIPS.a0 , 0, "-0.75 did not round up to ... | {
"content_hash": "9c396e552ffb98329f3fdc9ab69dd9f4",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 146,
"avg_line_length": 37.638888888888886,
"alnum_prop": 0.6627306273062731,
"repo_name": "8l/beri",
"id": "e8db1e46ff2151118b83214316f3f80d6d5c92a3",
"size": "2571",
"b... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
from bs4 import BeautifulSoup
from flexget import plugin
from flexget.event import event
from flexget.utils import requests
log = logging.getLogger('nnm-club')... | {
"content_hash": "3a94e4df40d2906565fb1cd3569c3512",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 85,
"avg_line_length": 30.547619047619047,
"alnum_prop": 0.6352299298519096,
"repo_name": "qvazzler/Flexget",
"id": "8f8d2ae4915318c027e59426c27cde42a758656d",
"size": "128... |
import math
from native_tags.decorators import function, filter, comparison
def func_factory(method):
try:
func = getattr(math, method)
except AttributeError:
return
def inner(arg1, arg2=None):
try:
return func(arg1, arg2)
except TypeError:
return fu... | {
"content_hash": "1d25cc5938a74dfdbf66fe1c7cc41f08",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 63,
"avg_line_length": 27.322033898305083,
"alnum_prop": 0.6550868486352357,
"repo_name": "justquick/django-native-tags",
"id": "19920195872980418fd4557cc564d6ef1c8e85d4",
... |
import argparse
from configparser import ConfigParser
import logging
import logging.handlers
import os
import socket
import sys
import time
from keystoneauth1 import loading
from keystoneauth1 import session
from novaclient import client
config = ConfigParser(strict=False)
debug = os.getenv('__OS_DEBUG', 'false')... | {
"content_hash": "69dba178dd0f5bd6f5aa22dd0eb4f11a",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 75,
"avg_line_length": 32.66990291262136,
"alnum_prop": 0.5839524517087668,
"repo_name": "openstack/tripleo-heat-templates",
"id": "61e0d618a2a6cfaefdcca1ebfaae0d3a8d5e0e4e"... |
from re import sub
from vyapp.plugins import ENV
from vyapp.areavi import AreaVi
from re import escape
def strip(chars=' '):
"""
Strip chars off the beginning of all selected lines.
if chars is not given it removes spaces.
"""
AreaVi.ACTIVE.replace_ranges('sel',
'^[%s]+' % escape(chars), '')... | {
"content_hash": "123db15299cc8ec865044ef68e9746fc",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 56,
"avg_line_length": 20.964285714285715,
"alnum_prop": 0.6303236797274276,
"repo_name": "iogf/vy",
"id": "14e8ac469a07ba3625fc90284f9c73d125d3d5a3",
"size": "587",
"bin... |
from time import perf_counter as clock
import numpy as np
import tables as tb
N = 144_000
#N = 144
def timed(func, *args, **kwargs):
start = clock()
res = func(*args, **kwargs)
print(f"{clock() - start:.3f}s elapsed.")
return res
def create_table(output_path):
print("creating array...", end=' ... | {
"content_hash": "443f3e71004ea13136262c51997f60c7",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 75,
"avg_line_length": 30.53913043478261,
"alnum_prop": 0.6101936218678815,
"repo_name": "PyTables/PyTables",
"id": "af629114857538de860f3c4e58105ea29ada5ca7",
"size": "35... |
"""
Created on Thu Mar 09 18:07:03 2017
@author: scram
"""
from gensim import corpora, models, similarities
import gensim
import json
import os
import pickle
from pymongo import MongoClient
import unicodedata as uniD
import sys
import nltk
import networkx as nx
import numpy as np
import itertools as it
import pprint
... | {
"content_hash": "e644f53f025ecfb035cbe6a4a1163aa4",
"timestamp": "",
"source": "github",
"line_count": 560,
"max_line_length": 162,
"avg_line_length": 38.45,
"alnum_prop": 0.5499721344974922,
"repo_name": "scramblingbalam/Alta_Real",
"id": "add2c43359be2b82c3e4c55b0b8cc5be205470b5",
"size": "21556... |
"""
Unit tests for django-registration.
These tests assume that you've completed all the prerequisites for
getting django-registration running in the default setup, to wit:
1. You have ``registration`` in your ``INSTALLED_APPS`` setting.
2. You have created all of the templates mentioned in this
application's doc... | {
"content_hash": "912964246cef1c98157704def892ab01",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 152,
"avg_line_length": 41.99686520376176,
"alnum_prop": 0.5617675599014704,
"repo_name": "jmptrader/dirigible-spreadsheet",
"id": "d3d083032c0d8b0d906993997c2b38dcabc4e6cf"... |
from JumpScale import j
import ujson
class AUTH():
def load(self,osis):
pass
def authenticate(self,osis,method,user,passwd):
if j.core.osis.cmds._authenticateAdmin(user=user,passwd=passwd):
return True
if user=="node" and method in ["set","get"]:
if j.c... | {
"content_hash": "69ce00b4c2f13e5b73581e3765a240e0",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 72,
"avg_line_length": 27,
"alnum_prop": 0.5925925925925926,
"repo_name": "Jumpscale/jumpscale6_core",
"id": "408914113a3fdeb8df2690d71e8dfc769d4ece98",
"size": "405",
"b... |
from ..interface import GreatFETInterface
class LED(GreatFETInterface):
""" Simple periheral that allows control of an LED through the GreatFET HAL."""
def __init__(self, board, led_number):
"""Create a new object representing a GreatFET LED.
board -- The GreatFET board object that owns the ... | {
"content_hash": "fef4c2143ac226dd77ee9950552cbbcd",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 83,
"avg_line_length": 32.333333333333336,
"alnum_prop": 0.6410496719775071,
"repo_name": "dominicgs/GreatFET-experimental",
"id": "a4448e5fbe8556d874400a8a2b0c5fc347e49fd8",... |
__author__ = 'frank'
from flask.ext.wtf import Form
from wtforms import StringField, SubmitField, TextField, PasswordField, SelectField, TextAreaField, BooleanField, ValidationError
from wtforms.validators import DataRequired, Length, EqualTo, Email
from models import Work, User
class RegisterForm(Form):
email... | {
"content_hash": "cc24cc553f3c4cdc21cf9816213dc368",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 129,
"avg_line_length": 34.602409638554214,
"alnum_prop": 0.6702646239554317,
"repo_name": "Fansion/sharefun",
"id": "7123a5825ad27d3409d60fc33965a464a03c4340",
"size": "35... |
from __future__ import absolute_import
import logging
from ..conf import settings
logger = logging.getLogger(__name__)
class TelegramBot:
def __init__(self, chat_id=None, split_on=None):
from telegram.bot import Bot
telegram_creds = settings().creds['telegram']
token = telegram_creds['t... | {
"content_hash": "7edddc57937acd78597f03ab568b4596",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 70,
"avg_line_length": 26.08695652173913,
"alnum_prop": 0.5538888888888889,
"repo_name": "kibitzr/kibitzr",
"id": "49f8edb0a10ebe9cde21346017ad66134b0fbb5f",
"size": "1800"... |
from __future__ import absolute_import
import json
import logging
from pipes import quote as pquote
import requests
LOG = logging.getLogger(__name__)
def add_ssl_verify_to_kwargs(func):
def decorate(*args, **kwargs):
if isinstance(args[0], HTTPClient) and 'https' in getattr(args[0], 'root', ''):
... | {
"content_hash": "61bfb62411b07b77d1b39aa99a717f48",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 87,
"avg_line_length": 31.12751677852349,
"alnum_prop": 0.5851660198361363,
"repo_name": "pixelrebel/st2",
"id": "877ed173c4a8193315129f36a29dc7cad3a1ef19",
"size": "5418"... |
from requests.auth import HTTPBasicAuth
def apply_updates(doc, update_dict):
# updates the doc with items from the dict
# returns whether or not any updates were made
should_save = False
for key, value in update_dict.items():
if getattr(doc, key, None) != value:
setattr(doc, key, v... | {
"content_hash": "b4198ba3c2e7c535db474507cd15ee68",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 64,
"avg_line_length": 28.64,
"alnum_prop": 0.6620111731843575,
"repo_name": "qedsoftware/commcare-hq",
"id": "96e734dc92c9bfe30c09882b5278257f306984ef",
"size": "716",
"... |
import datetime
import functools
import hashlib
import importlib
import os
import os.path
import socket
import struct
import tempfile
import eventlet
import mock
import netaddr
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_context import context as common_context
from oslo_context imp... | {
"content_hash": "94a03854d70fde9ebe856daa5005ab54",
"timestamp": "",
"source": "github",
"line_count": 1134,
"max_line_length": 79,
"avg_line_length": 39.63139329805996,
"alnum_prop": 0.5460816163054604,
"repo_name": "JioCloud/nova_test_latest",
"id": "48c19b10b51d83f3bfc170035d519d40125034b4",
"s... |
import sublime, sublime_plugin
import os
from .. import util
from ..popup_manager import popup_manager
from ..global_vars import *
class FolderExplorer:
view = None
start_path = ""
current_path = ""
selected_dir = ""
selected_file = ""
callback_choose = None
only_dir = False
only_file = False
closed... | {
"content_hash": "bd19560877d1c4fddfe7c2c619e4baaa",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 188,
"avg_line_length": 34.57142857142857,
"alnum_prop": 0.6061665607120152,
"repo_name": "pichillilorenzo/JavaScriptEnhancements",
"id": "f96d5520d7e0515f7899083ee1a868d415... |
import pathlib
import sys
from typing import Callable, List, Optional
import math
import subprocess
import tempfile
import networkx as nx
import numpy as np
import pymatching
import stim
def sample_decode_count_correct(*,
circuit: stim.Circuit,
model_ci... | {
"content_hash": "a9c478d6a24aabf29b385ac3b39fc5f6",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 125,
"avg_line_length": 42.17689530685921,
"alnum_prop": 0.5692887100915861,
"repo_name": "Strilanc/honeycomb_threshold",
"id": "e80611fe4b9070b9b31bc557b12743297f4a2c37",
... |
try:
from IBMQuantumExperience import IBMQuantumExperience
from pprint import pprint
def quant_exp(args):
with open('etc/IBMtoken', 'r') as infile:
token = infile.read().replace('\n', '')
config = {
"url": 'https://quantumexperience.ng.bluemix.net/api'
}
... | {
"content_hash": "d704bf7057a6e62951ff25a354c894d4",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 64,
"avg_line_length": 28.15625,
"alnum_prop": 0.5382907880133185,
"repo_name": "LSaldyt/qnp",
"id": "6c3ba9615682f7369e5e7bd840e8feea5b0470f4",
"size": "901",
"binary": ... |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("RandomForestRegressor" , "freidman3" , "db2")
| {
"content_hash": "fbc2413219fbeef9d9d8492d41c3db30",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 66,
"avg_line_length": 33.75,
"alnum_prop": 0.7777777777777778,
"repo_name": "antoinecarme/sklearn2sql_heroku",
"id": "e771da7831681b88e9f867e0be87dbdda081c314",
"size": "13... |
from datetime import datetime
import dateutil.tz
import pytest
import pytz
from pandas._libs.tslibs import conversion, timezones
from pandas import Timestamp
@pytest.mark.parametrize("tz_name", list(pytz.common_timezones))
def test_cache_keys_are_distinct_for_pytz_vs_dateutil(tz_name):
if tz_name == "UTC":
... | {
"content_hash": "73d49c8a1be9c5ba52e2f6ecbf24565e",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 77,
"avg_line_length": 29.75,
"alnum_prop": 0.6752941176470588,
"repo_name": "MJuddBooth/pandas",
"id": "0255865dbdf71846f43ff818cb8753ebc69d67fc",
"size": "2999",
"bina... |
import numpy as np
import sys
sys.path.append('../')
from interpolate import get_gradient, _bin_and_index
three_colors = ['#ffffff', '#000000', '#ff0000']
two_colors = ['#ffffff', '#000000']
equal = np.testing.assert_array_equal
close_enough = np.testing.assert_allclose
def test_bin_lower():
value = 0.3
s... | {
"content_hash": "36b909d57d25185b008956a94a25864a",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 72,
"avg_line_length": 27.057971014492754,
"alnum_prop": 0.6164970540974826,
"repo_name": "ceos-seo/data_cube_utilities",
"id": "a72dc32086a6f16aebacb1def745198d090ee3e1",
... |
import logging
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--temp")
parser.add_argument("--current")
def main():
FORMAT = '%(asctime)s %(levelname)s:%(message)s'
logging.basicConfig(filename='launcher.log', level=logging.INFO, filemode='w', format=FORMAT)
logging.info("Started... | {
"content_hash": "21f526fe9ee2984cd6abb8527bd00830",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 97,
"avg_line_length": 33.61818181818182,
"alnum_prop": 0.5705786911844241,
"repo_name": "Spring-Chobby/ChobbyLauncher",
"id": "bb040b3ddf1898a9f27a9c81974ac1c54ae518e7",
"... |
from __future__ import unicode_literals
import sys
if sys.version_info[0] > 2:
unicode = str
from xml.dom import XHTML_NAMESPACE
from xml.dom.minidom import getDOMImplementation
def create_testdoc(_title, _content, _data_count, _data_text):
dom_impl = getDOMImplementation()
html_doctype = dom_impl.create... | {
"content_hash": "9ec6fa277e2435b9622d99a79f60e33c",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 77,
"avg_line_length": 35.5,
"alnum_prop": 0.671180931744312,
"repo_name": "IvIePhisto/ECoXiPy",
"id": "5d45a07bba614d23c4352697b2b50804f46de19d",
"size": "1846",
"binary... |
"""
Regular-expression matching by the Thompson construction.
Explained in C at http://swtch.com/~rsc/regexp/regexp1.html
"""
def match(re, s): return run(prepare(re), s)
def run(states, s):
for c in s:
states = set.union(*[state(c) for state in states])
return accepting_state in states
def accepting... | {
"content_hash": "5a2f636c08aa181c0fd47d90b5eeded8",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 106,
"avg_line_length": 25.434782608695652,
"alnum_prop": 0.5935897435897436,
"repo_name": "JaDogg/__py_playground",
"id": "0ad84480066551c05983fddc3634acb33cd54a9a",
"size... |
from geoportailv3_geoportal.models import LuxPredefinedWms
from functools import partial
from pyramid.view import view_defaults
from pyramid.view import view_config
from c2cgeoform.schema import GeoFormSchemaNode
from c2cgeoform.views.abstract_views import AbstractViews
from c2cgeoform.views.abstract_views import List... | {
"content_hash": "d17a2b5494fee8ecd6408b9ab521fef6",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 80,
"avg_line_length": 30.363636363636363,
"alnum_prop": 0.6412175648702595,
"repo_name": "Geoportail-Luxembourg/geoportailv3",
"id": "e16e3f41bf5232fff46229b3116a25433e6536f... |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="color", parent_name="barpolar.unselected.textfont", **kwargs
):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent_... | {
"content_hash": "9ac2ac8714e34d8e348355a998f92600",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 87,
"avg_line_length": 32.76923076923077,
"alnum_prop": 0.6103286384976526,
"repo_name": "plotly/plotly.py",
"id": "2bd20d6506b808b18957e324f3d0c0a736d68ff9",
"size": "426"... |
from collections import defaultdict
from .ahdl import AHDL_STM
class AHDLVisitor(object):
def __init__(self):
self.current_fsm = None
self.current_stg = None
self.current_state = None
def process(self, hdlmodule):
for fsm in hdlmodule.fsms.values():
self.process_fs... | {
"content_hash": "4ce4a8952d435e90262166af0281aa42",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 66,
"avg_line_length": 25.894977168949772,
"alnum_prop": 0.5595133133486158,
"repo_name": "ktok07b6/polyphony",
"id": "b9b14b6690eb2d2c362a027d97935f278336715f",
"size": "... |
import kivy
from kivy.app import App
from kivy.lang import Builder
from kivy.utils import platform
from kivy.uix.widget import Widget
from kivy.clock import Clock
from jnius import autoclass
from android.runnable import run_on_ui_thread
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kiv... | {
"content_hash": "f5ab629c9b8238339796354dee604346",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 82,
"avg_line_length": 24.58730158730159,
"alnum_prop": 0.6701097482246611,
"repo_name": "gugabfigueiredo/p4a-social",
"id": "534e9f66ff095a50eb268c4ab072ab4d0a63bd8b",
"si... |
"""Qubole operator"""
import re
from datetime import datetime
from typing import Iterable, Optional
from airflow.hooks.base import BaseHook
from airflow.models import BaseOperator, BaseOperatorLink
from airflow.models.taskinstance import TaskInstance
from airflow.providers.qubole.hooks.qubole import (
COMMAND_ARGS... | {
"content_hash": "33060614725b7876b68e44101b55564d",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 108,
"avg_line_length": 42.822641509433964,
"alnum_prop": 0.612354599929503,
"repo_name": "DinoCow/airflow",
"id": "8725dd0fb53ab60e6800f6eaba239c9189c4b080",
"size": "121... |
import subprocess
from backends import Backend
class KdeBackend(Backend):
def lock_screen(self):
subprocess.Popen(['qdbus', 'org.freedesktop.ScreenSaver', '/ScreenSaver', 'Lock']) | {
"content_hash": "b3d202951ba51f6032b1e1122ccf7ed6",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 90,
"avg_line_length": 27.571428571428573,
"alnum_prop": 0.7253886010362695,
"repo_name": "pedrospdc/kde-leapmotion-control",
"id": "951a0c7c2b271d78dc0a8f66555de7b21167d508",... |
import bn, conv, dense, fft, init, norm, pool
from .bn import ComplexBatchNormalization as ComplexBN
from .conv import (ComplexConv,
ComplexConv1D,
ComplexConv2D,
ComplexConv3D,
WeightNorm_Conv)
from .dense import Complex... | {
"content_hash": "bae185540ab666ec4bd9fb417f297381",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 71,
"avg_line_length": 46.5,
"alnum_prop": 0.6411290322580645,
"repo_name": "ChihebTrabelsi/deep_complex_networks",
"id": "bf2e7cb40c1538125add2094847509393dc35d72",
"size"... |
import itertools
import platform
import subprocess
import sys
import math
import pickle
def normalize(x):
denom = sum(x)
return [e/denom for e in x]
def scale(x, a):
return [e * a for e in x]
def argcmp(x, comp, predicate):
idx = None
val = None
for i in xrange(len(x)):
if not predicate(x[i]):
... | {
"content_hash": "2d79a8b8b8a1eab4970fc95ca75568c2",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 110,
"avg_line_length": 24.84259259259259,
"alnum_prop": 0.5825568393589265,
"repo_name": "nathanielherman/silo",
"id": "f632fa0edc73001d9a6911b46425d890d7c81c34",
"size":... |
import ConfigParser
import argparse
import fnmatch
import logging
import json
import os
import sys
import time
import unittest
from collections import OrderedDict
from autothreadharness.harness_case import HarnessCase
from autothreadharness.open_thread_controller import OpenThreadController
from autothreadharness impo... | {
"content_hash": "fb8ec968632f705a5999384a9d7db7a6",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 119,
"avg_line_length": 35.92537313432836,
"alnum_prop": 0.5459077690070627,
"repo_name": "chshu/openthread",
"id": "a6010253d8e4c5813928d22a0a46451d19c669ee",
"size": "16... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "openinghours.tests.test_settings")
from django.core.management import execute_from_command_line
args = sys.argv + ["makemigrations", "openinghours"]
execute_from_command_line(args)
| {
"content_hash": "2d42df8699da43ba1f163ae9e8ff60b3",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 87,
"avg_line_length": 36.875,
"alnum_prop": 0.711864406779661,
"repo_name": "arteria/django-openinghours",
"id": "8ed03b7bda0939ac3a90c9633d84881124a7bbe9",
"size": "295",
... |
from datetime import (
datetime,
timedelta,
)
import numpy as np
import pytest
import pandas._testing as tm
from pandas.core.indexes.api import (
Index,
RangeIndex,
)
@pytest.fixture
def index_large():
# large values used in TestUInt64Index where no compat needed with int64/float64
large = [... | {
"content_hash": "a23f55d6b7d9ea4d4abd37ec142e238a",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 86,
"avg_line_length": 34.789808917197455,
"alnum_prop": 0.6036250457707799,
"repo_name": "pandas-dev/pandas",
"id": "3e3de14960f4ea3cb3f7652e6d9fb9c8a2b6fd3e",
"size": "5... |
from __future__ import unicode_literals
import collections
import copy
import datetime
import decimal
import math
import uuid
import warnings
from base64 import b64decode, b64encode
from functools import total_ordering
from django import forms
from django.apps import apps
from django.conf import settings
from django.... | {
"content_hash": "6ca908ec7691ef9a7a6b9e486cf99bf3",
"timestamp": "",
"source": "github",
"line_count": 2446,
"max_line_length": 101,
"avg_line_length": 36.782910874897794,
"alnum_prop": 0.5733402985406408,
"repo_name": "dgladkov/django",
"id": "6f8ca8980f91bb5f8464ae2d376235ac4371b949",
"size": "8... |
"""Support for mounting images with the loop device"""
from nova.openstack.common import log as logging
from nova import utils
from nova.virt.disk.mount import api
LOG = logging.getLogger(__name__)
class LoopMount(api.Mount):
"""loop back support for raw images."""
mode = 'loop'
def _inner_get_dev(self... | {
"content_hash": "d8bf133eb6f2aeb39ce5bf3826051e0c",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 78,
"avg_line_length": 35.02127659574468,
"alnum_prop": 0.5911300121506683,
"repo_name": "fajoy/nova",
"id": "667ecee1432750a2790db82bfef7a7886a6a7dda",
"size": "2264",
"... |
import numpy as np
from scipy import linalg
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from nose.tools import assert_true
from mne.time_frequency.stft import stft, istft, stftfreq, stft_norm2
def test_stft():
"Test stft and istft tight frame property"
sfreq = 1000. # Hz
f =... | {
"content_hash": "d32f8674c48fcf13495d718ae278fcf4",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 72,
"avg_line_length": 31.8,
"alnum_prop": 0.5715408805031447,
"repo_name": "jaeilepp/eggie",
"id": "e7eca49980df06453573ba15266ec29ed42a8713",
"size": "1272",
"binary": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.