text stringlengths 4 1.02M | meta dict |
|---|---|
"""superlists URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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-based vie... | {
"content_hash": "41b3c2b5d0d5142a14f6f12998cc4ae6",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 77,
"avg_line_length": 34.47826086956522,
"alnum_prop": 0.7036569987389659,
"repo_name": "rmelchorv/TDD-Cuervos",
"id": "f05df358e10775ffa272981369998abe464479cf",
"size": ... |
"""Leetcode 657. Robot Return to Origin
Easy
URL: https://leetcode.com/problems/robot-return-to-origin/
There is a robot starting at position (0, 0), the origin, on a 2D plane.
Given a sequence of its moves, judge if this robot ends up at (0, 0)
after it completes its moves.
The move sequence is represented by a str... | {
"content_hash": "cf9145c1ee5045bb199adce645de01c8",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 83,
"avg_line_length": 27.941176470588236,
"alnum_prop": 0.6006015037593985,
"repo_name": "bowen0701/algorithms_data_structures",
"id": "2a63a34c9bb25ec3aba76213d987c5935f8b... |
import unittest
import os
import gistey.gistey as gistey
class gisteyTest(unittest.TestCase):
def setUp(self):
open("test_file.py", 'a').close()
self.args = gistey.parser.parse_args(["-s",
"--files", "test_file.py",
... | {
"content_hash": "6567640b9a190fb101362fc85048b911",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 77,
"avg_line_length": 27.91891891891892,
"alnum_prop": 0.4937076476282672,
"repo_name": "meetmangukiya/gistey",
"id": "5b1defb16e5a63d902d0622494a502179d877f50",
"size": "... |
"""
Platform for Ecobee Thermostats.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/climate.ecobee/
"""
import logging
from os import path
import voluptuous as vol
from homeassistant.components import ecobee
from homeassistant.components.climate import... | {
"content_hash": "a0e26fa0091f3778e521742fffb97980",
"timestamp": "",
"source": "github",
"line_count": 386,
"max_line_length": 77,
"avg_line_length": 36.74611398963731,
"alnum_prop": 0.5948956570783982,
"repo_name": "LinuxChristian/home-assistant",
"id": "6780d3745f05e35d0037d61dc58b58b2797eefcf",
... |
import eventlet
from eventlet import Timeout
from mock import create_autospec
from nameko.containers import ServiceContainer
from nameko.testing.utils import wait_for_call
from nameko.timer import Timer
def spawn_managed_thread(fn, identifier=None):
return eventlet.spawn(fn)
def test_provider():
container ... | {
"content_hash": "50b0cd53b2f4f99afd4a61d51e04527d",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 69,
"avg_line_length": 26.333333333333332,
"alnum_prop": 0.6973532796317606,
"repo_name": "Alecto3-D/testable-greeter",
"id": "b04ce64eebbbbd8e6cbf900441123007aa6d9848",
"s... |
"""
This script generates tests text-emphasis-position-property-001 ~ 006
which cover all possible values of text-emphasis-position property with
all combination of three main writing modes and two orientations. Only
test files are generated by this script. It also outputs a list of all
tests it generated in the format... | {
"content_hash": "020415b6918ca6b98a75f938aed2df41",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 153,
"avg_line_length": 44.243589743589745,
"alnum_prop": 0.6731382208055636,
"repo_name": "nwjs/chromium.src",
"id": "527959068762f5a7185bf11bdc2536054d2db258",
"size": "3... |
"""
homeassistant.components.light.blinksticklight
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for Blinkstick lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.blinksticklight/
"""
import logging
from homeassistant.components.light... | {
"content_hash": "486ae8d04f8c17754da8abfa238e9eb1",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 76,
"avg_line_length": 27.6,
"alnum_prop": 0.591304347826087,
"repo_name": "nnic/home-assistant",
"id": "5e2f026aa90f6c11b48db1cfcd5a8c0b9a9d20a4",
"size": "2070",
"binar... |
from kansha.cardextension.tests import CardExtensionTestCase
from .comp import CardWeightEditor
class CardWeightTest(CardExtensionTestCase):
extension_name = 'weight'
extension_class = CardWeightEditor
def test_copy(self):
self.extension.weight(u'25')
self.extension.commit()
sel... | {
"content_hash": "4283fe6394437ddcacd6b7eb792ebb0a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 63,
"avg_line_length": 29,
"alnum_prop": 0.7176724137931034,
"repo_name": "bcroq/kansha",
"id": "c8a9b488a4be9f1ea58262c50c91c869f3929952",
"size": "709",
"binary": false... |
__author__ = "esemi"
from collections import deque
import numpy
from scipy.cluster import *
from scipy.spatial.distance import cdist
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from shared import get_data
def kmeans_export(centroids, data, labels):
"""Export kmeans result"""
re... | {
"content_hash": "4ac79b9e41256f5b9489b362c303119c",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 123,
"avg_line_length": 24.839285714285715,
"alnum_prop": 0.6232925952552121,
"repo_name": "esemi/blogpost_clustering",
"id": "ff1757fdbaf78b9b9d778681926d5a3edc83fc92",
"s... |
from telemetry.page import page_benchmark_results
class CsvPageBenchmarkResults(page_benchmark_results.PageBenchmarkResults):
def __init__(self, results_writer, output_after_every_page):
super(CsvPageBenchmarkResults, self).__init__()
self._results_writer = results_writer
self._did_output_header = False
... | {
"content_hash": "5205ccf600562b88a3902ef96a399b28",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 78,
"avg_line_length": 37.217948717948715,
"alnum_prop": 0.7144333448157079,
"repo_name": "codenote/chromium-test",
"id": "16df18e5fb2066c05654bba6c6e525e25fc1888d",
"size"... |
"""
Test settings for Big Data For Education project.
- Used to run tests fast on the continuous integration server and locally
"""
from .base import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
# Turn debug off so tests run faster
DEBUG = False
TEMPLATES[0]['OP... | {
"content_hash": "592d05a7ccf833d874dbffbf0f193ffe",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 80,
"avg_line_length": 32.0655737704918,
"alnum_prop": 0.5086912065439673,
"repo_name": "phoebeargon/BigDataForEducation",
"id": "4708e45c338c3f7256f8d9e31a3ec72a576d6935",
... |
"""
Pelix remote services: Specifications handling utility methods
:author: Thomas Calmant
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.5.7
:status: Beta
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this... | {
"content_hash": "a7488e63598992a9c6982d0ff6d77370",
"timestamp": "",
"source": "github",
"line_count": 808,
"max_line_length": 80,
"avg_line_length": 30.183168316831683,
"alnum_prop": 0.5895112350336231,
"repo_name": "ahmadshahwan/cohorte-runtime",
"id": "4a8145d404617349304bb0ec2d1ee18a8c53c06e",
... |
from SeaIceConnector import *
from threading import Condition
class ScopedSeaIceConnector (SeaIceConnector):
"""
A SeaIce DB Connector which is released to the pool from whence it
came when it goes out of scope. This type of connector is produced by
:func:`seaice.ConnectorPool.SeaIceConnectorPool.getS... | {
"content_hash": "493d455e37a9a34e0315f5286ab297a4",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 90,
"avg_line_length": 28.155555555555555,
"alnum_prop": 0.6610102604577742,
"repo_name": "nassar/yamz",
"id": "ca42c244e6a3387a77d54bd7c4e4d1e2f444922a",
"size": "4342",
... |
"""Tests for the Lutron Caseta integration."""
from homeassistant.const import STATE_ON
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from . import MockBridge, async_setup_integration
async def test_light_unique_id(hass: HomeAssistant) -> None:
"""Test a l... | {
"content_hash": "f3d8ddf2c32ef1550bb48892a8f9ebac",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 93,
"avg_line_length": 35.22222222222222,
"alnum_prop": 0.7392218717139852,
"repo_name": "nkgilley/home-assistant",
"id": "6449ce048328b08f12856250032feba3ad28a88b",
"size"... |
import re, json, sys, traceback
from urlparse import urlparse
from hashlib import sha1
from datetime import datetime
from base64 import b64encode
from twisted.internet.defer import inlineCallbacks
from vumi.transports import Transport
from vumi.utils import http_request_full
from vumi import log
from vusion.error im... | {
"content_hash": "ddafe4b0dab450d2842956e56656031d",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 101,
"avg_line_length": 38.32231404958678,
"alnum_prop": 0.5415139098555101,
"repo_name": "texttochange/vusion-backend",
"id": "7795955496d6b8c8df0d147f869feb3af1759c4d",
... |
"""Tests for tensorflow.ops.tf.scatter."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
def _AsType(v, vtype):
return v.astype(vtype) if isinstance(v, np.ndarray) else vtype(v)
def _NumpyAdd(ref, indices,... | {
"content_hash": "7bffc58561a45499d74d0434ec42333f",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 95,
"avg_line_length": 41.722972972972975,
"alnum_prop": 0.5475303643724696,
"repo_name": "DailyActie/Surrogate-Model",
"id": "0bbf0b9ce2dd112f814d4e3094578876da08498a",
"... |
from __future__ import absolute_import, unicode_literals
from contextlib import contextmanager
from .base import AppData, ContentStore
class AppDataDisabled(AppData):
"""No application cache available (most likely as we don't have write permissions)"""
def __init__(self):
pass
error = RuntimeE... | {
"content_hash": "57c74f08dcf059b571ce605ca97c00f3",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 96,
"avg_line_length": 19.71641791044776,
"alnum_prop": 0.6010598031794095,
"repo_name": "TeamSPoon/logicmoo_workspace",
"id": "937aa9a47436800f6ba221bcb022ee57530d87c4",
"... |
from __future__ import division, print_function
"""
Scripts to automate running the DEIMOS spec1d pipeline (in IDL)
"""
import os
import sys
import time
invoke_spec2d_templ = "et_domask,'{planfn}'\nexit\n"
def invoke_spec2d(path, maskname):
"""
Runs spec2d in the given path, assuming there's a {maskname}.p... | {
"content_hash": "45d934996b514c5fd34f17ea2bec16e7",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 89,
"avg_line_length": 31.984,
"alnum_prop": 0.587543771885943,
"repo_name": "eteq/erikutils",
"id": "03a3c82deb60efec7c2d63092846b716cdf877ba",
"size": "3998",
"binary"... |
import asyncore
import unittest
import select
import os
import socket
import sys
import time
import warnings
import errno
from test import test_support
from test.test_support import TESTFN, run_unittest, unlink
from StringIO import StringIO
try:
import threading
except ImportError:
threading ... | {
"content_hash": "22478c4ca92c4e34b2db458340f1e2c0",
"timestamp": "",
"source": "github",
"line_count": 722,
"max_line_length": 78,
"avg_line_length": 31.734072022160664,
"alnum_prop": 0.5639402932960894,
"repo_name": "ktan2020/legacy-automation",
"id": "c28bb7d4eb8a7da654b5957d8a5ba74545139a4c",
"... |
def attributesFromDict(d, obj=None, objName="self"):
if obj is None:
obj = d.pop(objName)
for n, v in d.iteritems():
setattr(obj, n, v)
class Before:
def __init__(self, foo, bar, baz, boom=1, bang=2):
self.foo = foo
self.bar = bar
self.baz = baz
self.boom = b... | {
"content_hash": "01002fc08dd9960c1b0fab480656552b",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 54,
"avg_line_length": 26.764705882352942,
"alnum_prop": 0.5560439560439561,
"repo_name": "ActiveState/code",
"id": "59b749397a635a1a9828400d9e9aa56fb9587407",
"size": "455... |
# Std libs
import os
import sqlite3
import time
# Non-std libs
import visa
# My libs
from instr.ke2636a import Keithley2636A
from instr.sci9700 import Sci9700
## Configurations ---------------------------------------------------------------
debug_mode = False # Set True while development without instruments.
#sci_rs... | {
"content_hash": "7b0270176ed561eed1d90ffccd00cf2c",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 81,
"avg_line_length": 28.82278481012658,
"alnum_prop": 0.556873078612209,
"repo_name": "wataash/Instr",
"id": "ea8a1f39897758d74937663eaffce20e4e55b1bf",
"size": "2279",
... |
from OpenGL.GL import *
import pywavefront.parser as parser
import pywavefront.texture as texture
class Material(object):
def __init__(self, name):
self.name = name
self.diffuse = [.8, .8, .8, 1.]
self.ambient = [.2, .2, .2, 1.]
self.specular = [0., 0., 0., 1.]
self.emissiv... | {
"content_hash": "c7016f8f93a4cba21dd2f934e37c18d7",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 79,
"avg_line_length": 31.355371900826448,
"alnum_prop": 0.6038481813389562,
"repo_name": "elgrandt/ShooterInc",
"id": "f72bd8ae65fb7e4bb2f7694fe3f07aad90af90c7",
"size": ... |
"""Handles all requests relating to volumes."""
import collections
import datetime
import functools
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from oslo_utils import timeutils
from oslo_utils import uuidutils
import six
from cinder.api import common
from cinder i... | {
"content_hash": "50c57c39b9d8aa54d90254fff9a990a8",
"timestamp": "",
"source": "github",
"line_count": 1508,
"max_line_length": 79,
"avg_line_length": 44.64655172413793,
"alnum_prop": 0.5297726023734906,
"repo_name": "tlakshman26/cinder-new-branch",
"id": "5eaa64dc1b4a5fedd6f6334742a69709bedbd8a5",
... |
import copy
import mock
import testtools
from testtools.matchers import HasLength
from ironicclient.common import base
from ironicclient.tests import utils
from ironicclient.v1 import node
NODE1 = {'id': 123,
'uuid': '66666666-7777-8888-9999-000000000000',
'chassis_uuid': 'aaaaaaaa-1111-bbbb-2222-ccc... | {
"content_hash": "4ab809c2d9f339fc7b4eb5de6784c3e6",
"timestamp": "",
"source": "github",
"line_count": 654,
"max_line_length": 79,
"avg_line_length": 30.827217125382262,
"alnum_prop": 0.5112841624919399,
"repo_name": "redhat-openstack/python-ironicclient",
"id": "a5b04300c1ac07c5836db51e80f4adec655e... |
from telemetry import decorators
from telemetry.page import page
from telemetry.unittest_util import options_for_unittests
from telemetry.unittest_util import page_test_test_case
from telemetry.util import wpr_modes
from measurements import thread_times
from metrics import timeline
class AnimatedPage(page.Page):
d... | {
"content_hash": "37164474d3b33bc6da5421e20dc853a4",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 78,
"avg_line_length": 40.1578947368421,
"alnum_prop": 0.743993010048056,
"repo_name": "SaschaMester/delicium",
"id": "7e7186c7d86dc250784e41ef25cbbaafa51de32e",
"size": "2... |
def city_country(name, country):
return f"{name}, {country}."
print(city_country("Buenos Aires" , "Argentina") )
print(city_country("Bogota", "Colombia"))
print(city_country("Caracas" , "Venezuela")) | {
"content_hash": "ebb81a359acce7a8116a148d0ede1f48",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 53,
"avg_line_length": 34.5,
"alnum_prop": 0.6811594202898551,
"repo_name": "AnhellO/DAS_Sistemas",
"id": "00eec6f8328088812f211211bb8707508fc159fc",
"size": "207",
"binar... |
"""Test parsing an append_env action."""
import io
import os
import textwrap
from launch.actions import AppendEnvironmentVariable
from launch.frontend import Parser
def test_append_env():
xml_file = \
"""\
<launch>
<append_env name="my_env_var" value="asd"/>
<append_env n... | {
"content_hash": "a525f78ac10c359462e6e0b18d4376b6",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 90,
"avg_line_length": 53.214285714285715,
"alnum_prop": 0.6513422818791946,
"repo_name": "ros2/launch",
"id": "5b651f3450d016a584d897a4d6b063f837478f84",
"size": "3582",
... |
from factory import (
SubFactory,
)
from factory.django import DjangoModelFactory
from accelerator.tests.factories.startup_factory import StartupFactory
from accelerator.models import BusinessProposition
class BusinessPropositionFactory(DjangoModelFactory):
class Meta:
model = BusinessProposition
... | {
"content_hash": "a4e49571e0b465e7007a98b2f0746641",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 70,
"avg_line_length": 25.642857142857142,
"alnum_prop": 0.807799442896936,
"repo_name": "masschallenge/django-accelerator",
"id": "72d8dcef43c680f921e91efb8094ead8143d5d3d",... |
from . import FairseqEncoder
class CompositeEncoder(FairseqEncoder):
"""
Encoder class that forwards on multiple encoders, for example for a fusion model or question-answering
Accepts a dictionary of encoder, the first encoder's dictionary is used for initialization
"""
def __init__(self, encoder... | {
"content_hash": "a2f4c99059e4e8a2297b858b31d61645",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 106,
"avg_line_length": 37.73529411764706,
"alnum_prop": 0.65705378020265,
"repo_name": "mlperf/training_results_v0.5",
"id": "d2e3d048661413bee7192a2d75cfa9490e36ed66",
"s... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('admin', 'admin@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'db.sqlite3',
}
}
SHORT_CACHE_TIMEOUT = 60 # One Minute
LOGIN_URL = '/auth/signin/'
# Hosts/domain names that ar... | {
"content_hash": "34ad967daab20c8b331888cb5c7317f8",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 79,
"avg_line_length": 30.133333333333333,
"alnum_prop": 0.6949115044247788,
"repo_name": "brandonivey/marimo-comments",
"id": "3486f50f1c7377b525395551692d51f4d026c89e",
... |
from distutils.core import setup
from setuptools import find_packages
packages = [
'tsheets',
'tsheets.repos',
'tsheets.models',
]
setup(
name='tsheets',
version='0.3',
description='API library helper for TSheets.com',
long_description='Allows to use the TSheets.com API to manage the ... | {
"content_hash": "a50952a71bdc72310d9170ab95f10178",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 109,
"avg_line_length": 27.607142857142858,
"alnum_prop": 0.6442432082794308,
"repo_name": "tsheets/api_python",
"id": "884f5f2af5f4a49679145b95e38e70dc0d85d744",
"size": "... |
__author__ = 'frank'
class BaseObject(object):
def __init__(self):
self.netki_client = None
def set_netki_client(self, netki_client):
"""
After instantiating the client in the appropriate mode, adding the client to the object will allow for API
operations.
:param ne... | {
"content_hash": "2da62f1ac2ec0c754d9c2a527b281163",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 114,
"avg_line_length": 24.833333333333332,
"alnum_prop": 0.6375838926174496,
"repo_name": "netkicorp/python-partner-client",
"id": "4b04b68f4fb56c9e8d4c60d978ec089ceb88b792"... |
from .. import wma
from .util import TestData, eq_
def test1():
# test1.wma is a normal, valid wma file
w = wma.WMADecoder(TestData.filepath('wma/test1.wma'))
eq_(w.artist, 'Modest Mouse')
eq_(w.album, 'The Moon & Antarctica')
eq_(w.title, '3rd Planet')
eq_(w.genre, 'Rock')
eq_(w.comment, '... | {
"content_hash": "2025f0eecc94bb5c0082da95afc4e96e",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 99,
"avg_line_length": 31.2972972972973,
"alnum_prop": 0.6292458261370178,
"repo_name": "jmtchllrx/pyMuse",
"id": "e07bb2ad52c23257497c03facacad5b5c8c9dba4",
"size": "3808... |
import functools
import os
import tempfile
import mock
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_utils import fileutils
import six
from nova.compute import arch
from nova import context
from nova import exception
from nova import objects
from nova import test
from nova.tests.unit... | {
"content_hash": "40ab2fb1aa29cb8bfe45b45be9ad7e63",
"timestamp": "",
"source": "github",
"line_count": 709,
"max_line_length": 79,
"avg_line_length": 41.400564174894214,
"alnum_prop": 0.555513916805778,
"repo_name": "HybridF5/nova",
"id": "599d51538b9942bee2bddebfd17db2a9339a8e12",
"size": "30026"... |
import os
import psycopg2
from petl import *
import argparse
# get the subdirectory containing the .csv files from the command line and check that it exists.
#
parser = argparse.ArgumentParser(description='Import .csv files for the Freshwater Species Database.')
parser.add_argument('subdir', help="name of the database... | {
"content_hash": "3275f9ffcba957aa2839e45b5b82c1d5",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 102,
"avg_line_length": 35.075949367088604,
"alnum_prop": 0.4957596535546734,
"repo_name": "NewCaliforniaWaterAtlas/ca-freshwater-species-backend",
"id": "42075f5df65f833f75... |
from sqlalchemy import orm
from sqlalchemy.event import listens_for
from sqlalchemy.orm import column_property
from sqlalchemy.sql import select
from indico.core.db import db
from indico.core.db.sqlalchemy import PyIntEnum
from indico.util.enum import RichIntEnum
from indico.util.i18n import _
from indico.util.locator... | {
"content_hash": "a389596de583e8e401f19163aa7d3ac2",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 105,
"avg_line_length": 40.60215053763441,
"alnum_prop": 0.6558968926553672,
"repo_name": "DirkHoffmann/indico",
"id": "d666e4d69af850aef96b7cb2baa34ca8b1567bac",
"size": ... |
from test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from util import *
import os
import shutil
# Create one-input, one-output, no-fee transaction:
class MempoolCoinbaseTest(BitcoinTestFramework):
def setup_network(self):
# Just need one node ... | {
"content_hash": "82159598c7fb530dbee3a676c790f635",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 92,
"avg_line_length": 40.44871794871795,
"alnum_prop": 0.6335974643423138,
"repo_name": "denverl/bitcoin",
"id": "6f7f577e36cfe50f1e1ed461f6f8a2fc4f900f51",
"size": "3451"... |
from tempest.api.compute import base
from tempest.test import attr
import time
class AttachInterfacesV3TestJSON(base.BaseV3ComputeTest):
_interface = 'json'
@classmethod
def setUpClass(cls):
if not cls.config.service_available.neutron:
raise cls.skipException("Neutron is required")
... | {
"content_hash": "9e135b6fedac3a30b1759e2739413ff6",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 75,
"avg_line_length": 37.24271844660194,
"alnum_prop": 0.5951511991657977,
"repo_name": "armando-migliaccio/tempest",
"id": "f208a4b514dcf6d73418c9527f4fe663c7ba9f9c",
"s... |
"""Train only on the labelled images in the semi-supervised setting."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.compat.v1 as tf
import datasets
import semi_supervised.utils as ss_utils
import trainer
import utils
def model_fn(da... | {
"content_hash": "5eafe97bd6cd399d7a88c1891a99c4b3",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 80,
"avg_line_length": 38.529411764705884,
"alnum_prop": 0.6950381679389313,
"repo_name": "google-research/s4l",
"id": "4b35250100c3017b232098f49c2269dc50a72a8d",
"size": "... |
from django.db import models
import multilingual
class Category(models.Model):
created = models.DateTimeField(auto_now_add=True)
class Translation(multilingual.Translation):
name = models.CharField(max_length=250)
class OtherModel(models.Model):
name = models.CharField(max_length=250)
| {
"content_hash": "9633b323df0fd5df44e9081e777d828d",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 53,
"avg_line_length": 28.09090909090909,
"alnum_prop": 0.7540453074433657,
"repo_name": "fabiocorneti/django-multilingual",
"id": "877fef4b001229a6c417c6b8bb29a99e1398206d",... |
import copy
from tempest.lib.services.compute import quota_classes_client
from tempest.tests.lib import fake_auth_provider
from tempest.tests.lib.services import base
class TestQuotaClassesClient(base.BaseServiceTest):
FAKE_QUOTA_CLASS_SET = {
"injected_file_content_bytes": 10240,
"metadata_item... | {
"content_hash": "b5e80a255dcf2d0e277075436ffcb565",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 71,
"avg_line_length": 34.70175438596491,
"alnum_prop": 0.6132457027300303,
"repo_name": "Juniper/tempest",
"id": "22d8b91a3d4ecafcc766a3c6c9ed884f0130911d",
"size": "2609"... |
from __future__ import division
import numpy as np
from .mesh import MeshVisual
from ..geometry import MeshData
class SurfacePlotVisual(MeshVisual):
"""Displays a surface plot on a regular x,y grid
Parameters
----------
x : ndarray | None
1D/2D array of values specifying the x positions of ... | {
"content_hash": "f8f48c183f75d6c150a66cb71a2fbc31",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 79,
"avg_line_length": 37.39877300613497,
"alnum_prop": 0.5360892388451444,
"repo_name": "Eric89GXL/vispy",
"id": "cf8c3bf91d2c73aa735dbaa8d754d542fd61f956",
"size": "6256... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('ecommerce', '0003_order_user'),
]
operations = [
migrations.CreateModel(
name='... | {
"content_hash": "c87f8c3c042d59b383feffb8b724b9b4",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 153,
"avg_line_length": 34.3235294117647,
"alnum_prop": 0.5801199657240789,
"repo_name": "mitodl/micromasters",
"id": "25a62a62fdf0decb43648d3a55cb5ddacdf9aae2",
"size": "1... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('members', '0008_auto_20160923_2056'),
('boards', '0030_auto_20160925_1843'),
]
operations = [
... | {
"content_hash": "1c0d67ea6f918eb0a4e73f7377aa9849",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 167,
"avg_line_length": 48.645161290322584,
"alnum_prop": 0.6312997347480106,
"repo_name": "diegojromerolopez/djanban",
"id": "024578711f8c59a99c1ec8c5208d580a656c2f46",
"s... |
import __builtin__
import gc
import sys
import types
import unittest
import popen2 # trigger early the warning from popen2.py
import weakref
from copy import deepcopy
from test import test_support
class OperatorsTest(unittest.TestCase):
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__... | {
"content_hash": "edc11bece937eba5f431176e62aec829",
"timestamp": "",
"source": "github",
"line_count": 4770,
"max_line_length": 92,
"avg_line_length": 33.89412997903564,
"alnum_prop": 0.47834853873511674,
"repo_name": "shiblon/pytour",
"id": "a6bb3197853a7fd0ebf202aa6370bb5dd6399fa0",
"size": "161... |
"""Handle the interface to GGRC models for all login methods.
"""
from ggrc import db, settings
from ggrc.models.context import Context
from ggrc.models.person import Person
from ggrc.fulltext import get_indexer
from ggrc.fulltext.recordbuilder import fts_record_for
from ggrc.services.common import log_event
from ggrc... | {
"content_hash": "42ec6fe12c9b3f228e526e49291f5cf8",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 77,
"avg_line_length": 30.357142857142858,
"alnum_prop": 0.7025882352941176,
"repo_name": "prasannav7/ggrc-core",
"id": "082155335249ec6b65296e5600a607acd879959c",
"size": ... |
import random
def main():
rl = RandList(1, 2000)
rl.gen_random_list()
rl.print_block_list()
class RandList(object):
def __init__(self, first, second):
self.first = first
self.second = second
self.populacao = []
def gen_random_list(self):
self.populacao = range(sel... | {
"content_hash": "e927848115e260bfc837a2b2f960256e",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 55,
"avg_line_length": 21.96551724137931,
"alnum_prop": 0.5416012558869702,
"repo_name": "tonussi/freezing-dubstep",
"id": "0135525025d5a5fc9bcd2233aa01f32838a11315",
"size... |
from urlparse import urlparse
from nose.tools import * # flake8: noqa
from framework.auth.core import Auth
from website.models import NodeLog
from website.views import find_bookmark_collection
from website.util import permissions
from website.util.sanitize import strip_html
from api.base.settings.defaults import AP... | {
"content_hash": "b6883cf2a01441192ae734efb6fb2df1",
"timestamp": "",
"source": "github",
"line_count": 1027,
"max_line_length": 174,
"avg_line_length": 45.996105160662125,
"alnum_prop": 0.5894830433125873,
"repo_name": "RomanZWang/osf.io",
"id": "f6871dbcd4c62ebe02e9aa54774a726695a34848",
"size": ... |
from rest_framework.views import APIView
from rest_framework import generics
from rest_framework.mixins import DestroyModelMixin
from rest_framework.response import Response
from rest_framework import authentication, permissions
from comments.models import Comment
from .permissions import IsOwnerOrReadOnly
from .seri... | {
"content_hash": "5db2909f963fd2813e91866351e8b3b7",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 78,
"avg_line_length": 32.18181818181818,
"alnum_prop": 0.7052730696798494,
"repo_name": "srvup/srvup-comments",
"id": "86156bc800c91fbd7480aae47ecdc64557456bc7",
"size": "... |
"""
Created on Thu Apr 11 14:50:17 2013
@author: bovy
Examples using the diagnostics module of pygchem.
"""
import os
import datetime
import numpy as np
import temp.diagnostics as gdiag
ws = "/Volumes/data/03_geo/geoschem/GEOS-Chem-rundirs/4x5/geos5/standard"
bpch_fname = "ctm.bpch"
# import a CTM file (only bi... | {
"content_hash": "16fc1906fe3dc861b2545ae0c4c4fe7f",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 76,
"avg_line_length": 35.96,
"alnum_prop": 0.6755654430849092,
"repo_name": "benbovy/PyGChem_examples",
"id": "0a5f603c5aeec8f8a7ef8d1d37204b0533ffe8f0",
"size": "2721",
... |
from datetime import datetime
from sqlalchemy import Column, DateTime, ForeignKey, String
from sqlalchemy.orm import relationship
from sqlalchemy.schema import UniqueConstraint, ForeignKeyConstraint
from uuid import uuid4
from changes.config import db
from changes.db.types.guid import GUID
from changes.db.types.json i... | {
"content_hash": "f904b67d037d6b9af5c5ff72433db9df",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 84,
"avg_line_length": 35.84,
"alnum_prop": 0.6607142857142857,
"repo_name": "bowlofstew/changes",
"id": "77f7981a3746e4b3e6a463b2b68ad1ced736c94e",
"size": "2689",
"bina... |
'''
FreeType high-level python API
This the bindings for the high-level API of FreeType (that must be installed
somewhere on your system).
Note:
-----
C Library will be searched using the ctypes.util.find_library. However, this
search might fail. In such a case (or for other reasons), you can specify the
FT_library_... | {
"content_hash": "5b38fa196a628234402ab33dec887b37",
"timestamp": "",
"source": "github",
"line_count": 1882,
"max_line_length": 91,
"avg_line_length": 38.07704569606801,
"alnum_prop": 0.5840973472321067,
"repo_name": "davidcox/freetype-py",
"id": "b4ce21ec5f7991b4bfbe34faab112d25fa44b976",
"size":... |
from yass.batch.batch import BatchProcessor
from yass.batch.reader import RecordingsReader, BinaryReader, MemoryMap
from yass.batch.generator import IndexGenerator
from yass.batch.pipeline import PipedTransformation, BatchPipeline
from yass.batch.vectorize import vectorize_parameter
__all__ = ['BatchProcessor',
... | {
"content_hash": "305bfb275700e28c2044abc26a98e96d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 71,
"avg_line_length": 39.23076923076923,
"alnum_prop": 0.7156862745098039,
"repo_name": "paninski-lab/yass",
"id": "252fa50901325b58b43c620017d2c60f3eafc3ea",
"size": "510... |
from google.datacatalog_connectors.rdbms.scrape import MetadataNormalizer
class SQLObjectsMetadataNormalizer(MetadataNormalizer):
@classmethod
def normalize(cls, metadata, metadata_definition):
"""
Receives a Pandas dataframe and normalizes it by creating a dictionary
with SQL Objec... | {
"content_hash": "3d59d919f078fef54161a9e75a6097cc",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 79,
"avg_line_length": 36.02884615384615,
"alnum_prop": 0.45102748865759273,
"repo_name": "GoogleCloudPlatform/datacatalog-connectors-rdbms",
"id": "86ea140f0b582634a649481d... |
"""
General utilities for the application.
"""
default_app_config = 'calaccess_processed_filings.apps.CalAccessProcessedFilingsConfig'
| {
"content_hash": "957ecbfe0b4d37bc3946954177522d13",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 87,
"avg_line_length": 33.75,
"alnum_prop": 0.8074074074074075,
"repo_name": "california-civic-data-coalition/django-calaccess-processed-data",
"id": "c173bc51156d4bcbdb68cad2... |
from kpm.formats.kub import Kub
DEFAULT_ENDPOINT = "http://localhost:5000"
def build(package,
version_query=None,
namespace="default",
variables={},
shards=None,
endpoint=DEFAULT_ENDPOINT):
"""
A build is the construction/expansion of a package.
The resu... | {
"content_hash": "f3381596403655c51df6cfe85020f087",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 96,
"avg_line_length": 33.49107142857143,
"alnum_prop": 0.5814449480138629,
"repo_name": "ant31/kpm",
"id": "8cf1010287c1d69ca15498d8da7698b821fc9d0d",
"size": "3751",
"... |
import json
_VSCODE_max_len = 200
# In IJupyterVariables.getValue this '_VSCode_JupyterTestValue' will be replaced with the json stringified value of the target variable
# Indexes off of _VSCODE_targetVariable need to index types that are part of IJupyterVariable
_VSCODE_targetVariable = json.loads('_VSCode_JupyterTest... | {
"content_hash": "f1d1c241631509ab411407b2555199b8",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 135,
"avg_line_length": 47.333333333333336,
"alnum_prop": 0.7438380281690141,
"repo_name": "jwatson/dotfiles",
"id": "1b4e8b3e87d55203529be29b858553162aa12763",
"size": "11... |
from django.db import models
from django.contrib.auth.models import User
from datetime import datetime
class Categorie(models.Model):
id = models.AutoField(primary_key=True, db_column='id')
name = models.CharField(max_length=45, unique=True, db_column='name')
description = models.TextField(db_column='descr... | {
"content_hash": "ab5fa4a98f98ead0db66b5007fa4bdfe",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 134,
"avg_line_length": 47.82222222222222,
"alnum_prop": 0.7044609665427509,
"repo_name": "Crypt0-M3lon/k6",
"id": "b6cd4afd745689ba805a0805dd5445a96552f511",
"size": "2176... |
import os
import six
import subprocess
import sys
import time
from girder import config
from girder.api import access
from girder.api.describe import Description, describeRoute
from girder.api.rest import Resource
from girder.constants import registerAccessFlag, ROOT_DIR
from girder.exceptions import RestException
fro... | {
"content_hash": "e119d3b58be198c1889c0c0dfbecd841",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 92,
"avg_line_length": 39.4780487804878,
"alnum_prop": 0.5931051526010133,
"repo_name": "jbeezley/girder",
"id": "c11a31446dfcb7cc82aee1aa0540b97db17a2e15",
"size": "8117"... |
"""
test_tempest_lib
----------------------------------
Tests for `tempest_lib` module.
"""
from tempest_lib.tests import base
class TestTempest_lib(base.TestCase):
def test_something(self):
pass
| {
"content_hash": "dd760d49459b1152cdd4172ee8c0cb8e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 37,
"avg_line_length": 15.214285714285714,
"alnum_prop": 0.5727699530516432,
"repo_name": "JioCloud/tempest-lib",
"id": "76d74a6af4eb960de755ae460a29b8bfb185ea63",
"size": ... |
Test.assert_equals(repeat_it('*', 3), '***')
Test.assert_equals(repeat_it('Hello', 5), 'HelloHelloHelloHelloHello')
| {
"content_hash": "95b97d7bf5274c61e9b4c9a8d72622ec",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 70,
"avg_line_length": 58,
"alnum_prop": 0.6896551724137931,
"repo_name": "RevansChen/online-judge",
"id": "7f547ebe763c88824cc62ad6d4973b5cade2aa75",
"size": "134",
"bina... |
from SimpleCV.base import *
from SimpleCV.ImageClass import Image
from SimpleCV.Features.FeatureExtractorBase import *
class HueHistogramFeatureExtractor(FeatureExtractorBase):
"""
Create a Hue Histogram feature extractor. This feature extractor
takes in an image, gets the hue channel, bins the number of p... | {
"content_hash": "0f684e2ba61bcb260ae918dc6290b48d",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 84,
"avg_line_length": 33.369565217391305,
"alnum_prop": 0.6247557003257329,
"repo_name": "jayrambhia/SimpleCV2",
"id": "efc92044e2975ffa707e5db29ab22ec067191b28",
"size": ... |
from django.views import generic
from traceability.models.item import Item
from traceability.forms.item import ItemUpdate
class ItemDetail(generic.DetailView):
template_name = 'traceability/item/item_detail.html'
model = Item
class ItemList(generic.ListView):
template_name = 'traceability/item/item_list... | {
"content_hash": "a5daae6cb09d6e3002040a92d795bc7a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 56,
"avg_line_length": 25.25,
"alnum_prop": 0.7465346534653465,
"repo_name": "vandorjw/django-traceability",
"id": "8cfec0abf4481f79848b42b0f89c3872b6c22408",
"size": "505"... |
from __future__ import division
import numpy as np
import pytest
import pandas.util.testing as tm
from pandas import compat
from pandas._libs.interval import IntervalTree
def skipif_32bit(param):
"""
Skip parameters in a parametrize on 32bit systems. Specifically used
here to skip leaf_size parameters r... | {
"content_hash": "77c7c50969340a7b881aea9dea7e1647",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 77,
"avg_line_length": 37.60344827586207,
"alnum_prop": 0.5701513067400276,
"repo_name": "harisbal/pandas",
"id": "c880133f4fc6b7db0a90874326bbcacdeb4e65ab",
"size": "4362... |
from xml.dom import minidom, Node
from urlparse import urlparse, urlunparse
from xml.parsers.expat import ExpatError
from htmlentitydefs import name2codepoint
import re
# select and apply an xml:base for this entry
class relativize:
def __init__(self, parent):
self.score = {}
self.links = []
self.collect... | {
"content_hash": "9db488204ed36d10cb6660c32a78f63e",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 80,
"avg_line_length": 34.79838709677419,
"alnum_prop": 0.6025492468134415,
"repo_name": "DebugUself/planet",
"id": "9220702c24ee433d60dd104d5c494e7518a930af",
"size": "43... |
""" Apply JSON-Patches (RFC 6902) """
from __future__ import unicode_literals
import collections
import copy
import functools
import inspect
import itertools
import json
import sys
try:
from collections.abc import MutableMapping, MutableSequence
except ImportError:
from collections import MutableMapping, Mut... | {
"content_hash": "bd23e4e129c053e26a38839b44ad0415",
"timestamp": "",
"source": "github",
"line_count": 803,
"max_line_length": 126,
"avg_line_length": 32.79327521793275,
"alnum_prop": 0.5672730034557399,
"repo_name": "biothings/biothings.api",
"id": "d9214fad6fd94dba7cd68333251c8242c077c7c0",
"siz... |
try:
from unittest import mock
except ImportError:
import mock
from unittest import TestCase
from iepy.preprocess.pipeline import PreProcessPipeline, PreProcessSteps
class TestPreProcessPipeline(TestCase):
def test_walk_document_applies_all_step_runners_to_the_given_doc(self):
step1_runner = mo... | {
"content_hash": "ee2ee31f32e7493a1a58b81884426ea2",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 90,
"avg_line_length": 44.40625,
"alnum_prop": 0.6403940886699507,
"repo_name": "mrshu/iepy",
"id": "e6484ebea03f679c5362272abcfb4757e2e55f21",
"size": "4263",
"binary": ... |
from django.apps import AppConfig
class CreditsConfig(AppConfig):
name = 'credits'
| {
"content_hash": "5ecf005b2f1fcde4be0f0914581508f3",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 33,
"avg_line_length": 17.8,
"alnum_prop": 0.7528089887640449,
"repo_name": "picsadotcom/maguire",
"id": "d5f4181ac16fad9ca726e570c6fbff0b3f41c8bb",
"size": "89",
"binary"... |
from oslo_utils import strutils
import webob
from nova.api.openstack import api_version_request
from nova.api.openstack import common
from nova.api.openstack.compute.schemas import flavors as schema
from nova.api.openstack.compute.views import flavors as flavors_view
from nova.api.openstack import wsgi
from nova.api i... | {
"content_hash": "a9f74e5ed495793df30a9b8d72c3340f",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 76,
"avg_line_length": 40.166666666666664,
"alnum_prop": 0.6199170124481328,
"repo_name": "mahak/nova",
"id": "3986e428b346ded74b22c48b33ef1bb80d10a450",
"size": "5456",
... |
import os
from ingenico.connect.sdk.factory import Factory
class BlockMandateExample(object):
def example(self):
with self.__get_client() as client:
response = client.merchant("merchantId").mandates().block("42268d8067df43e18a50a2ebf4bdb729")
def __get_client(self):
api_key_id =... | {
"content_hash": "0151991151c440eb666b5c50c9f76ba6",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 105,
"avg_line_length": 46.05555555555556,
"alnum_prop": 0.6079613992762364,
"repo_name": "Ingenico-ePayments/connect-sdk-python3",
"id": "e756b71c2f4bf9b3f966f1b2440993481a5... |
import trappy
import utils_tests
class TestSchedFunctions(utils_tests.SetupDirectory):
def __init__(self, *args, **kwargs):
super(TestSchedFunctions, self).__init__([], *args, **kwargs)
def test_get_pids_for_processes_no_sched_switch(self):
"""get_pids_for_processes() raises an exception if t... | {
"content_hash": "ad83d8d8a6711eb546568e30c93de8ee",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 189,
"avg_line_length": 56.72222222222222,
"alnum_prop": 0.6405484818805093,
"repo_name": "ARM-software/bart",
"id": "1a8d4ac16d3620d6411939e6ac3a2c1ba3f5998e",
"size": "36... |
import os
from django.core.files.storage import FileSystemStorage
from django.conf import settings
class OverwriteStorage(FileSystemStorage):
"""
Overwrites to a file if it exists on file system.
"""
def get_available_name(self, name, max_length=None):
"""
If a file with the ... | {
"content_hash": "8d6eaf2f62820ecaf8f78aad1dacc61a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 67,
"avg_line_length": 27.35,
"alnum_prop": 0.6361974405850092,
"repo_name": "Djacket/djacket",
"id": "2272dbcafafd02c9eb1dd32af4a34fe465a431e9",
"size": "547",
"binary":... |
"""
Author : Guillaume "iXce" Seguin
Email : guillaume@segu.in
Copyright (C) 2008 Guillaume Seguin
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
... | {
"content_hash": "1e3eb9d8b8c09b1966a0b23248154fef",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 77,
"avg_line_length": 36.51063829787234,
"alnum_prop": 0.5547785547785548,
"repo_name": "pf/enso",
"id": "c0cabf010a4e89a01a2487f9602768c61f4c11f4",
"size": "6887",
"bi... |
import mock
from rest_framework import serializers
from waffle.testutils import override_switch
from olympia.amo.tests import (
BaseTestCase, addon_factory, collection_factory, TestCase, user_factory)
from olympia.bandwagon.models import CollectionAddon
from olympia.bandwagon.serializers import (
CollectionAdd... | {
"content_hash": "c19cd43061fd36fd34c95c111abe8b1f",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 79,
"avg_line_length": 42.597765363128495,
"alnum_prop": 0.667016393442623,
"repo_name": "wagnerand/olympia",
"id": "7eb339f94bb3bd1b8827b018651884afa3b4a630",
"size": "76... |
import unittest
import trovesync
from utils import MockObject
__metaclass__ = type # make sure we use new-style classes
class TestSyncer(unittest.TestCase):
def test_is_testable(self):
mockSettings = MockObject()
mockSettings.albumsPath = "/some/absolute/path/"
trovesync.Syncer(mockSettings)
self.a... | {
"content_hash": "283d57c1484662e6e2afbf3044493b32",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 57,
"avg_line_length": 22.666666666666668,
"alnum_prop": 0.7411764705882353,
"repo_name": "kjarnet/trovesync",
"id": "bb69aca5060e6c9ad227c41df3ec3233547b75ba",
"size": "34... |
import os
import re
from setuptools import setup
project_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(project_dir, 'dontasq', '__init__.py')) as f:
version = re.search(r"__version__ = '(.+)'", f.read()).groups()[0]
with open(os.path.join(project_dir, 'README.rst')) as f:
long_desc... | {
"content_hash": "0d5fa7da829a0219ffda436614766fd4",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 71,
"avg_line_length": 30.916666666666668,
"alnum_prop": 0.6111859838274932,
"repo_name": "borzunov/dontasq",
"id": "aeec34142a419476147d5153db9cd474c24a6d6a",
"size": "153... |
"""
Check ElementTree import with xmlschema.
"""
import argparse
import sys
parser = argparse.ArgumentParser(add_help=True)
parser.add_argument(
'--before', action="store_true", default=False,
help="Import ElementTree before xmlschema. If not provided the ElementTree library "
"is loaded after xmlsche... | {
"content_hash": "af2c8f9f688e9ee6a9eef14541f6511c",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 102,
"avg_line_length": 41.02325581395349,
"alnum_prop": 0.7568027210884354,
"repo_name": "brunato/xmlschema",
"id": "bf8a9786ed6bab03a41ee430df5268af3ec7c65f",
"size": "21... |
from __future__ import unicode_literals
from django.db import migrations, models
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
('taggit', '0002_auto_20150616_2121'),
('memorylane', '0009_auto_20151207_1712'),
]
operations = [
migrations.AddField(... | {
"content_hash": "0183164185a9e4ba157175c4f0a106f9",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 162,
"avg_line_length": 27.95,
"alnum_prop": 0.631484794275492,
"repo_name": "MemoryLane196/WebApp",
"id": "495fc11c8a34b7d60048a718442ceded3741584f",
"size": "583",
"bin... |
from __future__ import unicode_literals
import collections
import datetime
import decimal
import math
import os
import re
import types
from importlib import import_module
from django.apps import apps
from django.db import migrations, models
from django.db.migrations.loader import MigrationLoader
from django.db.migrat... | {
"content_hash": "1645b57acf5684ead006c4287d196e4f",
"timestamp": "",
"source": "github",
"line_count": 526,
"max_line_length": 109,
"avg_line_length": 41.57984790874525,
"alnum_prop": 0.5505921082712267,
"repo_name": "gohin/django",
"id": "b45ec0cedaa4e183ed40de678abe7c8974e91e37",
"size": "21871"... |
"""
A module to allow each channel to have "news". News items may have expiration
dates.
"""
import supybot
import supybot.world as world
# Use this for the version of this plugin. You may wish to put a CVS keyword
# in here if you're keeping the plugin in CVS or some similar system.
__version__ = "%%VERSION%%"
__... | {
"content_hash": "d6f512b23c847e2a53e86afd71986b1f",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 78,
"avg_line_length": 28.47222222222222,
"alnum_prop": 0.7375609756097561,
"repo_name": "Ban3/Limnoria",
"id": "45eb3221d0f6d1fca831131f5dc34b2d00a48714",
"size": "2612",
... |
from twisted.application.service import ServiceMaker
TwistedTelnet = ServiceMaker(
"Twisted Telnet Shell Server",
"twisted.tap.telnet",
"A simple, telnet-based remote debugging service.",
"telnet")
| {
"content_hash": "b961335850ae9abbf859a532c32c30c7",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 55,
"avg_line_length": 28,
"alnum_prop": 0.7053571428571429,
"repo_name": "hlzz/dotfiles",
"id": "42e23437adf518ce80ad743a542f0f7d630b0016",
"size": "298",
"binary": false... |
from sklearn.datasets import load_breast_cancer
from autosklearn.classification import AutoSklearnClassifier
from autosklearn.constants import MULTICLASS_CLASSIFICATION, REGRESSION
from autosklearn.metalearning.mismbo import suggest_via_metalearning
from autosklearn.pipeline.util import get_dataset
from autosklearn.sm... | {
"content_hash": "bece2f6b63d3eae82613096381418fcf",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 85,
"avg_line_length": 39.523809523809526,
"alnum_prop": 0.5685025817555938,
"repo_name": "automl/auto-sklearn",
"id": "9740313ff8f40f37478dcf20a5ce822bd171206c",
"size": ... |
import json
from urllib import request
import requests
#for rest api
repository_url = 'http://10.3.100.22:8080'
restpath = '/rest'
xmlpath = '/xmlui'
def get_communities():
communities = request.urlopen(repository_url + restpath + '/communities')
communities_json = communities.read().decode('utf-8')
comm... | {
"content_hash": "056c9bfef0a4d9c0110dc0a068477f5e",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 77,
"avg_line_length": 30.95744680851064,
"alnum_prop": 0.5958762886597938,
"repo_name": "enlighter/ndl-question-papers-search-hub",
"id": "75a2ad697a75e54542ab7150e789dd5b8b... |
"""
Test PostgreSQL full text search.
These tests use dialogue from the 1975 film Monty Python and the Holy Grail.
All text copyright Python (Monty) Pictures. Thanks to sacred-texts.com for the
transcript.
"""
from django.contrib.postgres.search import (
SearchQuery, SearchRank, SearchVector,
)
from django.db impo... | {
"content_hash": "138b68a3ec8c366299ef313c93bd4ed2",
"timestamp": "",
"source": "github",
"line_count": 394,
"max_line_length": 119,
"avg_line_length": 44.588832487309645,
"alnum_prop": 0.6386612021857924,
"repo_name": "georgemarshall/django",
"id": "f5111ce8d3e3e8fa5eff17eea9fdad98eca2c9a8",
"size... |
"""
Aerostat Updater.
"""
import os
import shutil
import subprocess
import sys
from aerostat import logging
class Updater(object):
"""Update the /etc/hosts file on the localhost."""
def __init__(self):
"""Initialize object."""
self.hosts_data = ['127.0.0.1 localhost']
def append_hosts... | {
"content_hash": "52be8e8e25515acbcc6c956363f1bb83",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 84,
"avg_line_length": 33.765517241379314,
"alnum_prop": 0.5655637254901961,
"repo_name": "urbanairship/aerostat",
"id": "65c1b52463c4f95d8b10ccdf958f09a94529e445",
"size"... |
'''
Created on Aug 19, 2011
@author: Piotr
'''
import unittest
from generator.data.GeneratorDescription import GeneratorDescription
from generator.BlenderGenerator import BlenderGenerator
class BlenderGeneratorTests(unittest.TestCase):
def test_simple_printing(self):
gDesc = GeneratorDescription(inputFi... | {
"content_hash": "d5084db2f1cf22c683750780692859ce",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 100,
"avg_line_length": 26.44,
"alnum_prop": 0.7125567322239031,
"repo_name": "Dzess/ALFIRT",
"id": "dadcf0683aa389ff339aee33d1ecdb0f09a05937",
"size": "661",
"binary": f... |
"""
Objects that receive generated C/C++ code lines, reindents them, and
writes them to a file, memory, or another code sink object.
"""
import sys
PY3 = (sys.version_info[0] >= 3)
if PY3:
string_types = str,
else:
string_types = basestring,
DEBUG = 0
if DEBUG:
import traceback
import sys
class Code... | {
"content_hash": "f5c3ac795ff15013b7ee31b72d83a2e3",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 86,
"avg_line_length": 30.5,
"alnum_prop": 0.5669945355191257,
"repo_name": "softDi/clusim",
"id": "30929c7dea9508a7c58ee5f7ce2d7f4f01f4de12",
"size": "4575",
"binary": ... |
from Reviewable.models import Reviewable
from django import template
register = template.Library()
@register.inclusion_tag('Reviewable/__review_controls.html', takes_context=True)
def show_review_controls(context, review_object):
if not isinstance(review_object, Reviewable):
# Check the ob... | {
"content_hash": "b02feebebc268e79024788ac9f32bc04",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 80,
"avg_line_length": 34.31578947368421,
"alnum_prop": 0.6779141104294478,
"repo_name": "jacobwindsor/django-reviewable",
"id": "39e5af2c228d26065e82fd0ae06e11d7aa4f98a5",
... |
import pygame, os
from pygame.locals import *
# ----------------------------------------------------
def loadImage(name, colorkey=None):
fullname = os.path.join("data", name)
try:
image = pygame.image.load(fullname)
except pygame.error as message:
print("Cannot load image... | {
"content_hash": "3cfb09922b9faca48157503bc860b710",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 55,
"avg_line_length": 24.791044776119403,
"alnum_prop": 0.5213726670680313,
"repo_name": "lsoriano808/Functional",
"id": "326dc9233cb7d7d32da737959a06bc02baacd7e0",
"size"... |
"""nap_rest URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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-ba... | {
"content_hash": "9559fccade1b542e4ee4db0b03517a68",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 77,
"avg_line_length": 38.76923076923077,
"alnum_prop": 0.689484126984127,
"repo_name": "icsnju/nap-core",
"id": "16938370cd298b20a7bc716e71d0bfbcea790db8",
"size": "1008",... |
import abc
import asyncio
from types import TracebackType
from typing import (
Any, AsyncContextManager, Awaitable, Callable, Coroutine, Generic, Optional,
Set, Tuple, Type, TypeVar, Union,
)
from aiormq.tools import awaitable
from aio_pika.log import get_logger
from aio_pika.tools import create_task
log = ... | {
"content_hash": "49d1d9dc34bd0481cd81de00c69ef667",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 80,
"avg_line_length": 26.375757575757575,
"alnum_prop": 0.5737591911764706,
"repo_name": "mosquito/aio-pika",
"id": "93fc4080097c853166cc09c4348102dc74004a99",
"size": "4... |
from django.core.management.base import BaseCommand
from huntserver.utils import update_time_items
class RunUpdates(BaseCommand):
help = 'Runs all time related updates for the huntserver app'
def handle(self, *args, **options):
update_time_items()
| {
"content_hash": "7c072ec69718990ac6a9654cfa30d5da",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 65,
"avg_line_length": 29.666666666666668,
"alnum_prop": 0.7415730337078652,
"repo_name": "dlareau/puzzlehunt_server",
"id": "8a8f3bc0b8648f6599b0f3f876b158891ab5ef13",
"siz... |
import mock
from rally.plugins.openstack.context.sahara import sahara_edp
from tests.unit import test
CTX = "rally.plugins.openstack.context.sahara"
class SaharaEDPTestCase(test.TestCase):
def setUp(self):
super(SaharaEDPTestCase, self).setUp()
self.tenants_num = 2
self.users_per_tenant... | {
"content_hash": "4c9f22bd7707a8bea4d45d47b6698b71",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 78,
"avg_line_length": 36.96396396396396,
"alnum_prop": 0.5093833780160858,
"repo_name": "aplanas/rally",
"id": "ffedac9243927db0844e2003149e1322d9fc8214",
"size": "4669",... |
pluginType = MODULE
# moduleInformation() must return a tuple (module, widget_list). If "module"
# is "A" and any widget from this module is used, the code generator will write
# "import A". If "module" is "A[.B].C", the code generator will write
# "from A[.B] import C". Each entry in "widget_list" must be unique.... | {
"content_hash": "3ff368223dffe4cc3b5d01e902d41b2d",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 79,
"avg_line_length": 43.44444444444444,
"alnum_prop": 0.6956521739130435,
"repo_name": "Universal-Model-Converter/UMC3.0a",
"id": "3f57df2813330ffc5f6a1540c3b064da6b6ec191",... |
from request_engine import RequestEngine
from Constants import *
import time, subprocess, signal
from sys import argv, exit
from argparse import ArgumentParser
class EtcdResolver:
def __init__(self, hostname, host_address, etcd_address, etcd_port, etcd_directory, hosts_file, ttl):
"""
Initialize the service for n... | {
"content_hash": "b0fd88f886bf18cd748c44e85d00827b",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 102,
"avg_line_length": 34.601941747572816,
"alnum_prop": 0.6933221099887766,
"repo_name": "LuqmanSahaf/etcd-spark",
"id": "8d14adf5ff3604fd7f66e1cf1c4122f4976896d8",
"siz... |
"""
WSGI config for django_data_product project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("... | {
"content_hash": "5892e967c078fb99a577d41e766176e6",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 79,
"avg_line_length": 25.9375,
"alnum_prop": 0.7734939759036145,
"repo_name": "DistrictDataLabs/django-data-product",
"id": "0b8d19a7be75df10b0f1c588e239925a726ab5d3",
"si... |
from catalan import catalan
if __name__ == "__main__":
for i in range(10):
print("catalan({}) == {}".format(i, catalan(i))) | {
"content_hash": "1b681a88d6a44b42d2f1273a220d4f56",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 50,
"avg_line_length": 21.333333333333332,
"alnum_prop": 0.578125,
"repo_name": "Cnidarias/al-go-rithms",
"id": "840c4d24d2439884fd125eb6c7dc99fa4888e9f6",
"size": "148",
... |
from rest_framework.decorators import detail_route
from rest_framework.response import Response
from common import permissions
from .models import System, Station, Commodity, StationCommodity
from .serializers import CommoditySerializer, StationSerializer, \
SystemSerializer, MinimizedSystemSerializer, StationComm... | {
"content_hash": "957448bff14bf279c501510cdb8f0c69",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 119,
"avg_line_length": 35.07272727272727,
"alnum_prop": 0.65966822187662,
"repo_name": "Jingyu-Yao/elitetraderoutes",
"id": "ed387cc17ae8d37a94820dd1e96580bda679eab8",
"s... |
import unittest
from katas.beta.ninety_degrees_rotation import rotate
class RotateTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(rotate([[1, 2], [3, 4]]), [[3, 1], [4, 2]])
def test_equals_2(self):
self.assertEqual(rotate([[3, 1], [4, 2]]), [[4, 3], [2, 1]])
| {
"content_hash": "a91da611ee7986eb78214ad775f5b868",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 68,
"avg_line_length": 28.09090909090909,
"alnum_prop": 0.6084142394822006,
"repo_name": "the-zebulan/CodeWars",
"id": "df3fa452e6f3d1db23fdd99c8004579863cb416e",
"size": "... |
import json
import os
import tempfile
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.core.urlresolvers import reverse
from django.utils.encoding import smart_unicode
import mock
from jinja2.utils import escape
from nose import SkipTest
from nose.tools imp... | {
"content_hash": "be467c2fc29a533e7661f70e921e96fd",
"timestamp": "",
"source": "github",
"line_count": 1532,
"max_line_length": 79,
"avg_line_length": 37.965404699738905,
"alnum_prop": 0.5998830871860117,
"repo_name": "andymckay/zamboni",
"id": "78cf41205935f399c653e3da9378207a004d519a",
"size": "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.