text stringlengths 4 1.02M | meta dict |
|---|---|
import os
import flask
from oslo.config import cfg
from dashboard import memory_storage
from stackalytics.openstack.common import log as logging
from stackalytics.processor import runtime_storage
from stackalytics.processor import utils
LOG = logging.getLogger(__name__)
def get_vault():
vault = getattr(flask.c... | {
"content_hash": "a738db67abb5a91decbae8e8e9a73eca",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 74,
"avg_line_length": 32.66480446927374,
"alnum_prop": 0.6153583034034548,
"repo_name": "joshuamckenty/stackalytics",
"id": "afa07b03f8defe03e37f404b56047f979ae3b721",
"s... |
import django.template
register = django.template.Library()
@register.filter
def customfilter(stuff):
return "%s!" % stuff
@register.filter
def cat(stuff):
return "MEOW %s" % stuff
django.template.builtins.append(register) | {
"content_hash": "d64fc3e5e998a8cbc8a1a4ddc95883e3",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 41,
"avg_line_length": 26.333333333333332,
"alnum_prop": 0.7257383966244726,
"repo_name": "holli-holzer/python-docx",
"id": "ca076a60e4ac7ddfa37fe3d52c39391a29318594",
"size... |
"""Unit tests for the Model utilities."""
import json
import logging
from src import basetest
from src.clients import bigquery
from src.csvmatchreplace import transform
class TransformTest(basetest.TestCase):
"""Run all the ModelTests."""
def testTransformRow(self):
row1 = ['true', 'hue', 'blue']
conf... | {
"content_hash": "8c78c899f6e2379f356dc9daf3e1f7ef",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 79,
"avg_line_length": 38.67424242424242,
"alnum_prop": 0.5872673849167482,
"repo_name": "GoogleCloudPlatform/Data-Pipeline",
"id": "8c4bebbd8d753403fa24080dfbf4b1c218b02f37... |
import os
import os.path
import sys
# Django settings for map project.
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..' )
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
... | {
"content_hash": "67c56c8d43c25227cda3b64997d1badb",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 88,
"avg_line_length": 30.805882352941175,
"alnum_prop": 0.6956272675195723,
"repo_name": "haithamk/oMap",
"id": "a28532119bccad05c30577706d41149030d7a2e3",
"size": "5237"... |
""" Flask-User is a customizable user account management extension for Flask.
:copyright: (c) 2013 by Ling Thio
:author: Ling Thio (ling.thio@gmail.com)
:license: Simplified BSD License, see LICENSE.txt for more details."""
from passlib.context import CryptContext
from flask import Blueprint, current_app,... | {
"content_hash": "9ba713125c1ad244a7ebc63f6765cc80",
"timestamp": "",
"source": "github",
"line_count": 501,
"max_line_length": 161,
"avg_line_length": 44.74251497005988,
"alnum_prop": 0.6332976445396146,
"repo_name": "DimensionSoftware/Flask-User",
"id": "befa73915af012a9aed14c8a68e528897657eaae",
... |
import httplib2
import json
import sys
import DiscordGateway
sys.path.insert(0, "DiscordBot-PurpleMinion/Tools")
from NamedPipeIPC import NamedPipe
from BotConfigurations import getAuthenticationToken
from RestAPI import RestAPI
from DiscordGateway import gateway
class DiscordRequestAPI:
def __init__(self, namedPipe... | {
"content_hash": "05160cd47461de06538a3266587d2693",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 81,
"avg_line_length": 33.131147540983605,
"alnum_prop": 0.7803067788223652,
"repo_name": "alanrossx2/DiscordBot-PurpleMinion",
"id": "d5b55e0ff164db820e3b49d210e5f19aeade64f... |
from Crypto.PublicKey import RSA
from django.shortcuts import get_object_or_404
from rest_framework import generics
from rest_framework import status
from rest_framework.exceptions import PermissionDenied
from rest_framework.permissions import IsAuthenticated
from rest_framework.renderers import JSONRenderer
from res... | {
"content_hash": "27b88bbc3909a526a22131dfbdcf4006",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 99,
"avg_line_length": 36.54545454545455,
"alnum_prop": 0.6336176261549396,
"repo_name": "rfdrake/netbox",
"id": "672165da3cd877deea499a997e8118fd53c8bd15",
"size": "5628"... |
from .binary import BinaryOperation
# Less than: [c = ]a < b
class LessThan(BinaryOperation):
# Constructor
def __init__(self, *args):
# Do all the initializing stuff
super().__init__(*args)
# Set filters
self._filters = {
BinaryOperation.OperatorSide.ASSIGN: self.... | {
"content_hash": "282d4868897f067f11704f47e857cc5c",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 102,
"avg_line_length": 32.73076923076923,
"alnum_prop": 0.6239717978848414,
"repo_name": "lgrahl/klausuromat",
"id": "914b95de299487a5a1889a8707b9214f0e838685",
"size": "8... |
"""Routines to help recognizing sound files.
Function whathdr() recognizes various types of sound file headers.
It understands almost all headers that SOX can decode.
The return tuple contains the following items, in this order:
- file type (as SOX understands it)
- sampling rate (0 if unknown or hard to decode)
- nu... | {
"content_hash": "525a68501055c416daae49049838679d",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 78,
"avg_line_length": 26.195918367346938,
"alnum_prop": 0.5554689934559053,
"repo_name": "MalloyPower/parsing-python",
"id": "e5901ec58338aaae1ed33d56573b4ca0ecc0cfa1",
"... |
"""
Tests for the WebAppTest class.
"""
import os
from unittest import expectedFailure
from bok_choy.web_app_test import WebAppTest
from .pages import ImagePage
class ScreenshotAssertTest(WebAppTest):
"""
Test the integration with needle and its screenshot assertion capability.
"""
def test_needle_sc... | {
"content_hash": "f831e1146000d4b24df2ee531e2f9b8e",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 98,
"avg_line_length": 38.666666666666664,
"alnum_prop": 0.6860632183908046,
"repo_name": "drptbl/bok-choy",
"id": "f8ac1eb3599035a631b822061fa13106663d61a5",
"size": "1392... |
import re
import time
import requests
import pandas as pd
import pymysql.cursors
from bs4 import BeautifulSoup
# Runtime start
start = time.clock()
print(start)
# Connect to the database
connection = pymysql.connect(user='root', password='abc123', host='127.0.0.1', db='FUTHEAD', cursorclass=pymysql.cursors.DictCursor... | {
"content_hash": "89f08db9c649c7194b4e385a9910b062",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 148,
"avg_line_length": 36.00826446280992,
"alnum_prop": 0.5182464998852422,
"repo_name": "kafagy95/fifa18-Data",
"id": "cd29f373491ba43926488f01c7c250e8e8441f0b",
"size":... |
from oslo_db import exception as db_exc
from oslo_db.sqlalchemy import utils as sqlalchemyutils
from oslo_log import log as logging
from oslo_utils import versionutils
from nova import db
from nova.db.sqlalchemy import api as db_api
from nova.db.sqlalchemy import api_models
from nova.db.sqlalchemy import models as mai... | {
"content_hash": "2afb3ee624a3b1dcde6e3e7b3828a852",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 78,
"avg_line_length": 35.018450184501845,
"alnum_prop": 0.6162276080084299,
"repo_name": "alaski/nova",
"id": "7fe9dc518e479ae4fd6c28b3b26c2e77823ca005",
"size": "10095",... |
"""Demonstrates how to authenticate to Google Cloud Platform APIs using the
Requests HTTP library."""
import argparse
def implicit():
import google.auth
from google.auth.transport import requests
# Get the credentials and project ID from the environment.
credentials, project = google.auth.default(
... | {
"content_hash": "f95c3ab595d1ddc08b6c51af939d7ce7",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 78,
"avg_line_length": 32.184615384615384,
"alnum_prop": 0.6940726577437859,
"repo_name": "BrandonY/python-docs-samples",
"id": "f8321f077414076c1185271d3f193288266e29fb",
... |
from django.http import HttpResponse
from django.test import RequestFactory
from django.test.utils import override_settings
from csp.contrib.rate_limiting import RateLimitedCSPMiddleware
from csp.tests.utils import response
HEADER = 'Content-Security-Policy'
mw = RateLimitedCSPMiddleware(response())
rf = RequestFact... | {
"content_hash": "71c7baba60dd34ad8b07e09c2a24db95",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 65,
"avg_line_length": 29.458333333333332,
"alnum_prop": 0.7057991513437057,
"repo_name": "mozilla/django-csp",
"id": "98ccdedb7f93125d021c4ff4c7d8bc3c147b8512",
"size": "7... |
"""The Rcon driver."""
from rconsoft.dispatch.dispatcher import Signal
from rconsoft.util.signalsocket import SignalSocket
from rconsoft.config import config
#------------------------------
class RconDriver(object):
#==============================
def __init__(self):
self._init_signals()
#=... | {
"content_hash": "44b1c3b2d1ef0d33444d311a162f4e76",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 106,
"avg_line_length": 29.48,
"alnum_prop": 0.49796472184531887,
"repo_name": "adrianlee/rcon-cs",
"id": "90d80e65c3567affdead176b8c58dbfda6f03fd9",
"size": "737",
"bina... |
from django.conf import settings
from django.db import migrations, models
import openslides.utils.models
class Migration(migrations.Migration):
dependencies = [("agenda", "0005_auto_20180815_1109")]
operations = [
migrations.AlterField(
model_name="item",
name="parent",
... | {
"content_hash": "e9f5e22b5f12977ebb08f6bac860ef58",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 74,
"avg_line_length": 27.806451612903224,
"alnum_prop": 0.54292343387471,
"repo_name": "jwinzer/OpenSlides",
"id": "c4de2a12f49ed52cba7bfbce4cb9294867419bf2",
"size": "911... |
"""Test module for cgsdata"""
| {
"content_hash": "7efec850d59c9ae2c8154515bae9ea13",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 29,
"avg_line_length": 30,
"alnum_prop": 0.6666666666666666,
"repo_name": "jpoullet2000/cgs-data",
"id": "7b97ff28cd6556173f9f414ec235d4e78c120cab",
"size": "30",
"binary"... |
from flask import Flask
from flask import g, session, request, url_for, flash
from flask import redirect, render_template
from flask_oauthlib.client import OAuth
app = Flask(__name__)
app.debug = True
app.secret_key = 'development'
oauth = OAuth(app)
twitter = oauth.remote_app(
'twitter',
consumer_key='xBeX... | {
"content_hash": "f4f079356fe9bbf70dbe0971790a2444",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 79,
"avg_line_length": 27.177083333333332,
"alnum_prop": 0.6374089689536221,
"repo_name": "stianpr/flask-oauthlib",
"id": "0ed6151461704e23ca30c3e04e32e0757089a6eb",
"size"... |
"""
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the ... | {
"content_hash": "6d0b11143bfba54a862a47b5e366bb60",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 105,
"avg_line_length": 28.507462686567163,
"alnum_prop": 0.5884816753926702,
"repo_name": "melphi/algobox",
"id": "989904a7c2d9e2aba1f275f23b83fe3ee04f2221",
"size": "574... |
from unittest import TestCase
from cryptochallenge import userprofile
class TestProfileMethods(TestCase):
def test_kvparse(self):
teststr = "foo=bar&baz=qux&zap=zazzle"
print(teststr)
exp_obj = {
"foo": "bar",
"baz": "qux",
"zap": "zazzle"
}
... | {
"content_hash": "b7fd4e2eeb031b5181f2e166d0426da4",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 53,
"avg_line_length": 24.192307692307693,
"alnum_prop": 0.5230524642289348,
"repo_name": "dctelf/poisonous-mushroom",
"id": "f3cb4db57a2b5ba794dd8ae759c534b642741406",
"si... |
from __future__ import unicode_literals
from .models import kinesisvideoarchivedmedia_backends
from ..core.models import base_decorator
kinesisvideoarchivedmedia_backend = kinesisvideoarchivedmedia_backends["us-east-1"]
mock_kinesisvideoarchivedmedia = base_decorator(kinesisvideoarchivedmedia_backends)
| {
"content_hash": "6510a23b404d1e24604fcd8a7f74388c",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 83,
"avg_line_length": 50.833333333333336,
"alnum_prop": 0.8524590163934426,
"repo_name": "william-richard/moto",
"id": "c1676c87143a460272d3b5601d89a727fdf028e4",
"size": "... |
import time
import copy
import uuid
from mitmproxy import controller # noqa
from mitmproxy import stateobject
from mitmproxy import connections
from mitmproxy import version
import typing # noqa
class Error(stateobject.StateObject):
"""
An Error.
This is distinct from an protocol error respon... | {
"content_hash": "062d94b497d19b4cc52415fd041f3653",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 80,
"avg_line_length": 26.588541666666668,
"alnum_prop": 0.5657198824681685,
"repo_name": "dwfreed/mitmproxy",
"id": "7034cb4ab7951a094b78cf5713d7b2e93f0390c7",
"size": "5... |
from __future__ import unicode_literals, absolute_import
import django
DEBUG = True
USE_TZ = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "dddddddddddddddddddddddddddddddddddddddddddddddddd"
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
... | {
"content_hash": "dfbe3fd3f3dda4f3aaa2c326188e8860",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 66,
"avg_line_length": 19,
"alnum_prop": 0.6595394736842105,
"repo_name": "pbaranay/django-magic-cards",
"id": "9a5cf11b7548162153b4a73832307111c7c02e63",
"size": "628",
... |
from datetime import datetime
from dateutil import tz
from math import floor
def utcnow():
"""Returns the current time in a timezone-aware datetime object."""
return datetime.now(tz=tz.tzutc())
def unix_timestamp(dt):
"""Returns a UNIX timestamp representing the given datetime."""
try:
retur... | {
"content_hash": "637ec61de8237cf15e9049e0402e9245",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 71,
"avg_line_length": 29.82608695652174,
"alnum_prop": 0.6807580174927114,
"repo_name": "kyouko-taiga/trexmo",
"id": "6bbc3f8600580905741fb7f05b2407d90b26653a",
"size": "6... |
"""Test NULLDUMMY softfork.
Connect to a single node.
Generate 2 blocks (save the coinbases for later).
Generate 427 more blocks.
[Policy/Consensus] Check that NULLDUMMY compliant transactions are accepted in the 430th block.
[Policy] Check that non-NULLDUMMY transactions are rejected before activation.
[Consensus] Ch... | {
"content_hash": "813d96741c9f446937527f62a6aeb2a7",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 146,
"avg_line_length": 52.125,
"alnum_prop": 0.686810551558753,
"repo_name": "BTCGPU/BTCGPU",
"id": "1cf5b33e1e40a87ce660853b580d365ca102212f",
"size": "6469",
"binary"... |
"""
This module implements a simple framework for creating C-like enumerations in
Python using classes. Simply inherit from the #Enumeration class.
```python
>>> class Color(enum.Enumeration):
... red = 0
... green = 1
... blue = 2
>>> print Color.red
<Color: red>
>>> print Color('green')
<Color: green>
>>> prin... | {
"content_hash": "329f23ffa46c1caeb7f6cef0d7168a81",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 93,
"avg_line_length": 26.41839762611276,
"alnum_prop": 0.6387734471526452,
"repo_name": "nr-plugins/c4ddev",
"id": "f915e95b1243d3fcc9678b5a81be211cdf51288f",
"size": "10... |
from msrest.paging import Paged
class ExpressRouteCircuitAuthorizationPaged(Paged):
"""
A paging container for iterating over a list of :class:`ExpressRouteCircuitAuthorization <azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuitAuthorization>` object
"""
_attribute_map = {
'next_link':... | {
"content_hash": "fc2d29f7d45364ee608dd2dae0f8b227",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 173,
"avg_line_length": 36.125,
"alnum_prop": 0.6799307958477508,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "367fbd109d07d6cc3637b8c8ba5a0e7645bd2786",
"size": ... |
import unittest
from django.contrib import admin as django_admin
from django.test import client
from .. import admin, models
class ConfiguracaoAdminTestCase(unittest.TestCase):
def setUp(self):
factory = client.RequestFactory()
self.request = factory.get("/admin/configuracao/add")
self.... | {
"content_hash": "2aedf678eddd104e729725d2a5ef5f8d",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 79,
"avg_line_length": 39.61290322580645,
"alnum_prop": 0.6767100977198697,
"repo_name": "devincachu/devincachu-2013",
"id": "e51db161934b631ededc3d31726388b9ff2f8e57",
"si... |
import tempfile
import unittest
import yaml
import config_helper
import print_config
class PrintConfigTest(unittest.TestCase):
def test_load_yaml_file(self):
schema = config_helper.Schema.load_yaml("""
properties:
propertyInt:
type: int
propertyString:
type... | {
"content_hash": "fdf22a147f897e27bf4179b1b4912391",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 78,
"avg_line_length": 31.03669724770642,
"alnum_prop": 0.5300029559562518,
"repo_name": "GoogleCloudPlatform/marketplace-k8s-app-tools",
"id": "9077476e4f610badb7144d394ee5... |
from django.contrib.contenttypes.models import ContentType
from django.db import models, transaction
from wagtail.wagtailcore.models import Page
from content.models import ContentPage
from kehmet.models import KehmetContentPage, KehmetFrontPage
cp_type = ContentType.objects.get_for_model(ContentPage)
k_root = Page.o... | {
"content_hash": "12d8af5e8ed1745fcf8e4998b72e7f8b",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 73,
"avg_line_length": 30.604166666666668,
"alnum_prop": 0.6977535738597685,
"repo_name": "terotic/digihel",
"id": "4c87028ef44c1a513fd0ec317d7c3400c5e92a6c",
"size": "1469... |
"""
Utility base TestCase classes for testing manage views.
"""
from datetime import datetime
from . import base
class ListViewTestCase(base.FormViewTestCase, base.ListViewTestCase):
"""Base class for testing manage list views."""
# subclasses should specify these:
perm = None # required manag... | {
"content_hash": "22e122177fe6edb1b87643f3ee399126",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 78,
"avg_line_length": 27.754010695187166,
"alnum_prop": 0.5947976878612716,
"repo_name": "mccarrmb/moztrap",
"id": "beffd6e767f26b666fcb15b0524a7874180d97d0",
"size": "51... |
"""Volume manager service, the main entry point that manages volumes."""
from __future__ import absolute_import
import os
import json
import stat
from uuid import UUID, uuid4
from characteristic import attributes
from twisted.python.filepath import FilePath
from twisted.application.service import Service
from twist... | {
"content_hash": "b53d112059758f80f5ed13b8e8d272fe",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 79,
"avg_line_length": 35.848314606741575,
"alnum_prop": 0.6019432690800814,
"repo_name": "beni55/flocker",
"id": "e147d3b43a22b7542f2f8dfd03ce7b2d0852bcfe",
"size": "1288... |
from heat.common.i18n import _
from heat.engine import constraints
from heat.engine import properties
from heat.engine import resource
from heat.engine import support
class KeystoneProject(resource.Resource):
"""Heat Template Resource for Keystone Project."""
support_status = support.SupportStatus(
v... | {
"content_hash": "9dda04285b6a7f2d102cdb417d5307fc",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 73,
"avg_line_length": 30.24,
"alnum_prop": 0.5603174603174603,
"repo_name": "takeshineshiro/heat",
"id": "fa7a97b81a8af888c46ab09468a5c6ae8dd23a42",
"size": "4355",
"bi... |
import operator
from .. import inspect
from .. import util
from ..sql import and_
from ..sql import operators
class UnevaluatableError(Exception):
pass
class _NoObject(operators.ColumnOperators):
def operate(self, *arg, **kw):
return None
def reverse_operate(self, *arg, **kw):
return N... | {
"content_hash": "573f619a58421b80eb61a263fa563dc6",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 79,
"avg_line_length": 28.264957264957264,
"alnum_prop": 0.511037193831267,
"repo_name": "monetate/sqlalchemy",
"id": "69d80dd8bdbaae82728fec838b21e49c4f5f0e18",
"size": "... |
from __future__ import unicode_literals
try:
from urlparse import urlparse, parse_qs
except ImportError: # Python 3
from urllib.parse import urlparse, parse_qs
import os
from didel.base import DidelEntity
from didel.fileutils import date2timestamp, mkdir_p, file_mtime
from didel.souputils import parse_homem... | {
"content_hash": "3ea49ff2bce726ffa2290cbd6d6a5e8f",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 80,
"avg_line_length": 31.234615384615385,
"alnum_prop": 0.5707425193941633,
"repo_name": "bfontaine/didelcli",
"id": "b92c4cee039abb541168d9ecf51c30f839ad91f9",
"size": "... |
import re
from typing import List
from gitlint.git import GitCommit
from gitlint.options import StrOption
from gitlint.rules import CommitMessageTitle, LineRule, RuleViolation
# Word list from https://github.com/m1foley/fit-commit
# Copyright (c) 2015 Mike Foley
# License: MIT
# Ref: fit_commit/validators/tense.rb
WO... | {
"content_hash": "c1ddd5c325af2082c974de8351e5cc6b",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 79,
"avg_line_length": 36.061349693251536,
"alnum_prop": 0.6017352841102416,
"repo_name": "showell/zulip",
"id": "da70b63f117646ae08c62de1402d8b3e0be980a3",
"size": "5878"... |
from oslo.config import cfg
import testtools
from testtools import matchers
from neutron.common import exceptions as exc
from neutron.db import api as db
from neutron.plugins.ml2 import db as ml2_db
from neutron.plugins.ml2 import driver_api as api
from neutron.plugins.ml2.drivers import type_vxlan
from neutron.tests ... | {
"content_hash": "e8f72cc29cdbae71093d6b7b2556fdbd",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 79,
"avg_line_length": 41.2877358490566,
"alnum_prop": 0.5782017593967782,
"repo_name": "rickerc/neutron_audit",
"id": "b9f83b7d67ffb41e0fa2fa16c4b90d6c23294528",
"size": ... |
from operator import sub
from itertools import combinations
def checkio(cakes):
distance = lambda v: sum(v[i]**2 for i in range(2))**.5
normalize = lambda v: ['{:.3f}'.format(v[i]/distance(v)) for i in range(2)]
vectors = {}
for a, b in combinations(sorted(cakes), 2):
vect = list(map(sub, b,a)... | {
"content_hash": "cabfbd48b2ce1d2cd6482de3fbe026ae",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 79,
"avg_line_length": 35.48148148148148,
"alnum_prop": 0.5187891440501043,
"repo_name": "Pouf/CodingCompetition",
"id": "f5387e506571617c23b68e8b500c54b9e8ab577f",
"size":... |
from django.dispatch import receiver
from django.db.models.signals import m2m_changed
from django.db.models import get_model
from oscar.apps.basket.abstract_models import AbstractBasket
Voucher = get_model('voucher', 'Voucher')
OrderDiscount = get_model('order', 'OrderDiscount')
ConditionalOffer = get_model('offer', '... | {
"content_hash": "7e967af8eb14a4956b18d08669254a56",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 69,
"avg_line_length": 39.94736842105263,
"alnum_prop": 0.6996047430830039,
"repo_name": "Idematica/django-oscar",
"id": "845858372718e2b10c01b65607ae08b2f7a2d8b4",
"size":... |
from __future__ import absolute_import, division, print_function
import datashape
from datashape import (dshape, DataShape, Record, isdimension, Option,
discover, Tuple)
from .dispatch import dispatch
from .expr import Expr
from .compatibility import _strtypes
__all__ = []
try:
import pyspark
from p... | {
"content_hash": "c67d830dd7fba441e515c7769dab30e5",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 114,
"avg_line_length": 35.674285714285716,
"alnum_prop": 0.5720006407176037,
"repo_name": "vitan/blaze",
"id": "4fda3f949cedc80cd212a335ba1226dbef8d2a85",
"size": "6243",... |
from verbs.baseforms import forms
class CloseForm(forms.VerbForm):
name = "Close"
slug = "close"
edit_what_remark = forms.CharField()
duration_min_time = forms.IntegerField()
| {
"content_hash": "bbbd2aec511070ee44da7746fc001677",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 44,
"avg_line_length": 19.5,
"alnum_prop": 0.6871794871794872,
"repo_name": "Bionetbook/bionetbook",
"id": "64f6c64dd34ebd16320b9cb65f2026eeeff4c660",
"size": "195",
"bin... |
import re
import itertools
import collections
import logging
import inspect
from datetime import datetime, date
from django.conf import settings
from django.utils.http import parse_http_date, http_date
from django.http import Http404, HttpResponse as _HttpResponse
from django.core.handlers.wsgi import STATUS_CODE_TEXT
... | {
"content_hash": "42764c656e7eae2b09de0a5e5981dc40",
"timestamp": "",
"source": "github",
"line_count": 436,
"max_line_length": 80,
"avg_line_length": 37.24770642201835,
"alnum_prop": 0.624692118226601,
"repo_name": "mohamedattahri/Nuages",
"id": "d53f4063c746570dfa1fc9d66eb2573ad47e0d38",
"size": ... |
try:
import hashlib
md5er = hashlib.md5
except ImportError, e:
import md5
md5er = md5.new
import optparse
import os
from os.path import abspath, join, dirname, basename, exists
import pickle
import re
import sys
import subprocess
import multiprocessing
from subprocess import PIPE
# Disabled LINT rules and re... | {
"content_hash": "9942d00089ab1ecdc8a13d66feabd552",
"timestamp": "",
"source": "github",
"line_count": 355,
"max_line_length": 81,
"avg_line_length": 27.52112676056338,
"alnum_prop": 0.6387922210849539,
"repo_name": "mogoweb/webkit_for_android5.1",
"id": "a5f4c614d04a800c816991bdc6a00f27101aa5f1",
... |
from __future__ import division, print_function, absolute_import
from warnings import warn
import numpy as np
from dipy.reconst.dti import fractional_anisotropy, color_fa
from scipy.ndimage.filters import median_filter
try:
from skimage.filters import threshold_otsu as otsu
except:
from .threshold import ot... | {
"content_hash": "fbd61beed04bc769b7e856429550d023",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 86,
"avg_line_length": 30.28352490421456,
"alnum_prop": 0.6266447368421053,
"repo_name": "JohnGriffiths/dipy",
"id": "fd3f2736e46bb25c9081f9b0cf00a99c4ed00772",
"size": "7... |
"""
@file
@brief Shortcut for ``setuphelper``
"""
from .setup_creation import create_empty_folder_setup, create_folder_setup
| {
"content_hash": "bed80f4d0266e87ac599547a273457f4",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 74,
"avg_line_length": 21,
"alnum_prop": 0.7380952380952381,
"repo_name": "sdpython/pymyinstall",
"id": "cd0675f52d831e1b8f89e7f617d8cacf768dd6e6",
"size": "126",
"binary"... |
import simuvex
class setvbuf(simuvex.SimProcedure):
def run(self, stream, buf, type_, size):
return 0
| {
"content_hash": "9d27109a38a49ae11907a8697c4a65c6",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 44,
"avg_line_length": 23,
"alnum_prop": 0.6782608695652174,
"repo_name": "zhuyue1314/simuvex",
"id": "a71640edf4695b00f47abc642d449160f93c4bb5",
"size": "115",
"binary": ... |
"""
To change the version of entire package, just edit this one location.
"""
__title__ = 'newspaper'
__author__ = 'Lucas Ou-Yang'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014, Lucas Ou-Yang'
version_info = (0, 2, 2)
__version__ = ".".join(map(str, version_info))
| {
"content_hash": "c7519d2001839fbd8dbc9fa77461ec2b",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 69,
"avg_line_length": 27.2,
"alnum_prop": 0.6323529411764706,
"repo_name": "Factr/newspaper",
"id": "aa77537ed05c18d1443a1657cab3d1330fedac43",
"size": "296",
"binary": ... |
from matplotlib.colors import Normalize,LinearSegmentedColormap,cbook,ma
from matplotlib.cm import datad
import numpy as np
"""These functions allow for the creation of 'divergent' colorbars
out of *any* two existing matplotlib colorbars. They are
stitched together such that the split between the two colorbars
always... | {
"content_hash": "cd3d33744b699f1cac716a8709d67bba",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 78,
"avg_line_length": 32.88535031847134,
"alnum_prop": 0.5800890954871198,
"repo_name": "CKrawczyk/densityplot",
"id": "bb574636eb21e83a832690c2699e10fde89c4387",
"size":... |
"""Tests for the mobile_app HTTP API."""
# pylint: disable=redefined-outer-name,unused-import
import pytest
from homeassistant.components.mobile_app.const import CONF_SECRET, DOMAIN
from homeassistant.const import CONF_WEBHOOK_ID
from homeassistant.setup import async_setup_component
from .const import REGISTER, RENDE... | {
"content_hash": "fbf0ac789890a0ae9fdb6767c2b5e0d9",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 75,
"avg_line_length": 33.901234567901234,
"alnum_prop": 0.6504005826656956,
"repo_name": "jabesq/home-assistant",
"id": "80f01315f705e9390b023e242edf44fe9227abc8",
"size":... |
from __future__ import absolute_import
from freight.api.serializer import serialize
from freight.testutils import TestCase
class TaskSerializerTest(TestCase):
def test_locked(self):
user = self.create_user()
repo = self.create_repo()
app = self.create_app(repository=repo)
result ... | {
"content_hash": "3a876dc8719fdbff3e1b1079ad278182",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 46,
"avg_line_length": 28.133333333333333,
"alnum_prop": 0.6635071090047393,
"repo_name": "klynton/freight",
"id": "6c02cecebce6f1aec33d2fc48a25f82fe540895c",
"size": "422"... |
import argparse
import sympy
import sys
from sympy import Symbol as Sym
class DuoSymbol:
def __init__(self, name, value):
self.name = name
self.value = float(value)
def __repr__(self):
return "DuoSymbol('{}', {})".format(self.name, self.value)
class KinematicEquation:
def __init__(self, func, variables)... | {
"content_hash": "c61c5e4d46e0691d24ca4a27649d718d",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 71,
"avg_line_length": 24.324675324675326,
"alnum_prop": 0.6449546182594768,
"repo_name": "kochman/kinematic",
"id": "1c236a6a891ebc09446f7c5a5de17e68bdbce23e",
"size": "18... |
import os, sys
import imp
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *
constants = imp.load_source('modulename', 'constants.py')
from decimal import *
def approve_or_decline_held_transaction(transactionId):
merchantAuth = apicontractsv1.merchantAuthenticationType()
merchan... | {
"content_hash": "4409e6e5abf390f69785227fd9bd1cf7",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 124,
"avg_line_length": 50.056603773584904,
"alnum_prop": 0.6871466264606106,
"repo_name": "AuthorizeNet/sample-code-python",
"id": "ce9947e8585b5a3031fcb44a808f8a5c219dbdca"... |
import csv
import json
import time
import itertools
from datetime import timedelta
from django import http
from django.core.exceptions import PermissionDenied
from django.core.files.storage import get_storage_class
from django.db.transaction import non_atomic_requests
from django.http import HttpResponse
from django.... | {
"content_hash": "2b64cdcf4f204d2f7f608ce857ed66b8",
"timestamp": "",
"source": "github",
"line_count": 431,
"max_line_length": 87,
"avg_line_length": 31.301624129930396,
"alnum_prop": 0.6150767178118746,
"repo_name": "wagnerand/addons-server",
"id": "0fac8073bb2215fda2b2f3236d110165b92ca252",
"siz... |
from __future__ import absolute_import
from django import VERSION as django_version
from django import forms
from django.conf import settings
from django.utils.encoding import force_text
from django.utils.safestring import mark_safe
from django.utils.html import format_html
from .utils import get_icon_choices
CHOICE... | {
"content_hash": "4dd9c2f58131f315375a61697e49ae26",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 127,
"avg_line_length": 36,
"alnum_prop": 0.5893939393939394,
"repo_name": "redouane/django-fontawesome",
"id": "3589cddb4d11f4cc0104f173cf3f41f24970528d",
"size": "1980",
... |
"""
Manage a single benchmark and, when run from the commandline, report
its runtime to stdout.
"""
# !!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!
# This file, unlike most others, must be compatible with as many
# versions of Python as possible and have no dependencies outside of
# the Python standard library. This... | {
"content_hash": "ea4f0fe0dbea910032f879a23d1db84e",
"timestamp": "",
"source": "github",
"line_count": 487,
"max_line_length": 86,
"avg_line_length": 31.018480492813143,
"alnum_prop": 0.5483251688070965,
"repo_name": "cpcloud/asv",
"id": "c177a584e03e4b7ede37967f3cd8d64bcab891ef",
"size": "15195",... |
"""
Combiner for sort with Hadoop streaming.
"""
from __future__ import print_function
import sys
def main(stdin):
"""
Take unsorted standard input from mapper and return sorted block.
Value is just a place holder.
"""
for line_num in sorted(stdin):
# Remove trailing newlines.
line... | {
"content_hash": "ef339ad448b0a82e6c6ea0833971065c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 69,
"avg_line_length": 24.6,
"alnum_prop": 0.5788617886178862,
"repo_name": "stharrold/bench_mapr",
"id": "0983434e90c81fbce56709960612a729d55d50ee",
"size": "637",
"bina... |
from __future__ import unicode_literals
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import object
import configparser
from jnpr.space import xmlutil
from jnpr.space import rest
class TestDevices(object):
def setup_class(self):
... | {
"content_hash": "82b2f95b0e7805bc0a8266802de76407",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 82,
"avg_line_length": 38.56953642384106,
"alnum_prop": 0.5444711538461539,
"repo_name": "Juniper/py-space-platform",
"id": "90631ed251e87df0b637402e88852baf2f95e19a",
"si... |
"""Tests for `multi_process_runner`."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
import time
from six.moves import queue as Queue
from tensorflow.python.distribute import multi_process_runner
from tensorflow.python.distribute ... | {
"content_hash": "c2ad99409c4811f91f7bb9e8fb4413ea",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 78,
"avg_line_length": 33.98924731182796,
"alnum_prop": 0.6621322366339766,
"repo_name": "jhseu/tensorflow",
"id": "839646a5d1f7f9a8be282b274ff884e7394a908f",
"size": "701... |
"""
flask.ext.security.forms
~~~~~~~~~~~~~~~~~~~~~~~~
Flask-Security forms module
:copyright: (c) 2012 by Matt Wright.
:license: MIT, see LICENSE for more details.
"""
import inspect
try:
from urlparse import urlsplit
except ImportError:
from urllib.parse import urlsplit
from flask impor... | {
"content_hash": "1c906aecb8bf1cdfb9e8b4b757e8ffe3",
"timestamp": "",
"source": "github",
"line_count": 287,
"max_line_length": 81,
"avg_line_length": 31.480836236933797,
"alnum_prop": 0.6598782512451578,
"repo_name": "maxziv/SEApp",
"id": "54876ae8727364b5da0994b76ba2e22dce94e7ed",
"size": "9059",... |
from msrest.serialization import Model
class RuleAction(Model):
"""The action that is performed when the alert rule becomes active, and when
an alert condition is resolved.
You probably want to use the sub-classes and not this class directly. Known
sub-classes are: RuleEmailAction, RuleWebhookAction
... | {
"content_hash": "9c45a502e5359ca1f8486f7875dd3a65",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 187,
"avg_line_length": 31.548387096774192,
"alnum_prop": 0.6697341513292433,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "3fbc729ef113fca8554b24a81fc430ddae58854f",
... |
from f5_openstack_agent.lbaasv2.drivers.bigip.icontrol_driver import \
iControlDriver
from f5_openstack_agent.lbaasv2.drivers.bigip.system_helper import \
SystemHelper
import json
import logging
import os
import pytest
import requests
from ..testlib.bigip_client import BigIpClient
from ..testlib.fake_rpc impo... | {
"content_hash": "bf665043f0bbf0d246dce1e26160c55a",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 78,
"avg_line_length": 29.02803738317757,
"alnum_prop": 0.6748229233741146,
"repo_name": "F5Networks/f5-openstack-agent",
"id": "5b257ec16b94e733965dc00a54992eccf4594a84",
... |
import sys
import 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.abspat... | {
"content_hash": "9cdc986560b72d419af0edf12ec4452a",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 76,
"avg_line_length": 30.3690036900369,
"alnum_prop": 0.701093560145808,
"repo_name": "zmitchell/realms",
"id": "bf547efadee37fafc9b4fc6e2d7c50a72a9990ff",
"size": "8671"... |
from tgext.pluggable import PluggableSession
DBSession = PluggableSession()
def init_model(app_session):
DBSession.configure(app_session)
from models import TemporaryPhotosBucket | {
"content_hash": "a02bda2b7aae32e4d7f564867e03fb7c",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 44,
"avg_line_length": 18.7,
"alnum_prop": 0.8128342245989305,
"repo_name": "gasbasd/tgapp-stroller2",
"id": "2d33ec32b7198daeed268b97983b6d54532ec9dd",
"size": "211",
"b... |
getObject = {
'id': 1000,
'globalIdentifier': '1a2b3c-1701',
'datacenter': {'id': 50, 'name': 'TEST00',
'description': 'Test Data Center'},
'billingItem': {
'id': 6327,
'recurringFee': 1.54,
'nextInvoiceTotalRecurringAmount': 16.08,
'children': [
... | {
"content_hash": "44567040f227f86b0b5f34c43a674c0b",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 73,
"avg_line_length": 28.557377049180328,
"alnum_prop": 0.5229621125143513,
"repo_name": "skraghu/softlayer-python",
"id": "26dc7c3bf690994cd282ed7874531e9f61003b8e",
"si... |
from __future__ import print_function
from keras.preprocessing import sequence
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras.layers import Embedding
from keras.layers import Conv1D, GlobalMaxPooling1D
from keras.datasets import imdb
# set parameters:
def build_mo... | {
"content_hash": "192f7d7e7daef01022fa49822587e9bc",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 79,
"avg_line_length": 32.96153846153846,
"alnum_prop": 0.6213535589264878,
"repo_name": "Avsecz/concise",
"id": "fe1d715110c22284baa0c572e8acaf134b42145a",
"size": "1714",... |
class PermissionException(Exception):
pass
| {
"content_hash": "7deda8d334daa549ad8441666d6fbebe",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 37,
"avg_line_length": 23.5,
"alnum_prop": 0.7872340425531915,
"repo_name": "davidsanfal/bii-ide",
"id": "3d820eb31df49a420ad02cd6d64d28288d0d6054",
"size": "47",
"binary"... |
from urlparse import urlparse, urljoin
from flask import request, redirect
from flask.ext.wtf import Form
from flask.ext.wtf import HiddenField, BooleanField, TextField, PasswordField
from flask.ext.wtf import Required, Length, EqualTo, Email, URL
def is_safe_url(target):
ref_url = urlparse(request.host_url)
... | {
"content_hash": "abc28a7d27b3bce208a0c276c7357451",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 85,
"avg_line_length": 32.5,
"alnum_prop": 0.6527472527472528,
"repo_name": "Avamagic/mgserver-web-api",
"id": "828e64a679439690231e03b0bccf97d8a90fe8c7",
"size": "1820",
... |
import os
from string import digits
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
def get_setting(name, default=None):
return getattr(settings, f"LIPPUKALA_{name}", default)
def get_integer_setting(name, default=0):
try:
value = get_setting(name, default)
... | {
"content_hash": "bf96b2af70ab4d8b8b2bf9baa7e76bcf",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 109,
"avg_line_length": 36.05882352941177,
"alnum_prop": 0.6443719412724307,
"repo_name": "kcsry/lippukala",
"id": "fbba471e281e2ef7bdcfe9abf5514da83e66a091",
"size": "3065... |
from Child import Child
from Node import Node # noqa: I201
ATTRIBUTE_NODES = [
# token-list -> token token-list?
Node('TokenList', kind='SyntaxCollection',
element='Token'),
# attribute -> '@' identifier '('? token-list ')'?
Node('Attribute', kind='Syntax',
children=[
C... | {
"content_hash": "f3ef58bcda6d2f027b759c93bab9c8a4",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 55,
"avg_line_length": 31.095238095238095,
"alnum_prop": 0.5865237366003063,
"repo_name": "frootloops/swift",
"id": "6825b5e235f2a18d4e1330a40fba01da9a01468a",
"size": "653... |
from test.ditestcase import DITestCase
from mock import Mock, patch
from os.path import expanduser
class ConfigurationTests(DITestCase):
def setUp(self):
super(ConfigurationTests, self).setUp()
self.patchers = {
'configparser': patch('scrolls.configuration.configparser'),
... | {
"content_hash": "01dfe0173e09fa9bf976d11d21448265",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 73,
"avg_line_length": 40.160919540229884,
"alnum_prop": 0.6402404121350888,
"repo_name": "ilogue/scrolls",
"id": "4eaf4889d56f479c07fa6ee6cf49c372111f18fd",
"size": "3494"... |
"""Django Template Tags for the socialprofile module"""
| {
"content_hash": "8d4ca3e5e42ffebf94c5bb3594a7621a",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 55,
"avg_line_length": 56,
"alnum_prop": 0.7678571428571429,
"repo_name": "DLRSP/django-sp",
"id": "08d57a26c9f0df54635171b0a4798d697cbca24d",
"size": "56",
"binary": fals... |
"""Library containing utility functions used for Chrome-specific build tasks."""
from __future__ import print_function
import ast
import functools
import glob
import os
import re
import shlex
import shutil
import sys
from chromite.lib import failures_lib
from chromite.lib import cros_build_lib
from chromite.lib impo... | {
"content_hash": "273b63b5a4be42266cfd137ae5a403e6",
"timestamp": "",
"source": "github",
"line_count": 589,
"max_line_length": 80,
"avg_line_length": 36.10016977928693,
"alnum_prop": 0.6511781028076942,
"repo_name": "endlessm/chromium-browser",
"id": "ca024a51aa04376e7796e5df88d6db4b657f7208",
"si... |
from setuptools import setup
setup(
name='JissRenderingService',
description='Service for operations on files.',
version='1.0',
author='Anton Iskov',
author_email='aiskov@jiss-software.com',
url='http://www.jiss-software.com',
packages=[
'core',
'handler',
'utils'
... | {
"content_hash": "5728aa4d7d7fe8886af56595a5972e55",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 51,
"avg_line_length": 20.75,
"alnum_prop": 0.5614457831325301,
"repo_name": "jiss-software/jiss-rendering-service",
"id": "e650a17e2548277594ffeee879f549c9837d382d",
"size... |
"""Test node responses to invalid locators.
"""
from test_framework.messages import msg_getheaders, msg_getblocks, MAX_LOCATOR_SZ
from test_framework.mininode import P2PInterface
from test_framework.test_framework import BitcoinTestFramework
class InvalidLocatorTest(BitcoinTestFramework):
def set_test_params(sel... | {
"content_hash": "00905869cc3dcce2093af196693397a4",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 135,
"avg_line_length": 44.69230769230769,
"alnum_prop": 0.6431440045897877,
"repo_name": "UdjinM6/dash",
"id": "c8c752d1f7cbd59e82cbeccb83356f9f03152fda",
"size": "1957",
... |
"""This module implements the :class:`CropObjectClass`, which
represents one possible :class:`CropObject` class, such as
a notehead or a time signature. Aside from defining the "vocabulary"
of available object classes for annotation, it also contains
some information about how objects of the given class should
be displ... | {
"content_hash": "87f25b910e41ff3e0db48d0c7bfe2c20",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 83,
"avg_line_length": 34.43065693430657,
"alnum_prop": 0.6277294890820436,
"repo_name": "hajicj/muscima",
"id": "83d725cc35ec5a081e3a23a20c7ec1c11d2ed1c9",
"size": "4717"... |
import maya.cmds as mc
import pymel.core as pm
# appleseedMaya imports.
from appleseedMaya.logger import logger
class AEappleseedNodeTemplate(pm.ui.AETemplate):
def __init__(self, nodeName):
super(AEappleseedNodeTemplate, self).__init__(nodeName)
self.buildBody(nodeName)
logger.debug('Bu... | {
"content_hash": "14a5a7a1e5a32632552daba51e54f9d7",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 90,
"avg_line_length": 40.216,
"alnum_prop": 0.6246270141237319,
"repo_name": "dictoon/appleseed-maya",
"id": "cab47effd444022671b9f6b3a962c34154200ede",
"size": "6335",
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('enhance', '0018_auto_20170306_0714'),
]
operations = [
migrations.CreateModel(
name='DiffTokenVectorElement',
fields=[
... | {
"content_hash": "140288faa0fe3f16f1b9ccdfd8697eee",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 128,
"avg_line_length": 38.964285714285715,
"alnum_prop": 0.5866177818515124,
"repo_name": "nanchenchen/script-analysis",
"id": "be5c9fbf24994c9c49c6f3fb49cb7c81c4e8ca45",
... |
"""Collect Treadmill node information after a crash.
"""
import os
import glob
import logging
import shutil
import tempfile
from treadmill import fs
from treadmill import subproc
_LOGGER = logging.getLogger(__name__)
_IFCONFIG = 'ifconfig'
_SYSCTL = 'sysctl'
_DMESG = 'dmesg'
_TAIL = 'tail'
def _safe_copy(src, d... | {
"content_hash": "9bbcd63141d52b31ef22bbf362f8cdb9",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 77,
"avg_line_length": 28.226190476190474,
"alnum_prop": 0.6193589202867988,
"repo_name": "gaocegege/treadmill",
"id": "c6f19058fa44b4ecb49d6a3f9175806fcd600239",
"size": ... |
"""Backend objects for saving and loading data
DataStores provide a uniform interface for saving and loading data in different
formats. They should not be used directly, but rather through Dataset objects.
"""
from .common import AbstractDataStore
from .memory import InMemoryDataStore
from .netCDF4_ import NetCDF4Data... | {
"content_hash": "d329dcd4722f0ab9f1be54530779efd4",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 79,
"avg_line_length": 38.833333333333336,
"alnum_prop": 0.8240343347639485,
"repo_name": "NicWayand/xray",
"id": "a082bd53e5ebe9f7a553adb70adb9e07b4509495",
"size": "466",... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# Standard imports
from future import standard_library
standard_library.install_aliases()
from builtins import *
import unittest
import datetime as pydt
import logging
imp... | {
"content_hash": "9061bb507f413b7bbb3f92e66d1bb938",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 92,
"avg_line_length": 38.98837209302326,
"alnum_prop": 0.7450044736057262,
"repo_name": "e-mission/e-mission-server",
"id": "f043e198eeb39b2ace872619fa33435d17cbd2e9",
"si... |
from __future__ import division
from fable \
import unsigned_integer_scan, \
identifier_scan, \
find_closing_parenthesis, \
SemanticError
from fable import tokenization
from fable import intrinsics
from fable import equivalence
from fable import utils
import sys
class Error(Exception): pass
class raise_errors... | {
"content_hash": "90e8eae2f7b4007417ad1ca1fb98c281",
"timestamp": "",
"source": "github",
"line_count": 3116,
"max_line_length": 79,
"avg_line_length": 32.41463414634146,
"alnum_prop": 0.5775909864955844,
"repo_name": "hickerson/bbn",
"id": "582e4c20bbdb50da27b6373f5a6f8f30b90514e8",
"size": "10100... |
import os
from conjureup.app_config import app
from conjureup.controllers.summary import common
from conjureup.ui.views.summary import SummaryView
from ubuntui.ev import EventLoop
class SummaryController:
def __init__(self):
self.view = None
self.save_path = os.path.join(app.config['spell-dir'],... | {
"content_hash": "024662b11f2c5c5c7736833307e59532",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 70,
"avg_line_length": 32.59375,
"alnum_prop": 0.6069031639501438,
"repo_name": "battlemidget/conjure-up",
"id": "4a1483826e90987de6eb89db527ee7e57c58f119",
"size": "1043",... |
""" ID3v2 Frames """
__author__ = "Alastair Tse <alastair@tse.id.au>"
__license__ = "BSD"
__copyright__ = "Copyright (c) 2004, Alastair Tse"
__revision__ = "$Id: id3v2frame.py,v 1.4 2004/12/21 12:02:06 acnt2 Exp $"
from tagger.constants import *
from tagger.exceptions import *
from tagger.utility import *
from tagg... | {
"content_hash": "c0fc0b5510439fe7d4a98f1295cc8fea",
"timestamp": "",
"source": "github",
"line_count": 617,
"max_line_length": 131,
"avg_line_length": 32.6612641815235,
"alnum_prop": 0.5219829297340214,
"repo_name": "Ciantic/pytagger",
"id": "f4fdcbaae11e7e5990be94319c398ed241d6da49",
"size": "201... |
from __future__ import print_function, division
import numpy as np
from scipy.stats import sem
from agaro.output_utils import get_recent_model
from agaro.measure_utils import measures, t_measures, params
def seg_intersect(p1, p2, yi):
x1, y1 = p1
x2, y2 = p2
m = (y2 - y1) / (x2 - x1)
c = y1 - m * x1
... | {
"content_hash": "84c16e8a4e0e9ed232f32a482de52558",
"timestamp": "",
"source": "github",
"line_count": 457,
"max_line_length": 77,
"avg_line_length": 24.11597374179431,
"alnum_prop": 0.6162780146992106,
"repo_name": "eddiejessup/ahoy",
"id": "a60666e736b821ea2da4566ee042a9a6b9c52048",
"size": "110... |
import timeit
from scapy.layers.inet import TCP, IP, ICMP, UDP
__author__ = 'tal'
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
import socket
class Scanner():
def __init__(self, dst_ip, src_ip, timeout, scan_type, ports_list=None):
if not ports_list or... | {
"content_hash": "b4d3fe3235351036a42d33b341ac55f8",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 116,
"avg_line_length": 46.14383561643836,
"alnum_prop": 0.5150660531393796,
"repo_name": "talp101/Scanning-tool",
"id": "0ab28adbc78eecaa39825e954ba0bbca2a0f7766",
"size"... |
import sys
from easygui import *
from getNBlinkN2nanpyLCD import taha
def phase1():
msg = "Hi, Please type a positive integer :)"
n = integerbox(msg=msg, default=1, lowerbound=1)
taha(n)
msgbox(msg='Your number is {}. :)'.format(n))
| {
"content_hash": "88ca7536d3fc883a22a5b554cfb9abc7",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 52,
"avg_line_length": 25.1,
"alnum_prop": 0.6693227091633466,
"repo_name": "pooyapooya/rizpardazande",
"id": "838a2a20f881772264499f50c35a9a7908e39666",
"size": "251",
"... |
import random
import numpy as np
import tensorflow as tf
from language_model import LM
from hparams import HParams
def get_test_hparams():
return HParams(
batch_size=21,
num_steps=12,
num_shards=2,
num_layers=1,
learning_rate=0.2,
max_grad_norm=1.0,
vocab_s... | {
"content_hash": "2d6fcb1a87a01b4a4a7bab51dd6f8aeb",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 102,
"avg_line_length": 28.25423728813559,
"alnum_prop": 0.5410917816436712,
"repo_name": "DorRosenblum/tf_flstm_f-lm",
"id": "3d38c53792381c830cf49c16bd2da76800e0efc8",
"s... |
from typing import Type, TypeVar
class MyClass:
class_attr = 42
def __init__(self, attr):
self.inst_attr = attr
T = TypeVar('T', bound=MyClass)
def func(x: Type[T]):
# It will be resolved on "Go to Declaration" in the editor due to the "implicit" resolve context.
x.inst_attr
# <ref... | {
"content_hash": "305180a9d69d1d86e20132597953bdbb",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 102,
"avg_line_length": 18.941176470588236,
"alnum_prop": 0.6242236024844721,
"repo_name": "google/intellij-community",
"id": "a08ebfbd5ca724a3a1ce28b3194ba300a80effef",
"s... |
import unittest
def path_sum(root, given_sum):
all_paths = []
if root is not None:
path_sum_recursive(root, 0, [], given_sum, all_paths)
return all_paths
def path_sum_recursive(root, prev, path, given_sum, all_paths):
if root is not None:
path.append(root.val())
current = roo... | {
"content_hash": "e8f9f21e9de6cde5713c29f734cf831d",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 99,
"avg_line_length": 28.397590361445783,
"alnum_prop": 0.4705133644463301,
"repo_name": "Alex-Diez/python-tdd-katas",
"id": "7249349decb442a13e10bf31578f8de6ebcdff57",
"s... |
from typing import MutableMapping, MutableSequence
import proto # type: ignore
from google.cloud.appengine_admin_v1.types import (
network_settings as ga_network_settings,
)
__protobuf__ = proto.module(
package="google.appengine.v1",
manifest={
"Service",
"TrafficSplit",
},
)
class... | {
"content_hash": "261ee8c2def9ebbf9eab0de7bc168fac",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 81,
"avg_line_length": 34.97744360902256,
"alnum_prop": 0.6352106620808254,
"repo_name": "googleapis/python-appengine-admin",
"id": "e09e6285230d43adecced55492fdf14e92ba07e2... |
import logging
import signal
import time
import warnings
from datetime import datetime, timedelta
from itertools import repeat
from rq.exceptions import NoSuchJobError
from rq.job import Job
from rq.queue import Queue
from redis import WatchError
from .utils import from_unix, to_unix, get_next_scheduled_time
logge... | {
"content_hash": "759bdd8481f80ebea83a29a6b8409ef9",
"timestamp": "",
"source": "github",
"line_count": 348,
"max_line_length": 117,
"avg_line_length": 38.87356321839081,
"alnum_prop": 0.5700029568302779,
"repo_name": "lechup/rq-scheduler",
"id": "6a6598bbddd03d6322a3d21987ece89f36a69dcc",
"size": ... |
"""Tests for tpu_trainer_lib."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Dependency imports
from DLT2T.tpu import tpu_trainer_lib as lib
from DLT2T.utils import trainer_utils
from DLT2T.utils import trainer_utils_test
import tensorflow as tf
c... | {
"content_hash": "52253feae7913ca059eeec4d18d96e21",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 77,
"avg_line_length": 30.452830188679247,
"alnum_prop": 0.6933085501858736,
"repo_name": "renqianluo/DLT2T",
"id": "d5c6bdc1059c8be1a23e94fc5d278ed81218c3b4",
"size": "221... |
"""
Django settings for dsap project.
Generated by 'django-admin startproject' using Django 1.8.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths ... | {
"content_hash": "be81850b41ed1ff56fefe646ea227dd8",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 82,
"avg_line_length": 28.607843137254903,
"alnum_prop": 0.6922549691569568,
"repo_name": "CIRALabs/DSAP",
"id": "368ff57a3a5f367337bfd0eb814e056038254f52",
"size": "4377"... |
import base64
import re
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_utils import strutils
from oslo_utils import timeutils
from oslo_utils import uuidutils
import six
import stevedore
import webob
from webob import exc
from nova.api.openstack import api... | {
"content_hash": "1d33bb37d0f2e8b32e35e410b7d6939a",
"timestamp": "",
"source": "github",
"line_count": 1246,
"max_line_length": 79,
"avg_line_length": 44.86677367576244,
"alnum_prop": 0.5892064968517459,
"repo_name": "zhimin711/nova",
"id": "c34dffda9b14fccaa060cad77bb6fed1e32261e7",
"size": "5658... |
"""
Produces colormaps by curving through Lch color space
Chroma should probably be limited to the RGB cube in a way that never
produces sharp angles in the curve, which appear as bands in the gradient.
Examples:
This is similar to the 'hsv' map, but isoluminant:
lab_color_scale(hue=30, rot=1, l=75, chroma=41)
... | {
"content_hash": "30b2a7b8b7dc839fa21b882ae9459976",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 79,
"avg_line_length": 32.73394495412844,
"alnum_prop": 0.6070627802690582,
"repo_name": "sealhuang/brainDecodingToolbox",
"id": "3fe5ff442e0af135febbdca6378629ef71394a41",
... |
import sys, os
import re
from subprocess import call, Popen, PIPE
import shlex
# 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.
sy... | {
"content_hash": "f727fba170ec0e5d4340799d7792ce0d",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 106,
"avg_line_length": 33.91059602649007,
"alnum_prop": 0.708231618006054,
"repo_name": "empoweredhomes/esp-idf",
"id": "caa233c93c6fcbb1ff3a8649384700effa7e49be",
"size"... |
'''This example runs some iRODS commands
If something doesn't work as expected, try to set
SAGA_VERBOSE=3 in your environment before you run the
script in order to get some debug output.
If you think you have encountered a defect, please
report it at: https://github.com/saga-project/saga-python/issue... | {
"content_hash": "790fc40254fc8f116248d7b355258d1d",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 114,
"avg_line_length": 39.421052631578945,
"alnum_prop": 0.6395193591455274,
"repo_name": "telamonian/saga-python",
"id": "46ac966e4b66b79d8188dd05e03ebc74b73f944b",
"siz... |
from .request import make_request
from .response import process_response
from .util import _build_tracking_url
def create_tracking(tracking, **kwargs):
"""Create a tracking.
"""
response = make_request('POST', 'trackings', json=dict(tracking=tracking), **kwargs)
return process_response(response)
def... | {
"content_hash": "f301a1b681c46a429fd48eff9ede471a",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 109,
"avg_line_length": 35.65882352941176,
"alnum_prop": 0.6417024084460574,
"repo_name": "AfterShip/aftership-sdk-python",
"id": "5d48a27a9cb9cac5dba4acb1414686424b306da6",
... |
"""
Fix a word-processor-generated styles.odt for odtwriter use: Drop page size
specifications from styles.xml in STYLE_FILE.odt.
"""
#
# Author: Michael Schutte <michi@uiae.at>
from lxml import etree
import sys
import zipfile
from tempfile import mkstemp
import shutil
import os
NAMESPACES = {
"style": "urn:oasi... | {
"content_hash": "c3bc56537551c3830bab5a8dfd3be198",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 75,
"avg_line_length": 24.672131147540984,
"alnum_prop": 0.6132890365448505,
"repo_name": "j-windsor/iRiot-WebApp",
"id": "a48a3499bad6f47a5511068dec7d5ac23660b6e3",
"size"... |
r"""Code to extract a tensorflow checkpoint from a bundle file.
To run this code on your local machine:
$ python magenta/scripts/unpack_bundle.py \
--bundle_path 'path' --checkpoint_path 'path'
"""
from magenta.models.shared import sequence_generator_bundle
import tensorflow.compat.v1 as tf
FLAGS = tf.app.flags.FLAG... | {
"content_hash": "a82eb543b1d46edf747cb5f7f89d354f",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 71,
"avg_line_length": 31.5,
"alnum_prop": 0.6685340802987861,
"repo_name": "magenta/magenta",
"id": "7cefa63ada41349f4d16b920cdee533d9cd58cc0",
"size": "1656",
"binary":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.