text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import division
import theano
import theano.tensor as T
import numpy
from scipy.spatial.distance import cdist
def paraphrase_ranking(vectors, group):
"""Rank sentences by projection and return evaluation metrics."""
return ranking(vectors, vectors, group, ns=[4], exclude_self=True)
def ranking... | {
"content_hash": "459d29e8e899c824dccc22529c198d51",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 95,
"avg_line_length": 40.60344827586207,
"alnum_prop": 0.5876857749469214,
"repo_name": "gchrupala/visually-grounded-speech",
"id": "404a9613c09639d79008f99c5a27e28433084370... |
"""
Defines PASCAL_VOC datatset handling.
"""
import numpy as np
import os
import xml.dom.minidom as minidom
import tarfile
from PIL import Image
from neon.data.datasets import Dataset
from neon.util.persist import save_obj
from neon.util.persist import load_obj
# background class is always indexed at 0
PASCAL_VOC_C... | {
"content_hash": "79b4f7dfbe18be25a866b6ef435ad945",
"timestamp": "",
"source": "github",
"line_count": 745,
"max_line_length": 98,
"avg_line_length": 43.251006711409396,
"alnum_prop": 0.5388554403823475,
"repo_name": "DougFirErickson/neon",
"id": "150ad8e7a32a58bb070d801833b235a147d67ee6",
"size":... |
import functools
import types
def Cache(obj):
"""Decorator for caching read-only properties.
Example usage (always returns the same Foo instance):
@Cache
def CreateFoo():
return Foo()
If CreateFoo() accepts parameters, a separate cached value is maintained
for each unique parameter combination... | {
"content_hash": "7d40cc521d9cf23653a6b32f5f1199b7",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 80,
"avg_line_length": 34.45038167938932,
"alnum_prop": 0.6472413029027254,
"repo_name": "ChromiumWebApps/chromium",
"id": "9b3c38b3a3a13e49547a0e4df91fa7fa82bb87b9",
"siz... |
import unittest
import gflags
import time
import sys
from ct.crypto import cert
from ct.crypto import error
from ct.crypto.asn1 import oid
from ct.crypto.asn1 import x509_extension as x509_ext
from ct.crypto.asn1 import x509_name
FLAGS = gflags.FLAGS
gflags.DEFINE_string("testdata_dir", "ct/crypto/testdata",
... | {
"content_hash": "4b3b9b2bf48104a6609998c4b1539e92",
"timestamp": "",
"source": "github",
"line_count": 746,
"max_line_length": 81,
"avg_line_length": 41.74396782841823,
"alnum_prop": 0.6222664654314248,
"repo_name": "wreese/megacfs",
"id": "9e3564a0bd371a360aa55f0203373da669ef90ac",
"size": "31229... |
'''
Model tests
~~~~~~~~~~~
:copyright: (c) 2012 by Marc Schlaich
:license: MIT, see LICENSE for more details.
'''
import unittest
from mock import Mock
from guimvc import Model, Observer, List, Dict
class TestModel(Model):
attr1 = 0
attr2 = 0
class WildcardModel(TestModel):
__obser... | {
"content_hash": "4e3839ae04da7e8dd0eabb94a7b410a6",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 70,
"avg_line_length": 23.264,
"alnum_prop": 0.5660247592847317,
"repo_name": "schlamar/guimvc",
"id": "5d456233d36a9d43d686663bdf27e813c61a71f8",
"size": "2932",
"binar... |
from __future__ import absolute_import
from __future__ import division
from past.utils import old_div
from proteus import Domain
from proteus import Norms
from proteus import Profiling
from proteus import Context
from proteus.mprans import CLSVOF
import numpy as np
import math
try:
from .parameters import *
except:... | {
"content_hash": "3181d66c8be1d96f9797fd1b6738b328",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 86,
"avg_line_length": 25.267441860465116,
"alnum_prop": 0.6948918545789231,
"repo_name": "erdc/proteus",
"id": "138289d098b1f677d384b55597056fa776cc1f56",
"size": "2173",
... |
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file and with no dependencies other than the
Python S... | {
"content_hash": "e23ba8cffa771a3e77c849df1f438104",
"timestamp": "",
"source": "github",
"line_count": 3018,
"max_line_length": 103,
"avg_line_length": 39.59145129224652,
"alnum_prop": 0.5806070953325466,
"repo_name": "ironexmaiden/csd_post_sw",
"id": "cd7c88c5b5424bcefbf3afb2e07fbfee43cb1860",
"s... |
"""
Test that we can hit breakpoints in global constructors
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestBreakpointInGlobalConstructors(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE ... | {
"content_hash": "12ff3548d27e9e4fb5505c3dce29ef2b",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 70,
"avg_line_length": 29.304347826086957,
"alnum_prop": 0.6387240356083086,
"repo_name": "endlessm/chromium-browser",
"id": "4439607d91cfca3713ef00b1fde51d6cf83b27b3",
"si... |
from openstack_dashboard.api import swift
from openstack_dashboard.test.test_data.utils import TestDataContainer
def data(TEST):
TEST.containers = TestDataContainer()
TEST.objects = TestDataContainer()
container_1 = swift.Container(dict(name=u"container_one\u6346"))
container_2 = swift.Container(dic... | {
"content_hash": "bd27f7e791fa36dc2d1af2d82c7dc2fe",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 70,
"avg_line_length": 35.38461538461539,
"alnum_prop": 0.5804347826086956,
"repo_name": "tuskar/tuskar-ui",
"id": "2feef81050c09806c699daa789dd7648d9bf27a0",
"size": "1525... |
from tests.test_stack import TestConfig, app_from_config
def setup_noDB():
base_config = TestConfig(folder = 'config',
values = {'use_sqlalchemy': False,
'use_toscawidgets': False,
'use_toscawidgets2':False}
... | {
"content_hash": "65ac044e72d13e3be6829cffbda07973",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 76,
"avg_line_length": 32.89473684210526,
"alnum_prop": 0.5856,
"repo_name": "lucius-feng/tg2",
"id": "ca248ea65c83e583ffbc5f82fdb600f7241b8b8f",
"size": "1250",
"binary"... |
from __future__ import unicode_literals
from markupsafe import escape
from indico.modules.admin.views import WPAdmin
from indico.util.i18n import _
from indico.util.mathjax import MathjaxMixin
from indico.web.breadcrumbs import render_breadcrumbs
from indico.web.views import WPDecorated, WPJinjaMixin, render_header
... | {
"content_hash": "3afe6f57b531c2acfe12da173b7c80aa",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 102,
"avg_line_length": 34.46987951807229,
"alnum_prop": 0.6553652569031807,
"repo_name": "mic4ael/indico",
"id": "6e32fae752471432c7086b0fba829a5a28cac819",
"size": "3075"... |
"""
FASTMODE -- Provide real time response for each program. First, this checks to see
if the proposal asks for fasttime response. If so, the task then copies the data
to the fast directory for that proposal on saltpipe. If it is the first object
data for that proposal, then it will also send an email to the conta... | {
"content_hash": "d559b41ca8f805dc9aa3370a7f93d26f",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 115,
"avg_line_length": 38.07913669064748,
"alnum_prop": 0.6671075004723219,
"repo_name": "crawfordsm/pysalt",
"id": "260fc386bc1e5350beeceffbc64d1957dfa3c61c",
"size": "7... |
from pickle_file import PickleFile
from csv_file import CSVFile
from txt_file import TXTFile
from json_file import JSONFile
from s3_file import S3File
from tar_file import TARFile
from ftp_file import FTPFile
| {
"content_hash": "a9727fd49d245e31f70d5b15676d713e",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 34,
"avg_line_length": 29.857142857142858,
"alnum_prop": 0.8325358851674641,
"repo_name": "nathandunn/agr",
"id": "76a95a6ebc77e115de359d5043fcad6cb79ea7d7",
"size": "210",
... |
import threading
import time
def foo(iterations):
for i in range(iterations):
print threading.currentThread().name,
print threading.currentThread().ident,
print threading.activeCount(),
print threading.enumerate()
time.sleep(0.2)
def main():
"""Main function"""
thr... | {
"content_hash": "9ebad270106639948b7fe919d0ce94bf",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 54,
"avg_line_length": 23.90625,
"alnum_prop": 0.6287581699346405,
"repo_name": "jeremiedecock/snippets",
"id": "7f5c5f0766911dc9e7b3873ba78d61c44a1ed777",
"size": "1000",
... |
"""
Provides modules containing classes to support Web Services (SOAP) bindings.
"""
| {
"content_hash": "847e3f4f98a41ad2ed57ce6eaa858446",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 76,
"avg_line_length": 28.333333333333332,
"alnum_prop": 0.7529411764705882,
"repo_name": "c2theg/DDoS_Information_Sharing",
"id": "1704fa9d72390a0303d0a527466731f8547eb396",
... |
import unittest
from sqlalchemy import create_engine, MetaData, Table, Integer, String, Column
from cubes import *
from ...common import CubesTestCaseBase
from json import dumps
def printable(obj):
return dumps(obj, indent=4)
class JoinsTestCaseBase(CubesTestCaseBase):
sql_engine = "sqlite:///"
def setU... | {
"content_hash": "c84f88089aea1af93c00c396ff57b6f4",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 88,
"avg_line_length": 34.290849673202615,
"alnum_prop": 0.4731725912513104,
"repo_name": "she11c0de/cubes",
"id": "134377d67c5212456e0268b9562155fed89f2373",
"size": "105... |
import json
from junit_xml import TestSuite, TestCase
class JunitFormatter(object):
def __init__(self, project_cfg, project_result):
"""Initialize the stuff"""
self.testcases = {
unicode(item["id"]): item for item in project_cfg["testcases"]
}
test_cases = []
... | {
"content_hash": "6e36fff851daf952d65640bd14ff4639",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 84,
"avg_line_length": 31.564102564102566,
"alnum_prop": 0.5199025182778229,
"repo_name": "apiwatcher/apilisk",
"id": "cd870c65b26f112bf629e13e634681c327f660a7",
"size": "1... |
__import__( "Gaffer" )
__import__( "GafferImage" )
from _GafferScene import *
from ScenePath import ScenePath
from ScriptProcedural import ScriptProcedural
from AlembicPath import AlembicPath
| {
"content_hash": "06349067f2c5f90b59cf933cddba633c",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 45,
"avg_line_length": 24.25,
"alnum_prop": 0.7835051546391752,
"repo_name": "davidsminor/gaffer",
"id": "1acfb8ab0a0a31b3228014dfc26f210099b63588",
"size": "2073",
"binar... |
import os
import csv
import requests
from datetime import datetime
import simplejson as json
import platform
import base64
import ohmysportsfeedspy
from ohmysportsfeedspy.v1_0 import API_v1_0
# API class for dealing with v2.0 of the API
class API_v2_0(API_v1_0):
# Constructor
def __init__(self, verbose, sto... | {
"content_hash": "4b9a318474cc25ada0b6f4261cc8aed2",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 190,
"avg_line_length": 49.17272727272727,
"alnum_prop": 0.6070438158624515,
"repo_name": "MySportsFeeds/mysportsfeeds-python",
"id": "ac59d74bbfe59ac799e7a74914cedd5035f1b2... |
from __future__ import absolute_import
import six
from sentry.testutils import APITestCase
class CloudflareMetadataTest(APITestCase):
def test_simple(self):
user = self.create_user(email="a@example.com")
self.login_as(user=user)
resp = self.client.get("/extensions/cloudflare/metadata/"... | {
"content_hash": "929fa7a29ccd739919fe326a79be53a3",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 81,
"avg_line_length": 26.714285714285715,
"alnum_prop": 0.6256684491978609,
"repo_name": "beeftornado/sentry",
"id": "834bfec1bcd6bfebbcd145edbcb9b91f3d411163",
"size": "5... |
"""
Handles link keys that are used to give anonymous users elevated privileges. These can be used for different things
and should be tied to the user it should be used by. These keys should be temporary.
"""
from django.db import models
from django.contrib import admin
from django.contrib.auth.models import U... | {
"content_hash": "7cb0221860e0501780e6ecf3f6e91059",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 119,
"avg_line_length": 35.83076923076923,
"alnum_prop": 0.6749677973379132,
"repo_name": "andrewsosa/hackfsu_com",
"id": "25acfaab03fea8c8c147ee85cdd644a8dc41239b",
"size"... |
""" Tests for the CLI """
import shutil
import tempfile
from future.moves.urllib.parse import urlparse
from io import StringIO
from mock import patch
from dql.cli import repl_command, DQLClient
try:
import unittest2 as unittest # pylint: disable=F0401
except ImportError:
import unittest
class TestCli(unit... | {
"content_hash": "2d27d6a7cde8e15b865d428e3c9bb9a9",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 81,
"avg_line_length": 32.30882352941177,
"alnum_prop": 0.6026399635867091,
"repo_name": "mathcamp/dql",
"id": "59578043f2a164cc14a3e8b4546c821607885897",
"size": "2197",
... |
"""The tests for the Demo lock platform."""
import unittest
from homeassistant.setup import setup_component
from homeassistant.components import lock
from tests.common import get_test_home_assistant, mock_service
FRONT = 'lock.front_door'
KITCHEN = 'lock.kitchen_door'
OPENABLE_LOCK = 'lock.openable_lock'
class Test... | {
"content_hash": "f941d09e7ee3e8367776117cba9272c5",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 71,
"avg_line_length": 32.107142857142854,
"alnum_prop": 0.6312569521690767,
"repo_name": "persandstrom/home-assistant",
"id": "500cc7f9a6a671efe26f877aff21093e739a1076",
"... |
"""
Revision ID: 0254_folders_for_all
Revises: 0253_set_template_postage
Create Date: 2019-01-08 13:30:48.694881+00
"""
from alembic import op
revision = "0254_folders_for_all"
down_revision = "0253_set_template_postage"
def upgrade():
op.execute(
"""
INSERT INTO
service_permissions... | {
"content_hash": "49f13775b0ca105b326cfb2ca2137bfd",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 68,
"avg_line_length": 20.487179487179485,
"alnum_prop": 0.5081351689612015,
"repo_name": "alphagov/notifications-api",
"id": "419901a567d76e2a6a2323d9a087c86f9d2ddf56",
"s... |
import sys
import os
import shlex
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
# --... | {
"content_hash": "919028d58a3ff00c1f33710f5913d32d",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 89,
"avg_line_length": 31.22222222222222,
"alnum_prop": 0.6578546009150992,
"repo_name": "OmkarPathak/pygorithm",
"id": "03d9da55fc43832c3f04139340d599efe6489cb0",
"size": ... |
from io import BytesIO
import PyPDF2 as pyPdf
import scrapy
from ..spiders.CustomSpider import CustomSpider
class PDFSpider(CustomSpider):
"""
This scraper can download files that are linked from a PDF. It will extract
every single link from the PDF and yield a PageItem for each PDF, with the
links... | {
"content_hash": "f85c3bdd7fa2f4cf0768be8db11c846d",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 80,
"avg_line_length": 30.90909090909091,
"alnum_prop": 0.538235294117647,
"repo_name": "opensyllabus/osp-scraper",
"id": "411c1bab05e67e5a3d37d740579dc6a5229d0b78",
"size"... |
from __future__ import unicode_literals
from django.contrib.admin.tests import AdminSeleniumWebDriverTestCase
from django.contrib.admin.helpers import InlineAdminForm
from django.contrib.auth.models import User, Permission
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from... | {
"content_hash": "a5afdf216c2f2caecbcf4ce135ccb2f2",
"timestamp": "",
"source": "github",
"line_count": 702,
"max_line_length": 233,
"avg_line_length": 52.30911680911681,
"alnum_prop": 0.6526783039677568,
"repo_name": "ericholscher/django",
"id": "2d0a7edd10abd6c1765439724dc05751ca811083",
"size": ... |
from UI import UI
from page import Page
import time
display = UI ()
illustrations = [
"test_bookpage1.png",
"test_bookpage2.png",
"test_bookpage3.png",
"test_bookpage4.png"
]
raw_pages = [
"One fish",
"two fish",
"red fish",
"blue fish",
"Hello, this is some test text.",
"This... | {
"content_hash": "a650c1d69344518aaff85bbf96ede0eb",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 100,
"avg_line_length": 22.6,
"alnum_prop": 0.5786249149081008,
"repo_name": "Max-E/CS361-Reading-App",
"id": "91168f4adf0560094e4753d9ca3f5d84b870e3c2",
"size": "1469",
... |
import os
import platform
import sys
import unittest
from contextlib import contextmanager
from io import StringIO
from swift_build_support.swift_build_support import migration
from swift_build_support.swift_build_support.SwiftBuildSupport import (
get_all_preset_names,
get_preset_options,
)
from . import exp... | {
"content_hash": "35c8e6c94ee3510baff82743fa11c1cb",
"timestamp": "",
"source": "github",
"line_count": 733,
"max_line_length": 79,
"avg_line_length": 39.282401091405184,
"alnum_prop": 0.603459053969577,
"repo_name": "lorentey/swift",
"id": "a93f412631b5db960ca7347ef4f4332cd54c9df3",
"size": "29140... |
from datetime import datetime
from unittest import mock
from django.core.urlresolvers import reverse
from django.utils.timezone import make_aware
from django_webtest import WebTest
from testing.common import make_user, login_user
from apps.links.models import Link
class LinkTest(WebTest):
def setUp(self):
... | {
"content_hash": "2c6423badc1d8f55c552cba9dcb67017",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 79,
"avg_line_length": 36.83396226415094,
"alnum_prop": 0.5889765392890073,
"repo_name": "dstl/lighthouse",
"id": "58ae98c301b82a77c1276639c41c209f35963ed5",
"size": "9803... |
from __future__ import absolute_import
import httplib
import functools
import flask
from flask.ext.login import current_user
from guardrail.core import decorators
from guardrail.ext.sqlalchemy import SqlalchemyLoader
from guardrail.ext.sqlalchemy import SqlalchemyPermissionManager
import models
manager = Sqlalchem... | {
"content_hash": "d831f385165d5bf8c57c49f527123e96",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 75,
"avg_line_length": 26.263157894736842,
"alnum_prop": 0.7775551102204409,
"repo_name": "jmcarp/guardrail",
"id": "112c92e227306198144b348fa194a6d3e17c4d4e",
"size": "102... |
'''Multithreading Bottle server adapter.'''
import bottle
import mtwsgi
class MTServer(bottle.ServerAdapter):
def run(self, handler):
thread_count = self.options.pop('thread_count', None)
server = mtwsgi.make_server(self.host, self.port, handler, thread_count, **self.options)
server.serve_... | {
"content_hash": "c25d2c4724c40e7dd0dbea3e05408515",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 96,
"avg_line_length": 22.766666666666666,
"alnum_prop": 0.6134699853587116,
"repo_name": "RonRothman/mtwsgi",
"id": "affdb2d4e6da84ebf0c60963fde32b38a03f3084",
"size": "68... |
"""sqlalchemy.orm.interfaces.LoaderStrategy
implementations, and related MapperOptions."""
from .. import exc as sa_exc, inspect
from .. import util, log, event
from ..sql import util as sql_util, visitors
from .. import sql
from . import (
attributes, interfaces, exc as orm_exc, loading,
unitofwork, util a... | {
"content_hash": "1217ce62b03a74d6eb498d4a9ef1ecf0",
"timestamp": "",
"source": "github",
"line_count": 1708,
"max_line_length": 81,
"avg_line_length": 36.38875878220141,
"alnum_prop": 0.5657098725704723,
"repo_name": "israeleriston/scientific-week",
"id": "d35b956875cfde9e0c5fb73b4cb7d91ed889dbec",
... |
from django.contrib import admin
from .models import Profile
class ProfileAdmin(admin.ModelAdmin):
search_fields = ('user__username', 'user__first_name', 'user__last_name', 'user__email')
list_display = ('__str__', 'is_pending', 'is_confirmed')
list_filter = ('is_pending', 'is_confirmed', 'user__is_staff... | {
"content_hash": "98aeb18c2e6fa3fad5ba55b330d79d37",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 92,
"avg_line_length": 33.23076923076923,
"alnum_prop": 0.6759259259259259,
"repo_name": "aipescience/django-daiquiri",
"id": "4fdccb3e8322cb50a7767f9092299e05e4cf5972",
"s... |
import importlib
import inspect
import sys
import re
import libcloud
"""
import cherrypy
class server( object ):
def index( self ):
return "HI"
index.exposed = True
cherrypy.quickstart( server() )
"""
def get_argspecs( what ):
"""
Iterate through the particular drivers.
what can currently be
'compute'
'... | {
"content_hash": "ee8bd3d181e5020d1be4d3e7b6b34832",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 91,
"avg_line_length": 22.483870967741936,
"alnum_prop": 0.6642754662840746,
"repo_name": "robertkeizer/cloud-gui",
"id": "092a49a40159b6751ad4536425133e3e7225c5c5",
"size"... |
""" Global tasks.
:copyright: Copyright (c) 2014 Bivio Software, Inc. All Rights Reserved.
:license: Apache, see LICENSE for more details.
"""
import werkzeug
import flask
from . import oauth
from .. import controller
from ..auth import model as pam
from . import model as pgm
class General(controller.Task)... | {
"content_hash": "9320e1d8680878d7f2b9634555bfbb22",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 77,
"avg_line_length": 30.45,
"alnum_prop": 0.6164203612479474,
"repo_name": "biviosoftware/publicprize",
"id": "1932091d4c729d953beb11811a81a126aa46781d",
"size": "3069",... |
'''
New Integration Test for Multi-ISO.
@author: Legion
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import time
test_obj_dict = test_state.TestStateDict()
test_stub = test_lib.lib_get_test_stub()
multi_iso = test_st... | {
"content_hash": "6f4214b81a874e4823d1936474e28bab",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 52,
"avg_line_length": 27.634146341463413,
"alnum_prop": 0.703442188879082,
"repo_name": "zstackorg/zstack-woodpecker",
"id": "3fbe0628c1c1b5f5b60524015a809775a4a44362",
"s... |
from django.conf.urls import patterns, url, include
from api import views
urlpatterns = patterns(
'',
url(r'^', include(views.router.urls)),
)
| {
"content_hash": "47b1f5e3ba2d6decb7b4271d15b3fd16",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 51,
"avg_line_length": 17.11111111111111,
"alnum_prop": 0.6818181818181818,
"repo_name": "msluis/stage-assistant",
"id": "b6bdaca0ec4c42cf1fe76c13f7c6cadb8360d632",
"size": ... |
"""
Make this module itself executable as an alias for invoke.
"""
import sys
import subprocess
cmd = ['invoke']
if len(sys.argv) == 1:
cmd.append('help')
else:
cmd.extend(sys.argv[1:])
subprocess.check_call(cmd)
| {
"content_hash": "b0e60ca5ae45afdab1170b3b0f4eb44a",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 58,
"avg_line_length": 16,
"alnum_prop": 0.6741071428571429,
"repo_name": "jrversteegh/flexx",
"id": "523ac42185c6933b1211925a5f21b08ff4b931c2",
"size": "224",
"binary": ... |
"""Benchmark for KPL implementation of vocabulary columns from lists with dense
inputs."""
import tensorflow.compat.v2 as tf
import keras
from keras.layers.preprocessing import string_lookup
from keras.layers.preprocessing.benchmarks import (
feature_column_benchmark as fc_bm,
)
# isort: off
from tensorflow.pyth... | {
"content_hash": "40b39748f7b02032333966a9777aa166",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 80,
"avg_line_length": 29.72222222222222,
"alnum_prop": 0.6616822429906543,
"repo_name": "keras-team/keras",
"id": "eb455a8e52bc4bd2727211d56d1b181318f0bed7",
"size": "2829... |
from stream_framework.tests.feeds.base import TestBaseFeed, implementation
import pytest
from stream_framework.feeds.cassandra import CassandraFeed
from stream_framework.utils import datetime_to_epoch
from stream_framework.activity import Activity
class CustomActivity(Activity):
@property
def serialization_i... | {
"content_hash": "073c584bf2b2c74f55ca452b90d884c5",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 77,
"avg_line_length": 30.446153846153845,
"alnum_prop": 0.6705406771096514,
"repo_name": "turbolabtech/Stream-Framework",
"id": "f5ec0d89ca54c3ae238a658bb6aeec1f08e53772",
... |
"""
Most descriptor compounds selection
"""
# Author: Giuseppe Marco Randazzo gmrandazzo@gmail.com
# License: BSD 3 clause
from numpy import zeros, array
class MDC(object):
"""Perform Most-Descriptor-Compound object selection
Parameters
----------
dmx : array, shape(row,row)
A square distance... | {
"content_hash": "0a9b67b564c1037dffffbdb5e9f01e68",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 75,
"avg_line_length": 27.764705882352942,
"alnum_prop": 0.4905838041431262,
"repo_name": "zeld/scikit-optobj",
"id": "f40c275987990aeffec93533a105aa70976053aa",
"size": "... |
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
from numpy.distutils.system_info import get_info
config = Configuration('blas',parent_package,top_path)
config.add_sconscript('SConstruct')
config.add_data_dir('tests')
return config
if __... | {
"content_hash": "4d143fea82c348deb9f7c6a6d38a6f71",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 58,
"avg_line_length": 31,
"alnum_prop": 0.7027649769585254,
"repo_name": "teoliphant/scipy",
"id": "2df548879738e2f2835fac16c1657415291ad3a5",
"size": "457",
"binary": f... |
"""RegisterValidator example."""
import gflags
FLAGS = gflags.FLAGS
gflags.DEFINE_integer('my_version', 0, 'Version number.')
gflags.DEFINE_string('filename', None, 'Input file name', short_name='f')
gflags.RegisterValidator('my_version',
lambda value: value % 2 == 0,
... | {
"content_hash": "a8214a6467c830f4ac438d5cfb837e0d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 73,
"avg_line_length": 31.23076923076923,
"alnum_prop": 0.6477832512315271,
"repo_name": "gsutil-mirrors/python-gflags",
"id": "2bef217d284d0553fabf033109d68c7705036e48",
"... |
"""Parser for MacOS utmpx files."""
import os
from dfdatetime import posix_time as dfdatetime_posix_time
from plaso.containers import events
from plaso.lib import definitions
from plaso.lib import dtfabric_helper
from plaso.lib import errors
from plaso.lib import specification
from plaso.parsers import interface
fro... | {
"content_hash": "3337e1e21347f24008d6576ae72fadd9",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 79,
"avg_line_length": 30.804123711340207,
"alnum_prop": 0.6825635876840697,
"repo_name": "joachimmetz/plaso",
"id": "e49b8338f8b288197bae8fe51aef9caa1dd6dcfa",
"size": "6... |
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.core.exceptions import ObjectDoesNotExist
class Migration(DataMigration):
def forwards(self, orm):
for i in orm.Item.objects.all():
try:
i.status.get(name='Verifi... | {
"content_hash": "6794e3789ad22a02caaad348838fe119",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 182,
"avg_line_length": 67.70224719101124,
"alnum_prop": 0.5396232677786076,
"repo_name": "abztrakt/labtracker",
"id": "7eadbc8033112b3e2e5fc04b4069130d48584b07",
"size": ... |
import _plotly_utils.basevalidators
class DtickValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(
self, plotly_name="dtick", parent_name="parcats.line.colorbar", **kwargs
):
super(DtickValidator, self).__init__(
plotly_name=plotly_name,
parent_name=pare... | {
"content_hash": "b3553a4fb92adac554ee5a70812cd2d6",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 80,
"avg_line_length": 35.714285714285715,
"alnum_prop": 0.604,
"repo_name": "plotly/plotly.py",
"id": "b747c42782a9cc98ee291dca99264e3c43199442",
"size": "500",
"binary"... |
import unittest
import threading
import tempfile
import shutil
from electrum_ltc import constants
# Set this locally to make the test suite run faster.
# If set, unit tests that would normally test functions with multiple implementations,
# will only be run once, using the fastest implementation.
# e.g. libsecp256k1... | {
"content_hash": "72b5911cd7343be0314bd9695ac6f755",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 86,
"avg_line_length": 23.346153846153847,
"alnum_prop": 0.6861614497528831,
"repo_name": "vialectrum/vialectrum",
"id": "6e26471e7970c5214f9c06794c13c66f7b019325",
"size":... |
from __future__ import absolute_import, print_function
import collections
import copy
import os
import sys
from contextlib import contextmanager
from distutils.sysconfig import get_python_lib
import attr
import pip_shims
import six
from cached_property import cached_property
from packaging.markers import Marker
from ... | {
"content_hash": "0d9a6d702be10064d0459abe79f93a20",
"timestamp": "",
"source": "github",
"line_count": 3158,
"max_line_length": 113,
"avg_line_length": 38.027232425585815,
"alnum_prop": 0.5503122658006495,
"repo_name": "kennethreitz/pipenv",
"id": "6831a7c8305213711d9051fb666b339c2a841c58",
"size"... |
import os
import argparse
import sys
import gzip
from pathlib import Path
import json
import pandas as pd
from tqdm import tqdm
import pydicom
parser = argparse.ArgumentParser(description='Extract meta-data from DICOMs')
parser.add_argument('--data', '-d',
default='./files',
h... | {
"content_hash": "daaf58e9d13e9a2bd0e9f0f2cad4ba80",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 80,
"avg_line_length": 33.76190476190476,
"alnum_prop": 0.5202750352609309,
"repo_name": "MIT-LCP/mimic-code",
"id": "4feece53bb705d9d34cee58d19e0e701db7991b3",
"size": "5... |
"""End to end tests for lib.flows.general.registry."""
import os
from grr.endtoend_tests import base
from grr.lib import aff4
from grr.lib import data_store
from grr.lib import flow_utils
from grr.lib import rdfvalue
from grr.lib import utils
from grr.lib.flows.console import debugging
class TestFindWindowsRegistry... | {
"content_hash": "f454d92bff37d3b3ee800df9e907be60",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 80,
"avg_line_length": 35.26373626373626,
"alnum_prop": 0.6653162979121221,
"repo_name": "bgalehouse/grr",
"id": "c5e8d18c6a530e67c4b874788152d8b920155b5f",
"size": "3231",... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('tests', '0006_image_file_size'),
]
operations = [
migrations.CreateModel(
name='SingleEventPage',
fields=[
(... | {
"content_hash": "da952f47f3f3eb978bcc78e753fb9c56",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 85,
"avg_line_length": 27.63157894736842,
"alnum_prop": 0.3904761904761905,
"repo_name": "serzans/wagtail",
"id": "26279e569ad92d48e3ac9f6210ef7b7cb642e260",
"size": "1074"... |
import os
import pytest
from .utils import *
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), "../../samples/x-dns-peering")
@pytest.fixture(scope="module")
def resources(recursive_plan_runner):
_, resources = recursive_plan_runner(
FIXTURES_DIR,
tf_var_file=os.path.join(FIXTURES_DIR, "x-de... | {
"content_hash": "d4a60e5562d047b3f4f84582a41377f8",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 87,
"avg_line_length": 28.464285714285715,
"alnum_prop": 0.6693851944792973,
"repo_name": "apigee/terraform-modules",
"id": "3a11d8c347d359c1ad75aa0508472e10550bc356",
"siz... |
"""
Implementation of "clone" + "promote" functionality.
Cloning creates a copy of a trove on a related branch, with the only link
back to the original branch being through the "clonedFrom" link.
"""
# NOTE FOR READING THE CODE: creating the copy is easy. It's determining
# whether or not the clone is necessary that ... | {
"content_hash": "6dd6df35d9771616c1dfb721a4eb150d",
"timestamp": "",
"source": "github",
"line_count": 1725,
"max_line_length": 163,
"avg_line_length": 44.01623188405797,
"alnum_prop": 0.5612949109682858,
"repo_name": "fedora-conary/conary",
"id": "a1716eb14771451ff36e4b177ec6c1bae5afed46",
"size"... |
from fabric.api import env, local
env.hosts = ['localhost']
def npm_install():
"""Correctly runs npm install"""
local('cp node.json package.json')
local('npm install')
local('rm package.json')
def test():
"""Run tests with coverage"""
local('nosetests --with-coverage --cover-package=standu... | {
"content_hash": "909530c161e382a838b35e55b63fd80f",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 62,
"avg_line_length": 20.88235294117647,
"alnum_prop": 0.6338028169014085,
"repo_name": "rlr/standup",
"id": "7cd23c5d488fb6645aa621eda37ae36c6056dd84",
"size": "355",
"... |
import unittest
from conans.test.utils.tools import TestClient
from conans.test.utils.python_test_files import py_hello_conan_files
import platform
class PythonDiamondTest(unittest.TestCase):
def setUp(self):
self.client = TestClient()
def _export_upload(self, name, version=None, deps=None):
... | {
"content_hash": "505cc5d14c2d1ccbf7ad2de5829201cd",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 94,
"avg_line_length": 47.208333333333336,
"alnum_prop": 0.5962047661076787,
"repo_name": "mropert/conan",
"id": "120639ae477bb13e42bcfa52a31c2810eabe0fa1",
"size": "2266",... |
from .cipher_block_chaining import CBC_decrypt
from .counter import CTR_decrypt
from .electronic_codebook import ECB_decrypt
| {
"content_hash": "c4d36dad14c1695a7f335f800982b877",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 46,
"avg_line_length": 41.666666666666664,
"alnum_prop": 0.832,
"repo_name": "mamikonyana/cryptotools",
"id": "c2b8fd937ba5d3f854910b7d41e35be089eb9ac5",
"size": "125",
"b... |
from __future__ import absolute_import, division, print_function, unicode_literals
from h2o.estimators.estimator_base import H2OEstimator
from h2o.exceptions import H2OValueError
from h2o.frame import H2OFrame
from h2o.utils.typechecks import assert_is_type, Enum, numeric
class H2ORandomForestEstimator(H2OEstimator)... | {
"content_hash": "c6b16af4762ed39e12dec15c49d9899d",
"timestamp": "",
"source": "github",
"line_count": 749,
"max_line_length": 189,
"avg_line_length": 32.81842456608812,
"alnum_prop": 0.6096578658313332,
"repo_name": "spennihana/h2o-3",
"id": "e468813a81db713acd9613da374db37d47713336",
"size": "24... |
"""
pyClanSphere.plugins.gamesquad.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Forms we gonna need to handle creation and editing of entries
:copyright: (c) 2009 - 2010 by the pyClanSphere Team,
see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from pyC... | {
"content_hash": "76b86dc4badec41a37e91a7fe53ce6b4",
"timestamp": "",
"source": "github",
"line_count": 423,
"max_line_length": 109,
"avg_line_length": 37.061465721040186,
"alnum_prop": 0.5988390635963513,
"repo_name": "jokey2k/pyClanSphere",
"id": "3bf41b451c6181daf78b1bf6ad75099b92a4a0af",
"size"... |
from nose.tools import *
from dateutil.parser import parse as time_parse
import yawhois
class TestWhoisAscioComStatusAvailable(object):
def setUp(self):
fixture_path = "spec/fixtures/responses/whois.ascio.com/status_available.txt"
host = "whois.ascio.com"
part = yawhois.rec... | {
"content_hash": "6bc1a86300f5b85bcaf83d2f24d1cab2",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 85,
"avg_line_length": 31.185185185185187,
"alnum_prop": 0.6276722090261283,
"repo_name": "huyphan/pyyawhois",
"id": "2c47dbafc21250b64edc6c7c3311e9939d0f6743",
"size": "19... |
class PebkacError(RuntimeError):
"""An error that was caused by a misconfiguration or error in a snippet,
i.e. caused by the user. Hence: "Problem exists between keyboard and
chair".
"""
pass
| {
"content_hash": "93e084a4f14b371b9cedc26af270ea14",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 76,
"avg_line_length": 30.428571428571427,
"alnum_prop": 0.6854460093896714,
"repo_name": "khatchad/vimrc",
"id": "2a43d252e7e27117a1c6786246e9618c295264b6",
"size": "255",
... |
GstreamerPackage ('gstreamer', 'gst-plugins-bad', '0.10.23', configure_flags = [
' --disable-gtk-doc',
' --with-plugins=quicktime',
' --disable-apexsink',
' --disable-bz2',
' --disable-metadata',
' --disable-oss4',
' --disable-theoradec'
])
| {
"content_hash": "6b3f347756831051efa2ee9c1d1ff348",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 80,
"avg_line_length": 27.555555555555557,
"alnum_prop": 0.6330645161290323,
"repo_name": "BansheeMediaPlayer/bockbuild",
"id": "7bd6b10ce7f00f850a64373d069aeb47c96fc5f3",
"... |
class AbstractConnection:
"""An abstract connection to send and receive data
This is used to abstract the underlying communication stream from the
implementation of the miniSSL protocol.
"""
def __init__(self):
self._close_handler = None
self._receive_handler = None
self.is... | {
"content_hash": "d4c31db7d000cdb1a6cd5b946719c7b5",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 79,
"avg_line_length": 29.573529411764707,
"alnum_prop": 0.6116360019890602,
"repo_name": "vsaw/miniSSL",
"id": "773dcf2f7e82be1a07f1c31bca9f827cb2ed4e23",
"size": "2011",
... |
"""BR-specific Form helpers."""
from __future__ import unicode_literals
import re
import warnings
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import CharField, Field, RegexField, Select
from django.utils.encoding import force_text
from django.util... | {
"content_hash": "3db91489917cd8e8b6716225e462dbc3",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 115,
"avg_line_length": 35.71653543307087,
"alnum_prop": 0.6083553791887125,
"repo_name": "jieter/django-localflavor",
"id": "6a52db474f454c7d619cb9634235baf7557a80d9",
"s... |
"""Dynamic Imaging of Coherent Sources (DICS)."""
# Authors: Marijn van Vliet <w.m.vanvliet@gmail.com>
# Britta Westner <britta.wstnr@gmail.com>
# Susanna Aro <susanna.aro@aalto.fi>
# Roman Goj <roman.goj@gmail.com>
#
# License: BSD-3-Clause
import numpy as np
from ..channels import equaliz... | {
"content_hash": "8f5f361315fc5874acb5dd6fc609883d",
"timestamp": "",
"source": "github",
"line_count": 573,
"max_line_length": 86,
"avg_line_length": 37.78359511343805,
"alnum_prop": 0.6145034642032332,
"repo_name": "mne-tools/mne-python",
"id": "ec9937968fb02577e9913b1283e86f7ae9f6b277",
"size": ... |
import sys
from pip._internal.utils.compatibility_tags import get_supported, version_info_to_nodot
from pip._internal.utils.misc import normalize_version_info
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from typing import List, Optional, Tuple
from pip._vendor.packaging.t... | {
"content_hash": "fa932a54e807eed1094aaa6eaebc66ed",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 87,
"avg_line_length": 34.78632478632478,
"alnum_prop": 0.5803439803439804,
"repo_name": "kimjinyong/i2nsf-framework",
"id": "4593dc854f89846cf9507f0d0035ae799def5d8d",
"s... |
import os
import time
def handle_headers(frame, request, response):
resource_url = request.GET.first(b"resource-url").decode()
link_header_value = "<{}>; rel=preload; as=script".format(resource_url)
early_hints = [
(b":status", b"103"),
(b"link", link_header_value),
]
response.write... | {
"content_hash": "243455349cfc5a7c83f6c730a26672e3",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 75,
"avg_line_length": 34.73076923076923,
"alnum_prop": 0.6334440753045404,
"repo_name": "nwjs/chromium.src",
"id": "0d05f2a3c57266ce183457b83dad020a4ce580fd",
"size": "903... |
import contextlib
import copy
import inspect
import logging
import mock
import six
import webob.exc as wexc
from neutron.api import extensions
from neutron.api.v2 import attributes
from neutron.api.v2 import base
from neutron.common import exceptions as n_exc
from neutron import context
from neutron.db import db_base... | {
"content_hash": "eaaf298bec5cfef0f712f2553bea21e9",
"timestamp": "",
"source": "github",
"line_count": 1171,
"max_line_length": 79,
"avg_line_length": 45.4466268146883,
"alnum_prop": 0.5709346461723477,
"repo_name": "subramani95/neutron",
"id": "4e7be3e873b626dcb0448e7edd396eb57a5eb448",
"size": "... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import os, sys
from six.moves import range
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import optparse
from datetime import timedelta, datetime
from zerver.lib.timestamp import datetime_t... | {
"content_hash": "31f9f77dd7dd4c4cfe524aa8a797acde",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 106,
"avg_line_length": 35.91566265060241,
"alnum_prop": 0.6071787990607179,
"repo_name": "Frouk/zulip",
"id": "1693ef39eba8e04b96c511aa6251cec050dd3e3d",
"size": "6054",
... |
"""
Provides a temporal matching function
"""
import numpy as np
from scipy.spatial import cKDTree
import pandas as pd
def df_match(reference, *args, **kwds):
"""
Finds temporal match between the reference pandas.DataFrame (index has to
be datetime) and n other pandas.DataFrame (index has t... | {
"content_hash": "97c0d107aa465c4734e202878c65b83a",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 107,
"avg_line_length": 39.30573248407644,
"alnum_prop": 0.5880732458272565,
"repo_name": "christophreimer/pytesmo",
"id": "33e50b17ee4e0aad6a529ba1e85ac0311ff614a4",
"siz... |
"""
Support for Nest Thermostat Sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.nest/
"""
from itertools import chain
import logging
import voluptuous as vol
from homeassistant.components.nest import DATA_NEST, DOMAIN
from homeassistant.... | {
"content_hash": "4c429d4a7b44a1d0681ad2b57e86afa5",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 79,
"avg_line_length": 31.4,
"alnum_prop": 0.5937898089171975,
"repo_name": "dmeulen/home-assistant",
"id": "53f767ab49454080cfb4e56e1a1d01acfcfb6c46",
"size": "6281",
"... |
try:
import unittest.mock as mock
except:
import mock
from twitter_tunes.scripts import twitter_bot
from twitter_tunes.tests import bot_test_vars
import pytest
def redis_side_effect(arg):
if arg == u'trends':
return bot_test_vars.REDIS_TRENDS
elif arg == u'last_tweets':
... | {
"content_hash": "3001e1cd238d85747af752662c547a9a",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 94,
"avg_line_length": 41.49557522123894,
"alnum_prop": 0.699616122840691,
"repo_name": "icarrera/twitter-tunes",
"id": "f021d921b44e6ead9db26f45d3ab19b27e4ea23d",
"size":... |
import os
from oslo_config import cfg
from toscaparser import tosca_template
import unittest
import yaml
from tacker.common import utils
from tacker.plugins.common import constants as evt_constants
from tacker.tests import constants
from tacker.tests.functional import base
from tacker.tests.utils import read_file
fr... | {
"content_hash": "68f012649943adf902a6ba9e3c7eadae",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 79,
"avg_line_length": 38.95145631067961,
"alnum_prop": 0.5837487537387837,
"repo_name": "zeinsteinz/tacker",
"id": "bfc14382fe34b1cf28d0b37c5a0921808fc0533a",
"size": "45... |
"""
SchedulerOptions monitors a local .json file for changes and loads
it if needed. This file is converted to a data structure and passed
into the filtering and weighing functions which can use it for
dynamic configuration.
"""
import datetime
import os
from oslo_log import log as logging
from oslo_serialization imp... | {
"content_hash": "e31f0f6336ffc041aae406a426ea178f",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 76,
"avg_line_length": 32.89156626506024,
"alnum_prop": 0.6267399267399267,
"repo_name": "HybridF5/jacket",
"id": "84412856b004d612582ac7032867e8e34ba283d8",
"size": "3370"... |
"""Adding additional return value handlers is easy."""
from web.core.response import register
class MyObject(object):
pass
def handler(context, result):
pass # do something to the context.response
class SampleExtension(object):
always = True # usually you don't want to be required to activate your ow... | {
"content_hash": "3845aaa473e45c60b6629fd9d6427881",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 89,
"avg_line_length": 27.833333333333332,
"alnum_prop": 0.6766467065868264,
"repo_name": "marrow/WebCore",
"id": "3365975d8980ba049109557659c84c527d0be4cf",
"size": "687",... |
import sys
import numpy as np
import scipy.ndimage.filters
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg
import imtools
from basename import get_basename
mkoutfilename = None
def test_corner_samples( upper_left, upper_right, lower_left, lower_right ) :
pass
de... | {
"content_hash": "9f555d78e4a3508776d6675305540df9",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 117,
"avg_line_length": 36.1578947368421,
"alnum_prop": 0.6501698204754973,
"repo_name": "linuxlizard/q60",
"id": "8df91d5e229034cf0be2b75aefbc6c150b017025",
"size": "4132... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configurat... | {
"content_hash": "7177b29dccf2d6df0d8061e4df5b06f0",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 93,
"avg_line_length": 32.9915611814346,
"alnum_prop": 0.693694845888221,
"repo_name": "casmlab/quac",
"id": "3251e9edab4681d9d751aaba54fc6d40d6e8e677",
"size": "8234",
... |
import re, sys, time, os
import functools as fu
import sublime, sublime_plugin
from copy import copy
from .lib.misc import *
from .lib import kill_ring
from .lib import isearch
import Default.paragraph as paragraph
from . import sbp_layout as ll
# repeatable commands
repeatable_cmds = set(['move', 'left_delete', 'ri... | {
"content_hash": "f55f7bad9d6ab15eb9c95ac3c3b77e6c",
"timestamp": "",
"source": "github",
"line_count": 1587,
"max_line_length": 151,
"avg_line_length": 38.253308128544425,
"alnum_prop": 0.5851617579231733,
"repo_name": "sublime-emacs/sublemacspro",
"id": "5db742cb5382128b743bb8d8e3dc72139cf2464f",
... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('Alexandria.views',
url(r'^admin/', include(admin.site.urls)),
url(r'dialog', 'publish_dialog'),
url(r'api/publish', 'publish'),
url(r'api/query`', 'query'),
url(r'api/request_authorization',... | {
"content_hash": "354381c14b97bd74360d9fc4c44f7f64",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 63,
"avg_line_length": 37.54545454545455,
"alnum_prop": 0.6924939467312349,
"repo_name": "priestc/Alexandria",
"id": "05891db6b2e9d47d79730c387353e465e53c119c",
"size": "41... |
import activate_venv
from veevutils import banner
from veevutils import parse_slide
import argparse
import glob
import os
import shutil
import sys
import textwrap
import fnmatch
import pyparsing as pp
import re
import eco
import concurrent.futures
def load_html_files(dir):
html_dict = {}
html_files = glob.glob(os... | {
"content_hash": "c7f249fa3b93a30884bc7412d357e5da",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 116,
"avg_line_length": 29.857142857142858,
"alnum_prop": 0.6966507177033493,
"repo_name": "drewsynan/VELVEEVA",
"id": "c0f043798d63999ab3641313b0813cf2a05e5126",
"size": ... |
from django.db import models
import secretballot
class Link(models.Model):
url = models.URLField()
secretballot.enable_voting_on(Link)
# used for testing field renames
class WeirdLink(models.Model):
url = models.URLField()
secretballot.enable_voting_on(WeirdLink,
votes_name='v... | {
"content_hash": "8307f8235190e046f58957271767c667",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 60,
"avg_line_length": 30.727272727272727,
"alnum_prop": 0.5088757396449705,
"repo_name": "eugena/django-secretballot",
"id": "f38575a8efe2424cc5c655e735508da89f0620ea",
"s... |
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 model 'Category'
db.create_table('finance_category', (
('object_ptr', self.gf('django.db.models.fields.related... | {
"content_hash": "e9ca37eea0b717dfbccd6d140495afb0",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 203,
"avg_line_length": 72.11076923076924,
"alnum_prop": 0.5596518177163339,
"repo_name": "hellfish2/treeio",
"id": "a64c95878d12332dc3b6a5e6fe5408a03a0673be",
"size": "23... |
class Duck :
'''A class to define Duck properties.'''
def talk( self ) :
print( '\nDuck Says: Quack!' )
def coat( self ) :
print( 'Duck Wears: Feathers' )
| {
"content_hash": "5838203ef2e936476d6699723b917f31",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 41,
"avg_line_length": 18.333333333333332,
"alnum_prop": 0.6060606060606061,
"repo_name": "shahjalalh/tutorials",
"id": "5f97c1d1733e8acf9b26a303f48455df07a4e6da",
"size": "... |
"""
Slack platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.slack/
"""
import logging
import voluptuous as vol
from homeassistant.components.notify import (
ATTR_TARGET, PLATFORM_SCHEMA, BaseNotificationService)
f... | {
"content_hash": "1c373a42e65554021fe1623c47882f1b",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 77,
"avg_line_length": 31.897727272727273,
"alnum_prop": 0.5920912005700035,
"repo_name": "morphis/home-assistant",
"id": "b9f33c95d43141bdde36b687dc5e15694bd71a0f",
"size"... |
def test_generator_fails_before_yield():
a = 1 // 0
yield lambda: True
def test_generator_fails_during_iteration():
for i in [1, 2, 3, 0, 5, 6]:
a = 1 // i
yield lambda: True
def test_ok():
pass
class TestBuggyGenerators(object):
def test_generator_fails_before_yield(self):
... | {
"content_hash": "9196ac19f2be031549462fb18f298a71",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 52,
"avg_line_length": 18.862068965517242,
"alnum_prop": 0.5484460694698354,
"repo_name": "dbbhattacharya/kitsune",
"id": "00e481533b0b1d3cb7bc36383e63363c25ae1728",
"size"... |
from django.contrib import admin
from phoneconfirmation.models import (
MessageTooLong,
PhoneCountryCode,
PhoneNumber,
PhoneConfirmation,
SMSLog
)
class SMSLogAdmin(admin.ModelAdmin):
list_display = ["number", "destination", "message", "mocked", "created", "response_code"]
list_filter = [... | {
"content_hash": "5a03e6ea2294ef3cbe89dc86c6c16432",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 93,
"avg_line_length": 25.88095238095238,
"alnum_prop": 0.6706531738730451,
"repo_name": "jawed123/pinax-phone-confirmation",
"id": "bb2c89d1f8c3511170798ed1f1b81ed14bdb04d7"... |
import os
from oslo_log import log as logging
from oslo_service import periodic_task
from trove.common import cfg
from trove.common import exception
from trove.common.i18n import _
from trove.common import instance as rd_ins
from trove.guestagent.datastore.experimental.vertica.service import (
VerticaAppStatus)
f... | {
"content_hash": "350b0dd2d868b4386933c5bb77b1597d",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 79,
"avg_line_length": 41.127272727272725,
"alnum_prop": 0.6501989389920424,
"repo_name": "fabian4/trove",
"id": "95848eb16e5056f2d52e3819b2729686c347d47c",
"size": "9650"... |
from __future__ import absolute_import, unicode_literals
from time import time
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.db.models import Count
from django.http import Http404, HttpResponse, Js... | {
"content_hash": "b66c6b4ebacd589e6dca12f63e4c26a7",
"timestamp": "",
"source": "github",
"line_count": 1124,
"max_line_length": 149,
"avg_line_length": 38.35231316725979,
"alnum_prop": 0.594182054375058,
"repo_name": "iansprice/wagtail",
"id": "b66efe5a1f582a3943704e5287360242bf8aae6d",
"size": "4... |
from __future__ import unicode_literals
from __future__ import absolute_import
import logging
from .service import Service
from .container import Container
from .packages.docker.errors import APIError
log = logging.getLogger(__name__)
def sort_service_dicts(services):
# Topological sort (Cormen/Tarjan algorithm... | {
"content_hash": "a9ae0550059e769e7065e244e2446f3c",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 183,
"avg_line_length": 36.851351351351354,
"alnum_prop": 0.5889255592225889,
"repo_name": "waynedovey/fig",
"id": "d0c556c487c9e149121450f1929dffb3482ef84e",
"size": "818... |
import numpy as np
from openpnm.utils import PrintableList
__all__ = [
'ParserMixin',
'LabelMixin',
]
class ParserMixin:
def _parse_indices(self, indices):
r"""
This private method accepts a list of pores or throats and returns a
properly structured Numpy array of indices.
... | {
"content_hash": "bfa5cbd78a5d6bf804bdcefb8ffbac55",
"timestamp": "",
"source": "github",
"line_count": 697,
"max_line_length": 87,
"avg_line_length": 41.67144906743185,
"alnum_prop": 0.4996040626613875,
"repo_name": "PMEAL/OpenPNM",
"id": "d77f1ed5fb848a4ddbc9977b61f43dd93e830c47",
"size": "29045"... |
import commands
import os
import random
import sys
import unittest
from nova.adminclient import NovaAdminClient
from nova.smoketests import flags
from nova import vendor
import paramiko
nova_admin = NovaAdminClient(access_key=flags.admin_access_key, secret_key=flags.admin_secret_key, clc_ip=host)
class NovaTestCase... | {
"content_hash": "6a12929520387810ea15e1da03e6b003",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 111,
"avg_line_length": 31.90740740740741,
"alnum_prop": 0.6137550783517122,
"repo_name": "sorenh/cc",
"id": "869e3194603e57dc2d3ef3802cc13de8a4a00407",
"size": "4257",
... |
from uzentropi import Agent, asyncio, on_timer, on_event, random_id
class EventDataExample(Agent):
@on_timer(2)
async def send_random_data(self):
await self.emit('some_stuff', value=random_id())
await asyncio.sleep(1)
await self.emit('more_stuff', value=random_id())
@on_event('som... | {
"content_hash": "1cb95ba38294235bf6f1b002fb151123",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 67,
"avg_line_length": 28.38095238095238,
"alnum_prop": 0.6375838926174496,
"repo_name": "zentropi/python-uzentropi",
"id": "4aa4e9415656aadfdd1efeda5a75c78150473a16",
"siz... |
import os
import uuid
import create_data_labeling_job_specialist_pool_sample
import pytest
import helpers
API_ENDPOINT = os.getenv("DATA_LABELING_API_ENDPOINT")
PROJECT_ID = os.getenv("BUILD_SPECIFIC_GCLOUD_PROJECT")
LOCATION = "us-central1"
DATASET_ID = "1905673553261363200"
SPECIALIST_POOL_ID = "589802666199508582... | {
"content_hash": "b37b55cceeffdaa9e566ac3a73a3e50e",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 112,
"avg_line_length": 34.12244897959184,
"alnum_prop": 0.7386363636363636,
"repo_name": "googleapis/python-aiplatform",
"id": "7ae76a05505577a841a87d66ce0d0bdebe58de52",
... |
from django.conf.urls import url
from .views import sendmail_list, sendmail_send, sendmail_view
urlpatterns = [
url(r'^$', sendmail_list, name='sendmail_list'),
url(r'^view/(?P<mail_uuid>[^/]+)/$', sendmail_view, name='sendmail_view'),
url(r'^send/$', sendmail_send, name='sendmail_send'),
]
| {
"content_hash": "bfeb2ff0e653e797b14f617cde5ac3fe",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 78,
"avg_line_length": 30.7,
"alnum_prop": 0.6579804560260586,
"repo_name": "CasualGaming/studlan",
"id": "83b2e86b3c79e44f65bc25de6b072782b4c9ed26",
"size": "333",
"bina... |
"""
Module containing weather forecast classes and data structures.
"""
import json
import xml.etree.ElementTree as ET
from pyowm.webapi25.xsd.xmlnsconfig import (
FORECAST_XMLNS_PREFIX, FORECAST_XMLNS_URL)
from pyowm.utils import timeformatutils, xmlutils
class ForecastIterator(object):
"""
Iterator ove... | {
"content_hash": "5446801702ecdbe5d1980fbc3e4ace9e",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 89,
"avg_line_length": 30.486486486486488,
"alnum_prop": 0.5849586288416075,
"repo_name": "mpvoss/RickAndMortyWeatherTweets",
"id": "52f35dede99a439ee441c6d60093b8323c789fe5... |
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 'UserProfile.username'
db.add_column(u'users_userprofile', 'username',
self.gf('django.db.model... | {
"content_hash": "b4bad6e5d8d362ec9fdad2089b31c06d",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 195,
"avg_line_length": 65.79452054794521,
"alnum_prop": 0.5565271705184259,
"repo_name": "KarryWang/SHTP",
"id": "e80dbed12a7e144ed10f9dd20f1a84ea20fefe07",
"size": "4827"... |
"""Integration platform for recorder."""
from __future__ import annotations
from homeassistant.const import ATTR_EDITABLE
from homeassistant.core import HomeAssistant, callback
from . import ATTR_MAX, ATTR_MIN, ATTR_MODE, ATTR_STEP
@callback
def exclude_attributes(hass: HomeAssistant) -> set[str]:
"""Exclude ed... | {
"content_hash": "4e68ce503804bfd9e1ab64ada14379fb",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 68,
"avg_line_length": 25.68421052631579,
"alnum_prop": 0.6823770491803278,
"repo_name": "w1ll1am23/home-assistant",
"id": "05a5023be0b19322826907f5d06f033a282a8760",
"size... |
import coverage
from django.core.exceptions import ImproperlyConfigured
try:
from discover_runner import DiscoverRunner
except (ImportError, ImproperlyConfigured):
from django.test.runner import DiscoverRunner
from discoverage.settings import (COVERAGE_OMIT_MODULES,
COVERAGE_... | {
"content_hash": "272fc2053a384d95e59581a575fdd77c",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 69,
"avg_line_length": 31.48,
"alnum_prop": 0.6385006353240152,
"repo_name": "ryankask/django-discoverage",
"id": "372edd37102195946be37d26bd4617ca5eb54c72",
"size": "1574"... |
"""
Utility functions used in other test files
"""
from __future__ import absolute_import
import os
import unittest
from digits.config import config_value
def skipIfNotFramework(framework):
"""
Raises SkipTest if DIGITS_TEST_FRAMEWORK is set
to something other than framework
"""
key = 'DIGITS_TE... | {
"content_hash": "9f7b489d2592ebe22e1320ebdc1811e5",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 78,
"avg_line_length": 26.057971014492754,
"alnum_prop": 0.6323692992213571,
"repo_name": "TimZaman/DIGITS",
"id": "fce564ceeebea4dd8c3e852825d9b7d07d86a02d",
"size": "1862... |
import Gaffer
import GafferArnold
Gaffer.Metadata.registerNode(
GafferArnold.ArnoldDisplacement,
"description",
"""
Creates displacements to be applied to meshes for
rendering in Arnold. A displacement consists of a
shader to provide the displacement map and several
attributes to control the height and other ... | {
"content_hash": "3fb55fa8ba7e2c42137f2f4144e4dc1e",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 92,
"avg_line_length": 22.513761467889907,
"alnum_prop": 0.69559902200489,
"repo_name": "johnhaddon/gaffer",
"id": "cefeba07f09e93b436d2289cc43f81248e11d244",
"size": "425... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.