text stringlengths 4 1.02M | meta dict |
|---|---|
"""
Model admin
"""
from django.contrib import admin
from models import *
class ChannelAdmin(admin.ModelAdmin):
list_display = ('slug', 'title', 'created')
ordering = ('-created',)
class UserPreferencesAdmin(admin.ModelAdmin):
list_display = ('owner', 'created')
list_filter = ('created',)
class Filte... | {
"content_hash": "54cca1d93ca46910cfc8177f286da7f6",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 88,
"avg_line_length": 32.69444444444444,
"alnum_prop": 0.6788445199660152,
"repo_name": "sveetch/djangotribune",
"id": "161473fecd59e969ef81f3e59f986fc26c16dbd0",
"size": ... |
import numpy as np
import os
import datashape as ds
import pytest
from toolz import first
from blaze import into
from blaze.utils import tmpfile
from blaze.compatibility import xfail
from blaze import PyTables, discover
import pandas as pd
tb = pytest.importorskip('tables')
try:
f = pd.HDFStore('foo')
except (... | {
"content_hash": "44c39720e64e28006afeda57b3d54487",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 85,
"avg_line_length": 31.100591715976332,
"alnum_prop": 0.5325342465753424,
"repo_name": "mrocklin/blaze",
"id": "8f8c557c9a46230728869583390dafb38089e7c7",
"size": "5256... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_rebel_colonel_sullustan_male_01.iff"
result.attribute_template_id = 9
result.stfName("npc_name","sullustan_base_male")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return res... | {
"content_hash": "dc3223d81aef51f40a20ca185327ef88",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 85,
"avg_line_length": 24.846153846153847,
"alnum_prop": 0.7058823529411765,
"repo_name": "anhstudios/swganh",
"id": "889209d9e9e93af01aac2b24f85f51057d0eb357",
"size": "46... |
import ROOT
import numpy as np
def makeMomentMorph(w,interpParam, observable, pdfList, paramPoints):
paramVec = ROOT.TVectorD(len(paramPoints))
for i, p in enumerate(paramPoints):
paramVec[i]=p #seems silly, but other constructor gave problems
pdfs = ROOT.RooArgList()
for pdf in pdfList:
pdfs.add(pdf)
setti... | {
"content_hash": "23e717507d7e3b9e25fec2d8ddfc1505",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 90,
"avg_line_length": 31.155963302752294,
"alnum_prop": 0.7058303886925795,
"repo_name": "cranmer/parametrized-learning",
"id": "c32b6035d375bbb3eec31249b136218cf0b15560",
... |
def get_kv_shape(shape, key_axes):
func = lambda axis: shape[axis]
return _get_kv_func(func, shape, key_axes)
def get_kv_axes(shape, key_axes):
func = lambda axis: axis
return _get_kv_func(func, shape, key_axes)
def _get_kv_func(func, shape, key_axes):
key_res = [func(axis) for axis in key_axes]
... | {
"content_hash": "b77c9074b3d4dca3dfbd95bb641979c1",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 82,
"avg_line_length": 31.29032258064516,
"alnum_prop": 0.6103092783505155,
"repo_name": "andrewosh/bolt",
"id": "c006dd2012a0246d7a73febdd13b9a0d62a84112",
"size": "970",
... |
from replay import _ZERO_PROPERTIES
from report import _WEAPON_NAMES, _WEAPONS
from nicklog import load_timelines
from utils import Toggler, googlechart_url
import os
from math import log
_LOG_SUM_PROPERTIES = _ZERO_PROPERTIES[:]
_LOG_MAX_PROPERTIES = "kill_streak death_streak cap_streak chat_length".split(" ")
for p... | {
"content_hash": "d8eb68493c830154f7f64f2f991ba57c",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 105,
"avg_line_length": 33.41422594142259,
"alnum_prop": 0.635236664162284,
"repo_name": "qznc/arenastats",
"id": "c027864eaa8998403d88b0275254f356de9f3fb5",
"size": "7986... |
import datetime
import logging
import os
from itertools import groupby
from math import ceil
from django.db.models import Max
from django.db.models import Sum
from le_utils.constants import content_kinds
from sqlalchemy import and_
from sqlalchemy import case
from sqlalchemy import cast
from sqlalchemy import exists
f... | {
"content_hash": "5f0db5fe45f56635c68cb2bebb81ae82",
"timestamp": "",
"source": "github",
"line_count": 891,
"max_line_length": 123,
"avg_line_length": 36.101010101010104,
"alnum_prop": 0.6203133743704533,
"repo_name": "learningequality/kolibri",
"id": "fe901df9240a026689c39782edcd6f3bfb879252",
"s... |
import facenet
import numpy as np
import tensorflow as tf
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_integer('people_per_batch', 45,
"""Number of people per batch.""")
tf.app.flags.DEFINE_integer('alpha', 0.2,
"""Positive to negative triplet distance margin.... | {
"content_hash": "0bec32c1b372f46c3cfda7a0bef4c8bf",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 100,
"avg_line_length": 25.8,
"alnum_prop": 0.6447028423772609,
"repo_name": "lodemo/CATANA",
"id": "149e262b31a02ff7d9d6940990b8c5785eeb6b4f",
"size": "774",
"binary": f... |
from django.conf import settings
def viveum(request):
"""
Adds additional context variables to the default context.
"""
return {
'VIVEUM_ORDER_STANDARD_URL': settings.VIVEUM_PAYMENT.get('ORDER_STANDARD_URL'),
}
| {
"content_hash": "30f72ebf9e0eda471c723d0ccb259ec8",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 87,
"avg_line_length": 24.1,
"alnum_prop": 0.6680497925311203,
"repo_name": "philippeowagner/django-shop-viveum",
"id": "6c9805835ddae73e93ee89f1007492c83cf0f038",
"size": ... |
"""Agent implementing the server side of the AMQP management protocol.
Adapter layer between external attribute-value maps sent/received via the AMQP
management protocol and implementation objects (C or python) of the dispatch
router. Entity types are as described in qdrouter.json schema. Reading
configuration files i... | {
"content_hash": "ab0851d5b8d38bf2f6f1af799ac58ace",
"timestamp": "",
"source": "github",
"line_count": 941,
"max_line_length": 143,
"avg_line_length": 39.58023379383634,
"alnum_prop": 0.6205933682373473,
"repo_name": "dskarbek/qpid-dispatch",
"id": "7f50cb838ba65e84efd919fd445a0cf74dbcdcfd",
"size... |
"""
Datastore Model objects for Compute Instances, with
InstanceDirectory manager.
# Create a new instance?
>>> InstDir = InstanceDirectory()
>>> inst = InstDir.new()
>>> inst.destroy()
True
>>> inst = InstDir['i-123']
>>> inst['ip'] = "192.168.0.3"
>>> inst['project_id'] = "projectA"
>>> inst.save()
True
>>> InstDir... | {
"content_hash": "f5d6dba42da7c58b14fee68323562eb1",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 82,
"avg_line_length": 28.897435897435898,
"alnum_prop": 0.5811889973380656,
"repo_name": "jxta/cc",
"id": "2754e9e6d1627b235d4d20cc5ea20a586bdcf15b",
"size": "6289",
"b... |
from pdb import set_trace
from json import loads
from itertools import imap
from twitter_pb2 import *
tweets = Tweets()
with file('twitter.json', 'r') as f:
for line in imap(loads, f):
tweet = tweets.tweets.add()
tweet.is_delete = ('delete' in line)
if 'delete' in line:
status = line['delete']['sta... | {
"content_hash": "099a8bad2a8500a51d5b8a8563c4626d",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 62,
"avg_line_length": 34.06896551724138,
"alnum_prop": 0.6027327935222672,
"repo_name": "mitdbg/asciiclass",
"id": "7cf53d55fbfaf17834f1528f8b1bc9f2dacd4a0b",
"size": "215... |
import os
import asyncio # noqa: F401
import discord
import logging
from discord.ext import commands
from cogs.utils.dataIO import dataIO
from cogs.utils import checks
log = logging.getLogger('red.CrossQuote')
class CrossQuote:
"""
Cross server quote by message ID.
"""
__author__ = "mikeshardmind"
... | {
"content_hash": "85cec241adfc32a20fec99e517d152b8",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 79,
"avg_line_length": 39.41025641025641,
"alnum_prop": 0.5227716330513988,
"repo_name": "Garcia1008/tournament",
"id": "9be39d64050cf44698f6c8e1a7dc28930792d2da",
"size":... |
import numpy as np
import numpy.random
import matplotlib.pyplot as plt
import sys
import click
# Visualize a dotplot to compare two orderings of a list
# e.g. python scripts/scaffplot.py --inferred data/test/scaffolding.inferred.txt --actual data/test/scaffolding.key.txt --outpath data/test/test2.png
@click.command()... | {
"content_hash": "6cae9d0c4d9bdfe346ae521734b88b9f",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 149,
"avg_line_length": 28.306122448979593,
"alnum_prop": 0.6113914924297044,
"repo_name": "cb01/lxy",
"id": "aab8a50f1681e33d2aa92e14820ce7656ea7e312",
"size": "1387",
"... |
import pytest
from pandas.util._validators import (
validate_bool_kwarg,
validate_kwargs,
)
_fname = "func"
def test_bad_kwarg():
good_arg = "f"
bad_arg = good_arg + "o"
compat_args = {good_arg: "foo", bad_arg + "o": "bar"}
kwargs = {good_arg: "foo", bad_arg: "bar"}
msg = rf"{_fname}\(... | {
"content_hash": "a6da48a2831abac55dacb792358a2fd6",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 73,
"avg_line_length": 26.59090909090909,
"alnum_prop": 0.6045584045584046,
"repo_name": "pandas-dev/pandas",
"id": "de49cdd5e247d69671229e1813a7b15a1feb4286",
"size": "175... |
import numpy as np
import math
import time
from numba import autojit
# - Start Inner Loop - #
# - bbeta float
# - nGridCapital: int64
# - gridCapitalNextPeriod: int64
# - mOutput: float (17820 x 5)
# - nProductivity: int64
# - vGridCapital: fl... | {
"content_hash": "95f03151f0ce563573b1ed37fc219e5f",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 215,
"avg_line_length": 37.63358778625954,
"alnum_prop": 0.6350912778904665,
"repo_name": "lexu1upenn/Comparison-Programming-Languages-Economics",
"id": "ef3087da4b325c14ea4... |
from __future__ import unicode_literals
from django.db import models, migrations
def fill_years(apps, schema_editor):
AcademicYear = apps.get_model('schools', 'AcademicYear')
for year in AcademicYear.objects.all():
year.from_year, year.to_year = year.name.split('-')
year.save()
def empty_ye... | {
"content_hash": "87a4762fd6df5183287cf160f9c9602c",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 60,
"avg_line_length": 24.870967741935484,
"alnum_prop": 0.6199740596627756,
"repo_name": "klpdotorg/dubdubdub",
"id": "0e08b8d81580c2253880afd11bc904be9965fadc",
"size": "... |
__author__ = 'patelm'
import logging
import importlib
# key name that the PluginManager will use
DATASTORE_KEY = 'datastore'
DRIVER_KEY = 'driver'
RESOURCE_LOCATOR_KEY = 'resource-locator'
# There are the required methods for each plugin type.
# The PluginManager will check to make sure any plugin being loaded ha... | {
"content_hash": "1a2b6ac4ec8b8c67194e34f75f3b496a",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 103,
"avg_line_length": 33.39772727272727,
"alnum_prop": 0.6457978904389248,
"repo_name": "SMxJrz/Elasticd",
"id": "11090f1676d9f0706f908bb4e15e28adfa7fc6fe",
"size": "2939... |
import sys, os.path
from boto.s3.connection import S3Connection
from boto.s3.key import Key
import os
import mimetypes
import gzip
import tempfile
import shutil
from optparse import OptionParser
import re
from urllib import quote_plus
from urllib2 import urlopen
from s3config import S3CONFIG
excludes = r'|'.join([r'.*... | {
"content_hash": "689b854bd9041e0da0aee34087cbc31c",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 111,
"avg_line_length": 34.635416666666664,
"alnum_prop": 0.6369924812030076,
"repo_name": "newsapps/tarbell-0.8",
"id": "1698c1a8c2fbefb8478c8133be90d4a14f75f0f6",
"size":... |
from __future__ import absolute_import
import logging
import sys
import textwrap
from collections import OrderedDict
from pip.basecommand import Command, SUCCESS
from pip.download import PipXmlrpcTransport
from pip.models import PyPI
from pip.utils import get_terminal_size
from pip.utils.logging import indent_log
fr... | {
"content_hash": "83b7cbabca7e1fe5221a9d73bc5565cf",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 78,
"avg_line_length": 33.61194029850746,
"alnum_prop": 0.5825932504440497,
"repo_name": "fiber-space/pip",
"id": "a9cf8c93218e903da88bcb7c76d11dcfc30ed349",
"size": "4504... |
import io
import pytest
from freezegun import freeze_time
from FireEyeCM import *
from test_data.result_constants import QUARANTINED_EMAILS_CONTEXT, GET_ALERTS_CONTEXT, GET_ALERTS_DETAILS_CONTEXT, \
GET_ARTIFACTS_METADATA_CONTEXT, GET_EVENTS_CONTEXT
def util_load_json(path):
with io.open(path, mode='r', enc... | {
"content_hash": "f68e92930833da2cc678c8205590a962",
"timestamp": "",
"source": "github",
"line_count": 408,
"max_line_length": 118,
"avg_line_length": 41.5735294117647,
"alnum_prop": 0.633769602641198,
"repo_name": "VirusTotal/content",
"id": "8e7350da10a1e1757259909fed04f6deb09f4e37",
"size": "16... |
"""
Tests for L{nevow._flat}.
"""
import sys, traceback
from zope.interface import implements
from twisted.trial.unittest import TestCase
from twisted.internet.defer import Deferred, succeed
from nevow.inevow import IRequest, IQ, IRenderable, IData
from nevow._flat import FlattenerError, UnsupportedType, UnfilledSl... | {
"content_hash": "dafe53b03e5ad03fa62b738a0b5b67db",
"timestamp": "",
"source": "github",
"line_count": 1348,
"max_line_length": 90,
"avg_line_length": 34.76706231454006,
"alnum_prop": 0.5997524858106089,
"repo_name": "perkinslr/pypyjs",
"id": "c3e42d1d886d078061ca14c9ad3780f129327ca1",
"size": "46... |
from django.conf.urls import patterns, url
from .views import LogView
urlpatterns = patterns(
'',
url(r'^', LogView.as_view()),
)
| {
"content_hash": "6d407507513cf6e19c58db65f18dbb69",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 42,
"avg_line_length": 17.5,
"alnum_prop": 0.6642857142857143,
"repo_name": "wq/offline-website-logger",
"id": "6e8d36ba2fa3dac109614548221cf8ebc67e04cd",
"size": "140",
"... |
import ctypes
import platform
ES_CONTINUOUS = 0x80000000
ES_SYSTEM_REQUIRED = 0x00000001
def _set_thread_execution(state):
ctypes.windll.kernel32.SetThreadExecutionState(state)
def prevent_standby():
if platform.system() == 'Windows':
_set_thread_execution(ES_CONTINUOUS | ES_SYSTEM_R... | {
"content_hash": "56e91604d0048a9a1ab91b47d89588cf",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 65,
"avg_line_length": 21.96551724137931,
"alnum_prop": 0.6389324960753532,
"repo_name": "kbarnes3/MKVtoMP4",
"id": "3fa06fd0d2ac0a6172dc917a50c0de8dde0a7e22",
"size": "875... |
"""
werkzeug.security
~~~~~~~~~~~~~~~~~
Security related helpers such as secure password hashing tools.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import os
import hmac
import hashlib
import posixpath
impor... | {
"content_hash": "cda12d37af793a37dcd7b1a96024e78f",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 79,
"avg_line_length": 35.01901140684411,
"alnum_prop": 0.6116178067318132,
"repo_name": "maxhawkins/random_diet_club",
"id": "b0f304e0daeff85efcc8ac59bf4454927b89cb71",
"... |
import os
import shutil
import time
from threading import Thread
import yaml
from traits.api import TraitError, Float, provides, Str
from pychron.core.progress import open_progress
from pychron.core.yaml import yload
from pychron.furnace.base_furnace_manager import BaseFurnaceManager
from pychron.furnace.configure_du... | {
"content_hash": "8182096967a054a2a2827ab1f8b0343d",
"timestamp": "",
"source": "github",
"line_count": 383,
"max_line_length": 92,
"avg_line_length": 31.715404699738905,
"alnum_prop": 0.5824483411541944,
"repo_name": "USGSDenverPychron/pychron",
"id": "610331e31d229553429893fa41a18f3905b407e6",
"s... |
__all__ = (
'drizzle',
'firebird',
'mssql',
'mysql',
'oracle',
'postgresql',
'sqlite',
'sybase',
)
from .. import util
def _auto_fn(name):
"""default dialect importer.
plugs into the :class:`.PluginLoader`
as a first-hit system.
"""
if "." in name:
dia... | {
"content_hash": "21d9596ebf42375e92b2a0dd3e6871ee",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 76,
"avg_line_length": 20.763157894736842,
"alnum_prop": 0.5665399239543726,
"repo_name": "FRC-Team-3140/north-american-happiness",
"id": "974d4f787567321707589687beee71e48ff... |
from __future__ import unicode_literals
"""
Example sentences to test spaCy and its language models.
>>> from spacy.lang.pt.examples import sentences
>>> docs = nlp.pipe(sentences)
"""
sentences = [
"Apple está querendo comprar uma startup do Reino Unido por 100 milhões de dólares",
"Carros autônomos empur... | {
"content_hash": "dbfbb07d788fcd3e41339423468c4c9e",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 88,
"avg_line_length": 29.705882352941178,
"alnum_prop": 0.7386138613861386,
"repo_name": "recognai/spaCy",
"id": "239929215c1166ede8aed6d7bc0be17bde9e805f",
"size": "528",... |
"""Constants used by Home Assistant components."""
__version__ = "0.25.0.dev0"
REQUIRED_PYTHON_VER = (3, 4)
PLATFORM_FORMAT = '{}.{}'
# Can be used to specify a catch all when registering state or event listeners.
MATCH_ALL = '*'
# If no name is specified
DEVICE_DEFAULT_NAME = "Unnamed Device"
WEEKDAYS = ['mon', '... | {
"content_hash": "6cbbab8c738bbeba4cb054c6bd9b379a",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 79,
"avg_line_length": 27.84081632653061,
"alnum_prop": 0.7240873772174168,
"repo_name": "devdelay/home-assistant",
"id": "5d745765fb74976bfdad4660ab17c2977a616272",
"size... |
"""
Invoice views for gunclub
"""
import datetime
from django.core.mail import EmailMessage
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.a... | {
"content_hash": "49c7b4408c375a6b701cd6df4b940cde",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 81,
"avg_line_length": 37.49193548387097,
"alnum_prop": 0.6283071628307163,
"repo_name": "wiliamsouza/gunclub",
"id": "543876cca1ab7b7b65249fa6765c524e161fd8bc",
"size": "... |
"""
Description:
* An interface is defined for creating an object.
* Comparing to simple factory, subclasses decide which class is instantiated.
@author: Paul Bodean
@date: 12/08/2017
"""
from abc import ABCMeta, abstractmethod
from typing import Union
from selenium.webdriver import Chrome, Firefox
from src.factory.p... | {
"content_hash": "f8c44bd479da22554d6662a0a8eb4c58",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 113,
"avg_line_length": 22.70063694267516,
"alnum_prop": 0.5735129068462402,
"repo_name": "paulbodean88/automation-design-patterns",
"id": "cef3a4b7096fb1111903237bca3840746... |
"""
kombu.entity
================
Exchange and Queue declarations.
"""
from __future__ import absolute_import
from .abstract import MaybeChannelBound
from .exceptions import ContentDisallowed
from .serialization import prepare_accept_content
TRANSIENT_DELIVERY_MODE = 1
PERSISTENT_DELIVERY_MODE = 2
DELIVERY_MODES = ... | {
"content_hash": "7c90a183878c24f39815c17b2404b698",
"timestamp": "",
"source": "github",
"line_count": 716,
"max_line_length": 78,
"avg_line_length": 36.710893854748605,
"alnum_prop": 0.5677002092448165,
"repo_name": "1stvamp/kombu",
"id": "5bf1470b9c8cf139ea2b455d2e934b1be7083aea",
"size": "26285... |
from django.test import TestCase, Client
from .models import BoardGame, EditorGame
class BoardGameTest(TestCase):
def test_create_a_board_game(self):
editor = EditorGame(name="Iello")
boardgame = BoardGame(name="Le village de tiercelieux", min_player=1,
max_player=18,... | {
"content_hash": "3b9cc5eb0a1bb9669cd2c61d8bc3579a",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 77,
"avg_line_length": 35.86666666666667,
"alnum_prop": 0.6394052044609665,
"repo_name": "fbentz/vedasboardgame",
"id": "ac19e586136c01323d4e1a97b7bf8198a2a7b63a",
"size": ... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('status', '0010_auto_20150216_1614'),
]
operations = [
migrations.AlterModelOptions(
name='incidentupdate',
options={'orderin... | {
"content_hash": "599539242e82c72edd6d4e79dea7f3aa",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 152,
"avg_line_length": 27.11764705882353,
"alnum_prop": 0.6247288503253796,
"repo_name": "darkpixel/statuspage",
"id": "5fae2ee5045dad4ddc48e27050dd71d0506a030d",
"size": ... |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | {
"content_hash": "bbe13ed143fe688578fae8a83a303747",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 110,
"avg_line_length": 40.26519337016575,
"alnum_prop": 0.5617453347969265,
"repo_name": "plaid/plaid-python",
"id": "c2ebfea54e04a8324ceb9049c4a2e8e8e7c724aa",
"size": "... |
"""Add Skipped enum value
Revision ID: 8b536bc5d716
Revises: 40c86deefd01
Create Date: 2020-04-27 12:12:47.075110
"""
# revision identifiers, used by Alembic.
revision = '8b536bc5d716'
down_revision = '40c86deefd01'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
from sqlalche... | {
"content_hash": "463f741d5f8f1310a6574e9eb8724f8f",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 65,
"avg_line_length": 25.88888888888889,
"alnum_prop": 0.7648068669527897,
"repo_name": "fake-name/ReadableWebProxy",
"id": "e6a21730a790b34aefe97bd8a1ada0ec691a6f72",
"si... |
from django.core.urlresolvers import reverse
from nose.tools import eq_
from pyquery import PyQuery as pq
import amo
import amo.tests
from amo.tests import app_factory
from mkt.developers.models import PreloadTestPlan
from mkt.operators.views import preloads
from mkt.site.fixtures import fixture
from mkt.users.models... | {
"content_hash": "9104b2e242c764efbf11d5f1ca015a1a",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 69,
"avg_line_length": 31.027027027027028,
"alnum_prop": 0.6567944250871081,
"repo_name": "andymckay/zamboni",
"id": "a3475beba89eaffbd659f5eff64cbd8afd542052",
"size": "11... |
"""Multiprocessing Pool test double"""
class MockTub(object):
"""Class to mock multiprocessing.Pool
"""
def __init__(self, main_worker, args):
"""Create a new instance"""
main_worker(*args)
def imap_unordered(self, func, iterable):
"""Map the func over the iterable"""
... | {
"content_hash": "6562276a853a835beb0d7f5d423d4702",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 45,
"avg_line_length": 22.347826086956523,
"alnum_prop": 0.5603112840466926,
"repo_name": "mapbox/rio-mucho",
"id": "e1d06d93e30d254d25fa11ed639529da50f5bcb1",
"size": "514... |
__doc__ = """Code by Benjamin S. Murphy
bscott.murphy@gmail.com
Dependencies:
numpy
Callable Methods:
write_asc_grid(X, Y, Z, filename='output.asc', style=1): Writes an MxN data grid
to an ASCII grid file (.*asc).
Inputs:
X (array-like, dim Nx1): X-coordinates of grid poi... | {
"content_hash": "c36248b79eb1960406d8d6721364b59b",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 96,
"avg_line_length": 42.394366197183096,
"alnum_prop": 0.5287929125138427,
"repo_name": "yejingxin/PyKrige",
"id": "acad63d548372b5a42eb24daccb31775ec789a12",
"size": "9... |
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/vehicle/component/shared_dx_disruptor_array.iff"
result.attribute_template_id = -1
result.stfName("string_id_table","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "73e1ce02229b5277a92b9dabd10a5a27",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 91,
"avg_line_length": 24.615384615384617,
"alnum_prop": 0.703125,
"repo_name": "anhstudios/swganh",
"id": "10abf685175c4c3bc01218fa4610df9038008443",
"size": "465",
"bin... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsight import HDInsightManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsight
# USAGE
python create_linux_hadoop_secure_hadoop.py
Before run the sample, please set the values of the client ID... | {
"content_hash": "d04463d0767d7a9fb14c622047f1920c",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 155,
"avg_line_length": 47.1171875,
"alnum_prop": 0.42099154369093017,
"repo_name": "Azure/azure-sdk-for-python",
"id": "02b7bdf5b50558837aa084a1ac8737a7fd6e0118",
"size":... |
import cv2
import numpy as np
import math
#Takes an image and returns an inverted blured (noise removed) binary image in its place
def biModalInvBlur(image):
#turns all pixels that are darker than 60 -> 255, all others 0
image1 = cv2.threshold(image, 60, 255, cv2.THRESH_BINARY_INV)
height, width = image.shape
... | {
"content_hash": "314c9de97ba7ad266157b54138ad5ee3",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 162,
"avg_line_length": 29.82857142857143,
"alnum_prop": 0.733955938697318,
"repo_name": "jodosh/MP4GS",
"id": "f63bcb0f2c6f3d16b62f63bbb004fd9d9021d3ca",
"size": "4176",
... |
from pathlib import Path
from textwrap import dedent
import pytest
from _pytest.config import UsageError
from _pytest.config.findpaths import get_common_ancestor
from _pytest.config.findpaths import get_dirs_from_args
from _pytest.config.findpaths import load_config_dict_from_file
class TestLoadConfigDictFromFile:
... | {
"content_hash": "00f63a7756f9d7d1d69ffb7e7bcb9408",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 101,
"avg_line_length": 39.84444444444444,
"alnum_prop": 0.5839375348577802,
"repo_name": "markshao/pytest",
"id": "3a2917261a255063b1c306e3b1a8c566e5b42325",
"size": "537... |
import sys
import os
import platform
import numpy as np
# -- add development version of flopy to system path
flopypath = os.path.join('..', '..')
if flopypath not in sys.path:
print 'Adding to sys.path: ', flopypath
sys.path.append(flopypath)
import flopy
import flopy.utils as fputl
spth = os.getcwd()
mnam... | {
"content_hash": "98712c2b29bb59b0838c9ad93fc149eb",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 139,
"avg_line_length": 23.166666666666668,
"alnum_prop": 0.6237410071942446,
"repo_name": "bdestombe/flopy-1",
"id": "6d2cb90414a39f0978c45784a71ccf4601a8648a",
"size": "1... |
import argparse
import openstack
import logging
import datetime
import time
DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
PAUSE_SECONDS = 5
log = logging.getLogger('openstack-cleanup')
parser = argparse.ArgumentParser(description='Cleanup OpenStack resources')
parser.add_argument('-v', '--verbose', action='store_true',
... | {
"content_hash": "4ca59c06d1006a9274eea7a4f515e52f",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 79,
"avg_line_length": 28.18421052631579,
"alnum_prop": 0.6265172735760971,
"repo_name": "kubernetes-incubator/kargo",
"id": "9bc24d3f3796432fbf2fb8e164be2a634407fdc1",
"si... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from sqlalchemy.orm import subqueryload
class ConnectorRegistry(object):
""" Central Registry for all available datasource engines"""
sources = {}
@classm... | {
"content_hash": "317e6977273989b4627db598ccf72661",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 78,
"avg_line_length": 37.23170731707317,
"alnum_prop": 0.6265967900425811,
"repo_name": "dmigo/incubator-superset",
"id": "efafcb441739cb8c006b236cc01e6637ea27932e",
"size... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('approvals', '0006_auto_20170612_1526'),
]
operations = [
migrations.AlterField(
model_name='approval',
name='app_type',
... | {
"content_hash": "80af64d448580e86b8c08c8851f3658e",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 332,
"avg_line_length": 37,
"alnum_prop": 0.5990990990990991,
"repo_name": "ropable/statdev",
"id": "c7258e0dc31bd3620013fe8c844b2f4c5e20f762",
"size": "739",
"binary": f... |
"""Generic interface for least-square minimization."""
from __future__ import division, print_function, absolute_import
from warnings import warn
import numpy as np
from numpy.linalg import norm
from scipy.sparse import issparse, csr_matrix
from scipy.sparse.linalg import LinearOperator
from scipy.optimize import _m... | {
"content_hash": "0ce2b5f82bc1cee5b87cdbf89f3d3d02",
"timestamp": "",
"source": "github",
"line_count": 901,
"max_line_length": 79,
"avg_line_length": 40.55049944506104,
"alnum_prop": 0.606880884606963,
"repo_name": "nonhermitian/scipy",
"id": "2c04e7532a6a4bff3ae261003540b669612fc416",
"size": "36... |
import unittest
from conans.test.tools import TestClient, TestServer
class UserTest(unittest.TestCase):
def test_command_user(self):
""" Test that the user can be shown and changed, and it is reflected in the
user cache localdb
"""
client = TestClient()
client.run('user')
... | {
"content_hash": "c4eb80d5683dedadd3da872bfa0da378",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 97,
"avg_line_length": 45.589473684210525,
"alnum_prop": 0.638420688062803,
"repo_name": "Xaltotun/conan",
"id": "a03e10696238433474a52bfdcb41c0cfad6e0a3a",
"size": "4331",... |
"""The superclass of all handlers."""
import base64
import cgi
import datetime
import json
import logging
import os
import re
import sys
import traceback
import urllib.parse
from flask import redirect as flask_redirect
from flask import request
from flask import Response
from flask.views import MethodView
from google... | {
"content_hash": "ae9776e6458d9a31031de468b66f25a7",
"timestamp": "",
"source": "github",
"line_count": 291,
"max_line_length": 77,
"avg_line_length": 30.584192439862544,
"alnum_prop": 0.6683146067415731,
"repo_name": "google/clusterfuzz",
"id": "1f1e4daf9432f33e7df018c6c0c52bb068b8acfb",
"size": "... |
"""Nova common internal object model"""
import collections
import copy
import functools
import netaddr
from oslo import messaging
import six
from nova import context
from nova import exception
from nova.objects import fields
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as lo... | {
"content_hash": "e773af6d4003922224befd695a700cb9",
"timestamp": "",
"source": "github",
"line_count": 609,
"max_line_length": 79,
"avg_line_length": 37.1559934318555,
"alnum_prop": 0.6057981262153085,
"repo_name": "nkrinner/nova",
"id": "c453fa011b7cf4e6276a4ee078d7e16aa12e7115",
"size": "23233",... |
import numpy as np
import sys
def build_parameter_grid( param_grid ) :
print "Building the parameter grid..."
import ast
return [ {k: ast.literal_eval(v) for k,v in param_grid.iteritems()} ]
def grid_search( pipeline, param_grid, X_train, y_train, X_test, y_test ) :
'''
|
| Execute a grid se... | {
"content_hash": "bc1cbf6fbdf2fbe96dd2e50654527277",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 75,
"avg_line_length": 33,
"alnum_prop": 0.6406060606060606,
"repo_name": "cavestruz/StrongCNN",
"id": "c77aadcd5970c79e4a37e3c1499d22b6d725eb16",
"size": "1650",
"binary... |
"""
LRU Cache for Image Data
"""
import hashlib
from oslo.config import cfg
from glance.common import exception
from glance.common import utils
from glance.openstack.common import importutils
import glance.openstack.common.log as logging
LOG = logging.getLogger(__name__)
image_cache_opts = [
cfg.StrOpt('image_... | {
"content_hash": "1d0368bb5b92141c547934f783e9ad4a",
"timestamp": "",
"source": "github",
"line_count": 309,
"max_line_length": 79,
"avg_line_length": 34.86407766990291,
"alnum_prop": 0.5748630836350135,
"repo_name": "ntt-sic/glance",
"id": "4f6188242e2d8b41e4915abf11b7621ac5039f30",
"size": "11448... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = """
---
module: cp_mgmt_time_facts
short_description: Get time objects fac... | {
"content_hash": "fa32789d20f26cf394728593dd2015db",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 141,
"avg_line_length": 29.813084112149532,
"alnum_prop": 0.6579937304075235,
"repo_name": "thaim/ansible",
"id": "119da09e583cbb400407147f8000489fa3a22fff",
"size": "3915... |
"""Runs the WebDriver Java acceptance tests.
This script is called from chrome/test/chromedriver/run_all_tests.py and reports
results using the buildbot annotation scheme.
For ChromeDriver documentation, refer to http://code.google.com/p/chromedriver.
"""
import optparse
import os
import shutil
import sys
import xml... | {
"content_hash": "d14890bab32a8b124c53bf76f40d0d8c",
"timestamp": "",
"source": "github",
"line_count": 329,
"max_line_length": 80,
"avg_line_length": 36.83586626139817,
"alnum_prop": 0.6309101411007508,
"repo_name": "was4444/chromium.src",
"id": "1caa8213fdf5175f5a8f01b25d2cc789c0b4243c",
"size": ... |
from msrest.serialization import Model
class OperationResult(Model):
_required = []
_attribute_map = {
'status': {'key': 'status', 'type': 'str'},
}
def __init__(self, *args, **kwargs):
"""OperationResult
:param str status: The status of the request. Possible values for thi... | {
"content_hash": "6c66fc5e23b5f4ba05022e416158e50b",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 78,
"avg_line_length": 26.772727272727273,
"alnum_prop": 0.5738539898132428,
"repo_name": "vulcansteel/autorest",
"id": "501cb16b59fa064001104dac6f09a582b925ee72",
"size": ... |
"""
Script to Summarize statistics in the scan-build output.
Statistics are enabled by passing '-internal-stats' option to scan-build
(or '-analyzer-stats' to the analyzer).
"""
import sys
if __name__ == '__main__':
if len(sys.argv) < 2:
print >> sys.stderr, 'Usage: ', sys.argv[0],\
... | {
"content_hash": "12a692b9c7ea992505730ea39ad276a4",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 76,
"avg_line_length": 36.44155844155844,
"alnum_prop": 0.5602280826799715,
"repo_name": "youtube/cobalt",
"id": "50e1cb854f4eaa1a3ac14f5c524ff838282e927f",
"size": "2829",... |
'''Cleanup files & directories under /tmp'''
import os
import shutil
import glob
dir_root = '/tmp/'
def cleanup_work_dir(dir_root=dir_root):
'''Cleanup directories & files under the root directory
Defaults to /tmp/ which is default working directory'''
listing = glob.glob(dir_root+'*')
for l in listin... | {
"content_hash": "847e550aa2d86044deeda732382494bd",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 59,
"avg_line_length": 24.727272727272727,
"alnum_prop": 0.5330882352941176,
"repo_name": "ucldc/harvester",
"id": "677fa19aa353eca89a47c4b910a52e162f8e647a",
"size": "544"... |
"""Tests for embedding layers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python import keras
from tensorflow.python.eager import backprop
from tensorflow.python.framework import test_util as tf_test_util
from ten... | {
"content_hash": "12db1a60e120d4a503dd9ef4261ad588",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 65,
"avg_line_length": 31.682926829268293,
"alnum_prop": 0.6070053887605851,
"repo_name": "girving/tensorflow",
"id": "2e42e403aa3815a8530b1755bb8b271a6fe3c96e",
"size": "3... |
import importlib
import logging
# HACK:
# Sphinx-autoapi doesn't like imports to excluded packages in the main module.
conf = importlib.import_module('airflow.configuration').conf # type: ignore[attr-defined]
PROVIDERS_GOOGLE_VERBOSE_LOGGING: bool = conf.getboolean(
'providers_google', 'VERBOSE_LOGGING', fallbac... | {
"content_hash": "626c5f5702fd21bd63a12a1de1031cec",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 102,
"avg_line_length": 34.40909090909091,
"alnum_prop": 0.702774108322325,
"repo_name": "Acehaidrey/incubator-airflow",
"id": "de7c3eef9373fa50e83eb83226b2c656cdb31d97",
"... |
import StringIO
from nose.tools import *
from impactlib.refresh import extract_dependencies
def test_complex1():
fp = StringIO.StringIO("""
package RealTimeCoordinationLibrary
annotation (uses(Modelica(version="3.2"), RealTimeCoordinationLibrary(version=
"1.0.2"),
Modelica_StateGraph2(version="2... | {
"content_hash": "4c201870524e1b9b2345652a62784211",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 471,
"avg_line_length": 58.81818181818182,
"alnum_prop": 0.6982225656877898,
"repo_name": "FND/impact",
"id": "0828694b4ab616476a8e17848e5cf49ffdf7e615",
"size": "2588",
... |
from transformer import *
from standard_game import *
from standard_player import *
from player_vectorizer import *
| {
"content_hash": "f5cdb11fe81868f3e10999c5e44c23ba",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 31,
"avg_line_length": 29,
"alnum_prop": 0.8017241379310345,
"repo_name": "claymcleod/pyffl",
"id": "1252deb3c51b4ef390b61f49d606703dabc8891d",
"size": "116",
"binary": fa... |
"""
lantz.ui.layouts
~~~~~~~~~~~~~~~~
Frontends to automatically locate widgets.
:copyright: 2015 by Lantz Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from lantz.utils.qt import QtGui
from lantz.ui.app import Frontend
class _PanelsUi(Frontend):
"... | {
"content_hash": "ad3d88e0eec347642431fb25f37a753e",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 91,
"avg_line_length": 27.974025974025974,
"alnum_prop": 0.5807799442896936,
"repo_name": "LabPy/lantz_qt",
"id": "192f199fd21880ffa9a9bc1593645f54b0ca296a",
"size": "2178"... |
import os
from time import time
from flask import Flask, request
from crypto import rsa, aes
from settings import APP_STATIC
from utils import json, get_session_key, SESSION_KEY_EXPIRATION_TIME
app = Flask(__name__)
db = {
'admin': {
'password': 'secret'
},
'bob': {
'password': 'foo'
... | {
"content_hash": "fb86eaaf41d14ef8077b06fe03ecfd34",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 89,
"avg_line_length": 28.462962962962962,
"alnum_prop": 0.6128822381262199,
"repo_name": "Drapegnik/bsu",
"id": "e87e7a9e7590454727b6aad75477036576a60ac6",
"size": "3074"... |
from __future__ import unicode_literals
import unittest
import json
import os
from monty.json import MontyDecoder
from pymatgen.analysis.defects.dilute_solution_model import *
import random
test_dir = os.path.join(os.path.dirname(__file__), "..", "..", "..", "..",
'test_files')
with open(
... | {
"content_hash": "4f772e98a350289290542fc92c2667a8",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 97,
"avg_line_length": 38.9327731092437,
"alnum_prop": 0.6324195985322685,
"repo_name": "johnson1228/pymatgen",
"id": "aa7fefbb73ed49933a34d15ce349066dd2fba8a4",
"size": "... |
import sys
import json
import bson
import cbor
# Get filename base (without extension) from argument list
fname = sys.argv[1]
# Open the JSON version of the file, and a new file
# to hold the BSON version.
fin = open(fname + '.json', 'r')
fout = open(fname + '.bson', 'wb')
# Parse the JSON string from the file into... | {
"content_hash": "4a008abe33dfda3a99d6ea60c58c6690",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 58,
"avg_line_length": 21.17241379310345,
"alnum_prop": 0.6864820846905537,
"repo_name": "hillbw/exi-test",
"id": "f468f3fbaf7cebcef2173ef0c2464caaf700d10a",
"size": "1228"... |
import socket
from oslo_service import loopingcall
from oslo_utils import timeutils
from cinder import context
from cinder import db
from cinder import objects
def get_test_admin_context():
return context.get_admin_context()
def create_volume(ctxt,
host='test_host',
display... | {
"content_hash": "f7e27385d6ad53c4e268bd6105c6bf4b",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 70,
"avg_line_length": 34.146198830409354,
"alnum_prop": 0.5762973111834219,
"repo_name": "nexusriot/cinder",
"id": "4890486ec99ae1bb21cdcb82993e2eeb50ca775b",
"size": "64... |
import sys
from bigdl.util.common import callBigDlFunc
if sys.version >= '3':
long = int
unicode = str
class DLImageReader:
"""
Primary DataFrame-based image loading interface, defining API to read images from files
to DataFrame.
"""
@staticmethod
def readImages(path, sc=None, minPari... | {
"content_hash": "975f50d043d1ce8b7248704c61fc66db",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 102,
"avg_line_length": 40.65384615384615,
"alnum_prop": 0.6688741721854304,
"repo_name": "wzhongyuan/BigDL",
"id": "96c8c9bd71b2e1b2b43a1480d1f98cfe36b85404",
"size": "164... |
import roslib; roslib.load_manifest('controller_manager')
import sys
import rospy
from controller_manager_msgs.srv import *
def list_controller_types():
rospy.wait_for_service('controller_manager/list_controller_types')
s = rospy.ServiceProxy('controller_manager/list_controller_types', ListControllerTypes)
... | {
"content_hash": "d2fa0787e791c112c7346ab690f04abb",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 103,
"avg_line_length": 34.36206896551724,
"alnum_prop": 0.673607626693427,
"repo_name": "robotic-ultrasound-image-system/ur5",
"id": "062fba0dae271b100bc2156a70e49fd2f35f49... |
from distutils.core import setup
setup(name = "django-testauth",
version = '0.1',
description = "Django library/application for authenticating against TEST services",
author = "Andrew Williams",
author_email = "matalok@pleaseignore.com",
url = "http://dev.pleaseignore.com/projects/django-dreddit... | {
"content_hash": "0320ef3d0f6c655b610502750f1be2b3",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 88,
"avg_line_length": 33.166666666666664,
"alnum_prop": 0.6909547738693468,
"repo_name": "nikdoof/django-testauth",
"id": "d780a94736af30d65063b1c60c388714149a2304",
"size... |
from proteus import StepControl
from proteus.default_n import *
from proteus import (StepControl,
TimeIntegration,
NonlinearSolvers,
LinearSolvers,
LinearAlgebraTools)
import vof_p as physics
from proteus import Context
from proteus.mpr... | {
"content_hash": "cbed9b8a990e0a607f197a1004557ed7",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 144,
"avg_line_length": 28.753086419753085,
"alnum_prop": 0.7745813653928725,
"repo_name": "erdc-cm/air-water-vv",
"id": "261c6128c2e8f55a7e7b66d0a73c6009297fdb41",
"size":... |
from utils.views import JsonView
from utils.models import HeartBeat
from django.forms.models import model_to_dict
# Create your views here.
class HeartBeatView(JsonView):
def react(self, data):
return model_to_dict(HeartBeat.objects.latest('datetime'), exclude='datetime') | {
"content_hash": "5166ee72062c4d2176d14c9ea9aad998",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 86,
"avg_line_length": 31.77777777777778,
"alnum_prop": 0.7657342657342657,
"repo_name": "Glucksistemi/EGS-DSM",
"id": "27e1fdcfbc20cde1e229dc3681dff3b9268027d3",
"size": "2... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/components/booster/shared_bst_tiefighter_basic.iff"
result.attribute_template_id = 8
result.stfName("space/space_item","bst_tiefighter_basic_n")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ... | {
"content_hash": "5de73e4c1ee65ff3ec1140660b58b308",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 92,
"avg_line_length": 26.23076923076923,
"alnum_prop": 0.7155425219941349,
"repo_name": "anhstudios/swganh",
"id": "674a5c1e0c3cfc5275ffe6e09a749a475b0c2dd4",
"size": "486... |
import datetime
class Console(object):
def __enter__(self):
self.logfile = open('/tmp/console.html', 'a', 0)
return self
def __exit__(self, etype, value, tb):
self.logfile.close()
def addLine(self, ln):
ts = datetime.datetime.now()
outln = '%s | %s' % (str(ts), ln... | {
"content_hash": "eafecdf241466f86dc6ce8a896704f29",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 56,
"avg_line_length": 20.8,
"alnum_prop": 0.5444711538461539,
"repo_name": "gooddata/zuul",
"id": "4b377d9079b0cd0f337efb56ca0df96208134848",
"size": "1549",
"binary": f... |
from .dashboard import Dashboard, Link
from .module import Module, ModuleType
| {
"content_hash": "d134b1ab659d84841598fb48e27e9ab2",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 38,
"avg_line_length": 39,
"alnum_prop": 0.8205128205128205,
"repo_name": "alphagov/stagecraft",
"id": "a47141b726145bd065c1262a312312bbafb12dc2",
"size": "78",
"binary": ... |
"""The tests for the Light component."""
# pylint: disable=protected-access
import unittest
import os
from homeassistant.bootstrap import setup_component
import homeassistant.loader as loader
from homeassistant.const import (
ATTR_ENTITY_ID, STATE_ON, STATE_OFF, CONF_PLATFORM,
SERVICE_TURN_ON, SERVICE_TURN_OFF... | {
"content_hash": "d16577cdcd6ce3f4e8b86eef2c2fdfe7",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 78,
"avg_line_length": 34.11920529801324,
"alnum_prop": 0.6011257763975155,
"repo_name": "philipbl/home-assistant",
"id": "60e5b4d9ec2300b079db749fa5519423cb51e92e",
"size... |
__all__ = ['Process', 'current_process', 'active_children']
#
# Imports
#
import os
import sys
import signal
import itertools
from multiprocessing.patch import property
#
#
#
try:
ORIGINAL_DIR = os.path.abspath(os.getcwd())
except OSError:
ORIGINAL_DIR = None
# forward compatibility
bytes = str
#
# Publi... | {
"content_hash": "5ee640bc221e070fd317040f7bfcb873",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 79,
"avg_line_length": 26.714285714285715,
"alnum_prop": 0.5552584670231729,
"repo_name": "miracle2k/python-multiprocessing",
"id": "946a41e20be1730163977a2ac727ee238ac2b4ea... |
import functools
import pathlib
import sys
import traceback
import unittest
import xml.etree.ElementTree as ET
import zipfile
from inc_datasources import _XMLMethodNames, _localWorkspace, _outputDirectory, _daGPTools
sys.path.insert(0, _daGPTools)
import arcpy
import pandas as pd
import tempfile
from scripts import d... | {
"content_hash": "a73fed97d49953e56a05edbbf100c89c",
"timestamp": "",
"source": "github",
"line_count": 828,
"max_line_length": 120,
"avg_line_length": 41.52536231884058,
"alnum_prop": 0.5794142454119768,
"repo_name": "JRosenfeldIntern/data-assistant",
"id": "35795f5fdf3ca5dfa6bc0d47edaab4467d57dc7d"... |
"""Fake RPC implementation which calls proxy methods directly with no
queues. Casts will block, but this is very useful for tests.
"""
import inspect
# NOTE(russellb): We specifically want to use json, not our own jsonutils.
# jsonutils has some extra logic to automatically convert objects to primitive
# types so tha... | {
"content_hash": "99e56469d03e155b7cb7ff819d71a9c6",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 78,
"avg_line_length": 28.977777777777778,
"alnum_prop": 0.5774539877300614,
"repo_name": "rickerc/ceilometer_audit",
"id": "16caadc45d97701f221470a581e1d15262a0e097",
"si... |
"""Support for Envisalink devices."""
import asyncio
import logging
import voluptuous as vol
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
from homeassistant.const import EVENT_HOMEASSISTANT_STOP, CONF_TIMEOUT, \
CONF_HOST
from homeassistant.helpers.entity import Ent... | {
"content_hash": "c0c434718dcabc10951e7809e9019c60",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 79,
"avg_line_length": 34.06060606060606,
"alnum_prop": 0.6562023385866802,
"repo_name": "jnewland/home-assistant",
"id": "d7a015e8e4571077d623b0a354cfb3b39db10bbb",
"size... |
import sys
from copy import deepcopy
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase, SimpleTestCase, override_settings
from mock import patch
from django_auth_adfs.config import django_settings
from django_auth_adfs.config import Settings
from .custom_config import Settings as... | {
"content_hash": "1684a60d8e6f645811d91df212a0b9af",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 94,
"avg_line_length": 41.50892857142857,
"alnum_prop": 0.6601419660141966,
"repo_name": "jobec/django-auth-adfs",
"id": "96a8b98eb4c3e19b663a3447ba4fe7d65735f4af",
"size"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dictionary', '0008_auto_20160410_2229'),
]
operations = [
migrations.RemoveField(
model_name='wordcontent',
name='references... | {
"content_hash": "89cd3170a7086b0b5d62330e93052ba1",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 123,
"avg_line_length": 26.045454545454547,
"alnum_prop": 0.6090750436300174,
"repo_name": "nirvaris/nirvaris-dictionary",
"id": "12161282f00bf925135425e32f4e1581147a1bd1",
... |
import wevote_functions.admin
logger = wevote_functions.admin.get_logger(__name__)
# NOTE: @login_required() throws an error. Needs to be figured out if we ever want to secure this page.
def export_reaction_like_data_view():
pass
| {
"content_hash": "6e41f54c1884766578c7c04d9d3379f7",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 103,
"avg_line_length": 29.625,
"alnum_prop": 0.7383966244725738,
"repo_name": "wevote/WeVoteServer",
"id": "0471da6d0f75dcdbd9f9ac460ab4458a7d0310f8",
"size": "361",
"bin... |
from google.cloud import gke_multicloud_v1
async def sample_update_aws_node_pool():
# Create a client
client = gke_multicloud_v1.AwsClustersAsyncClient()
# Initialize request argument(s)
aws_node_pool = gke_multicloud_v1.AwsNodePool()
aws_node_pool.version = "version_value"
aws_node_pool.conf... | {
"content_hash": "9dec4bafcfb39a74211ad98691edfad5",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 76,
"avg_line_length": 33.28125,
"alnum_prop": 0.7173708920187793,
"repo_name": "googleapis/python-gke-multicloud",
"id": "94817ec2ee0a0309f3eac3994bac5aeffe36810c",
"size"... |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [
Extension(
"enet",
extra_compile_args=["-O3"],
sources=["enet.pyx"],
libraries=["enet"])]
setup(
name = 'enet',
cmdclass = {'build_ext': build_ext},... | {
"content_hash": "11dbabc9b8b5dabd0c42e75c20db6436",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 41,
"avg_line_length": 21.9375,
"alnum_prop": 0.6353276353276354,
"repo_name": "agrif/pyenet",
"id": "33e418422a778d9cc943749d65e0b6f8cd15e350",
"size": "351",
"binary": ... |
import os
import sys
from accounts.models import User
from django.conf import settings
from django.contrib.auth.models import Group
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.core.urlresolvers import reverse
from django.db.models import Q
from django.test.utils import override_... | {
"content_hash": "513b1ccc395d853bfdf9c4847c1df24f",
"timestamp": "",
"source": "github",
"line_count": 703,
"max_line_length": 131,
"avg_line_length": 42.502133712660026,
"alnum_prop": 0.5932594799022725,
"repo_name": "CDE-UNIBE/qcat",
"id": "3446ce0bd7781f249500790d349012606de46b68",
"size": "298... |
from __future__ import unicode_literals
from sys import version_info
import flask_login
from flask_login import login_required, current_user, logout_user
from flask import flash
from wtforms import (
Form, PasswordField, StringField)
from wtforms.validators import InputRequired
from flask import url_for, redirec... | {
"content_hash": "924567c1d797b31db4948904060da3ca",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 83,
"avg_line_length": 27.085106382978722,
"alnum_prop": 0.6423147420790782,
"repo_name": "yiqingj/airflow",
"id": "66b1df1d86c6e5397e9a7dba2ad2b513af9943ea",
"size": "438... |
"""Starter script for the Solum Worker service."""
import os
import shlex
import sys
from oslo_config import cfg
from oslo_log import log as logging
from oslo_privsep import priv_context
import solum
from solum.common.rpc import service as rpc_service
from solum.common import service
from solum.common import trace_d... | {
"content_hash": "5c65ab15dc532cba766aec88b91b7bdc",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 77,
"avg_line_length": 30.982758620689655,
"alnum_prop": 0.6755703951029494,
"repo_name": "stackforge/solum",
"id": "d2f7c9ddd9ea8df6218a7c6902107ef877e1da77",
"size": "240... |
__all__ = ["Dtool_ObjectToDict", "Dtool_funcToMethod", "Dtool_PreloadDLL"]
import imp, sys, os
# The following code exists to work around a problem that exists
# with Python 2.5 or greater.
# Specifically, Python 2.5 is designed to import files named *.pyd
# only; it will not import files named *.dll (or *.so). We ... | {
"content_hash": "323ecfe07f0856eb097f0a8027f1f570",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 127,
"avg_line_length": 34.83720930232558,
"alnum_prop": 0.6515353805073432,
"repo_name": "ee08b397/panda3d",
"id": "9424b640ce1fefd77cf53676d219acad43fe4801",
"size": "45... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2014 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the righ... | {
"content_hash": "06f9ce522b020d6fa6f1dec91c063fe4",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 77,
"avg_line_length": 36.09756097560975,
"alnum_prop": 0.7614864864864865,
"repo_name": "margguo/python-ivi",
"id": "9a22eb7b33b44b60c71513b1e56fd858ddd18fec",
"size": "14... |
"""Tests for advanced user interactions."""
import os
import time
import unittest
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import A... | {
"content_hash": "bd563938b2305759112f5b5201034482",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 91,
"avg_line_length": 39.63636363636363,
"alnum_prop": 0.6604155423637345,
"repo_name": "akiellor/selenium",
"id": "4a082a67256a138d953833524f9d6dd8cf7a7e8b",
"size": "80... |
"""
Tests for leveldb with plyvel as a backend.
This suite is skipped if plyvel is not installed.
"""
import pytest
from levelpy.leveldb import LevelDB
from fixtures import leveldir # noqa
@pytest.fixture(scope='module')
def backend_class_str():
return "leveldb.LevelDB... | {
"content_hash": "254ec116c5644eefe27c51a03beb5c86",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 79,
"avg_line_length": 27.90625,
"alnum_prop": 0.713885778275476,
"repo_name": "akubera/levelpy",
"id": "3e753493c1006f912f0af831eeb09bd5d4d6292c",
"size": "1843",
"binar... |
"""Keras string lookup preprocessing layer."""
# pylint: disable=g-classes-have-attributes
import numpy as np
from tensorflow.python.framework import dtypes
from tensorflow.python.keras.engine import base_preprocessing_layer
from tensorflow.python.keras.layers.preprocessing import index_lookup
from tensorflow.python.... | {
"content_hash": "5598fc02efbf2b0e5d09ea564818ed35",
"timestamp": "",
"source": "github",
"line_count": 329,
"max_line_length": 80,
"avg_line_length": 43.848024316109424,
"alnum_prop": 0.6335089421877166,
"repo_name": "sarvex/tensorflow",
"id": "1a0bd1894e36718e8972dd6c444e6b6045a16237",
"size": "1... |
COMPLETED = "response_completed"
DISQUALIFIED = "response_disqualified"
UPDATED = "response_updated"
# Object Types
SURVEY = "survey"
COLLECTOR = "collector"
| {
"content_hash": "85c4fd7c078b7773c07b6d34cefd4e0e",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 38,
"avg_line_length": 22.714285714285715,
"alnum_prop": 0.7610062893081762,
"repo_name": "Administrate/surveymonkey",
"id": "fd0436cb97b7962bbf8cb03297c5db633653c4c8",
"siz... |
import sys
import cv2.cv as cv
import urllib2
wndname = "Distance transform"
tbarname = "Threshold"
# The output images
dist = 0
dist8u1 = 0
dist8u2 = 0
dist8u = 0
dist32s = 0
gray = 0
edge = 0
# define a trackbar callback
def on_trackbar(edge_thresh):
cv.Threshold(gray, edge, float(edge_thresh), float(edge_th... | {
"content_hash": "9bf76096701d932b6121039801dc98cf",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 89,
"avg_line_length": 29.323943661971832,
"alnum_prop": 0.6729106628242075,
"repo_name": "grace-/opencv-3.0.0-cvpr",
"id": "c7a61c6dbb190a29fbe069734c6ca5d2169bbc20",
"siz... |
"""
Adds the concept of partner lists.
"""
from lino import ad, _
class Plugin(ad.Plugin):
"See :class:`lino.core.Plugin`."
verbose_name = _("Lists")
partner_model = 'contacts.Partner'
menu_group = 'contacts'
def on_site_startup(self, site):
self.partner_model = site.models.resolve(self.... | {
"content_hash": "c251289cfc8c69232b2e20643aa70924",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 68,
"avg_line_length": 30.647058823529413,
"alnum_prop": 0.6113243761996161,
"repo_name": "lino-framework/xl",
"id": "b079f2e931cf93043bf6ef0d4dfdf624c6a88f0e",
"size": "11... |
from datetime import datetime
from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy.ext.mutable import MutableDict
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy_utils import JSONType
from sqlalchemy.orm.exc import NoResultFound
from flask_dance.utils import FakeCache, first, g... | {
"content_hash": "712a1d6d86501dee9cc3276bd9d3d2fa",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 88,
"avg_line_length": 40.03404255319149,
"alnum_prop": 0.594281462585034,
"repo_name": "nickdirienzo/flask-dance",
"id": "34b1c0873ea78070eccad0f680732905a11cdb80",
"size... |
from collections import namedtuple
from datetime import datetime, timedelta
from django.shortcuts import get_object_or_404
from django.utils.timezone import now
import django_filters
from rest_framework.views import APIView
from rest_framework.response import Response
from remo.api.views import BaseReadOnlyModelView... | {
"content_hash": "87523e5793ee83020b523304ffc2d4df",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 79,
"avg_line_length": 36.76510067114094,
"alnum_prop": 0.6341730558598029,
"repo_name": "akatsoulas/remo",
"id": "19a0f59168fbc4a50c8fe88d567d691ea05c10f5",
"size": "5478... |
"""
Ganglia module for getting latest instance count
"""
import os
import time
import threading
import traceback
import sys
from nova import flags
from nova import db
from nova import context
from nova import log as logging
from nova import utils
from nova import version
from nova.compute import manager as compute_m... | {
"content_hash": "8370fce4502cb279585c31f7bc97c778",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 79,
"avg_line_length": 29.41346153846154,
"alnum_prop": 0.5232101994115724,
"repo_name": "Mitali-Sodhi/CodeLingo",
"id": "2f20a18e4ebaf0322f77dafd1cef96c7ec584530",
"size"... |
''' Base class for preprocessing of RC files.
'''
from __future__ import print_function
class PreProcessor(object):
''' Base class for preprocessing of the RC file data before being
output through the RC2GRD tool. You should implement this class if
you have specific constructs in your RC files that GRIT cannot ... | {
"content_hash": "43ad55b4bf44d22e6f760a9289fe4f21",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 75,
"avg_line_length": 29.571428571428573,
"alnum_prop": 0.7085346215780999,
"repo_name": "nwjs/chromium.src",
"id": "494fe7921f561dedd0f6c3b8fdcb659b17f36042",
"size": "76... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.