text stringlengths 4 1.02M | meta dict |
|---|---|
from django.conf.urls import patterns, include, url
from tastypie.api import Api
from testapp.resources import (
UserResource, HomePageResource, ThrottledHomePageResource
)
v1 = Api(api_name='v1')
v1.register(UserResource())
v1.register(HomePageResource())
v1.register(ThrottledHomePageResource())
urlpatterns = ... | {
"content_hash": "1eab0055dfcad3c99c2470af5bc80a9e",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 61,
"avg_line_length": 22.11764705882353,
"alnum_prop": 0.7473404255319149,
"repo_name": "uranusjr/django-tastypie-crust",
"id": "301547cc37176860a99d99f2438ef0189a198c6d",
... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
import os
import signal
import time
import traceback
from contextlib import contextmanager
import psutil
from pants.base.build_environment import get_... | {
"content_hash": "02aea623c2cce052b2a1191b25472194",
"timestamp": "",
"source": "github",
"line_count": 572,
"max_line_length": 108,
"avg_line_length": 40.95454545454545,
"alnum_prop": 0.6795867839153078,
"repo_name": "baroquebobcat/pants",
"id": "4d49c6a1f6c7c87af3f4add2e24360e324feeaae",
"size": ... |
import abc
from typing import Awaitable, Callable, Optional, Sequence, Union
import pkg_resources
import google.auth # type: ignore
import google.api_core # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core... | {
"content_hash": "77091404cf34f4e0043a36f39a39dbbb",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 101,
"avg_line_length": 38.17687074829932,
"alnum_prop": 0.6245545260156807,
"repo_name": "googleads/google-ads-python",
"id": "18ad0ff93a92539397465963bac67891f5028511",
... |
from __future__ import absolute_import
import os
from celery import Celery
from django.conf import settings
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'battleground.settings')
app = Celery('battleground')
# Using a string here means the worke... | {
"content_hash": "7072eab80a4e41c10ce1a8e7545aa6ec",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 72,
"avg_line_length": 26.833333333333332,
"alnum_prop": 0.782608695652174,
"repo_name": "rmariano/pywars",
"id": "09f2cbb825b55767059222283a87c88aa5835ae9",
"size": "483",... |
"""Perturb a `LinearOperator` with a rank `K` update."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from tensorflow.python.ops import array_ops
from tensor... | {
"content_hash": "4a923ee3b515dad2ac491bacf04fc196",
"timestamp": "",
"source": "github",
"line_count": 455,
"max_line_length": 80,
"avg_line_length": 38.47912087912088,
"alnum_prop": 0.6282842129312315,
"repo_name": "annarev/tensorflow",
"id": "2e60a10e226c31dc01d851b321a75e29c68bd8f9",
"size": "1... |
import sys
import tensorflow as tf
from sacrebleu import corpus_bleu
def bleu_score(pred_file, ref_file):
with tf.io.gfile.GFile(pred_file) as pred_stream, tf.io.gfile.GFile(ref_file) as ref_stream:
pred_stream_txt = pred_stream.readlines()
ref_stream_txt = ref_stream.readlines()
bleu = cor... | {
"content_hash": "9aca2fb82f4c4400cca7ef89d3abf393",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 122,
"avg_line_length": 46.61904761904762,
"alnum_prop": 0.6067415730337079,
"repo_name": "NVIDIA/FasterTransformer",
"id": "a4c95adc8bf2bf28eb22200cb31324fb64c73187",
"siz... |
import lynx
def test_encode_one_section():
section = lynx.Section("mysection", [], {})
result = lynx.dumps(section)
config = lynx.loads(result)
assert(len(config) == 1)
assert(config[0].name() == "mysection")
def test_encode_multiple_sections():
sub_section = lynx.Section("mysection2", [], {})... | {
"content_hash": "8039999415e18e9045b8965812625ad9",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 64,
"avg_line_length": 34.891304347826086,
"alnum_prop": 0.609968847352025,
"repo_name": "omershelef/lynx",
"id": "02a993a98ded3b19fd1cbeec6dd676441e34e38e",
"size": "1605"... |
"""Tests for make_template."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import traceback
from tensorflow.python.client import session
from tensorflow.python.eager import context
from tensorflow.python.framework import ops
from tensor... | {
"content_hash": "015f3a472e18d155e7151afbbd3cdcd0",
"timestamp": "",
"source": "github",
"line_count": 790,
"max_line_length": 80,
"avg_line_length": 37.72278481012658,
"alnum_prop": 0.6655481359685916,
"repo_name": "frreiss/tensorflow-fred",
"id": "45a1d423fb7a6a403210ca336202e8470277647f",
"size... |
try:
import unittest2 as unittest
except ImportError:
import unittest
import os
from utils import setup_syspath
setup_syspath()
from elftools.elf.elffile import ELFFile
from elftools.common.exceptions import ELFError
from elftools.elf.dynamic import DynamicTag
class TestDynamicTag(unittest.TestCase):
"""... | {
"content_hash": "3df8f34dec010e8d7046746e6269c53f",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 73,
"avg_line_length": 28.066666666666666,
"alnum_prop": 0.5977830562153602,
"repo_name": "endlessm/chromium-browser",
"id": "f25febafff33b5c7ab59da1a15238f0f513121c8",
"si... |
from threading import Thread
import requests
from django.contrib.auth import get_user_model
User = get_user_model()
class OPENDOTA:
PLAYERS = "https://api.opendota.com/api/players/{account_id}"
RANK_TIERS = [
'Uncalibrated',
'Herald',
'Guardian',
'Crusader',
'Archon',
'Legend',
'An... | {
"content_hash": "096620fbb80f1533395b4f55b268a38b",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 68,
"avg_line_length": 22.186666666666667,
"alnum_prop": 0.6316105769230769,
"repo_name": "prattl/wepickheroes",
"id": "08b00c937e81cac745dc399fb732900502219c68",
"size": "... |
# coding: utf-8
from __future__ import absolute_import
import pytest
import os.path
import responses
from mock import patch
from django.conf import settings
from sentry.models import Event, File, Release, ReleaseFile
from sentry.testutils import TestCase
BASE64_SOURCEMAP = 'data:application/json;base64,' + (
... | {
"content_hash": "5617e9459689332882ace56c6bf1b441",
"timestamp": "",
"source": "github",
"line_count": 1434,
"max_line_length": 190,
"avg_line_length": 35.95536959553696,
"alnum_prop": 0.4299069045771916,
"repo_name": "looker/sentry",
"id": "3adad1e3de5c54d81778dcedc137bbfbb79e727e",
"size": "5156... |
from __future__ import absolute_import
import copy
import six
from keystone.common import kvs
from keystone import config
from keystone import exception
from keystone.openstack.common.gettextutils import _
from keystone.openstack.common import log
from keystone.openstack.common import timeutils
from keystone import t... | {
"content_hash": "5fa7ab956841969c7845d6cae939fd59",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 79,
"avg_line_length": 42.11538461538461,
"alnum_prop": 0.5681067790656832,
"repo_name": "sanket4373/keystone",
"id": "395f5ab0e6472d4b99e7aa7d936d4111ffdb91c5",
"size": "... |
import os, sys, getopt, traceback, json, re
from py4j.java_gateway import java_import, JavaGateway, GatewayClient
from py4j.protocol import Py4JJavaError
from pyspark.conf import SparkConf
from pyspark.context import SparkContext
from pyspark.rdd import RDD
from pyspark.files import SparkFiles
from pyspark.storageleve... | {
"content_hash": "dd2d0ed161be1f10d256d00d2167fb34",
"timestamp": "",
"source": "github",
"line_count": 364,
"max_line_length": 142,
"avg_line_length": 31.447802197802197,
"alnum_prop": 0.6832357823010395,
"repo_name": "Nova-Boy/zeppelin",
"id": "da4d7943e7c88b9e062308ab83c79f2b37bb3d8e",
"size": "... |
from common import *
def test_create_out_of_session(m):
n = TNode()
randval = n.randval = n.randval
assert m.session.count == 1
ret = create_out_of_session(m, n)
assert m.session.count == 0
assert isinstance(ret, int)
n = TNode.get(ret)
assert m.session.count == 1
assert n.randval... | {
"content_hash": "2a7091a648171d731c6381f569e3d06c",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 59,
"avg_line_length": 23.223300970873787,
"alnum_prop": 0.6082775919732442,
"repo_name": "ivotkv/neolixir",
"id": "576343875a704900bc998d12b1fbf52fb378b7b5",
"size": "352... |
from .time import hour
from .length import nautical_mile
#
# Definitions of common speed units
# Data taken from Appendix F of Halliday, Resnick, Walker, "Fundamentals of Physics",
# fourth edition, John Willey and Sons, 1993
knot = nautical_mile/hour
| {
"content_hash": "8ca1d027fc80a7767ad7b68ad44d2c03",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 85,
"avg_line_length": 25.9,
"alnum_prop": 0.752895752895753,
"repo_name": "Heathckliff/cantera",
"id": "93374c83abef6de9e9a40a051dedda7313970ac4",
"size": "259",
"binary... |
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='SQLApiUser',
fields=[
... | {
"content_hash": "6edf459703d2768013fecf451002028b",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 111,
"avg_line_length": 28.88888888888889,
"alnum_prop": 0.5717948717948718,
"repo_name": "dimagi/commcare-hq",
"id": "fde12eeba66c30ba7a1c7bffa19affe6bfd3e37a",
"size": "8... |
import json
# read json file into python dictionary
def read_json(json_file):
with open(json_file, 'rb') as data_file:
data = json.loads(data_file.read())
return data
# read csv file into python list of lists
def read_csv(csv_file, delimiter, strip):
with open(csv_file, 'rb') as data_file:
... | {
"content_hash": "1ce5f81f0be1a1cf31d4e0c445ba1c14",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 44,
"avg_line_length": 30.41176470588235,
"alnum_prop": 0.6170212765957447,
"repo_name": "baldwmic/portfolio-website",
"id": "02370934935703a83bcccb31c771ca5f26549170",
"si... |
import time
import asyncio
import aioprocessing as aioproc
import multiprocessing as mp
from collections import defaultdict
from .common import Configuration, MethodRegistry
from .enums import AnswerErrorCode, ProcCmdType
from .server import Server as ConnectionServer
from .transport import ProcCmd
_min_iter_delay ... | {
"content_hash": "446aeff99d3619db2e1f71768a15f79c",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 77,
"avg_line_length": 30.037542662116042,
"alnum_prop": 0.5305078968299057,
"repo_name": "unaxfromsibiria/roolet",
"id": "4dacd8edfd238e764d970c89d4110612aea12379",
"size... |
import ast
import builtins
import collections
import decimal
import fractions
import io
import locale
import os
import pickle
import platform
import random
import re
import sys
import traceback
import types
import unittest
import warnings
from operator import neg
from test.support import TESTFN, unlink, run_unittest, ... | {
"content_hash": "2424e5aca743611cb4e1761bf5587dde",
"timestamp": "",
"source": "github",
"line_count": 1829,
"max_line_length": 105,
"avg_line_length": 36.09021323127392,
"alnum_prop": 0.5253071550849127,
"repo_name": "anbangleo/NlsdeWeb",
"id": "a792099f10a48ee79e38e7ec15de3446791453f5",
"size": ... |
import typing as t
from .scope_definition import MutableScope
ScopeBuilderScopes = t.Union[
None, str, t.Tuple[str, str], t.List[t.Union[str, t.Tuple[str, str]]]
]
class ScopeBuilder:
"""
Utility class for creating scope strings for a specified resource server.
:param resource_server: The identifie... | {
"content_hash": "f19e838146176b3549b88987120ccee9",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 87,
"avg_line_length": 38.03086419753087,
"alnum_prop": 0.6231131309852297,
"repo_name": "globus/globus-sdk-python",
"id": "359dbc124f759d5051796c18349c37b727f02448",
"siz... |
import json, hmac, hashlib, time, requests, base64
from requests.auth import AuthBase
from abc import ABCMeta, abstractmethod
class exchange(object):
__metaclass__ = ABCMeta
def __init__(self):
pass
@abstractmethod
def place_order(self):
pass
class cb_exchange_sim(exchange):
"""C... | {
"content_hash": "71ba065f259eeb986a5ca6b93eb2e421",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 107,
"avg_line_length": 35.42857142857143,
"alnum_prop": 0.5647401433691757,
"repo_name": "ehickox/bitraider",
"id": "111bb9113261b64bedffee0cb7d9ce7c95272dcf",
"size": "8... |
default_app_config = 'sample.config.SiteConfig'
| {
"content_hash": "66d7ab5b21c1ba3ef391fd3de58cd942",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 47,
"avg_line_length": 48,
"alnum_prop": 0.7916666666666666,
"repo_name": "altio/foundation",
"id": "1f8edd2834109d73df0d5c8587b1ee15d8a15c21",
"size": "48",
"binary": fal... |
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('trees', '0010_treephoto_license'),
]
operations = [
... | {
"content_hash": "1436641efb00688cb6950f93d72a993e",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 76,
"avg_line_length": 26.095238095238095,
"alnum_prop": 0.6405109489051095,
"repo_name": "mattblair/pdx-trees-django",
"id": "eb7104abf3196a44376e214092221021afcc79b1",
"s... |
import asyncio
import unittest
from couchbase.experimental import enable; enable()
from fixtures import asynct, AioTestCase
from couchbase.n1ql import N1QLQuery
class CouchbaseBeerTest(AioTestCase):
def make_connection(self):
try:
return super().make_connection(bucket='beer-sample')
... | {
"content_hash": "782f666cd2a4b313b190d4fd2d36b416",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 75,
"avg_line_length": 25.958333333333332,
"alnum_prop": 0.6420545746388443,
"repo_name": "mnunberg/couchbase-python-client",
"id": "fc688672ca71cf73c3e305378b352e473a1e4a13"... |
import os
import sys
import periodicals
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
version = periodicals.__version__
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
print("You probably want to also tag the version now:")
print("... | {
"content_hash": "563312cd263efb712dad8d035a9bb356",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 69,
"avg_line_length": 28.555555555555557,
"alnum_prop": 0.6160830090791181,
"repo_name": "saschwarz/django-periodicals",
"id": "3966d2e06163905fcfeca2ac6a09cdfafa4a1d2d",
... |
"""Converts MNIST data to TFRecords file format with Example protos."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy
import tensorflow as tf
from tensorflow.contrib.learn.python.learn.datasets import mnist
SOURCE_URL = 'http://yan... | {
"content_hash": "d6613e9828358f9dc31befe2ac181fae",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 79,
"avg_line_length": 32.4025974025974,
"alnum_prop": 0.6509018036072144,
"repo_name": "HaebinShin/tensorflow",
"id": "2e3035731ad435fcb11d08adb423b73f5fbd52cc",
"size": "... |
from distutils.core import setup
setup(
name='BatchNotebook',
version='0.0.3',
packages=['batch_notebook'],
license='BSD-new license',
description='Tools for running an IPython notebook in batch mode.',
long_description=open('README.rst').read(),
author='John Bjorn Nelson',
author_email... | {
"content_hash": "5094b7d954c5d2dac3cafce32ffc3a0c",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 71,
"avg_line_length": 29.176470588235293,
"alnum_prop": 0.6532258064516129,
"repo_name": "jbn/BatchNotebook",
"id": "b7d98efbcd66f36f9fe1c2a9c6d2cd9f36814db0",
"size": "49... |
"""
kombu.exceptions
================
Exceptions.
:copyright: (c) 2009 - 2011 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
class NotBoundError(Exception):
"""Trying to call channel dependent method on unbound entity."""
pass
class MessageStateError(Exception):
"""The message has alr... | {
"content_hash": "e2f51600a8f22df7121e6ab113080d98",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 68,
"avg_line_length": 17.125,
"alnum_prop": 0.694647201946472,
"repo_name": "WoLpH/kombu",
"id": "bac4ac8688fa93853d338834021d026b16001e3c",
"size": "822",
"binary": fal... |
import sys
from pyspark import since, keyword_only
from pyspark.ml.util import *
from pyspark.ml.wrapper import JavaEstimator, JavaModel, JavaParams, JavaWrapper
from pyspark.ml.param.shared import *
from pyspark.ml.common import inherit_doc
from pyspark.sql import DataFrame
__all__ = ['BisectingKMeans', 'BisectingKM... | {
"content_hash": "98c485787a50271aaf8f61dbd8513a86",
"timestamp": "",
"source": "github",
"line_count": 1343,
"max_line_length": 100,
"avg_line_length": 35.79523454951601,
"alnum_prop": 0.5943877020364862,
"repo_name": "bravo-zhang/spark",
"id": "4aa1cf84b5824cb193164c24e032945c19562b1c",
"size": "... |
"""Distributed MNIST training and validation, with model replicas.
A simple softmax model with one hidden layer is defined. The parameters
(weights and biases) are located on two parameter servers (ps), while the
ops are defined on a worker node. The TF sessions also run on the worker
node.
Multiple invocations of thi... | {
"content_hash": "39901eb3d4e60e3cbdc94653e2df9f8e",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 85,
"avg_line_length": 39.63720930232558,
"alnum_prop": 0.6284909645623094,
"repo_name": "douban/tfmesos",
"id": "a984d24ff8d9da4ed322a8b7b36f415e664b2d8e",
"size": "9212"... |
import os
import six
import tempfile
import nova.privsep.path
from nova import test
class LastBytesTestCase(test.NoDBTestCase):
"""Test the last_bytes() utility method."""
def setUp(self):
super(LastBytesTestCase, self).setUp()
self.f = six.BytesIO(b'1234567890')
def test_truncated(self... | {
"content_hash": "4b158d7f7a0701587e341b534154ead7",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 79,
"avg_line_length": 31.4,
"alnum_prop": 0.6278434940855323,
"repo_name": "gooddata/openstack-nova",
"id": "cacbebd0e9f939e7043c8df84749bed65da99ab5",
"size": "1741",
"... |
import types
import warnings
import pickle
import re
from copy import deepcopy
from functools import partial, wraps
from inspect import signature
from numbers import Real
import numpy as np
from scipy import sparse
from scipy.stats import rankdata
import joblib
from . import IS_PYPY
from .. import config_context
from... | {
"content_hash": "f6305c933755074ec62d37c2a9241089",
"timestamp": "",
"source": "github",
"line_count": 4223,
"max_line_length": 88,
"avg_line_length": 35.31304759649538,
"alnum_prop": 0.6093396903310601,
"repo_name": "vinayak-mehta/scikit-learn",
"id": "7026159f162879b84961d78337f1f33812de510f",
"... |
import datetime
import uuid
from keystoneauth1 import _utils
from keystoneauth1.fixture import exception
class _Service(dict):
"""One of the services that exist in the catalog.
You use this by adding a service to a token which returns an instance of
this object and then you can add_endpoints to the serv... | {
"content_hash": "d037e9000405cf82834dd1d691374d44",
"timestamp": "",
"source": "github",
"line_count": 415,
"max_line_length": 79,
"avg_line_length": 33.15421686746988,
"alnum_prop": 0.5939385129733266,
"repo_name": "citrix-openstack-build/keystoneauth",
"id": "b5344245c4cb0570be88c5e7717001d21d9188... |
import unittest
import jupyter_kernel_test
class XeusKernelTests(jupyter_kernel_test.KernelTests):
kernel_name = "test_kernel"
language_name = "cpp"
code_hello_world = "hello, world"
code_page_something = "?"
code_execute_result = [
{'code': '6*7', 'result': '6*7'},
{'code': 'te... | {
"content_hash": "e12f064ebf61627d539e9bd202e543b9",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 69,
"avg_line_length": 26.416666666666668,
"alnum_prop": 0.5951629863301787,
"repo_name": "QuantStack/xeus",
"id": "f681a0e557103c7e1a38eb0ec38b01a1ca83ed66",
"size": "951"... |
try:
__IPYTHON__
import sys
del sys.argv[1:]
except:
pass
import srwl_bl
import srwlib
import srwlpy
def set_optics(v=None):
el = []
pp = []
pp.append([])
return srwlib.SRWLOptC(el, pp)
varParam = srwl_bl.srwl_uti_ext_options([
['name', 's', 'Undulator Radiation', 'simulation ... | {
"content_hash": "2cea2bbfae1c95b36c6afe5ac24e12fe",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 440,
"avg_line_length": 86.73979591836735,
"alnum_prop": 0.6757249573554497,
"repo_name": "radiasoft/sirepo",
"id": "5486918274c196a837206f46c5ad6e884dbbafd4",
"size": "17... |
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class AvailableAddOnTestCase(IntegrationTestCa... | {
"content_hash": "903d22efbd23e0d041b1422efd29ce79",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 144,
"avg_line_length": 37.080882352941174,
"alnum_prop": 0.4824509220701963,
"repo_name": "twilio/twilio-python",
"id": "31f830e66198641e1e3b47fcf01df79380c8c249",
"size"... |
import datetime
from keystoneclient import exceptions
import requests
from ceilometer.central import plugin
from ceilometer import counter
from ceilometer.openstack.common import log
LOG = log.getLogger(__name__)
class KwapiClient(object):
"""Kwapi API client."""
def __init__(self, url, token=None):
... | {
"content_hash": "7dcf4c295ad98dafa6173f58f619b2a6",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 79,
"avg_line_length": 32.144444444444446,
"alnum_prop": 0.5458002073971656,
"repo_name": "dreamhost/ceilometer",
"id": "a171d6fb3178dc24758a84911173784c7596e6d8",
"size": ... |
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
from hamcrest.core.base_matcher import BaseMatcher
import six
class IsEqualIgnoringCase(BaseMatcher):
def __init__(self, string):
if not isinstance(string, six.string_types):
raise Type... | {
"content_hash": "1a24211824f907a631914b322442e382",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 78,
"avg_line_length": 29.232558139534884,
"alnum_prop": 0.6690533015115354,
"repo_name": "axbaretto/beam",
"id": "d1ee2d17fc34d32a503f3be5e7ea38c6d049f7e2",
"size": "1257"... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0029_auto_20200902_1549'),
]
operations = [
migrations.AddField(
model_name='proposedtalkevent',
name='is_remote',
field=models.BooleanField(de... | {
"content_hash": "5a6d128150c77550744a4e2db4c51cd2",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 79,
"avg_line_length": 23.5625,
"alnum_prop": 0.596816976127321,
"repo_name": "pycontw/pycontw2016",
"id": "3a03415f04600c821f11f0d64bfd6f3214d64783",
"size": "426",
"bin... |
'''Various helpers for doing advanced things with dictionaries.'''
import re
def get_fields(s):
'''Return a set of field names referenced as formatting keys in the given
string. I thought there would be an easier way to get this, but I can't
find one. E.g. get_fields('%(hello)s %(world)s') returns
set... | {
"content_hash": "055781f37d46d3e2a56b5a331ff7f591",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 77,
"avg_line_length": 33.63157894736842,
"alnum_prop": 0.6384976525821596,
"repo_name": "smaccm/camkes-tool",
"id": "265a7c1fb9cf36104debffd7953c6bfebcee811e",
"size": "86... |
"""Tests for model saving."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import shutil
import tempfile
from absl.testing import parameterized
import numpy as np
from tensorflow.python import keras
from tensorflow.python.eager import context
... | {
"content_hash": "a7a4c4a7958cbd7dd735d56adfbe3593",
"timestamp": "",
"source": "github",
"line_count": 848,
"max_line_length": 80,
"avg_line_length": 36.14033018867924,
"alnum_prop": 0.6077919535354195,
"repo_name": "jart/tensorflow",
"id": "030328f2a66f0ec406ac271aecfbf2dbebf22f5f",
"size": "3133... |
from collections import namedtuple
import requests
TRACKING_URI = 'https://ssl.google-analytics.com/collect'
def _request(data, extra_headers):
return requests.post(TRACKING_URI, data=data, headers=extra_headers,
timeout=5.0)
def report(tracking_id, client_id, requestable, extra_info=... | {
"content_hash": "ee0152bcf1936ef9ee86bf1dba7ebf25",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 133,
"avg_line_length": 33.33203125,
"alnum_prop": 0.5568967537794445,
"repo_name": "hadynz/plugin.video.altv",
"id": "62efff1012d8b0f1f6a94f167a26edc9ab2ba0e0",
"size": "... |
import subprocess
import os
import tempfile
import json
from git import Repository
from config import config
def apply_roles(roles, services, ports, host, repository, extra_vars=None, tags=None, skip=None):
"""
:type roles: list[str]
:type host: str
:type repository: Repository
:type extra_vars: d... | {
"content_hash": "5b7deb4b9aff2293db7eea57c1f5af77",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 97,
"avg_line_length": 30.633333333333333,
"alnum_prop": 0.6409140369967355,
"repo_name": "iamdork/dork",
"id": "f9b32de8df0159f418d8519e7f951ca1a7eec333",
"size": "2757",
... |
"""Print classes which have a virtual method and non-virtual destructor."""
from __future__ import print_function
from __future__ import unicode_literals
from . import ast
from . import metrics
__author__ = 'nnorwitz@google.com (Neal Norwitz)'
def _find_warnings(filename, source, ast_list):
count = 0
for ... | {
"content_hash": "0b3a474dce335db43f735af66aa16119",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 75,
"avg_line_length": 34.63636363636363,
"alnum_prop": 0.5085301837270341,
"repo_name": "susundberg/esp8266-waterpump",
"id": "b1dbd0392b264747637b1e4514ffee240dd7d38c",
"... |
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from django.db import models
class Board(models.Model):
year = models.IntegerField()
officers = models.TextField()
class Meta:
ordering = ("year",)
get_latest_by = "year"
verbose_name... | {
"content_hash": "65121b5dc4505c5fd55b0e10077c60d8",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 124,
"avg_line_length": 29.76923076923077,
"alnum_prop": 0.5936692506459949,
"repo_name": "hylje/tekis",
"id": "698813e597edab86d4171a4c2b32fded8eb9d49e",
"size": "1548",
... |
import json
import numpy as np
from inversetoon.data.contour import Contour
from inversetoon.data.data import Data
from inversetoon.data.segment import IsophoteSegment
## Curve data class.
#
# Attributes:
# * cvs: list of control vertices (n x 2 numpy.array).
# * segments_cvIDs: list of segment_cvIDs.
# - se... | {
"content_hash": "7317be0c6f8d19a928e0818946acb51b",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 78,
"avg_line_length": 27.624454148471617,
"alnum_prop": 0.5758773316471704,
"repo_name": "tody411/InverseToon",
"id": "04af59769f55ed2a2c3c4c609b17fcdede94a847",
"size": ... |
from __future__ import annotations
import os.path
import sys
from unittest import mock
import pytest
import pre_commit.constants as C
from pre_commit.envcontext import envcontext
from pre_commit.languages import python
from pre_commit.prefix import Prefix
from pre_commit.util import make_executable
from pre_commit.u... | {
"content_hash": "9d8e7e10a9900a22210a59700b6ff278",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 103,
"avg_line_length": 32.70754716981132,
"alnum_prop": 0.6580617248341506,
"repo_name": "pre-commit/pre-commit",
"id": "54fb98feb5fcd9618b91646f8cfaccda1d4fd931",
"size"... |
from PyQt4 import QtCore, QtGui
app = QtGui.QApplication([''])
mw = QtGui.QMainWindow() # mw = MainWindow
mw.setCentralWidget(None)
mw.showMaximized()
mw.dockWdg1 = QtGui.QDockWidget(mw)
mw.content1 = QtGui.QTreeWidget()
mw.dockWdg1.setWidget(mw.content1)
mw.addDockWidget(QtCore.Qt.TopDockWidgetArea, mw.dockWdg1)
mw... | {
"content_hash": "f53fcb1eae757cb27a768b0f53ade095",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 61,
"avg_line_length": 29.071428571428573,
"alnum_prop": 0.7874692874692875,
"repo_name": "dls-controls/qt_python_dock",
"id": "9554620e3b39df0e7cc5977b5680cede52f65b8d",
"... |
from django.contrib import admin
from django_token.models import Token
admin.site.register(Token)
| {
"content_hash": "782bebcb8712b74868c7196ab38b5f9d",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 37,
"avg_line_length": 20,
"alnum_prop": 0.82,
"repo_name": "jasonbeverage/django-token",
"id": "97aba63d5813daade2383daa5bb2751f56553016",
"size": "100",
"binary": false,... |
from numba import njit, types
from numba.tests.gdb_support import GdbMIDriver
from numba.tests.support import TestCase, needs_subprocess
import unittest
@njit(debug=True)
def foo(x):
z = 7 + x
return x, z
@needs_subprocess
class Test(TestCase):
def test(self):
foo(120)
sz = types.intp.b... | {
"content_hash": "9736af86185a6c0efe6ad730def75962",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 75,
"avg_line_length": 27.515151515151516,
"alnum_prop": 0.6156387665198237,
"repo_name": "seibert/numba",
"id": "da74077bbdf5196e9ff5ced0754579210d9295fc",
"size": "980",
... |
import test_classification
import numpy as np
from SimpleGP import SparseGPPG, SparseArray
from SimpleGP.gppg import PGCl
import os
cl = test_classification.cl
X = test_classification.X
def test_gppg():
x = map(lambda x: SparseArray.fromlist(X[x]), range(X.shape[0]))
fname = 'gppg.npy.gz'
gp = SparseGPPG... | {
"content_hash": "17ba3b85e9054a234f84f688ca2482d6",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 71,
"avg_line_length": 32.4,
"alnum_prop": 0.575925925925926,
"repo_name": "mgraffg/simplegp",
"id": "12482b1ff107157da56ff15cc84b2172386b95f3",
"size": "3240",
"binary"... |
"""
List available ports.
This is a simple version of mido-ports.
"""
from __future__ import print_function
import mido
def print_ports(heading, port_names):
print(heading)
for name in port_names:
print(" '{}'".format(name))
print()
print()
print_ports('Input Ports:', mido.get_input_names())... | {
"content_hash": "54f5f2f443e422f98373eb4d56a2ae2d",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 53,
"avg_line_length": 19.736842105263158,
"alnum_prop": 0.6613333333333333,
"repo_name": "olemb/mido",
"id": "947a299305543481b41be4aeeff7876e05da48a9",
"size": "397",
"... |
from django.core.cache import cache
class SingletonMixin:
"""A base model to represents a singleton."""
def set_cache(self):
cache.set(self.__class__.__name__, self)
def save(self, *args, **kwargs): # pylint:disable=arguments-differ
self.pk = 1
super().save(*args, **kwargs)
... | {
"content_hash": "e9b810d3af169be12d8d0e931a8c1eac",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 73,
"avg_line_length": 25,
"alnum_prop": 0.616,
"repo_name": "polyaxon/polyaxon",
"id": "fd94179a3b095d056418e431f3417ead8c687115",
"size": "1105",
"binary": false,
"co... |
import unittest
import tempfile
import sys
import os
import io
import datashape
from dynd import nd
import numpy as np
from blaze.datadescriptor import (
HDF5DataDescriptor, DyNDDataDescriptor, IDataDescriptor, dd_as_py)
from blaze.py2help import skipIf
from blaze.optional_packages import tables_is_here
if table... | {
"content_hash": "935f0df95731d80e38084ed0dc0fabc2",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 72,
"avg_line_length": 37.096774193548384,
"alnum_prop": 0.6197101449275362,
"repo_name": "cezary12/blaze",
"id": "c94f43c5e4e6b1c263a4c781b060daba18f49fa9",
"size": "3450"... |
from beritest_tools import BaseBERITestCase
class test_break(BaseBERITestCase):
def test_break_epc(self):
self.assertRegisterEqual(self.MIPS.a0, self.MIPS.a5, "Unexpected EPC")
def test_break_returned(self):
self.assertRegisterEqual(self.MIPS.a1, 1, "flow broken by breakpoint instruction")
... | {
"content_hash": "0b135e33fc3948720fb6637d1e94e6dd",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 104,
"avg_line_length": 43,
"alnum_prop": 0.6875631951466128,
"repo_name": "8l/beri",
"id": "93288415a407a53e9138e7591da812aead0a7d14",
"size": "2129",
"binary": false,
... |
from __future__ import absolute_import, unicode_literals
import multiprocessing
from build_swift import argparse
from build_swift import defaults
from swift_build_support.swift_build_support import targets
__all__ = [
'HelpOption',
'SetOption',
'SetTrueOption',
'SetFalseOption',
'DisableOption'... | {
"content_hash": "383f2c16558cd7c9e3ed7b580224a5b3",
"timestamp": "",
"source": "github",
"line_count": 747,
"max_line_length": 83,
"avg_line_length": 38.58902275769746,
"alnum_prop": 0.6511482689238881,
"repo_name": "xwu/swift",
"id": "4004159d2966d03d2ac81154f0184a20b6d24871",
"size": "29172",
... |
from .._iree_structured_transform_ops_gen import *
| {
"content_hash": "7dbd8a2783f26a6e191fe3ed04ff71bf",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 50,
"avg_line_length": 51,
"alnum_prop": 0.7647058823529411,
"repo_name": "iree-org/iree",
"id": "563e20bc0b046f38d87809b9db185e78901884c7",
"size": "269",
"binary": false... |
"""
$Id$
"""
from email import message_from_string
from utils import log, log_exc
from exceptions import MailInException
from config import config_instance
from django.shortcuts import render_to_response
from django.http import HttpResponse
class MailInTransport(object):
def __call__(self, request, *args, **kw... | {
"content_hash": "94df6b5a323eec935986535790fb1b61",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 67,
"avg_line_length": 27.77777777777778,
"alnum_prop": 0.6304,
"repo_name": "blw0rm/django-email-processing",
"id": "716e02065e7d6753ba2324b7701e0edec0925d74",
"size": "12... |
import logging
import requests
import anyjson as json
import urllib2
from daikon import exceptions
# ---------------------
# Logging
# ---------------------
log = logging.getLogger('daikon')
# ---------------------
# Classes
# ---------------------
class Index(object):
def __init__(self, connection):
... | {
"content_hash": "2ae0fc522868d7340b530b7e5c459657",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 70,
"avg_line_length": 31.91304347826087,
"alnum_prop": 0.5122615803814714,
"repo_name": "neogenix/daikon",
"id": "4d4a504b3b70e34248a5ffb3e6f5aeaae57db3d7",
"size": "5133... |
"""Generating migration for a PRAW object
Revision ID: 960085fce39c
Revises: 4d46b88366fc
Create Date: 2016-06-13 17:30:49.056215
"""
# revision identifiers, used by Alembic.
revision = '960085fce39c'
down_revision = '4d46b88366fc'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as s... | {
"content_hash": "58ee9a8095c99c61959bcd378f17e82c",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 63,
"avg_line_length": 28.32941176470588,
"alnum_prop": 0.6611295681063123,
"repo_name": "c4fcm/CivilServant",
"id": "b232a77fa11a92f0c22876f94369e7164b1f764c",
"size": "24... |
import os.path
from getpass import getpass
from nexus import Client
# First instantiate a client object either with a dictionary or with a yaml file
pwd = os.path.dirname(__file__)
client = Client(config_file=os.path.join(pwd, 'sample.yml'))
# Generate a url for the end user to use to authorize this client/authenticat... | {
"content_hash": "eabb0569328251bada38ee2f7b7a4c57",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 85,
"avg_line_length": 39.89655172413793,
"alnum_prop": 0.7536732929991357,
"repo_name": "kbase/auth_service",
"id": "abba283c230317f05db5f6dff8e1a184a1d9528d",
"size": "11... |
import re
import sys
import traceback
import unittest
from robot.utils.asserts import assert_equal, assert_true, assert_raises
from robot.utils.error import get_error_details, get_error_message, ErrorDetails
def format_traceback():
return ''.join(traceback.format_exception(*sys.exc_info())).rstrip()
def format... | {
"content_hash": "36d6c7466a7a86378d8b6ea700e7ccbd",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 84,
"avg_line_length": 36.198113207547166,
"alnum_prop": 0.5830075579880115,
"repo_name": "HelioGuilherme66/robotframework",
"id": "38cad78c0588a724d061568fab302ffedcceb5e3"... |
import sys
import os
import time
import datetime
import TestHelper
import re
from tempfile import gettempdir
from OSEHRAHelper import PROMPT
introText = """**************************************************
* Welcome to VistA
**************************************************
*
* Use the following credentials... | {
"content_hash": "1f4fa3cf06831cce75a38981d41935c9",
"timestamp": "",
"source": "github",
"line_count": 1704,
"max_line_length": 444,
"avg_line_length": 31.916079812206572,
"alnum_prop": 0.6617081915969477,
"repo_name": "josephsnyder/VistA",
"id": "0c3f64766ad70abc8b220dba86810f69ba15e8b2",
"size":... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class UpdatePriceAndQuantity(Choreography):
def __init__(self, temboo_session):
"""
... | {
"content_hash": "693dd95608e3311fb544a35433da35be",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 212,
"avg_line_length": 50.567567567567565,
"alnum_prop": 0.6976661321931231,
"repo_name": "jordanemedlock/psychtruths",
"id": "83a3efe41edf87106d7a105c7ae96124d0626005",
... |
'''
Integration Test for public network down in management network separated and recover.
@author: SyZhao
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.node_operations as no... | {
"content_hash": "4e073cac0ce3203a7e380fc4901fe433",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 150,
"avg_line_length": 39.915789473684214,
"alnum_prop": 0.6703586497890295,
"repo_name": "zstackorg/zstack-woodpecker",
"id": "563d2acc84d08b86383e92bed9ace438f0240d60",
... |
from django.shortcuts import render
def index(request, pageData):
return render(request, 'index.html', pageData)
def orders(request, pageData):
return render(request, 'orders.html', pageData)
def orderers(request, pageData):
return render(request, 'orderers.html', pageData)
def products(request, pageD... | {
"content_hash": "8757bfee5bcc60627c2666d324f379c0",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 53,
"avg_line_length": 29.4375,
"alnum_prop": 0.7473460721868365,
"repo_name": "sanchaez/python_labs",
"id": "eace6681b3c66ed44c23adca56752a8623ba92d4",
"size": "471",
"b... |
from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register
from bvspca.animals.models import Animal
class AnimalModelAdmin(ModelAdmin):
model = Animal
menu_label = 'Animals'
menu_icon = 'fa-paw'
menu_order = 100
add_to_settings_menu = False
list_display = ('title', 'petpoi... | {
"content_hash": "9647d3dfe6806c7dc2ecaf0a61d1365a",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 79,
"avg_line_length": 31.263157894736842,
"alnum_prop": 0.6818181818181818,
"repo_name": "nfletton/bvspca",
"id": "e0a9217332472ebbfe59a3bc0f4f55caf37de6ce",
"size": "594"... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import hypothesis.strategies as st
from hypothesis import given, settings
import numpy as np
from caffe2.python import core, workspace
import caffe2.pytho... | {
"content_hash": "fc2cea6ebb024db7d2e0dd36d37a9be1",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 81,
"avg_line_length": 36.95061728395062,
"alnum_prop": 0.5766789174741063,
"repo_name": "bwasti/caffe2",
"id": "9c91ee0a34234eadf1254d3e10d2fb3ace13c14b",
"size": "2993",
... |
from interaction import *
from optimization import *
from sketch import *
from visualization import *
from connectorBehavior import *
import regionToolset
session.journalOptions.setValues(replayGeometry=COORDINATE,recoverGeometry=COORDINATE)
beamLength=4.0
cLoad=10000 #only refers to scale
#------------------------... | {
"content_hash": "04b69a465f9555e39686eb9fb1ce8369",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 134,
"avg_line_length": 32.077669902912625,
"alnum_prop": 0.6613196125907991,
"repo_name": "zjkl19/AbaqusPython",
"id": "45fc387e780c912036456ae686c28b4f19702e6d",
"size":... |
from flask import url_for
from flask.ext.testing import TestCase
from webapp import app, db
from webapp.models import Monkey, Friendship, BestFriend
from config import HEROKU_POSTGRESQL_CHARCOAL_URL
def setup_module():
app.config['SQLALCHEMY_DATABASE_URI'] = HEROKU_POSTGRESQL_CHARCOAL_URL
app.config['WTF_CSR... | {
"content_hash": "cef997cb50ce7bf4a6de3c3504a40f14",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 77,
"avg_line_length": 40.429906542056074,
"alnum_prop": 0.5570966250577901,
"repo_name": "Sajjadhosn/web-app-monkey",
"id": "7382c7b12baff31286e473ec01414571d9a9f4e5",
"s... |
from __future__ import absolute_import, division, print_function, unicode_literals
import six
from azure.mgmt.eventgrid.models import EventSubscription, EventSubscriptionFilter
from c7n_azure.session import Session
from c7n.utils import local_session
class AzureEvents(object):
"""A mapping of resource types to ... | {
"content_hash": "f2995611940eb06451ad85b4157e903f",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 97,
"avg_line_length": 31.964028776978417,
"alnum_prop": 0.5838397479180734,
"repo_name": "kapilt/cloud-custodian",
"id": "abeecf3707c566b7365274bcc33edb3f57c84f26",
"size... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('climatemodels', '0066_auto_20170120_1625'),
]
operations = [
migrations.AlterField(
model_name='impactmodel',
name='responsi... | {
"content_hash": "2abf0cbce1d8796ab088a97713064fce",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 259,
"avg_line_length": 33.888888888888886,
"alnum_prop": 0.6836065573770492,
"repo_name": "bruecksen/isimip",
"id": "6f4191bf22a1f53b17f1101f6fa3e7d60d4c40e2",
"size": "68... |
from ..util import TestConfig
from biokbase.workspace.baseclient import ServerError
class MockClients:
"""
Mock KBase service clients as needed for Narrative backend tests.
Use this with the Python mock library to mock the biokbase.narrative.clients.get call
as a test function decorator, like this:
... | {
"content_hash": "51313d707c085a17e51b4b6f39d7b98e",
"timestamp": "",
"source": "github",
"line_count": 328,
"max_line_length": 162,
"avg_line_length": 38.3109756097561,
"alnum_prop": 0.5380391532707306,
"repo_name": "pranjan77/narrative",
"id": "09d1bdf465e3a61434af60e00283b443a51bf79e",
"size": "... |
"""
Created on Thur Apr 20 13:56:10 2017
@author: richard.mathie@amey.co.uk
"""
class MailGunException(Exception):
pass
| {
"content_hash": "e7594ce9ad27cc0ec9b4f801cfeab700",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 36,
"avg_line_length": 14.11111111111111,
"alnum_prop": 0.7007874015748031,
"repo_name": "amey-sam/Flask-MailGun",
"id": "50de4d0321e07abdc4e3d0978b3b4e1fb7021898",
"size": ... |
from flask import Flask, jsonify
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from flask_jwt import JWT, jwt_required
from models import Users, Contacts
from flask import request, Response
from sqlalchemy.exc import IntegrityError
from sqlalche... | {
"content_hash": "9aab3044675ae24cffefd8380867de2a",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 108,
"avg_line_length": 31.11891891891892,
"alnum_prop": 0.5893694632621157,
"repo_name": "Sergey010289/Address_book_flask",
"id": "108d0ec12fb24207a3b5f47d6eabf0a94a4ca070"... |
StreamSubscriptions = {}
| {
"content_hash": "3651643a95890a7afba803c03adc1668",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 24,
"avg_line_length": 14,
"alnum_prop": 0.6785714285714286,
"repo_name": "AlexPereverzyev/html5stream",
"id": "a811ff8be255af1201f99d702898e4ce720831ac",
"size": "28",
"b... |
import argparse
import pprint
from pathlib import Path
from git import Git
from PIL import Image, ImageDraw
# Bold Farmhouse https://www.color-hex.com/color-palette/104687
PALETTE = ["#830015", "#000068", "#8fb178", "#f2e8cf", "#ae976d"]
# Dull Shell https://www.color-hex.com/color-palette/104668
# PALETTE = ["#dfb2... | {
"content_hash": "a93a14a202d35ececf2592c2dabfa6b6",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 83,
"avg_line_length": 24.13013698630137,
"alnum_prop": 0.5642917967641214,
"repo_name": "johntellsall/shotglass",
"id": "bcc8b9814c0ba60e3878d70b2ba1abef88fd59bc",
"size"... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Employee.image'
db.add_column(u'employee_employee', 'image',
... | {
"content_hash": "afd466d7af4083366cbc86ef881a58d0",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 126,
"avg_line_length": 58.166666666666664,
"alnum_prop": 0.55396370582617,
"repo_name": "asm-technologies/management",
"id": "debc9969d33d47dac2fdd7d400e39a9680620ff5",
"s... |
from py2neo import Graph
graph = Graph()
def buildNodes(aNodeRecord):
data = {"id": aNodeRecord.n._id}
data.update(aNodeRecord.n.properties)
return {"data": data}
def buildRelations(aRelationRecord):
data = {"source": aRelationRecord.r.start_node._id, "target": aRelationRecord.r.end_node._id}
def ... | {
"content_hash": "95b5e47e47d52f5caa3df1c6648eb030",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 117,
"avg_line_length": 28.34375,
"alnum_prop": 0.659316427783903,
"repo_name": "zhongzhu/cytoscape_py2neo",
"id": "3e62e4023124a603704e36d660508a9ebd9451fe",
"size": "907"... |
import json
from contextlib import contextmanager
import mock
import os
import random
import tempfile
import unittest
import shutil
import copy
import time
from collections import defaultdict, Counter
from swift.common.exceptions import RingBuilderError
from swift.common.ring import RingBuilder, Ring
from swift.comm... | {
"content_hash": "272d01741d3b5fe4bc0bd804dce8e387",
"timestamp": "",
"source": "github",
"line_count": 1295,
"max_line_length": 79,
"avg_line_length": 44.186100386100385,
"alnum_prop": 0.610545079603642,
"repo_name": "nadeemsyed/swift",
"id": "9e952611f550c50d4628ecca8d8f6745efbc340f",
"size": "57... |
from __future__ import unicode_literals
from builtins import object
import logging
class BaseConfig(object):
""" Base class for all configuration objects """
defaults = {}
search_path = ['config']
def __init__(self, config=None):
if config is None:
self.config = {}
else:
... | {
"content_hash": "23b38758e8c209d4d4ae7f9842bc044b",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 76,
"avg_line_length": 28.037735849056602,
"alnum_prop": 0.5114401076716016,
"repo_name": "e02d96ec16/CumulusCI",
"id": "ca63037c8c1c32226082ea7cb61f58a799320f07",
"size": ... |
a = 2. # parameter
s = np.random.zipf(a, 1000)
# Display the histogram of the samples, along with
# the probability density function:
import matplotlib.pyplot as plt
import scipy.special as sps
# Truncate s values at 50 so plot is interesting
count, bins, ignored = plt.hist(s[s<50], 50, normed=True)
x = np.arange(1.,... | {
"content_hash": "6850dbfbb906b3faea41200673ed83c2",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 57,
"avg_line_length": 29.142857142857142,
"alnum_prop": 0.6985294117647058,
"repo_name": "leesavide/pythonista-docs",
"id": "bd6c5db2e433d86fc87ac8094b1c165f6b63131f",
"si... |
import argparse
import os
from six.moves import configparser
import sys
from launchpadlib import launchpad
from gerrit_dash_creator.cmd import creator
CACHE_DIR = os.path.expanduser('~/.cache/launchpadlib/')
SERVICE_ROOT = 'production'
def print_dash_url(projects, bugs):
config = configparser.ConfigParser()
... | {
"content_hash": "306e6bec2f6f347bf40a852a19df6361",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 67,
"avg_line_length": 30.763779527559056,
"alnum_prop": 0.5446634246224725,
"repo_name": "asalkeld/review-bugs",
"id": "6e43cbdec3364cdcc36ee2054e356bfe460a2bab",
"size":... |
class Solution:
def guessNumber(self, n: int) -> int:
if n < 1: return 0 # unexpected
left, right = 1, n
while left <= right:
mid = (left + right) // 2 # mid number
is_picked = guess(mid)
if is_picked == 0:
return mid
elif is_pi... | {
"content_hash": "8ecf2e874dbcf27f50659afd221b52b7",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 50,
"avg_line_length": 32.375,
"alnum_prop": 0.4266409266409266,
"repo_name": "tanchao/algo",
"id": "dad32d37a41b551828b468371268ca5a6e5fbcd8",
"size": "698",
"binary": f... |
"""
Tests the fugato app
"""
##########################################################################
## Imports
##########################################################################
from unittest import skip
from fugato.models import *
from voting.models import *
from stream.signals import stream
from stream.... | {
"content_hash": "4ccdaa055066904cb66482f0b6cf877b",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 105,
"avg_line_length": 35.49751243781095,
"alnum_prop": 0.5906797477224948,
"repo_name": "DistrictDataLabs/minimum-entropy",
"id": "3f0c632c674304a14a5c1077e5fbc16a33b02106... |
import os
import sys
#Experiment Variables
eiger1 = "104.236.140.240"
eiger2 = "188.226.251.145"
eiger3 = "104.236.191.32"
eiger4 = "192.241.215.97"
eiger5 = "104.236.152.144"
DC0 = [eiger1,eiger3,eiger4,eiger5] #add nodes here
DC1 = [eiger2]
NODES = DC0 + DC1
ALL_NODES = [eiger1,eiger2,eiger3,eiger4,eiger5]
VAL_SIZ... | {
"content_hash": "52443e843f016753c42b9b42b2bb07f4",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 384,
"avg_line_length": 37.961832061068705,
"alnum_prop": 0.6016489040820431,
"repo_name": "tadeegan/eiger-application-aware",
"id": "469902d464a7cabbabcb63b4ef90d21188f3bec... |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.template import Context
_mail_context_processors = None
# This is a function rather than module-level procedural code because we only
# want it to execute if somebody uses MailContext.
def get_mail_processors():
g... | {
"content_hash": "b4e5b38c8c7e2697ee3eb5887df89d20",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 125,
"avg_line_length": 38.07017543859649,
"alnum_prop": 0.6248847926267281,
"repo_name": "arneb/django-campaign",
"id": "a8c982a20f46a178e9f2948088724ea80e3d8678",
"size":... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0005_auto_20170323_1743'),
]
operations = [
migrations.AlterField(
model_name='comment',
... | {
"content_hash": "a057c8de4cae5c08c1eea153c6dd8be7",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 135,
"avg_line_length": 29.833333333333332,
"alnum_prop": 0.6201117318435754,
"repo_name": "frostblooded/kanq",
"id": "b32c28c415ebf781bb05e71f418ea90cd5462a7b",
"size": "7... |
"""
Generates a new configuration file for use with Astrometrica
"""
from astropy.io import fits
import os
import astrogen
import pyfits
import sys
__pkg_root__ = os.path.dirname(__file__)
__resources_dir__ = os.path.join(__pkg_root__, os.pardir, 'resources')
__batch_dir__ = os.path.join(__resources_dir__, 'fits_files... | {
"content_hash": "528286059b4cf55dce8c88babbda6eb7",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 91,
"avg_line_length": 35.34188034188034,
"alnum_prop": 0.5823458282950423,
"repo_name": "aesoll/astrogen",
"id": "6518783a14e4e19850bc76fe0d7979935cccdb3d",
"size": "4433... |
import json
import logging
import sys
import time
from telemetry.core import util
class InspectorPage(object):
def __init__(self, inspector_backend, timeout=60):
self._inspector_backend = inspector_backend
self._inspector_backend.RegisterDomain(
'Page',
self._OnNotification,
self._On... | {
"content_hash": "86123529f91b31d157956c976a01c1ac",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 80,
"avg_line_length": 36.24812030075188,
"alnum_prop": 0.6403235843186061,
"repo_name": "patrickm/chromium.src",
"id": "2874268caef4c93e983778c32cacaf0b098c164b",
"size":... |
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Rss201rev2Feed
from wagtail.wagtailimages.models import Filter
from wagtail.wagtailcore.models import Site
from django.conf import settings
from datetime import datetime, time
from django.utils.html import strip_tags
from django.ap... | {
"content_hash": "9bd1b5ab61d3b0705050906d0103e027",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 78,
"avg_line_length": 34.02173913043478,
"alnum_prop": 0.6585729499467519,
"repo_name": "DonaldTrumpHasTinyHands/tiny_hands_pac",
"id": "b75f0fb748a96251739cd3de2c2feaa1eba... |
import os
import shutil
import textwrap
from ..util.compat import u, has_pep3147, get_current_bytecode_suffixes
from ..script import Script, ScriptDirectory
from .. import util
from . import engines
from . import provision
def _get_staging_directory():
if provision.FOLLOWER_IDENT:
return "scratch_%s" % p... | {
"content_hash": "15f3991cc716da4e4d3620dc184fb916",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 78,
"avg_line_length": 22.614754098360656,
"alnum_prop": 0.6266763320043494,
"repo_name": "Widiot/simpleblog",
"id": "7e328fda306c0b8f913d499b7b714861c93fcd9a",
"size": "8... |
from collections import Sequence # noqa
import logging
from django.conf import settings
from horizon import exceptions
import six
__all__ = ('APIResourceWrapper', 'APIDictWrapper',
'get_service_from_catalog', 'url_for',)
LOG = logging.getLogger(__name__)
class APIVersionManager(object):
"""Obje... | {
"content_hash": "19903e8d79e6c240b43f783174bbe7ea",
"timestamp": "",
"source": "github",
"line_count": 339,
"max_line_length": 79,
"avg_line_length": 33.43952802359882,
"alnum_prop": 0.5845977417078334,
"repo_name": "melon-li/openstack-dashboard",
"id": "d08b016aae430f5760325b84518ffa12971c1e52",
... |
from moto.core import BaseBackend
import boto.logs
from moto.core.utils import unix_time_millis
from .exceptions import (
ResourceNotFoundException,
ResourceAlreadyExistsException
)
class LogEvent:
_event_id = 0
def __init__(self, ingestion_time, log_event):
self.ingestionTime = ingestion_tim... | {
"content_hash": "4d35bfe359e671a7941c5c09da616a20",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 150,
"avg_line_length": 40.86986301369863,
"alnum_prop": 0.6344896933132227,
"repo_name": "botify-labs/moto",
"id": "a4ff9db46114fb53fa9694f1b7058d32e555b230",
"size": "11... |
from .mcpp_lib import * | {
"content_hash": "5a2e8c3a4e71d92b6441c51b517c0e10",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 23,
"avg_line_length": 23,
"alnum_prop": 0.7391304347826086,
"repo_name": "filonik/clibs",
"id": "c64b6d4e039ded4eaf38c81f4d7fad092ca869cd",
"size": "23",
"binary": false,... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = """
---
module: netapp_e_snapshot_group
short_description: NetApp E-Series ... | {
"content_hash": "c0fa840c8040667706a780ff26f143d7",
"timestamp": "",
"source": "github",
"line_count": 365,
"max_line_length": 145,
"avg_line_length": 39.69315068493151,
"alnum_prop": 0.5584621755935947,
"repo_name": "SergeyCherepanov/ansible",
"id": "0b678fe818c09758bda0a479e8e43d6b1045fe35",
"si... |
from project import db
import datetime
class Movie(db.Document):
created = db.DateTimeField(default=datetime.datetime.now, required=True)
title = db.StringField(max_length=255, required=True)
summary = db.StringField(max_length=10000, required=True)
tags = db.ListField(db.StringField(max_length=50))
cast = db.Lis... | {
"content_hash": "816d1151317aa3ccbf42a4deb0ad17f2",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 147,
"avg_line_length": 28.420289855072465,
"alnum_prop": 0.6925038245792963,
"repo_name": "ndbills/MyMovieLibrary",
"id": "08ab6b4bcf6271c8afb9c8d9e038e1e9f71987ac",
"size... |
import time
import copy
import numpy as np
from .. import pick_channels
from ..utils import logger, verbose
from ..epochs import _BaseEpochs
from ..event import _find_events
from ..io.proj import setup_proj
class RtEpochs(_BaseEpochs):
"""Realtime Epochs
Can receive epochs in real time from an RtClient.
... | {
"content_hash": "6efc4f7ece87f5f1e2e1ffe82dc955ff",
"timestamp": "",
"source": "github",
"line_count": 420,
"max_line_length": 79,
"avg_line_length": 39.266666666666666,
"alnum_prop": 0.5750060635459617,
"repo_name": "Odingod/mne-python",
"id": "acec512083c66aabb2cc91288b7111d134587deb",
"size": "... |
from datetime import datetime
import orm
from scheduler_service import pg_db
from . import metadata
from .mixin import CRUDMixin
class Task(orm.Model, CRUDMixin):
__tablename__ = 'task'
__metadata__ = metadata
__database__ = pg_db
id = orm.Integer(primary_key=True)
name = orm.String(max_length=... | {
"content_hash": "181c137574a004fd772b431c989db5a1",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 54,
"avg_line_length": 24.081632653061224,
"alnum_prop": 0.6161016949152542,
"repo_name": "moonlitlaputa/scheduler-service",
"id": "8154b5472ef14bdefd2127813b64842d839e2682",... |
"""
Copyright 2016-present Tony Peng
Implementation of the papers "Perceptual Losses for Real-Time Style Transfer and Super-Resolution"
by Justin Johnson, Alexandre Alahi, and Li Fei-Fei and "A Neural Algorithm of Artistic Style"
by Leon Gatys, Alexander S Ecker, and Matthias Bethge.
"""
import nets
import numpy as n... | {
"content_hash": "c3d67f611e20fb91a57bf688eb5898ac",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 148,
"avg_line_length": 38.23728813559322,
"alnum_prop": 0.6323877068557919,
"repo_name": "tonypeng/tensorstyle",
"id": "b4e6ab7bd5faf76321f0b2699244e51a7d87b956",
"size":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.