text stringlengths 4 1.02M | meta dict |
|---|---|
"""Defines `{Additive,Multiplicative}SwapRegretOptimizer`s.
These optimizers minimize a `ConstrainedMinimizationProblem` by using a
swap-regret minimizing algorithm (either SGD or multiplicative weights) to learn
what weights should be associated with the objective function and constraints.
These algorithms do *not* u... | {
"content_hash": "23e9be95255ddc6c1313410a49001e17",
"timestamp": "",
"source": "github",
"line_count": 581,
"max_line_length": 84,
"avg_line_length": 42.28743545611015,
"alnum_prop": 0.7031625218771623,
"repo_name": "manipopopo/tensorflow",
"id": "ff846b191a34e3f3b4aa35671ca22b96b963db80",
"size":... |
"""Python protoc plugin for Envoy APIs."""
import sys
from collections import namedtuple
from tools.api_proto_plugin import traverse
from google.protobuf.compiler import plugin_pb2
OutputDescriptor = namedtuple(
'OutputDescriptor',
[
# Output files are generated alongside their corresponding input .... | {
"content_hash": "02c4be1cea34b64b8d71fbe31a1f16b0",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 94,
"avg_line_length": 40.74647887323944,
"alnum_prop": 0.6768060836501901,
"repo_name": "envoyproxy/envoy",
"id": "2ae9dfb44fc928b3d67d1a73c351f8b051fc5385",
"size": "2893... |
class SWIGInterfaceParser(object):
def __init__(self):
self.ignored = []
def parse(self, interface_path):
pass
| {
"content_hash": "36a4d872fc4c9311f85606a287c486e0",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 36,
"avg_line_length": 22.666666666666668,
"alnum_prop": 0.5955882352941176,
"repo_name": "rokups/Urho3D",
"id": "0e8273e3aa2a515999d3e98e80f26b8fd2c0e5cd",
"size": "137",
... |
import abc
import six
import eventlet
__all__ = [
'Sensor',
'PollingSensor'
]
@six.add_metaclass(abc.ABCMeta)
class BaseSensor(object):
"""
Base Sensor class - not to be instantiated directly.
"""
def __init__(self, sensor_service, config=None):
self._sensor_service = sensor_service... | {
"content_hash": "b96bb228a0307b68a5f75dec5a9af7e4",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 89,
"avg_line_length": 20.894736842105264,
"alnum_prop": 0.5646515533165407,
"repo_name": "jtopjian/st2",
"id": "9c801f5856ad2b19d2113333e80abefa20bf9f6a",
"size": "2382",... |
import datetime
from itertools import chain
import re
from py4j.protocol import Py4JJavaError
from pyspark.sql import Row, Window
from pyspark.sql.functions import udf, input_file_name, col, percentile_approx, \
lit, assert_true, sum_distinct, sumDistinct, shiftleft, shiftLeft, shiftRight, \
shiftright, shiftr... | {
"content_hash": "556761705dab17537ba3319c5b87e1b3",
"timestamp": "",
"source": "github",
"line_count": 677,
"max_line_length": 99,
"avg_line_length": 40.42688330871492,
"alnum_prop": 0.5407212539734736,
"repo_name": "milliman/spark",
"id": "082d61b732429e3f56e4b2e8e173fb33473e016e",
"size": "28154... |
import redis
# r_server = redis.Redis("211.155.92.154")
r_server = redis.Redis("121.40.202.173")
r_server.delete("esribbs:static")
with open("init-redis/data/esribbs.txt") as sites:
urls = sites.read().splitlines()
for url in urls:
r_server.sadd("esribbs:static", url)
r_server.delete("esribbs:start_u... | {
"content_hash": "227b9ee269dace06646a09c82df9648c",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 50,
"avg_line_length": 28.8,
"alnum_prop": 0.6875,
"repo_name": "NoahKow/ziwuquan",
"id": "a70ee26814707abbb9d89c3df5ff4415ec9b1273",
"size": "451",
"binary": false,
"c... |
import tensorflow as tf
from preprocessing import crop
MEAN = tf.constant([123.68, 116.78, 103.94], dtype=tf.float32) # IMAGENET
def preprocess_image(image, output_height, output_width, is_training=False):
# Crop
img_crop = crop.preprocess_image(image, output_height, output_width, is_training)
# ... | {
"content_hash": "97a8397cbf53dddaefd69e433776a5ca",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 85,
"avg_line_length": 37.53333333333333,
"alnum_prop": 0.7069271758436945,
"repo_name": "pjaehrling/finetuneAlexVGG",
"id": "0bba09656675dffa7760dff51cc21e2628d22a93",
"si... |
"""Global database feature support policy.
Provides decorators to mark tests requiring specific feature support from the
target database.
External dialect test suites should subclass SuiteRequirements
to provide specific inclusion/exlusions.
"""
from . import exclusions, config
class Requirements(object):
def... | {
"content_hash": "a913db7e7818185c4cba66de2e8175c6",
"timestamp": "",
"source": "github",
"line_count": 443,
"max_line_length": 89,
"avg_line_length": 27.87133182844244,
"alnum_prop": 0.6341621446505223,
"repo_name": "davidvon/pipa-pay-server",
"id": "f89d469eaf1ccb4290fdde2cbef7220d81927a03",
"siz... |
"""SCons.Tool.FortranCommon
Stuff for processing Fortran, common to all fortran dialects.
"""
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 So... | {
"content_hash": "f5171373a9510892f56869f627149e7a",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 163,
"avg_line_length": 38.376344086021504,
"alnum_prop": 0.6636779676846922,
"repo_name": "pzajda/eloquence",
"id": "cf6486880096109cb13e13f4741bbd98d5926d84",
"size": "1... |
import hmac
from hashlib import sha256
from flask import current_app
from freight.testutils import TestCase
class WebhooksViewTest(TestCase):
def make_path(self, hook, action, app, env="production", digest=None):
key = f"{hook}/{action}/{app}/{env}"
if digest is None:
api_key = curre... | {
"content_hash": "101685cc8c33bfe886183ce092831733",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 75,
"avg_line_length": 33.03225806451613,
"alnum_prop": 0.6015625,
"repo_name": "getsentry/freight",
"id": "9d74fad39ae76ddee3dac86d72398d8bffe7c6ec",
"size": "1024",
"bi... |
from enum import Enum
from typing import Callable
from cryptography.hazmat.primitives import hashes
from .exceptions import InvalidInput
class SignatureConstructionMethod(Enum):
"""
An enumeration of signature construction methods supported by SignXML, used to specify the method when signing.
See the li... | {
"content_hash": "c9494fd7bcca3916bf9403a4c4a64ab8",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 120,
"avg_line_length": 48.4320987654321,
"alnum_prop": 0.7165434616365026,
"repo_name": "XML-Security/signxml",
"id": "24fe6ca3028e5618a33f6eb47497d65874eb3549",
"size": ... |
import sys
from _lsprof import Profiler, profiler_entry
__all__ = ['profile', 'Stats']
def profile(f, *args, **kwds):
"""XXX docstring"""
p = Profiler()
p.enable(subcalls=True, builtins=True)
try:
f(*args, **kwds)
finally:
p.disable()
return Stats(p.getstats())
class Stats(ob... | {
"content_hash": "b46d4bb5800b74f5728088772eabb08d",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 77,
"avg_line_length": 33.5045045045045,
"alnum_prop": 0.49152998117773594,
"repo_name": "joewalnes/idea-community",
"id": "5235a598e7cdd4906468290e276f78fb0822f1fb",
"siz... |
"""
Support for MySensors switches.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.mysensors/
"""
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components import mysensors
from homeassistant.comp... | {
"content_hash": "b1645c150b3f0b8a055dda62197b932c",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 74,
"avg_line_length": 37.22666666666667,
"alnum_prop": 0.629297994269341,
"repo_name": "persandstrom/home-assistant",
"id": "20e50518df8e52cbf11b3f784db8a1623b90dd44",
"s... |
import pytest
import serial
from pymeasure.adapters import SerialAdapter
def make_adapter(**kwargs):
return SerialAdapter(serial.serial_for_url("loop://", **kwargs))
@pytest.mark.parametrize("msg", ["OUTP\n", "POWER 22 dBm\n"])
def test_adapter_write(msg):
adapter = make_adapter(timeout=0.2)
adapter.wri... | {
"content_hash": "6e83b25416ec749edb8c9aad5b614684",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 95,
"avg_line_length": 36.82608695652174,
"alnum_prop": 0.6635182998819362,
"repo_name": "ralph-group/pymeasure",
"id": "53a6593c38119e24297f425f4745b790a7582206",
"size": ... |
"""
This test checks that blocks containing segwit recovery transactions will be accepted,
that segwit recovery transactions are rejected from mempool acceptance (even with
-acceptnonstdtxn=1), and that segwit recovery transactions don't result in bans.
"""
import time
from typing import Optional, Sequence
from test_... | {
"content_hash": "22f2612ac0826a0aa0e386984cd51075",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 132,
"avg_line_length": 41.699551569506724,
"alnum_prop": 0.619528981610926,
"repo_name": "Bitcoin-ABC/bitcoin-abc",
"id": "e692ad9cabdbd06217a97a2abd48cbce7dc76a5e",
"siz... |
"""
Script for running pytest tests.
This script is meant to be run in a separate process by a PyTestRunner.
It runs tests via the pytest framework and prints the results so that the
PyTestRunner can read them.
"""
# Standard library imports
import sys
# Third party imports
import pytest
# Local imports, needs to b... | {
"content_hash": "2001ed24a84bf11a63e63ce13e75820a",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 74,
"avg_line_length": 34.15483870967742,
"alnum_prop": 0.5710238005289007,
"repo_name": "jitseniesen/spyder-unittest",
"id": "3553cec6f3ce2a2909425262958a71c752e50903",
"... |
import unittest
from slovar import slovar
from prf.view import BaseView
from prf.request import PRFRequest
from prf.tests.prf_testcase import PrfTestCase
class TestView(PrfTestCase):
def request(self, url='/', method='GET', mime='application/json', params={}):
from pyramid import testing
req = te... | {
"content_hash": "efb42e3abedf85d0034751171cf75bd8",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 81,
"avg_line_length": 34.28813559322034,
"alnum_prop": 0.5338606030647554,
"repo_name": "vahana/prf",
"id": "cdd1bb51de7e271566a4453469e9e55bb53ccb6e",
"size": "2023",
"... |
from concurrence._event import event, version, method, has_next, next, loop, EventError
from concurrence._event import EV_TIMEOUT, EV_READ, EV_WRITE, EV_SIGNAL, EV_PERSIST
import os
try:
#try to import some extra features available from libevent14+
from concurrence._event14 import init
from concurrence._e... | {
"content_hash": "d1baf196f9dc69388c300ae0386048b7",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 87,
"avg_line_length": 28.685714285714287,
"alnum_prop": 0.6633466135458167,
"repo_name": "toymachine/concurrence",
"id": "4285dca973bd1b8f476d8277b0e7632cc80d084c",
"size"... |
from .base import *
from .native import *
| {
"content_hash": "c16181a011340e8ce2e2e4cef46eef88",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 21,
"avg_line_length": 21,
"alnum_prop": 0.7142857142857143,
"repo_name": "fperignon/siconos",
"id": "df66ddefb0262a60a3c54dd4d3a557c00d7aec79",
"size": "43",
"binary": fa... |
from __future__ import print_function
from builtins import object
from builtins import str
from lib.common import helpers
class Module(object):
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Get-DomainUser',
'Author': ['@harmj0y'],
'Description': ... | {
"content_hash": "ad960c4b37c3210dab5a316a601d3882",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 165,
"avg_line_length": 39.53157894736842,
"alnum_prop": 0.4643855678338437,
"repo_name": "byt3bl33d3r/Empire",
"id": "52daafe6655f523eabee65ceb1f23c73d1094792",
"size": "... |
"""
=========================================================
Hashing feature transformation using Totally Random Trees
=========================================================
RandomTreesEmbedding provides a way to map data to a
very high-dimensional, sparse representation, which might
be beneficial for classificati... | {
"content_hash": "7beb818ec961c0e6489ccaa9fea62f63",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 79,
"avg_line_length": 33.69444444444444,
"alnum_prop": 0.7136575982412751,
"repo_name": "massmutual/scikit-learn",
"id": "eef04ac3336c4cc228caf66fe77759949ad9871c",
"size... |
"""Defines fixtures available to all tests."""
import pytest
from webtest import TestApp
from octs.app import create_app
from octs.database import db as _db
from octs.settings import TestConfig
from .factories import UserFactory
@pytest.yield_fixture(scope='function')
def app():
"""An application for the tests... | {
"content_hash": "f207be09363213d72edde250c9618dc6",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 46,
"avg_line_length": 19.08,
"alnum_prop": 0.6582809224318659,
"repo_name": "kaiueo/octs",
"id": "3a0f54572de4c5371eb456ab651ec5db2579e07c",
"size": "978",
"binary": fal... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_compress import Compress
from flask_debugtoolbar import DebugToolbarExtension
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
from sqlalchemy.pool import NullPool
import logging
import sys
import os
import requests... | {
"content_hash": "c8f9d25354b3bc2db1c04fa00f070609",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 87,
"avg_line_length": 28.767441860465116,
"alnum_prop": 0.7219078415521423,
"repo_name": "Impactstory/paperbuzz-api",
"id": "ac6709dad0b8c1bd980dea52f63d24619e0b19c1",
"si... |
"""This module contains an object that represents a Telegram WebhookInfo."""
from telegram import TelegramObject
class WebhookInfo(TelegramObject):
"""This object represents a Telegram WebhookInfo.
Attributes:
url (str): Webhook URL, may be empty if webhook is not set up.
has_custom_certific... | {
"content_hash": "47ea177c164df65716c333259d2c6c26",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 76,
"avg_line_length": 28.54385964912281,
"alnum_prop": 0.5685310387215734,
"repo_name": "thonkify/thonkify",
"id": "ac8c91886c4635ef3974b958342417e1a2080f9e",
"size": "243... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('codepot', '0008_auto_20150720_1430'),
('codepot', '0013_workshopmessage_created'),
]
operations = [
]
| {
"content_hash": "e7bcf1a5c77b3d10e185d2d9af9b22a8",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 52,
"avg_line_length": 19.857142857142858,
"alnum_prop": 0.6474820143884892,
"repo_name": "codepotpl/codepot-backend",
"id": "2e9601cf56b252330da4bede821bb7c6b4225996",
"si... |
import falcon
import logging
import importlib
import calplus.conf
LOG = logging.getLogger(__name__)
CONF = calplus.conf.CONF
class Request(falcon.Request):
pass
class Response(falcon.Response):
pass
class BaseMiddleware(object):
def process_request(self, req, resp):
"""Process the request b... | {
"content_hash": "bbdab84d87ef1a7c4f54519e9438af99",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 77,
"avg_line_length": 28.57758620689655,
"alnum_prop": 0.5840120663650076,
"repo_name": "cloudcomputinghust/CAL",
"id": "f37034d9d8355d00b5290d9fb8c60c25ad0291c1",
"size"... |
r"""subprocess - Subprocesses with accessible I/O streams
This module allows you to spawn processes, connect to their
input/output/error pipes, and obtain their return codes. This module
intends to replace several other, older modules and functions, like:
os.system
os.spawn*
os.popen*
popen2.*
commands.*
Informatio... | {
"content_hash": "e849e5c482b96e477dae5a58638fe270",
"timestamp": "",
"source": "github",
"line_count": 1450,
"max_line_length": 128,
"avg_line_length": 35.67793103448276,
"alnum_prop": 0.5561440473198925,
"repo_name": "MalloyPower/parsing-python",
"id": "bdd116a103a59beca140439a88653364f9a49589",
... |
from __future__ import annotations
import pytest
"""Pytest-bdd pytest hooks."""
def pytest_bdd_before_scenario(request, feature, scenario):
"""Called before scenario is executed."""
def pytest_bdd_after_scenario(request, feature, scenario):
"""Called after scenario is executed."""
def pytest_bdd_before_... | {
"content_hash": "e05b2824408fccb0188f5a36e8c2d9f5",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 98,
"avg_line_length": 31.558139534883722,
"alnum_prop": 0.7148120854826824,
"repo_name": "pytest-dev/pytest-bdd",
"id": "9351b2e3097f75356dc17b1ff9bee6e7c2cc128b",
"size":... |
import time
''' Class for timing functions '''
class timer:
''' Object that tracks start and end time and prints elapsed time
Instantiating timer starts the clock and timer.stop() stops the clock
'''
def __init__(self, out='Wall Time ='):
self.start = time.time()
self.out = out
def stop(self):
elaps... | {
"content_hash": "4b69132e5a0b58aa8d6f7d0b253956fa",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 72,
"avg_line_length": 20.387096774193548,
"alnum_prop": 0.6281645569620253,
"repo_name": "smsolivier/VEF",
"id": "4dc0bb2cfb8ce83ca08c6a2674a35aff5998b3f8",
"size": "632",... |
"""A module for the Cloud SDK CLI tree external representation."""
import argparse
import textwrap
from googlecloudsdk.core.console import console_io
def _NormalizeDescription(description):
"""Normalizes description text.
argparse.SUPPRESS normalizes to None.
Args:
description: str, The text to be norma... | {
"content_hash": "a275baa16aa3aa5da2def29cffe8c435",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 80,
"avg_line_length": 35.06390977443609,
"alnum_prop": 0.6029805939744827,
"repo_name": "flgiordano/netcash",
"id": "1af2e6de06ed8f33344bda55860f048541e0b41c",
"size": "9... |
'''This models is an example for training a classifier on SNLI'''
from __future__ import print_function
from os.path import join
import nltk
import numpy as np
import os
import urllib
import zipfile
import sys
from spodernet.hooks import AccuracyHook, LossHook, ETAHook
from spodernet.preprocessing.pipeline import Pip... | {
"content_hash": "b83aa7cd27497f9af19229b552ca0ced",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 168,
"avg_line_length": 38.609756097560975,
"alnum_prop": 0.6789639924194567,
"repo_name": "TimDettmers/spodernet",
"id": "53ef133039ce6a1b58342ed0b819da9866d9eff2",
"size... |
from pytest import raises, skip
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy_continuum import (
versioning_manager, ImproperlyConfigured, TransactionFactory
)
from tests import TestCase
class TestVersionedModelWithoutVersioning(TestCase):
def create_models(s... | {
"content_hash": "d37e4e56d0963053f575edec472cf21e",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 76,
"avg_line_length": 31.201680672268907,
"alnum_prop": 0.6051710207379477,
"repo_name": "piotr-dobrogost/sqlalchemy-continuum",
"id": "9dd034cca2d7ee4b00d046ac2120b53274b5... |
"""VIF drivers for libvirt."""
import copy
import os
from oslo_concurrency import processutils
from oslo_config import cfg
from nova import exception
from nova.i18n import _
from nova.i18n import _LE
from nova.network import linux_net
from nova.network import model as network_model
from nova.openstack.common import ... | {
"content_hash": "6ea28f3d52eb6d7457f32f025fad4f16",
"timestamp": "",
"source": "github",
"line_count": 768,
"max_line_length": 79,
"avg_line_length": 40.24609375,
"alnum_prop": 0.5319486233783041,
"repo_name": "orbitfp7/nova",
"id": "1b7fe61b5965883429c87cf59582ede6ed7fc5e0",
"size": "31611",
"b... |
from mangopaysdk.types.oauthtoken import OAuthToken
from mangopaysdk.tools.apibase import ApiBase
from mangopaysdk.tools.resttool import RestTool
import logging
class ApiOAuth(ApiBase):
"""MangoPay API methods for users."""
def CreateToken(self):
"""Get token information for OAuth Authentication.
... | {
"content_hash": "ac5cb93769c0b36251346dad37831db5",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 97,
"avg_line_length": 35.38235294117647,
"alnum_prop": 0.6541978387364921,
"repo_name": "gracaninja/mangopay2-python-sdk",
"id": "91d15d359025b729c7b254abceacbb5abf56d3ac",
... |
from .common import SeaBreezeError
from .spectrometer import (
SpectrometerFeatureUSB2000,
SpectrometerFeatureHR2000,
SpectrometerFeatureHR4000,
SpectrometerFeatureUSB650,
Spectrom... | {
"content_hash": "f95864e685f0e2533d330248a57cdb11",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 99,
"avg_line_length": 34.39296187683284,
"alnum_prop": 0.6209924965893588,
"repo_name": "fishazam/api",
"id": "f19884534c6c8769095e045bb2b8fb0d9a204d82",
"size": "11728",... |
import logging
import hashlib
import multiprocessing
import os
import re
import shutil
import subprocess
import time
from smqtk.utils import file_utils, string_utils
__author__ = "paul.tunison@kitware.com"
class VideoMetadata (object):
"""
Simple container for video file metadata values
"""
def __... | {
"content_hash": "c0d1b2a6f696ff8fcbc53aab373bee25",
"timestamp": "",
"source": "github",
"line_count": 353,
"max_line_length": 80,
"avg_line_length": 35.89518413597734,
"alnum_prop": 0.5960855496803725,
"repo_name": "Purg/SMQTK",
"id": "f03d6a7c1349bfcbeb006bd6a7b503e3a53defb0",
"size": "12671",
... |
from django.template import Library
register = Library()
@register.simple_tag
def get_object_properties(object, properties):
"""Returns first non empty property of given object."""
properties = properties.split(',')
for property in properties:
attribute = getattr(object, property, '')
if ... | {
"content_hash": "8cc33c7f96abf2f2b5295878faee85fa",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 59,
"avg_line_length": 28.642857142857142,
"alnum_prop": 0.683291770573566,
"repo_name": "UITools/saleor",
"id": "d68a16392608f788c3795010fdc6e9b890233c94",
"size": "401",
... |
import smtplib
import random
import string
def send_recovery_email(user):
recovery_code = "".join(random.choice(string.ascii_uppercase + string.ascii_uppercase) for _ in range(10))
message = \
""" From: NoReply <noreply@artizanz.com>
To: {0} <{1}>
MIME-Version: 1.0
Content-Type... | {
"content_hash": "95a94503365b90280f53c372d6a60e4b",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 110,
"avg_line_length": 29.347826086956523,
"alnum_prop": 0.6340740740740741,
"repo_name": "BrambleLLC/Artizanz",
"id": "a34c9f96cb12b4de77d8e7614c479aed8ed10d18",
"size": ... |
'''
# Shortest Word题目地址:https://www.codewars.com/kata/57cebe1dc6fdc20c57000ac9/train/python
'''
import unittest
class TestCases(unittest.TestCase):
def setUp(self):
pass
def test1(self):self.assertEqual(find_short("bitcoin take over the world maybe who knows perhaps"), 3)
def test2(self):self.asse... | {
"content_hash": "deada1acfbb9f53757adc4a96bb28f8d",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 121,
"avg_line_length": 27.28125,
"alnum_prop": 0.6849942726231386,
"repo_name": "karchi/codewars_kata",
"id": "801dcec7e7ff2517aeec16c8655c19d63c503ad0",
"size": "936",
... |
"""Runs all of the tests in parallel with or without integration server.
This package doesn't need any setup and can do one of three things:
execute all unit, functional and integration tests:
python scripts/project.py --test=*
execute specific tests packages, classes or methods:
python scrip... | {
"content_hash": "17ad175fffb441ecb1d63503dc8a23a5",
"timestamp": "",
"source": "github",
"line_count": 1424,
"max_line_length": 80,
"avg_line_length": 35.438202247191015,
"alnum_prop": 0.6006063728598605,
"repo_name": "andela-angene/coursebuilder-core",
"id": "c5b00274487208d4477728b07d23e0c9dfc0bf8... |
from p4_core import *
from p4_headers import p4_header_instance, P4_NEXT, p4_field_reference
import p4_imperatives
from p4_expressions import p4_expression
from p4_hlir.util.OrderedSet import OrderedSet
from collections import OrderedDict, defaultdict
from p4_hlir.util.topo_sorting import Graph, Node
p4_parser_exce... | {
"content_hash": "dcbf280ebffcdd1e0a2c2b44feedc3b8",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 94,
"avg_line_length": 36.375,
"alnum_prop": 0.5352806414662085,
"repo_name": "hanw/p4-hlir",
"id": "ff3f5870851aaf73b9e276f839d96f926d85e8e9",
"size": "9328",
"binary":... |
import json
import os
import unittest
from attributes.management import main
from lib import database
class MainTestCase(unittest.TestCase):
def setUp(self):
path = (
os.path.join(
os.path.abspath(
os.path.join(
os.path.dirname(os.pa... | {
"content_hash": "39fa2272187a23ec1e0a1a99d00bd19f",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 77,
"avg_line_length": 25.823529411764707,
"alnum_prop": 0.48291571753986334,
"repo_name": "RepoReapers/reaper",
"id": "5155bed40fef4b84c26b5120d8497248f4e70665",
"size": "... |
from __future__ import division
import numpy as np
from scipy import ndimage
from scipy.interpolate import UnivariateSpline
from scipy.optimize import leastsq
import abel
#########################################################################
# circularize.py
#
# Image circularization by following peak intensity vs... | {
"content_hash": "fa536121ae59b8d5ac7fac3d421c6d49",
"timestamp": "",
"source": "github",
"line_count": 321,
"max_line_length": 80,
"avg_line_length": 38.05295950155763,
"alnum_prop": 0.6605812525583299,
"repo_name": "DhrubajyotiDas/PyAbel",
"id": "0c3a924ec5ea8fbc22f405654560a1a7a4833f7e",
"size":... |
from blinkpy.common.system.filesystem_mock import MockFileSystem
from blinkpy.common.system.log_testing import LoggingTestCase
from blinkpy.style.main import change_directory
class ChangeDirectoryTest(LoggingTestCase):
_original_directory = '/original'
_checkout_root = '/chromium/src'
def setUp(self):
... | {
"content_hash": "eafaf160fe7ccd6c2f1cb471dc296704",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 78,
"avg_line_length": 39.35087719298246,
"alnum_prop": 0.6598305840392331,
"repo_name": "chromium/chromium",
"id": "43bb70cc9f2be02c9dbd28218a8399a75b6f040d",
"size": "357... |
from django.apps import AppConfig
class MarkersConfig(AppConfig):
name = 'markers'
| {
"content_hash": "48d1ee78f1b0e583a45d5fadc4d577dd",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 33,
"avg_line_length": 17.8,
"alnum_prop": 0.7528089887640449,
"repo_name": "pabulumm/neighbors",
"id": "f703edede08ad35c0ea1f34204d1139fd51ad639",
"size": "89",
"binary":... |
import optproblems.cec2005
import numpy as np
import time
from ICA import *
import os
if __name__ == "__main__":
dim = 30
repeats = 10
evaluations = 10000*dim
countries = 30
imperialists = 6
if not os.path.exists('results'):
os.makedirs('results')
if not os.path.exists('convergenc... | {
"content_hash": "79f13c7c4422b6aa6fb2e1f307eae4f8",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 111,
"avg_line_length": 36.554140127388536,
"alnum_prop": 0.5924377069175815,
"repo_name": "JJSrra/Research-SocioinspiredAlgorithms",
"id": "3674b4c113a8b39ac3285c97be56f7ad... |
import queue
import concurrent.futures
import time
import hashlib
import sys
import re
import string
import random
import urllib.request
import urllib.parse
from html.parser import HTMLParser
from collections import namedtuple
from classes.cache import Cache
from classes.results import Results
class HTMLStripper(HTM... | {
"content_hash": "3426065d8b17cb8e8cee3013cc20c24c",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 93,
"avg_line_length": 26.78078078078078,
"alnum_prop": 0.6437542049786947,
"repo_name": "akamajoris/wig",
"id": "2b292a0601a22532682609f7d0b912a8c2217287",
"size": "8918"... |
import os.path
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='vapns-client',
version='0.2.1.6',
author='Sardar Yumatov',
author_email='ja.doma@gmail.com... | {
"content_hash": "1bcbf9a1f6bc79caf28764bec3130e51",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 83,
"avg_line_length": 35.67857142857143,
"alnum_prop": 0.6366366366366366,
"repo_name": "vine/apns-client",
"id": "b082620b44c864c866553166efc24a346e5df6e9",
"size": "999"... |
from .proxy_only_resource import ProxyOnlyResource
class PushSettings(ProxyOnlyResource):
"""Push settings for the App.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource Id.
:vartype id: str
:ivar name: Resource Name.
:vartype name... | {
"content_hash": "d5251ab3393c4669c8c00fa37d46e593",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 126,
"avg_line_length": 41.15,
"alnum_prop": 0.6362899959497772,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "9c89aa6540ca2da48810eb52f5517a36631b9cec",
"size": "294... |
"""Tests for nova websocketproxy."""
import copy
import io
import socket
from unittest import mock
from oslo_utils.fixture import uuidsentinel as uuids
import nova.conf
from nova.console.securityproxy import base
from nova.console import websocketproxy
from nova import context as nova_context
from nova import except... | {
"content_hash": "bf915a7eacd48a2be609d21f1625a14c",
"timestamp": "",
"source": "github",
"line_count": 765,
"max_line_length": 79,
"avg_line_length": 39.86143790849673,
"alnum_prop": 0.5910015084934741,
"repo_name": "mahak/nova",
"id": "fc25bef2bc3f77b6bd83d000d05ab018c004172f",
"size": "31092",
... |
import sys, os
import sphinx_rtd_theme
# 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.insert(0, os.path.abspath('.'))
... | {
"content_hash": "05e8e013ca74ba4982a63d4487774cba",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 80,
"avg_line_length": 32.44541484716157,
"alnum_prop": 0.7032301480484522,
"repo_name": "perone/protocoin",
"id": "b5ac8d39e1a736396fc62416c9249b428d14e1b7",
"size": "785... |
import speech_recognition as sr
from glob import glob
from ctypes import *
from contextlib import contextmanager
from array import array
from struct import pack
import sys
import os
import select
import pyaudio
import audioop
import wave
# Need 16kHz 16bit mono .wav
FREQ=16000
CHUNK=256
# File management stuff
DIR=os... | {
"content_hash": "dc0d9d6a14d79c2622147282d2786bfc",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 116,
"avg_line_length": 24.349514563106798,
"alnum_prop": 0.6614832535885168,
"repo_name": "adewynter/Tools",
"id": "3489a57f3450484601edbb54ee160a0d8712fbdc",
"size": "28... |
from django.conf.urls import patterns, url
from inkdisplay import views
urlpatterns = patterns('',
url(r'^$', views.index, name='inkdisplay'),
url(r'^(?P<inkdisplay_name>\w+)/$', views.display, name='inkdisplay_display'),
) | {
"content_hash": "a9bc91653924ea057a7ca713aeee909a",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 82,
"avg_line_length": 26,
"alnum_prop": 0.6837606837606838,
"repo_name": "volzotan/django-howl",
"id": "115e9f7a213acb3f78faae2d2ef31937fc43e1f0",
"size": "234",
"binary"... |
from django.contrib import admin
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.contrib.auth.admin import UserAdmin, GroupAdmin
from django.contrib.auth.models import Permission, Group
from .forms import CustomUserChangeForm, CustomUserCreationForm
from .models import IUser, MasterProfile, ... | {
"content_hash": "e1dfb6a83a052143e8fac013ba383877",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 121,
"avg_line_length": 33.323232323232325,
"alnum_prop": 0.6562594725674447,
"repo_name": "I-sektionen/i-portalen",
"id": "beaaba34feeae33b2c55e07c6031d09ca90a95c1",
"size... |
from setuptools import setup
from setuptools import find_packages
from distutils.cmd import Command
from distutils.extension import Extension
import os
import sys
import io
import subprocess
import platform
import numpy as np
from Cython.Build import cythonize
import Cython.Compiler.Options
Cython.Compiler.Options.anno... | {
"content_hash": "006bfbaf0fc56ca78bd07d7121679ad1",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 93,
"avg_line_length": 29.934426229508198,
"alnum_prop": 0.6217597663380796,
"repo_name": "ChinaQuants/Finance-Python",
"id": "8273b21efbe79e638b98a1d75210e9f8b01ff722",
"... |
from django import template
from xgds_core.models import Constant
register = template.Library()
@register.simple_tag(name='constant')
def constant(name):
try:
return Constant.objects.get(name=name)
except:
return None
@register.simple_tag(name='constant_value')
def constant_value(name):
... | {
"content_hash": "86093b5e8a7e3ecb30bfccf8d9cad705",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 52,
"avg_line_length": 20.75,
"alnum_prop": 0.6843373493975904,
"repo_name": "xgds/xgds_core",
"id": "f65841e528c6c77c65adf37826d45f81a661e8ff",
"size": "616",
"binary": ... |
"""Clear out matching diffs.
Revision ID: 1cf84ddb034c
Revises: 4d7019b218d4
Create Date: 2013-10-28 08:46:17.516023
"""
# revision identifiers, used by Alembic.
revision = '1cf84ddb034c'
down_revision = '4d7019b218d4'
from alembic import context, op
from collections import defaultdict
from sqlalchemy.sql import an... | {
"content_hash": "82d31a69fca7ea3182cf89c9274dc644",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 78,
"avg_line_length": 33.45454545454545,
"alnum_prop": 0.5682744565217391,
"repo_name": "ucsb-cs/submit",
"id": "782a0a0d9a1cf581a40a66b042365c4d9c9ef144",
"size": "2944",... |
from distutils import log
from distutils.core import Command
from distutils.errors import DistutilsSetupError
import os
import re
from datetime import date
class release(Command):
description = "create and release a new version"
user_options = [
('keyid', None, "GPG key to sign with"),
('skip-... | {
"content_hash": "28a0c1b28c28f9cb5768ea1f368d5525",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 78,
"avg_line_length": 35.51639344262295,
"alnum_prop": 0.5407339026078929,
"repo_name": "Yubico/python-yubico-dpkg",
"id": "1f70b2256ed079c9b5949cefad15c880e3eba91e",
"si... |
from datetime import datetime, timedelta
import time
from openerp import pooler
from openerp.osv import fields, osv
from openerp.tools.translate import _
class is_resource_calendar_leaves(osv.osv):
_inherit = "resource.calendar.leaves"
_columns = {
'partner_id': fields.many2one('res.partner', 'Com... | {
"content_hash": "cfa3ab4c90f3deaddaeb349af4c799aa",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 94,
"avg_line_length": 37.03846153846154,
"alnum_prop": 0.5597092419522326,
"repo_name": "tonygalmiche/is_plastigray",
"id": "694591dc222f9dfdb1df669d8fb9c18e1049f105",
"si... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import models, migrations
def update_site_forward(apps, schema_editor):
"""Set site domain and name."""
Site = apps.get_model("sites", "Site")
Site.objects.update_or_create(
id=settings.SITE_ID,
defaul... | {
"content_hash": "3e2cb2e4b50799e508fdecf836c87f30",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 72,
"avg_line_length": 23.692307692307693,
"alnum_prop": 0.5941558441558441,
"repo_name": "diegoduncan21/subastas",
"id": "e54478879f749f0873b5488d7479ec87145cda10",
"size"... |
"""Prepares a licenses.txt file for the package.
The license paths file is expected to contain a series of titles and paths to
output. The paths should be relative to the file itself. For example,
Title: path/to/LICENSE
The extra licenses file is expected to contain input similar to the output;
a series of licenses, ... | {
"content_hash": "198331495267faad6b434bd89c4d9980",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 80,
"avg_line_length": 33.89705882352941,
"alnum_prop": 0.6637744034707158,
"repo_name": "shaka-project/shaka-player-embedded",
"id": "0a094e364b96f0bdade92bb8069fa183a613364... |
import configparser
import os
import shutil
from copy import deepcopy
from unittest import mock
import pytest
from great_expectations.core.usage_statistics.usage_statistics import (
run_validation_operator_usage_statistics,
)
from great_expectations.data_context import (
BaseDataContext,
DataContext,
... | {
"content_hash": "3d89110b95a4bf3b6e2fdfec5d0889c4",
"timestamp": "",
"source": "github",
"line_count": 406,
"max_line_length": 100,
"avg_line_length": 35.18472906403941,
"alnum_prop": 0.64025201260063,
"repo_name": "great-expectations/great_expectations",
"id": "65e1393fafc8d6a996666dce02bf447a001d3... |
"""
Unit Tests for :py:class:`ironic.conductor.rpcapi.ConductorAPI`.
"""
import copy
import mock
from oslo.config import cfg
from ironic.common import boot_devices
from ironic.common import exception
from ironic.common import states
from ironic.conductor import manager as conductor_manager
from ironic.conductor impo... | {
"content_hash": "5a0fab0baf0fd7e88662ea0bb5067afa",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 79,
"avg_line_length": 38.12595419847328,
"alnum_prop": 0.5186705375913505,
"repo_name": "CiscoUcs/Ironic-UCS",
"id": "47a938c4767f874e7ad5e937ff13ce350b4884d0",
"size": "... |
import datetime
import io
import os
import textwrap
from enum import Enum
# keep below as absolute imports
from flopy.mf6.data import mfdatautil, mfstructure
from flopy.utils import datautil
"""
createpackages.py is a utility script that reads in the file definition
metadata in the .dfn files to create the package cl... | {
"content_hash": "0024ef97dbdf7bed1097721afc26dc5b",
"timestamp": "",
"source": "github",
"line_count": 851,
"max_line_length": 97,
"avg_line_length": 36.71562867215041,
"alnum_prop": 0.4874699951992319,
"repo_name": "jentjr/flopy",
"id": "72721a78e1edfd46ce6fbcd4a989a2329fcd0088",
"size": "31245",... |
from .CakeModel import CakeModel
class SourceAffiliate(CakeModel):
def __init__(self, **kwargs):
self.param_defaults = {
'affiliate_id': None,
'affiliate_name': None,
'third_party_name': None,
'tier': None,
'account_managers': None,
'account_status': None,
'inactive_reason': None,
'address... | {
"content_hash": "4f647727a0fa128d0bd29357d1ff82fd",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 54,
"avg_line_length": 25.87037037037037,
"alnum_prop": 0.6320687186828919,
"repo_name": "heytimj/pycake",
"id": "49e37d084aa37925d7a2fe5e6e7ea64cea6b6105",
"size": "1397",... |
import networkx
from collections import defaultdict
from bingraphvis import *
from bingraphvis.angr import *
from bingraphvis.angr.x86 import *
def set_plot_style(c):
set_style(c)
def plot_common(graph, fname, format="png", type=True):
vis = AngrVisFactory().default_common_graph_pipeline(type=type)
vis.... | {
"content_hash": "dc5964bcde8aa4ef82d0fdd2ce6c3a90",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 227,
"avg_line_length": 44.52,
"alnum_prop": 0.7196765498652291,
"repo_name": "axt/angr-utils",
"id": "3d26952670409b6cd8d1e8152c3d4b24075a36d4",
"size": "4452",
"binary... |
from __future__ import with_statement
import redis
import unittest
class PipelineTestCase(unittest.TestCase):
def setUp(self):
self.client = redis.Redis(host='localhost', port=6379, db=9)
self.client.flushdb()
def tearDown(self):
self.client.flushdb()
def test_pipeline(self):
... | {
"content_hash": "99c3479f33d669c48470b291b16e94d3",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 84,
"avg_line_length": 36.03125,
"alnum_prop": 0.5355594102341718,
"repo_name": "raphaelfruneaux/redis-py",
"id": "e1322a3653d25233bf1a571c955b207f5dfc9785",
"size": "6918... |
if __name__ == "__main__":
from setuptools import setup, find_packages
setup(name="catalogue", packages=find_packages())
| {
"content_hash": "37f4620771d0c4012911f3b2106d06a6",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 53,
"avg_line_length": 32.5,
"alnum_prop": 0.6538461538461539,
"repo_name": "explosion/catalogue",
"id": "347ead66ab2a8b2ae2708a422f0b68eaa7368b5c",
"size": "153",
"binary... |
"""Nginx Configuration"""
import logging
import os
import re
import shutil
import socket
import subprocess
import sys
import time
import OpenSSL
import zope.interface
from acme import challenges
from acme import crypto_util as acme_crypto_util
from letsencrypt import achallenges
from letsencrypt import constants as ... | {
"content_hash": "dc246139bb293ebadd01a11ebced0ec7",
"timestamp": "",
"source": "github",
"line_count": 633,
"max_line_length": 85,
"avg_line_length": 37.35703001579779,
"alnum_prop": 0.5807502008711465,
"repo_name": "hsduk/lets-encrypt-preview",
"id": "29e69e498ae183f5c05661bf90340ff342f56c77",
"s... |
from telemetry.page import page_benchmark_unittest_base
from perf_tools import image_decoding_benchmark
class ImageDecodingBenchmarkUnitTest(
page_benchmark_unittest_base.PageBenchmarkUnitTestBase):
def testImageDecodingMeasurement(self):
ps = self.CreatePageSetFromFileInUnittestDataDir('image_decoding.html'... | {
"content_hash": "3b79d942b8b7364a93bda3aa6d3a123e",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 75,
"avg_line_length": 36.578947368421055,
"alnum_prop": 0.7784172661870503,
"repo_name": "codenote/chromium-test",
"id": "1bbe27dabb9b3cf1338e7e0f075d0b8a4e361f09",
"size"... |
"""Support for TPLink lights."""
import logging
import time
from pyHS100 import SmartBulb, SmartDeviceException
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_HS_COLOR,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
Light,
)
import homeassistant... | {
"content_hash": "7bba0dbfd89a5e97c71ce9269fe05d47",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 88,
"avg_line_length": 32,
"alnum_prop": 0.5917300380228137,
"repo_name": "leppa/home-assistant",
"id": "ec3307fc87e3f03f4384d2af3ce8e44dfac50f95",
"size": "8416",
"bina... |
from .base import *
DEBUG = False
TESTING = get_env_variable_bool('TESTING')
if get_env_variable_bool('SSL'):
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
ALLOWED_HOSTS = [get_env_variable('ALLOWED_HOSTS'), ]
DOMAIN = get_env_variable('DOMAIN')
DATABASE = DOMAIN.replace('.', '_')
DATABASES = {
... | {
"content_hash": "cf33f563e90a9c9eaa486c13193a9d3b",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 86,
"avg_line_length": 28.0989010989011,
"alnum_prop": 0.650371529135706,
"repo_name": "pkimber/kbsoftware_couk",
"id": "39e7b8a741d49dffcdc1b00693040edb51b3e793",
"size": ... |
from sqlalchemy import create_engine, func
from sqlalchemy.orm import sessionmaker
from sqlalchemy import Sequence
from sqlalchemy import Column
from sqlalchemy import BigInteger, Integer, SmallInteger
from sqlalchemy import DateTime, Float, String, Unicode
from datetime import datetime
from mabolab.database.db... | {
"content_hash": "67e546a715414491a26e66a285ec5388",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 56,
"avg_line_length": 22.71794871794872,
"alnum_prop": 0.6613995485327314,
"repo_name": "mabotech/maboss.py",
"id": "097828045e59487a07fc52bcccd6cd888ddca698",
"size": "91... |
from neomodel.core import StructuredNode
from neomodel.exceptions import InflateConflict, DeflateConflict
from neomodel.util import _get_node_properties
class SemiStructuredNode(StructuredNode):
"""
A base class allowing properties to be stored on a node that aren't
specified in its definition. Conflictin... | {
"content_hash": "b63dda6453daece19574698800ec4a0c",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 80,
"avg_line_length": 37.015625,
"alnum_prop": 0.5571971295905446,
"repo_name": "robinedwards/neomodel",
"id": "883a5895991c7ccc21ccbccd246fb4802705a3a0",
"size": "2369",
... |
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = """Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)"""
import socket
import time
def plugin(srv, item):
srv.logging.debug("*** MODULE=%s: service=%s, target=%s", __file__, ... | {
"content_hash": "5c557ae9cbdd04d776c53e82a4ff07d1",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 107,
"avg_line_length": 30.704918032786885,
"alnum_prop": 0.5750133475707421,
"repo_name": "sourceperl/docker.mqttwarn",
"id": "72395f56e68913d783a09ebb07d775d723c8bec2",
"... |
from atelier.invlib import setup_from_tasks
ns = setup_from_tasks(
globals(), "atelier",
blogref_url="http://luc.lino-framework.org",
revision_control_system='git',
# tolerate_sphinx_warnings=True,
cleanable_files=['docs/api/atelier.*'])
| {
"content_hash": "b88e1adc84abbdd594003d061eb236c1",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 48,
"avg_line_length": 36.857142857142854,
"alnum_prop": 0.689922480620155,
"repo_name": "lsaffre/atelier",
"id": "d5fc82d7d3f0d2427086745854131314afd36ca9",
"size": "258",
... |
import decimal
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils import timezone
from django.contrib.auth import authenticate, login, logout
from mock import Mock
from ..middleware import ActiveSubscriptionMiddleware
from ..models import... | {
"content_hash": "b305efd8e40b35006236163242d9cf47",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 90,
"avg_line_length": 35.60526315789474,
"alnum_prop": 0.6612466124661247,
"repo_name": "alexhayes/django-stripe-payments",
"id": "f4076ee815d11c1d824a8443024374a48de2233e"... |
import sys
import webob
from prestans import exception
class ErrorResponse(webob.Response):
"""
ErrorResponse is a specialised webob.Response, it is responsible for writing
out a message in the following format; using the currently selected serializer
{
"code": 404,
"message": ... | {
"content_hash": "785c312cc23f5e9706339a445bb41a49",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 103,
"avg_line_length": 30.743243243243242,
"alnum_prop": 0.596043956043956,
"repo_name": "anomaly/prestans",
"id": "72138128f8e72cf8abf6dd1a2af7f343f1ededa7",
"size": "227... |
from experiment import Experiment
from episodic import EpisodicExperiment
from continuous import ContinuousExperiment
from queued import QueuedExperiment
from tournament import Tournament
| {
"content_hash": "2aff8daec8c905fd2ffef3817319df0e",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 44,
"avg_line_length": 37.8,
"alnum_prop": 0.8888888888888888,
"repo_name": "daanwierstra/pybrain",
"id": "a8fe5a492a81e9a230177defe162792b406043c6",
"size": "189",
"binar... |
"""Development settings and globals."""
from __future__ import absolute_import
from os.path import join, normpath
from .base import *
import os
# DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-... | {
"content_hash": "91e80a1ba4f06c8917f79191aab512fe",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 108,
"avg_line_length": 27.956521739130434,
"alnum_prop": 0.6666666666666666,
"repo_name": "dmallcott/C-Nutra",
"id": "ddd492a69cc89725e049fe010ffc0c18f834b74d",
"size": "1... |
"""
WSGI config for brickset_app project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | {
"content_hash": "b9152874918f1b34c54dd00cff681949",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 25.125,
"alnum_prop": 0.7711442786069652,
"repo_name": "pyfirst/samplecode",
"id": "40a319d67e475230da8a9acee24a0785b47667a7",
"size": "402",
"bina... |
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from app import create_app
from app.models import db
from app.models.user import User
from app.models.skill import Skill
from app.models.role import Role
app = create_app()
manager = Manager(app)
migrate = Migrate(app, db)
m... | {
"content_hash": "b46810269059754581ea0af2999eff1d",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 49,
"avg_line_length": 15.447368421052632,
"alnum_prop": 0.6541737649063032,
"repo_name": "AthelasPeru/laborapp",
"id": "15940874134cfa56a1b55ae85e5015a7b2bcfc98",
"size": ... |
import logging as loggers
import theano
import theano.tensor as T
from theano.ifelse import ifelse
from deepy.utils import FLOATX, dim_to_var, EPSILON
from deepy.trainers.util import wrap_core, multiple_l2_norm
from deepy.conf import TrainerConfig
logging = loggers.getLogger(__name__)
def optimize_updates(params, g... | {
"content_hash": "d8636aa84ed220d03e6d92fedbe717ce",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 104,
"avg_line_length": 35.00869565217391,
"alnum_prop": 0.6159960258320915,
"repo_name": "wolet/deepy",
"id": "e8a40b7b3a59fc1750fd2c20eda43903dc3c3c7c",
"size": "4074",
... |
"""
SiteAlert, what are you waiting for?
Copyright (c) 2015, Matteo Pietro Dazzi <---> ilteoood
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the... | {
"content_hash": "944694db65e25f77ae98485a04eda88b",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 262,
"avg_line_length": 43.07988165680474,
"alnum_prop": 0.5199505528466452,
"repo_name": "ilteoood/SiteAlert-Python",
"id": "f42c0c13227f6c2619a9b24366679ea305e11828",
"s... |
"""empty message
Revision ID: a4cb3e538622
Revises: None
Create Date: 2016-11-17 17:17:37.946675
"""
# revision identifiers, used by Alembic.
revision = 'a4cb3e538622'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###... | {
"content_hash": "abd77384235781d8459a73d8714e4d2a",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 96,
"avg_line_length": 37.27272727272727,
"alnum_prop": 0.6658536585365854,
"repo_name": "cynicalanlz/flask-este-code-sample",
"id": "2fe12ad50626de67e33b4752477b15bf60ed7f8e... |
import logging
import tempfile
import json
from chrome_remote_control import adb_commands
from chrome_remote_control import browser_backend
from chrome_remote_control import browser_gone_exception
class AndroidBrowserBackend(browser_backend.BrowserBackend):
"""The backend for controlling a browser instance running ... | {
"content_hash": "1ede3944b3937088518b36a84e668c11",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 80,
"avg_line_length": 34.54032258064516,
"alnum_prop": 0.619892598645809,
"repo_name": "junmin-zhu/chromium-rivertrail",
"id": "223b8c8f81b41d2d94e19be422d15efcaf3c15b2",
... |
import numpy as np
import alsaaudio as aa
from struct import unpack
import time
# Will read small read_size packets from the mic and append until "chunk" data has been read
def read_mic(chunk, input):
# Create an empty NumPy array that will store the mic data
data = np.array([])
amount_read = 0
while amou... | {
"content_hash": "78ac9c452208f12fae523e4d17e7e475",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 127,
"avg_line_length": 41.69444444444444,
"alnum_prop": 0.6728847435043305,
"repo_name": "parrisha/raspi-visualizer",
"id": "7dcef1f36b9e2181284d7dbdde9470184ef4ec06",
"si... |
from django.conf.urls import include, url
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from mudu import urls, views
urlpatterns = [
url(r'^$', views.IndexPage.as_view(), name='index'),
url(r'^api/', include(urls)),
url(r'^gagou/', include(admin.site.urls)),
]
a... | {
"content_hash": "cb291ddc3d85154110aeae741e43ec51",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 56,
"avg_line_length": 31,
"alnum_prop": 0.7075268817204301,
"repo_name": "TheBlackDude/mudu45",
"id": "3947db338fe71713983238e3e33b1132b2748d04",
"size": "465",
"binary"... |
"""The tests for the Template select platform."""
import pytest
from homeassistant import setup
from homeassistant.components.input_select import (
ATTR_OPTION as INPUT_SELECT_ATTR_OPTION,
ATTR_OPTIONS as INPUT_SELECT_ATTR_OPTIONS,
DOMAIN as INPUT_SELECT_DOMAIN,
SERVICE_SELECT_OPTION as INPUT_SELECT_SE... | {
"content_hash": "9200d23cddf43f8a38131470fb9b5b3a",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 132,
"avg_line_length": 32.6061320754717,
"alnum_prop": 0.4716817359855335,
"repo_name": "rohitranjan1991/home-assistant",
"id": "66f67d93754d26c6f31f7eb569da2eb5e815629e",
... |
from setuptools import setup, find_packages
setup(
name='drf_ujson',
version='1.2',
description='Django Rest Framework UJSON Renderer',
author='Gizmag',
author_email='tech@gizmag.com',
url='https://github.com/gizmag/drf-ujson-renderer',
packages=find_packages(),
install_requires=['djang... | {
"content_hash": "06454689fcc54c8064576508ee8036b8",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 63,
"avg_line_length": 29.833333333333332,
"alnum_prop": 0.6871508379888268,
"repo_name": "pombredanne/drf-ujson-renderer",
"id": "ba4e69365c634d7b26bda04535c24c57c29298d3",
... |
"""Simplified chat demo for websockets.
Authentication, error handling, etc are left as an exercise for the reader :)
"""
import os.path
import uuid
import sys
import time
from collections import defaultdict
from twisted.python import log
from twisted.internet import reactor, task
import cyclone.escape
import cyclo... | {
"content_hash": "19861ff878c557be2ae9d71b9db36a09",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 79,
"avg_line_length": 26.575342465753426,
"alnum_prop": 0.6180412371134021,
"repo_name": "fiorix/cyclone",
"id": "c8e9d2667a56798bfcb9e4c57ef2b9edf4c12488",
"size": "4476... |
'''
:author: Robin Flume
:contact: robin.flume@rub.de
'''
import os
class Job(object):
''' This class represents a job 'to do' for the Password Guessing Framework.
It includes the necessary configurations parsed from the file 'run.ini'.
'''
def __init__(self, logger):
''' Constructor.
... | {
"content_hash": "e655bd314461780f02fc0ff2e218bf80",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 319,
"avg_line_length": 52.971098265895954,
"alnum_prop": 0.5967917939764295,
"repo_name": "RUB-SysSec/Password-Guessing-Framework",
"id": "861bba9946be169cd9e2169d1e5755dc2... |
from rest_framework import serializers
from assets.models import PersonInfoSerializer
from controk_webservice.suppliers.models import Supplier
class SupplierSerializer(serializers.ModelSerializer):
class Meta:
model = Supplier
fields = ['id', 'email', 'cnpj', 'trading_name']
class SupplierInfoS... | {
"content_hash": "56b05bcc9ea9e56e707f381b7a35bc62",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 56,
"avg_line_length": 28.066666666666666,
"alnum_prop": 0.7553444180522565,
"repo_name": "jourdanrodrigues/controk-webservice",
"id": "958f943d9be1484b7e3b7d3a9ec262a03da227... |
import time
SUBJECT_FILENAME = "subjects.txt"
VALUE, WORK = 0, 1
#
# Problem 1: Building A Subject Dictionary
#
def loadSubjects(filename):
"""
Returns a dictionary mapping subject name to (value, work), where the name
is a string and the value and work are integers. The subject information is
read fr... | {
"content_hash": "0a03f81127d7c3956f7364f360cea095",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 112,
"avg_line_length": 32.93674698795181,
"alnum_prop": 0.6402377686328303,
"repo_name": "feliposz/learning-stuff",
"id": "20f55b57a547ba42cd3561c38a5791f44ba811a7",
"siz... |
import _plotly_utils.basevalidators
class UirevisionValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="uirevision", parent_name="heatmapgl", **kwargs):
super(UirevisionValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "c00fbe3a30ef802feeeecda353ec67ef",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 84,
"avg_line_length": 36.81818181818182,
"alnum_prop": 0.6296296296296297,
"repo_name": "plotly/plotly.py",
"id": "e98413fe3a635fd720730a4d93a0001b60d8e03d",
"size": "405"... |
from django.contrib.localflavor.es.forms import (ESPostalCodeField, ESPhoneNumberField,
ESIdentityCardNumberField, ESCCCField, ESRegionSelect, ESProvinceSelect)
from django.test import SimpleTestCase
class ESLocalFlavorTests(SimpleTestCase):
def test_ESRegionSelect(self):
f = ESRegionSelect()
... | {
"content_hash": "f7a8e9d5b71a94d6693d293aa2045c58",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 112,
"avg_line_length": 38.35672514619883,
"alnum_prop": 0.6339381003201707,
"repo_name": "mixman/djangodev",
"id": "ccd08b168d0265330a74717f7d2ffc81d08b77d8",
"size": "65... |
"""
Basic chain parser tool for SmartChain functions.
Author: Tim M. (TM2013)
Co-Author: Bitkapp (aka alaniz)
Organization: Project Radon
Date: 2/17/2016
Requirements:
BitcoinRPC
An RPC-enabled client
"""
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
import logging
import time
try... | {
"content_hash": "e44122f478f9228ea4868aec5f560517",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 100,
"avg_line_length": 29.9390243902439,
"alnum_prop": 0.6036659877800408,
"repo_name": "tm2013/SmartChain-OP_RETURN",
"id": "1a736d5d62c0777ed8971b64fd87310ebf9ce8c6",
"s... |
from novaclient import exceptions as nova_exceptions
from oslo_log import log as logging
from trove.cluster import models as cluster_models
from trove.cluster.tasks import ClusterTasks
from trove.cluster.views import ClusterView
from trove.common import cfg
from trove.common import exception
from trove.common import ... | {
"content_hash": "b5a257e61e4d5d474c62b05835b67f6f",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 79,
"avg_line_length": 39.55203619909502,
"alnum_prop": 0.5914655073790184,
"repo_name": "mmasaki/trove",
"id": "c4bd58b27ceb6ee6e7fcf6f6c0ef5c4ec08c2959",
"size": "9372",... |
import time
while True:
print "I need to make sure I'm still alive."
time.sleep(1)
| {
"content_hash": "56b59690ff325462d84121ba1ab8ac44",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 46,
"avg_line_length": 17.6,
"alnum_prop": 0.6931818181818182,
"repo_name": "adcade/puppet-upstart",
"id": "4a5a662c2206e23c9df96be3539bfc6720331cf7",
"size": "88",
"binar... |
#
# The Python Imaging Library.
# $Id$
#
# Sun image file handling
#
# History:
# 1995-09-10 fl Created
# 1996-05-28 fl Fixed 32-bit alignment
# 1998-12-29 fl Import ImagePalette module
# 2001-12-18 fl Fixed palette loading (from Jean-Claude Rimbault)
#
# Copyright (c) 1997-2001 by Secret Labs AB
# Copyright (c... | {
"content_hash": "d6bac22d85cb73c411889359a5cbd9af",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 82,
"avg_line_length": 31.764705882352942,
"alnum_prop": 0.5483796296296296,
"repo_name": "isabernardes/Heriga",
"id": "fd5e82724df892a0b8fc00bf28a22cf4b593aa28",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.