text stringlengths 4 1.02M | meta dict |
|---|---|
import unittest
from unittest import mock
# Threaded Implementation
import threaded
class ThreadedTest(unittest.TestCase):
def test_add_basic(self):
@threaded.threaded
def func_test():
pass
# pylint: disable=assignment-from-no-return
test_thread = func_test()
... | {
"content_hash": "00c1386be3572c0119c74d188662358f",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 65,
"avg_line_length": 30.53846153846154,
"alnum_prop": 0.6251889168765743,
"repo_name": "penguinolog/threaded",
"id": "926f6fb31ea8e8fdbc9d9afb028a82c2f90e8a62",
"size": "... |
"""Test the locking library."""
from __future__ import print_function
import itertools
import multiprocessing
import os
import sys
import time
from chromite.lib import cros_test_lib
from chromite.lib import locking
from chromite.lib import parallel
from chromite.lib import osutils
from chromite.lib import process_ut... | {
"content_hash": "ca7aca3dec8ca832bce5aa07a4f6b964",
"timestamp": "",
"source": "github",
"line_count": 328,
"max_line_length": 77,
"avg_line_length": 33.58841463414634,
"alnum_prop": 0.6741399655078515,
"repo_name": "endlessm/chromium-browser",
"id": "70c24cc63ca84a45940ef2f5d04c3b748a7b9bb5",
"si... |
import sys
import inviwo_internal
class OutputRedirectStdout:
def write(self, string):
inviwo_internal.ivwPrint(string, 0)
class OutputRedirectStderr:
def write(self, string):
inviwo_internal.ivwPrint(string, 1)
sys.stdout = OutputRedirectStdout()
sys.stderr = OutputRedirectStderr()
| {
"content_hash": "fc0c7b48d0271c94a983fd3908c92a51",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 43,
"avg_line_length": 22.5,
"alnum_prop": 0.7333333333333333,
"repo_name": "sarbi127/inviwo",
"id": "a99bcd935308a315170a7b64bd265c0ea2e1a2f4",
"size": "315",
"binary": ... |
from direct.distributed import DistributedObjectAI
from direct.fsm import FSM
from direct.directnotify import DirectNotifyGlobal
from toontown.coghq import FoodBeltBase
class DistributedFoodBeltAI(DistributedObjectAI.DistributedObjectAI, FSM.FSM, FoodBeltBase.FoodBeltBase):
notify = DirectNotifyGlobal.directNotify... | {
"content_hash": "04ecb63477b0203645b3c76e77fced88",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 105,
"avg_line_length": 24.529411764705884,
"alnum_prop": 0.6205035971223022,
"repo_name": "Spiderlover/Toontown",
"id": "7cd1cce7271886521ddbfc58c35db1c8963d7f55",
"size":... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/component/droid/shared_le_repair_droid_chassis.iff"
result.attribute_template_id = -1
result.stfName("craft_droid_ingredients_n","le_repair_droid_chassis")
#### BEGIN MODIFICATIONS ####
#### END MODIFICAT... | {
"content_hash": "d56a0b38297583b03c19feddd2e272bb",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 87,
"avg_line_length": 26.692307692307693,
"alnum_prop": 0.7146974063400576,
"repo_name": "anhstudios/swganh",
"id": "a3ae1d4ed6285953897381f43c6ba64e8d255398",
"size": "49... |
from ray.rllib.models.tf.layers.gru_gate import GRUGate
from ray.rllib.models.tf.layers.noisy_layer import NoisyLayer
from ray.rllib.models.tf.layers.relative_multi_head_attention import \
RelativeMultiHeadAttention
from ray.rllib.models.tf.layers.skip_connection import SkipConnection
from ray.rllib.models.tf.layer... | {
"content_hash": "6c03787322f5cbab7ee3d7362a1ead64",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 78,
"avg_line_length": 44.18181818181818,
"alnum_prop": 0.7983539094650206,
"repo_name": "richardliaw/ray",
"id": "68ae2ea53c8b51eea9494b524d974a90c55aa553",
"size": "486",... |
import six
from rally.common.i18n import _
from rally.common import log as logging
from rally.common import utils
from rally import consts
from rally import osclients
from rally.plugins.openstack.wrappers import network as network_wrapper
from rally.task import context
LOG = logging.getLogger(__name__)
@context.co... | {
"content_hash": "d6256c742de4a1043c5919e305fc2a22",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 76,
"avg_line_length": 36.53012048192771,
"alnum_prop": 0.495712401055409,
"repo_name": "cernops/rally",
"id": "ab29baf09807055988abc15280c425421fd32d73",
"size": "3605",
... |
"""This file is part of the Scribee project.
"""
__author__ = 'Emanuele Bertoldi <emanuele.bertoldi@gmail.com>'
__copyright__ = 'Copyright (c) 2011 Emanuele Bertoldi'
__version__ = '0.0.1'
import os
import settings
class Entity(object):
"""An Entity is a generic language-agnostic object.
"""
class Types... | {
"content_hash": "fceaa55b520f0c44dcfa43cb9dbb59c6",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 98,
"avg_line_length": 29.53370786516854,
"alnum_prop": 0.5261556020544037,
"repo_name": "zuck/scribee",
"id": "a7e6acaf984be4d89faccf44418f4252ffeaf7b7",
"size": "5299",
... |
from flask import Blueprint, render_template, redirect, url_for, current_app
from deployer import database as db
from deployer.routing.models import Route
from deployer.utils import xhr_form, allow_traffic, get_container_ip
from . import models, forms
views = Blueprint('apps', __name__, template_folder='templates')
... | {
"content_hash": "b056afebbc27661a0014df8a7640cf66",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 79,
"avg_line_length": 32.08187134502924,
"alnum_prop": 0.6208530805687204,
"repo_name": "GaretJax/docker-deployer",
"id": "4f10d1c66cd24cc3511c486c0a27e46e84095b80",
"siz... |
import logging
import os
import traceback
import fuel_health.common.ssh
from fuel_health.common.utils.data_utils import rand_name
import fuel_health.nmanager
import fuel_health.test
LOG = logging.getLogger(__name__)
class HeatBaseTest(fuel_health.nmanager.NovaNetworkScenarioTest):
"""Base class for Heat openst... | {
"content_hash": "a6dc6638dc3c5af0cfca6b15a76bffa3",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 78,
"avg_line_length": 38.13302752293578,
"alnum_prop": 0.5575604474918802,
"repo_name": "mcloudv/fuel-ostf",
"id": "f7c69fd298d2c62de777e1dd16a4a64dbf1c79e1",
"size": "90... |
from flask.ext.sqlalchemy import SQLAlchemy
db = SQLAlchemy()
| {
"content_hash": "34b0a689b18308abcf14a87f5f361b41",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 43,
"avg_line_length": 31,
"alnum_prop": 0.8064516129032258,
"repo_name": "cjmabry/PoliChart",
"id": "7d42edc2a0f344acbfbff7c6683262a2403bbdec",
"size": "87",
"binary": fa... |
from accounts.cqrs import app
from rest_framework.authentication import BaseAuthentication
from rest_framework.authentication import get_authorization_header
from rest_framework.exceptions import AuthenticationFailed
import re
TOKEN_RE = re.compile(r'^Token (\w+)$')
class TokenAuthentication(BaseAuthentication):
... | {
"content_hash": "032f1e55c64a7457c7c57772b5faeaa2",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 97,
"avg_line_length": 33.94444444444444,
"alnum_prop": 0.679214402618658,
"repo_name": "lukaszb/cq",
"id": "7726df83e270d84e1a27b2cced04e9130032c78d",
"size": "1222",
"b... |
from django.shortcuts import get_object_or_404
from django.http import Http404
from django.core.urlresolvers import reverse
from django.utils.feedgenerator import Atom1Feed
from django.contrib.syndication.views import Feed
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import Conten... | {
"content_hash": "7dbb18a931fd19cb47b9349639c78750",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 95,
"avg_line_length": 32.26966292134831,
"alnum_prop": 0.6340529247910863,
"repo_name": "netconstructor/django-activity-stream",
"id": "e2b9fd5f2368ce12d1600613bce6e8725d73b... |
from .compat import unittest
import ucl
import json
import os.path
import glob
import re
TESTS_SCHEMA_FOLDER = '../tests/schema/*.json'
comment_re = re.compile('\/\*((?!\*\/).)*?\*\/', re.DOTALL | re.MULTILINE)
def json_remove_comments(content):
return comment_re.sub('', content)
class ValidationTest(unittest.Te... | {
"content_hash": "34f4f98e1f3e257b965e742d99a3fe9a",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 92,
"avg_line_length": 34.72,
"alnum_prop": 0.5754608294930875,
"repo_name": "fichtner/libucl",
"id": "f7c853ad69a75a4ec5afb71869a35d752d6b4a12",
"size": "1736",
"binary"... |
class Solution:
def scoreOfParentheses(self, S):
st = []
for x in S:
if x == '(': st.append(x)
else:
temp = []
while st[-1] != '(':
temp.append(st.pop())
st.pop()
st.append(sum(temp)*2 or 1)
... | {
"content_hash": "a5338a9069106fa169bee27413bd5a1d",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 48,
"avg_line_length": 32.8125,
"alnum_prop": 0.47619047619047616,
"repo_name": "zuun77/givemegoogletshirts",
"id": "246ba00a3985b572c4ac18e651be49088c75f287",
"size": "525... |
from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals
from sys import version_info
PY3 = version_info[0] == 3
if PY3:
bytes = bytes
unicode = str
else:
bytes = str
unicode = unicode
string_types = (bytes, unicode,)
try:
import urllib2 as urll... | {
"content_hash": "a034d6988acc4ebe3d53477fc496149e",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 65,
"avg_line_length": 17.65909090909091,
"alnum_prop": 0.7232947232947233,
"repo_name": "miso-belica/jusText",
"id": "3f0242d314512e1d02f2dc4ec7df73e27c5c87a2",
"size": "8... |
from distutils.core import setup
import os
from admin_tools import VERSION
# taken from django-registration
# Compile the list of packages available, because distutils doesn't have
# an easy way to do this.
packages, data_files = [], []
root_dir = os.path.dirname(__file__)
if root_dir:
os.chdir(root_dir)
for dir... | {
"content_hash": "a04148be7264a1643492ab3bf9e0dd94",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 87,
"avg_line_length": 33.16949152542373,
"alnum_prop": 0.631578947368421,
"repo_name": "proft/django-admin-tools",
"id": "a8b65ed1d12ebdd1ad881975a0c53ab0078dfe86",
"size"... |
'''
https://www.mozilla.org/en-US/projects/calendar/holidays/
'''
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
import logging # isort:skip
log = logging.getLogger(__name__)
#---------------... | {
"content_hash": "3ff1908be0241c47353511516281756b",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 127,
"avg_line_length": 33.75,
"alnum_prop": 0.2767195767195767,
"repo_name": "ericmjl/bokeh",
"id": "2ec707f222f51b5a3cba1684a984ab19a52ce6be",
"size": "2221",
"binary":... |
import os, requests, random, time
from selenium_test_case import SeleniumTestCase, slow, online, wd, host
import tests
from tests.pages import signup_page, accounts_page, profile_page
from nose.tools import assert_equals, assert_in, assert_greater_equal, assert_items_equal, raises
class TestSignupAndAccounts(Selen... | {
"content_hash": "3a959db57f5c477535d2ff7c44aaa32d",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 256,
"avg_line_length": 43.97931034482759,
"alnum_prop": 0.5582562333385604,
"repo_name": "Impactstory/impactstory-tester",
"id": "8cd52031ecf0e0019d0669e5afec8b0666dd5ea2",... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('coopInfo', '0003_auto_20150129_1128'),
]
operations = [
migrations.AddField(
model_name='cooperative',
name='is990present',
... | {
"content_hash": "afc154ebbbd46ea5cfc422de6d6ee094",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 53,
"avg_line_length": 25.08,
"alnum_prop": 0.580542264752791,
"repo_name": "antoineclaval/ruralpowerproject",
"id": "b654cb330f9a9fea7e78b26d5ba9677e30105a98",
"size": "65... |
"""
rohmu - timestamp handling
Copyright (c) 2017 Ohmu Ltd
See LICENSE for details
"""
import datetime
import dateutil.parser
import dateutil.tz
def parse_timestamp(ts, *, with_tz=True, assume_local=False):
"""Parse a given timestamp and return a datetime object with or without tzinfo.
If `with_tz` is False... | {
"content_hash": "5743f977251b4ae1db7c9296e832c05d",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 119,
"avg_line_length": 40.25,
"alnum_prop": 0.7186335403726708,
"repo_name": "saaros/pghoard",
"id": "5b114c92932b19363764ba9ee45754df55fd20d3",
"size": "1610",
"binary"... |
"""
Component to interface with various sensors that can be monitored.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/sensor/
"""
import logging
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.components import (
... | {
"content_hash": "ba5d9b17864a78722e68583bd7ebf279",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 75,
"avg_line_length": 28.5609756097561,
"alnum_prop": 0.7241673783091375,
"repo_name": "aoakeson/home-assistant",
"id": "48dee4e169b05e22102479efcfbf2d804ef9974b",
"size":... |
from bs4 import BeautifulSoup
class ExtractionModule1:
def find_queries(html):
""" Finds queries and extracts them from websites.
Args:
html: HTML response which contains HTML text
Returns
A list of queries in the form of strings.
"... | {
"content_hash": "67ad7c85f2adcba9856fd629325754bd",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 62,
"avg_line_length": 26.90909090909091,
"alnum_prop": 0.5388513513513513,
"repo_name": "GoogleCloudPlatform/bigquery-utils",
"id": "f6ff6b3a0fa907f172a1358a52947ef3d9293b31... |
import unittest
from airflow.contrib.operators.adls_list_operator import AzureDataLakeStorageListOperator
from tests.compat import mock
TASK_ID = 'test-adls-list-operator'
TEST_PATH = 'test/*'
MOCK_FILES = ["test/TEST1.csv", "test/TEST2.csv", "test/path/TEST3.csv",
"test/path/PARQUET.parquet", "test/pat... | {
"content_hash": "e00866150bc9f9d344cf617c1120301c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 89,
"avg_line_length": 36.68,
"alnum_prop": 0.6739367502726281,
"repo_name": "owlabs/incubator-airflow",
"id": "f668b55a5a80f25e1de3aef95cecd5df012c3a9d",
"size": "1729",
... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/components/droid_interface/shared_ddi_hk_mk1.iff"
result.attribute_template_id = 8
result.stfName("space/space_item","ddi_hk_mk1_n")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
retu... | {
"content_hash": "3a0649d50927061662a3918b08d0537e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 90,
"avg_line_length": 25.307692307692307,
"alnum_prop": 0.7021276595744681,
"repo_name": "obi-two/Rebelion",
"id": "2989c094d7b224c88c80b2ae09b10cd7847d5353",
"size": "474... |
import sys
import time
import os
sys.path.insert(0, "python")
import libxml2
test_nr = 0
test_succeed = 0
test_failed = 0
test_error = 0
#
# the testsuite description
#
CONF="xml-test-suite/xmlconf/xmlconf.xml"
LOG="check-xml-test-suite.log"
log = open(LOG, "w")
#
# Error and warning handlers
#
error_nr = 0
error_m... | {
"content_hash": "99f9d39a6c959c254f6ac5b7b1f9e2f7",
"timestamp": "",
"source": "github",
"line_count": 407,
"max_line_length": 86,
"avg_line_length": 25.167076167076168,
"alnum_prop": 0.5693644440105438,
"repo_name": "nwjs/chromium.src",
"id": "cecb59b77f24c0c3a37f3c33bbb3634e5a810fdf",
"size": "1... |
"""
URLconf for registration and activation, using django-registration's
one-step backend.
If the default behavior of these views is acceptable to you, simply
use a line like this in your root URLconf to set up the default URLs
for registration::
(r'^accounts/', include('registration.backends.simple.urls')),
Thi... | {
"content_hash": "45740ef0e9ba931c368724cb4a82dc82",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 103,
"avg_line_length": 35.91891891891892,
"alnum_prop": 0.6380737396538751,
"repo_name": "jlovison/django-registration",
"id": "18e738cf2c9413c907745251d0aee65a200b8cda",
... |
from __future__ import print_function, division, absolute_import
__version__ = 2015.02
from PTMCMCSampler import *
def test():
# Run some tests here
print("{0} tests have passed".format(0))
| {
"content_hash": "9e2c9f027fc9525b9e4489694abcc474",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 64,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.6865671641791045,
"repo_name": "vhaasteren/PTMCMCSampler",
"id": "1c91ff5a686420a8fbca63815a99fb90478e64ed",
"size... |
import os
import testscenarios
import nova.conf
from nova.tests import fixtures
from nova.tests.fixtures import api_paste as api_paste_fixture
from nova.tests.functional import api_samples_test_base
CONF = nova.conf.CONF
# API samples heavily uses testscenarios. This allows us to use the
# same tests, with slight v... | {
"content_hash": "ec637fa44ddd4e543d925ec518a81391",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 75,
"avg_line_length": 38.604838709677416,
"alnum_prop": 0.6634635471067475,
"repo_name": "mahak/nova",
"id": "be8e07a9411971195096af087cfe9a8acc7222c3",
"size": "5389",
... |
"""Script to load cnv data
To run: python load.py config_file
"""
import sys
from bigquery_etl.load import load_data_from_file
import json
import os
from bigquery_etl.utils.logging_manager import configure_logging
def load(config):
"""
Load the bigquery table
load_data_from_file accepts following params:
... | {
"content_hash": "676325cdd33a4f6e79dc4b766dd31696",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 91,
"avg_line_length": 33.7962962962963,
"alnum_prop": 0.5863013698630137,
"repo_name": "isb-cgc/ISB-CGC-data-proc",
"id": "7b0dd81fce84d91608d9991b8cd1116be4f676b9",
"size... |
from google.cloud import dialogflow_v2
async def sample_list_session_entity_types():
# Create a client
client = dialogflow_v2.SessionEntityTypesAsyncClient()
# Initialize request argument(s)
request = dialogflow_v2.ListSessionEntityTypesRequest(
parent="parent_value",
)
# Make the re... | {
"content_hash": "39aaa33d397d8d5ef7eb825e394888a2",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 79,
"avg_line_length": 28.25,
"alnum_prop": 0.7309734513274336,
"repo_name": "googleapis/python-dialogflow",
"id": "2d5baceb409a8d8c335817fa23673b7654e1ea01",
"size": "1980... |
""" Live settings for 9ms starter """
from ninecms_starter.settings import *
DEBUG = False
ALLOWED_HOSTS = [
# ...
]
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
],
'APP_DIRS': True,
... | {
"content_hash": "fefb809bb304b68de31c83990713af0c",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 73,
"avg_line_length": 23.4390243902439,
"alnum_prop": 0.5348595213319459,
"repo_name": "Wtower/django-ninecms-starter",
"id": "714d95680141d5361f466bb61a601f938703f464",
"... |
import _plotly_utils.basevalidators
class ShowlineValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="showline", parent_name="layout.smith.imaginaryaxis", **kwargs
):
super(ShowlineValidator, self).__init__(
plotly_name=plotly_name,
... | {
"content_hash": "c17b71388a606fb530856502f3722b11",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 88,
"avg_line_length": 33.38461538461539,
"alnum_prop": 0.6175115207373272,
"repo_name": "plotly/plotly.py",
"id": "89035731f390bb7de527c5eaaec064bc28155254",
"size": "434"... |
"""Exports Redis storage controllers."""
from marconi_redis.queues.storage.redis import catalogue
from marconi_redis.queues.storage.redis import claims
from marconi_redis.queues.storage.redis import messages
from marconi_redis.queues.storage.redis import queues
from marconi_redis.queues.storage.redis import shards
Cla... | {
"content_hash": "bd860f85ec464d8a9342a5a89e92b360",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 56,
"avg_line_length": 41.69230769230769,
"alnum_prop": 0.8560885608856088,
"repo_name": "cabrera/marconi-redis",
"id": "d788305cbb1510f8ecb27581ffe4f3a8e316dbcf",
"size": ... |
"""
=========================================
Visualize channel over epochs as an image
=========================================
This will produce what is sometimes called an event related
potential / field (ERP/ERF) image.
Two images are produced, one with a good channel and one with a channel
that does not show an... | {
"content_hash": "4e97c1a67e25fe02eeb632cd285b0b2a",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 79,
"avg_line_length": 35.41772151898734,
"alnum_prop": 0.6290207290922087,
"repo_name": "teonlamont/mne-python",
"id": "98557011676b3a863cf2f5dce5913b52a69a4321",
"size": ... |
import uuid
import base64
import json
from boto.cloudfront.identity import OriginAccessIdentity
from boto.cloudfront.object import Object, StreamingObject
from boto.cloudfront.signers import ActiveTrustedSigners, TrustedSigners
from boto.cloudfront.logging import LoggingInfo
from boto.cloudfront.origin import S3Origin,... | {
"content_hash": "bd69ddc67891a5feddac6ca263a66256",
"timestamp": "",
"source": "github",
"line_count": 721,
"max_line_length": 102,
"avg_line_length": 41.00970873786408,
"alnum_prop": 0.5584753787878788,
"repo_name": "yyuu/botornado",
"id": "a663cb769321c139b5013c4a1d118be9bb6ad9a8",
"size": "3067... |
import math
def inverse_clamp(value, liveband):
"""
Ensures value is in (-∞, -liveband] ∪ [liveband, ∞)
liveband must be a positive value
"""
if value > 0:
value = max(value, liveband)
if value < 0:
value = min(value, -liveband)
return value
def rotate(vec, degrees):
"""
Rotate... | {
"content_hash": "f27d4509cfbb6a66a30676e042761f75",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 67,
"avg_line_length": 22.28,
"alnum_prop": 0.6014362657091562,
"repo_name": "cuauv/software",
"id": "36b4da9a5be53ce912fac852b53a2f700a1c2eb0",
"size": "582",
"binary": ... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "blog_app.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "c28a44cd25ad603bef6278f123b0811b",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 72,
"avg_line_length": 25.444444444444443,
"alnum_prop": 0.7074235807860262,
"repo_name": "Satchitananda/django-simple-blog",
"id": "41bb07acef0828e7675a750700f315d8467fc3bc",... |
"""Stuff to parse WAVE files.
Usage.
Reading WAVE files:
f = wave.open(file, 'r')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods read(), seek(), and close().
When the setpos() and rewind() methods are not used, the seek()
method is not necessary.
This ... | {
"content_hash": "5e5770877fc1145effeed96fa0b038b8",
"timestamp": "",
"source": "github",
"line_count": 515,
"max_line_length": 130,
"avg_line_length": 36.0757281553398,
"alnum_prop": 0.5900209914419506,
"repo_name": "timm/timmnix",
"id": "4a223451bf9c345df19c6f5ae9b3a4d81a51fdf4",
"size": "18579",... |
import os.path
import argparse
import numpy as np
import sympy as sp
from numpy.linalg.linalg import LinAlgError
import stats.accuracy as accuracy
import stats.estimators as estimators
import stats.methods as methods
import stats.utils as utils
################
# Declarations #
################
DESCRIPTION = 'Use t... | {
"content_hash": "240f529d60970b88f1ea4b3b5da1e373",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 78,
"avg_line_length": 33.89351851851852,
"alnum_prop": 0.5480125665892638,
"repo_name": "budnyjj/NLRA",
"id": "ab88cfd43762a2c714ee8de9bb776be53322f1f6",
"size": "7345",
... |
def fuzz_it(check_sudoku=None, solve_sudoku=None, test="all", iters=10,
mutations=10, check_edges=None):
if test in ("all", "checker"):
from fuzz_checker import fuzz_checker
success = fuzz_checker(check_sudoku, check_edges)
if not success:
print "Failed fuzzing of sudoku ... | {
"content_hash": "2cf33bf3e5fb593aeae5ac5cb43eff74",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 82,
"avg_line_length": 38.6,
"alnum_prop": 0.5911917098445596,
"repo_name": "jtratner/sudoku-fuzzer-udacity",
"id": "7726377f6b340c008bc33c68549d5262a4d38742",
"size": "193... |
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest # pylint: disable=import-error
else:
import unittest
| {
"content_hash": "1d026db6a45d09ca27b61393f03174d2",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 64,
"avg_line_length": 22.166666666666668,
"alnum_prop": 0.706766917293233,
"repo_name": "gamechanger/kafka-python",
"id": "da1069f8d14fed9a487e3a1796a72abedb2ad488",
"size"... |
"""
The MIT License (MIT)
Copyright (c) 2018 Zuse Institute Berlin, www.zib.de
Permissions are granted as stated in the license file you have obtained
with this software. If you find the library useful for your purpose,
please refer to README.md for how to cite IPET.
@author: Gregor Hendel
"""
from .Observer import ... | {
"content_hash": "89ec7d57b12a22ab428f90a0bca608fb",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 146,
"avg_line_length": 36.9364161849711,
"alnum_prop": 0.6405320813771518,
"repo_name": "GregorCH/ipet",
"id": "e86ecf950a988af895204279b1a2bc27e422e507",
"size": "6390",... |
from decimal import Decimal
import json
from django.core.serializers.json import DjangoJSONEncoder
from django.utils import six
try:
from importlib import import_module
except ImportError: # pragma: no cover
from django.utils.importlib import import_module
class JSONFieldDescriptor(object):
def __init__... | {
"content_hash": "0333ce212167427e67d415d4e7588d7f",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 74,
"avg_line_length": 30.60377358490566,
"alnum_prop": 0.5678175092478421,
"repo_name": "michaelkuty/leonardo-items",
"id": "5b8e3844c676efb72be789d5353a6db27d03ca03",
"si... |
"""
Enums transformer
"""
import json
import logging
import re
from collections import namedtuple, OrderedDict
from model.enum import Enum
from model.enum_element import EnumElement
from transformers.common_producer import InterfaceProducerCommon
class EnumsProducer(InterfaceProducerCommon):
"""
Enums transf... | {
"content_hash": "3db59b4b402787bfb0a082219a632a8a",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 118,
"avg_line_length": 39.2289156626506,
"alnum_prop": 0.5737100737100738,
"repo_name": "smartdevicelink/sdl_ios",
"id": "748f6cbe6fe111197bc65a6a794b36b39eef1dd6",
"size"... |
"""Matcher interface and Match class.
This module defines the Matcher interface and the Match object. The job of the
matcher is to match row and column indices based on the similarity matrix and
other optional parameters. Each column is matched to at most one row. There
are three possibilities for the matching:
1) ma... | {
"content_hash": "25ae42b80fc4333ac11820c95c6f840f",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 80,
"avg_line_length": 36.22540983606557,
"alnum_prop": 0.693517366217898,
"repo_name": "jiaphuan/models",
"id": "4c0a9c811957bb06c883b249eee5cee01258efe3",
"size": "9529"... |
"""Test getting the total resource volume.
"""
import datetime
import testscenarios
from ceilometer.publisher import rpc
from ceilometer import sample
from ceilometer.tests import api as tests_api
from ceilometer.tests import db as tests_db
load_tests = testscenarios.load_tests_apply_scenarios
class TestSumResour... | {
"content_hash": "678b26d9b14f2a73c45db53ee37207c7",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 79,
"avg_line_length": 37.95454545454545,
"alnum_prop": 0.5529940119760479,
"repo_name": "rackerlabs/instrumented-ceilometer",
"id": "952e21a1f7793e1bab677f0fdc04505d70fe9bb3... |
print type([]) # is same [].__class__
print [].__class__
print list
print isinstance([], list) #T
print isinstance([], dict) #F
print isinstance([], object) #T
print isinstance([], (dict, object)) #T, Compare "[]" is dict or object.
print dir([]) # get all method(just name) about list.
print help([]) # print the metho... | {
"content_hash": "abe459cd503e2e90eb5f4ebb50e71edb",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 72,
"avg_line_length": 31.266666666666666,
"alnum_prop": 0.6417910447761194,
"repo_name": "williamHuang5468/ExpertPython",
"id": "b56953be1f8fd1bc87584a38f41f45969f0ffd1a",
... |
"""ManagementSystem 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')
... | {
"content_hash": "31ff0a5e12c97a014365286938634ef8",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 77,
"avg_line_length": 41.892857142857146,
"alnum_prop": 0.690537084398977,
"repo_name": "XMLPro/ManagementSystem",
"id": "c1f54086181c04fb361afb3213a84b303618fdc4",
"size"... |
"""
GUI APP to convert currency 1 to currency 2's value given exchange rate
#Author : Satheesh Gopalan
"""
import Tkinter
from Tkinter import *
import tkMessageBox
def OnClick():
"""
Handle the Button click's
Gets input
Verifies that input is valid
"""
currency1 = 0
ex... | {
"content_hash": "a9cfcf19457405fb6f9014f7a0aa1d54",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 123,
"avg_line_length": 20.358974358974358,
"alnum_prop": 0.6001259445843828,
"repo_name": "satheeshgopalan/python",
"id": "db5abb589ee749d5582531c4bd4f8fd24ac5524d",
"size... |
import subprocess
from subprocess import check_output, CalledProcessError
from flask import Flask, render_template, request, redirect, flash, url_for, jsonify
app = Flask(__name__)
illegal_chars = " '\"/\:;|&`()$<>*?{}[]"
illegal_chars_t = tuple(illegal_chars)
@app.route('/', methods=['GET'])
def index():
return ... | {
"content_hash": "1a078990f1458609c6f86169c0501058",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 98,
"avg_line_length": 27.05128205128205,
"alnum_prop": 0.5620853080568721,
"repo_name": "shrkw/run-your-command-via-web-ui-py",
"id": "81af2b602fcdc851495f310ef51d1aca768f5c... |
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain... | {
"content_hash": "42e4c1edf9acd5707e13b3724820c7bd",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 173,
"avg_line_length": 38.604166666666664,
"alnum_prop": 0.6499730167296276,
"repo_name": "microsoft/DiscoFaceGAN",
"id": "a431a4d4d18a32c9cd44a14ce89f35e038dc312c",
"siz... |
from __future__ import absolute_import
import ipyvuetify as v
import ipywidgets as widgets
import traitlets
from traitlets import * # noqa
from . import traitlets as vt
import os
import vaex.jupyter
def load_template(filename):
with open(os.path.join(os.path.dirname(__file__), filename)) as f:
return f.... | {
"content_hash": "2426fa60c5debf6a44edaf61e15ee40b",
"timestamp": "",
"source": "github",
"line_count": 555,
"max_line_length": 192,
"avg_line_length": 35.07027027027027,
"alnum_prop": 0.6266954377311961,
"repo_name": "maartenbreddels/vaex",
"id": "eae9766bde688ba3273336b8a21569c3c8f56c0f",
"size":... |
from __future__ import print_function
from time import gmtime, strftime
import pylogging
import unittest
import os
import datetime
class TestPyLoggingMethods(unittest.TestCase):
def test_filters(self):
""" Test Logger Class """
now = datetime.datetime.now()
log_path = os.path.dirname(os.path.abspath(__file_... | {
"content_hash": "b4e7c1635320608aed79f1aa8bc783a5",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 104,
"avg_line_length": 34.57142857142857,
"alnum_prop": 0.6481700118063755,
"repo_name": "Clivern/PyLogging",
"id": "f61d487b381127e9fa1f3873357d6adbaa0b389d",
"size": "16... |
from django.views.generic import ListView, DetailView, CreateView, \
DeleteView, UpdateView, \
ArchiveIndexView, DateDetailView, \
DayArchiveView, MonthArchiveView, \
TodayArchiveView, Wee... | {
"content_hash": "a665def56b47073df75a2f2b87ce9e5d",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 85,
"avg_line_length": 32.891666666666666,
"alnum_prop": 0.7137066126171776,
"repo_name": "mravikumar281/staging-server",
"id": "c1ffff7f36c4a92c75b19b9f31e4be845ef78775",
... |
import re
import unittest
from unittest import mock
import pytest
from google.cloud.bigquery import DEFAULT_RETRY, DatasetReference, Table, TableReference
from google.cloud.bigquery.dataset import AccessEntry, Dataset, DatasetListItem
from google.cloud.exceptions import NotFound
from parameterized import parameterized... | {
"content_hash": "908665f9899dfcae9ff800f0245cfa04",
"timestamp": "",
"source": "github",
"line_count": 1999,
"max_line_length": 110,
"avg_line_length": 42.29964982491246,
"alnum_prop": 0.5936587154227326,
"repo_name": "dhuang/incubator-airflow",
"id": "66d0003cac79dd4d610d2c76fe0400a338dd587f",
"s... |
"""Lower-level utilities, including some git helpers."""
from fabric.api import env, local, require, settings
from fabric.colors import green
import os
def compare_versions(x, y):
"""
Expects 2 strings in the format of 'X.Y.Z' where X, Y and Z are
integers. It will compare the items which will organize thi... | {
"content_hash": "0ece9fe4cfdb7a19b81a88602c835ceb",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 80,
"avg_line_length": 35.628571428571426,
"alnum_prop": 0.5966319165998396,
"repo_name": "alexmerser/ops",
"id": "08b2c0df5d108332dc3eb57e46248c5ea391c7ec",
"size": "2494"... |
"""
Created on Thu Feb 19 10:14:34 2015
@author: wirkert
"""
from randomForest import randomForest
from calculateWeightsForDomainAdaption import calculateWeights
import random
import numpy as np
import time
import matplotlib.pyplot as plt
def estimateParametersRealImage(trainingParameters, trainingReflectanc... | {
"content_hash": "b6fb2f068cce9b4e948acdeea42b4950",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 137,
"avg_line_length": 35.11486486486486,
"alnum_prop": 0.7186838560708101,
"repo_name": "NifTK/MITK",
"id": "8635ce03a1a2673c42c2387928ea0805902aa7ca",
"size": "5221",
... |
from django import template
register = template.Library()
def product_upsell(product):
"""
Display the list of products that are upsell candidates for currently viewed product.
"""
goals = None
if product.upselltargets.count() > 0:
goals = product.upselltargets.all()
return { ... | {
"content_hash": "b7be973cfd440102a87a1af1450da64c",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 89,
"avg_line_length": 30.5,
"alnum_prop": 0.6932084309133489,
"repo_name": "ringemup/satchmo",
"id": "bcc6bcd0b9652e66d670701f0133326de777dcfa",
"size": "427",
"binary":... |
""" Functioned to introspect a model """
from django.contrib.contenttypes.models import ContentType
from django.db.models.fields import FieldDoesNotExist
from django.conf import settings
import inspect
def isprop(v):
return isinstance(v, property)
def get_properties_from_model(model_class):
""" Show propertie... | {
"content_hash": "89b55b8ebe6d3f4373f49a4f4fd14f2c",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 96,
"avg_line_length": 38.95294117647059,
"alnum_prop": 0.6088794926004228,
"repo_name": "burke-software/django-report-utils",
"id": "f4f826f35bda9db16ec64c45aa102037bcaa1923... |
import os
BASEDIR = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
DEBUG_TOOLBAR = DEBUG
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Pablo Recio', 'me@pablorecio.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', '... | {
"content_hash": "2156fe8f3536d26af453071e187a4903",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 120,
"avg_line_length": 31.11038961038961,
"alnum_prop": 0.6756418284283031,
"repo_name": "shakaran/casterly",
"id": "2ffa289c0ec1c0dcfb3e417dcc7eab9be43c4f6c",
"size": "4... |
import os
from examples.core.transforms import *
from examples.core.transform import TransformListFactory, TransformationList
class Pipeline(Transform):
"""Tile a linalg op with `tile_sizes`.
This transform can be configured as follows:
* `ms_unroll`: Level of unrolling of the given loop
* `ms_distance... | {
"content_hash": "28eef5fea05f22a4035feff8fb66bb88",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 76,
"avg_line_length": 32.31578947368421,
"alnum_prop": 0.6248642779587406,
"repo_name": "iree-org/iree-llvm-sandbox",
"id": "80d90ebde70d60881820b15a6d51450a7c2ea5f0",
"si... |
from __future__ import absolute_import, unicode_literals
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
from .grains.rich_text import *
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(PROJECT_DIR)
# Quick-start development sett... | {
"content_hash": "e313b2c7045f979c9cd4053f57a91049",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 80,
"avg_line_length": 26.02097902097902,
"alnum_prop": 0.6885245901639344,
"repo_name": "gasman/wagtaildraftail",
"id": "5ebd5ce1f51964dca053ae9b63d1472c9ac5e93c",
"size"... |
from __future__ import unicode_literals
__version__ = '0.5'
| {
"content_hash": "3fe034e9f3dcbcc43b14831b4e2bbe29",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 39,
"avg_line_length": 20.333333333333332,
"alnum_prop": 0.6557377049180327,
"repo_name": "vmonaco/pohmm",
"id": "6f9eeeb196c95af8e13d7d6b93b42809b9d07662",
"size": "61",
... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dojo', '0122_cobaltio_product'),
]
operations = [
migrations.AddField(
model_name='test',
name='scan_type',
field=models.TextField(null=True),
),... | {
"content_hash": "031797303b893d023ef8a1faaf13b05c",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 46,
"avg_line_length": 20.4375,
"alnum_prop": 0.5596330275229358,
"repo_name": "rackerlabs/django-DefectDojo",
"id": "bc660162d4fa2c0b9144e440b3c64ecf51a09d16",
"size": "32... |
"""
Problem 19: Counting Sundays
You are given the following information, but you may prefer to do some research
for yourself.
- 1 Jan 1900 was a Monday.
- Thirty days has September,
April, June and November.
All the rest have thirty-one,
Saving February alone,
Which has twenty-eight, rain or shi... | {
"content_hash": "14a42fabe8f25775a8db68c717216a61",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 82,
"avg_line_length": 30.84313725490196,
"alnum_prop": 0.7082008900190718,
"repo_name": "hendrikjeb/Euler",
"id": "d0f84f6b981777b73f601127d75fbecf51cf7ac7",
"size": "1599... |
from .base_renderer import *
import os
import re
import docutils.writers.html4css1
from docutils.core import publish_parts
from docutils.writers.html4css1 import Writer, HTMLTranslator
docutils_dir = os.path.dirname(docutils.writers.html4css1.__file__)
class GitHubHTMLTranslator(HTMLTranslator):
def visit_litera... | {
"content_hash": "287791ce912e8178998b3671d2f687f6",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 105,
"avg_line_length": 35.07272727272727,
"alnum_prop": 0.6148263348885433,
"repo_name": "timonwong/OmniMarkupPreviewer",
"id": "f969f741bbc69567799767c676a1cd299d912d52",
... |
import os
root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'rson'))
imports = set()
def splitfile(s):
keywords = 'class def'.split()
keywords = ['\n%s ' % x for x in keywords]
info = [(s.split(x, 1) + [x]) for x in keywords]
info.sort(key=lambda x:len(x[0]))
top, bottom, keywo... | {
"content_hash": "aecfe0c00b040bf7b0a5bdc8c9de60c4",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 87,
"avg_line_length": 29.595238095238095,
"alnum_prop": 0.6387771520514883,
"repo_name": "tundish/rson",
"id": "16f41f14ee108bab3f219d275523b235ab6ec9fe",
"size": "1266",
... |
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration(None, parent_package, top_path)
config.set_options(
assume_default_configuration=True,
delegate_options_to_subpackages=True,
quiet=True)
config.add_subpackage('quspin')
return config... | {
"content_hash": "a46741086ddacb30becd4e0f4e42fc5e",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 66,
"avg_line_length": 23.12162162162162,
"alnum_prop": 0.6832261835184102,
"repo_name": "weinbe58/QuSpin",
"id": "ecfdda769a8ffc3efb7e96bc9345e726da574fc3",
"size": "1711"... |
from setuptools import setup
from pip.req import parse_requirements
REQS = [str(ir.req) for ir in parse_requirements('requirements.txt', session=False)]
setup(
name='tabletopscanner',
packages=['tabletopscanner'],
include_package_data=True,
install_requires=REQS,
) | {
"content_hash": "38d0a3a6d6d5072d35167d105546ae82",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 84,
"avg_line_length": 25.727272727272727,
"alnum_prop": 0.7385159010600707,
"repo_name": "ramseyboy/tabletop-scanner",
"id": "11270c14fdc6c8bc10147edca1a29f28597000e2",
"s... |
"""Forms for core app."""
import logging
from django import forms
from django.contrib.auth.models import User
from django.forms.fields import CharField
from django.utils.translation import ugettext_lazy as _
from .models import UserProfile
log = logging.getLogger(__name__)
class UserProfileForm(forms.ModelForm):... | {
"content_hash": "8f98c49edb994594f0c150e676589c2e",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 80,
"avg_line_length": 26.943181818181817,
"alnum_prop": 0.6199915647406158,
"repo_name": "rtfd/readthedocs.org",
"id": "34ebfbd0d2ea3fad1bccac3152b405c1d714a9ed",
"size": ... |
import json
import flask
from flask import current_app as app
from jenkins_reporting import db
from jenkins_reporting import stats
root_bp = flask.Blueprint('root', __name__)
iso_bp = flask.Blueprint('iso', __name__, template_folder='templates')
staging_bp = flask.Blueprint('staging', __name__, template_folder='temp... | {
"content_hash": "6c59abc893f5c96c7593f662cf8f9738",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 78,
"avg_line_length": 27.84375,
"alnum_prop": 0.6154133931911709,
"repo_name": "dkalashnik/failorama",
"id": "587c2fb988631665c2451033301df71508e7ac70",
"size": "2673",
... |
import pytest
import json
import pyethereum.processblock as pb
import pyethereum.utils as utils
import pyethereum.bloom as bloom
import os
import sys
def check_testdata(data_keys, expected_keys):
assert set(data_keys) == set(expected_keys), \
"test data changed, please adjust tests"
@pytest.fixture(scope... | {
"content_hash": "0c44fbe5c26ff048a6829fc6cd489422",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 89,
"avg_line_length": 32.74025974025974,
"alnum_prop": 0.6287187623958747,
"repo_name": "joelcan/tools-eth-contract-dev",
"id": "a184a518b3a0639f3ec4f847591d8ecd2b045471",
... |
from django.core.cache import cache
from django.contrib.auth.decorators import login_required
from django.template.defaultfilters import slugify
from pompadour_wiki.apps.utils.decorators import render_to
from pompadour_wiki.apps.wiki.models import Wiki
from datetime import datetime
import os
class LastEdits(object... | {
"content_hash": "518c8c0f7ef0253e1b193b3c31d15242",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 85,
"avg_line_length": 31.865168539325843,
"alnum_prop": 0.47143864598025387,
"repo_name": "9h37/pompadour-wiki",
"id": "b34f7eed27baa5f4d2de139fcdba94e119e78442",
"size":... |
import unittest
from flask_babel import LazyString
from unittest.mock import patch, MagicMock
from app.exceptions.base import ResourceNotFoundException, \
BusinessRuleException
from app.models.oauth.client import OAuthClient
from app.models.oauth.token import OAuthToken
from app.repository import oauth_repository ... | {
"content_hash": "06abcdf14c2a3189292db16ac208f41d",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 77,
"avg_line_length": 41.1578947368421,
"alnum_prop": 0.6673593350383632,
"repo_name": "viaict/viaduct",
"id": "1b21c2d3b7ef661daa960ebe46bbdff2f1a745ba",
"size": "6256",... |
from kittens.tui.handler import result_handler
from kitty.boss import Boss
from typing import List
def main():
pass
@result_handler(no_ui=True)
def handle_result(args: List[str], answer: str, target_window_id: int, boss: Boss) -> None:
boss.active_tab.neighboring_window(args[1])
| {
"content_hash": "536999b18f5b9d67bee636a666546a33",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 91,
"avg_line_length": 26.454545454545453,
"alnum_prop": 0.7353951890034365,
"repo_name": "joshuarubin/dotfiles",
"id": "ae2914409a9a08d7ff70c1759f015a2670e406c7",
"size": ... |
"""User roles
:copyright: Copyright (c) 2021 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from pykern import pkconfig
from pykern.pkdebug import pkdp
import aenum
import sirepo.feature_config
ROLE_ADM = "adm"
ROLE_PAYMENT_PLAN_ENTERPRISE = "enterprise"
ROLE_PAYMEN... | {
"content_hash": "8fcfa7a9dbe94a6add455b803ac25c29",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 88,
"avg_line_length": 25.075757575757574,
"alnum_prop": 0.6670694864048339,
"repo_name": "radiasoft/sirepo",
"id": "741cbad399a8380da01cd2f37806baf1b9bf2094",
"size": "167... |
import re
import sys
COMMAND = sys.argv.pop(0)
if len(sys.argv) != 2: sys.exit("usage: "+COMMAND+" gold-column-number guessed-column-number < file\n")
GOLDCOLUMN = int(sys.argv.pop(0))
GUESSEDCOLUMN = int(sys.argv.pop(0))
nbrOfClasses = {} # count per class
nbrOfGuesses = {} # count per guess
confusion = {} # confusi... | {
"content_hash": "20bd18653150fcfc1aca5e0757d90784",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 103,
"avg_line_length": 37.405797101449274,
"alnum_prop": 0.6667958155753584,
"repo_name": "online-behaviour/machine-learning",
"id": "2a075a82bd1947480a2317c3a6511c9d529b276... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python.test_util import TestCase
from caffe2.python import workspace, brew
from caffe2.python.model_helper import ModelHelper
from caffe2.python.predictor impo... | {
"content_hash": "cf296a0340f532188352e6b516747774",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 88,
"avg_line_length": 35.89915966386555,
"alnum_prop": 0.6308520599250936,
"repo_name": "Yangqing/caffe2",
"id": "0ae91da5300c3b467a986c192f7d2fce6d8c9519",
"size": "4943... |
"""ZHA device automation trigger tests."""
from datetime import timedelta
import time
import pytest
import zigpy.profiles.zha
import zigpy.zcl.clusters.general as general
import homeassistant.components.automation as automation
import homeassistant.components.zha.core.device as zha_core_device
from homeassistant.help... | {
"content_hash": "dd81b95bb6b9fdcb3c1c32f5179293d6",
"timestamp": "",
"source": "github",
"line_count": 351,
"max_line_length": 84,
"avg_line_length": 30.586894586894587,
"alnum_prop": 0.5408904619970194,
"repo_name": "sdague/home-assistant",
"id": "801b6831379ffa671d53ed09fc41fcf0198b28d7",
"size"... |
from __future__ import (division, print_function, absolute_import,
unicode_literals)
__all__ = ["get_quad_coeffs"]
import os
import shutil
import sqlite3
import logging
from tempfile import NamedTemporaryFile
from six.moves import urllib
from .config import KPLR_ROOT
DB_FILENAME = "ldcoeffs... | {
"content_hash": "e80178f3ab17df02fadee2615b590297",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 79,
"avg_line_length": 30.50381679389313,
"alnum_prop": 0.6191191191191191,
"repo_name": "evanbiederstedt/kplr",
"id": "160419fb69ae881159cde284614631af2b7351e2",
"size": ... |
"""This module, nexus_db.py, acts as an API to the NexusDB {MySQL}."""
import pika
import json
import time
from scripts.docker.wait_for_rabbit_host import WaitForRabbitMQHost
import mysql.connector
print('TODO: Run NexusDB!')
wait = WaitForRabbitMQHost()
wait.wait_for_connection()
print('MAKING A CONNECTI... | {
"content_hash": "6db7c504a7fd3524bb474747cc254bf8",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 86,
"avg_line_length": 21.875,
"alnum_prop": 0.593015873015873,
"repo_name": "utarsuno/quasar_source",
"id": "a44987c449467af5ec983d160e8013f1006bdaf8",
"size": "1591",
"... |
import tensorflow as tf
from examples.data.data_loader import _DEFAULT_IMAGE_SIZE, _NUM_CHANNELS
from examples.utils import get_tfkeras_model
def get_resnet_model(resnet_depth: str = "50", resnet_version: str = "v1") -> tf.keras.Model:
"""
Creates a native tf.keras ResNet model.
Args:
resnet_dept... | {
"content_hash": "97a541b9ea0e84284c7cc0e5fb7ad4b7",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 93,
"avg_line_length": 32.7037037037037,
"alnum_prop": 0.6534541336353341,
"repo_name": "NVIDIA/TensorRT",
"id": "3044d8854ccefbf39f6c4b21c75b7e1851bdf97d",
"size": "1573",... |
import webapp2
from pale.adapters import webapp2 as pale_webapp2_adapter
from pale.config import authenticator, context_creator
from tests.example_app import api
@authenticator
def authenticate_pale_context(context):
"""Don't actually authenticate anything in this test."""
return context
@context_creator
d... | {
"content_hash": "f4904af63b5d828e81663fe47d4d2d00",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 72,
"avg_line_length": 27.56,
"alnum_prop": 0.7387518142235123,
"repo_name": "Loudr/pale",
"id": "6b6a2ce9fb731d0ece6bc5a05667c5c14cf1de69",
"size": "689",
"binary": fals... |
import json
import logging
import os
import os.path
from cornice.service import Service
from pyramid.httpexceptions import HTTPBadGateway, HTTPBadRequest, HTTPNotFound
from json.decoder import JSONDecodeError
from cornice.validators import colander_body_validator
from .. import supervisor
from ..config import path
f... | {
"content_hash": "d127618e0aa033ed69e04d47a8f7d0d6",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 99,
"avg_line_length": 30.850515463917525,
"alnum_prop": 0.6688387635756057,
"repo_name": "getsenic/senic-hub",
"id": "8b55867fda8bf950e068261a50bd685105e7a67e",
"size": "... |
import datetime
import mock
from testtools import matchers
from ironic.common import exception
from ironic import objects
from ironic.tests.unit.db import base
from ironic.tests.unit.db import utils
from ironic.tests.unit.objects import utils as obj_utils
class TestPortObject(base.DbTestCase):
def setUp(self):
... | {
"content_hash": "2ab10104711c7ee5d435bf2b8a49047e",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 79,
"avg_line_length": 42.46268656716418,
"alnum_prop": 0.5766256590509666,
"repo_name": "ruyang/ironic",
"id": "de5adb162738d2d0a3aac05d24de6354de5104c2",
"size": "6282",... |
from instruction_set_parser import is_parser
import unittest
ISP = is_parser.InstructionSetParser
class HexToDecimalTestCase(unittest.TestCase):
"""Tests for the hexadecimal part of the _replace_numerals function"""
def test_simple_literal(self):
self.assertEquals('2', ISP._replace_numerals('0x0002'... | {
"content_hash": "6d4c4b9f51442383e99d868d1ba1383f",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 114,
"avg_line_length": 38.1625,
"alnum_prop": 0.68948575171962,
"repo_name": "G3Kappa/kasmc",
"id": "7d91febca810bd50b1925e8ce805cb036746a132",
"size": "3053",
"binary":... |
from rtfng.utils import RTFTestCase
from rtfng.Elements import Document
from rtfng.document.base import RawCode
from rtfng.document.paragraph import Paragraph
from rtfng.document.section import Section
from rtfng.object.picture import Image
class PictureTestCase(RTFTestCase):
def make_pictures():
doc... | {
"content_hash": "fad4729b45f2776782c1fe75a06097d2",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 108,
"avg_line_length": 35.08163265306123,
"alnum_prop": 0.6340895869691682,
"repo_name": "nekstrom/pyrtf-ng",
"id": "4cda5a7f03f7d6ee5c2c0e656e470f69a6668f33",
"size": "17... |
from __future__ import (absolute_import, division, print_function, unicode_literals)
from future.builtins.disabled import *
from future.builtins import *
from future.standard_library import install_aliases
install_aliases()
# pylint: enable=wildcard-import,unused-wildcard-import,wrong-import-order,wrong-import-position... | {
"content_hash": "337551d1a0ead3a7122e90f553ed3957",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 96,
"avg_line_length": 36.21052631578947,
"alnum_prop": 0.7296511627906976,
"repo_name": "DavidWhittingham/arcpyext",
"id": "99a05d4d5fcc4873a6baf64be9d1cf827d2f088c",
"siz... |
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename('format15.xlsx')
def test_create_file_ze... | {
"content_hash": "d5ec68835dedf95a09f92457600509e6",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 76,
"avg_line_length": 27.127659574468087,
"alnum_prop": 0.6352941176470588,
"repo_name": "jmcnamara/XlsxWriter",
"id": "c8387464660617f47e55d484da9c1b0821a19ca5",
"size": ... |
import gym
from typing import List, Any
TaskType = Any # Can be different types depending on env, e.g., int or dict
class TaskSettableEnv(gym.Env):
"""
Extension of gym.Env to define a task-settable Env.
Your env must implement this interface in order to be used with MAML.
For curriculum learning, ... | {
"content_hash": "013f32afdb57fe964f800ff530f9fd58",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 80,
"avg_line_length": 29.51923076923077,
"alnum_prop": 0.6306188925081433,
"repo_name": "pcmoritz/ray-1",
"id": "003c79293749da11628a61a2a4cc4e10644cf3fb",
"size": "1535",... |
'''The app module, containing the app factory function.'''
from flask import Flask, render_template
from clearstate.settings import ProdConfig
from clearstate.assets import assets
from clearstate.extensions import (
bcrypt,
cache,
db,
login_manager,
migrate,
debug_toolbar,
gravatar,
bab... | {
"content_hash": "cb0fa5ebb225a95ee48b5decf8a594d6",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 73,
"avg_line_length": 26.208955223880597,
"alnum_prop": 0.6981776765375854,
"repo_name": "sharoonthomas/clearstate",
"id": "4aae1e85aea191b2c0bb08e83e2ae87bfec5da87",
"siz... |
from __future__ import absolute_import
import json
import re
import thread
from debug_toolbar.toolbar import DebugToolbar
from django.conf import settings
from django.template.loader import render_to_string
from django.utils.encoding import force_text
class ToolbarCache(object):
def __init__(self):
self... | {
"content_hash": "49d1ebb4f9ab3466d15933a2da2b5ef8",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 85,
"avg_line_length": 33.67256637168141,
"alnum_prop": 0.621550591327201,
"repo_name": "nicholasserra/sentry",
"id": "bbd0a73dcf26e8fbfcc8eb3f43ff03fbb151a98a",
"size": "... |
"""
This class contains the class on which all the commands will be based
"""
class Command(object):
def __init__(self, id, command, summary, votes, url):
self.id = id
self.command = command
self.summary = summary
self.votes = votes
self.url = url
def __repr__(self):
... | {
"content_hash": "821ea3804d62f61af8c353e97b14060c",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 76,
"avg_line_length": 24.434782608695652,
"alnum_prop": 0.501779359430605,
"repo_name": "ncrocfer/clf",
"id": "2c366719d64d79d94bfa89a458cdb23e20f82d9c",
"size": "587",
... |
from oslo.config import cfg
import requests
import six
from six.moves.urllib import parse as urlparse
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
CONF = cfg.CONF
LOG = log.getLogger(__name__)
class OpencontrailAPIFailed(Exception):
pass
class Analytics... | {
"content_hash": "314cd3b86bee7895b41ef274cf488a37",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 78,
"avg_line_length": 29.85135135135135,
"alnum_prop": 0.5427795382526029,
"repo_name": "froyobin/ceilometer",
"id": "6c66f42c385b32175353786e1c846a8212a670c4",
"size": "... |
from .runner import TAPTestRunner
__all__ = ["TAPTestRunner"]
__version__ = "3.1"
| {
"content_hash": "9fef90fbd93c634f93931f26ae2c2b73",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 33,
"avg_line_length": 20.75,
"alnum_prop": 0.6506024096385542,
"repo_name": "mblayman/tappy",
"id": "6d7ab3ff8ea5abb6125c3e97168ca3f0920df597",
"size": "83",
"binary": fa... |
"""
Basic utilities for handling avro schemas
"""
from avro import schema
def hash_func(self):
""" Monkey patching the avro library's schema module's RecordSchema class.
Patching the https://github.com/apache/avro/blob/trunk/lang/py3/avro/schema.py as the RecordSchema doesn't have a __hash__ function, bu... | {
"content_hash": "fc04cece298ffbc8e2a96e534f5f1549",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 194,
"avg_line_length": 41,
"alnum_prop": 0.7223264540337712,
"repo_name": "zoltan-fedor/python-confluent-schemaregistry",
"id": "b94387395c1301c2864d92a2bf273e381a147462",
... |
import math
import numpy
import scipy.ndimage
from PIL import Image
from PIL import ImageDraw
from pyami import imagefun
from pyami import ellipse
from pyami import primefactor
from appionlib import apDisplay
from appionlib.apCtf import ctfpower
from appionlib.apImage import imagefile
from appionlib.apImage import imag... | {
"content_hash": "e43aa1a793a873d9fa81c442e3fc774a",
"timestamp": "",
"source": "github",
"line_count": 516,
"max_line_length": 121,
"avg_line_length": 33.68023255813954,
"alnum_prop": 0.6934806375510674,
"repo_name": "vossman/ctfeval",
"id": "c4a714ba73ed0d79e600af766461d2cb4d02baba",
"size": "174... |
"""Define APIs for the servicegroup access."""
from oslo_config import cfg
from oslo_utils import importutils
from nova.i18n import _, _LW
from nova.openstack.common import log as logging
LOG = logging.getLogger(__name__)
_default_driver = 'db'
servicegroup_driver_opt = cfg.StrOpt('servicegroup_driver',
... | {
"content_hash": "0cc1ce85c7ddfe1ffab6c4f863992511",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 79,
"avg_line_length": 41.67796610169491,
"alnum_prop": 0.5717771451809679,
"repo_name": "sajeeshcs/nested_quota_final",
"id": "07dcec13ba5f585fab2ae6e97294684a90d682b6",
... |
from collections import OrderedDict
favorite_languages = OrderedDict()
favorite_languages['kaushik'] = 'python'
favorite_languages['sahil'] = 'javascript'
favorite_languages['prashant'] = 'java'
for name, language in favorite_languages.items():
print(name.title() + "'s favorite language is " +
language.title... | {
"content_hash": "33000d8337c6f5d19333bee89852817c",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 53,
"avg_line_length": 29.90909090909091,
"alnum_prop": 0.7173252279635258,
"repo_name": "KT26/PythonCourse",
"id": "0464e7134b34f5a28b42a2caac54ac5f09eed974",
"size": "602... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.