text stringlengths 4 1.02M | meta dict |
|---|---|
"""Offer device oriented automation."""
import voluptuous as vol
from homeassistant.components.device_automation import (
DEVICE_TRIGGER_BASE_SCHEMA,
async_get_device_automation_platform,
)
from homeassistant.const import CONF_DOMAIN
from .exceptions import InvalidDeviceAutomationConfig
# mypy: allow-untyped... | {
"content_hash": "09545ffefb84a601d7eb0e2d14b86e1f",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 85,
"avg_line_length": 34.888888888888886,
"alnum_prop": 0.73328025477707,
"repo_name": "jawilson/home-assistant",
"id": "1a63dcb9e9ba0c3a899d2ad8e2b8393608db1170",
"size":... |
try:
from nose.plugins.skip import SkipTest
except ImportError:
pass
else:
def setup_module():
raise SkipTest('Doctests fail for externals.validator')
"""
The Validator object is used to check that supplied values
conform to a specification.
The value can be supplied as a string -... | {
"content_hash": "2b241ef9bd2b677c5c76c68dc2d5d8ff",
"timestamp": "",
"source": "github",
"line_count": 1452,
"max_line_length": 104,
"avg_line_length": 31.74862258953168,
"alnum_prop": 0.5421158810386343,
"repo_name": "arokem/nipy",
"id": "27918d5fbb1647ea54411c16908227c77c73ee62",
"size": "46864"... |
from .settings import settings
import requests
import io
import dill
from os import path
from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor
import sys
if settings.IS_IPYTHON:
from tqdm import tqdm_notebook as tqdm
else:
from tqdm import tqdm
def save_var_cloud(data_var, data_name):
if... | {
"content_hash": "0b8d10ab10353273c708964ee565ed72",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 76,
"avg_line_length": 27.40277777777778,
"alnum_prop": 0.6259503294475418,
"repo_name": "Catalearn/catalearn",
"id": "b00ac3551be649c6327b5c690a99fc76dfc03e4e",
"size": "... |
from __future__ import absolute_import
from sentry.utils.compat.mock import MagicMock
from sentry.testutils.cases import RuleTestCase
from sentry.rules.actions.notify_event import NotifyEventAction
from sentry.rules.actions.services import LegacyPluginService
class NotifyEventActionTest(RuleTestCase):
rule_cls ... | {
"content_hash": "d58ec244c502f0d316bf9c0a73b837cc",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 71,
"avg_line_length": 31.458333333333332,
"alnum_prop": 0.7178807947019867,
"repo_name": "beeftornado/sentry",
"id": "e40f37e469bcfa3ec0c00a59b534a40979044bc4",
"size": "7... |
import os
import numpy as np
from collections import deque
from sge.utils import MOVE_ACTS, AGENT, BLOCK, WATER, EMPTY, KEY, OBJ_BIAS,\
TYPE_PICKUP, TYPE_TRANSFORM
__PATH__ = os.path.abspath(os.path.dirname(__file__))
class Mazemap(object):
def __init__(self, game_name, game_config):
if game_name not... | {
"content_hash": "4381624f310b1f7557543250f011911b",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 108,
"avg_line_length": 38.51953125,
"alnum_prop": 0.5038028597505324,
"repo_name": "srsohn/subtask-graph-execution-light",
"id": "e05a4dd7c599c717dcbca0e621ae29fdb0231d9b",... |
from logger import Logger
class DeviceMerger:
""" DeviceMerger
Merges several devices into logical groups.
Since most Devices have the same peripherals, but differ in other
parameters, like Flash/RAM/EEPROM sizes, packaging or other minor
differences, it makes sense to group them accordingly.
Please not that th... | {
"content_hash": "50dc1453a0e32a7befbc50154c9e54c8",
"timestamp": "",
"source": "github",
"line_count": 504,
"max_line_length": 107,
"avg_line_length": 29.071428571428573,
"alnum_prop": 0.6145236145236145,
"repo_name": "dergraaf/xpcc",
"id": "f8233bf03a5daa40e32dad2f37946c90b9cd83dd",
"size": "1498... |
"""
Common directory service interfaces
"""
from zope.interface.interface import Interface, Attribute
__all__ = [
"IStoreDirectoryService",
"IStoreDirectoryRecord",
]
class IStoreDirectoryError(Exception):
"""
Base class for directory related errors.
"""
class DirectoryRecordNotFoundError(Exc... | {
"content_hash": "48a3bceb586ac9a445819895a07e64e8",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 106,
"avg_line_length": 22.68235294117647,
"alnum_prop": 0.6161825726141079,
"repo_name": "macosforge/ccs-calendarserver",
"id": "bfae63cf29bb81ce23f958562d1a56b468ce932c",
... |
from django.conf.urls import patterns
from django.conf.urls import url
from conveyordashboard.plans import views
PLAN = r'^(?P<plan_id>[^/]+)/%s$'
urlpatterns = patterns(
'conveyordashboard.plans.views',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^create$', views.CreateView.as_view(), nam... | {
"content_hash": "de93e14973b7c75204e6ccd1235da990",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 69,
"avg_line_length": 40,
"alnum_prop": 0.6526315789473685,
"repo_name": "Hybrid-Cloud/conveyor-dashboard",
"id": "1a0f0604fbe10a0bfdc54774204fb675219d9674",
"size": "1369... |
from ..script import tools
from ... import encoding
from ...networks import address_prefix_for_netcode
from ...serialize import b2h
from ..exceptions import SolvingError
from .ScriptType import ScriptType
class ScriptPayToAddress(ScriptType):
TEMPLATE = tools.compile("OP_DUP OP_HASH160 OP_PUBKEYHASH OP_EQUALV... | {
"content_hash": "537812b9412c7531af224c220b14d766",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 102,
"avg_line_length": 35.82432432432432,
"alnum_prop": 0.6333459072048284,
"repo_name": "shayanb/pycoin",
"id": "7058e5ef0bd16c7ab726be51190790f39bf133f5",
"size": "2651"... |
import unittest
import numpy
import six.moves.cPickle as pickle
import chainer
from chainer.backends import cuda
from chainer import functions as F
from chainer import links
from chainer import testing
from chainer.testing import attr
from chainer.utils import conv
@testing.parameterize(*testing.product({
'x_dt... | {
"content_hash": "c87b8c30441c07711fe6925c391a666f",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 76,
"avg_line_length": 31.478632478632477,
"alnum_prop": 0.5680152049959273,
"repo_name": "niboshi/chainer",
"id": "8f9acd545f85d509f64ab555a150497e4ab879f0",
"size": "736... |
import pytest
from thefuck.rules.man import match, get_new_command
from tests.utils import Command
@pytest.mark.parametrize('command', [
Command('man read'),
Command('man 2 read'),
Command('man 3 read'),
Command('man -s2 read'),
Command('man -s3 read'),
Command('man -s 2 read'),
Command('m... | {
"content_hash": "34b7364c3b4327009a8872917956c45b",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 89,
"avg_line_length": 32.05714285714286,
"alnum_prop": 0.6229946524064172,
"repo_name": "mlk/thefuck",
"id": "c4714881f96faeea9b70425411cc0dbcf1275055",
"size": "1122",
... |
"""
Elephant is a package for the analysis of neurophysiology data, based on Neo.
:copyright: Copyright 2014-2015 by the Elephant team, see AUTHORS.txt.
:license: Modified BSD, see LICENSE.txt for details.
"""
from . import (statistics,
spike_train_generation,
spike_train_correlation,
... | {
"content_hash": "e2426bfb3b180f85c61e27e15d641182",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 77,
"avg_line_length": 25.17391304347826,
"alnum_prop": 0.5906735751295337,
"repo_name": "neuroelectro/elephant",
"id": "0f760c273dcd069519ca69eda52e85c426457cf4",
"size": ... |
from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.api.openstack.compute import test_fping
class FpingSampleJsonTests(test_servers.ServersSampleBase):
sample_dir = "os-fping"
def setUp(self):
super(FpingSampleJsonTests, self).setUp()
def fake_check_fping(sel... | {
"content_hash": "e48802a5f2e932479c72f312c35a7141",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 74,
"avg_line_length": 35.80769230769231,
"alnum_prop": 0.6283566058002148,
"repo_name": "rajalokan/nova",
"id": "a6e4d369a71385ceb10d5274dd40af7046cdd086",
"size": "1563",... |
'''
Created by auto_sdk on 2015.04.21
'''
from aliyun.api.base import RestApi
class Cdn20141111RefreshObjectCachesRequest(RestApi):
def __init__(self,domain='cdn.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.ObjectPath = None
self.ObjectType = None
def getapiname(self):
return '... | {
"content_hash": "26476f038c3e489b83d49f0a4107bc6b",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 58,
"avg_line_length": 30.833333333333332,
"alnum_prop": 0.7216216216216216,
"repo_name": "wanghe4096/website",
"id": "8c48302dab937ac82420808e03fab6e55b5d401b",
"size": "3... |
from __future__ import annotations
import subprocess
import sys
from importlib.metadata import EntryPoint
from typing import NamedTuple
import pytest
import ibis
from ibis.backends.base import BaseBackend
def test_backends_are_cached():
assert isinstance(ibis.sqlite, BaseBackend)
del ibis.sqlite # delete ... | {
"content_hash": "1c9bde725b17de687e18671dd4714587",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 78,
"avg_line_length": 25.285714285714285,
"alnum_prop": 0.6655367231638418,
"repo_name": "cpcloud/ibis",
"id": "b89f876196dd2bb8265a2a26a148aa88ac96874b",
"size": "1770",
... |
from django import template
from django.utils.safestring import mark_safe
from django.utils.html import escape
from django.utils.text import capfirst
from django_easyfilters.filters import FILTER_ADD, FILTER_REMOVE, FILTER_DISPLAY, \
ValuesFilter, ChoicesFilter, ForeignKeyFilter, ManyToManyFilter, DateTimeFilter, ... | {
"content_hash": "7e2c5121f30525b2c21bd436781ace28",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 141,
"avg_line_length": 35.88321167883212,
"alnum_prop": 0.5673311635475997,
"repo_name": "georgemarshall/django-easyfilters",
"id": "7dd12b1828cb5b0fb46c798c8d8a2538c634d96... |
"""
pyClanSphere Test Suite
~~~~~~~~~~~~~~~~~~~~~~~
This is the pyClanSphere test suite. It collects all modules in the pyClanSphere
package, builds a TestSuite with their doctests and executes them. It also
collects the tests from the text files in this directory (which are too
extensive to pu... | {
"content_hash": "f9764809801078244b3f8938bf561c1c",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 117,
"avg_line_length": 37.58582089552239,
"alnum_prop": 0.6282140375260598,
"repo_name": "jokey2k/pyClanSphere",
"id": "7ad7121025f451087e1d17156235a6fcc200c7f8",
"size":... |
from swgpy.object import *
def create(kernel):
result = Building()
result.template = "object/building/poi/shared_dathomir_freedprisonerscamp_medium1.iff"
result.attribute_template_id = -1
result.stfName("poi_n","base_poi_building")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return resul... | {
"content_hash": "9c493a0d28a64fd348532a78651d1fcc",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 87,
"avg_line_length": 24.692307692307693,
"alnum_prop": 0.7071651090342679,
"repo_name": "obi-two/Rebelion",
"id": "484ef2100c0d82d1fd8d9dd65b51dcc93386eed4",
"size": "466... |
"""Create a blockchain cache.
Creating a cache of the blockchain speeds up test execution when running
multiple functional tests. This helper script is executed by test_runner when multiple
tests are being run in parallel.
"""
from test_framework.test_framework import DoriancoinTestFramework
class CreateCache(Dorian... | {
"content_hash": "cdac151004a2dbad887158e385ee762f",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 86,
"avg_line_length": 25.75,
"alnum_prop": 0.7038834951456311,
"repo_name": "doriancoins/doriancoin",
"id": "ac830b74859f442146903af3f808604181776576",
"size": "835",
"b... |
from argparse import ArgumentParser
import socket
import time
import os
from novaclient.client import Client
DEFAULT_SCHEME = '{}.nova.hypervisors'.format(socket.gethostname())
METRIC_KEYS = (
'current_workload',
'disk_available_least',
'local_gb',
'local_gb_used',
'memory_mb',
'memory_mb_use... | {
"content_hash": "344f4dbff7d04a8905c8616ba77b64f9",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 83,
"avg_line_length": 30.925925925925927,
"alnum_prop": 0.6191616766467066,
"repo_name": "sivakom/ursula-monitoring",
"id": "c17a461cd55ceb4491fdf19260846b08ce75bbe2",
"si... |
import tornado
import tornado.web
import tornado.websocket
import tornado.options
import os
import json
import uuid
import argparse
import logging
logger = logging.getLogger('gateway')
args = None
def parse_args():
global args
static_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 's... | {
"content_hash": "c19d831f931974415cf7785ec9e45755",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 142,
"avg_line_length": 25.61842105263158,
"alnum_prop": 0.6456086286594761,
"repo_name": "polyphony-ot/polyphony-ios-demo",
"id": "24000548b8591df6e2818b695ca2dbbee9e7fc9d",... |
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
def plot():
fig = plt.figure()
x, y = np.ogrid[-10:10:100j, -10:10:100j]
extent = (x.min(), x.max(), y.min(), y.max())
cmap = matplotlib.cm.get_cmap("gray")
plt.imshow(x * y, extent=extent, cmap=cmap)
plt.colorbar()
retur... | {
"content_hash": "a7869ac8c5bff5462cf8f41ef1dd36f7",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 52,
"avg_line_length": 22.894736842105264,
"alnum_prop": 0.639080459770115,
"repo_name": "nschloe/matplotlib2tikz",
"id": "8e84b7ea45c719081dee36cd7676cc09d1aa62f2",
"size"... |
"""Operations that operate on whole columns.
.. autosummary::
ColumnRemovalOperation
ColumnRenameOperation
ColumnMoveOperation
column_reorder_operation
column_addition_operation
"""
from .base import operation
from ..expressions import compile_expression
@operation('column-removal')
class Column... | {
"content_hash": "2ab06963434cb140d222a190d75874d1",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 79,
"avg_line_length": 29.881944444444443,
"alnum_prop": 0.6109690913316291,
"repo_name": "jezcope/pyrefine",
"id": "fb09bb8c04f29d9f97274f7b3f1ff0851a666aa2",
"size": "43... |
from datetime import datetime
import collections
import pytest
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
from pandas.compat import StringIO, u
from pandas.util.testing import (assert_series_equal, assert_almost_equal,
assert_frame_equal, ensure_clean... | {
"content_hash": "a39633aa669bebe8a0e565ccc89518f6",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 78,
"avg_line_length": 31.771844660194176,
"alnum_prop": 0.5599694423223835,
"repo_name": "zfrenchee/pandas",
"id": "ad51261a47c5c3fd901ddcdfbe414b17be592e2c",
"size": "65... |
from distutils.core import setup, Extension
import numpy
mod = Extension('CorrCoef',
include_dirs = [numpy.get_include()],
sources = ['CorrCoef.c'],
extra_compile_args=['-fopenmp'],
extra_link_args=['-lgomp']
)
setup (name = 'CorrCoef',
author = 'Aljoscha Rheinwalt',
author_email = 'aljoscha.r... | {
"content_hash": "4284cfca19bfc8d0709fec1b97762039",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 55,
"avg_line_length": 24.8,
"alnum_prop": 0.6559139784946236,
"repo_name": "Rheinwalt/CorrCoef",
"id": "c761c6f99b4158576dc491de61b99afbd65095b2",
"size": "372",
"binary... |
import pygame, math
ais={}
def register_ai(name):
def _internal(cls):
ais[name]=cls
cls.name=name
return cls
return _internal
@register_ai("empty")
class AI(object):
def update(self, dt):
pass
def get_angle(x1, x2, y1, y2):
delta_angle=math.degrees(math.atan2(y2-y1, -(x2-x1)))+90
return delta_angle
de... | {
"content_hash": "366d7248cf52b138dcfc9394bb2e1236",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 105,
"avg_line_length": 31.640449438202246,
"alnum_prop": 0.6967329545454546,
"repo_name": "602p/starfighter_revival",
"id": "6d2e31db411b672a72a2593730a22d64766e31d1",
"si... |
import sys
sys.path.insert(1, "../../")
import h2o, tests
def get_model_test(ip,port):
prostate = h2o.import_file(path=h2o.locate("smalldata/logreg/prostate.csv"))
r = prostate[0].runif()
train = prostate[r < 0.70]
test = prostate[r >= 0.70]
# Regression
regression_gbm1 = h2o.gbm(y... | {
"content_hash": "a93d6857cdc988ab0935b25ed2b38085",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 121,
"avg_line_length": 37.34375,
"alnum_prop": 0.6435146443514644,
"repo_name": "bospetersen/h2o-3",
"id": "c98532c84b2ee96f69ddc4863f5705289bd7419c",
"size": "2390",
"b... |
import taskflow.engines
from taskflow.patterns import linear_flow
from taskflow.types import failure
from cinder import test
from cinder.tests.unit.volume.drivers.dell_emc.vnx import fake_exception \
as vnx_ex
from cinder.tests.unit.volume.drivers.dell_emc.vnx import res_mock
import cinder.volume.drivers.dell_emc.... | {
"content_hash": "c37a548baf081995c1dddfe0dbd66b2b",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 74,
"avg_line_length": 37.05911330049261,
"alnum_prop": 0.5395453941246843,
"repo_name": "eharney/cinder",
"id": "559075c5f50512a24c0f076d40345191c79828d7",
"size": "8137"... |
from django import shortcuts
from horizon import forms
from horizon.test import helpers as test
class FormMixinTests(test.TestCase):
def _prepare_view(self, cls, request_headers, *args, **kwargs):
req = self.factory.get('/my_url/', **request_headers)
req.user = self.user
view = cls()
... | {
"content_hash": "7e8da8e6d0972a4e053317315d584427",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 78,
"avg_line_length": 34.946236559139784,
"alnum_prop": 0.6313846153846154,
"repo_name": "NeCTAR-RC/horizon",
"id": "58539917a9067e8b40e84b10c4404f6a544ad626",
"size": "38... |
'''
tcp_message Inline Script Hook API Demonstration
------------------------------------------------
* modifies packets containing "foo" to "bar"
* prints various details for each packet.
example cmdline invocation:
mitmdump -T --host --tcp ".*" -q -s examples/tcp_message.py
'''
from netlib.utils import clean_bin
d... | {
"content_hash": "365b8cc6b646b180a71f75b7b5787c58",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 74,
"avg_line_length": 36.041666666666664,
"alnum_prop": 0.623121387283237,
"repo_name": "ParthGanatra/mitmproxy",
"id": "c63368e4fc0868f061baa4dd6b44669024983a5e",
"size":... |
from grab import DataNotFound, GrabMisuseError
import six
from test.util import build_grab
from test.util import BaseGrabTestCase
HTML = u"""
<head>
<title>фыва</title>
<meta http-equiv="Content-Type" content="text/html; charset=cp1251" />
</head>
<body>
<div id="bee">
<div class="wrapper">
... | {
"content_hash": "375f0eb6481277f500c3d86684fe6de6",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 77,
"avg_line_length": 32.088235294117645,
"alnum_prop": 0.5857011915673694,
"repo_name": "liorvh/grab",
"id": "2c1139842e2cdef31bacb81f92a7a5c0b24f3a78",
"size": "2289",
... |
from flask import Blueprint
fit = Blueprint('fit', __name__, static_folder='static', template_folder='templates', url_prefix='/fitness')
import views | {
"content_hash": "8c720b755e2098e2fc3157f652252910",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 108,
"avg_line_length": 30.2,
"alnum_prop": 0.7350993377483444,
"repo_name": "SNET-Entrance/Entrance-UM",
"id": "364c838e5faf64cf55fccddbdda322839b780c95",
"size": "151",
... |
"""
An example of using shards directly to construct the MagnaDoodle component,
using the PygameComponentShard as a base.
Generated code is in MagnaDoodle.py
"""
from PygameComponentShard import pygameComponentShard
# import shards and inline shards from these files
from ExampleMagnaShards import __INIT__
from Examp... | {
"content_hash": "db214bcff30f6557450e90ffafcb2e7f",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 97,
"avg_line_length": 42.63934426229508,
"alnum_prop": 0.6093810073048828,
"repo_name": "bbc/kamaelia",
"id": "1ea6f8e71b62ab5532a413c1a88480cd1b964213",
"size": "3407",
... |
from TreeNode import TreeNode
import collections
class Solution(object):
# https: // discuss.leetcode.com / topic / 21363 / python - solutions - dfs - stack - bfs - queue - dfs - recursively
# dfs + stack
def sumNumbers1(self, root):
if not root:
return 0
stack, res = [(root, root.va... | {
"content_hash": "3303429b73c0d267d61973360ac7a4b4",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 117,
"avg_line_length": 35.76923076923077,
"alnum_prop": 0.5043010752688172,
"repo_name": "menghanY/LeetCode-Python",
"id": "dcd5489db82e3255b5b9dd5edfb1cfdcee836032",
"siz... |
"""The tests for Lock device actions."""
import pytest
import homeassistant.components.automation as automation
from homeassistant.components.lock import DOMAIN
from homeassistant.const import CONF_PLATFORM
from homeassistant.helpers import device_registry
from homeassistant.setup import async_setup_component
from te... | {
"content_hash": "928a0eeeaa777312cb580fbc27985341",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 88,
"avg_line_length": 32.311764705882354,
"alnum_prop": 0.548152193701074,
"repo_name": "postlund/home-assistant",
"id": "0fc98d9460e69debb1d1852e84c163b8648233b6",
"size... |
from __future__ import absolute_import
from __future__ import unicode_literals
from functools import reduce
import six
from .const import LABEL_CONTAINER_NUMBER
from .const import LABEL_PROJECT
from .const import LABEL_SERVICE
class Container(object):
"""
Represents a Docker container, constructed from the... | {
"content_hash": "964d9f0572ab5cc328be07ae94d50a7b",
"timestamp": "",
"source": "github",
"line_count": 272,
"max_line_length": 81,
"avg_line_length": 28.488970588235293,
"alnum_prop": 0.5910440056781521,
"repo_name": "andrewgee/compose",
"id": "2c16863df9561d4162e8a646f2b6fd291a97ac3a",
"size": "7... |
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": "a4375734afb039d9f84f8f7b2dd485ce",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 99,
"avg_line_length": 32.81659388646288,
"alnum_prop": 0.7060545575515635,
"repo_name": "rapidsms/rapidsms-celery-router",
"id": "e179adeae5b02e9803ef005c7637dcbf7eca814f",... |
import testtools
from tempest.api.compute import base
from tempest import config
from tempest import test
CONF = config.CONF
class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
_host_key = 'OS-EXT-SRV-ATTR:host'
@classmethod
def setup_clients(cls):
super(LiveBlockMigrationTestJSON, c... | {
"content_hash": "d2700c6130f8315182c2a64719582604",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 78,
"avg_line_length": 42.05555555555556,
"alnum_prop": 0.6213672391017173,
"repo_name": "danielmellado/tempest",
"id": "d3b1f5e7fe21670d0336c6d33694d922bb00a49e",
"size":... |
from . import cpuinfo, progressbar
from .misc import *
from .time import *
| {
"content_hash": "2ab4103f1304549b1f277c21ba9fbe21",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 34,
"avg_line_length": 25,
"alnum_prop": 0.7466666666666667,
"repo_name": "MAndelkovic/pybinding",
"id": "2aad9ea62f7bd0dd1af7793fc0ad1ee08a4f9cc3",
"size": "75",
"binary"... |
import functools
import fixtures
import netaddr
from neutron_lib.api.definitions import portbindings
from neutron_lib import constants
from neutronclient.common import exceptions
from neutron.common import utils
def _safe_method(f):
@functools.wraps(f)
def delete(*args, **kwargs):
try:
r... | {
"content_hash": "9cc6971163a49a449272c8e2f4fd89c1",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 79,
"avg_line_length": 36.55882352941177,
"alnum_prop": 0.5669080182354519,
"repo_name": "noironetworks/neutron",
"id": "441c3e506617446b34eca7e8ff6b20c3a64fc283",
"size":... |
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 'GovInfoScraper'
db.create_table(u'scrapers_govinfoscraper', (
(u'id', self.gf('django.db.models.fields.A... | {
"content_hash": "82d3a480db0c5c8b9561f2ab760802c3",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 116,
"avg_line_length": 55.61764705882353,
"alnum_prop": 0.5978318350079324,
"repo_name": "adieyal/billtracker",
"id": "a0ab5406e2e2ea44a322561198b442f690516fe7",
"size": "... |
import json
from oauth2client import xsrfutil
from oauth2client.file import Storage
from django.conf import settings
from django.contrib import messages
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.http import HttpResponseBadRequest, HttpResponseRedirect, ... | {
"content_hash": "09354099afac1a319e41adebb405505d",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 175,
"avg_line_length": 37.298136645962735,
"alnum_prop": 0.6406328059950042,
"repo_name": "GDGLima/contentbox",
"id": "cd07dc6a48bf6ef60115051821a43b240e70782c",
"size": ... |
from swgpy.object import *
def create(kernel):
result = Weapon()
result.template = "object/weapon/melee/sword/shared_sword_lightsaber_sleekblack.iff"
result.attribute_template_id = 10
result.stfName("weapon_name","sword_lightsaber_sleekblack")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
... | {
"content_hash": "af00ee36805b243052a9462cff7e98f4",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 85,
"avg_line_length": 25.615384615384617,
"alnum_prop": 0.7177177177177178,
"repo_name": "anhstudios/swganh",
"id": "8e12fd69ecb4cb1f27461df8c98894cf978f3c25",
"size": "47... |
import os
import json
from http import client
from unittest import mock
import pytest
import aiohttpretty
from waterbutler.core import metadata
from waterbutler.core import exceptions
from waterbutler.core.path import WaterButlerPath
from waterbutler.providers.osfstorage.provider import OSFStorageProvider
from waterb... | {
"content_hash": "7d1fb0cf6c89968f9607b24472734f7c",
"timestamp": "",
"source": "github",
"line_count": 1255,
"max_line_length": 101,
"avg_line_length": 45.516334661354584,
"alnum_prop": 0.6024018346375365,
"repo_name": "felliott/waterbutler",
"id": "7ee414a7738e8151f88923e67b397a2e8238e7b6",
"size... |
import ddt
import mock
from cinder import exception
from cinder import test
from cinder.tests.unit.volume.drivers.netapp.dataontap.performance \
import fakes as fake
from cinder.volume.drivers.netapp.dataontap.performance import perf_base
@ddt.ddt
class PerformanceLibraryTestCase(test.TestCase):
def setUp(s... | {
"content_hash": "a4ed52b3a2001d202ae681fbcd55d639",
"timestamp": "",
"source": "github",
"line_count": 351,
"max_line_length": 78,
"avg_line_length": 42.12535612535613,
"alnum_prop": 0.5680373326119302,
"repo_name": "cloudbase/cinder",
"id": "a6efa60ca0d668c1ae5a75e61cf89009185bceef",
"size": "154... |
import unittest
import os
from conans.paths import CONANFILE, CONAN_MANIFEST
from conans.util.files import save, load
from conans.model.ref import ConanFileReference
from conans.test.utils.cpp_test_files import cpp_hello_conan_files
from conans.model.manifest import FileTreeManifest
from conans.test.utils.tools import ... | {
"content_hash": "2a5ac7d2b0291363e976857919217698",
"timestamp": "",
"source": "github",
"line_count": 422,
"max_line_length": 99,
"avg_line_length": 43.02132701421801,
"alnum_prop": 0.6109611677223905,
"repo_name": "birsoyo/conan",
"id": "f837466e7d88e73d96b0ac52376f8b4a75d3f906",
"size": "18155"... |
import mock
from rally.benchmark.context import secgroup
from tests.unit import fakes
from tests.unit import test
class SecGroupContextTestCase(test.TestCase):
def setUp(self):
super(SecGroupContextTestCase, self).setUp()
self.users = 2
task = {"uuid": "foo_task_id"}
self.secgrou... | {
"content_hash": "6b625729f587924f514821e55f3cb198",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 77,
"avg_line_length": 41.93023255813954,
"alnum_prop": 0.5986319097799963,
"repo_name": "pandeyop/rally",
"id": "34805b2f5a11bfbda82059048ce0ef58bf9fccc6",
"size": "6039"... |
"""Tests the filesystem backend store"""
import __builtin__
import errno
import hashlib
import json
import mock
import os
import stat
import StringIO
import uuid
import fixtures
from oslo_utils import units
import six
from glance_store._drivers.filesystem import ChunkedFile
from glance_store._drivers.filesystem impo... | {
"content_hash": "8ca6b7ab7f0938e896f5330633822393",
"timestamp": "",
"source": "github",
"line_count": 622,
"max_line_length": 79,
"avg_line_length": 41.58038585209003,
"alnum_prop": 0.5597958473494954,
"repo_name": "hmakkapati/glance_store",
"id": "f237a6057560b37dcf04851e8f4ae1643695d23d",
"size... |
import os
from contextlib import contextmanager
from copy import copy
import logging
from peyutil import (assure_dir_exists,
read_as_json,
write_as_json, )
from .ott_schema import HEADER_TO_LINE_PARSER
from .taxon import Taxon
from .tree import TaxonForest
from .util import ... | {
"content_hash": "045130b1d330276408d10851066e8ee2",
"timestamp": "",
"source": "github",
"line_count": 913,
"max_line_length": 110,
"avg_line_length": 38.606790799561885,
"alnum_prop": 0.548031093962778,
"repo_name": "mtholder/taxalotl",
"id": "3775f4332c5b5590a2c3fdfbb398b6e76594245c",
"size": "3... |
import collections
import sys
import mock
from neutron_lib import constants
from oslo_config import cfg
from neutron.agent.linux import bridge_lib
from neutron.agent.linux import ip_lib
from neutron.agent.linux import utils
from neutron.common import exceptions
from neutron.plugins.common import constants as p_const
... | {
"content_hash": "b234995247f6074084a52e00b85b29bd",
"timestamp": "",
"source": "github",
"line_count": 1034,
"max_line_length": 83,
"avg_line_length": 46.80947775628627,
"alnum_prop": 0.5171380756595938,
"repo_name": "bigswitch/neutron",
"id": "fe6228d42866a5ade573e67db2325253c49fc48e",
"size": "4... |
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = 'u%fk(_dcx=zl_wz@5u#tw9sw*h58848luyf7jzbi^u%_%vbi_v'
DEBUG = True
ALLOWED_HOSTS = ['*']
WSGI_APPLICATION = 'example.wsgi.application'
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contentt... | {
"content_hash": "9d0ed588ccb1db5ec9600b7ce8cc3820",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 69,
"avg_line_length": 23.658227848101266,
"alnum_prop": 0.6575708935259497,
"repo_name": "fata1ex/django-statsy",
"id": "812d19ffc84bccc78c0ea836e01dccbfd31054f5",
"size":... |
class Solution:
# @param candidates, a list of integers
# @param target, integer
# @return a list of lists of integers
def combinationSum2(self, candidates, target):
candidates.sort()
res = []
cand = []
self.combination_sum(candidates, target, cand, res)
return re... | {
"content_hash": "ee3ec61a0f2a3b05d7cf49409b0c0862",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 79,
"avg_line_length": 31.555555555555557,
"alnum_prop": 0.4788732394366197,
"repo_name": "shichao-an/leetcode-python",
"id": "a6709849dd2eb4b17b4cf74d0a4e66c18a13a765",
"s... |
"""
Module for editing date/time settings on macOS
.. versionadded:: 2016.3.0
"""
from datetime import datetime
import salt.utils.mac_utils
import salt.utils.platform
from salt.exceptions import SaltInvocationError
__virtualname__ = "timezone"
def __virtual__():
"""
Only for macOS
"""
if not salt... | {
"content_hash": "e311869c3e46273847f822992ae4db68",
"timestamp": "",
"source": "github",
"line_count": 383,
"max_line_length": 88,
"avg_line_length": 22.287206266318538,
"alnum_prop": 0.6260543580131209,
"repo_name": "saltstack/salt",
"id": "5703ab08784eac6435a42ddf56fa210fda8e665f",
"size": "8536... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('services', '0013_auto_20151117_1205'),
]
operations = [
migrations.AlterField(
model_name='story',
name='date',
... | {
"content_hash": "2878186df79d53f3dca3d70467d9377d",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 69,
"avg_line_length": 21.944444444444443,
"alnum_prop": 0.5949367088607594,
"repo_name": "vitorfs/woid",
"id": "5ad43dc6d1b21956412c3fda14905ece8df7dd11",
"size": "419",
... |
import heapq
import logging
import threading
import time
try:
from UserDict import DictMixin
except ImportError:
from collections import Mapping as DictMixin
from .token_bucket import Bucket
from six.moves import queue as Queue
logger = logging.getLogger('scheduler')
try:
cmp
except NameError:
cmp = ... | {
"content_hash": "31148efd3b5b645acc470e529b4f1155",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 100,
"avg_line_length": 30.45084745762712,
"alnum_prop": 0.5874429477902705,
"repo_name": "wangjun/pyspider",
"id": "a6d02e3a5101c8bd34121eb22ec51d9f68b3cc24",
"size": "91... |
from base import BaseDataStore
class StorageManager(BaseDataStore):
def __init__(self, get_cache_size=0, execute_cache_size=0):
super(StorageManager, self).__init__(get_cache_size, execute_cache_size)
self.inputs = []
self.outputs = []
def iteritems(self):
for _, ds, _ in self.... | {
"content_hash": "e4b7d77e6a38664f72f012ace2e74453",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 114,
"avg_line_length": 35.5921052631579,
"alnum_prop": 0.6118299445471349,
"repo_name": "elsonidoq/fito",
"id": "a4dd208896bdb6a8482915bd723250673f0c404b",
"size": "2705",... |
from django.contrib import admin
from apps.shop.models import Order, OrderLine
class OrderAdmin(admin.ModelAdmin):
model = Order
list_display = ('__str__', 'price', 'quantity', 'order_line')
class OrderInline(admin.TabularInline):
model = Order
extra = 0
readonly_fields = ['__str__']
fields... | {
"content_hash": "4d62aa48ba77ca4775a0b221acdba0da",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 100,
"avg_line_length": 25.857142857142858,
"alnum_prop": 0.6602209944751382,
"repo_name": "dotKom/onlineweb4",
"id": "d1b6cefbd4752f588567ff40b4211182e8e2ce50",
"size": "7... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import random
import string
import tasks.competition.messages as msg
from core.task import on_message, on_start, on_timeout
from fsa import build_automaton
from tasks.co... | {
"content_hash": "cfee5d57afea32d615cd542370788be0",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 137,
"avg_line_length": 38.3780487804878,
"alnum_prop": 0.6260989301980723,
"repo_name": "general-ai-challenge/Round1",
"id": "bfc1094cf422d6c2890e35387c1b4ea9c5addc43",
"... |
from __future__ import unicode_literals
from gge_proxy_manager.models import Kingdom
from lib.core.api2object.castle import import_castle_economy
from lib.socket.response import Response
from django.utils.timezone import now, timedelta
from datetime import datetime
import logging
logger = logging.getLogger(__name__)
... | {
"content_hash": "0b5836071e7d9aea401466bee498d0f7",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 116,
"avg_line_length": 36.88235294117647,
"alnum_prop": 0.580542264752791,
"repo_name": "mrcrgl/gge-storage",
"id": "49df6278c46179d397b390b04c35969c9f2e85b5",
"size": "25... |
import logging
import traceback
import uuid
from copy import deepcopy
from datetime import timedelta
from io import BytesIO
from typing import Dict, List, Optional
import bmds
import pandas as pd
import reversion
from bmds.bmds3.batch import BmdsSessionBatch
from bmds.bmds3.recommender.recommender import RecommenderSe... | {
"content_hash": "2dd1a58dbcb58e67eac67a6d3a7d6899",
"timestamp": "",
"source": "github",
"line_count": 359,
"max_line_length": 100,
"avg_line_length": 34.53481894150418,
"alnum_prop": 0.6229230521051783,
"repo_name": "shapiromatron/bmds-server",
"id": "a31e96ec9ab554177d17aac0cd96322e478155af",
"s... |
"""SE2017 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | {
"content_hash": "57e0c86fe8584cccbe1fd0dd72da75e3",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 92,
"avg_line_length": 42.13513513513514,
"alnum_prop": 0.7126363053239256,
"repo_name": "SriHarshaGajavalli/SE2017",
"id": "02ac44363eb34f9d1c9c582468af7b919c83f294",
"siz... |
from flask import url_for
from flask_admin.consts import ICON_TYPE_GLYPH
from flask_babelex import lazy_gettext
from wtforms import ValidationError
from tests.fixture import run_as_admin
from tests.object_faker import object_faker
from psi.app.const import DIRECT_PO_TYPE_KEY, PO_ISSUED_STATUS_KEY, \
RECEIVING_DRAF... | {
"content_hash": "86a771089e3a5c552edeb1a328434ca2",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 111,
"avg_line_length": 53.61417322834646,
"alnum_prop": 0.5514759876633867,
"repo_name": "betterlife/flask-psi",
"id": "8ec9982c8a9093468889acab4720352982a6cfdd",
"size":... |
"""
VGGの学習済み重みを使わない
"""
from keras import backend as K
from keras.models import Sequential, Model, model_from_json
from keras.layers import Dense, Activation, Reshape, Flatten, Dropout, TimeDistributed, Input, merge, GaussianNoise, BatchNormalization
from keras.layers import LSTM
from keras.layers import Convolution2D,... | {
"content_hash": "7f959d9cd100bca281235517da9adc15",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 135,
"avg_line_length": 31.206451612903226,
"alnum_prop": 0.6092619392185239,
"repo_name": "EggInTheShell/TodoCounting",
"id": "970941e0007bf5fe898b998ddf454c37e074a1e2",
... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'ProductAtLocation'
db.delete_table(u'locations_productatlocation')
# Adding M2M table for field p... | {
"content_hash": "403700cb3e4688962641f364fec00cd6",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 161,
"avg_line_length": 70.55696202531645,
"alnum_prop": 0.5739146035163258,
"repo_name": "puttarajubr/commcare-hq",
"id": "2667bf3c10e4fbe5d05d7ae6b0b30ffb9ba73b86",
"size... |
from testframework.testcases.domain_mock import DomainMockingSuccessfulTestCase
from testframework.testcases.rest import RESTBasedSuccessfulTestCase
class FullLayerHarnessTestCase(RESTBasedSuccessfulTestCase,
DomainMockingSuccessfulTestCase):
pass
| {
"content_hash": "338c7cd7829a009ec331b956bce543fa",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 79,
"avg_line_length": 40.42857142857143,
"alnum_prop": 0.8021201413427562,
"repo_name": "hsnlab/escape",
"id": "117bb8c2a8fbd822523da17f0d43734509fad121",
"size": "857",
... |
import train as train
import time, random
import scipy.sparse
import pycrfsuite as crf
import helper
from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.tag import pos_tag
import random
import text2num as t2n
def trainModel(holdback=-1):
## extract features
trainer = crf.Trainer(verbose=True)
... | {
"content_hash": "44218c425184f03c3749ff3146c614ce",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 116,
"avg_line_length": 33.14179104477612,
"alnum_prop": 0.6163026345417699,
"repo_name": "adi-sharma/RLIE_A3C",
"id": "9dc134541857ecc6d1729b5b9c092d216a248840",
"size": ... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField(verbose_name='ID', auto_cre... | {
"content_hash": "e7102003b4ce1365cf09bb06019c9dd9",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 114,
"avg_line_length": 28.708333333333332,
"alnum_prop": 0.5457184325108854,
"repo_name": "c-rhodes/hack2014",
"id": "e9ad478f42899df145cebc0ade2f219f4be04e69",
"size": "7... |
"""Segment Gettext PO, XLIFF and TMX localization files at the sentence level.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/posegment.html
for examples and usage instructions.
"""
from translate.storage import factory
from translate.lang import factory as lang_factory
class segm... | {
"content_hash": "0c2e159907711bf7750bcfe83f5343c8",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 132,
"avg_line_length": 42.195402298850574,
"alnum_prop": 0.6635794061563607,
"repo_name": "DESHRAJ/fjord",
"id": "e3b1cc72a39ccb104c2646d19fa8d30ba7382879",
"size": "4450"... |
"""
UnionMatcher.py
Implements a matcher that matches a set of sub-matchers.
"""
from Matcher import Matcher
class UnionMatcher(Matcher):
"""
A matcher that matches a set of sub-matchers.
"""
def __init__(self, submatchers):
self._submatchers = submatchers
maxlength = max(submatchers, key=lambda x: ... | {
"content_hash": "840bd63b9ed5206a57f0b5889bf6d05e",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 135,
"avg_line_length": 27.80392156862745,
"alnum_prop": 0.5994358251057827,
"repo_name": "jgeldart/stolat",
"id": "3e1e78863df22ee00da8c7551802104bf1ba712b",
"size": "1418... |
from __future__ import print_function
from bcc import BPF, USDT
from time import sleep, strftime
import argparse
import re
import signal
import sys
import traceback
debug = False
class Probe(object):
def __init__(self, pattern, kernel_stack, user_stack, use_regex=False,
pid=None, per_pid=False):
... | {
"content_hash": "ed48ee2ced9fcc707c6072938239120b",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 79,
"avg_line_length": 42.32865168539326,
"alnum_prop": 0.5247859844714314,
"repo_name": "mcaleavya/bcc",
"id": "9dfc06f116cf5cf14f1ec1011024fc4b4c54770a",
"size": "15702"... |
from airflow.contrib.hooks.gcs_hook import GoogleCloudStorageHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
from airflow.version import version
class GoogleCloudStorageCreateBucketOperator(BaseOperator):
"""
Creates a new bucket. Google Cloud Storage uses a fl... | {
"content_hash": "6b9d4da0f84004170c654d77c75c2bcf",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 86,
"avg_line_length": 38.945454545454545,
"alnum_prop": 0.6057422969187675,
"repo_name": "r39132/airflow",
"id": "5b430f4304f9497b0fc0a25ffca77ccc676817a1",
"size": "5096... |
survey_data['name'].value_counts()[:8] | {
"content_hash": "6d513bee8abfbe9c746b122aa75e46a5",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 38,
"avg_line_length": 38,
"alnum_prop": 0.6842105263157895,
"repo_name": "jorisvandenbossche/DS-python-data-analysis",
"id": "db2e83815d798498173da5b26ee25cda229ee311",
"si... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import collections
import contextlib
import multiprocessing
import os
import subprocess
from pants.backend.jvm.tasks.jvm_task import JvmTask
from pants.base.exception... | {
"content_hash": "0b67b2b44926b309a8602bbc3cfe4a3f",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 103,
"avg_line_length": 40.34285714285714,
"alnum_prop": 0.6612370160528801,
"repo_name": "sameerparekh/pants",
"id": "697f911a705dd7c1b9dfe5eef20df2cfc874c3ab",
"size": "... |
"""Functional test case that utilizes httplib2 against the API server"""
import datetime
import hashlib
import json
import tempfile
import httplib2
from glance.openstack.common import timeutils
from glance.tests import functional
from glance.tests.utils import skip_if_disabled, minimal_headers
FIVE_KB = 5 * 1024
FI... | {
"content_hash": "7b4a61bbb2254b26a84ea73a3cf9d312",
"timestamp": "",
"source": "github",
"line_count": 1436,
"max_line_length": 79,
"avg_line_length": 42.213091922005574,
"alnum_prop": 0.5584644824969481,
"repo_name": "tylertian/Openstack",
"id": "f0b607754e5bf0c7ed04e7d12d8ee489aad0bfed",
"size":... |
import nose
# asr modules
import pyspell.check as check
# Tests
def execution_test():
check.get_parser()
| {
"content_hash": "8425a013a138ef8e579e990bd53572ca",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 29,
"avg_line_length": 12.444444444444445,
"alnum_prop": 0.7142857142857143,
"repo_name": "MartinThoma/pyspell",
"id": "9368d354a822f4a4af95cd0fe1066237b0ee6250",
"size": "1... |
from case import Case
class Case10_1_1(Case):
DESCRIPTION = """Send text message with payload of length 65536 auto-fragmented with <b>autoFragmentSize = 1300</b>."""
EXPECTATION = """Receive echo'ed text message (with payload as sent and transmitted frame counts as expected). Clean close with normal code."""
... | {
"content_hash": "8eb63cac7f23c13518087cc05fe2ee7f",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 146,
"avg_line_length": 44,
"alnum_prop": 0.6661442006269592,
"repo_name": "mikelikespie/AutobahnTestSuite",
"id": "53e9eb613050af6c0eee95fb5dafaf13c4825535",
"size": "2042... |
import toml
import yaml
class Configuration(dict):
def __init__(self, **kwargs):
super().__init__(kwargs)
for required_arg in ["custom_order", "explicit_checks", "exclude_checks"]:
if required_arg not in self:
self[required_arg] = None
@classmethod
def from_con... | {
"content_hash": "5d93da10935cbf8129edc9dffa0f7be8",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 82,
"avg_line_length": 29.703703703703702,
"alnum_prop": 0.571072319201995,
"repo_name": "moyogo/fontbakery",
"id": "671c3c0cf0632ec0461f811e9a8faf20214fcc4b",
"size": "802... |
import os
import warnings
from typing import Any, Callable, Iterable, Optional, overload
import prestodb
from prestodb.exceptions import DatabaseError
from prestodb.transaction import IsolationLevel
from airflow import AirflowException
from airflow.configuration import conf
from airflow.hooks.dbapi import DbApiHook
f... | {
"content_hash": "1590cff8dfa3f6f8ea530f6253105d1a",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 100,
"avg_line_length": 35.57587548638132,
"alnum_prop": 0.5809909220168434,
"repo_name": "bolkedebruin/airflow",
"id": "419b571c9f92b1ac294a8606fd13688afb17d599",
"size":... |
from PIL import Image
import StringIO
import threading
import urllib2
import time
import requests
# Lock to protect the cache for write access.
_global_lock = threading.Lock()
# The cache.
_cache = {
# url : [contents, lock, last_timestamp]
}
MAX_TIME = 0.1 # ms
def webcam_cache(webcam_func):
def _webcam_... | {
"content_hash": "18c6d9ac15a6f1915f0b9207c6a79ce8",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 98,
"avg_line_length": 29.64179104477612,
"alnum_prop": 0.6160624370594159,
"repo_name": "porduna/weblabdeusto",
"id": "d103d972d93f185234d0d2766707c00a23f9634d",
"size": ... |
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 1, s, t 2.1, s, t 3.2, s, t 4.1, s, q"
tags = "Layer, Waves3D, Flip"
from cocos.director import director
from cocos.actions imp... | {
"content_hash": "03dad26174d9bc6ad9ac2b46f0c5d962",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 76,
"avg_line_length": 25.94736842105263,
"alnum_prop": 0.6159567275185936,
"repo_name": "shadowmint/nwidget",
"id": "3f1f046820b3efa31681670b96adc0f0bb38817e",
"size": "15... |
import sys
import weaver.client as client
# create graph from file
coord_id = 0
c = client.Client(client._CLIENT_ID, coord_id)
nodes = dict()
tx_id = c.begin_tx()
for i in range(6):
nodes[i] = c.create_node(tx_id)
edge_id = c.create_edge(tx_id, nodes[0], nodes[1])
c.set_edge_property(tx_id, nodes[0], edge_id, ... | {
"content_hash": "996a9b6cb81982eacef25d3da0a31c68",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 117,
"avg_line_length": 31.333333333333332,
"alnum_prop": 0.6683354192740926,
"repo_name": "sid17/weaver",
"id": "fb27dae3061f8187618f50749dc205749942e89c",
"size": "2006",... |
import sys, traceback
import os
import shutil
import requests
import time
import grequests
import itertools
from itertools import product
import multiprocessing as mp
from multiprocessing import Pool
import logging
import subprocess
from subprocess import check_call
import codecs
from xml.etree import ElementTree as ET... | {
"content_hash": "a11a13e4a4caccf669a3ef3cc99e05d4",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 94,
"avg_line_length": 35.955128205128204,
"alnum_prop": 0.5498306293456944,
"repo_name": "myoshimura080822/galaxy_in_docker_custom_bit_wf",
"id": "4dc4fb541ecb5aaa975c47188... |
__all__ = ['instagram_download']
from ..common import *
def instagram_download(url, output_dir = '.', merge = True, info_only = False):
html = get_html(url)
id = r1(r'instagram.com/p/([^/]+)/', html)
description = r1(r'<meta property="og:description" content="([^"]*)"', html)
title = description ... | {
"content_hash": "225c96525f7fd6adb4cbadbeb1596c03",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 80,
"avg_line_length": 35.1,
"alnum_prop": 0.6125356125356125,
"repo_name": "kzganesan/you-get",
"id": "6071dfd0c27376584cea894c94fa6b78c14dac58",
"size": "725",
"binary"... |
import ctypes, random, unittest, sys
from django.contrib.gis.geos import *
from django.contrib.gis.geos.base import gdal, numpy, GEOSBase
from django.contrib.gis.geos.libgeos import GEOS_PREPARE
from django.contrib.gis.geometry.test_data import TestDataMixin
class GEOSTest(unittest.TestCase, TestDataMixin):
@prop... | {
"content_hash": "945f6ebb241485dd6d7ded53381e5a67",
"timestamp": "",
"source": "github",
"line_count": 1055,
"max_line_length": 121,
"avg_line_length": 40.913744075829385,
"alnum_prop": 0.5779353164674266,
"repo_name": "skevy/django",
"id": "4620a9fb528913d2fd90d2562eebb0964c0cdeb3",
"size": "4316... |
class EtcdTime(object):
"""
An object holding a time value
"""
def __init__(self, hour, minute, second):
self.hour = hour
self.minute = minute
self.second = second
| {
"content_hash": "b984831da2aafbef116e5eff9362ade7",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 45,
"avg_line_length": 25.5,
"alnum_prop": 0.5637254901960784,
"repo_name": "box/etcdb",
"id": "450ef71234aff4bd8d1e78fd594ad8888ebb3acf",
"size": "204",
"binary": false,
... |
import mock
from neutron.agent.common import config as agent_config
from neutron.agent.l3 import router_info
from neutron.agent.linux import ip_lib
from neutron.common import constants as l3_constants
from neutron.common import exceptions as n_exc
from neutron.openstack.common import uuidutils
from neutron.tests impor... | {
"content_hash": "b4ae3301ef8b1163d81772e1675b64ce",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 79,
"avg_line_length": 38.74666666666667,
"alnum_prop": 0.573554714384033,
"repo_name": "JioCloud/neutron",
"id": "5e60aa12c8fe54d9869079c7e699393d338eee95",
"size": "1219... |
import re, string, sys
with open("../stop_words.txt") as f:
stops = set(f.read().split(",") + list(string.ascii_lowercase))
# The "database"
data = {}
# Internal functions of the "server"-side application
def error_state():
return "Something wrong", ["get", "default", None]
# The "server"-side application ha... | {
"content_hash": "8cfc9d831c4781801b774c8145aa22ab",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 116,
"avg_line_length": 33.74311926605505,
"alnum_prop": 0.5815660685154975,
"repo_name": "potherca-contrib/exercises-in-programming-style",
"id": "e8554bef807ae1f0e91f4b10c... |
"""
Test that variables of floating point types are displayed correctly.
"""
from __future__ import print_function
import AbstractBase
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class DoubleTypesTestCase(AbstractBase.GenericTester)... | {
"content_hash": "57787db0c326e481f8a9eb49ede85edf",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 83,
"avg_line_length": 28.333333333333332,
"alnum_prop": 0.7189542483660131,
"repo_name": "apple/swift-lldb",
"id": "e9704c6efb2651190ad5b5538e96fd87776b6439",
"size": "765... |
"""Tests for training.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import glob
import json
import os
import random
import shutil
import tempfile
import time
import numpy as np
from tensorflow.python.estimator import estimator as estimator_lib
fr... | {
"content_hash": "7cde9fb77b932980ff560889526b94f8",
"timestamp": "",
"source": "github",
"line_count": 1671,
"max_line_length": 80,
"avg_line_length": 39.3081986834231,
"alnum_prop": 0.6706503866999574,
"repo_name": "mdrumond/tensorflow",
"id": "d88ca2c925c7544dd1e73b4310d486c3a2f847fe",
"size": "... |
from __future__ import print_function, division
import subprocess
import time
from math import floor
from lastfm_auth import LastFMInstance, TokenRequestException, \
AuthenticationException, NotAuthenticatedException, \
ScrobbleException, NowPlayingException
#
# Change the scrobble percentage here
SCROBBLE_T... | {
"content_hash": "49a39ade775fa887ea9910f10ad5dcbb",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 153,
"avg_line_length": 32.932203389830505,
"alnum_prop": 0.5779722079258878,
"repo_name": "gouthamank/cmus-scrobble",
"id": "c73b937de28858703261948e887a7584c5a2d61a",
"s... |
"""
Helper methods for working with S3 buckets.
"""
import sys
from boto.s3.connection import S3Connection
from boto.exception import S3ResponseError
from widely.util import sizeof_fmt
class NoSuchBucket(Exception):
"""
Raised when there is no bucket for the specified sitename.
"""
pass
class NoW... | {
"content_hash": "8cc0610f567f1fe028499cc14b167bee",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 77,
"avg_line_length": 24.636363636363637,
"alnum_prop": 0.6370345521637034,
"repo_name": "zeckalpha/widely",
"id": "d4d39863da278a807270c1db7142cfd438d937c7",
"size": "29... |
"""A simple utility for constructing filesystem-like trees from beets
libraries.
"""
from __future__ import division, absolute_import, print_function
from collections import namedtuple
from beets import util
Node = namedtuple('Node', ['files', 'dirs'])
def _insert(node, path, itemid):
"""Insert an item into a v... | {
"content_hash": "15c8c819601035e9fb5e0c7f0dd2a076",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 69,
"avg_line_length": 30.736842105263158,
"alnum_prop": 0.6421232876712328,
"repo_name": "diego-plan9/beets",
"id": "7f9a049eeb0a7ea2ff6acf0815b81ef51c1bdcc5",
"size": "18... |
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('payments', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='payment',
name='token',
field=models.CharField(max_length=32, default='viki... | {
"content_hash": "0523d020038952ed5d16358f8b177825",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 66,
"avg_line_length": 22.176470588235293,
"alnum_prop": 0.5649867374005305,
"repo_name": "vladimiroff/humble-media",
"id": "73e590b7850119b3bc3e89583b4439d3fdad8869",
"siz... |
import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='git_branch_panel',
version='0.1',
packages=['git_branch_p... | {
"content_hash": "4f0c97c17e92050f7b0dec482c364be8",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 81,
"avg_line_length": 32.733333333333334,
"alnum_prop": 0.6476578411405295,
"repo_name": "rantecki/git-branch-debug-panel",
"id": "44cfef673f6c8cae7f4367a58eae23d39cd235b8",... |
"""Support for Linksys Access Points."""
import base64
import logging
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.device_tracker import (
DOMAIN,
PLATFORM_SCHEMA,
DeviceScanner,
)
from homeassistant.const import CONF_HOST, CON... | {
"content_hash": "accf6cf1131fd02ba62e32e7a113716e",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 88,
"avg_line_length": 30.544554455445546,
"alnum_prop": 0.6077795786061588,
"repo_name": "fbradyirl/home-assistant",
"id": "df24a409b9872a308599afe36696185bd8786143",
"si... |
"""This module is deprecated. Please use `airflow.providers.amazon.aws.hooks.lambda_function`."""
import warnings
# pylint: disable=unused-import
from airflow.providers.amazon.aws.hooks.lambda_function import AwsLambdaHook # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.providers.amazon.aw... | {
"content_hash": "8052000ab3e7304e9dbaffb5db7ab3a1",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 98,
"avg_line_length": 32.666666666666664,
"alnum_prop": 0.7678571428571429,
"repo_name": "spektom/incubator-airflow",
"id": "727cdf26f4e52bf964d6aba8e19373bcb5a8dab0",
"si... |
from sympy import Symbol
from sympy.matrices import Matrix, MatrixSymbol
from copy import copy
from sympy import sympify
"""
Module "arraypy" describes tensor and it's bases - Multidimentional arrays.
Module consists of Arraypy class, TensorArray class and converting functions:
list2arraypy, matrix2arraypy, list2tenso... | {
"content_hash": "d1e03517683f5f2cb25769cc0293bee3",
"timestamp": "",
"source": "github",
"line_count": 1412,
"max_line_length": 106,
"avg_line_length": 30.43201133144476,
"alnum_prop": 0.5000698161508029,
"repo_name": "AunShiLord/sympy",
"id": "45690902a98da9874c045a197842bfe886dbd52e",
"size": "4... |
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1JobStat... | {
"content_hash": "fd627484cc681ba79e32dd6d5ea497c6",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 208,
"avg_line_length": 30.30204081632653,
"alnum_prop": 0.5843211206896551,
"repo_name": "sebgoa/client-python",
"id": "afd0b4b61fcac6cdc5ced5d1a99b8a149bbfca50",
"size":... |
from json import JSONEncoder,JSONDecoder
import json
import logging
logger = logging.getLogger(__name__)
class Chirp():
def __init__(self,_method,_name = "",_uri = "",_port = 0 ,_protocol = "",_config = {},_sender=''):
self.method = _method
self.name = _name
self.uri = _uri
self.p... | {
"content_hash": "07f7b867d87a446f76029b637b6b71b5",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 121,
"avg_line_length": 23.61764705882353,
"alnum_prop": 0.5703611457036114,
"repo_name": "rahulmadhavan/chirp-python",
"id": "c6d9ad3cc91e26e23be0dfa41ad2b3b68a78a204",
"s... |
from flask import Flask
from flask_restful import reqparse, abort, Api, Resource
app = Flask(__name__)
api = Api(app)
TODOS = {
'todo1': {'task': 'build an API'},
'todo2': {'task': '?????'},
'todo3': {'task': 'profit!'},
}
def abort_if_todo_doesnt_exist(todo_id):
if todo_id not in TODOS:
abor... | {
"content_hash": "1dc333b46bbf67c986ab477cd446c0f3",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 67,
"avg_line_length": 24.440677966101696,
"alnum_prop": 0.6005547850208044,
"repo_name": "mitchfriedman/flask-restful",
"id": "860cd62dba1702ae1af87ec571ac9550da4b7f6d",
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.