text stringlengths 4 1.02M | meta dict |
|---|---|
import json
from django.test import mock, TestCase
from django.contrib.contenttypes.models import ContentType
from django.forms import Select
from django.db.models import BLANK_CHOICE_DASH
from django.contrib.admin.widgets import AdminFileWidget
from django.core.files.uploadedfile import InMemoryUploadedFile
from .. ... | {
"content_hash": "cbdfc7bbd57c46c99c54c3a96535b069",
"timestamp": "",
"source": "github",
"line_count": 380,
"max_line_length": 80,
"avg_line_length": 40.54736842105263,
"alnum_prop": 0.6144210799584632,
"repo_name": "Kemaweyan/django-content-gallery",
"id": "4e13cdda2183adaa53f9a376d2b3e37c8735e0ce"... |
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from orcid_api_... | {
"content_hash": "88d8af3a2cd4181f6a8019d4e2cb5865",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 211,
"avg_line_length": 30.3125,
"alnum_prop": 0.6053420805998125,
"repo_name": "Royal-Society-of-New-Zealand/NZ-ORCID-Hub",
"id": "202b57882f1670d85989a69f6ef7be7119e0d99f"... |
from product_details import product_details
ENGLISH_LANGUAGE_CHOICES = sorted(
[(key.lower(), u'{0} ({1})'.format(key, value['English']))
for key, value in product_details.languages.items()]
)
LANGUAGE_VALUES = [choice[0] for choice in ENGLISH_LANGUAGE_CHOICES]
ENGLISH_COUNTRY_CHOICES = sorted(
[(code, ... | {
"content_hash": "feef746e48fb1a2bf69d26bbbd773df8",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 68,
"avg_line_length": 32.5,
"alnum_prop": 0.6711538461538461,
"repo_name": "bensternthal/snippets-service",
"id": "b3663dfeed13f813cb26b85364c24395c70a147e",
"size": "520"... |
import os
import uuid
from lxml import etree
from . import namespaces as ns, xsd
NAMESPACE = ns.wsa
ANONYMOUS = 'http://www.w3.org/2005/08/addressing/anonymous'
SCHEMA_IMPORT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), 'raw', 'wsa.xsd'))
class ReplyTo(xsd.ComplexType):
Address = xsd.Element(... | {
"content_hash": "25e0ab4f21d965756b89ff77d6f0cc0e",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 95,
"avg_line_length": 32.04545454545455,
"alnum_prop": 0.7085106382978723,
"repo_name": "FelixSchwarz/soapfish",
"id": "80eca053c2ef8529db2d517c5351a6aa7ad3f390",
"size": ... |
import copy
from keystoneclient import exceptions as ksc_exc
from openstackclient.identity.v2_0 import project
from openstackclient.tests import fakes
from openstackclient.tests.identity.v2_0 import fakes as identity_fakes
class TestProject(identity_fakes.TestIdentityv2):
def setUp(self):
super(TestPro... | {
"content_hash": "dab7c1b3307cdebc02f229063160daac",
"timestamp": "",
"source": "github",
"line_count": 588,
"max_line_length": 78,
"avg_line_length": 29.848639455782312,
"alnum_prop": 0.5485157540880862,
"repo_name": "BjoernT/python-openstackclient",
"id": "18e862eb13367eb6e80102bdddaccd55a3ba6958",... |
"""``python bbob_pproc`` tests the package bbob_pproc and should run through
smoothly from a system command shell. It however depends on data files that
might not be available (to be improved).
This test can and should become much more sophisticated.
"""
import os, sys, time, inspect
import fnmatch
import urlli... | {
"content_hash": "405fef88ab12eafaca59972979a9ef66",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 107,
"avg_line_length": 43.63973063973064,
"alnum_prop": 0.6062803796003394,
"repo_name": "oaelhara/numbbo",
"id": "d68b18a4aece51ef393ea3866331839e4680f996",
"size": "129... |
from flask import current_app as app, render_template, request, redirect, abort, jsonify, json as json_mod, url_for, session
from CTFd.utils import ctftime, view_after_ctf, authed, unix_time, get_kpm, can_view_challenges, is_admin, get_config
from CTFd.models import db, Challenges, Files, Solves, WrongKeys, Keys
impo... | {
"content_hash": "fedd6626763c77c14e8a882c06e967d8",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 168,
"avg_line_length": 45.241610738255034,
"alnum_prop": 0.518469069870939,
"repo_name": "gusnaughton/CTFd",
"id": "54db83754100c29a54f99179b501c6ca962fd0a9",
"size": "67... |
import hashlib
import json
from tempest_lib.common.utils import data_utils
from tempest_lib import exceptions as lib_exc
from tempest.api.object_storage import base
from tempest.common import custom_matchers
from tempest import test
from tempest_lib import decorators
# Each segment, except for the final one, must be... | {
"content_hash": "96dc0e803b2550d870d710c0deae4fdb",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 78,
"avg_line_length": 39.754285714285714,
"alnum_prop": 0.5916343251401466,
"repo_name": "jaspreetw/tempest",
"id": "afec1ef9cd7b278dd52a62d59bf4e4cac08ceb18",
"size": "7... |
import sys
from aubio import source, onset
win_s = 512 # fft size
hop_s = win_s // 2 # hop size
if len(sys.argv) < 2:
print("Usage: %s <filename> [samplerate]" % sys.argv[0])
sys.exit(1)
filename = sys.argv[1]
samplerate = 0
if len( sys.argv ) > 2: samplerate = int(sys.argv[2])
s =... | {
"content_hash": "5c018bd74f92288dd9f45977b332b9af",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 60,
"avg_line_length": 21.818181818181817,
"alnum_prop": 0.6069444444444444,
"repo_name": "MusicVisualizationUMass/TeamNameGenerator",
"id": "43e4aedec37b299178beb0094914c595... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("easy_maps", "0002_auto_20190329_0541"),
]
operations = [
migrations.AddField(
model_name="address",
name="timestamp",
field=models.DateTimeField(auto_now... | {
"content_hash": "2492847e52f95aa427d18e917e92a131",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 54,
"avg_line_length": 21.5625,
"alnum_prop": 0.5768115942028985,
"repo_name": "bashu/django-easy-maps",
"id": "abec79ab7fa1a5f5a757a6b1ee5df901d3991442",
"size": "394",
... |
from rest_framework import serializers
from models import (Task, Team)
class TaskSerializer(serializers.ModelSerializer):
simulators = serializers.SerializerMethodField('get_simulators')
def get_simulators(self, obj):
return obj.simulator_set.count()
class Meta:
model = Task
fie... | {
"content_hash": "c0ff5f5d657a13927fb65dbe3b5361d3",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 68,
"avg_line_length": 24.157894736842106,
"alnum_prop": 0.6993464052287581,
"repo_name": "ticcky/teyb",
"id": "70cd0a15d2327efb59d7f350a0d283450c59a76f",
"size": "459",
... |
"""Automatically generated mapping of error codes."""
# pylint: disable=g-bad-name
from __future__ import absolute_import
import collections
_ErrorInfo = collections.namedtuple(
'_ErrorInfo', ['http_status', 'rpc_status', 'reason', 'domain'])
_UNSUPPORTED_ERROR = _ErrorInfo(404,
... | {
"content_hash": "78177627048573e83d5a30c61ae0e11b",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 77,
"avg_line_length": 38.4,
"alnum_prop": 0.6174242424242424,
"repo_name": "nparley/mylatitude",
"id": "d0c31c352c22281ccadb09f1d6ce2eb9488174cf",
"size": "2709",
"binar... |
from django.conf.urls import url
from remo.events import views as events_views
urlpatterns = [
url(r'^(?P<slug>[a-z0-9-]+)/$', events_views.view_event, name='events_view_event'),
url(r'^(?P<slug>[a-z0-9-]+)/edit/$', events_views.edit_event, name='events_edit_event'),
url(r'^(?P<slug>[a-z0-9-]+)/clone/$', ... | {
"content_hash": "9dfe377ca8e7630b4c6b9d6c839ebf6d",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 98,
"avg_line_length": 55.904761904761905,
"alnum_prop": 0.6235093696763203,
"repo_name": "akatsoulas/remo",
"id": "6e74baa3715fccdecf445c6477ad29ac40c7224e",
"size": "1174... |
import sys, threading, time
import twitter
import requests
import bson.json_util
import logging, logging.handlers
import Queue
import sqlite3
import httplib, urllib2
import re
# local
from drenaj.client.config.config import *
import datetime
import rfc822
ABORTING_WAIT_TOO_LONG_CODE = 1
NOT_AUTHORIZED_ERROR_CO... | {
"content_hash": "e7eca52f612f815de82f454fb487588b",
"timestamp": "",
"source": "github",
"line_count": 661,
"max_line_length": 231,
"avg_line_length": 41.03025718608169,
"alnum_prop": 0.5539987463589101,
"repo_name": "boun-cmpe-soslab/drenaj",
"id": "ba77c67f67c25ef3fc459de050f03cb9e54c6a15",
"siz... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0023_auto_20220102_1437'),
]
operations = [
migrations.AddField(
model_name='systemversion',
name='twitter_handle',
field=models.CharField(blank=... | {
"content_hash": "97aae9a1a3e5880ef76adc9b88dd7eea",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 145,
"avg_line_length": 27.625,
"alnum_prop": 0.6244343891402715,
"repo_name": "cmu-db/dbdb.io",
"id": "1b371e44ce39e409e9bed3e3a5457247a26821ce",
"size": "492",
"binary"... |
import chainladder as cl
def test_trend1():
tri = cl.load_sample('clrd')[['CumPaidLoss', 'EarnedPremDIR']].sum()
assert (
cl.CapeCod(.05).fit(tri['CumPaidLoss'], sample_weight=tri['EarnedPremDIR'].latest_diagonal).ibnr_ ==
cl.CapeCod().fit(cl.Trend(.05).fit_transform(tri['CumPaidLoss']), sample... | {
"content_hash": "93bf7b35ce8a2bdcdae769c379bb6394",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 132,
"avg_line_length": 47.07692307692308,
"alnum_prop": 0.6274509803921569,
"repo_name": "jbogaardt/chainladder-python",
"id": "8c4804040dbdd9c73477abbc7178b4ac5f9f621a",
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('thing', '0010_auto_20170417_0259'),
]
operations = [
migrations.AddField(
model_name='pricewatch',
name='price_group',
... | {
"content_hash": "bc408ddffadf103480de1500a5f4a061",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 61,
"avg_line_length": 22.57894736842105,
"alnum_prop": 0.5920745920745921,
"repo_name": "cmptrgeekken/evething",
"id": "870bab1a9c0391a087d4541d74fb80347d6ec0f7",
"size": ... |
from django.db import migrations
from django.db.backends.postgresql.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def fix_realm_string_ids(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
Realm = apps.get_model('zerver', 'Realm')
if Realm.objects.filter(deac... | {
"content_hash": "805e4fc5fd3668a0272100d7861a9cd0",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 90,
"avg_line_length": 30.7,
"alnum_prop": 0.6547231270358306,
"repo_name": "shubhamdhama/zulip",
"id": "a74db853ed8a8a43f7f087507fd6873ee778a654",
"size": "970",
"binary... |
import json
import logging
from django.core.exceptions import ObjectDoesNotExist
from django.db.utils import IntegrityError
from django.http import HttpResponse, Http404
from django.shortcuts import render_to_response
from django.views.decorators.cache import cache_page
from cbmonitor import forms
from cbmonitor impo... | {
"content_hash": "ca0e28233649d194a338fc825bf2c97f",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 82,
"avg_line_length": 27.835680751173708,
"alnum_prop": 0.6447967616798785,
"repo_name": "couchbase/cbmonitor",
"id": "8bb6650327a17375e0403d1268515a6c2bf42157",
"size": ... |
"""
SciPy: A scientific computing package for Python
================================================
Documentation is available in the docstrings and
online at https://docs.scipy.org.
Contents
--------
SciPy imports all the functions from the NumPy namespace, and in
addition provides:
Subpackages
-----------
Using ... | {
"content_hash": "91e9c40d74f3a16c8661d8f2a90ef6b9",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 80,
"avg_line_length": 33.40512820512821,
"alnum_prop": 0.5848940743015044,
"repo_name": "vigna/scipy",
"id": "153db41c221d63052fa4443f2673990ef4ce86cc",
"size": "6514",
... |
"""
Design a data structure that supports adding new words and finding if a string matches any previously added string.
Implement the WordDictionary class:
WordDictionary() Initializes the object.
void addWord(word) Adds word to the data structure, it can be matched later.
bool search(word) Returns true if there is a... | {
"content_hash": "38783e1be28bc7566c094d7e87a81a31",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 182,
"avg_line_length": 30.02,
"alnum_prop": 0.5779480346435709,
"repo_name": "franklingu/leetcode-solutions",
"id": "eef286975ec4a2602c149a17ec7ffe2b85b4ed59",
"size": "3... |
from django.db import models
# Create your models here.
| {
"content_hash": "f0dc88b039f0cfb324d21fb65965ea53",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 28,
"avg_line_length": 9.11111111111111,
"alnum_prop": 0.5365853658536586,
"repo_name": "ReneFGJ/Brapci",
"id": "bbe0bccc4d78f199ff77a23483fb76af3fe4bac3",
"size": "82",
"... |
class EventWebhookHeader:
"""
This class lists headers that get posted to the webhook. Read the docs for
more details: https://sendgrid.com/docs/for-developers/tracking-events/event
"""
SIGNATURE = 'X-Twilio-Email-Event-Webhook-Signature'
TIMESTAMP = 'X-Twilio-Email-Event-Webhook-Timestamp'
... | {
"content_hash": "7e2e67525ac7fa6377fa7410e8dd3d12",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 80,
"avg_line_length": 35.4,
"alnum_prop": 0.692090395480226,
"repo_name": "sendgrid/sendgrid-python",
"id": "a41a4852409e28acfe449066fc7253740c239f02",
"size": "354",
"b... |
from DocumentationTest import DocumentationTest
from RenderManShaderUITest import RenderManShaderUITest
if __name__ == "__main__":
unittest.main()
| {
"content_hash": "335f8b9c98d8be52efef5dde31765a47",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 55,
"avg_line_length": 29.8,
"alnum_prop": 0.7919463087248322,
"repo_name": "goddardl/gaffer",
"id": "9c408e44c7e3104d33967c296e00109df1fa124a",
"size": "1952",
"binary": ... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'sportsBerlin.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| {
"content_hash": "bf3a9d80b99c0c51121f48ca0cd2079d",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 57,
"avg_line_length": 28.1,
"alnum_prop": 0.6476868327402135,
"repo_name": "sklind/sportsBerlin",
"id": "160f5a840ff381be3efa437c15ed3d44dc71a614",
"size": "281",
"binar... |
from django.conf.urls import url
# Local views prox
from .views import HomeView, ContactFormView
urlpatterns = [
url(r'^$', HomeView.as_view(), name='home'),
url(r'^contact/$', ContactFormView.as_view(), name='contact'),
]
| {
"content_hash": "bfaf49e2cc298430adbabfd9e47944e0",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 66,
"avg_line_length": 25.88888888888889,
"alnum_prop": 0.6824034334763949,
"repo_name": "Hawk-X/hawk-x",
"id": "37f094d0ce67843c08282cbb0ee982dfa20d7e10",
"size": "233",
... |
"""
Merge two or more JSON documents.
Usage:
jsonmerge.py [-i, --indent=N] <file.json>...
Options:
-i
Indent with the default width of 4 spaces.
--indent=N
Indent with the specified number of spaces.
Examples:
$ cat > a.json
{
"a": {
"foo": 1,
"... | {
"content_hash": "08bcc7d88aa271c96b70d9d279ffd78b",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 79,
"avg_line_length": 24.705479452054796,
"alnum_prop": 0.5192680898253396,
"repo_name": "h4l/jsonmerge",
"id": "9730d94c5092f73b814a04e4ba86ca208647d583",
"size": "3607"... |
"""
Support for repeating alerts when conditions are met.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/alert/
"""
import asyncio
from datetime import datetime, timedelta
import logging
import os
import voluptuous as vol
from homeassistant.core impor... | {
"content_hash": "ead8cabb3d10f149a78392f82f79c1ec",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 78,
"avg_line_length": 31.862815884476536,
"alnum_prop": 0.629617040561976,
"repo_name": "Zac-HD/home-assistant",
"id": "8cee05f29cc4b136b3476a820d14af888b2cd0cd",
"size":... |
from twisted.spread import pb
from twisted.internet import reactor
class Two(pb.Referenceable):
def remote_print(self, arg):
print "two.print was given", arg
class One(pb.Root):
def __init__(self, two):
#pb.Root.__init__(self) # pb.Root doesn't implement __init__
self.two = t... | {
"content_hash": "01a197663e3d249bd1d60ad1e3c02189",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 70,
"avg_line_length": 31.16,
"alnum_prop": 0.6213093709884467,
"repo_name": "hortonworks/hortonworks-sandbox",
"id": "5bfddb0a824a5c1f50b385fd84d03b00a082e383",
"size": "7... |
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
trigger = client.usage.triggers("UT33c6aeeba34e48f38d6899ea5b765ad4").fetch()
print(trigger.current_... | {
"content_hash": "afe0e21a29704476406d5db80b7b5ca6",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 77,
"avg_line_length": 32.7,
"alnum_prop": 0.8012232415902141,
"repo_name": "teoreteetik/api-snippets",
"id": "18e0fd3e9870a09a72b895532fc2ff3b7b1c3aab",
"size": "400",
"... |
from msrest.serialization import Model
class KeyVaultSecretReference(Model):
"""Describes a reference to Key Vault Secret.
:param source_vault: Fully qualified resource Id for the Key Vault.
:type source_vault: :class:`ResourceId
<azure.mgmt.batchai.models.ResourceId>`
:param secret_url: The URL... | {
"content_hash": "dfd8c732b4f00f58825656a16c3a4828",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 71,
"avg_line_length": 30.5,
"alnum_prop": 0.6242118537200504,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "58f80f2adec53e1cb0805d113c4443c72fded600",
"size": "12... |
from __future__ import print_function
import tensorflow as tf
from subprocess import Popen
from time import sleep
import os
import errno
from config import Configuration
import re
def set_port(port, sim_dir, config):
try:
with open(sim_dir + 'unrealcv.ini', 'w') as ini_file:
print('[UnrealCV.C... | {
"content_hash": "4901fc2e588ea77d8ec359747916b9b2",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 90,
"avg_line_length": 26.254545454545454,
"alnum_prop": 0.6018005540166205,
"repo_name": "mkisantal/ucv-control",
"id": "006f756d49ced2234852db42f08e326c3b0c59f7",
"size":... |
import pandas
from sklearn.externals import joblib
from treeinterpreter import treeinterpreter as ti
from optparse import OptionParser
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from featureizer import featureize
from flowenhancer import enhance_flow
from clearcut_utils import load_brofi... | {
"content_hash": "1934e3c4a081364554df040b090f19c9",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 81,
"avg_line_length": 26.45679012345679,
"alnum_prop": 0.6290247316845544,
"repo_name": "DKarev/isolation-forest",
"id": "7cda0754a7ef206692c2d10d8aa9647d046e246e",
"size"... |
from django.db.models import Q
from kolibri.core.auth.models import AnonymousUser
from kolibri.core.auth.permissions.base import q_none
from kolibri.core.auth.permissions.general import DenyAll
class UserCanReadExamAssignmentData(DenyAll):
def user_can_read_object(self, user, obj):
if isinstance(user, An... | {
"content_hash": "688551ff1d7a111714998a16e72aee47",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 101,
"avg_line_length": 38.96153846153846,
"alnum_prop": 0.6594274432379073,
"repo_name": "indirectlylit/kolibri",
"id": "db51fbdcbe258e01bd0858c71d29593e713cf6f9",
"size":... |
from djangae.test import TestCase
from djangae.db import transaction
from djangae.contrib import sleuth
class TransactionTests(TestCase):
def test_atomic_decorator(self):
from .test_connector import TestUser
@transaction.atomic
def txn():
TestUser.objects.create(username="foo... | {
"content_hash": "6d9120939f8351d87351721f52e1bbc9",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 105,
"avg_line_length": 34.825581395348834,
"alnum_prop": 0.6051752921535893,
"repo_name": "martinogden/djangae",
"id": "8d5d7c4dbbfe66324a70a70f14e2b1ef94830e16",
"size":... |
import logging
from django.contrib.auth.models import User
from django.db.models import Q
from django.utils.translation import ugettext as _
from libsolr.api import SolrApi
from search.conf import SOLR_URL
from search.models import Collection
LOG = logging.getLogger(__name__)
class SearchController(object):
""... | {
"content_hash": "b194205a6e109b0aaa290d97f542edcc",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 193,
"avg_line_length": 28.150943396226417,
"alnum_prop": 0.6414209115281502,
"repo_name": "vitan/hue",
"id": "e822dfa003a6e338828c235fdc6f7ef6622f4c52",
"size": "3798",
... |
"""
Created on Fri Aug 4 14:00:48 2017
@author: casari
"""
import pyqtgraph as pg
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import sys
import numpy as np
#width_spin = [("Floating-point spin box, min=0, no maximum.", pg.SpinBox(value=5.0, bounds=[0, None]))]
class Graph(Q... | {
"content_hash": "e2659a38325b1016b10e4b26534b57ae",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 111,
"avg_line_length": 38.646067415730336,
"alnum_prop": 0.5987788922808548,
"repo_name": "MCasari-PMEL/EDD-ICMGUI",
"id": "5f46a0577c44bc78c306ad42ce336e3b22c81be8",
"si... |
import os
import sys
import time
import redis
import logging
import threading
import ConfigParser
import datetime
import paho.mqtt.client as mqtt
from pytz import timezone
from InformationFetcher import InformationFetcher
class AlarmClock(threading.Thread):
def _readConfig(self):
u... | {
"content_hash": "191bcd7b6022cf40e8618455d5daa050",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 157,
"avg_line_length": 40.85806451612903,
"alnum_prop": 0.5386072951207959,
"repo_name": "AnsgarSchmidt/sensomatic",
"id": "d36ab0b94ae3028fa617aabe2722c492ae571ee5",
"si... |
from mcstat.net import make_multicast_server_socket
from mcstat.domain import Term, Tick, Sample, Aggr, MetricEvent
from mcstat.stat import metrics
import select
import collections
import time
import logging
log = logging.getLogger('mcstat.core')
def receiver(channels, queue, wake_up_fd):
# Maps file descriptor... | {
"content_hash": "8ba628f42a5db0f3ae13ffeeb143e840",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 74,
"avg_line_length": 28.543478260869566,
"alnum_prop": 0.5346534653465347,
"repo_name": "mstarzyk/mcstat",
"id": "1124dd3f77046c3fc899b4bc231cdf2436df94d9",
"size": "2626... |
"""Centered finite differencing."""
import xarray as xr
from ..utils import wraparound
from . import FiniteDiff, BwdDiff, FwdDiff
class CenDiff(FiniteDiff):
"""Centered finite differencing."""
_MIN_SPACING_FACTOR = 2
_DIFF_BWD_CLS = BwdDiff
_DIFF_FWD_CLS = FwdDiff
def __init__(self, arr, dim, sp... | {
"content_hash": "a3d7c872c829f0b72db02587c967613a",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 78,
"avg_line_length": 42.80952380952381,
"alnum_prop": 0.5895439377085651,
"repo_name": "spencerahill/infinite-diff",
"id": "8d6aba538f9ea82f57fb0e94890368d7b7e143cf",
"si... |
from string import replace
import os, sys, shutil
from localizeUtils import *
STRINGS_FILE = 'Localizable.strings';
def usage():
print >>sys.stderr, 'Usage: python merge.py path-to-merge-with path-to-merge-from1 path-to-merge-from2 ...'
def mergeFiles(path, mergePath):
baseLanguages = [name for name in... | {
"content_hash": "5076dc3d7dc7ece029be9c0d441d3aec",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 191,
"avg_line_length": 36.65151515151515,
"alnum_prop": 0.5977676725919802,
"repo_name": "gamma/Localize",
"id": "c6d0a5d17503a2369529616d5ae76c7d65380dd3",
"size": "2555"... |
import re
import mock
import six
from ironic.common import exception
from ironic.tests import base
class Unserializable(object):
def __str__(self):
raise NotImplementedError('nostr')
class TestException(exception.IronicException):
_msg_fmt = 'Some exception: %(spam)s, %(ham)s'
class TestIronicE... | {
"content_hash": "080b165ab017669f6e88422fa9217724",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 79,
"avg_line_length": 37.145161290322584,
"alnum_prop": 0.611376465479809,
"repo_name": "jiazichenzhan/Server_Manage_Plugin",
"id": "17a80b9fed90f6b667be1b664ae2bb30c18d4168... |
from django.contrib import admin
from .models import AuthenticationSession
admin.site.register(AuthenticationSession)
| {
"content_hash": "0e67cb0c62e416941a1eefaf1d4404a7",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 42,
"avg_line_length": 24,
"alnum_prop": 0.8583333333333333,
"repo_name": "larserikgk/mobiauth-server",
"id": "fbf20c01ad1606a5277d4e9c531384bdf266da8d",
"size": "120",
"b... |
from django.db import models, migrations
from django.conf import settings
import django.core.validators
import markupfield.fields
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | {
"content_hash": "685c070462500bf1d1f869c393bffa2c",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 289,
"avg_line_length": 76.70769230769231,
"alnum_prop": 0.628158844765343,
"repo_name": "manhhomienbienthuy/pythondotorg",
"id": "56e8f9a803899106199ad35d92fa15aac5df1b27",
... |
"""
Utilities for applying a watermark to an image using PIL.
Original Source: http://code.activestate.com/recipes/362879/
"""
try:
from PIL import Image, ImageEnhance
except ImportError:
import Image, ImageEnhance
import random
import traceback
def _percent(var):
"""
Just a simple interface to the _v... | {
"content_hash": "185b9393d807318f290cf8b4e449ee5b",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 181,
"avg_line_length": 29.437246963562753,
"alnum_prop": 0.5589327465273002,
"repo_name": "pigletto/django-watermark",
"id": "b564b483c2a8e5bf49b7fa604c88814718c3d318",
"... |
from toontown.classicchars import DistributedPlutoAI
from toontown.hood import HoodAI
from toontown.safezone import DistributedTrolleyAI
from toontown.toonbase import ToontownGlobals
class BRHoodAI(HoodAI.HoodAI):
def __init__(self, air):
HoodAI.HoodAI.__init__(self, air,
To... | {
"content_hash": "3fa7a727ff3bfc98ae38aca18560ac67",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 74,
"avg_line_length": 34.114285714285714,
"alnum_prop": 0.6624790619765494,
"repo_name": "ToonTownInfiniteRepo/ToontownInfinite",
"id": "1974dc1952533ed6f5eebfc531c2d1f5912f... |
"""Test suites for the ITime processor implementation."""
import time as stdtime
import iface
import pytest
from asyncdef.interfaces.engine import itime
from . import time
@pytest.fixture(scope='function')
def processor():
"""Get a test processor."""
return time.Time()
def test_time_implements_interface... | {
"content_hash": "786a79a44ffb55d4b80ab0e2f751b9ca",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 63,
"avg_line_length": 25.415730337078653,
"alnum_prop": 0.6702033598585323,
"repo_name": "asyncdef/engine",
"id": "dcd2143234f05a7b52995274dbf62ae32812d4e3",
"size": "2262... |
import json
import os
def from_envvars(conf, prefix=None, envvars=None, as_json=True):
"""Load environment variables as Flask configuration settings.
Values are parsed as JSON. If parsing fails with a ValueError,
values are instead used as verbatim strings.
:param app: App, whose configuration shoul... | {
"content_hash": "3d902567a4b3c7b02911bf7329abb55e",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 74,
"avg_line_length": 36.37777777777778,
"alnum_prop": 0.6053756872327428,
"repo_name": "brettatoms/flask-appconfig",
"id": "57bb00d25d0f2519fc00aea95a215c3f251621a9",
"si... |
"""
magic is a wrapper around the libmagic file identification library.
See README for more information.
Usage:
>>> import magic
>>> magic.from_file("testdata/test.pdf")
'PDF document, version 1.2'
>>> magic.from_file("testdata/test.pdf", mime=True)
'application/pdf'
>>> magic.from_buffer(open("testdata/test.pdf").r... | {
"content_hash": "b14ae1ec90168e0049b1c7ad42c64138",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 86,
"avg_line_length": 29.678807947019866,
"alnum_prop": 0.6570344750641526,
"repo_name": "douban-code/python-magic",
"id": "bd621750642f4d730a9230a032a35b2b75940b89",
"si... |
from .code_generator import CodeGeneratorBase
| {
"content_hash": "c40286e61b6b7b1976fd6758caff132c",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 45,
"avg_line_length": 46,
"alnum_prop": 0.8695652173913043,
"repo_name": "GeosoftInc/gxapi",
"id": "c2a4eac4ddbf098d19976dc1e8835bcb9f36318d",
"size": "46",
"binary": fal... |
import numpy as np
class Board:
def __init__(self, size = (3, 3), array = None):
# if array == None:
if array is None:
self.board = np.zeros(size, dtype=np.int8)
else:
self.board = np.array(array, dtype=np.int8)
self.x_size = self.board.shape[0]
self.y_size = self.board.shape[1]
... | {
"content_hash": "5b36c0a776df33ed89a97388e51d9ea2",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 91,
"avg_line_length": 32.016129032258064,
"alnum_prop": 0.5954659949622166,
"repo_name": "scooler/tic-tac-toe",
"id": "5796d09017d7a05994a37f08c6ff7a401cb82d2e",
"size": "... |
from pkg_resources import get_distribution
import sys, os
import urllib
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.... | {
"content_hash": "10ad37b1ec18f1820dcc390d0d4c0886",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 80,
"avg_line_length": 31.43295019157088,
"alnum_prop": 0.6961238420282789,
"repo_name": "GrimDerp/gcloud-python",
"id": "f4bac42a91f88787fb9f02c123318f55364e0cfc",
"size"... |
'An app that allows delete objects but preserve them on the database'
__version__ = '2.0.5' | {
"content_hash": "51eac46e8373d4d0b261108875f09dea",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 69,
"avg_line_length": 30.666666666666668,
"alnum_prop": 0.717391304347826,
"repo_name": "angvp/django-logical-delete",
"id": "f2a02f0f3f2ff6473ee06d9a159a479fbc7d4cbf",
"si... |
import parmed.unit as units
import intermol.forces.forcedata as forcedata
"""
functions for manipulating the data to extract keywords and unit-ed parameter lists from forces,
name in code example description
force_type - HarmonicBondType - class, contains atom t... | {
"content_hash": "8f17a60ee1bf174ad67919db8bc6dc08",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 111,
"avg_line_length": 34.57435897435897,
"alnum_prop": 0.6566300800949273,
"repo_name": "mrshirts/InterMol",
"id": "08d158d3e91ff526c6c7ba62c416fafd8e7705d3",
"size": "6... |
import sys
import getopt
import os
import string
import user
sys.path.append(user.home+'/Library/PythonFiles')
import mylib1,mylib2,mylib3
import eplus2,time
import cPickle
def nocomment(st,com):
"""
just like the comment in python.
removes any text after the phrase 'com'
"""
ls=st.splitlines()
for i in range(... | {
"content_hash": "915baa13e531214ef393c02b9f316ded",
"timestamp": "",
"source": "github",
"line_count": 321,
"max_line_length": 90,
"avg_line_length": 22.766355140186917,
"alnum_prop": 0.6250684181718664,
"repo_name": "santoshphilip/EPlusInterface_original",
"id": "e815e2fc5448ba72002d17cdc5d6cd1addb... |
import unittest
from streamlink.logger import Logger
from streamlink.compat import is_py2
# Docs says StringIO is suppose to take non-unicode strings
# but it doesn't, so let's use BytesIO instead there...
if is_py2:
from io import BytesIO as StringIO
else:
from io import StringIO
class TestSession(unittest... | {
"content_hash": "4dcf690289082a2d5f9aaece7abcccda",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 72,
"avg_line_length": 27.857142857142858,
"alnum_prop": 0.6533333333333333,
"repo_name": "ethanhlc/streamlink",
"id": "e3137573ce54e0f0832734e564c3fa176662e9e7",
"size": "... |
import random
def get_random_filename(nb=50):
choices = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
return "".join([random.choice(choices) for i in range(nb)]) | {
"content_hash": "3f82c28d8f6051fdc990aae82eb6bceb",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 75,
"avg_line_length": 30.666666666666668,
"alnum_prop": 0.7989130434782609,
"repo_name": "charlesthk/django-nightmare-pdf",
"id": "1285a1cb6887c0a54d363dc7a009ebd607976ab5",
... |
"""
The eigenvalue method of Silver and Chan (1991)
Uses Pair to do high level work
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from ..core import core,io
from ..core.pair import Pair
from ..core.window import Window
from .measure import Measure
# f... | {
"content_hash": "631aecd05f40493af94740f2a0925cee",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 96,
"avg_line_length": 27.88235294117647,
"alnum_prop": 0.5358649789029536,
"repo_name": "JackWalpole/splitwavepy",
"id": "748cbda33f92cd27ea35bd19a6057da825536c53",
"size... |
"""
The I{soaparray} module provides XSD extensions for handling
soap (section 5) encoded arrays.
"""
from suds import *
from logging import getLogger
from suds.xsd.sxbasic import Factory as SXFactory
from suds.xsd.sxbasic import Attribute as SXAttribute
class Attribute(SXAttribute):
"""
Represents an XSD <a... | {
"content_hash": "31d1f6260642b166c7544745010c8d31",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 60,
"avg_line_length": 25.545454545454547,
"alnum_prop": 0.6241992882562277,
"repo_name": "c2theg/DDoS_Infomation_Sharing",
"id": "ea04fa7add0d7595b10ae4cdd9e09ea26ef05fc0",
... |
from matplotlib import pyplot as plt, patches
from scipy.spatial import distance
from sklearn.manifold import MDS
import numpy as np
import os
import basics
import rater_analysis
import svg_polygons
import Voronoi
import geometry
# Globals
label_font_size = 10 # points
axis_font_size = 8 # points
legend_font_size = 1... | {
"content_hash": "279c63c02e8ddd413098cb44567c5c29",
"timestamp": "",
"source": "github",
"line_count": 458,
"max_line_length": 238,
"avg_line_length": 40.096069868995635,
"alnum_prop": 0.6892289261598781,
"repo_name": "jwcarr/flatlanders",
"id": "c14834c70a1dc8e2dfd2594c73df7c592b61ce61",
"size": ... |
"""
Product tests for generating an online and offline installer for presto-admin
"""
import subprocess
import os
import fnmatch
import re
from nose.plugins.attrib import attr
from prestoadmin import main_dir
from tests.docker_cluster import DockerCluster
from tests.product.base_product_case import BaseProductTestCase... | {
"content_hash": "227ac99d04d1ef421eedc7788c6fe406",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 78,
"avg_line_length": 40.8921568627451,
"alnum_prop": 0.5698873171901223,
"repo_name": "Svjard/presto-admin",
"id": "20f92e0275ab326984df75bb30c5fc02f86fdcf7",
"size": "4... |
import unittest
from cvra_bootloader.page import *
class PaginationTestCase(unittest.TestCase):
def test_smaller_than_page_is_yielded(self):
"""
Tests that a page smaller than the page size is yielded entierly.
"""
b = bytes([1])
p = slice_into_pages(b, page_size=4)
... | {
"content_hash": "453593351baece2191e817e836a3b1e6",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 73,
"avg_line_length": 32.32,
"alnum_prop": 0.594059405940594,
"repo_name": "cvra/can-bootloader",
"id": "17305213500f770288fc5652f29db78c8863df55",
"size": "808",
"binar... |
import os
import glob
import pickle
import numpy as np
import gzip
import struct
def one_hotify(labels, nb_classes=None):
'''
Converts integer labels to one-hot vectors.
Arguments:
labels: numpy array containing integer labels. The labels must be in
range [0, num_labels - 1].
Returns:... | {
"content_hash": "eaf6138b55333adb6db0f169f99542b9",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 80,
"avg_line_length": 38.079754601226995,
"alnum_prop": 0.6302561623972934,
"repo_name": "robertomest/convnet-study",
"id": "43a358a038c304218a03cc20fbc7f3a12fed809a",
"s... |
import time
from textmagic.test import TextMagicTestsBase
from textmagic.client import StatusCallbackResponse
from textmagic.client import ReplyCallbackResponse
from textmagic.test import gmtime_from_localtime
class CallbackUrlTests(TextMagicTestsBase):
def testStatusCallback(self):
post_params = {
... | {
"content_hash": "4af0df84ee9ad9da8d78d93e7f1ba68c",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 76,
"avg_line_length": 42.42622950819672,
"alnum_prop": 0.6329211746522411,
"repo_name": "textmagic/textmagic-sms-api-python",
"id": "45bb7cd4e928c3c9ec1128a70da59ac0ac7b9948... |
"""Support for Lagute LW-12 WiFi LED Controller."""
import logging
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_EFFECT, ATTR_HS_COLOR, ATTR_TRANSITION,
Light, PLATFORM_SCHEMA, SUPPORT_BRIGHTNESS, SUPPORT_EFFECT,
SUPPORT_COLOR, SUPPORT_TRANSITION
)
from homea... | {
"content_hash": "1a90780cd9eaa86796163385c2fbed4b",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 74,
"avg_line_length": 32.019867549668874,
"alnum_prop": 0.5993795243019648,
"repo_name": "molobrakos/home-assistant",
"id": "a2ff77dc2d0fda4a59782844dba21a97ac571621",
"s... |
from __future__ import print_function
import releaseCommon
v = releaseCommon.Version()
v.incrementMajorVersion()
releaseCommon.performUpdates(v)
print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) )
| {
"content_hash": "dcf2e2cd7699deacb902afeb1f586f99",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 87,
"avg_line_length": 29.625,
"alnum_prop": 0.7679324894514767,
"repo_name": "Teaonly/easyLearning.js",
"id": "8da34066c53c5bd151fc40482353bc461c8a9da9",
"size": "260",
"... |
"""The Query class and support.
Defines the :class:`.Query` class, the central
construct used by the ORM to construct database queries.
The :class:`.Query` class should not be confused with the
:class:`.Select` class, which defines database
SELECT operations at the SQL (non-ORM) level. ``Query`` differs from
``Selec... | {
"content_hash": "8648fef546c604201ab9bb413f6afb6d",
"timestamp": "",
"source": "github",
"line_count": 4156,
"max_line_length": 102,
"avg_line_length": 36.82074109720885,
"alnum_prop": 0.57534291334209,
"repo_name": "noxora/flask-base",
"id": "2fae36272b614132d416be66f2ea4980a2eb91c9",
"size": "15... |
from __future__ import division
from vistrails.core.modules.vistrails_module import ModuleError
from fold import Fold, FoldWithModule
#################################################################################
## Some useful loop structures
class Map(FoldWithModule):
"""A Map module, that just appends the ... | {
"content_hash": "e2fd73f100f2e62cb8da22cd64252df0",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 99,
"avg_line_length": 35.6137339055794,
"alnum_prop": 0.4546878765967703,
"repo_name": "hjanime/VisTrails",
"id": "09a706f55a7ce1c65e36fba6dbeef2b24a25c76d",
"size": "102... |
import _init_paths
import cv2
import time
import argparse
import logging
import pprint
import os
import sys
from config.config import config, update_config
def parse_args():
parser = argparse.ArgumentParser(description='Train Faster-RCNN network')
# general
parser.add_argument('--cfg', help='experiment co... | {
"content_hash": "42dd597d489261d96b13b48c578af71e",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 152,
"avg_line_length": 45.54375,
"alnum_prop": 0.6864278852751475,
"repo_name": "msracver/Deformable-ConvNets",
"id": "6deac438b10678ce29c40a9e6a8c1975ce5e7a26",
"size": ... |
"""Abstract base class and null boundary condition class for
conveniently making compliant boundary condition classes for use in
wepy.
"""
import sys
import logging
from copy import deepcopy
from collections import defaultdict
import random
import numpy as np
from wepy.walker import Walker
class BoundaryConditions... | {
"content_hash": "585e9c854651c5931fc93e869a1d34a6",
"timestamp": "",
"source": "github",
"line_count": 553,
"max_line_length": 88,
"avg_line_length": 31.531645569620252,
"alnum_prop": 0.6464414750243734,
"repo_name": "ADicksonLab/wepy",
"id": "01364b92040f7dfce7eeb3f86c3cbb05805ab470",
"size": "17... |
from django.dispatch import Signal
user_logged_in = Signal(providing_args=["request", "user"])
user_logged_out = Signal(providing_args=["request", "user"])
# Typically followed by `user_logged_in` (unless, e-mail verification kicks in)
user_signed_up = Signal(providing_args=["request", "user"])
password_set = Signal... | {
"content_hash": "98378d287319e551ea3596bdb9acbcc3",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 79,
"avg_line_length": 46.578947368421055,
"alnum_prop": 0.7028248587570621,
"repo_name": "patricio-astudillo/django-allauth",
"id": "c54f05d14ff12b5585896e170022de3d0639c969... |
import os, sys
from fig import *
config = r"""
[layout]
style layout
horizontalBalance 0
rootPadX 80
nodePadX 80
nodePadY 10
branchPadY 10
radialMinNodes 1000
sameWidthSiblings no
snap... | {
"content_hash": "8d6434133e3e18323fc563ae45a6779b",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 45,
"avg_line_length": 22.054545454545455,
"alnum_prop": 0.46331409727947237,
"repo_name": "johnnovak/twyg",
"id": "6e89b83e0c3a80b710c3df148b2d96524047b7a8",
"size": "1213... |
"""
These consumers handle our chat communications over a websocket.
"""
import hashlib
import json
from channels import Channel, Group
from channels.sessions import enforce_ordering
from channels.auth import channel_session_user, channel_session_user_from_http
from django.contrib.auth import get_user_model
from dja... | {
"content_hash": "507734639497e1ee1ea34059f8ca0cd9",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 82,
"avg_line_length": 34.27322404371585,
"alnum_prop": 0.5913584183673469,
"repo_name": "izzyalonso/tndata_backend",
"id": "a234327491b0d56cdae2c556f626101384a88deb",
"si... |
from functools import singledispatch, wraps
import stl
from optlang import Constraint, Variable
from magnum.constraint_kinds import Kind as K
eps = 1e-7
M = 1000 # TODO
def counter(func):
i = 0
@wraps(func)
def _func(*args, **kwargs):
nonlocal i
i += 1
return func(*args, i=i, *... | {
"content_hash": "c057407fa98df697eb9a69b85b7fdaa2",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 73,
"avg_line_length": 25.431818181818183,
"alnum_prop": 0.5786416443252904,
"repo_name": "mvcisback/py-blustl",
"id": "de8d8181de61e8900f74321c2a9f13e103f91f93",
"size": "... |
from __future__ import print_function
import numpy as np
import argparse
import time
import math
import paddle
import paddle.fluid as fluid
import paddle.fluid.profiler as profiler
from paddle.fluid import core
import unittest
from multiprocessing import Process
import os
import signal
from functools import reduce
fr... | {
"content_hash": "14edcc3607f0ff1f2c0535647a62ca12",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 89,
"avg_line_length": 30.54237288135593,
"alnum_prop": 0.6853496115427303,
"repo_name": "tensor-tang/Paddle",
"id": "977e17c37f7676ae81d9ab29b6b36089ccbeeacf",
"size": "24... |
from util import serialize
from models import BotIdentity, BotRank
class DisplayBot(object):
"""A BotIdentity with some relevant joins"""
def __init__(self, bot_id):
self.bot = BotIdentity.query.get(bot_id)
rank = BotRank.query.get(bot_id)
self.rank = rank.rank if rank else None
d... | {
"content_hash": "b8d6dff8a1823765a7ef11f34c8da269",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 56,
"avg_line_length": 26.4,
"alnum_prop": 0.5863636363636363,
"repo_name": "gnmerritt/casino",
"id": "891241a9b6996b93d1775a2dde8cb15ee60be8df",
"size": "660",
"binary":... |
import argparse
import json
import os
import logging
from c7n.credentials import SessionFactory
from c7n.policy import load as policy_load
from c7n import mu, resources
from botocore.exceptions import ClientError
log = logging.getLogger('resources')
def load_policies(options):
policies = []
for f in option... | {
"content_hash": "19cd2ca2eadf168ed113269c62eef012",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 82,
"avg_line_length": 32.37313432835821,
"alnum_prop": 0.5975103734439834,
"repo_name": "jimmyraywv/cloud-custodian",
"id": "50d43acf89dff6698601d41019b71e5e526683a4",
"s... |
"""The Representation base class."""
class Repr(object):
"""The Representation base class."""
def __repr__(self):
return "{}({})".format(self.__class__.__name__, super(Repr, self).__repr__())
def __str__(self):
return self.__repr__()
| {
"content_hash": "65436950d53e0764286304120f0c4ab1",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 85,
"avg_line_length": 32.875,
"alnum_prop": 0.5475285171102662,
"repo_name": "hellerve/hawkweed",
"id": "ff3b611e8f198e7137d2689ee3e2312362c9937f",
"size": "263",
"binary... |
"""Statistics utility functions of NCF."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
def random_int32():
return np.random.randint(low=0, high=np.iinfo(np.int32).max, dtype=np.int32)
def permutation(args):
"""Fork ... | {
"content_hash": "04a8631a63bc1015b2d7f33f5fa57cc6",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 80,
"avg_line_length": 31.923076923076923,
"alnum_prop": 0.6943775100401607,
"repo_name": "tombstone/models",
"id": "658a2721e98a88d71dc2ac4562366283ffd2fc47",
"size": "317... |
from __future__ import absolute_import
from surveymonkey.surveymonkey import BaseConfig
class EmailConfig(BaseConfig):
def __init__(self, **kwargs):
super(EmailConfig, self).__init__(**kwargs)
self.type = "email"
class WeblinkConfig(BaseConfig):
def __init__(self, **kwargs):
super(W... | {
"content_hash": "72431b670ff146971bde10de59de2fa8",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 53,
"avg_line_length": 22.043478260869566,
"alnum_prop": 0.6390532544378699,
"repo_name": "Administrate/surveymonkey",
"id": "808204bf3fb304da113c043b0c7c26c972ea2bde",
"si... |
from pyflink.ml.api.ml_environment_factory import MLEnvironmentFactory, MLEnvironment
from pyflink.testing.test_case_utils import MLTestCase
class MLEnvironmentFactoryTest(MLTestCase):
def test_get_default(self):
ml_env1 = MLEnvironmentFactory.get_default()
ml_env2 = MLEnvironmentFactory.get_defa... | {
"content_hash": "d8bb99f6c9f47fe3ca0faab13ce516e2",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 85,
"avg_line_length": 39.93333333333333,
"alnum_prop": 0.6936560934891486,
"repo_name": "tzulitai/flink",
"id": "7f381d1b37049b702dbb84f6849ca062e4a7b0a9",
"size": "2157",... |
"""
Artwork template production
@todo: Comment on idiocyncrasies of the input json and the need to look things
up on wikidata.
"""
import batchupload.helpers as helpers
import batchupload.common as common # temp before this is merged with helper
from batchupload.make_info import MakeBaseInfo
import os
import re
impor... | {
"content_hash": "ec8a134ee112d7224c9e31f5bb55db6e",
"timestamp": "",
"source": "github",
"line_count": 1266,
"max_line_length": 219,
"avg_line_length": 35.791469194312796,
"alnum_prop": 0.5330376059322034,
"repo_name": "lokal-profil/upload_batches",
"id": "e3a6ade13c3f84df8fb912e65dbcd283ba214a18",
... |
"""Tests for tensorflow.python.framework.ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gc
import weakref
from tensorflow.core.framework import attr_value_pb2
from tensorflow.core.framework import types_pb2
from tensorflow.core.protobuf imp... | {
"content_hash": "1077bc2017fc5280127a86a66cafef49",
"timestamp": "",
"source": "github",
"line_count": 1891,
"max_line_length": 80,
"avg_line_length": 37.69487043892121,
"alnum_prop": 0.61866416015488,
"repo_name": "xuleiboy1234/autoTitle",
"id": "4cbb9deed7b3bb90c29967766a3f64bfe2f936e1",
"size":... |
import datetime
import sys
from pyspark.sql import Row
from pyspark.sql.functions import udf, input_file_name
from pyspark.testing.sqlutils import ReusedSQLTestCase
class FunctionsTests(ReusedSQLTestCase):
def test_explode(self):
from pyspark.sql.functions import explode, explode_outer, posexplode_outer... | {
"content_hash": "7c521b9466246908e8a8a7d697b03d4a",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 98,
"avg_line_length": 43.009009009009006,
"alnum_prop": 0.5659125820416143,
"repo_name": "darionyaphet/spark",
"id": "fa9ee57ff5f90c727c88caf7c03a6d440ad92ac4",
"size": "... |
DEFAULT_URL = "http://myslice.onelab.eu:7080"
DEFAULT_PLATFORM = 'ple'
# starting with 2.7.9 we need to turn off server verification
import ssl
ssl_needs_unverified_context = hasattr(ssl, '_create_unverified_context')
import xmlrpclib
import getpass
class ManifoldUploader:
"""A utility class for uploading delega... | {
"content_hash": "bc7bb29b900200277d398aebf0e22a34",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 118,
"avg_line_length": 44.3445945945946,
"alnum_prop": 0.5884504037787597,
"repo_name": "yippeecw/sfa",
"id": "8354e1efa160e20aa8b1875255ad072bc3c09c73",
"size": "7591",
... |
import wx
import wx.lib.newevent
from atom.api import Typed
from enaml.widgets.menu import ProxyMenu
from .wx_action import WxAction, EVT_ACTION_CHANGED
from .wx_action_group import WxActionGroup
from .wx_toolkit_object import WxToolkitObject
#: An event emitted when the menu state changes.
wxMenuChangedEvent, EVT... | {
"content_hash": "9e45482047046a80abf844dee5392162",
"timestamp": "",
"source": "github",
"line_count": 721,
"max_line_length": 79,
"avg_line_length": 31.439667128987516,
"alnum_prop": 0.5330421739897653,
"repo_name": "ContinuumIO/ashiba",
"id": "7623bb9b5d6e1cd1712a5f1b71e12f050549c054",
"size": "... |
import _plotly_utils.basevalidators
class ItemsizingValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="itemsizing", parent_name="layout.legend", **kwargs):
super(ItemsizingValidator, self).__init__(
plotly_name=plotly_name,
parent_name=pare... | {
"content_hash": "4b9ccf3f98d878bc2c099951bfe156cc",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 88,
"avg_line_length": 40.53846153846154,
"alnum_prop": 0.6129032258064516,
"repo_name": "plotly/python-api",
"id": "d8fd9e50e96d9ab152da8df5ba7e6be011c4820b",
"size": "527... |
from django import forms
from ..models import ConsultaEmergencia
class ConsultaEmergenciaForm(forms.ModelForm):
"""Class ConsultaEmergenciaForm."""
class Meta:
model = ConsultaEmergencia
exclude = ('',)
widgets = {
'historia': forms.Select(attrs={'class': 'form-control', 'r... | {
"content_hash": "c046f974101424a98947db39240f14bf",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 88,
"avg_line_length": 28.916666666666668,
"alnum_prop": 0.6368876080691642,
"repo_name": "upeu-jul-20161-epis-ads2/MedicFast",
"id": "6d763fdc94a9ba81342ee6bca338eb4c3e0130c... |
"""
DotnetCoreCommon
Common code associated with the dotnet core cli tool
"""
import os, sys, os.path as path
import SCons.Script
from SCons.Environment import Environment
from SCons.Script import File, Dir
def detect(env):
"""Detect if dotnet exe is detected on the system, or use user specified op... | {
"content_hash": "54372871e3f314c772d92ecac0dd64e5",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 128,
"avg_line_length": 45.735849056603776,
"alnum_prop": 0.6687293729372937,
"repo_name": "ASoftTech/Scons-Tools-Grbd",
"id": "394849664f976c1c6226614475b81a17fcfdd815",
"... |
import contextlib
import errno
import functools
import os
import threading
import time
import weakref
from oslo.config import cfg
from nova.openstack.common import fileutils
from nova.openstack.common.gettextutils import _ # noqa
from nova.openstack.common import local
from nova.openstack.common import log as loggin... | {
"content_hash": "17207cc800ec9442a05b7172de43be1f",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 78,
"avg_line_length": 33.753846153846155,
"alnum_prop": 0.6009571558796718,
"repo_name": "imsplitbit/nova",
"id": "b53a828391f7cf8bf6cba822d33f81067dca46f7",
"size": "945... |
from __future__ import unicode_literals
MESSAGES = {
"%d min remaining to read": "Il reste encore %d min. de lecture",
"(active)": "(actif)",
"Also available in:": "Également disponible en :",
"Archive": "Archives",
"Authors": "Auteurs",
"Categories": "Catégories",
"Comments": "Commentaires... | {
"content_hash": "8d17e2532f01ce226423abfc5dd3b8c4",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 74,
"avg_line_length": 36.854166666666664,
"alnum_prop": 0.5850763143018655,
"repo_name": "andredias/nikola",
"id": "905fdf926a0fc035160c15bc693a2671c97eef8d",
"size": "181... |
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.db import models
from django.test import TestCase, TransactionTestCase
from django_dynamic_fixture import G
from mock import patch, MagicMock
from activatable_model import BaseActivatableModel, mod... | {
"content_hash": "d5ca3c50f4730e9acca2827cb37728e3",
"timestamp": "",
"source": "github",
"line_count": 358,
"max_line_length": 120,
"avg_line_length": 46.07821229050279,
"alnum_prop": 0.6958050436469447,
"repo_name": "wesleykendall/django-activatable-model",
"id": "aea422b74156544cb5ab8b30142db65702... |
"""Baremetal DB utils for test."""
from nova import context as nova_context
from nova import flags
from nova import test
from nova.virt.baremetal import bmdb
from nova.virt.baremetal.bmdb.sqlalchemy import baremetal_models
flags.DECLARE('baremetal_sql_connection',
'nova.virt.baremetal.bmdb.sqlalchemy.ba... | {
"content_hash": "8587f59662db028d3683d2b9cd88a35d",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 76,
"avg_line_length": 35.8,
"alnum_prop": 0.6679081315952824,
"repo_name": "NoBodyCam/TftpPxeBootBareMetal",
"id": "5651b5b5daf21913dd941d435f82a53455091076",
"size": "224... |
from twilio.twiml.voice_response import Dial, VoiceResponse, Sip
response = VoiceResponse()
dial = Dial()
dial.sip('sip:kate@example.com?mycustomheader=foo&myotherheader=bar')
response.append(dial)
print(response)
| {
"content_hash": "5deef4f0e2019570f95e9ee30847404e",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 69,
"avg_line_length": 27,
"alnum_prop": 0.7916666666666666,
"repo_name": "teoreteetik/api-snippets",
"id": "9344bc3a6202070eab7c2a0e703c0315117aeca5",
"size": "216",
"bin... |
import sys
import re
import os
import shutil
import commands
"""Copy Special exercise
"""
# +++your code here+++
# Write functions and modify main() to call them
def get_special_paths(dir):
"""
returns a list of absolute paths of special files in the given dir
"""
result = []
filenames = os.li... | {
"content_hash": "f59d4742abd9466187f12b839ffa7968",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 74,
"avg_line_length": 24.413793103448278,
"alnum_prop": 0.5856873822975518,
"repo_name": "yangjin-unique/Google_Python_Class",
"id": "2aa060d475e37c2f394460f99572a549dc652c7... |
from django.shortcuts import render, render_to_response
from django.http import HttpResponse
from django.views.generic import TemplateView
class HomeView(TemplateView):
template_name = 'morado/index.html'
#def home(request):
# context = {}
# return render_to_response('morado/index.html')
# def task... | {
"content_hash": "ece9f06e0d91451856892d5e6e277ca2",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 55,
"avg_line_length": 24,
"alnum_prop": 0.7205882352941176,
"repo_name": "gsvaldes/toronjil",
"id": "b6b8e8c169367194437334a70b78baf4965b1287",
"size": "408",
"binary": ... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from matplotlib.externals import six
from mpl_toolkits.axisartist.angle_helper import *
| {
"content_hash": "9b9b52f2f5c2b2ca274a5e225e72b3b4",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 66,
"avg_line_length": 33.166666666666664,
"alnum_prop": 0.7035175879396985,
"repo_name": "yuanagain/seniorthesis",
"id": "259918a1a1d885a8ecdf23dbf315161731c75409",
"size":... |
from __future__ import absolute_import
from nearpy.examples.example1 import example1
from nearpy.examples.example2 import example2
| {
"content_hash": "0b7841a7bfe755a93960c7978705a77e",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 45,
"avg_line_length": 33,
"alnum_prop": 0.8333333333333334,
"repo_name": "nguyenhoan1988/NearPy",
"id": "6181cfb85f53d500b7daf7bdfb8f11e06936008b",
"size": "1253",
"binar... |
from os import path
from text_formatter import TextFormatter
class Reporter:
def __init__(self, base_dir='./', default_formatter=TextFormatter()):
self.base_dir = base_dir
self.formatters = [default_formatter]
def generate(self, profiles):
for formatter in self.formatters:
report_file_path = pa... | {
"content_hash": "a10e47ded9691cb56d46a70b6dade63e",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 79,
"avg_line_length": 29.875,
"alnum_prop": 0.6861924686192469,
"repo_name": "drborges/pyprofiler",
"id": "d0695ee61f1aeac5df62edf3759d365c2b90b043",
"size": "478",
"bin... |
"""
This script executes the task of estimating the type of an archaeological feature, based solely on the geometry for
that feature. The data for this script can be found at http://hdl.handle.net/10411/GYPPBR.
"""
import os
import socket
import sys
from datetime import datetime, timedelta
from pathlib import Path
fro... | {
"content_hash": "697e09f37b0b8ae3e9f949ed9774a521",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 115,
"avg_line_length": 39.58011049723757,
"alnum_prop": 0.6842546063651591,
"repo_name": "reinvantveer/Topology-Learning",
"id": "9776af47390e77366ce742f98b8d5693c10425c5",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.