text stringlengths 4 1.02M | meta dict |
|---|---|
"""Tests for jax3d.projects.nesf.nerfstatic.losses.losses."""
import jax
from jax import numpy as jnp
from jax3d.projects.nesf.nerfstatic.losses import losses
import numpy as np
import tensorflow as tf
def test_softmax_cross_entropy_loss():
labels = jnp.array([[0], [1], [2]], dtype=jnp.int32)
logits = jnp.array(... | {
"content_hash": "e7083203a69e1d5f55abdd85e81d8920",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 80,
"avg_line_length": 38.8235294117647,
"alnum_prop": 0.706060606060606,
"repo_name": "google-research/jax3d",
"id": "2f64fe79117af2c0ce1598d48d8501233f9e8fdc",
"size": "1... |
"""Beam DoFns and PTransforms to provide validation of user models."""
from __future__ import annotations
import datetime
from core import feconf
from core.jobs import job_utils
from core.jobs.decorators import validation_decorators
from core.jobs.transforms.validation import base_validation
from core.jobs.types imp... | {
"content_hash": "1135ec605b7934696f938816816f86fc",
"timestamp": "",
"source": "github",
"line_count": 472,
"max_line_length": 89,
"avg_line_length": 35.53389830508475,
"alnum_prop": 0.7133317433818268,
"repo_name": "oppia/oppia",
"id": "907c843021389dce97ec405f8482c4d566aad639",
"size": "17395",
... |
import platform
import pytest
import numpy as np
from ....io import fits
from . import FitsTestCase
from ....tests.helper import ignore_warnings
class TestUintFunctions(FitsTestCase):
@classmethod
def setup_class(cls):
cls.utypes = ('u2', 'u4', 'u8')
cls.utype_map = {'u2': np.uint16, 'u4': n... | {
"content_hash": "13174c8e54cfa3285d39374e7d3b24a9",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 91,
"avg_line_length": 43.357142857142854,
"alnum_prop": 0.5152388797364086,
"repo_name": "DougBurke/astropy",
"id": "6cbd08dc5a1ab1962a9c7f6556f6b68d2f95e7b1",
"size": "4... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class stock_move(osv.osv):
_inherit = 'stock.move'
_columns = {
'purchase_line_id': fields.many2one('purchase.order.line',
'Purchase Order Line', ondelete='set null', select=True,
readonly=True),
}
... | {
"content_hash": "257ef003532b10a43093501b0695ad67",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 179,
"avg_line_length": 55.581497797356825,
"alnum_prop": 0.5938812713006262,
"repo_name": "diogocs1/comps",
"id": "d62cbb5a43c77b8f6be499343f4011dbf892659c",
"size": "135... |
"""
Module to build dataframe of news articles from sqlite3 database.
"""
import os
import re
from urllib.parse import urlparse
import sqlite3
from contextlib import closing
from datetime import datetime
from typing import Optional
import pandas as pd
DB_FILE_NAME = os.path.join('fake_news', 'articles.db')
def get_u... | {
"content_hash": "c55500548a7d29c8b222f61476f8e292",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 68,
"avg_line_length": 32.19642857142857,
"alnum_prop": 0.634498058790904,
"repo_name": "bmassman/fake_news",
"id": "83ecb26c304f4ad15a56c95ccb20a07b26433758",
"size": "182... |
import boto3
from botocore.exceptions import ClientError
import sure # noqa # pylint: disable=unused-import
import botocore
import pytest
from moto import mock_ec2, mock_route53
@mock_route53
def test_create_hosted_zone():
conn = boto3.client("route53", region_name="us-east-1")
response = conn.create_host... | {
"content_hash": "b1c581c562bb49cf965cb2db3fdcf732",
"timestamp": "",
"source": "github",
"line_count": 1384,
"max_line_length": 107,
"avg_line_length": 34.86054913294798,
"alnum_prop": 0.5639936161833896,
"repo_name": "spulec/moto",
"id": "f8a0277a1aad2ea919d8b1a8c36a0b5ceb692ed0",
"size": "48247"... |
import json, jwt, random, string
from urlparse import urlparse
configfile = '/etc/jitsi/wazo.json'
class JitsiMeetService(object):
def get(self, arg):
configjson = self._read_config()
return self._generate_token(configjson)
def update(self, resource):
config = self._read_config()
... | {
"content_hash": "d21ad87c721f1a9f91b970b655de63dd",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 133,
"avg_line_length": 38.54716981132076,
"alnum_prop": 0.5883504650024474,
"repo_name": "Mickaelh51/wazo-admin-ui-jitsi-meet",
"id": "abf331082a2e5c7167645c596774ee16cefe1c... |
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(packages=['slaw_manipulation'],
package_dir={'': 'src'})
setup(**d)
| {
"content_hash": "daada2d408179b25a040698d7679f646",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 60,
"avg_line_length": 31.714285714285715,
"alnum_prop": 0.6576576576576577,
"repo_name": "smARTLab-liv/smartlabatwork-release",
"id": "0d05b44e70fa01179c0f973d9fd2fc441d88add... |
from pyvisdk.base.managed_object_types import ManagedObjectTypes
from pyvisdk.base.base_entity import BaseEntity
import logging
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
class View(BaseEntity):
'''... | {
"content_hash": "866f3b0c0e34e9814379d04a03a9c2ee",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 86,
"avg_line_length": 38.21621621621622,
"alnum_prop": 0.6810466760961811,
"repo_name": "xuru/pyvisdk",
"id": "85e466e91af7c5c1ccbe2cbd282ac88d5e679862",
"size": "1415",
... |
"""Beam data processing pipeline for AstroNet."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
from absl import app
from absl import flags
from absl import logging
import apache_beam as beam
import numpy as np
import pandas as pd
... | {
"content_hash": "8fddec20d2644b050aa6d6314ab0db1d",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 80,
"avg_line_length": 31.818930041152264,
"alnum_prop": 0.6412312467666839,
"repo_name": "google-research/exoplanet-ml",
"id": "92aa5a961cd8317853728d6ec306fc6c883c14e1",
... |
from muntjac.api import VerticalLayout, TextField, Button
from muntjac.ui.abstract_field import FocusShortcut
from muntjac.event.shortcut_action import KeyCode, ModifierKey
from muntjac.ui.button import IClickListener
class ShortcutBasicsExample(VerticalLayout):
def __init__(self):
super(ShortcutBasicsEx... | {
"content_hash": "b628c0f22e40c732140070c62b8972dc",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 76,
"avg_line_length": 36.51020408163265,
"alnum_prop": 0.6908887646730016,
"repo_name": "rwl/muntjac",
"id": "62fa9f048baeb448160243327ab23e25bb4aba2e",
"size": "1790",
... |
import pytest
import pyecore.ecore as Ecore
from pyecore.resources import *
from pyecore.resources.xmi import XMIResource, XMIOptions
from pyecore.resources.resource import HttpURI, Resource
from pyecore.utils import DynamicEPackage
from os import path
# Modified to it does not need an internet connection anymore
def... | {
"content_hash": "1c556486e5a1c0587bf5a8edf5fdc45d",
"timestamp": "",
"source": "github",
"line_count": 454,
"max_line_length": 103,
"avg_line_length": 34.47797356828194,
"alnum_prop": 0.6658148597712898,
"repo_name": "aranega/pyecore",
"id": "ad1339cd14d5d459bf2e44745b85bb03d520268a",
"size": "156... |
"""
This module provides decorator functions which can be applied to test objects
in order to skip those objects when certain conditions occur. A sample use case
is to detect if the platform is missing ``matplotlib``. If so, any test objects
which require ``matplotlib`` and decorated with ``@td.skip_if_no_mpl`` will be... | {
"content_hash": "0a0aca93dedd7c604949aef1a8c59556",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 88,
"avg_line_length": 28.43243243243243,
"alnum_prop": 0.6581511406844106,
"repo_name": "jorisvandenbossche/pandas",
"id": "b78f1652dc419c3daf366048e9caa55434f51b28",
"si... |
from csp import settings
from crowdsourcing import models
from rest_framework.views import APIView
from django.http import HttpResponse, HttpResponseRedirect
# TODO change this to support ajax requests, remove HttpResponseRedirect
class DropboxOauth(APIView):
"""
Handles the Dropbox Oauth2 integration
... | {
"content_hash": "77078ee50334b3048ade0d55579b7a55",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 108,
"avg_line_length": 47.69444444444444,
"alnum_prop": 0.6150262085032032,
"repo_name": "tanujs22/crowdsource-platform",
"id": "1051660a39feb7cdb6bb5a152a3428955e8d8da0",
... |
"""Etcd2 specific configuration."""
import os
import shutil
import server
class Etcd2Cluster(object):
"""Sets up a global or cell-local etcd cluster."""
def __init__(self, name):
import environment # pylint: disable=g-import-not-at-top
self.port_base = environment.reserve_ports(2)
self.name = na... | {
"content_hash": "b033220a36d7354e21ebf2408a4bfe61",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 75,
"avg_line_length": 29.36036036036036,
"alnum_prop": 0.610309911015649,
"repo_name": "derekstavis/bluntly",
"id": "510302783fab6d7cee3cc40ffca485cbe3913524",
"size": "3... |
from rest_framework import serializers
from qmpy.analysis.vasp import Calculation
class CalculationSerializer(serializers.ModelSerializer):
class Meta:
model = Calculation
fields = (
"id",
"entry",
"composition",
"path",
"label",
... | {
"content_hash": "def907c8b6bf6a7f1624aea5718a8741",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 60,
"avg_line_length": 23.652173913043477,
"alnum_prop": 0.5551470588235294,
"repo_name": "wolverton-research-group/qmpy",
"id": "8bf9ef4fe7f45bd50f6fbfb6bede5a3cf2b780ab",
... |
import sys, os, datetime
import alabaster
# 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.append(os.path.abspath('.'))
s... | {
"content_hash": "e0e849f0505f1819f3a58c83bbf4fb24",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 127,
"avg_line_length": 32.37455830388693,
"alnum_prop": 0.6906788910718183,
"repo_name": "bcrochet/eve",
"id": "f4245b4587ad1d474e1a4ce939008de512ec0954",
"size": "9576",... |
from nose.tools import *
from hamcrest import equal_to, assert_that
from tests.performanceplatform.collector.tools \
import temp_file, json_file, capture_stderr
from performanceplatform.collector.arguments import parse_args
class TestParseArgs(object):
def test_happy_path(self):
with json_file({}) as ... | {
"content_hash": "a40bd1dbd2291f3307a6112811b123bd",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 78,
"avg_line_length": 42.48780487804878,
"alnum_prop": 0.4618254879448909,
"repo_name": "alphagov/performanceplatform-collector",
"id": "0a7bf307729dee4a1849f7fc0515171f49be... |
"""
Support for Blink Home Camera System.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/blink/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import (CONF_USERNAME,
... | {
"content_hash": "c30e2f0b706638f61cef624f80fa89b9",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 79,
"avg_line_length": 32.03448275862069,
"alnum_prop": 0.6182274847506279,
"repo_name": "miniconfig/home-assistant",
"id": "2a079716b6820f97ff81227243111b7ce8d5bfe5",
"siz... |
import shutil
import os
import string_utils
# make directory if not exists and delete and make if exists
def make_directory_if_not_exists(path):
if os.path.exists(path):
shutil.rmtree(path)
os.makedirs(path)
else:
os.makedirs(path)
# returns "build/core/task/task.h"
def cpp_object_h... | {
"content_hash": "26cfbebc5efe87b113b0fc834d0e9209",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 76,
"avg_line_length": 29.4,
"alnum_prop": 0.6993197278911565,
"repo_name": "DaYeSquad/worktilerwdemo",
"id": "ea1ea2234c14ec14b7a99d902d57f32abfa9b4dc",
"size": "735",
"... |
"""Fixtures for Django DB related tests for AuditedModel"""
from datetime import datetime
from decimal import Decimal
from fixture import DataSet
__all__ = ['PilotData', 'VesselData']
class PilotData(DataSet):
"""Pilot fixtures for testing AuditedModel"""
class Meta:
django_model = "bsg.Pilot"
... | {
"content_hash": "abc5e8425bd1a7d12e43ca57e3378527",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 59,
"avg_line_length": 25.426666666666666,
"alnum_prop": 0.5264813843733613,
"repo_name": "rdkls/django-audit-mongodb",
"id": "5b15efa476fa26442629af96355d6ba9fdbcda55",
"s... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read().replace('.. :changelog:', '')
requirements = [
# TODO: put package re... | {
"content_hash": "588c2411303b4775817139fbfed69c24",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 103,
"avg_line_length": 29.74468085106383,
"alnum_prop": 0.617310443490701,
"repo_name": "nikhilkalige/flir",
"id": "afb1114d2ce093c3454655b2138dc4f27187e193",
"size": "144... |
"""Example running a parcel-based second-level analysis from a set of
first-level effect images.
This script takes as input a directory path that contains first-level
images in nifti format, as well as a group mask image and a
parcellation image (such as the AAL atlas, 'ROI_MNI_V4.nii', see
http://www.gin.cnrs.fr/spip... | {
"content_hash": "a85d3d6beee792b72e57854b1e59815d",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 76,
"avg_line_length": 37.706896551724135,
"alnum_prop": 0.716506630086877,
"repo_name": "arokem/nipy",
"id": "eff2950401ee5e6ebbc0a4e4c2e56e17f9c79822",
"size": "2323",
... |
import cStringIO
import functools
import multiprocessing
import optparse
import os
import re
import shutil
import subprocess
import sys
import common
import gold
import pngdiffer
import suppressor
class KeyboardInterruptError(Exception): pass
# Nomenclature:
# x_root - "x"
# x_filename - "x.ext"
# x_path - "pa... | {
"content_hash": "9bc6fdd3588cd43e3f192157c2795dc1",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 122,
"avg_line_length": 36.46590909090909,
"alnum_prop": 0.631141580970188,
"repo_name": "DrAlexx/pdfium",
"id": "6cd3a6c05abd7f569939ef7a8f8bf5b1cc551d36",
"size": "9810"... |
from yowsup.structs import ProtocolTreeNode
from .notification_contact import ContactNotificationProtocolEntity
class UpdateContactNotificationProtocolEntity(ContactNotificationProtocolEntity):
'''
<notification offline="0" id="{{NOTIFICATION_ID}}" notify="{{NOTIFY_NAME}}" type="contacts"
t="{{TIME... | {
"content_hash": "8f6fdcc431674fcf98a911f1fa41d5a7",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 109,
"avg_line_length": 43.166666666666664,
"alnum_prop": 0.6957528957528958,
"repo_name": "svub/whatsapp-rest-webservice",
"id": "7d9e7fbd6a5e0ff29853a111902049a3254e0dc3",
... |
from collections import defaultdict
import sys
input_filename = sys.argv[1]
with open(input_filename) as f:
input = f.read()
chips = defaultdict(list)
output = []
instructions = input.split('\n')
def reserve(lst, count):
while len(lst) < count:
lst.append(None)
while len(instructions) > 0:
for... | {
"content_hash": "5df6a72c72bc4fd1c515b87c81f8f342",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 53,
"avg_line_length": 25.10909090909091,
"alnum_prop": 0.4887762490948588,
"repo_name": "mofr/advent-of-code",
"id": "5e882d27027db6f376f04b751cf8a98b9484ad08",
"size": "1... |
from neutron_lib.api import extensions
EXTENDED_ATTRIBUTES_2_0 = {
'networks': {
'v2attrs:something': {'allow_post': False,
'allow_put': False,
'is_visible': True},
'v2attrs:something_else': {'allow_post': True,
... | {
"content_hash": "4c6094995d9f47e6cfb3d1b27fb813d2",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 70,
"avg_line_length": 27.90909090909091,
"alnum_prop": 0.5374592833876222,
"repo_name": "huntxu/neutron",
"id": "0c83e2c1b36d309c6fe7077db5d892ab3248acf5",
"size": "1512",... |
import unittest
class TestFoobar:
def test_can_be_automatically_documented(self):
pass
def test_is_a_singleton(self):
pass
class TestBazBar(unittest.TestCase):
def test_does_this_and_that(self):
pass
| {
"content_hash": "e82bd5e509f46f79edd4b857714bdea6",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 51,
"avg_line_length": 17.214285714285715,
"alnum_prop": 0.6639004149377593,
"repo_name": "simudream/spec",
"id": "473a49268ec403dab640a4770a2fc7d8e51aee7b",
"size": "241",... |
from django.contrib import admin
# Register your models here.
from .models import Provider, BillingCode, PatientVisit
admin.site.register(Provider)
admin.site.register(BillingCode)
admin.site.register(PatientVisit)
| {
"content_hash": "9fd329db91d37d6640fb6695c016cc10",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 55,
"avg_line_length": 24.22222222222222,
"alnum_prop": 0.8211009174311926,
"repo_name": "craighagan/rvumanager",
"id": "bb505178d4e5b0ce784d31c93c6e2406c7b220ab",
"size": "... |
import sys
import time
import pkg_resources
import Image
import tg
from pylons import c
from paste.deploy.converters import asint
from ming.orm import mapper, ThreadLocalORMSession, session, state, Mapper
from allura.command import base
import forgetracker.model
class RethumbCommand(base.Command):
min_args=1
... | {
"content_hash": "0a06331e3e8d10b49b52483467f265b2",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 160,
"avg_line_length": 41.470588235294116,
"alnum_prop": 0.5886524822695035,
"repo_name": "pombredanne/SourceForge-Allura",
"id": "90e1e67b8391d7995ff78582b7ee8f181283862d"... |
"""Chromium presubmit script for src/chrome/browser/sync.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit API built into gcl.
"""
def GetPreferredTryMasters(project, change):
return {
'tryserver.chromium': {
'linux_chromium_rel': set(['defaultt... | {
"content_hash": "fcae0f2b8d4ce9ef2f3d7070978b8faf",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 75,
"avg_line_length": 31.285714285714285,
"alnum_prop": 0.6894977168949772,
"repo_name": "patrickm/chromium.src",
"id": "715bb60322c5249c4e2574c6acdb1c5f675e4914",
"size":... |
from typing import Any, Dict, List
from urllib.parse import quote, urlsplit
from zerver.lib.topic import get_topic_from_message_info
from zerver.models import Realm, Stream, UserProfile
def hash_util_encode(string: str) -> str:
# Do the same encoding operation as hash_util.encodeHashComponent on the
# fronte... | {
"content_hash": "b835efd1d2a035a9d784d5711ec848df",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 95,
"avg_line_length": 31.257142857142856,
"alnum_prop": 0.6237050578915295,
"repo_name": "eeshangarg/zulip",
"id": "6767771318fd7f6dd3a6fe426a26ae7b0dffbd1a",
"size": "32... |
"""
tests/__init__.py
:copyright: (c) 2014 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
import unittest
import trytond.tests.test_tryton
from tests.test_views_depends import TestViewsDepends
from tests.test_party import TestCreditCard
def suite():
... | {
"content_hash": "f45e1955be102c1bc145e227b010c95b",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 74,
"avg_line_length": 26.115384615384617,
"alnum_prop": 0.6936671575846833,
"repo_name": "openlabs/nereid-payment-gateway",
"id": "e3fcf6d9e9fa05b7982019f243bd905dd1fa4c76",... |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'my1.views.home', name='home'),
# url(r'^my1/', include('my1.foo.urls')),
# Uncomment the... | {
"content_hash": "8bd8a1d16ee59998e444ea41e981e93d",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 71,
"avg_line_length": 32.05882352941177,
"alnum_prop": 0.673394495412844,
"repo_name": "praveenskumar/djangoapp",
"id": "00df1f3a808dbcb886d9621525101aa1f7a02be9",
"size":... |
import rospy
from sensor_msgs.msg import Joy
from geometry_msgs.msg import Twist
from std_msgs.msg import Float32
from std_msgs.msg import String
import serial
#import time
class OpenNav(object):
def __init__(self):
rospy.Subscriber("joy", Joy, self.callback)
self.pub = rospy.Publisher('/cmd_vel'... | {
"content_hash": "81746a2077ef801b5ffc26bdc13248a5",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 53,
"avg_line_length": 21.25,
"alnum_prop": 0.5686274509803921,
"repo_name": "Jailander/COSMOS",
"id": "98b186c6897f2dd2dc86c1911bafbe4d57b79c80",
"size": "789",
"binary"... |
import automate
from os.path import dirname, join, exists, realpath
from os import getcwd
# install or replace a automateserver.py in the current directory
server_fn = realpath(join(automate.__path__[0], "server.py"))
automateserver_fn = realpath(join(getcwd(), "automateserver.py"))
print("Install automateserver.py in... | {
"content_hash": "94b9258f2eeeee1d59c583f36429032f",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 66,
"avg_line_length": 40.5,
"alnum_prop": 0.7386831275720165,
"repo_name": "tito/automate",
"id": "6d6b9ed3459b3240f60e491367f8a21e69b08191",
"size": "502",
"binary": fa... |
"""
Handles all requests relating to transferring ownership of volumes.
"""
import hashlib
import hmac
import os
from oslo.config import cfg
from cinder.db import base
from cinder import exception
from cinder.i18n import _
from cinder.openstack.common import excutils
from cinder.openstack.common import log as loggi... | {
"content_hash": "f835260c805105f9e1a5b2844508076e",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 79,
"avg_line_length": 42.09,
"alnum_prop": 0.547992397244001,
"repo_name": "redhat-openstack/cinder",
"id": "6f98101620f457e25b649d516156b5f656a89c20",
"size": "9079",
... |
""" Utilities related to FRB galaxies"""
import os
import glob
from IPython import embed
from pkg_resources import resource_filename
import numpy as np
from scipy.interpolate import interp1d
import pandas
try:
from specdb.specdb import SpecDB
except ImportError:
flg_specdb = False
else:
flg_specdb = True... | {
"content_hash": "b789ce3b0cac028298713a91b775e34e",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 91,
"avg_line_length": 28.293650793650794,
"alnum_prop": 0.5967741935483871,
"repo_name": "FRBs/FRB",
"id": "7358e3bad7791f4f22d986d08bb5880a6e8f019d",
"size": "7130",
"... |
from pattern.web import Twitter
import indiocio
indicoio.config.api_key = 'f40bb2f1a1746e98919452261d38003a'
def get_tweets():
'''This function parses Twitter to find tweets about a user-defined political figure
'''
print 'This program measures the average sentiment of the populous towards a political candidate ... | {
"content_hash": "f1b5a488342a8a134f56b0309b76ec71",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 165,
"avg_line_length": 32.236559139784944,
"alnum_prop": 0.6924616410940627,
"repo_name": "brettkinson/SoftwareDesignFall15",
"id": "4a1a4fead9c7a0e1b31706e8c9f2ec4e63e6745e... |
from collections import namedtuple
from heapq import heappush, heappop
from itertools import cycle
import six
from six.moves import xrange, zip
from threading import Condition
import sys
from cassandra.cluster import ResultSet
import logging
log = logging.getLogger(__name__)
ExecutionResult = namedtuple('ExecutionR... | {
"content_hash": "a5dd1f4ee1c228077b0bad4a829e1325",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 171,
"avg_line_length": 40.07239819004525,
"alnum_prop": 0.627710027100271,
"repo_name": "coldeasy/python-driver",
"id": "204bef964bd318260c6cbd6ac23928bbe7774631",
"size"... |
"""
Sticky
-------
Python + IPython + D3
"""
from __future__ import print_function
from __future__ import division
import json
from uuid import uuid4
from IPython.core.display import display, Javascript
from IPython.html import widgets
from IPython.utils.traitlets import Unicode
from jinja2 import Environment, Pack... | {
"content_hash": "4c36e5f26f017ebf5cb5055c9bb26ced",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 63,
"avg_line_length": 27.17721518987342,
"alnum_prop": 0.6255239869585468,
"repo_name": "wrobstory/sticky",
"id": "21eb41bdb9a123369ace90e93eac45ad872c8110",
"size": "2171... |
"""Tests for the Windows preprocessor plugins."""
import unittest
from dfvfs.helpers import fake_file_system_builder
from dfvfs.lib import definitions as dfvfs_definitions
from dfvfs.path import factory as path_spec_factory
from plaso.containers import artifacts
from plaso.containers import sessions
from plaso.engin... | {
"content_hash": "c55cdb68d9bfa317dc3eb161039cd340",
"timestamp": "",
"source": "github",
"line_count": 721,
"max_line_length": 79,
"avg_line_length": 36.994452149791954,
"alnum_prop": 0.7500093727739662,
"repo_name": "log2timeline/plaso",
"id": "010c1f9d640ecd4c94beb9baed9824957e4d81d6",
"size": "... |
import math
from nltk import probability
def bag_of_words(words):
return dict([(word, True) for word in words])
def bag_of_words_in_set(words, wordset):
return bag_of_words(set(words) & wordset)
def word_counts(words):
return dict(probability.FreqDist((w for w in words)))
def word_counts_in_set(words, wordset):
... | {
"content_hash": "5697021957d36d7999e0a1425b604c34",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 74,
"avg_line_length": 29.666666666666668,
"alnum_prop": 0.726123595505618,
"repo_name": "VinACE/nltk-trainer",
"id": "f22e15f86454bcad68d2ef69f5c2fbba6674ce09",
"size": "7... |
from google.cloud import aiplatform_v1
def sample_list_training_pipelines():
# Create a client
client = aiplatform_v1.PipelineServiceClient()
# Initialize request argument(s)
request = aiplatform_v1.ListTrainingPipelinesRequest(
parent="parent_value",
)
# Make the request
page_re... | {
"content_hash": "060b1f6b7adf0dff18ecd99c7709fc9f",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 74,
"avg_line_length": 26.75,
"alnum_prop": 0.7233644859813084,
"repo_name": "googleapis/python-aiplatform",
"id": "aabeaf34b6967f499f36044a8884994b111194b4",
"size": "1944... |
"""Joint variant calling with multiple samples: aka squaring off, or backfilling.
Handles the N+1 problem of variant calling by combining and recalling samples
previously calling individually (or in smaller batches). Recalls at all positions found
variable in any of the input samples within each batch. Takes a general... | {
"content_hash": "59539629b5d23f43a5e0de632fcdfd98",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 103,
"avg_line_length": 48.2,
"alnum_prop": 0.616004742145821,
"repo_name": "brainstorm/bcbio-nextgen",
"id": "216d98b88e3181f2ed2bc9989d1b1cd4eeebcb9d",
"size": "8435",
... |
import unittest
from pprint import pprint
import feedparser
class FeedparserTest(unittest.TestCase):
"""
A test class for the feedparser module.
"""
def setUp(self):
"""
set up data used in the tests.
setUp is called before each test function execution.
... | {
"content_hash": "ec0892546499251e377fe87b72930142",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 111,
"avg_line_length": 29.87323943661972,
"alnum_prop": 0.5671852899575672,
"repo_name": "quchunguang/test",
"id": "69185065e3d3193ccc6c0ff14f8d11cb86331d92",
"size": "212... |
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
inputdoc = UnwrapElement(IN[1])
if inpu... | {
"content_hash": "2b9a9e8d366ef698299e4879c6608ee7",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 76,
"avg_line_length": 29.458333333333332,
"alnum_prop": 0.7835926449787836,
"repo_name": "andydandy74/ClockworkForDynamo",
"id": "7c05069aa4db1931ef67ac3aadf75a1e05804839",
... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Textfont(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatterpolar"
_path_str = "scatterpolar.textfont"
_valid_props = {"color", "colorsrc", "fa... | {
"content_hash": "1cfab9c237da9a060bc086132c73d3c4",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 82,
"avg_line_length": 33.878787878787875,
"alnum_prop": 0.5522361359570662,
"repo_name": "plotly/plotly.py",
"id": "1d062e102fb98ef173b9f2b27c511ff10bbf56d8",
"size": "11... |
from __future__ import absolute_import
from chaco.shell.plot_maker import *
| {
"content_hash": "99dbca481912d10ce10b5e45a53bd963",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 38,
"avg_line_length": 38,
"alnum_prop": 0.7763157894736842,
"repo_name": "enthought/etsproxy",
"id": "e10ad4c887615bcb582fc3310a1f8823d3c9b315",
"size": "91",
"binary": f... |
import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.... | {
"content_hash": "6ad5bc713cdb11881476b5b2618f1264",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 182,
"avg_line_length": 40.71621621621622,
"alnum_prop": 0.6393959508795221,
"repo_name": "Azure/azure-sdk-for-python",
"id": "e43102252ea15d1406c0bc5f4c7f4eb928a9d398",
"... |
def _set_value(self, value):
self._value = value + 3
| {
"content_hash": "ef52dbae3c8a48735e816282586ed85e",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 28,
"avg_line_length": 28.5,
"alnum_prop": 0.6140350877192983,
"repo_name": "pmacosta/pexdoc",
"id": "387afcb4f76c32ce1e47bdfd5132a587a6c1f284",
"size": "183",
"binary": f... |
import socket
s = socket.socket()
host = socket.gethostname()
port = 12345
print "host ",host
s.bind((host, port))
s.listen(5)
while True:
c, addr = s.accept()
print 'Got connection from',addr
data = c.recv(1024);
print 'data ',data;
c.... | {
"content_hash": "069f8c84f27b59bba47803cdcf8d67f1",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 37,
"avg_line_length": 23.75,
"alnum_prop": 0.5105263157894737,
"repo_name": "CSE-SOE-CUSAT/NOSLab",
"id": "89a762339548913768a763e0bfbdc0c8bba6d7bc",
"size": "380",
"bin... |
import os
PATH = os.path.split(os.path.realpath(__file__))[0]
| {
"content_hash": "2a315eaeb06788fe7fad2d1294d7910f",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 51,
"avg_line_length": 21,
"alnum_prop": 0.6666666666666666,
"repo_name": "dataunit/dataunit",
"id": "ae111fee510be14f8a8cb1aac107322486f5a649",
"size": "63",
"binary": fa... |
import copy
import datetime
from contextlib import suppress
from decimal import Decimal
from django.core.exceptions import EmptyResultSet, FieldError
from django.db.models import fields
from django.db.models.query_utils import Q
from django.utils.deconstruct import deconstructible
from django.utils.functional import c... | {
"content_hash": "d2302d23457c98d7d3d8c7ca8e4ae74c",
"timestamp": "",
"source": "github",
"line_count": 1121,
"max_line_length": 114,
"avg_line_length": 35.888492417484386,
"alnum_prop": 0.6119658969451418,
"repo_name": "mlavin/django",
"id": "ff7921b520bad351997f7b311895dae90b39d2ba",
"size": "402... |
import time
from goose import Goose
def load_jezebel():
with open('resources/additional_html/jezebel1.txt') as f:
data = f.read()
return data
def bench(iterations=100):
data = load_jezebel()
goose = Goose()
times = []
for _ in xrange(iterations):
t1 = time.time()
goose.... | {
"content_hash": "31e726e39123504c9fbf6516354b2681",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 61,
"avg_line_length": 24.923076923076923,
"alnum_prop": 0.5864197530864198,
"repo_name": "scivey/goosepp",
"id": "605c1a12d24681cf6d1638787ff69bd4094f23b1",
"size": "648",... |
'''
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
'''
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def sortedArrayToBST(se... | {
"content_hash": "5d4ad7c85340f6f5df36b2fddafb381d",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 97,
"avg_line_length": 25.71875,
"alnum_prop": 0.5795868772782503,
"repo_name": "gavinfish/leetcode-share",
"id": "64894956382f777d3facca83a3562cce0a505844",
"size": "823",... |
from django import template
register = template.Library()
def product_upsell(context, product):
"""
Display the list of products that are upsell candidates for currently viewed product.
"""
goals = None
if product.upselltargets.count() > 0:
goals = product.upselltargets.all()
return t... | {
"content_hash": "7b70a2dd250084017677582b6fd92a79",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 89,
"avg_line_length": 33.785714285714285,
"alnum_prop": 0.7145877378435518,
"repo_name": "DrOctogon/Satchmo",
"id": "df24fa85348b0e7378e790eff7df2366abf69b0c",
"size": "47... |
import os
import unittest
import numpy as np
from op_test import OpTest
import paddle
import paddle.nn.functional as F
from paddle.fluid import Program, program_guard, core
from test_attribute_var import UnittestBase
def _unpool_output_size(x, kernel_size, stride, padding, output_size):
input_size = x.shape
... | {
"content_hash": "c7d43b7e041eab4b5a88626b77748a58",
"timestamp": "",
"source": "github",
"line_count": 494,
"max_line_length": 80,
"avg_line_length": 32.17206477732793,
"alnum_prop": 0.5142515572893727,
"repo_name": "PaddlePaddle/Paddle",
"id": "4ae6919552cadc2c68126a777c7c801423b4d688",
"size": "... |
"""Helper classes for Google Assistant integration."""
from __future__ import annotations
from abc import ABC, abstractmethod
from asyncio import gather
from collections.abc import Mapping
from datetime import datetime, timedelta
from http import HTTPStatus
import logging
import pprint
from aiohttp.web import json_re... | {
"content_hash": "73327319fb4de93cac09d849e647d18a",
"timestamp": "",
"source": "github",
"line_count": 696,
"max_line_length": 103,
"avg_line_length": 32.497126436781606,
"alnum_prop": 0.5953223096648687,
"repo_name": "GenericStudent/home-assistant",
"id": "fd6aecd5d426847ddd0a3aa0fa780d62fd589137",... |
import pluginloader
from escpos import *
def testLoadPlugin():
pluginloader.init('test')
try:
pluginloader.loadedPlugins['test']
if pluginloader.loadedPlugins['test'].init != True:
raise NameError
except NameError:
raise NameError("Plugin loader is not defining the loaded... | {
"content_hash": "45903120df7047db8925a9ca8f619b1a",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 109,
"avg_line_length": 36,
"alnum_prop": 0.6683006535947712,
"repo_name": "mashedkeyboard/Dashday",
"id": "a54b486cb38307c2bb73e57b8e84c31313f5917b",
"size": "612",
"bin... |
from __future__ import absolute_import, division, print_function
from hashlib import sha1
import os
import textwrap
from pants.base.exceptions import TaskError
from pants.base.fingerprint_strategy import FingerprintStrategy
from pants.task.task import Task
class NameTagsAndDepFingerprintStrategy(FingerprintStrategy... | {
"content_hash": "a8d8f2465bfdfb7b06859170a7bd300b",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 107,
"avg_line_length": 32.97107438016529,
"alnum_prop": 0.6540919914776288,
"repo_name": "foursquare/fsqio",
"id": "8e40208ecdb863b87fa404fabc515720dbbed29e",
"size": "80... |
from django import template
from .. import scope
register = template.Library()
@register.filter
def scopes(scope_int):
"""
Wrapper around :attr:`provider.scope.names` to turn an int into a list
of scope names in templates.
"""
return scope.to_names(scope_int)
@register.filter
def scope_verbose(s... | {
"content_hash": "4ef5abd4ab765c82c5260816eca8ba62",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 74,
"avg_line_length": 21.4,
"alnum_prop": 0.6845794392523364,
"repo_name": "maroux/django-oauth2-provider",
"id": "d389949aed6d20dee5669dd56f8cc8742c190113",
"size": "428"... |
from BinPy.sequential.sequential import *
from BinPy.tools import *
class Register(object):
"""
Base class for all registers
"""
def __init__(self, inputs, clock, clear):
self.inputs = inputs
if not isinstance(clock, Clock):
raise Exception("Error: Invalid Clock Input")
... | {
"content_hash": "b4b889eb19829ad73967731c0c6d7f45",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 72,
"avg_line_length": 27.355450236966824,
"alnum_prop": 0.4908177408177408,
"repo_name": "rajathkumarmp/BinPy",
"id": "c68bf63b7c6b45ae9f0e83cc9e8e2793ee901b18",
"size": ... |
from enum import Enum
from math import pi
from Data.Events import *
from Data.Objects import *
from Data.Vertex import Vertex
class FeatureType(Enum):
ExtrudeFeature = 0
RevolveFeature = 1
FilletFeature = 2
PlaneFeature = 3
SketchFeature = 4
NurbsSurfaceFeature = 5
class Feature(NamedObservableObject, IdObje... | {
"content_hash": "e9b0f3fb5b810d51c2b2a383adb6926c",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 110,
"avg_line_length": 32.36546184738956,
"alnum_prop": 0.6982255863010299,
"repo_name": "pracedru/PracedruDesign",
"id": "4ae6b5e596af7da237548d8debe7aedf95b4b783",
"siz... |
from sklearn.datasets import make_classification
from sklearn.model_selection import cross_val_score
from sklearn.ensemble import RandomForestClassifier as RFC
from sklearn.svm import SVC
from bayes_opt import BayesianOptimization
from bayes_opt.util import Colours
def get_data():
"""Synthetic binary classificati... | {
"content_hash": "85012803e8542227a7239bec63c8c9c6",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 78,
"avg_line_length": 32.54545454545455,
"alnum_prop": 0.6470289487049263,
"repo_name": "fmfn/BayesianOptimization",
"id": "e4e5d88e0fa3ceb332629f90849356e6132424f4",
"si... |
def pyfun_external():
alert("External embedded python checking in");
| {
"content_hash": "b19dcb489bb5cafaf721d42e805685ef",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 47,
"avg_line_length": 35,
"alnum_prop": 0.7571428571428571,
"repo_name": "marshall/titanium",
"id": "2a6dcc6a8fc406db5347e6d35288abf2898467c7",
"size": "70",
"binary": fa... |
import _env
from _base.app import Route
from _base.controller import JsonErrView
from _base.json_ob import JsOb
from model.re_mail import RE_MAIL
from model.msg import msg_new
route = Route()
@route('/j/contact')
class Contact(JsonErrView):
def post(self):
o = self.json
err = JsOb()
if... | {
"content_hash": "cfd128d6107b98c2d38e3611c7ead21c",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 53,
"avg_line_length": 23.322580645161292,
"alnum_prop": 0.598893499308437,
"repo_name": "Kzinglzy/hiblog",
"id": "4809ae5f386155cccc975438e079e4bec7337bb5",
"size": "761",... |
import os.path
import re
import shutil
import sys
import tempfile
import zipfile
from distutils import dist
from glob import iglob
from ..bdist_wheel import bdist_wheel
from ..wheelfile import WheelFile
from . import WheelError, require_pkgresources
egg_info_re = re.compile(r'''
(?P<name>.+?)-(?P<ver>.+?)
(-(... | {
"content_hash": "10d120e9ac1c385ddca32d9ef39f6c9a",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 83,
"avg_line_length": 35.23048327137546,
"alnum_prop": 0.608420386198164,
"repo_name": "frainfreeze/studying",
"id": "ff7baaa051df4faf30e4565d9112fc61ff8610e8",
"size": "... |
import abc
from oslo_config import cfg
BASE_ROUTER_TRAFFIC_COUNTER_KEY = "router-"
BASE_PROJECT_TRAFFIC_COUNTER_KEY = "project-"
BASE_LABEL_TRAFFIC_COUNTER_KEY = "label-"
class MeteringAbstractDriver(object, metaclass=abc.ABCMeta):
"""Abstract Metering driver."""
def __init__(self, plugin, conf):
s... | {
"content_hash": "39922fa20b70c388d347a2487e812928",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 68,
"avg_line_length": 28.046875,
"alnum_prop": 0.675208913649025,
"repo_name": "mahak/neutron",
"id": "48d3fed413a530abea93f7b84d637280bc98f6e3",
"size": "2402",
"binary... |
from __future__ import division, print_function
"""
A wxPython backend for matplotlib, based (very heavily) on
backend_template.py and backend_gtk.py
Author: Jeremy O'Donoghue (jeremy@o-donoghue.com)
Derived from original copyright work by John Hunter
(jdhunter@ace.bsd.uchicago.edu)
Copyright (C) Jeremy O'Dono... | {
"content_hash": "8ad78baed947508a2ab339af54b3fa3c",
"timestamp": "",
"source": "github",
"line_count": 2076,
"max_line_length": 174,
"avg_line_length": 35.0033718689788,
"alnum_prop": 0.5823413654065807,
"repo_name": "RobertABT/heightmap",
"id": "73a1d0cf9ce8294f80ea6daacb2d6f47461b6cf0",
"size": ... |
import os
import sys
import unittest2 as unittest
import xmlrunner
from optparse import OptionParser
import random
from PIL import Image
import numpy as np
import io
import struct
from oe_test_utils import restart_apache, make_dir_tree, get_file_hash, check_tile_request
import shutil
APACHE_CONFIG_DIR = "/etc/httpd/co... | {
"content_hash": "4691a758acd02d932ab5f37826479236",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 95,
"avg_line_length": 33.89545454545455,
"alnum_prop": 0.5584015019444817,
"repo_name": "nasa-gibs/onearth",
"id": "0b73c708281b5012ea38b48b2f26fd4cc4fbe083",
"size": "80... |
from __future__ import division
from __future__ import print_function
import numpy as np
import copy
from core.detection_input import AnchorTarget2D
from operator_py.cython.bbox import bbox_overlaps_cython
from operator_py.cython.bbox_self import bbox_selfoverlaps_cython
class PyramidAnchorTarget2DBase(AnchorTarget2... | {
"content_hash": "49886d3237047a862d3a3ef36b34b70e",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 147,
"avg_line_length": 42.144329896907216,
"alnum_prop": 0.5792563600782779,
"repo_name": "TuSimple/simpledet",
"id": "e3768811b358994ad6dbc2a19f4784be881f1931",
"size": ... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import collections
import inspect
from abc import abstractmethod
from functools import update_wrapper
import six
from pants.build_graph.address import Address
from p... | {
"content_hash": "f7497ca8a1200bbb459cf9156c422c87",
"timestamp": "",
"source": "github",
"line_count": 435,
"max_line_length": 100,
"avg_line_length": 38.00919540229885,
"alnum_prop": 0.6602153138986331,
"repo_name": "kwlzn/pants",
"id": "d4fe58885437f30f68131997cf1bf70a7a7ecd7e",
"size": "16681",... |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.pr... | {
"content_hash": "61196a58492432dcb0b295a96627df91",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 680,
"avg_line_length": 39.84615384615385,
"alnum_prop": 0.7501072501072501,
"repo_name": "bellowsj/aiopogo",
"id": "c21ddb26b5814962adfd1b633614035718514692",
"size": "47... |
import json
import unittest
from unittest import mock
from airflow.api.common.experimental.trigger_dag import _trigger_dag
from airflow.exceptions import AirflowException
from airflow.models import DAG, DagRun
class TestTriggerDag(unittest.TestCase):
@mock.patch('airflow.models.DagRun')
@mock.patch('airflow... | {
"content_hash": "96cd3050bf3b45b3af8116000ba499c8",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 85,
"avg_line_length": 30.194690265486727,
"alnum_prop": 0.5565650644783119,
"repo_name": "Fokko/incubator-airflow",
"id": "b787f840ffbc399e7c663df1d00c701dd3d53174",
"siz... |
gifts=['A Partridge in a Pear Tree', 'Two Turtle Doves, and', 'Three French Hens', 'Four Calling Birds', 'Five Golden Rings', 'Six Geese-a-Laying', 'Seven Swans-a-Swimming', 'Eight Maids-a-Milking', 'Nine Ladies Dancing', 'Ten Lords-a-Leaping', 'Eleven Pipers Piping', 'Twelve Drummers Drumming']
ordinal=['st', 'nd', 'r... | {
"content_hash": "7207488b7e43f033de20b539eb2cbdd6",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 296,
"avg_line_length": 54.4,
"alnum_prop": 0.6470588235294118,
"repo_name": "sdlwdr/misc",
"id": "8cc86cbf3e8b07e6c013a9f4ea24ab55cf6eda37",
"size": "572",
"binary": fal... |
import warnings
from tornado.testing import AsyncTestCase, gen_test
from docker.utils import kwargs_from_env
from remoteappmanager.docker.async_docker_client import AsyncDockerClient
from remoteappmanager.tests.mocking.virtual.docker_client import (
VirtualDockerClient)
class TestAsyncDockerClient(AsyncTestCase)... | {
"content_hash": "d1f19569f29dab3205a5a2618efc510c",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 76,
"avg_line_length": 37.666666666666664,
"alnum_prop": 0.6428571428571429,
"repo_name": "simphony/simphony-remote",
"id": "4a3f9bae2789c47f6769cb1adba00063153e06e9",
"siz... |
"""Initialization for bart.sched"""
from bart.sched import SchedAssert
from bart.sched import SchedMultiAssert
from bart.sched import SchedMatrix
| {
"content_hash": "986767a013c2172110fc137a8a8b6243",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 39,
"avg_line_length": 24.666666666666668,
"alnum_prop": 0.8175675675675675,
"repo_name": "sinkap/bart",
"id": "c391ecbc4132bdc0074cac6772aa7167956f7100",
"size": "734",
"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Media',
fields=[
('tmdb_id', models.PositiveInteger... | {
"content_hash": "bbd862f67da16d1bdbe1ab4d042b7f95",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 119,
"avg_line_length": 32.25,
"alnum_prop": 0.5387596899224806,
"repo_name": "rbeagrie/django-tmdb",
"id": "c8a3d32c62c6b519271f242ab1f5b78a572e8fb3",
"size": "1105",
"b... |
import random
import operator
import numpy
from deap import algorithms
from deap import base
from deap import creator
from deap import tools
from deap import gp
# Initialize Parity problem input and output matrices
PARITY_FANIN_M = 6
PARITY_SIZE_M = 2**PARITY_FANIN_M
inputs = [None] * PARITY_SIZE_M
outputs = [None]... | {
"content_hash": "869553d476698d7163f7a9d1185e64bf",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 83,
"avg_line_length": 29.441558441558442,
"alnum_prop": 0.6876929863255403,
"repo_name": "GrimRanger/GeneticAlgorithm",
"id": "504bf9c61669dac1460423e28877d57778a62688",
"... |
from nova.api.openstack.compute import versions
from nova.api.openstack.compute.views import versions as views_versions
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
ALIAS = "versions"
class VersionsController(object):
@extensions.expected_errors(())
@wsgi.serializers(xml=ver... | {
"content_hash": "67f1837312d18b990bead0bee3f944cf",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 76,
"avg_line_length": 32.075,
"alnum_prop": 0.6414653156664069,
"repo_name": "citrix-openstack-build/nova",
"id": "8e8f5d71b63ed6c3ea6d65cd73ac186ec4db9d58",
"size": "1953... |
import unittest
import gpflow
import numpy as np
import tensorflow as tf
from gpflow import set_trainable
# import pickle
# Branching files
from BranchedGP import BranchingTree as bt
from BranchedGP import VBHelperFunctions, assigngp_dense, assigngp_denseSparse
from BranchedGP import branch_kernParamGPflow as bk
cl... | {
"content_hash": "93c4c95cbf8ba47d46dc64656267ed3e",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 83,
"avg_line_length": 36.12408759124087,
"alnum_prop": 0.5879975752677309,
"repo_name": "ManchesterBioinference/BranchedGP",
"id": "3e3fd44af9f95724992dbc112a7a35d84979a0f4... |
"""Return a list removing elements specified in another."""
def array_diff(a, b):
"""Return a after removing elements from b."""
return [i for i in a if i not in b]
| {
"content_hash": "ffce332fdd6351b55b53352071636977",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 59,
"avg_line_length": 29.166666666666668,
"alnum_prop": 0.6571428571428571,
"repo_name": "clair3st/code-katas",
"id": "e29df874a78850a4e5bf84c28f71e1b7a6fa6947",
"size": "1... |
'''
New Integration Test for creating KVM VM with ISO.
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.image_operations as img_ops
import os
test_stub = test_lib.lib_get_specific_stub()
vm = None
v... | {
"content_hash": "f81cd0ec3f1ec088eefd50edda5ada47",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 66,
"avg_line_length": 21.43243243243243,
"alnum_prop": 0.6343001261034048,
"repo_name": "zstackio/zstack-woodpecker",
"id": "c6a6f7a9ae877884c43f81ac73bd51ecd055c758",
"si... |
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
import jsonfield.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djstripe', '0003_auto_20150128_0800'),
]
operations = [
migrations.AlterF... | {
"content_hash": "d050ae7fe1bc806291b3fa510ce9fe64",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 63,
"avg_line_length": 24.964285714285715,
"alnum_prop": 0.5894134477825465,
"repo_name": "jameshiew/dj-stripe",
"id": "614d0a3f2eb7d36ff541b20b480f04cfe0367b70",
"size": "... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/space/story_loot/shared_loot_dantooine_anthro2.iff"
result.attribute_template_id = -1
result.stfName("space/story_loot_n","loot_dantooine_anthro2")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ##... | {
"content_hash": "35fe04299d9938328bb06758c6053e1c",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 87,
"avg_line_length": 26.076923076923077,
"alnum_prop": 0.7109144542772862,
"repo_name": "anhstudios/swganh",
"id": "6c4227b920719bab99a0ef560ea81dbb3656eace",
"size": "48... |
from trump.orm import SymbolManager
from trump.templating import QuandlFT, QuandlSecureFT, SQLFT
from trump.templating import FFillRollingMeanMT
from datetime import datetime as dt
sm = SymbolManager()
oil = sm.create(name = "oil_front_month",
description = "Crude Oil Futures, Continuous C... | {
"content_hash": "8faa48e2d827e4e62832fe9674256380",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 94,
"avg_line_length": 26.514285714285716,
"alnum_prop": 0.6637931034482759,
"repo_name": "Equitable/trump",
"id": "fbb6aeafc5842088c8b869b1045f124e6511cdc3",
"size": "953"... |
def voter_retrieve_doc_template_values(url_root):
"""
Show documentation about voterRetrieve
"""
required_query_parameter_list = [
{
'name': 'api_key',
'value': 'string (from post, cookie, or get (in that order))', # boolean, integer, long, string
... | {
"content_hash": "dfb8fea2796ab3d0488b49cd4d53dddd",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 115,
"avg_line_length": 44.18421052631579,
"alnum_prop": 0.5053603335318642,
"repo_name": "wevote/WebAppPublic",
"id": "c6c626d5c6dedffd49d638812b7862a69698704f",
"size": "... |
"""
Functional tests for the File store interface
"""
import os
import os.path
import fixtures
import oslo.config.cfg
import testtools
import glance.store.filesystem
import glance.tests.functional.store as store_tests
class TestFilesystemStore(store_tests.BaseTestCase, testtools.TestCase):
store_cls_path = 'g... | {
"content_hash": "67b7fb8a4808172129fe44abc3486296",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 76,
"avg_line_length": 29.543478260869566,
"alnum_prop": 0.6578366445916115,
"repo_name": "ntt-sic/glance",
"id": "504c7d6c49e4f0df1da76b6934984b623cc4097a",
"size": "2039"... |
from marshmallow import ValidationError, fields, post_load, pre_dump
from azure.ai.ml._schema._sweep.search_space.normal import NormalSchema, QNormalSchema
from azure.ai.ml._schema._sweep.search_space.randint import RandintSchema
from azure.ai.ml._schema._sweep.search_space.uniform import QUniformSchema, UniformSchema... | {
"content_hash": "75465c32d4716ee7cae640f702fa96a9",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 89,
"avg_line_length": 35.36842105263158,
"alnum_prop": 0.5654761904761905,
"repo_name": "Azure/azure-sdk-for-python",
"id": "986ce6e406cefd65cd43230116051622acba889a",
"si... |
from __future__ import absolute_import
import copy
import lxml.etree
from xml.sax.saxutils import escape as xmlescape
from . import utils
class Job(object):
def __init__(self, name, branch, template, jenkins):
self.name = name
self.branch = branch # the scm branch that this job builds
s... | {
"content_hash": "0ee4769f4f6607a0cfbc38128498e71c",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 93,
"avg_line_length": 36.18,
"alnum_prop": 0.5610834715312327,
"repo_name": "gvalkov/jenkins-autojobs",
"id": "58e86f903660b8755ec54da2fdb08adcb601f8e2",
"size": "5453",
... |
import eisoil.core.pluginmanager as pm
def setup():
# setup config keys
config = pm.getService("config")
config.install("dhcprm.max_reservation_duration", 10*60, "Maximum duration a DHCP resource can be held allocated (not provisioned).")
config.install("dhcprm.max_lease_duration", 24*60*60, "Maximum d... | {
"content_hash": "d610b5b9a5ff7113c39a243e19227806",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 137,
"avg_line_length": 50.2,
"alnum_prop": 0.7410358565737052,
"repo_name": "EICT/C-BAS",
"id": "4a819092ca166625cd6faa05972877c281f6cef8",
"size": "753",
"binary": fals... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/deed/city_deed/shared_garden_naboo_sml_04_deed.iff"
result.attribute_template_id = 2
result.stfName("deed","garden_naboo_sml_04_deed")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return ... | {
"content_hash": "3981d2784983e68d7d32d57ab25c36a3",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 87,
"avg_line_length": 25.076923076923077,
"alnum_prop": 0.6993865030674846,
"repo_name": "anhstudios/swganh",
"id": "6ac10a0e8b3bc14a024e3d3aafe4157d1cd1cdc4",
"size": "47... |
import sys
import 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 con... | {
"content_hash": "d7f6b918fc5208820824cfae22085849",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 85,
"avg_line_length": 30.763440860215052,
"alnum_prop": 0.6893859955726436,
"repo_name": "MarvinT/pyoperant",
"id": "3b59f4b54a58b0e5a06b1706b73bf0b4193aaacb",
"size": "9... |
"""
jinja2.ext
~~~~~~~~~~
Jinja extensions allow to add custom tags similar to the way django custom
tags work. By default two example extensions exist: an i18n and a cache
extension.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD.
"""
from collections import deque
from jinja2 impo... | {
"content_hash": "fb78dc239e207fb32b45fbe2e64536ed",
"timestamp": "",
"source": "github",
"line_count": 552,
"max_line_length": 81,
"avg_line_length": 39.45289855072464,
"alnum_prop": 0.6121774267609514,
"repo_name": "inclement/python-for-android",
"id": "15a87715790787e7720e925207b1cdc2192880a2",
... |
import sys
import socket
import numpy as np
import matplotlib.pyplot as plt
def main():
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('', 5151))
while True:
sock.listen(5)
client, address = sock.accept()
print "{} connected".format( address )
response = client.recv(1000000)
if ... | {
"content_hash": "f27258f53c67593a21136374a095b1f7",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 57,
"avg_line_length": 18.8,
"alnum_prop": 0.6536643026004728,
"repo_name": "simonlegrand/Windows-universal-samples",
"id": "5b87fd6bc297f5899b04ec86ab84518023acbe3d",
"siz... |
"""
Installation script for Tacker's development virtualenv
"""
from __future__ import print_function
import os
import sys
import install_venv_common as install_venv
def print_help():
help = """
Tacker development environment setup is complete.
Tacker development uses virtualenv to track and manage Python de... | {
"content_hash": "96f4c46b7a449e59cf31506288fb984a",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 79,
"avg_line_length": 28.403846153846153,
"alnum_prop": 0.6926201760324983,
"repo_name": "priya-pp/Tacker",
"id": "40e597e2055f79c181119fb3a27335178e1c7fbc",
"size": "2300... |
from django.test import TestCase
from jflow.db.instdata.models import DataId
__all__ = ['DataIdManagerTest',
]
class DataIdManagerTest(TestCase):
def testCreateDataIdwithNoType(self):
code = u'MSCI_W'
name = 'MSCI WORLD FREE USD'
description = 'World Index'... | {
"content_hash": "b51c585e4b0958c991813f254acb0a50",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 126,
"avg_line_length": 24.4,
"alnum_prop": 0.5770491803278689,
"repo_name": "lsbardel/flow",
"id": "cf9e1a4bb0fc6f1f46fc2607524d68c5bdd48817",
"size": "610",
"binary": f... |
import networkx as nx
import matplotlib.pyplot as plt
G = nx.read_pajek("dataset/Erdos971.net")
print nx.info(G)
isolated_nodes = nx.isolates(G)
print 'isolated_nodes:', G
G.remove_nodes_from(isolated_nodes)
print nx.info(G) | {
"content_hash": "1db42d21bfc93d47ca89926b5c6a1e95",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 41,
"avg_line_length": 25,
"alnum_prop": 0.76,
"repo_name": "python27/NetworkControllability",
"id": "d3b6935e0a2b9b3a52b30ae91e778b079f6480f1",
"size": "225",
"binary": f... |
"""A setup module for the GRPC packager service.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
import setuptools
from setuptools import setup, find_packages
install_requires = [
'oauth2client>=0.4.1, <0.5.0dev',
'grpcio>=0.15.0, <0.16.0dev',
'googleapi... | {
"content_hash": "bcb61e23fad52ade81a3aac430cbf4b1",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 66,
"avg_line_length": 30.72093023255814,
"alnum_prop": 0.6820590461771385,
"repo_name": "googleapis/packman",
"id": "c65dd0a904cdd1e3a0989c2500298503a6c7fd6f",
"size": "13... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.