text stringlengths 4 1.02M | meta dict |
|---|---|
from os import getenv
from raygun4py.raygunprovider import RaygunSender
from sanic import Sanic
from sanic.exceptions import SanicException
from sanic.handlers import ErrorHandler
class RaygunExceptionReporter(ErrorHandler):
def __init__(self, raygun_api_key=None):
super().__init__()
if raygun_a... | {
"content_hash": "daf646f11925ada7439dba797131e846",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 59,
"avg_line_length": 26.636363636363637,
"alnum_prop": 0.6973833902161547,
"repo_name": "ashleysommer/sanic",
"id": "2270ea9d18276e4d2ab53a1ccb4143eb3917551c",
"size": "8... |
from unittest import TestCase
import py3utils
class TestUnicodeUtils(TestCase):
def test_get_str(self):
# ok
data = '世界与中国'
res = py3utils.UnicodeUtils.get_str(data.encode('gbk'))
self.assertTrue(res == data)
| {
"content_hash": "da4cd9cb933653f8d10c7a38b4e1619d",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 63,
"avg_line_length": 22.545454545454547,
"alnum_prop": 0.6451612903225806,
"repo_name": "hezhiming/py3utils",
"id": "73e5aa17a3100aa26c786d799ab845898b9ab69f",
"size": "3... |
"""Main entry point into the Token Persistence service."""
import abc
import copy
from oslo_config import cfg
from oslo_log import log
from oslo_utils import timeutils
import six
from keystone.common import cache
from keystone.common import dependency
from keystone.common import manager
from keystone import exceptio... | {
"content_hash": "9c68a8f2389b89d86e1312f13e60c67f",
"timestamp": "",
"source": "github",
"line_count": 348,
"max_line_length": 79,
"avg_line_length": 37.91954022988506,
"alnum_prop": 0.6235222794786299,
"repo_name": "tobegit3hub/keystone_docker",
"id": "e68970ace5f192111303257999b9a178f269a7ae",
"... |
from __future__ import print_function # this is here for the version check to work on Python 2.
import sys
if sys.version_info < (3, 5):
print("#" * 49, file=sys.stderr)
print("# mitmproxy only supports Python 3.5 and above! #", file=sys.stderr)
print("#" * 49, file=sys.stderr)
import os # noqa
import s... | {
"content_hash": "c3231b233173e6af4e21a107cd14c68c",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 96,
"avg_line_length": 29.112781954887218,
"alnum_prop": 0.6082128099173554,
"repo_name": "xaxa89/mitmproxy",
"id": "6db232fc98cb2de0a8b0e4216586328fa8b09721",
"size": "38... |
"""
Set up the plot figures, axes, and items to be done for each frame.
This module is imported by the plotting routines and then the
function setplot is called to set the plot parameters.
"""
#--------------------------
def setplot(plotdata):
#--------------------------
"""
Specify what is to be plotted... | {
"content_hash": "c140746dd9c11ef4ffbf589b91dba332",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 74,
"avg_line_length": 33,
"alnum_prop": 0.6136363636363636,
"repo_name": "clawpack/clawpack-4.x",
"id": "16952c0da7b3d0e7ba6f7a14db764511fc172452",
"size": "2245",
"bina... |
"""Libraries for unified and simple console output."""
| {
"content_hash": "5a2bfbc5150643f7030c5d5a1e1a70c4",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 54,
"avg_line_length": 55,
"alnum_prop": 0.7454545454545455,
"repo_name": "KaranToor/MA450",
"id": "86002a86c56e8ea2b8a3030f10380e24c76b683a",
"size": "651",
"binary": fal... |
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "d53db88046393d255b7ac4255a8d858f",
"timestamp": "",
"source": "github",
"line_count": 1138,
"max_line_length": 143,
"avg_line_length": 26.557117750439367,
"alnum_prop": 0.6734828932565681,
"repo_name": "samiunn/incubator-tinkerpop",
"id": "6165ed33384c662f490821be78c7e29b7c65c0d0",
... |
<<<<<<< HEAD
<<<<<<< HEAD
"""distutils.file_util
Utility functions for operating on single files.
"""
import os
from distutils.errors import DistutilsFileError
from distutils import log
# for generating verbose output in 'copy_file()'
_copy_action = { None: 'copying',
'hard': 'hard linking',
... | {
"content_hash": "3aba93b37bfa805919909152ab3eb18a",
"timestamp": "",
"source": "github",
"line_count": 720,
"max_line_length": 83,
"avg_line_length": 34.144444444444446,
"alnum_prop": 0.5710218027985682,
"repo_name": "ArcherSys/ArcherSys",
"id": "aca36bc9bcacac22ce337638db2228ce57c99911",
"size": ... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'DeadLink.date'
db.delete_column('smra_portal_deadlink', 'date')
# Adding field 'DeadLink.date_cre... | {
"content_hash": "81d94eae13d04fc612380de3d0101f51",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 196,
"avg_line_length": 66.17391304347827,
"alnum_prop": 0.558694699956198,
"repo_name": "tectronics/mavrec",
"id": "83ddb267bfdbe0aa00b1ed18970ee0861ea52756",
"size": "91... |
from django.conf.urls import patterns, url
urlpatterns = patterns(
'jobsub.views',
# The base view is the "list" view, which we alias as /
url(r'^$', 'list_designs'),
# Not available on Hue 4
url(r'^not_available$', 'not_available'),
# Actions: get, save, clone, delete, submit, new.
url(r'^designs$', ... | {
"content_hash": "0e58ab634bd2c17cd9892c3d84645b77",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 65,
"avg_line_length": 35.15,
"alnum_prop": 0.6187766714082503,
"repo_name": "xq262144/hue",
"id": "2229531e497cf38631d0a70b3967aac8499b54d3",
"size": "1495",
"binary": f... |
__author__ = 'Sergey Krivohatskiy'
window_width = 800
window_height = 600
window_vsync = True
window_resizable = True
background_color_r = 23
background_color_g = 23
background_color_b = 23
bullet_image = 'bullet.png'
bullet_max_velocity = 20
bullet_velocity_power_coefficient = 3
bullet_half_width = 5
robot_body_im... | {
"content_hash": "bae349aeb802699c896017416f1fc3be",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 43,
"avg_line_length": 23.70967741935484,
"alnum_prop": 0.7428571428571429,
"repo_name": "SergeyKrivohatskiy/robocode_python",
"id": "3ce003ea8939b651e72ccb7ef8f945cedc0b2793... |
from http import HTTPStatus
from waterbutler.core.exceptions import ProviderError
class OsfStorageQuotaExceededError(ProviderError):
def __init__(self, dummy) -> None:
"""``dummy`` argument is because children of ``WaterButlerError`` must be instantiable with
a single integer argument. See :cla... | {
"content_hash": "d7d491086d707c4832d185e83d26dab7",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 99,
"avg_line_length": 36.666666666666664,
"alnum_prop": 0.6854545454545454,
"repo_name": "felliott/waterbutler",
"id": "c347d8d47285143495fd86db9cdd1d267845e7e0",
"size": ... |
"""Run the Chrome WebUI presubmit scripts on our test javascript.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into depot_tools, and see
https://chromium.googlesource.com/chromium/src/+/main/styleguide/web/web.md
for the rules we're checking... | {
"content_hash": "621b56759066469337f060d260ebaefc",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 75,
"avg_line_length": 28.23728813559322,
"alnum_prop": 0.7274909963985594,
"repo_name": "chromium/chromium",
"id": "63b9ce0d8f2c8744967ab8658403b0fe626087cb",
"size": "180... |
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).absolute().parent.parent / 'src/'))
| {
"content_hash": "6ad5ee0fc650045f5b33219389dcd49d",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 70,
"avg_line_length": 21.8,
"alnum_prop": 0.7064220183486238,
"repo_name": "wartalker/BlogSpider",
"id": "ed3d47e43d3b6421496afe5c86a4a96157acb99b",
"size": "135",
"binar... |
from .models.base import Base, engine, session
from .queries import make_query
from .models.group import Group
from .models.user import User
def commit():
'''Commit the changes to database'''
session.commit()
def close():
'''Close the session connection with the database'''
session.close()
def com... | {
"content_hash": "dcbe36c43dfd1bf6e17ea05c76a559ce",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 99,
"avg_line_length": 23,
"alnum_prop": 0.6339410939691444,
"repo_name": "Pygrameiros/bot",
"id": "550fa2df2e7f5f61886733e0a40d3b8d03f99e18",
"size": "2852",
"binary": ... |
"""
Default settings for the CPPPATH support of the Automoc feature:
it is enabled and uses the CPPPATH list of the current environment.
"""
import TestSCons
test = TestSCons.TestSCons()
test.dir_fixture('image')
test.file_fixture('SConscript','SConscript')
test.file_fixture('../../../qtenv.py')
test.file_fixture('..... | {
"content_hash": "dd5724e7b2f8737949bea35b17e2d799",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 84,
"avg_line_length": 23.772727272727273,
"alnum_prop": 0.6998087954110899,
"repo_name": "mbychawski/traffic-simulator",
"id": "ccf202e6e6b68209a67c25f2fa7856e93bafe741",
... |
import logging
# Our imports
import emission.analysis.intake.segmentation.section_segmentation_methods.smoothed_high_confidence_motion as eaisms
import emission.core.wrapper.motionactivity as ecwm
import emission.core.wrapper.location as ecwl
class SmoothedHighConfidenceMotionWithVisitTransitions(eaisms.SmoothedHighC... | {
"content_hash": "de2c6ecb4cb9cd4244f34ba831247372",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 131,
"avg_line_length": 57.127272727272725,
"alnum_prop": 0.6195098663271802,
"repo_name": "yw374cornell/e-mission-server",
"id": "e676d7a3dfbd7e319673a9b3d0989f76dc3f5c55",... |
import _plotly_utils.basevalidators
class ColorbarValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="colorbar", parent_name="parcats.line", **kwargs):
super(ColorbarValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "9eb2ae29347ad46ec5364dbe3f47d580",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 85,
"avg_line_length": 47.49561403508772,
"alnum_prop": 0.5228552959645396,
"repo_name": "plotly/python-api",
"id": "bf5d856f0a541dd7188481f5f5a183c75eabb585",
"size": "10... |
from .gui import (
Widget,
Button,
TextInput,
SpinBox,
Label,
GenericDialog,
InputDialog,
ListView,
ListItem,
DropDown,
DropDownItem,
Image,
Table,
TableRow,
TableItem,
TableTitle,
Input,
Slider,
ColorPicker,
Date,
GenericObject,
Fi... | {
"content_hash": "fcf041db11fb236895ee55c31a5f7a1d",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 64,
"avg_line_length": 17.45,
"alnum_prop": 0.6547277936962751,
"repo_name": "dddomodossola/remi",
"id": "74378e4f7a4ffc49aba02403945c571ba3cd51e4",
"size": "698",
"binar... |
import base64
import urllib.request
import json
def decodeB64(code):
bas64text = base64.b64decode(code)
baseUTF = bas64text.decode('utf-8')
crop = baseUTF.split('\"url\":\"')[1]
url = crop[:-4]
print(url)
def getSkin(UUID):
page = urllib.request.urlopen('https://sessionserver.mojan... | {
"content_hash": "93e00bcd897c83920590d8bdc0a97c4e",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 103,
"avg_line_length": 28.1,
"alnum_prop": 0.6334519572953736,
"repo_name": "kevinchu-sg/Minecraft-Skin-Decoder",
"id": "502a49b6d64b4152cc5b16effc1b7e04c4f6cb07",
"size":... |
from __future__ import absolute_import, print_function, division
from numba import unittest_support as unittest
from numba import guvectorize
from numba import void, float32
import numpy as np
import numpy.core.umath_tests as ut
def matmulcore(A, B, C):
m, n = A.shape
n, p = B.shape
for i in range(m):
... | {
"content_hash": "c85b21bf8f16cd3298cb5228f0c319a4",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 83,
"avg_line_length": 29.435897435897434,
"alnum_prop": 0.563588850174216,
"repo_name": "pombredanne/numba",
"id": "d49350c43b8399a86f41b54df4b4420d7d4fedff",
"size": "114... |
import subprocess as sp
import os
from .safe_call import safe_call
def init_parser(parser):
parser.add_argument('name', type=str, help='Cluster name.')
parser.add_argument('service', type=str,
choices=['notebook', 'nb', 'spark-ui', 'ui', 'spark-ui1', 'ui1',
... | {
"content_hash": "b3f9787fcb3afa6b14395bfac93d0d0b",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 138,
"avg_line_length": 35.07692307692308,
"alnum_prop": 0.5434210526315789,
"repo_name": "Nealelab/cloudtools",
"id": "4b9bdc6c79140277f82f43c2ade0e6de8e85f740",
"size": "... |
"""
This module is the central entity that determines which implementation of the
API is used.
"""
__author__ = '[email protected] (Petar Petrov)'
import os
# This environment variable can be used to switch to a certain implementation
# of the Python API. Right now only 'python' and 'cpp' are valid values. Any
# oth... | {
"content_hash": "ba5e9ce88b88c62d0e7f2b6259b48a48",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 77,
"avg_line_length": 32,
"alnum_prop": 0.7198464912280702,
"repo_name": "beschulz/ved-decoder",
"id": "daa340c91efe23786c671099f6e01f38c162cc89",
"size": "3444",
"binar... |
import datetime
import mwparserfromhell
import pywikibot
import re
import sys
SOFT_REDIR_CATS = "Wikipedia soft redirected categories"
NUM_PAGES = 2
SUMMARY = "[[Wikipedia:Bots/Requests for approval/EnterpriseyBot 10|Bot]] removing the article class assessment"
DATA_FILE = "current-progress.txt"
WP_BANNER_SHELL = "Wik... | {
"content_hash": "967067756a114c52e06cdafea5a44961",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 112,
"avg_line_length": 41.74125874125874,
"alnum_prop": 0.6049589545987603,
"repo_name": "APerson241/EnterpriseyBot",
"id": "31a22eed6035d5a715c02771a33eabbf43acd0c3",
"s... |
from django.contrib import admin
from models import EmailConfirmation, EmailAddress
class EmailAddressAdmin(admin.ModelAdmin):
list_display = ('email', 'user', 'primary', 'verified')
list_filter = ('primary', 'verified')
search_fields = ('email',
'user__username',
... | {
"content_hash": "e3699204ab8c45e586df2053ced489cf",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 62,
"avg_line_length": 33.80952380952381,
"alnum_prop": 0.643661971830986,
"repo_name": "GinnyN/towerofdimensions-django",
"id": "b722f10f01a635042189bcaf79b9c441a7cc6470",
... |
import pickle
import numpy as np
from teafacto.util import argprun, tokenize
def run(trainp="fb_train.tsv", testp="fb_test.tsv", validp="fb_valid.tsv", outp="datamat.wordchar.pkl", maxchar=30):
worddic = {"<RARE>": 0}
chardic = {}
entdic = {}
reldic = {}
acc = {}
acc["train"] = getdata(train... | {
"content_hash": "196ea6da4b1abbce29dd633720f822aa",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 116,
"avg_line_length": 33.351063829787236,
"alnum_prop": 0.5655502392344498,
"repo_name": "lukovnikov/teafacto",
"id": "e368fb3a970d5bfd4d517801495432ee55f12b0a",
"size": ... |
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
# Future is needed for pip distribution for python 3 support
dependencies = ['pyyaml', 'pycurl']
test_dependencies = ['django==1.6.5','django-tastypie==0.12.1','jsonpath','jmespath']
# Add additional compatibilit... | {
"content_hash": "1cc7893f32e8a98b96e816d9491e3235",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 136,
"avg_line_length": 41.81818181818182,
"alnum_prop": 0.6334782608695653,
"repo_name": "satish-suradkar/pyresttest",
"id": "040178479362b2b0b22f1388e34361f0ac35f8fe",
"s... |
"""An implementation of MultiPerspectiveLayer for Bimpm model."""
import tensorflow as tf
from keras import backend as K
from keras.engine import Layer
from matchzoo.contrib.layers.attention_layer import AttentionLayer
class MultiPerspectiveLayer(Layer):
"""
A keras implementation of multi-perspective layer... | {
"content_hash": "1dbf58b4dea01bb7fe9849bc25af8b89",
"timestamp": "",
"source": "github",
"line_count": 468,
"max_line_length": 80,
"avg_line_length": 34.72435897435897,
"alnum_prop": 0.5573810842409698,
"repo_name": "faneshion/MatchZoo",
"id": "64cfd33868917a14c049613d90b21b7be0d12274",
"size": "1... |
import urllib,urllib2,re,xbmcplugin,xbmcgui
import os,datetime
import demjson
import BeautifulSoup
DATELOOKUP = "http://www.thedailyshow.com/feeds/timeline/coordinates/"
pluginhandle = int(sys.argv[1])
shownail = xbmc.translatePath(os.path.join(os.getcwd().replace(';', ''),"icon.png"))
fanart = xbmc.translat... | {
"content_hash": "001bde5e2828368520bbd18c703ca44c",
"timestamp": "",
"source": "github",
"line_count": 423,
"max_line_length": 150,
"avg_line_length": 39.652482269503544,
"alnum_prop": 0.5510642103380433,
"repo_name": "adamsb6/xbmc-dailyshow",
"id": "6b83cc78402e197ba5fefbcbe027fd56c6a1c5c7",
"siz... |
"""
Copyright (2010-2014) INCUBAID BVBA
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... | {
"content_hash": "d149c71d77224f0151150960a73ef34d",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 80,
"avg_line_length": 31.07017543859649,
"alnum_prop": 0.6084133258046301,
"repo_name": "sql-analytics/openvstorage",
"id": "edb8d017b4555930e3be052754d13a3da584c7e1",
"s... |
"""
Author: Isabel Restrepo
May 2, 2012
A script to parse training features from all categories and stack them into a singe array
"""
#*******************The Main Algorithm ************************#
if __name__=="__main__":
import os
import sys
import time
import numpy as np
from bmvc12_adaptor import *
... | {
"content_hash": "60b310dd9ccc1755f8489878c7c79507",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 137,
"avg_line_length": 33.83838383838384,
"alnum_prop": 0.6582089552238806,
"repo_name": "mirestrepo/voxels-at-lems",
"id": "2b6695b3a0a363d4741467e0a458d5c711132dd1",
"si... |
"""Header encoding and decoding functionality."""
import re
import binascii
import email.quopriMIME
import email.base64MIME
from email.Errors import HeaderParseError
from email.Charset import Charset
NL = '\n'
SPACE = ' '
USPACE = u' '
SPACE8 = ' ' * 8
UEMPTYSTRING = u''
MAXLINELEN = 76
USASCII = Charset('us-ascii... | {
"content_hash": "a90c395045f5bf3e9282d0799d89216f",
"timestamp": "",
"source": "github",
"line_count": 497,
"max_line_length": 79,
"avg_line_length": 43.183098591549296,
"alnum_prop": 0.5916503587736465,
"repo_name": "MalloyPower/parsing-python",
"id": "5e24afede013f775e836a5931c35f6ca3edfd1a9",
"... |
'''
Send Cluster EFK checks to Zagg
'''
# vim: expandtab:tabstop=4:shiftwidth=4
#
# Copyright 2015 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.... | {
"content_hash": "3b4014a1c6d851e5b833674808e8431d",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 118,
"avg_line_length": 41.78885630498534,
"alnum_prop": 0.5666666666666667,
"repo_name": "ivanhorvath/openshift-tools",
"id": "56a1f3f34ae985e2e30cd6829fe1a6052a187a1e",
... |
from pyqtgraph import ROI
from pyqtgraph import QtGui
from pyqtgraph import QtCore
from pyqtgraph import TextItem
from pyqtgraph import LayoutWidget
from .utils import delete_content
from .utils import get_bigger_bbox
from .color import JChooseColor
from .color import setup_color
from .remove_item import JRemoveItem... | {
"content_hash": "a4578531c8227de7237e0a4a84a893b3",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 76,
"avg_line_length": 28.735905044510385,
"alnum_prop": 0.560512185047501,
"repo_name": "jakaspeh/JDesigner",
"id": "fdcc1c319bd1e5e57757141234f691d9304f4094",
"size": "9... |
"""List User Device access."""
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('identifier')
@environment.pass_env
def cli(env, identifier):
"""User Device access."""
mgr = SoftLay... | {
"content_hash": "bd1fe8425365bfd76ef4775743d23c20",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 119,
"avg_line_length": 43.916666666666664,
"alnum_prop": 0.5836812144212524,
"repo_name": "allmightyspiff/softlayer-python",
"id": "4ad0f2951ff95ba94f42edd7cb2fd6fa6f99d81b"... |
from osqp.interface import OSQP
| {
"content_hash": "904af8ead269a094766258f1e4ad3ec8",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 31,
"avg_line_length": 32,
"alnum_prop": 0.84375,
"repo_name": "oxfordcontrol/osqp-python",
"id": "19ebfaa23d845dcd79fcce24991d651de2a7f329",
"size": "32",
"binary": false... |
class Experiment:
function_set = None
terminal_set = None
@classmethod
def get_terminal_set(cls):
return cls.terminal_set.get()
@classmethod
def get_function_set(cls):
return cls.function_set.get()
def function_lookup(self, name):
return getattr(self, name)
def index(self):
return No... | {
"content_hash": "bb2af1d7e6ad0192cd7d766f598acff4",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 39,
"avg_line_length": 20.79310344827586,
"alnum_prop": 0.6235489220563848,
"repo_name": "dougsc/gp",
"id": "7dc193a687415fcd519f461905953c14913de3d7",
"size": "604",
"bi... |
import time
import json
from flask import g, request, Response
from flask.ext.classy import FlaskView
from werkzeug.exceptions import BadRequest, NotAcceptable
from app.authorization import login_required
import app.config
import app.database
class NotificationView(FlaskView):
'''
Send notifications using Se... | {
"content_hash": "4b134c804277b7e09001943b542632cc",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 94,
"avg_line_length": 30.74390243902439,
"alnum_prop": 0.5763585878619596,
"repo_name": "TeamHG-Memex/hgprofiler",
"id": "5cf7d8ab471807185f3f889a78658350b464d4c9",
"size"... |
"""<MyProject>, a CherryPy application.
Use this as a base for creating new CherryPy applications. When you want
to make a new app, copy and paste this folder to some other location
(maybe site-packages) and rename it to the name of your project,
then tweak as desired.
Even before any tweaking, this should serve a fe... | {
"content_hash": "992b06c34f237e80b0dabd6bc5a782be",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 74,
"avg_line_length": 31.6984126984127,
"alnum_prop": 0.628943415122684,
"repo_name": "cherrypy/cherrypy",
"id": "bcddba2db85b0b509b26371ef4046b62e6c688f4",
"size": "1997"... |
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
from neutron.api.rpc.handlers import l3_rpc
from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.db import common_db_mixin
from neutron.db import dns_db
#from neutron.db import l3_gwmode_db
from oslo_config import cfg
from osl... | {
"content_hash": "3d683fc6ec7394e3ee51c89ce6bb3d38",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 78,
"avg_line_length": 42.241379310344826,
"alnum_prop": 0.6744897959183673,
"repo_name": "Tehsmash/networking-cisco",
"id": "85bad7c93404715b89da27d03bc05049f67fef61",
"s... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
import warnings
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'PeopleInPovertyState'
db.create_table('data_peopleinpovertystate', (
('id', self... | {
"content_hash": "0f77680d9cf8b94d4962e1ae26cb93f7",
"timestamp": "",
"source": "github",
"line_count": 1941,
"max_line_length": 197,
"avg_line_length": 79.17516743946419,
"alnum_prop": 0.5528341543086563,
"repo_name": "npp/npp-api",
"id": "ff186e3d7fde240f39a1336e29935c633b4cdab7",
"size": "153697... |
import sys
from time import sleep
import logging
import os
import string
import re
import datetime
from commands import *
# Initialize logging
logging.basicConfig(format='%(asctime)s [%(levelname)s] %(name)s - %(message)s', level=logging.WARNING)
_log = logging.getLogger()
_log.setLevel(logging.INFO)
class Gbp_Config... | {
"content_hash": "3f1388d0ac48544c5ac93033cb18afb7",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 161,
"avg_line_length": 42.48396501457726,
"alnum_prop": 0.5534586878945924,
"repo_name": "tbachman/group-based-policy",
"id": "c8b1da7bb0c86f83e7fa37df95bcefa10c6fdcfd",
... |
import argparse
import uuid
import fixtures
import mock
from oslo_config import cfg
from keystoneauth1.auth import base
from keystoneauth1.auth import cli
from keystoneauth1.tests.unit.auth import utils
class TesterPlugin(base.BaseAuthPlugin):
def get_token(self, *args, **kwargs):
return None
@cla... | {
"content_hash": "ba16873a0ef061250b2976b8a0c17baa",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 78,
"avg_line_length": 34.43478260869565,
"alnum_prop": 0.6025883838383839,
"repo_name": "citrix-openstack-build/keystoneauth",
"id": "f2cbde40702d56564c809d3a17080522cb23c4... |
from numba import jit
import numpy as np
from functools import lru_cache as cache
@cache()
@jit
def invertPoisson(x, mi):
""" Calculates the value that would be found in a
poisson distribution with lambda = mi at probability
value X
"""
if(mi >= 0):
if(x >= 0):
if(x < 1):
... | {
"content_hash": "7fa5d558c57d1d3398f67e8eb7ff2fd0",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 79,
"avg_line_length": 27.69148936170213,
"alnum_prop": 0.5908567038033039,
"repo_name": "PyQuake/earthquakemodels",
"id": "f9b3fc9a3a21953699997d176c5b4516a5055924",
"size... |
import sys
import os
import time
import re
import random
import weakref
import subprocess
import socket
import asyncore
import inspect
#----------------------------------------------------------------------------------------------------------------------
# wpantund properties
WPAN_STATE ... | {
"content_hash": "fde58bcedf698ff684efea1d65f0bc05",
"timestamp": "",
"source": "github",
"line_count": 1298,
"max_line_length": 125,
"avg_line_length": 42.15100154083205,
"alnum_prop": 0.5400643368913584,
"repo_name": "erja-gp/openthread",
"id": "874259e0833bd69a3c25af536c2a3aa78c31f1a8",
"size": ... |
from supriya.tools.ugentools.UGen import UGen
class TRand(UGen):
r'''A triggered random number generator.
::
>>> trigger = ugentools.Impulse.ar()
>>> t_rand = ugentools.TRand.ar(
... minimum=-1.,
... maximum=1.,
... trigger=trigger,
... )
... | {
"content_hash": "d3f55d753097a2be7bb3761c05e2f1fb",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 72,
"avg_line_length": 23.605405405405406,
"alnum_prop": 0.44882070070986946,
"repo_name": "andrewyoung1991/supriya",
"id": "085a021291b4ddf4ff1ee5d05e6df752f968bfd9",
"si... |
from ._commons import validate_yes_no, MODELNAME_template
def create_admin(model_name):
MODELNAME_template('admin', model_name)
return
def request(model_name):
while True:
admin_required = input('Does this model require an admin.py [y/n] ')
answer = validate_yes_no(admin_required)
if answer:
create_admin(... | {
"content_hash": "487ded56f2b2aa64ff7f47dc546a1863",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 70,
"avg_line_length": 23.647058823529413,
"alnum_prop": 0.7189054726368159,
"repo_name": "cidadania/ecidadania-ng",
"id": "b9c09ca839047052a6e6d762fc0210991ae5c2f4",
"size... |
from django import forms
from cms.models import Page
from cms.utils.urlutils import static_with_version
from .wizard_pool import entry_choices
def step2_form_factory(mixin_cls, entry_form_class, attrs=None):
"""
Combines a form mixin with a form class, sets attrs to the resulting class.
This is used to ... | {
"content_hash": "5f5d8ac438aaa89a92d584f26d19134d",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 79,
"avg_line_length": 31.15068493150685,
"alnum_prop": 0.6270888302550571,
"repo_name": "netzkolchose/django-cms",
"id": "95d5f11dd67670a25f134d3f774bdbd0ab17d92e",
"size"... |
from random import random
import csv
import sys
# Splits inputfile into two files: one for testing and one for training
# Pre-Requisite : Inputfile, a csv generated from extract.py
# Parameters :
# inputfile - a csv that is in the format NLC expects (see extract.py)
# outputtrainfile - the outputfile as CSV in the for... | {
"content_hash": "9a6719936b30d5ed6d638cc6f60490d9",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 302,
"avg_line_length": 40.96923076923077,
"alnum_prop": 0.6060833646263613,
"repo_name": "mkaufmann1/Lightning",
"id": "27bdf74978f4ee28cf93a054230112c7a29f9224",
"size": ... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Verify the Jar() behavior when we have no JARCHDIR set (it should
automatically use the classdir that was deduced from the Java() call)
and when we explicity set it to None (it should not use the Java()
classdir attribute at all).
"""
import TestSCons
... | {
"content_hash": "3f8245dd651b43a1c353cb2f3528ee8b",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 69,
"avg_line_length": 18.966666666666665,
"alnum_prop": 0.6051552431165788,
"repo_name": "andrewyoung1991/scons",
"id": "20375249ddb7cfb42b19fea778c80d647dbcde55",
"size":... |
import sys, os, subprocess
# 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('.'))
sys.path.inse... | {
"content_hash": "9f81905f54ba9745fe50e2d6b65144f6",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 80,
"avg_line_length": 31.55666666666667,
"alnum_prop": 0.6520545051230591,
"repo_name": "alexmojaki/blaze",
"id": "a49350076c8417f526d5bb00e2dcaec8dd2d30b0",
"size": "988... |
# Copyright (C) 2013 Google Inc. 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 above copyright
# notice, this list of conditions and the ... | {
"content_hash": "93168d24e161bac159e9da6f6be8c2fb",
"timestamp": "",
"source": "github",
"line_count": 483,
"max_line_length": 182,
"avg_line_length": 48.54451345755694,
"alnum_prop": 0.6676333859342346,
"repo_name": "Pluto-tv/blink-crosswalk",
"id": "7db6e4ea4c0a38b2448d9e86d7f9af7f0018d715",
"si... |
"""Tests for the Google Drive snapshots event formatter."""
import unittest
from plaso.formatters import gdrive
from tests.formatters import test_lib
class GDriveCloudEntryFormatterTest(test_lib.EventFormatterTestCase):
"""Tests for the Google Drive snapshot cloud event formatter."""
def testInitialization(se... | {
"content_hash": "9d53b93be6fee50eda153139d8af93c2",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 69,
"avg_line_length": 30.192307692307693,
"alnum_prop": 0.7439490445859872,
"repo_name": "jorik041/plaso",
"id": "2e12ac35a243a787a78a6ac79425d07436379297",
"size": "1612"... |
"""
Running or runtime configuration related to Virtual Routing and Forwarding
tables (VRFs).
"""
import abc
import logging
from ryu.lib.packet.bgp import RF_IPv4_UC
from ryu.lib.packet.bgp import RF_IPv6_UC
from ryu.lib.packet.bgp import BGPPathAttributeExtendedCommunities
from ryu.services.protocols.bgp.utils imp... | {
"content_hash": "16567f06ea844528c4e8f70ee6462b61",
"timestamp": "",
"source": "github",
"line_count": 528,
"max_line_length": 79,
"avg_line_length": 36.515151515151516,
"alnum_prop": 0.6009854771784232,
"repo_name": "ynkjm/ryu",
"id": "9cbfe998b112d5f05a73a60e2e7b5f71df70e32d",
"size": "19893",
... |
from os import listdir
import os
lis1 = [f for f in listdir("set4 files")]
lis2 = [f for f in listdir("transcript")]
print (lis1)
for i in lis1:
if i in lis2:
os.remove('transcript/'+i)
| {
"content_hash": "2ea701e0b6edcf86feaa566aa97ce2c3",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 41,
"avg_line_length": 23.625,
"alnum_prop": 0.6825396825396826,
"repo_name": "amudalab/concept-graphs",
"id": "1d33fead058c668628e2c122efdc2846f0b210fc",
"size": "189",
"... |
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
sentences = ["VADER is smart, handsome, and funny.", # positive sentence example
"VADER is not smart, handsome, nor funny.", # negation sentence example
"VADER is smart, handsome, and funny!", # punctuation emphasis handl... | {
"content_hash": "723b72f6edfc76d4376064a0225af8ae",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 133,
"avg_line_length": 71.1304347826087,
"alnum_prop": 0.6968215158924206,
"repo_name": "steinnp/Big-Data-Final",
"id": "a83bc6eff2ac01492d7045623563d601e8e50af2",
"size":... |
import sys, os
#get path of script
_script_path = os.path.realpath(__file__)
_script_dir = os.path.dirname(_script_path)
pyWolfPath = _script_dir
if sys.platform == "linux" or sys.platform == "linux2":
print "Linux not tested yet"
elif sys.platform == "darwin":
print "OS X not tested yet"
elif sys.platform ==... | {
"content_hash": "a7eaf5f29a1fa09b74570a137ad228e7",
"timestamp": "",
"source": "github",
"line_count": 276,
"max_line_length": 190,
"avg_line_length": 37.61231884057971,
"alnum_prop": 0.5675753780945959,
"repo_name": "PooyaEimandar/WolfEngine",
"id": "7049b619e7a5bd7fd44906dca7c476d4d8d1741b",
"si... |
import sys
import os
PATH = os.path.dirname(__file__)
sys.path.append(PATH + "/..")
from mobula.Defines import *
import numpy as np
import random
random.seed(1019)
np.random.seed(1019)
def test_layer_y(layer, X):
from mobula.layers import Data
data = Data(X, "data")
data.reshape()
l = layer(data, ... | {
"content_hash": "094b8bce434033fb03d55bb2614838f5",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 34,
"avg_line_length": 18.08,
"alnum_prop": 0.6327433628318584,
"repo_name": "wkcn/mobula",
"id": "721e5fd351925588eadfd89c007254a4ffe7c86b",
"size": "452",
"binary": fal... |
import argparse
import tomviz
def main():
parser = argparse.ArgumentParser(
description='Tomviz acquisition server.')
parser.add_argument('-a', '--adapter', help='source adapter to install')
parser.add_argument('-i', '--host', default='localhost',
help='on what interface th... | {
"content_hash": "afa5063e01addfcb2375a120382d4315",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 80,
"avg_line_length": 32.74285714285714,
"alnum_prop": 0.5759162303664922,
"repo_name": "cjh1/tomviz",
"id": "2e5d8c18f8293f35b598bd6a67edcc0cd9243bc1",
"size": "1146",
... |
"""Handling of RSA and DSA keys.
This module is unstable.
Maintainer: U{Paul Swartz<mailto:[email protected]>}
"""
# base library imports
import base64
import string
import sha, md5
# external library imports
from Crypto.Cipher import DES3
from Crypto.PublicKey import RSA, DSA
from Crypto import Util
#twisted
... | {
"content_hash": "71ab3f1477e9bd57ef5098438337f25d",
"timestamp": "",
"source": "github",
"line_count": 466,
"max_line_length": 100,
"avg_line_length": 35.26824034334764,
"alnum_prop": 0.565378764831153,
"repo_name": "santisiri/popego",
"id": "aa766a7abba375ead13dd0373020404a9437f0e9",
"size": "165... |
"Unit test for the MplStyleManager class."
__version__ = "$Revision: #1 $"
#===========================================================================
# Required imports. Do not modify these.
import unittest
#===========================================================================
# Place all imports after her... | {
"content_hash": "cf86fd565d8d9477332c6cea53634a44",
"timestamp": "",
"source": "github",
"line_count": 378,
"max_line_length": 85,
"avg_line_length": 35.97883597883598,
"alnum_prop": 0.5415441176470588,
"repo_name": "nasa/mplStyle",
"id": "4997262562c28e91d67fb67e0104c3ccf08d859d",
"size": "15402"... |
from datetime import timedelta
from flask import make_response, request, current_app
from functools import update_wrapper
def crossdomain(origin=None, methods=None, headers=None,
max_age=21600, attach_to_all=True,
automatic_options=True):
if methods is not None:
methods = '... | {
"content_hash": "abd5b936bef0b51201a22964a9fca312",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 67,
"avg_line_length": 36.77777777777778,
"alnum_prop": 0.6030211480362537,
"repo_name": "paked/WPC-fix",
"id": "2e8cef02091d776d3f3693d37d46d7d5771989d0",
"size": "1699",
... |
class Person:
def __init__(self, name):
self.name = name
# Getter function
@property
def name(self):
return self._name
# Setter function
@name.setter
def name(self, value):
if not isinstance(value, str):
raise TypeError('Expected a string')
self.... | {
"content_hash": "62797e434a8e4fe8974596e20288a9fc",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 63,
"avg_line_length": 22.75862068965517,
"alnum_prop": 0.5856060606060606,
"repo_name": "tuanavu/python-cookbook-3rd",
"id": "763f8c6deef3dca7ca59d203afb5d3e33e0d08b6",
"s... |
"""Device tracker for Synology SRM routers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.synology_srm/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.device... | {
"content_hash": "53e9438043e770b42d9cbb07f807d110",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 77,
"avg_line_length": 30.77,
"alnum_prop": 0.6454338641533962,
"repo_name": "PetePriority/home-assistant",
"id": "5c7ac9a5d00dffd9979430c195e91dd7a593504a",
"size": "3077... |
from django.conf.urls.defaults import *
from cyder.cydns.urls import cydns_urls
urlpatterns = cydns_urls('mx')
| {
"content_hash": "d4a8a0d4ae96d64f028cbd81cb59c37f",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 39,
"avg_line_length": 19,
"alnum_prop": 0.7631578947368421,
"repo_name": "zeeman/cyder",
"id": "b806f2cdaf74c464176e8690f8724e113b55a5d3",
"size": "114",
"binary": false,... |
"""
Find heights oftemperature etc. on pressure levels from models and save
Takes calculate pressure level heights from geopotential_interpolate_multiple.py
"""
import os,sys
import iris
import iris.coords as coords
import iris.unit as unit
#from tempfile import mkdtemp
import numpy as np
import os.path as path
im... | {
"content_hash": "1af261aea1f9c0b4a958ea3c7144ff2c",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 117,
"avg_line_length": 36.49579831932773,
"alnum_prop": 0.5804743265024177,
"repo_name": "peterwilletts24/Monsoon-Python-Scripts",
"id": "e6ac2c118904987c8d9cab0b769bfcc48d... |
import os
from getpass import getpass
from addic7ed_cli.error import Error
from addic7ed_cli.util import remove_extension, file_to_query, string_set
from addic7ed_cli.episode import search
from addic7ed_cli.compat import echo, input
from addic7ed_cli.login import login, get_current_user
from addic7ed_cli.version impor... | {
"content_hash": "59589802f5df08045a03abf389da2d47",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 74,
"avg_line_length": 27.205,
"alnum_prop": 0.5034001102738467,
"repo_name": "BenoitZugmeyer/addic7ed-cli",
"id": "3f96a46a496a51af30b762f19fb059d214b82714",
"size": "544... |
"""
Predefined ttk style
"""
import os
import logging
from tkinter import ttk
LOGGER = logging.getLogger(__name__)
class TTKStyle(ttk.Style):
def __init__(self, style_name, theme='default', **kwargs):
super().__init__()
self.theme_use(theme)
self.configure(style_name, **kwargs)
def init_c... | {
"content_hash": "43d57b119145f2e8172062a64d1cd773",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 113,
"avg_line_length": 63.19736842105263,
"alnum_prop": 0.6570893191755153,
"repo_name": "afunTW/moth-graphcut",
"id": "3e8fe287050b0ebf109cb4800b0989c8cac0c52e",
"size": ... |
import functools
from neutron.api import extensions
from neutron.common import exceptions
from neutron import manager
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
class Diagnostician(object):
def __init__(self, plugin):
self.plugin = plugin
def diag_not_implemented(self, res... | {
"content_hash": "ccf9d5777b614e70af34cf434d6c33a8",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 78,
"avg_line_length": 30.893617021276597,
"alnum_prop": 0.6377410468319559,
"repo_name": "Cerberus98/quark",
"id": "edaaec6b0b6e2fc92aca0965feecc907983d3627",
"size": "204... |
import re
from aiohttp import web
from components.eternity import config
from utils.abstract import AbsWebView
from utils.period import todate
from utils.shortcut import paginate, render
from utils.response import geass, http_400_response
class IndexView(AbsWebView):
async def get(self):
page = self._get(... | {
"content_hash": "0f4ec0d1462c9e88cafd93c24b555420",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 117,
"avg_line_length": 33.24752475247525,
"alnum_prop": 0.4994044073853484,
"repo_name": "chiaki64/Windless",
"id": "eaf54881c5ffac28402714deea38f3635b37ba84",
"size": "6... |
from typing import List, Union
import torch
import torch.fx
from torch import nn, Tensor
from torch.jit.annotations import BroadcastingList2
from torch.nn.modules.utils import _pair
from torchvision.extension import _assert_has_ops
from ..utils import _log_api_usage_once
from ._utils import check_roi_boxes_shape, con... | {
"content_hash": "b830de0de0487bc491b7c5bd04c7b925",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 108,
"avg_line_length": 40.875,
"alnum_prop": 0.6449201495073055,
"repo_name": "pytorch/vision",
"id": "96282418f0769bc91018a872dbd0a106742bf884",
"size": "2943",
"binary... |
"""Runs two benchmark programs and compares their results."""
from __future__ import print_function
import argparse
import subprocess
import sys
try:
xrange # Python 2
except NameError:
xrange = range # Python 3
parser = argparse.ArgumentParser()
parser.add_argument('prog1')
parser.add_argument('prog2... | {
"content_hash": "6bd858ef1c5d28211348895993121742",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 74,
"avg_line_length": 26.625,
"alnum_prop": 0.6460093896713615,
"repo_name": "pombredanne/grumpy",
"id": "eced9512e9217e70285cef3e9e4d022035938120",
"size": "2750",
"bin... |
"""Describe job command."""
from googlecloudsdk.api_lib.dataproc import util
from googlecloudsdk.calliope import base
class Describe(base.Command):
"""View the details of a job."""
detailed_help = {
'DESCRIPTION': '{description}',
'EXAMPLES': """\
To view the details of a job, run:
... | {
"content_hash": "f91c55311266ddc76c4cce429082fa62",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 51,
"avg_line_length": 22.10810810810811,
"alnum_prop": 0.6210268948655256,
"repo_name": "flgiordano/netcash",
"id": "0b6f363c5ccceb1c3174c81ec54fff2991aa50e1",
"size": "14... |
from setuptools import setup
setup(name='YourAppName',
version='1.0',
description='OpenShift App',
author='Your Name',
author_email='[email protected]',
url='https://www.python.org/community/sigs/current/distutils-sig',
install_requires=['Flask>=0.7.2', 'MarkupSafe'],
)
| {
"content_hash": "e0e118c6b4056dbff47d51f91cc99895",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 72,
"avg_line_length": 31.5,
"alnum_prop": 0.6476190476190476,
"repo_name": "waco001/abhishekgorti.me-flask",
"id": "cebfd5bf0b50f9d76420b07d842ae4c6466e8183",
"size": "315... |
import flask
def create_valid_response(response_id=None, result=None, error=None, jsonrpc_version='2.0'):
response = {}
if response_id is not None:
response['id'] = response_id
if error is not None: # always return an error
response['error'] = error
elif result is not None:
re... | {
"content_hash": "aafc32fda50d3a2b6ae1c8e66d86f1d0",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 92,
"avg_line_length": 32.36,
"alnum_prop": 0.5673671199011124,
"repo_name": "alexander-svendsen/ev3-python",
"id": "03d957ec8f38435d0eb0373e7dc007b3debc39d8",
"size": "164... |
"""
views.py
.. moduleauthor:: Steve Androulakis <[email protected]>
.. moduleauthor:: Gerson Galang <[email protected]>
.. moduleauthor:: Ulrich Felzmaann <[email protected]>
"""
from tardis.tardis_portal.auth.decorators import has_datafile_download_access,\
has_experiment_write, ... | {
"content_hash": "a6595136e1461b6501e3f0c160a727ef",
"timestamp": "",
"source": "github",
"line_count": 3100,
"max_line_length": 135,
"avg_line_length": 35.51774193548387,
"alnum_prop": 0.6192089369238454,
"repo_name": "steveandroulakis/mytardis",
"id": "6f4d40695f281fee65c948337eafaea35297f0ec",
"... |
""" Estimation of infection and mortality parameters from survival over time.
Parameters estimated:
(infection-related)
- p: probability that a single virion will cause infection in a host of the first group
- a,b: shape parameters for the distribution of susceptibility of the second group compared to the first
- eps... | {
"content_hash": "e4d06653214a840fb117fcd8ee2553e9",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 111,
"avg_line_length": 41.3448275862069,
"alnum_prop": 0.7668890742285238,
"repo_name": "dpessoaIGC/Dose-Invariant_Susceptibility_Estimator",
"id": "436b2172f9d0d7a366217f4f... |
import numpy as np
from PIL import Image
from os.path import *
import re
import cv2
cv2.setNumThreads(0)
cv2.ocl.setUseOpenCL(False)
TAG_CHAR = np.array([202021.25], np.float32)
def readFlow(fn):
""" Read .flo file in Middlebury format"""
# Code adapted from:
# http://stackoverflow.com/questions/28013200... | {
"content_hash": "01a886395d96a968210cc5c833fea57f",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 109,
"avg_line_length": 29.37226277372263,
"alnum_prop": 0.577286282306163,
"repo_name": "google-research/3d-moments",
"id": "6c491135efaffc25bd61ec3ecde99d236f5deb12",
"s... |
from mock import MagicMock
from .test_base import CliCommandTest
class UsersTest(CliCommandTest):
def setUp(self):
super(UsersTest, self).setUp()
self.use_manager()
self.client.users = MagicMock()
def test_create_users_missing_username(self):
outcome = self.invoke(
... | {
"content_hash": "ad0c046b982052a5e959e53b75041660",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 75,
"avg_line_length": 34.659574468085104,
"alnum_prop": 0.6040515653775322,
"repo_name": "isaac-s/cloudify-cli",
"id": "c9b6669e23f7833556b672e5d7f7495c4da355f9",
"size": ... |
"""Code to clean-up transform the JSON description of a dataflow.
Example clean-ups:
1. Dictionaries representing primitives with a schema will be converted to the
primitive:
Ex: { '@type': "https://schema.org/Text", 'value': "Hello" } becomes "Hello"
2. Fields that are unlikely to be human consumable may be hidd... | {
"content_hash": "b1a36d3e3c10db343f9b62739b961783",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 78,
"avg_line_length": 31.59,
"alnum_prop": 0.7011712567268122,
"repo_name": "wemanuel/smry",
"id": "98aec9da991686b98759595ed73490770b06c36d",
"size": "3209",
"binary":... |
from django.test import TestCase
from oscar.test.factories import create_product
from django.db import IntegrityError
from django.utils.translation import ugettext_lazy as _
from oscar.apps.offer import custom
class CustomRange(object):
name = "Custom range"
def contains_product(self, product):
retu... | {
"content_hash": "6588d751dead8ab36ca6b1a56cb9c5bb",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 77,
"avg_line_length": 28.654545454545456,
"alnum_prop": 0.6694162436548223,
"repo_name": "marcoantoniooliveira/labweb",
"id": "19691cb9877e09ce305d16c8ce0564fe8498bb8b",
"... |
from oslo_config import cfg
import webob.exc
from neutron._i18n import _
from neutron.api import extensions
from neutron.api.v2 import attributes as attr
from neutron.common import exceptions as nexception
allowed_address_pair_opts = [
#TODO(limao): use quota framework when it support quota for attributes
cfg... | {
"content_hash": "e51a59d9c2ccfa0209eb67611d2b4ccb",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 75,
"avg_line_length": 34.959016393442624,
"alnum_prop": 0.5981242672919109,
"repo_name": "dims/neutron",
"id": "fff7151d11debe8e77c7913c47d42456b959b3ec",
"size": "4892",... |
from google.cloud import aiplatform_v1
def sample_export_data():
# Create a client
client = aiplatform_v1.DatasetServiceClient()
# Initialize request argument(s)
export_config = aiplatform_v1.ExportDataConfig()
export_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value"
reque... | {
"content_hash": "eeb5327c0ef963d02b4c9c07ebd9c34a",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 79,
"avg_line_length": 25.962962962962962,
"alnum_prop": 0.7061340941512125,
"repo_name": "googleapis/python-aiplatform",
"id": "4a68486f43a304267c44781e23cc1ea420de8bdd",
... |
import logging
import re
from webkitpy.common.webkit_finder import WebKitFinder
from webkitpy.layout_tests.port import chromium
from webkitpy.layout_tests.port import chromium_win
from webkitpy.layout_tests.port import config
_log = logging.getLogger(__name__)
class ChromiumLinuxPort(chromium.ChromiumPort):
po... | {
"content_hash": "d2490f416e045b2a12ba3987c9d65dec",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 151,
"avg_line_length": 41.6985294117647,
"alnum_prop": 0.650326221125022,
"repo_name": "espadrine/opera",
"id": "a4a6abfb5ff4d8dd6dfba4c4a4ee2188cd66a7e3",
"size": "7201"... |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.absp... | {
"content_hash": "7da971f51cd219ef23ccd76c66cc8370",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 94,
"avg_line_length": 35.216981132075475,
"alnum_prop": 0.673720867934637,
"repo_name": "lpancescu/atlas-lint",
"id": "89570b1430028aa2e02499d00927467b8147f5f8",
"size": ... |
import os
import re
from setuptools import setup, find_packages
version = None
for line in open('./djfactory/__init__.py'):
m = re.search('__version__\s*=\s*(.*)', line)
if m:
version = m.group(1).strip()[1:-1] # quotes
break
assert version
setup(
name='djfactory',
version=version,... | {
"content_hash": "028acfd2df93e3ab573140833183ec92",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 65,
"avg_line_length": 27.31578947368421,
"alnum_prop": 0.5934489402697495,
"repo_name": "hfeeki/djfactory",
"id": "e07f97d237d25450c98fc3122645a81ebe24612d",
"size": "1038... |
"""Dispatches tests, either sharding or replicating them.
Performs the following steps:
* Create a test collection factory, using the given tests
- If sharding: test collection factory returns the same shared test collection
to all test runners
- If replciating: test collection factory returns a unique test co... | {
"content_hash": "b9fdefc606f33aa8e32b90721126fa13",
"timestamp": "",
"source": "github",
"line_count": 331,
"max_line_length": 80,
"avg_line_length": 37.027190332326285,
"alnum_prop": 0.6941090078328982,
"repo_name": "Just-D/chromium-1",
"id": "93df28ccb45ed8dcabd392534c1a31e39bbdd963",
"size": "1... |
class ModuleDocFragment(object):
# Standard F5 documentation fragment
DOCUMENTATION = r'''
options:
provider:
description:
- A dict object containing connection details.
type: dict
version_added: '2.5'
suboptions:
password:
description:
- The password for the user... | {
"content_hash": "3ef9ef333305541c279d21dad3d06832",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 128,
"avg_line_length": 42.026666666666664,
"alnum_prop": 0.6516497461928934,
"repo_name": "thaim/ansible",
"id": "e247021e3cf586b84d9e23b8e57e96c56bbff7f2",
"size": "3272"... |
from m5.objects import *
# Simple ALU Instructions have a latency of 1
class O3_ARM_v7a_Simple_Int(FUDesc):
opList = [ OpDesc(opClass='IntAlu', opLat=1) ]
count = 2
# Complex ALU instructions have a variable latencies
class O3_ARM_v7a_Complex_Int(FUDesc):
opList = [ OpDesc(opClass='IntMult', opLat=3, pipe... | {
"content_hash": "148fbecc03c82c933e6c47e1873f1bd8",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 70,
"avg_line_length": 28.99397590361446,
"alnum_prop": 0.6166632038229795,
"repo_name": "BellScurry/gem5-fault-injection",
"id": "a38273c103ae8f84ffda1c2af003a834a7d79a2a",... |
from libcloud.utils.py3 import parse_qs, urlparse
from libcloud.common.base import Connection
__all__ = ["get_response_object"]
def get_response_object(url, method="GET", headers=None, retry_failed=None):
"""
Utility function which uses libcloud's connection class to issue an HTTP
request.
:param ur... | {
"content_hash": "35e860ca98639f509321843e7a94c2f3",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 76,
"avg_line_length": 26.170731707317074,
"alnum_prop": 0.6514445479962722,
"repo_name": "apache/libcloud",
"id": "40f4c1594c49cbdb6518db9ef85f4540df9b5440",
"size": "1855... |
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils import timezone
from django.utils.timezone import utc
from organizations import models as organization_models
def get_clubmaps():
return {
"American Club": "American",
"Britannia": "... | {
"content_hash": "b7b707e16546513cf123127a5f20f415",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 66,
"avg_line_length": 25.26923076923077,
"alnum_prop": 0.5996955859969558,
"repo_name": "st8st8/django-organizations",
"id": "9a5bb99650078b928b9c6565b0faa3ee2eea51ba",
"s... |
import os
import shutil
import tempfile
#conary
from conary import errors
from conary.deps import deps
from conary.local import database
from conary.cmds import cscmd
from conary.repository import changeset
from conary.cmds.showchangeset import displayChangeSet
from conary import versions
#test
from conary_test impor... | {
"content_hash": "c2db7fc1547273b446076862f036b422",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 80,
"avg_line_length": 41.77366255144033,
"alnum_prop": 0.5176829868978425,
"repo_name": "fedora-conary/conary",
"id": "358c27588f3d861c68e82db84b5167688ce54e04",
"size": ... |
import os
from types import FunctionType
import logging
import json
import re
import datetime
import stat
import csv, chardet, StringIO
import time
from constance import config
from django.conf import settings as dj_settings
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.h... | {
"content_hash": "71a1fd78b3feed5aa61facd02941a184",
"timestamp": "",
"source": "github",
"line_count": 2421,
"max_line_length": 198,
"avg_line_length": 34.0512185047501,
"alnum_prop": 0.593561221766661,
"repo_name": "saukrIppl/seahub",
"id": "d9004558d74c144f2078f7e09f8a2f0816fff0bb",
"size": "824... |
from django.db import models
from localflavor.md.models import MDCompanyTypeField, MDIDNOField, MDLicensePlateField
class MDPlaceModel(models.Model):
idno = MDIDNOField()
company_type_1 = MDCompanyTypeField()
company_type_2 = MDCompanyTypeField()
license_plate = MDLicensePlateField()
| {
"content_hash": "0b6f9e78b1c25a3d8d2660d26bf7ae0b",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 86,
"avg_line_length": 30.4,
"alnum_prop": 0.7730263157894737,
"repo_name": "rsalmaso/django-localflavor",
"id": "a2eb2b95b43cd5f4d9bf7a72d9cf726ecacf201c",
"size": "304",
... |
import click
import requests
from .exceptions import (
CachedPage,
WaybackRuntimeError,
BlockedByRobots
)
from urllib.parse import urljoin
from requests.utils import parse_header_links
def capture(
target_url,
user_agent="savepagenow (https://github.com/pastpages/savepagenow)",
accept_cache=Fa... | {
"content_hash": "ceb9c57e2da462f260cfa9286dea2f93",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 103,
"avg_line_length": 35.483870967741936,
"alnum_prop": 0.6715909090909091,
"repo_name": "pastpages/savepagenow",
"id": "1b2e65eba52eda34fcbe68cdea16778793cac0c7",
"size... |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('projects', '0037_project_tasks'),
]
operations = [
migrations.CreateModel(
name='Integration',
fields=[
('id', model... | {
"content_hash": "4959a12bf947fd4e2b24e039937891b7",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 233,
"avg_line_length": 49.02564102564103,
"alnum_prop": 0.5920502092050209,
"repo_name": "DMPwerkzeug/DMPwerkzeug",
"id": "7454a9cb49ae1a5db6d7a6d71f6e4a023661de82",
"size... |
"""
A connection to a hypervisor through libvirt.
Supports KVM, LXC, QEMU, UML, XEN and Parallels.
"""
import collections
from collections import deque
import contextlib
import errno
import functools
import glob
import itertools
import mmap
import operator
import os
import shutil
import tempfile
import time
import u... | {
"content_hash": "08474d01db484ac07c8364eca2fe62f4",
"timestamp": "",
"source": "github",
"line_count": 7872,
"max_line_length": 119,
"avg_line_length": 45.18673780487805,
"alnum_prop": 0.5521632790756515,
"repo_name": "OpenSciViz/cloudstack",
"id": "d719bdc80f870f5c872717e503a5163973d4c10c",
"size... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "flavify.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is rea... | {
"content_hash": "b6763cfe7e34fc25fcc50499cc01070b",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 77,
"avg_line_length": 37.285714285714285,
"alnum_prop": 0.6206896551724138,
"repo_name": "swpease/Flavify",
"id": "501e5d602114a1243300ad50df461dbc9e72f544",
"size": "805"... |
import os
import tkinter as tk
import tkinter.filedialog
import tkinter.messagebox
from tkinter import ttk
from streamdownloader import thread
def set_children_padding(object, padding_x, padding_y):
for child in object.winfo_children():
child.grid_configure(padx=padding_x, pady=padding_y)
... | {
"content_hash": "5b9a36c17ca4a42a823dddc0d2748343",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 78,
"avg_line_length": 37.748971193415635,
"alnum_prop": 0.5408263381663578,
"repo_name": "stashingpixels/streamdownloader",
"id": "caa8828c98997270b28db26393380199b446e0f6"... |
from fdfs import Fdfs
fs=Fdfs()
fs.open()
s=fs.upload('/home/insion/Pictures/g.jpg')
print(s) | {
"content_hash": "36d6bd2b86b9d522b6c57191062175a6",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 42,
"avg_line_length": 18.6,
"alnum_prop": 0.7204301075268817,
"repo_name": "ptphp/PyLib",
"id": "20d2dc5185865634d4197507ae91b7ee75a28a09",
"size": "93",
"binary": false,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.