text stringlengths 4 1.02M | meta dict |
|---|---|
import sqlalchemy.types as types
from nailgun.openstack.common import jsonutils
class JSON(types.TypeDecorator):
impl = types.Text
def process_bind_param(self, value, dialect):
if value is not None:
value = jsonutils.dumps(value)
return value
def process_result_value(self, ... | {
"content_hash": "119142b3e9f38310cba314963d96041e",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 51,
"avg_line_length": 22.571428571428573,
"alnum_prop": 0.6487341772151899,
"repo_name": "Axam/nsx-web",
"id": "38b4d6f653c97defe550599eaa2e921f46495ba0",
"size": "1267",
... |
import collections
from oslo_log import log as logging
import six
from heat.common import exception
from heat.common.i18n import _
from heat.engine.resources import signal_responder
LOG = logging.getLogger(__name__)
class BaseWaitConditionHandle(signal_responder.SignalResponder):
"""Base WaitConditionHandle re... | {
"content_hash": "8b397c582dccdc9f9354174ead8c5f16",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 79,
"avg_line_length": 35.64485981308411,
"alnum_prop": 0.6132669113791295,
"repo_name": "noironetworks/heat",
"id": "87d797237bc188453e702a2cbe16f75732dd070e",
"size": "4... |
import logging
from uuid import uuid4
from flask import render_template
from tempfile import NamedTemporaryFile
from pantomime.types import HTML
from aleph import settings
from aleph.core import archive
from aleph.index.entities import entities_by_ids
log = logging.getLogger(__name__)
FIELDS = ["id", "schema", "prope... | {
"content_hash": "dc4b5ad81fb2252ab8e3c52cd17e00c4",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 71,
"avg_line_length": 29.02173913043478,
"alnum_prop": 0.6322097378277154,
"repo_name": "pudo/aleph",
"id": "e65c38cdf7b9e5982bcfb04fe3eaf9d4ad76cee5",
"size": "1335",
"... |
"""
Author : Mingbin Xu (mingbin.xu@gmail.com)
Filename : kbp-system.py
Last Update : Jul 26, 2016
Description : N/A
Website : https://wiki.eecs.yorku.ca/lab/MLL/
Copyright (c) 2016 iNCML (author: Mingbin Xu)
License: MIT License (see ../LICENSE)
"""
import argparse, logging, time
from itertools import pr... | {
"content_hash": "6292948cd5f0d5ce6471e74df26ca3c8",
"timestamp": "",
"source": "github",
"line_count": 501,
"max_line_length": 122,
"avg_line_length": 48.650698602794414,
"alnum_prop": 0.4343562812833347,
"repo_name": "nanalelfe/fofe-ner",
"id": "0b44250bfa0a10cbe8ed51b984776f56d06efd07",
"size": ... |
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.... | {
"content_hash": "8dce31eb255026835df46c9364da083f",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 177,
"avg_line_length": 51.25974025974026,
"alnum_prop": 0.6602482898403851,
"repo_name": "edespino/gpdb",
"id": "ec281351ddcf2b2ebf9fb4362ec65cf8d1a65786",
"size": "7894"... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('venta', '0008_auto_20160205_2313'),
]
operations = [
migrations.CreateModel(
name='Image',
... | {
"content_hash": "f0a19c9bbb06e71339aae572407be1fc",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 114,
"avg_line_length": 27.681818181818183,
"alnum_prop": 0.5796387520525451,
"repo_name": "vpadillar/pventa",
"id": "e46c0a546e06f2925d082b39ce4b4e19fd93804c",
"size": "68... |
from collections import defaultdict
from urlparse import urlparse, urlunparse
from socket import gethostbyname
from textwrap import dedent
from time import time
import requests
from progressbar import ProgressBar
from gevent import Timeout, sleep as g_sleep
from gevent.pool import Pool
from surcharge import logger
... | {
"content_hash": "87569a647eeabe9621ef55e02a880d95",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 103,
"avg_line_length": 31.41176470588235,
"alnum_prop": 0.5483770287141073,
"repo_name": "Lujeni/Surcharge",
"id": "3a071d828f91fdd421803baf98af7f4e5df94e89",
"size": "64... |
import logging
from datetime import timedelta
from pajbot.managers.handler import HandlerManager
from pajbot.modules.base import BaseModule
from pajbot.modules.base import ModuleSetting
log = logging.getLogger(__name__)
class AsciiProtectionModule(BaseModule):
ID = __name__.split(".")[-1]
NAME = "ASCII Pr... | {
"content_hash": "040ba1d15ed22b790a2bae2f107eec17",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 120,
"avg_line_length": 34.9020979020979,
"alnum_prop": 0.5682228010418754,
"repo_name": "pajlada/pajbot",
"id": "eac67985be408c0891e5a8e1f03240cba216345a",
"size": "4991"... |
from django.core.urlresolvers import resolve
from django.test import TestCase
from django.http import HttpRequest
from django.template.loader import render_to_string
from django.utils import timezone
from weight.views import editorWeight
from weight.models import Weight
class EditorWeightTest(TestCase):
def tes... | {
"content_hash": "dde34f15b1cdc25276af7d3ec2ab9c61",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 66,
"avg_line_length": 28.76271186440678,
"alnum_prop": 0.6540954625810254,
"repo_name": "williamHuang5468/WeightController",
"id": "8baa85b9e03ac5c53ebc26c6ca72de35977dbed3"... |
from __future__ import absolute_import, division, print_function
import binascii
import itertools
import math
import os
import pytest
from cryptography.exceptions import (
AlreadyFinalized, InvalidSignature, _Reasons
)
from cryptography.hazmat.backends.interfaces import (
PEMSerializationBacke... | {
"content_hash": "4e521aa24e8b8c2c80d56b1039bfd651",
"timestamp": "",
"source": "github",
"line_count": 2314,
"max_line_length": 79,
"avg_line_length": 35.620138288677616,
"alnum_prop": 0.5395329087048832,
"repo_name": "hipnusleo/laserjet",
"id": "ee9353209b99d78c8ea7b9bdd6807e6847e36c76",
"size": ... |
import json
import os
from shutil import copytree
from subprocess import CalledProcessError, check_call, check_output
import pytest
import pkgpanda.build
import pkgpanda.build.cli
from pkgpanda.util import expect_fs, is_windows
def get_tar_contents(filename):
return set(check_output(["tar", "-tf", filename]).de... | {
"content_hash": "ca5526c3a6db3982f80f54735abc9185",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 116,
"avg_line_length": 41.00471698113208,
"alnum_prop": 0.6308524099850454,
"repo_name": "surdy/dcos",
"id": "8f676b4ad43b0399885539d0f03443d7050a064c",
"size": "8693",
... |
from .affine import Affine
from ... import describe
from ...describe import Dimension, Synapses, Biases
from ... import check
from ...describe import Dimension, Synapses, Biases
from ...check import has_shape
class ELU(Affine):
def predict(self, input__bi):
output__bo = Affine.predict(self, input__bi)
... | {
"content_hash": "8b71cc1b6e1cbe1c3b2f5bb948b7b44b",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 83,
"avg_line_length": 40.69230769230769,
"alnum_prop": 0.6597353497164461,
"repo_name": "ryfeus/lambda-packs",
"id": "245d829dbe9bde091d0e71d11421beb5f36433e7",
"size": "1... |
import pymongo
import pandas as pd
from math import log
from time import time
import sys
from scipy.stats import linregress
import pickle
client = pymongo.MongoClient()
db = client['bitmicro']
def get_book_df(symbol, limit, convert_timestamps=False):
'''
Returns a DataFrame of book data
'''
books_db ... | {
"content_hash": "b9ac4313136925cb3531a0f053b9e439",
"timestamp": "",
"source": "github",
"line_count": 259,
"max_line_length": 80,
"avg_line_length": 32.52123552123552,
"alnum_prop": 0.6009735248723732,
"repo_name": "cbyn/bitmicro",
"id": "1e53cb2b5237abc737a3d95fe3d56d9bcbbb4a4f",
"size": "8423",... |
class DataClassFile():
def functionName1(self, parameter1):
""" One Function (takes a parameter) with three test functions
(with single line comments) where outdated documentation
exists.
************************************************************
####UnitTest Spec... | {
"content_hash": "f91af2c9a12c462003c84eb7a79e3cce",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 71,
"avg_line_length": 36.904761904761905,
"alnum_prop": 0.45806451612903226,
"repo_name": "anconaesselmann/ClassesAndTests",
"id": "8f9c9273dabded8548ecc535debf41dc069301bf"... |
import webob
from webob import exc
from cinder.api.openstack import extensions
from cinder.api.openstack import wsgi
from cinder import db
from cinder import exception
from cinder import volume
from cinder.openstack.common import log as logging
LOG = logging.getLogger(__name__)
class AdminController(wsgi.Controlle... | {
"content_hash": "6fce1eb5ba724588e79f1a04b71af53a",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 79,
"avg_line_length": 33.16783216783217,
"alnum_prop": 0.6251317731393633,
"repo_name": "rnirmal/cinder",
"id": "8aa6863c0350d8315631b0acc11a6bb9913a1372",
"size": "5343"... |
from __future__ import absolute_import
from __future__ import print_function
from pyface.qt.QtCore import QTimer
from pyface.qt.QtGui import QLabel, QImage, QPixmap, QSizePolicy
from traits.api import Int, Instance
# ============= standard library imports ========================
# ============= local library imports ... | {
"content_hash": "83628611e7f0bcced894f6f90cb9a039",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 71,
"avg_line_length": 32.30882352941177,
"alnum_prop": 0.5539371870732818,
"repo_name": "NMGRL/pychron",
"id": "511ee1a9d8ae2591e660caebf47721b95ea8a826",
"size": "2997",
... |
from django import template
from ..models import Story, StoryCategory
register = template.Library()
@register.assignment_tag
def get_story_categories():
return StoryCategory.objects.all()
@register.assignment_tag
def get_stories_featured():
return Story.objects.featured()
@register.assignment_tag
def g... | {
"content_hash": "eecc62fa49445964cdc3c5247b82857b",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 88,
"avg_line_length": 21.615384615384617,
"alnum_prop": 0.7597864768683275,
"repo_name": "lepture/pythondotorg",
"id": "4b0310e5dd10eedc1b25f9b6a5408de2d61f03aa",
"size": ... |
import newrelic.agent
import os.path
newrelic.agent.initialize(os.path.join(os.path.dirname(__file__), 'config', 'newrelic.ini'))
import pymongo.errors
from flask.ext import cors
from flask.ext.pymongo import PyMongo
from flask import Flask, g, render_template, request, flash, abort
import mail
from config import c... | {
"content_hash": "59a8a62974de062884143900c9c00937",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 92,
"avg_line_length": 27.301724137931036,
"alnum_prop": 0.5822544995263657,
"repo_name": "angstwad/linky",
"id": "02f2d3fe765426c0db931e7f005271120b106c31",
"size": "3845... |
from genMixins import subjectMixin, updateCallsExecuteModuleMixin
class transformStackClass(list,
subjectMixin,
updateCallsExecuteModuleMixin):
def __init__(self, d3Module):
# call base ctors
subjectMixin.__init__(self)
updateCallsExe... | {
"content_hash": "1f60b3aaec8da1cd30ecdbb27ec1dbb1",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 65,
"avg_line_length": 31.133333333333333,
"alnum_prop": 0.6359743040685225,
"repo_name": "nagyistoce/devide",
"id": "0b62e3a1aa3b7aed503684509b8623eba5d84fe5",
"size": "47... |
import random
import unittest
from exporters.groupers.base_grouper import BaseGrouper
from exporters.groupers.file_key_grouper import FileKeyGrouper
from exporters.groupers.python_exp_grouper import PythonExpGrouper
from exporters.records.base_record import BaseRecord
country_codes = ['es', 'uk', 'us']
states = ['vale... | {
"content_hash": "f516b992b3922380dcee6423104ba582",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 88,
"avg_line_length": 33.90555555555556,
"alnum_prop": 0.513845649680485,
"repo_name": "scrapinghub/exporters",
"id": "c530c6809a3e8d8fb658c25b75772d8ec96beac1",
"size": ... |
from django import forms
from django.conf import settings
from django.conf.urls.defaults import patterns, url
from django.contrib import admin
from django.contrib import messages
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.contrib.auth.models import User, Group
from django.core.urlresolv... | {
"content_hash": "694eddbd2597f400383bd0d8e2c39cb6",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 86,
"avg_line_length": 38.58806818181818,
"alnum_prop": 0.6160641978944269,
"repo_name": "boardman/django-guardian",
"id": "d0f54e6e67a5d4f647801f586ac195c48d03db47",
"siz... |
import sklearn.metrics
import sklearn.svm
from autosklearn.pipeline.components.classification.libsvm_svc import LibSVM_SVC
from autosklearn.pipeline.util import _test_classifier_predict_proba, get_dataset
from .test_base import BaseClassificationComponentTest
class LibSVM_SVCComponentTest(BaseClassificationComponen... | {
"content_hash": "10d848243dbb5568cb092836e07f29a3",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 82,
"avg_line_length": 36.50666666666667,
"alnum_prop": 0.589481373265157,
"repo_name": "automl/auto-sklearn",
"id": "6fe95f5b62930042543ef85eb8b0f387d5e1a2e8",
"size": "27... |
from distutils.core import Extension, setup
mikktspace = Extension(
'_mikktspace',
sources=['mikktpy.i', 'mikktpy.cpp', 'mikktspace.c'],
swig_opts=['-modern', '-c++'],
extra_compile_args=['/EHsc'])
setup (name = 'MikkTSpace',
version = '1.0',
description = 'This is a demo package',
... | {
"content_hash": "d8834509c35a2a7de38ecf6486825b81",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 55,
"avg_line_length": 27.46153846153846,
"alnum_prop": 0.5994397759103641,
"repo_name": "ambrusc/mikktpy",
"id": "07e4c766f5d9ea578af83c03688c071538b35ad8",
"size": "400",... |
from django.test import TestCase
from .. forms import (
BinaryQuestionForm,
LikertQuestionForm,
MultipleChoiceQuestionForm,
OpenEndedQuestionForm,
)
class TestBinaryQuestionForm(TestCase):
def test_unbound(self):
form = BinaryQuestionForm()
expected_fields = [
'availa... | {
"content_hash": "e525c167d12a2dc1f6b4de95c897fe2d",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 79,
"avg_line_length": 29.016806722689076,
"alnum_prop": 0.5244714740805096,
"repo_name": "izzyalonso/tndata_backend",
"id": "abde430cb55ac8e0a4239152aa9095f551727fc0",
"s... |
"""
Exception classes for pyRserve
"""
class PyRserveError(Exception):
pass
class REvalError(PyRserveError):
"""Indicates an error raised by R itself (not by Rserve)"""
pass
class RConnectionRefused(PyRserveError):
pass
class RResponseError(PyRserveError):
pass
class RSerializationError(Py... | {
"content_hash": "099153de6ceb47f981e9a9ef28d31d32",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 63,
"avg_line_length": 13.964285714285714,
"alnum_prop": 0.7289002557544757,
"repo_name": "flying-sheep/pyRserve",
"id": "edc385ed5ae8e6aedd741fae10865d265f35acb3",
"size":... |
from django.test import TestCase
# Create your tests here.
# Unit Tests
# System integration test.
class SystemIntegrationTestCase(TestCase):
"""
Complete system integration test that tests the system from
initialization to final score prediction.
0. Assumes database is set up with a small corpus of... | {
"content_hash": "27655f37f5c46cb48f1eea66da88f917",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 77,
"avg_line_length": 27.322580645161292,
"alnum_prop": 0.7001180637544274,
"repo_name": "arunchaganty/kbp-online",
"id": "448f4deef649a780d78ba7222f4c5176f3f60992",
"size... |
import binascii
try:
import StringIO
except ImportError:
from io import StringIO
class PKCS7Encoder(object):
'''
RFC 2315: PKCS#7 page 21
Some content-encryption algorithms assume the
input length is a multiple of k octets, where k > 1, and
let the application define a method for handling... | {
"content_hash": "0f05fe2593148484b5e5533cc1e5dc16",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 80,
"avg_line_length": 31.876923076923077,
"alnum_prop": 0.5815637065637066,
"repo_name": "wileyyugioh/kissanime_dl",
"id": "ffb6322e12945f1fabd191709462b097c2297711",
"siz... |
"""
Single label image classification solution. Typical usage is:
Run preprocess() or preprocess_async() to preprocess data for training.
Run train() or train_async() to train models.
Run predict(), batch_predict(), batch_predict_async() to perform predictions.
The trained model can also be deployed online with googl... | {
"content_hash": "446e8469b922084d5050a48a4b8a98a6",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 97,
"avg_line_length": 41.13333333333333,
"alnum_prop": 0.7277147487844409,
"repo_name": "yebrahim/pydatalab",
"id": "e81a13d2aa864ff598c0c65cdd73c79b37535b64",
"size": "12... |
from django.contrib import admin
from .models import Customer
class CustomerAdmin(admin.ModelAdmin):
list_display = ['name', 'is_active']
admin.site.register(Customer, CustomerAdmin)
| {
"content_hash": "fc3f5deb1da4b494603d252e5c58097b",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 44,
"avg_line_length": 21.22222222222222,
"alnum_prop": 0.7643979057591623,
"repo_name": "moshthepitt/answers",
"id": "f6983e4d9416135e5526436f2c362f9d5b6e39f8",
"size": "19... |
import sys
from oslo_config import cfg
from oslo_log import log as logging
from neutron.agent import dhcp_agent
from neutron.cmd.sanity import checks
from neutron.common import config
from neutron.db import l3_hamode_db
from neutron.i18n import _LE, _LW
LOG = logging.getLogger(__name__)
def setup_conf():
cfg.... | {
"content_hash": "5bbfd9439d7886234e95cdf58a3cae23",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 79,
"avg_line_length": 39.26053639846743,
"alnum_prop": 0.6304284180735825,
"repo_name": "mmnelemane/neutron",
"id": "6d3b3dfe7ae47eb433880ac0abf97913f6c23b15",
"size": "1... |
from __future__ import print_function, division, unicode_literals, absolute_import
from builtins import map, range
def get_vox_dims(volume):
import nibabel as nb
from nipype.utils import NUMPY_MMAP
if isinstance(volume, list):
volume = volume[0]
nii = nb.load(volume, mmap=NUMPY_MMAP)
hdr ... | {
"content_hash": "a0ed683f33ecc29080dbe64224e2a943",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 143,
"avg_line_length": 33.11538461538461,
"alnum_prop": 0.6209833526906697,
"repo_name": "mick-d/nipype",
"id": "dba7fb909396a95203acd9d5d815643c21f1a882",
"size": "2721",... |
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
from twilio.base... | {
"content_hash": "45c5c617aefb2edb0b4bfdf9fc45d4ec",
"timestamp": "",
"source": "github",
"line_count": 259,
"max_line_length": 104,
"avg_line_length": 33.50579150579151,
"alnum_prop": 0.630560036874856,
"repo_name": "twilio/twilio-python",
"id": "464ba35d2ebbb5fe771a2184249c11b4c9b97d64",
"size": ... |
import pytest
import uuid
import os
import contextlib
from ipyimport import gather
@contextlib.contextmanager
def stub_file(basedir):
if not os.path.exists(basedir):
os.mkdir(basedir)
filename = os.path.join(basedir, str(uuid.uuid4()) + '.py')
with open(filename, 'w') as outf:
yield outf
... | {
"content_hash": "8d206e5bab3ea73acbd76149e82aedef",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 77,
"avg_line_length": 29.87272727272727,
"alnum_prop": 0.6269020085209982,
"repo_name": "striglia/ipyimport",
"id": "3a375aa11b4295fc125201fc37ab67cc234dadb1",
"size": "16... |
from flask import Flask, jsonify, request
import CHIP_IO.GPIO as GPIO
import CHIP_IO.PWM as PWM
import CHIP_IO.SOFTPWM as SPWM
import CHIP_IO.SERVO as SERVO
import CHIP_IO.LRADC as LRADC
import CHIP_IO.OverlayManager as OM
import CHIP_IO.Utilities as UT
import random
import math
import copy
import sys
import signal
imp... | {
"content_hash": "7464d525bd6cadd34f5dbb60beb5df15",
"timestamp": "",
"source": "github",
"line_count": 519,
"max_line_length": 140,
"avg_line_length": 35.20616570327553,
"alnum_prop": 0.5729531523642732,
"repo_name": "xtacocorex/chip-python-aREST",
"id": "f041cb95e511a91ffcbbc46f1d75dc8d79d1d20b",
... |
from __future__ import print_function
import os
import sys
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from h2o.exceptions import H2OValueError
from h2o.automl import H2OAutoML
from tests import pyunit_utils as pu
from _automl_utils import import_dataset
def test_get_best_model_per_family():
ds ... | {
"content_hash": "52df16247b0542792bd8c0ae05986646",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 126,
"avg_line_length": 39.08108108108108,
"alnum_prop": 0.6189488243430152,
"repo_name": "h2oai/h2o-3",
"id": "1250481ee98b5f5ad8d64fab09ad7416bf6a383d",
"size": "2892",
... |
import datetime
import itertools
import json
import os
import random
import re
class JobData(object):
def __init__(self, jobkind, jobid, module, jobargs):
self.jobkind = jobkind
self.jobid = jobid
self.module = module
self.jobargs = jobargs
(self.input, self.triple, self.o... | {
"content_hash": "956efa88bea567849326df2e48b0e70a",
"timestamp": "",
"source": "github",
"line_count": 353,
"max_line_length": 79,
"avg_line_length": 36.1586402266289,
"alnum_prop": 0.5184895017235976,
"repo_name": "austinzheng/swift",
"id": "f7797ea8112962e4e5efc5238ac29ba9a0f2f57c",
"size": "134... |
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.db.models import Prefetch, QuerySet
from django.db.models.query import get_prefetcher, prefetch_related_objects
from django.test import TestCase, override_setting... | {
"content_hash": "1f805b27241b8431432b835614ff3f0c",
"timestamp": "",
"source": "github",
"line_count": 1530,
"max_line_length": 119,
"avg_line_length": 43.79150326797386,
"alnum_prop": 0.5961851315652005,
"repo_name": "schinckel/django",
"id": "49c7fd8ff67b1528d3eee2fa4e0dba77300c5117",
"size": "6... |
"""Statistics helper for sensor."""
from __future__ import annotations
import datetime
import itertools
import logging
from typing import Callable
from homeassistant.components.recorder import history, statistics
from homeassistant.components.sensor import (
ATTR_STATE_CLASS,
DEVICE_CLASS_ENERGY,
DEVICE_C... | {
"content_hash": "615991fd3ae7662c853048af21439751",
"timestamp": "",
"source": "github",
"line_count": 521,
"max_line_length": 100,
"avg_line_length": 37.39923224568138,
"alnum_prop": 0.5846548627149089,
"repo_name": "FreekingDean/home-assistant",
"id": "0054b01abd2c87a103eb39ff42a00538056430c3",
... |
import io
import json
def read_docs(f, field=1):
input_stream = io.TextIOWrapper(f.buffer, encoding='utf-8')
for line in input_stream:
yield json.loads(line.strip().split("\t")[field-1])
def revision2doc(revision, page):
"""
Implements RevisionDocument v0.0.2
"""
redirect = None
i... | {
"content_hash": "be393564917509df6399fc1e6ee5bbb0",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 63,
"avg_line_length": 25.73913043478261,
"alnum_prop": 0.535472972972973,
"repo_name": "halfak/MediaWiki-Streaming",
"id": "a526860d3142443bb2133e0e13694280427ca725",
"siz... |
from qutip.about import about
from qutip import settings as qset
def run(full=False):
"""
Run the test scripts for QuTiP.
Parameters
----------
full: bool
If True run all test (30 min). Otherwise skip few variants of the
slowest tests.
"""
# Call about to get all version in... | {
"content_hash": "7810e95a80a4bc273fd4b14e2a073ab8",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 77,
"avg_line_length": 29.441176470588236,
"alnum_prop": 0.6213786213786214,
"repo_name": "qutip/qutip",
"id": "0281a2c1472a94d6854039cb7f0eb0411a21099d",
"size": "1001",
... |
'''
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
Created on Jan 1, 2011
@author:Drew Bratcher
@contact: dbratcher@gatech.edu
@summary: Contains tutorial for... | {
"content_hash": "c4477087964277bcac236163b32bd5db",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 129,
"avg_line_length": 30.845070422535212,
"alnum_prop": 0.6981735159817352,
"repo_name": "grahesh/Stock-Market-Event-Analysis",
"id": "8fed4256e35ea9a43c277395dc5300744e753... |
import os
import pipes
import platform
from build_swift.build_swift import argparse
from build_swift.build_swift.constants import BUILD_SCRIPT_IMPL_PATH
from build_swift.build_swift.constants import SWIFT_BUILD_ROOT
from build_swift.build_swift.constants import SWIFT_REPO_NAME
from build_swift.build_swift.constants im... | {
"content_hash": "c1b4a610e9e2f0aeac18a7116fde5297",
"timestamp": "",
"source": "github",
"line_count": 793,
"max_line_length": 87,
"avg_line_length": 43.833543505674655,
"alnum_prop": 0.5720943613348677,
"repo_name": "rudkx/swift",
"id": "5343318ad80fac5670add53c8e268e7e7cf96d17",
"size": "35265",... |
from conans import python_requires
import os
common = python_requires('llvm-common/0.0.0@orbitdeps/stable')
class LLVMTransformUtils(common.LLVMModulePackage):
version = common.LLVMModulePackage.version
name = 'llvm_transform_utils'
llvm_component = 'llvm'
llvm_module = 'TransformUtils'
llvm_requi... | {
"content_hash": "9c83919ad5f76d5dc37d533f81039808",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 82,
"avg_line_length": 35.36363636363637,
"alnum_prop": 0.7352185089974294,
"repo_name": "pierricgimmig/orbitprofiler",
"id": "dec17791ecfa6745ee75c1ed6d79a6ea8418ec17",
"s... |
import sqlalchemy_utils
from flask import request, render_template
from flask_babel import get_locale
from stand.app import babel, app
sqlalchemy_utils.i18n.get_locale = get_locale
'''
# @app.before_request
def before():
print request.args
if request.args and 'lang' in request.args:
if request.args['l... | {
"content_hash": "a3d470ba2f74e0899886b65a1718b460",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 66,
"avg_line_length": 25.014492753623188,
"alnum_prop": 0.5886442641946698,
"repo_name": "eubr-bigsea/stand",
"id": "cca13072673072bc7e276b6cbcd9471a49a3398a",
"size": "17... |
import re
import urllib
RESERVED = ":/?#[]@!$&'()*+,;="
OPERATOR = "+./;?|!@"
EXPLODE = "*+"
MODIFIER = ":^"
TEMPLATE = re.compile("{([^\}]+)}")
def _tostring(varname, value, explode, operator, safe=""):
if type(value) == type([]):
if explode == "+":
return ",".join([varname + "." + urllib.quote(x, safe) ... | {
"content_hash": "efbeb5c9ae740a58948bad725c3cb831",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 125,
"avg_line_length": 31.64,
"alnum_prop": 0.5658298717717175,
"repo_name": "KaranToor/MA450",
"id": "c04363e59a1741ca1616f293b52f83db3f596e48",
"size": "5608",
"binar... |
"""
This modules loads a JSON file from the etc/ directory and provides it as a
Python dictionary for other scripts to utilize.
"""
__all__ = [
'json2py',
'load',
'sanity_check',
'CONFIG_DIRECTORY',
]
import json
import os
CONFIG_DIRECTORY = 'etc'
def json2py(data):
if isinstance(data, dict):
... | {
"content_hash": "128250802d401fc3013990a857664f50",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 101,
"avg_line_length": 28.698630136986303,
"alnum_prop": 0.5560859188544153,
"repo_name": "ammongit/ucr-class-map",
"id": "73d08b1313bc21735e2ef3cc7699196355a22eeb",
"size... |
import time
import os
import socket
import threading
import SocketServer
import uuid
VERSION = '0.1'
class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
def handle(self):
while(1):
data = self.request.recv(1024)
if not data:
break
cur_thread = threading.current_thread()
print cu... | {
"content_hash": "8ff3c98817b9d03f1a425d4e38016d9d",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 108,
"avg_line_length": 23.174311926605505,
"alnum_prop": 0.6797307996832938,
"repo_name": "GBHsl/py0live",
"id": "7f3a2be7a5293ff369131257bed6aa408276d3c4",
"size": "2526... |
from __future__ import unicode_literals
from django import forms
from django.utils import six
from .conf import settings
#==============================================================================
class Fieldline(object):
def __init__(self, form, fields, layout, labels):
self.form = form
if ... | {
"content_hash": "45ec58541e454169bb136f986e606a6b",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 118,
"avg_line_length": 31.370689655172413,
"alnum_prop": 0.5237702665567464,
"repo_name": "kunitoki/django-formaldehyde",
"id": "df1fb5512c8a4cb2c0914ed81d5d609c4709c026",
... |
import gym
import time
import torch
from torch import nn, autograd, optim
import torch.nn.functional as F
import numpy as np
num_hidden = 4
print_every = 100
class Policy(nn.Module):
"""
Given parameters, calculates probability of any action,
given any state as input
samples from these probabilities... | {
"content_hash": "bb42c5553e86800230f3b8812392f221",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 97,
"avg_line_length": 28.947916666666668,
"alnum_prop": 0.5980568549838071,
"repo_name": "hughperkins/pub-prototyping",
"id": "2bce9c499b1ac6a3ff58a5c3b249440806238dcc",
"... |
import os
import urlparse
from redis import Redis
from rq import Worker, Queue, Connection
from recruit_app.app import create_app
from recruit_app.settings import DevConfig, ProdConfig
listen = ['high', 'medium', 'low']
redis_url = os.getenv('REDISTOGO_URL')
# if not redis_url:
# raise RuntimeError('Set up Redis... | {
"content_hash": "b7c52b3507e5f29791aba97734404c52",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 79,
"avg_line_length": 26.870967741935484,
"alnum_prop": 0.6542617046818727,
"repo_name": "tyler274/Recruitment-App",
"id": "da50f1be4db364713c2860f2467388d118632e1d",
"siz... |
import bson.json_util
from girder import events
from girder.constants import AccessType
from girder.utility.model_importer import ModelImporter
from girder.api.describe import Description, describeRoute
from girder.api.rest import Resource, RestException
from girder.api import access
class ResourceExt(Resource):
... | {
"content_hash": "6e0f1c8c2d4c05020c88c31fc4686af6",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 79,
"avg_line_length": 39.86440677966102,
"alnum_prop": 0.6075680272108843,
"repo_name": "essamjoubori/girder",
"id": "58061e23a82c6c727b8a2ee96ffb753b7bbaaab3",
"size": "3... |
"""Generate docs for the TensorFlow Python API."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import fnmatch
import os
import shutil
import tempfile
import six
from tensorflow.python.util import tf_inspect
from tensorflow.tools.common... | {
"content_hash": "a166afe9403932732462741ef6563c62",
"timestamp": "",
"source": "github",
"line_count": 668,
"max_line_length": 80,
"avg_line_length": 34.14071856287425,
"alnum_prop": 0.6285626589493993,
"repo_name": "ppwwyyxx/tensorflow",
"id": "77a685062aec1e6440c72484517938f66e150343",
"size": "... |
import gevxlpy.util.configuration as cfg
import gevxl.gui_wx as gui_wx
import os
import errno
import wx
import wx.lib.mixins.inspection
import wx.lib.masked.timectrl
import wx.lib.masked.numctrl
import wx.gizmos
import wx.calendar
import wx.lib.scrolledpanel
import sys
import util
import subprocess
from wx.lib.agw.aui ... | {
"content_hash": "f3d09edd85bbee5dc0572988468e9baf",
"timestamp": "",
"source": "github",
"line_count": 2775,
"max_line_length": 222,
"avg_line_length": 60.84576576576577,
"alnum_prop": 0.6383352976363217,
"repo_name": "VHAINNOVATIONS/GE-Pressure-Ulcer",
"id": "69a766bef34542e2c6ca9e52da89dc4de57f71d... |
import argparse
import logging as std_logging
import os
import pprint
import sys
from st2common import log as logging
from st2reactor.rules.tester import RuleTester
__all__ = [
'main'
]
def _parse_args():
parser = argparse.ArgumentParser(description='Test the provided rule')
parser.add_argument('--rule'... | {
"content_hash": "9d42a8aae6afa8a0da871f55d2c361f0",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 87,
"avg_line_length": 27.585714285714285,
"alnum_prop": 0.5572242361470741,
"repo_name": "Itxaka/st2",
"id": "b91ddf60a1dde4d39308157762f8fbb999a4fe07",
"size": "2711",
... |
import logging
import os
import sys
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
sys.path.append(ROOT_PATH)
DEBUG = False
TEMPLATE_DEBUG = DEBUG
SITE_ID = 1
SITE_BRANDING = 'OpenStack'
SITE_NAME = 'openstack'
ENABLE_VNC = True
LOGIN_URL = '/auth/login'
LOGIN_REDIRECT_URL = '/'
MEDIA_ROOT = os.path.abspa... | {
"content_hash": "2a7883513aead3f9b16d607be7e39f70",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 72,
"avg_line_length": 27.705882352941178,
"alnum_prop": 0.7033666969972703,
"repo_name": "rnirmal/openstack-dashboard",
"id": "ef8919a34fd45c956ab24e5bd6e1f25e37dabd43",
... |
"""Flow Resource functions."""
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | {
"content_hash": "8d886f955efdf160a397eee52f1bbf0a",
"timestamp": "",
"source": "github",
"line_count": 447,
"max_line_length": 80,
"avg_line_length": 32.56375838926174,
"alnum_prop": 0.5928826600714482,
"repo_name": "GoogleCloudPlatform/dfcx-scrapi",
"id": "206fd60c56ce7bfc3a71fb36da14dcec7861d63c",... |
__author__ = "Mehdi Korjani"
__version__ = "1.0.0"
import pdb
import glob
import os
import numpy as np
from keras.models import load_model
from keras.models import model_from_json
from keras.callbacks import EarlyStopping
from keras.callbacks import ModelCheckpoint
import h5py
import argparse
from pydub import AudioSe... | {
"content_hash": "b86ffa8282cf1a2deb60e7f0f814cfe1",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 141,
"avg_line_length": 34.75739644970414,
"alnum_prop": 0.5614572693224379,
"repo_name": "korjani/time_domain_speech_enhancement",
"id": "ba2d582a96fba34d2b0cbed6cff9487f40... |
plot_docstring = """
Plot the target map.
Parameters:
path: `string`
The path where to put the plot.
whiteOnBlack: `boolean [default True]`
By default, whiteOnBlack=True, the detected signal
is white on a black background. ... | {
"content_hash": "caf2d289def0fa9cdb3716c143b26d7a",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 70,
"avg_line_length": 30.7,
"alnum_prop": 0.5374592833876222,
"repo_name": "ctherien/pysptools",
"id": "e613b7b036de9e246ff9dd4d658b8073159ded70",
"size": "1757",
"binar... |
"""
@author: KBK
"""
import numpy as np
import time
from sklearn.model_selection import cross_val_score
import pandas as pd
class EvolutionaryFeatureSubsetting(object):
def __init__(self,populationsize,composition=[.2,.2,.1,.1,.4]):
self.populationsize = pop... | {
"content_hash": "fdce5629ee67a6cd868aca8c28e3bf97",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 125,
"avg_line_length": 44.093023255813954,
"alnum_prop": 0.5726090014064698,
"repo_name": "kaplanbr/Evolutionary-Search",
"id": "7446cb1e8892440c2cdf11dd80159fc8a70ea32d",
... |
from __future__ import unicode_literals
import collections
from collections import OrderedDict
from django.utils.encoding import force_text
from rest_framework.compat import unicode_to_repr
class ReturnDict(OrderedDict):
"""
Return object from `serialier.data` for the `Serializer` class.
Includes a bac... | {
"content_hash": "7add2653307184a749a6101511edb818",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 93,
"avg_line_length": 30.953020134228186,
"alnum_prop": 0.6175195143104943,
"repo_name": "hunter007/django-rest-framework",
"id": "b11d3fd0713e1d989703f3fc9cd73469f4902e70"... |
"""This application demonstrates how to delete a reservation using
the Pub/Sub Lite API. For more information, see the root level README.md
and the documentation at https://cloud.google.com/pubsub/lite/docs/topics.
"""
import argparse
def delete_lite_reservation(project_number, cloud_region, reservation_id):
# [... | {
"content_hash": "b5e67ecc4e75901e3846d53d2d2f65ea",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 85,
"avg_line_length": 34.645833333333336,
"alnum_prop": 0.7041491280817799,
"repo_name": "googleapis/python-pubsublite",
"id": "373ccf1502804add4cb36d210ad04acf25265378",
... |
import sys
import posixpath
output_dir = sys.argv[1]
for file in sys.argv[2:]:
(base, suffix) = posixpath.splitext(file)
if suffix == ".idl":
print posixpath.normpath(posixpath.join(output_dir, "%s_glue.h" % base))
print posixpath.normpath(posixpath.join(output_dir, "%s_glue.cc" % base))
else:
print... | {
"content_hash": "4245adfa1975d52f5eeaadbd7fea9d62",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 77,
"avg_line_length": 27.642857142857142,
"alnum_prop": 0.6950904392764858,
"repo_name": "rwatson/chromium-capsicum",
"id": "ceb15754add05f5e6b308278a99acfd550dd0220",
"si... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Comment.remix_of'
db.add_column('canvas_comment', 'remix_of', self.gf('django.db.models.fields.related.Forei... | {
"content_hash": "8cc2f775a074ed20c57915ada281de2a",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 187,
"avg_line_length": 69.62096774193549,
"alnum_prop": 0.5459284142244875,
"repo_name": "canvasnetworks/canvas",
"id": "9fc45da712f050bf11d5e8ebb82b3e7a4c27e3de",
"size"... |
import WebIDL
def WebIDLTest(parser, harness):
parser.parse("""
interface TestArrayBuffer {
attribute ArrayBuffer bufferAttr;
void bufferMethod(ArrayBuffer arg1, ArrayBuffer? arg2, ArrayBuffer[] arg3, sequence<ArrayBuffer> arg4);
attribute ArrayBufferView viewAttr;
... | {
"content_hash": "ab8a7dc74473e0ad578d93a568bc6757",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 148,
"avg_line_length": 49.79761904761905,
"alnum_prop": 0.7052354769304328,
"repo_name": "sergecodd/FireFox-OS",
"id": "5b8e56f86ca1daf8b6dfc445989a3c9c7f6195c2",
"size": ... |
from datetime import date
from os.path import join, split
from uuid import uuid4
import django
from django import forms
from django.forms.extras import SelectDateWidget
from django.core.files.storage import FileSystemStorage
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
fro... | {
"content_hash": "8b39ce28e5e57f208d453dc11c18340d",
"timestamp": "",
"source": "github",
"line_count": 370,
"max_line_length": 79,
"avg_line_length": 43.52972972972973,
"alnum_prop": 0.5583633428535949,
"repo_name": "westinedu/similarinterest",
"id": "1bfb12df542746e907da70bfe42fb1330ced1cb5",
"si... |
import json
import re
import cfgm_common
import netaddr
import uuid
import vnc_quota
from gen.resource_xsd import *
from gen.resource_common import *
from gen.resource_server import *
from pprint import pformat
from pysandesh.gen_py.sandesh.ttypes import SandeshLevel
class GlobalSystemConfigServer(GlobalSystemConfi... | {
"content_hash": "b249a6a8ece4d50b2d06d8749b4ce1d8",
"timestamp": "",
"source": "github",
"line_count": 1223,
"max_line_length": 112,
"avg_line_length": 40.39084219133279,
"alnum_prop": 0.5440301226770314,
"repo_name": "cloudwatt/contrail-controller",
"id": "6c3550ea4d25ea30728fd784baee499a3ba18d08",... |
"""
Mock unit tests for the NetApp block storage C-mode library
"""
import ddt
import mock
from cinder import exception
from cinder import test
import cinder.tests.unit.volume.drivers.netapp.dataontap.fakes as fake
from cinder.tests.unit.volume.drivers.netapp.dataontap.utils import fakes as\
fake_utils
import cin... | {
"content_hash": "4790599aee8379f70bbaab109ec0a7a5",
"timestamp": "",
"source": "github",
"line_count": 713,
"max_line_length": 79,
"avg_line_length": 43.86115007012623,
"alnum_prop": 0.6015412656284974,
"repo_name": "cloudbase/cinder",
"id": "74dcbc65b658c9360f482e51006fbd69e60ba8e6",
"size": "320... |
"""
This example demonstrates jitclasses and deferred types for writing a
singly-linked-list.
"""
from __future__ import print_function, absolute_import
from collections import OrderedDict
import numpy as np
from numba import njit
from numba import jitclass
from numba import int32, deferred_type, optional
from numba.ru... | {
"content_hash": "68aac25437ba7b91ab8bc00658f9806b",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 76,
"avg_line_length": 22.855072463768117,
"alnum_prop": 0.6518706404565631,
"repo_name": "jriehl/numba",
"id": "68ec017a5aa05cd5a2db11b22873f884052dae80",
"size": "1624",
... |
import json
from colors import black, blue, cyan, green, magenta, red, white
from packaging.version import Version
from pants.option.options_fingerprinter import CoercingOptionEncoder
from pants.option.ranked_value import Rank
from pants.option.scope import GLOBAL_SCOPE
from pants.task.console_task import ConsoleTask... | {
"content_hash": "6ca9900e8e31899ee1f365e42f0074be",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 109,
"avg_line_length": 41.74603174603175,
"alnum_prop": 0.5670468948035488,
"repo_name": "tdyas/pants",
"id": "382b6c39b0edf04825f7f20ba16ca74a92b4a709",
"size": "8022",
... |
"""@file evaluate.py
Module containing functions for the evaluation of the constant and variable shear-type branches
of the GREAT3 Challenge.
For the functions used to directly evaluate the GREAT3 metrics, see q_constant() and q_variable().
This code requires the GREAT3 metric evaluation truth data to have been unpa... | {
"content_hash": "dcdb9f2844f22c7fe749f248dc59df70",
"timestamp": "",
"source": "github",
"line_count": 1114,
"max_line_length": 100,
"avg_line_length": 53.35188509874327,
"alnum_prop": 0.6139246895716257,
"repo_name": "barnabytprowe/great3-public",
"id": "71ac5deb2673d925e05e1b5abbc22bce83a52096",
... |
#!/usr/bin/env python
"""
This script is used to run tests, create a coverage report and output the
statistics at the end of the tox run.
To run this script just execute ``tox``
"""
import re
from fabric.api import local, warn
from fabric.colors import green, red
if __name__ == '__main__':
local('flake8 --ignore... | {
"content_hash": "dd4f6ab49bdfcbff5f05c355b7627532",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 78,
"avg_line_length": 41.12,
"alnum_prop": 0.646887159533074,
"repo_name": "bitmazk/django-document-library",
"id": "65b73dd219f2f5d4494a495c13424f585a804900",
"size": "10... |
from enum import Enum
class Mode(Enum):
copy = 0
move = 1
replace = 2
def __str__(self):
return self.name
class Encode(Enum):
no = 0
yes = 1
later = 2
def __str__(self):
return self.name
| {
"content_hash": "56c973257ad5413c1d7bff10af9f5104",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 24,
"avg_line_length": 12.68421052631579,
"alnum_prop": 0.5186721991701245,
"repo_name": "gotling/photo-sort",
"id": "7c90dd0f4145d4e0386f9a2ce86962616c13eef8",
"size": "24... |
import _plotly_utils.basevalidators
class ImaginaryaxisValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="imaginaryaxis", parent_name="layout.smith", **kwargs
):
super(ImaginaryaxisValidator, self).__init__(
plotly_name=plotly_name,
... | {
"content_hash": "163d21f0fab33cde50510b96b920ca89",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 79,
"avg_line_length": 44.49586776859504,
"alnum_prop": 0.524888558692422,
"repo_name": "plotly/plotly.py",
"id": "ff2661dd8bda455d437e1de4383e3c24eaf12bde",
"size": "5384... |
"""
This module solves (certain types of) cryptarithmetic problems.
"""
from csp import *
import itertools
import re
class Cryptarithmetic(ConstraintSatisfactionProblem):
"""
The cryptarithmetic solver.
This one only solves decimal domain puzzles, and only puzzles with two
addends and a sum.
""... | {
"content_hash": "7831504e0fc3d8b7f3ebd957c2dde8ff",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 97,
"avg_line_length": 33.28104575163399,
"alnum_prop": 0.5581304006284368,
"repo_name": "jharris119/ConstraintSatisfactionProblem",
"id": "6a9dd4e2ed3fb5d89ed193aa27e4c28f1... |
"""
sentry.db.models.manager
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import logging
import six
import threading
import weakref
from django.conf import ... | {
"content_hash": "8aa7b226303d2286388be35d8541c778",
"timestamp": "",
"source": "github",
"line_count": 315,
"max_line_length": 86,
"avg_line_length": 32.58412698412698,
"alnum_prop": 0.5641075604053001,
"repo_name": "JackDanger/sentry",
"id": "527909a16f1b33ca2f078490a0c2a2e2672ee577",
"size": "10... |
def log(str):
print str
| {
"content_hash": "e58019628758801dd96710d111bee231",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 13,
"avg_line_length": 14,
"alnum_prop": 0.6071428571428571,
"repo_name": "kevinb7/js2py",
"id": "f1120b00ee30370d25cf9e68c19cfcfd34db89ff",
"size": "46",
"binary": false,... |
import os
import shutil
from plenum.common.util import randomString
keepFilesInClientReset = [
'pool_transactions_sandbox',
'sovrin_config.py',
'sample',
'pool_transactions_local',
'pool_transactions_live'
]
def performSovrinBaseDirCleanup(baseDir):
backupDir = None
while True:
b... | {
"content_hash": "1aa9b92330293af19dc892fa2954e1a8",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 64,
"avg_line_length": 27.53125,
"alnum_prop": 0.6186152099886493,
"repo_name": "keenondrums/sovrin-node",
"id": "e646b0f4325b78e81a1d14b296a825f769cad1a5",
"size": "881",
... |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("SGDClassifier" , "FourClass_100" , "duckdb")
| {
"content_hash": "3cf22a963171223e923d61e1845bd84a",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 72,
"avg_line_length": 35.5,
"alnum_prop": 0.7816901408450704,
"repo_name": "antoinecarme/sklearn2sql_heroku",
"id": "3b322a07ba9f201c4d97343bee2999b7fd229e40",
"size": "142... |
from sympy.core.basic import Basic, S, cache_it, cache_it_immutable
from sympy.core import oo, Rational, Pow
from sympy.core.methods import ArithMeths, RelMeths
class Order(Basic, ArithMeths, RelMeths):
"""
Represents O(f(x)) at the point x = 0.
Definition
==========
g(x) = O(f(x)) as x->0 if an... | {
"content_hash": "03c4d16cafa591f6ce33355a6e22b64b",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 128,
"avg_line_length": 32.712166172106826,
"alnum_prop": 0.49909288824383163,
"repo_name": "certik/sympy-oldcore",
"id": "250a4c31830a9b46c14910275c2c1ee671b338d2",
"size... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "readthedocs.settings.dev")
sys.path.append(os.getcwd())
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "7eced286e2ed2cee4a4fb68ffd5970ab",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 79,
"avg_line_length": 26.9,
"alnum_prop": 0.7063197026022305,
"repo_name": "safwanrahman/readthedocs.org",
"id": "966dad77845753de3dffeb9c3c18e759ceaafc83",
"size": "291",... |
import django_filters
from waldur_core.structure import filters as structure_filters
from . import models
class ImageFilter(structure_filters.BaseServicePropertyFilter):
class Meta:
model = models.Image
fields = structure_filters.BaseServicePropertyFilter.Meta.fields + ('region',)
region =... | {
"content_hash": "9569fe3a7fbd9f3c74a566ce187d9333",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 86,
"avg_line_length": 27.275862068965516,
"alnum_prop": 0.7496839443742098,
"repo_name": "opennode/nodeconductor-aws",
"id": "5c9352636d592968608e754e2844c076b9e7227e",
"s... |
from tests import unittest
import itertools
from nose.plugins.attrib import attr
import botocore.session
from botocore.exceptions import ClientError
class TestEC2(unittest.TestCase):
def setUp(self):
self.session = botocore.session.get_session()
self.client = self.session.create_client(
... | {
"content_hash": "1dbdcab3001a7d76362ad8b396145fcc",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 79,
"avg_line_length": 38.229729729729726,
"alnum_prop": 0.6401555319901026,
"repo_name": "pplu/botocore",
"id": "cc8dcf0908f8addae3bac8425dbcdaa5fc272ef9",
"size": "3395",... |
from datetime import timedelta
from django.core.files.storage import default_storage
from django.utils import timezone
from freezegun import freeze_time
from ...webhook.event_types import WebhookEventAsyncType
from ..models import EventDelivery, EventDeliveryAttempt, EventPayload
from ..tasks import (
delete_even... | {
"content_hash": "4d3693d8ed359e654bf578f42db03528",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 77,
"avg_line_length": 32.35227272727273,
"alnum_prop": 0.6972251492799438,
"repo_name": "mociepka/saleor",
"id": "9bc8b1fd4c1d3a77d18f1e1b927772f08b31b85d",
"size": "2847"... |
from enable.component_editor import ComponentEditor
from pyface.tasks.traits_dock_pane import TraitsDockPane
from pyface.tasks.traits_task_pane import TraitsTaskPane
from traits.api import Button, Bool, Int, Float
from traitsui.api import View, Item, UItem, VGroup, HGroup, spring, Tabbed
from pychron.core.ui.lcd_edito... | {
"content_hash": "1f7ec5d61e0a1fc110a96ce342fb9a4a",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 116,
"avg_line_length": 34.32857142857143,
"alnum_prop": 0.521986405881537,
"repo_name": "NMGRL/pychron",
"id": "fa2f8c2220acd5b7e6b24fbad960ebfc8af914de",
"size": "7943",... |
from matplotlib import pyplot as plt
from matplotlib import animation, colors
class Display(object):
def __init__(self, mapa, values, paints, update):
self.__make_cmap(paints, values)
self.update = update
self.__show(mapa)
def __make_cmap(self, paints, values):
self.cmap = col... | {
"content_hash": "754ec9e62d3a318713aff912da2932fa",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 113,
"avg_line_length": 32.361111111111114,
"alnum_prop": 0.5768240343347639,
"repo_name": "kotwgarnku/predatory-prey-simulation",
"id": "828810f240e4a0af957caba9dc046f8574cd... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/deed/event_perk/shared_rsf_2x10_honorguard_deed.iff"
result.attribute_template_id = 2
result.stfName("event_perk","rsf_2x10_honorguard_deed_name")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ###... | {
"content_hash": "f58fbac3da4ed07a10d7278e47b617b6",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 88,
"avg_line_length": 26,
"alnum_prop": 0.7100591715976331,
"repo_name": "obi-two/Rebelion",
"id": "bd521ea93f04a4bcad2639cd2a2523245e70794d",
"size": "483",
"binary": f... |
from networking_vsphere.tests import base
from networking_vsphere.utils import error_util
class TestVimException(base.TestCase):
def test_str(self):
exc = Exception("Test Exception")
exception_summary = "Test Summary "
vim_excep = error_util.VimException(exception_summary, exc)
se... | {
"content_hash": "cb8cf2d592a26aea472e9f9b44f1405a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 75,
"avg_line_length": 32.9,
"alnum_prop": 0.6914893617021277,
"repo_name": "Mirantis/vmware-dvs",
"id": "55d1756029e2e8a56c633a5b27cd78c847313f1e",
"size": "1319",
"bina... |
__author__ = "Martin Felder"
__version__ = '$Id$'
from pylab import figure, ioff, clf, contourf, ion, draw, show
from pybrain.utilities import percentError
from pybrain.tools.shortcuts import buildNetwork
from pybrain.supervised.trainers import BackpropTrainer
from pybrain.structure.modules import Soft... | {
"content_hash": "124ccd10031897bc7e18ee4b3f79f28a",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 94,
"avg_line_length": 33.38235294117647,
"alnum_prop": 0.6951541850220264,
"repo_name": "fxsjy/pybrain",
"id": "1ecaf50ecdcbbbe91117b22e033fd90de960d443",
"size": "2352",
... |
import paho.mqtt.client as mqttc
import time
import random
# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
# Subscribing in on_connect() means that if we lose the connection and
# recon... | {
"content_hash": "a0ea0b0ccf811e696b97ad7019230672",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 80,
"avg_line_length": 34.26829268292683,
"alnum_prop": 0.6804270462633452,
"repo_name": "Samsung-IoT-Academy/mockquitto",
"id": "8b5c26f5a780f07b0f589f453cabecac632d92f5",
... |
class HeapSort:
@classmethod
def heapsort_support(cls, heap):
# create support array
ordered_array = []
# extract min until heap is empty
while not heap.is_empty():
min_node = heap.delete_min()
if min_node is None:
break
else:
... | {
"content_hash": "814bb127d194e6261aa105b0dbf45b94",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 46,
"avg_line_length": 28.285714285714285,
"alnum_prop": 0.5328282828282829,
"repo_name": "andreweb/HeapHeap",
"id": "31d5558e501ce9b866dc650496dc34f9deeb3144",
"size": "39... |
import json
import logging
import os
from pwd import getpwnam
import shutil
import sys
# TODO(rhallisey): add docstring.
logging.basicConfig()
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.INFO)
def validate_config(config):
required_keys = {'source', 'dest', 'owner', 'perm'}
if 'command' not in co... | {
"content_hash": "1d77e4a260000bd880e76c18031a97e7",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 77,
"avg_line_length": 30.151041666666668,
"alnum_prop": 0.5767835550181378,
"repo_name": "fdumpling/kolla",
"id": "941e74ca230b508bc1786027149d6d39633a21e7",
"size": "635... |
import os
import sys
import numpy as np
import argparse
import struct
def process_dlrm_data(embedding_rows_bound, data_file, dest_dir, num_samples = 0):
dest_dir = output_dir + "/build/criteo"
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
# No of lines in the file
if num_samples == 0:... | {
"content_hash": "ac23ba333bca3031cced99da977d9793",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 161,
"avg_line_length": 49.416666666666664,
"alnum_prop": 0.6329398538504778,
"repo_name": "mlperf/inference_results_v0.7",
"id": "5788a8252f64a9d0c0d0f574a174dbcd0b2624e5",
... |
import platform
import re
from awscli.compat import urlopen, URLError
from awscli.customizations.codedeploy.systems import System, Ubuntu, Windows, RHEL
from socket import timeout
MAX_INSTANCE_NAME_LENGTH = 100
MAX_TAGS_PER_INSTANCE = 10
MAX_TAG_KEY_LENGTH = 128
MAX_TAG_VALUE_LENGTH = 256
INSTANCE_NAME_PATTERN = r'^... | {
"content_hash": "31c4054f7cbdc76a4f18e663d9c6e66a",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 82,
"avg_line_length": 33.33057851239669,
"alnum_prop": 0.5648400694272254,
"repo_name": "LockScreen/Backend",
"id": "7aee4bb77e4053905e00a50f80ec6ecba85b7dc0",
"size": "4... |
from plankton import codec
# A generic object.
class Object(object):
def __init__(self, serial):
self.header = None
self.payload = None
self.serial = serial
def set_header(self, value):
self.header = value
return self
def set_payload(self, value):
self.payload = value
return self
... | {
"content_hash": "48a62c160d56a0374459640512f821e8",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 79,
"avg_line_length": 21.164383561643834,
"alnum_prop": 0.6586839266450917,
"repo_name": "plesner/neutrino",
"id": "1513133ccafba02c358b4f2cfe6c936c0aaa356f",
"size": "47... |
from django.contrib import admin
from django.utils.decorators import method_decorator
from django.views.decorators.http import require_POST
from django.utils.translation import ugettext_lazy as _
from solo.admin import SingletonModelAdmin
from allink_apps.config.models import Config
require_POST = method_decorator(r... | {
"content_hash": "cef4495786a66c6eb387b214cbde385e",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 55,
"avg_line_length": 27.2,
"alnum_prop": 0.8259803921568627,
"repo_name": "allink/allink-apps",
"id": "7cd1c8585c90eef5f74df8a780d1b814f53f1677",
"size": "432",
"binary... |
import logging
import inspect
import imp
import os
import operator
import re
import sys
import time
import traceback
from clint.textui import colored, puts, indent
from os.path import abspath, dirname
from multiprocessing import Process, Queue
import bottle
from listener import WillXMPPClientMixin
from mixins import ... | {
"content_hash": "5ea0730dccd71f5bb8b5d809778bd0ac",
"timestamp": "",
"source": "github",
"line_count": 586,
"max_line_length": 120,
"avg_line_length": 46.339590443686006,
"alnum_prop": 0.448388878659547,
"repo_name": "mvanbaak/will",
"id": "ab3e09c9655d477bce47204dedc0b6734b873780",
"size": "27184... |
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
urlpatterns = [
# Examples:
# url(r'^$', 'evetool.views.home', name='home'),
url(r'^', include('users.urls')),
url(r'^', include('admins.urls')),
url(r'^', include('apis.urls')),
... | {
"content_hash": "c62c5a136e8898ec9c2b446c5371355a",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 77,
"avg_line_length": 35.642857142857146,
"alnum_prop": 0.6693386773547094,
"repo_name": "Sult/evehub",
"id": "f683fb024cfec72e3e6eca04b2eefe731643215f",
"size": "499",
... |
"""Support for monitoring the state of Vultr Subscriptions."""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_MONITORED_CONDITIONS, CONF_NAME
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity... | {
"content_hash": "f6a28d481bfefb9ee8c6587c4fc78d75",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 82,
"avg_line_length": 29.28828828828829,
"alnum_prop": 0.6419563211319594,
"repo_name": "Teagan42/home-assistant",
"id": "fec912f00d8150d36be3cccee595c54d09798311",
"size... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import django_resized.forms
import phoenix.custom_storages
import pyotp
import uuid
class Migration(migrations.Migration):
initial = Tru... | {
"content_hash": "a239d1edd9374fbbcdb3d4c5eb7d3b3d",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 148,
"avg_line_length": 39.41860465116279,
"alnum_prop": 0.6324483775811209,
"repo_name": "vchrisb/emc_phoenix3",
"id": "20980894f611c4311fd079f39ff464f76a81d8c2",
"size": ... |
"""
These tests contain real-life-ish code snippets with different
problematic input configs that should cause the expected errors.
"""
from unittest import TestCase
from jsoncfg import loads_config, expect_object, expect_array, JSONConfigNodeTypeError
class ServerConfigLoader(object):
"""
This is the workho... | {
"content_hash": "34c193114c61d62dafef5eb3801bb88a",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 93,
"avg_line_length": 34.70454545454545,
"alnum_prop": 0.4931237721021611,
"repo_name": "pasztorpisti/json-cfg",
"id": "d757023c1f055827ca507867dc94c66d8f624d53",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.