text stringlengths 4 1.02M | meta dict |
|---|---|
import inspect
import os
from oslo_utils import importutils
import osprofiler.opts as profiler
import six.moves as six
from nova import conf
from nova import test
class TestProfiler(test.NoDBTestCase):
def test_all_public_methods_are_traced(self):
# NOTE(rpodolyaka): osprofiler only wraps class methods ... | {
"content_hash": "f7325e79f9fe84664600a290e8d2288d",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 78,
"avg_line_length": 45.08955223880597,
"alnum_prop": 0.6262826878517047,
"repo_name": "rahulunair/nova",
"id": "0d2ccf17879a851d6a68632c8650e025c75af65b",
"size": "3657"... |
import rospy
import actionlib
from vigir_synthesis_msgs.msg import *
import ltl_compilation_client
import ltl_synthesis_client
import sm_generate_client
class BehaviorSynthesisActionServer(object):
'''ROS Action server that handles the following processes:
* LTL Specification Compilation
* LTL Synthesis... | {
"content_hash": "951d9c18b45cd52c8ba04a2ac4d0346c",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 115,
"avg_line_length": 41.025,
"alnum_prop": 0.6256855575868373,
"repo_name": "team-vigir/vigir_behavior_synthesis",
"id": "72c9fabe8496c24eecb53f7e50536a773b710542",
"si... |
"""
Tests for L{txdav.xml.base}.
"""
from twisted.trial.unittest import TestCase
from txdav.xml.base import decodeXMLName, encodeXMLName
from txdav.xml.base import WebDAVUnknownElement
from txdav.xml.parser import WebDAVDocument
class NameEncodeTests(TestCase):
"""
Name encoding tests.
"""
def test_... | {
"content_hash": "9bdaf273ba2e4356ddda0473709bf69c",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 82,
"avg_line_length": 32.63529411764706,
"alnum_prop": 0.6434751261715934,
"repo_name": "macosforge/ccs-calendarserver",
"id": "78b154687db422eff69cc0a164bd0a26ed94e6fd",
... |
import _plotly_utils.basevalidators
class TokenValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="token", parent_name="table.stream", **kwargs):
super(TokenValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "522c262a862db1d35037610e32875460",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 82,
"avg_line_length": 38.42857142857143,
"alnum_prop": 0.5910780669144982,
"repo_name": "plotly/python-api",
"id": "dd775062137cf463d3ff6cd3bb10b845a212cc0b",
"size": "538... |
from binwalk.core.compat import *
from binwalk.core.common import BlockFile
from binwalk.core.module import Module, Option, Kwarg
class Plotter(Module):
'''
Base class for visualizing binaries in Qt.
Other plotter classes are derived from this.
'''
VIEW_DISTANCE = 1024
MAX_2D_PLOT_POINTS = 12... | {
"content_hash": "9002d7a0c9a0c4c4607220a9fd57d27c",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 104,
"avg_line_length": 32.73354231974922,
"alnum_prop": 0.5315073740662708,
"repo_name": "sundhaug92/binwalk",
"id": "7fa1abbed5cc52c283ce85171f83d4e73f5cac39",
"size": "... |
from setuptools import setup, find_packages
import os
import re
import ast
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('qtk/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
BASE_PATH = os.path.dirname(__file__)
def get_... | {
"content_hash": "0dd53ef073a9d5f36abccd15ab15f6e8",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 75,
"avg_line_length": 29.76,
"alnum_prop": 0.6223118279569892,
"repo_name": "gouthambs/qtk-python",
"id": "6885ae19c29c67677ee60a663ce448fe742b4380",
"size": "1488",
"bi... |
"""
https://leetcode.com/problems/smallest-subtree-with-all-the-deepest-nodes/
"""
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
from common.list_to_tree_node import listToTreeNode
from common.tree_no... | {
"content_hash": "a432bbbcd55f70966ca09a0bd52a8401",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 166,
"avg_line_length": 29.884615384615383,
"alnum_prop": 0.5926640926640927,
"repo_name": "vivaxy/algorithms",
"id": "20f1e906233296ed37671135a3d119de8f5825ba",
"size": "1... |
import numpy as np
import copy
def combine_predictions(Predictions, predictions_list, index_list):
"""Combine predictions predictions_list[index_list].
Parameters
----------
Predictions : a Predictions type
Needed to call combine.
predictions_list : list of instances of Predictions
in... | {
"content_hash": "15349d96ad12c4e4c98adbe70874f8e9",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 79,
"avg_line_length": 43.13809523809524,
"alnum_prop": 0.6692791698863009,
"repo_name": "paris-saclay-cds/ramp-workflow",
"id": "dac4b5fe60c64543268e9a43ef5542a0d75a750b",
... |
"""A simple Google-style logging wrapper."""
import logging
import time
import traceback
import os
import gflags as flags
FLAGS = flags.FLAGS
def format_message(record):
try:
record_message = '%s' % (record.msg % record.args)
except TypeError:
record_message = record.msg
return record_m... | {
"content_hash": "cbdbd28ed3ef4a0c82896ae17e713d5c",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 90,
"avg_line_length": 28.663967611336034,
"alnum_prop": 0.5997175141242937,
"repo_name": "benley/python-glog",
"id": "1aa0f75fe4390a025e4d19fb2e9b105b050d994e",
"size": "... |
from __future__ import unicode_literals, absolute_import
import os
from ardublocklyserver.py23 import py23
from ardublocklyserver.compilersettings import ServerCompilerSettings
class SketchCreator(object):
"""
Creates an Arduino Sketch.
"""
#
# Metaclass methods
#
def __init__(self):
... | {
"content_hash": "9be1007533af577944ef714f8bff19fb",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 77,
"avg_line_length": 32.51807228915663,
"alnum_prop": 0.5739162652834383,
"repo_name": "adrgerez/ardublockly",
"id": "2a394cbb2ea452968fe6ce76847cd12c89cd2b46",
"size": "... |
from window import App
app = App()
app.updatemsg("startup")
app.run()
app.root.destroy()
| {
"content_hash": "dd574ebd716ea177a9e8b15e133bd20c",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 24,
"avg_line_length": 15,
"alnum_prop": 0.7111111111111111,
"repo_name": "brucelau-github/raspberry-pi-proj",
"id": "9c512a419aa71ee8ddf0e11ec71b28cada618c27",
"size": "90"... |
"""Dummy ProvPy ``prov-compare`` which mimics the behaviour of
ProvPy ``prov-compare``.
``prov-compare`` returns 2 if:
- No files.
- Files are not valid PROV documents.
``prov-compare`` returns 1 if:
- Files are valid PROV documents but not equivalent.
``prov-compare`` returns 0 if:
- Files are valid PROV do... | {
"content_hash": "5c91fea115b01592bd034e72cee26f5b",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 76,
"avg_line_length": 32.74766355140187,
"alnum_prop": 0.6786529680365296,
"repo_name": "prov-suite/interop-test-harness",
"id": "528c98169572cf958f01ddb153657eee65cdd96e",... |
"""zest.releaser entry points to support projects using distutils2-like
setup.cfg files. The only actual functionality this adds is to update the
version option in a setup.cfg file, if it exists. If setup.cfg does not exist,
or does not contain a version option, then this does nothing.
TODO: d2to1 theoretically supp... | {
"content_hash": "7f01c29a270510da72ee720f8e12f518",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 79,
"avg_line_length": 34.666666666666664,
"alnum_prop": 0.6566506410256411,
"repo_name": "ioram7/keystone-federado-pgid2013",
"id": "896b6dbddde892313b462ddddde93b96989d5e3d... |
from django.contrib import admin
from quotations import models
class AuthorAdmin(admin.ModelAdmin):
search_fields = ['name']
class QuotationAdmin(admin.ModelAdmin):
search_fields = ['text', 'author__name']
admin.site.register(models.Author, AuthorAdmin)
admin.site.register(models.Quotation, QuotationAdmi... | {
"content_hash": "f76028df3aed6f7757306d21ed6ec40b",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 53,
"avg_line_length": 21.533333333333335,
"alnum_prop": 0.7647058823529411,
"repo_name": "jessamynsmith/socialjusticebingo",
"id": "eed4ba8820cc0e8165ef8ac560f88f0a23f55b9a"... |
"""
Environmental Exposures API
Environmental Exposures API
OpenAPI spec version: 1.0.0
Contact: stealey@renci.org
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 complianc... | {
"content_hash": "c09997431f7a2715bf368c6b4bffa613",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 83,
"avg_line_length": 26.870588235294118,
"alnum_prop": 0.670753064798599,
"repo_name": "ResearchSoftwareInstitute/greendatatranslator",
"id": "5bfd93a2dbfd5a4169fff95e51c4c... |
import os
import sys
import MySQLdb
class DatabaseConnection(object):
'''Connect to OLRC's mysql server.'''
def __init__(self):
'''Initiate connection the database. If connection credentials are not
available or connection fails throw exception.'''
try:
self.db = MySQLdb.... | {
"content_hash": "a9c0c75398be6365999673e3c0909b45",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 78,
"avg_line_length": 29.86046511627907,
"alnum_prop": 0.4976635514018692,
"repo_name": "cudevmaxwell/SwiftBulkUploader",
"id": "2285c130af0b5f85de18d72270c8128861df4b84",
... |
from os.path import abspath, dirname, basename, join
try:
import kendoui_backend
except ImportError:
import sys
sys.path.insert(0, "..")
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
ROOT_PATH = abspath(dirname(__file__))
PROJECT_NAME = basename(ROOT_PA... | {
"content_hash": "2a1425bdbd13b41d550c48ee7bd62ddd",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 122,
"avg_line_length": 26.041666666666668,
"alnum_prop": 0.62112,
"repo_name": "tnajdek/django-kendoui-backend",
"id": "08b3cf3a28e79fa1950942d2e52539ef9adc8485",
"size":... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("account", "0001_user")]
operations = [
migrations.AddField(
model_name="user",
name="updated_at",
field=models.DateTimeField(
auto_now=True,
... | {
"content_hash": "23f97f59e607dc13e74f4d2535d6be8a",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 69,
"avg_line_length": 27.04,
"alnum_prop": 0.5133136094674556,
"repo_name": "knowmetools/km-api",
"id": "650e877a31bd3c342eee395c419b53f1cb497056",
"size": "725",
"binar... |
import argparse
import subprocess
PROJECT_VERSION = '0.1.0-rc.5' # Current version of the project (ViennaGrid for Python)
BOOST_VERSION = '1.53.0' # Version of Boost used for development
VIENNAGRID_VERSION = '1.0.1' # Version of ViennaGrid used for development
def replace_dirs(old_str, new_str, dirs)... | {
"content_hash": "84d50f00093b06fe69c65da3b368a3a3",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 121,
"avg_line_length": 47.170731707317074,
"alnum_prop": 0.6923474663908997,
"repo_name": "jonancm/viennagrid-python",
"id": "4599b5b166636e3730207ec438826c7bb08a27aa",
"s... |
from model.new_contact import New_contact
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def fill_new_contact_form(self, new_contact):
wd = self.app.wd
self.open_add_new_contact()
self.fill_contact_form(new_contact)
# submit the form
wd.... | {
"content_hash": "88bac066dcb620d2b63b6c4e91a5830f",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 125,
"avg_line_length": 42.515527950310556,
"alnum_prop": 0.5956172388604821,
"repo_name": "olga121/python_training",
"id": "142c563c3b58f0d8c885be5748d36def76a23eb5",
"si... |
import sys
import os.path
import re
# import exceptions
class bjbTask:
# Class "constants"
TEXT = 0
CONTEXT = 1
STATUS = 2
DUE_DATE = 3
START_DATE = 4
# Class variables
db_file = "taskdb"
tasks = []
def __init__(self):
# Check for config file
if os.path.isfile... | {
"content_hash": "eb346422ea918bccc52ef7d03b4ee7e8",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 128,
"avg_line_length": 38.98293515358362,
"alnum_prop": 0.466993521274733,
"repo_name": "barrybridgens/bjbtask",
"id": "50595c897b1f73232d82666d57d5b3e5006a915f",
"size":... |
import math
import numpy
import worldengine.astar
# Direction
NORTH = [0, -1]
NORTH_EAST = [1, -1]
EAST = [1, 0]
SOUTH_EAST = [1, 1]
SOUTH = [0, 1]
SOUTH_WEST = [-1, 1]
WEST = [-1, 0]
NORTH_WEST = [-1, -1]
CENTER = [0, 0]
DIR_NEIGHBORS = [NORTH, EAST, SOUTH, WEST]
DIR_NEIGHBORS_CENTER = [CENTER, NORTH, EAST, SOUTH, W... | {
"content_hash": "ede1c0ccc4069050eea042514f2c83e1",
"timestamp": "",
"source": "github",
"line_count": 405,
"max_line_length": 104,
"avg_line_length": 40.35308641975308,
"alnum_prop": 0.49097472924187724,
"repo_name": "psi29a/worldengine",
"id": "a08a0bc27143862c080fbe0ee77048b9717f2802",
"size": ... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag
def upload_js():
return mark_safe("""
<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i+... | {
"content_hash": "989941418ff0cc597b8d7a8f065b6240",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 210,
"avg_line_length": 36.37777777777778,
"alnum_prop": 0.46640195479535734,
"repo_name": "vsoch/docfish",
"id": "e086be7e79a49b8f2f1e9457e26c79ecad280f67",
"size": "3274"... |
import os, sys
sys.path.append(os.getcwd())
import profiler
import time
import random
# this example essentially showcases the basic uses of
# - profiler.function_profiler
# - profiler.FunctionLogger.log_data
@profiler.function_profiler()
def foo():
return
foo()
foo()
@profiler.function_profiler()
def bar():
... | {
"content_hash": "677222f9f00da89274c76de0e9c9c8ac",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 54,
"avg_line_length": 17.208333333333332,
"alnum_prop": 0.6767554479418886,
"repo_name": "Datamine/Function-Profiler",
"id": "c62d610961c2f7cbe86550b99b903e3adfcfd0c2",
"s... |
"""Integration code for AFLplusplus fuzzer."""
import os
import shutil
from fuzzers.afl import fuzzer as afl_fuzzer
from fuzzers import utils
def get_cmplog_build_directory(target_directory):
"""Return path to CmpLog target directory."""
return os.path.join(target_directory, 'cmplog')
def get_uninstrument... | {
"content_hash": "b54e259fb5ccc2861ccec1a95fb3d4cf",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 136,
"avg_line_length": 40.12549019607843,
"alnum_prop": 0.6134675527756059,
"repo_name": "google/fuzzbench",
"id": "b350390e21c69ee791d527276da82c35ccc4e66a",
"size": "10... |
import os
from app import create_app, db
from app.models import User, Follow, Role, Permission, Post, Comment, Api, Api_gps
from flask_script import Manager, Shell
from flask_migrate import Migrate, MigrateCommand
from werkzeug.contrib.fixers import ProxyFix
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
app... | {
"content_hash": "15c6673794719e9e25184ff13e2f4c38",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 92,
"avg_line_length": 31.266666666666666,
"alnum_prop": 0.7185501066098081,
"repo_name": "Harold2017/myfirstflasky",
"id": "a3211f7c8557bd6936aa7715dc738091c838c1f3",
"siz... |
"""A Folder Resource."""
import json
from google.cloud.forseti.common.gcp_type import resource
class FolderLifecycleState(resource.LifecycleState):
"""Represents the Folder's LifecycleState."""
pass
class Folder(resource.Resource):
"""Folder Resource."""
RESOURCE_NAME_FMT = 'folders/%s'
def ... | {
"content_hash": "e0627dc42dd314c13a6a728369603c62",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 75,
"avg_line_length": 31.7027027027027,
"alnum_prop": 0.5626598465473146,
"repo_name": "forseti-security/forseti-security",
"id": "48bfc874ea2fd6a5ddbb9b340b7995d1339b1dc9",... |
import urllib2
import urllib
import urlparse
import base64
import argparse
import sys
import json
import ConfigParser
import os
import time
import atexit
import signal
import logging
import ssl
# maps a dynamic DNS provider name (used in the config file)
# to the name of the class that supports it)
DNS_PROVIDER_MAP = ... | {
"content_hash": "ad7928b95b41a3d682f5fc5b1ef7d005",
"timestamp": "",
"source": "github",
"line_count": 766,
"max_line_length": 110,
"avg_line_length": 32.26109660574413,
"alnum_prop": 0.5581094205244416,
"repo_name": "theory14/chipmunk",
"id": "9e3be71082574f3e4ed78bf32208964c57194f32",
"size": "2... |
from __future__ import division
import requests
from collections import defaultdict
from math import ceil
BASE_URL = "http://api.genius.com"
def search_songs(search, n=25):
pages = int(ceil(n / 25))
songs = []
for page in xrange(1, pages + 1):
r = requests.get(BASE_URL + "/search", pa... | {
"content_hash": "69b266219568c19fd45e7c086b0c9013",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 101,
"avg_line_length": 29.9375,
"alnum_prop": 0.5117804950790337,
"repo_name": "billletson/genius",
"id": "0c8e1bb93935194b1cfb09910f28c588420e741b",
"size": "3353",
"b... |
"""
Migration from moin--main--1.3 pre patch-332 to post patch-332.
In patch-332 we changed the format of page lists in user data file. They
are now tab separated instead of comma separated, and page names are not
quoted using file system quoting.
You can run the script multiple times with no damage.
Steps for a su... | {
"content_hash": "39e2c729f0052601680c0305b4b0a547",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 78,
"avg_line_length": 30.063291139240505,
"alnum_prop": 0.6442105263157895,
"repo_name": "RealTimeWeb/wikisite",
"id": "e423d2ac5a22221751719f30fba864de5a058f94",
"size":... |
import enum
@enum.unique
class ConnectionStatus(enum.Enum):
NOT_APPLICABLE = "NOT_APPLICABLE"
CALCULATING = "CALCULATING"
CONNECTED = "CONNECTED"
DISCONNECTED = "DISCONNECTED"
DOMAIN_DELETED = "DOMAIN_DELETED"
NOT_COMPLETE = "NOT_COMPLETE"
USER_IN_SOURCE = "USER_IN_SOURCE"
L7_APPLICATI... | {
"content_hash": "f9605caa3a2be4839e49f818ddf40448",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 47,
"avg_line_length": 28.375,
"alnum_prop": 0.6806167400881057,
"repo_name": "Tufin/pytos",
"id": "a903466459731bf0bfd596acaf3b861a85057000",
"size": "455",
"binary": fa... |
"""
osisoftpy.find_tags_and_query
~~~~~~~~~~~~
Some blah blah about what this file is for...
"""
# Fix print functions
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from future.utils import iteritems
import arrow
import time
import osisoftpy # main packag... | {
"content_hash": "273aa6e41e8de18d0a781d8ccba4f429",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 157,
"avg_line_length": 37.01960784313726,
"alnum_prop": 0.6518802966101694,
"repo_name": "dstcontrols/osisoftpy",
"id": "09ed9f8bdd16ad642e31ffe66b49293b29bd928c",
"size"... |
import optparse
import unittest
from webkitpy.common.system.output_capture import OutputCapture
from webkitpy.tool.commands.queries import PrintBaselines, PrintExpectations
from webkitpy.tool.mock_tool import MockWebKitPatch
class PrintExpectationsTest(unittest.TestCase):
def run_test(self, tests, expected_stdo... | {
"content_hash": "a825c576a08355718737aa1de50ef2be",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 121,
"avg_line_length": 43.744827586206895,
"alnum_prop": 0.5390193914551474,
"repo_name": "google-ar/WebARonARCore",
"id": "d60a56e9d2201f248935c8317e6ab8887ed0fc20",
"si... |
import re
from random import randrange
from model.contact import Contact
def test_contact_on_the_home_page(app, db):
old_contacts = app.contact.get_contact_list()
contact_from_db = db.get_contact_list()
for i in range(len(contact_from_db)):
db_contact = contact_from_db[i]
ui_contact = (sor... | {
"content_hash": "1924701a12790e7ed29f863f8bf21199",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 114,
"avg_line_length": 41.10344827586207,
"alnum_prop": 0.639261744966443,
"repo_name": "AnnaWyszomirska/lesson1_1",
"id": "407539ec9ae4b5f086208cfcedce8b70ce3c07b5",
"siz... |
import os
import struct
import subprocess
import configparser
CONFIG_FILE = os.path.join(os.environ['LOCALAPPDATA'], 'squeakvmlauncher.ini')
# TODO: make this platform independent
CONFIG_SECTION = 'VMs'
def launch_squeak(image_filename):
with open(image_filename, 'rb') as f:
image_version = read_magic_ver... | {
"content_hash": "0d308c7bac065d1f57fd6e86c837a997",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 98,
"avg_line_length": 33.43636363636364,
"alnum_prop": 0.7188689505165851,
"repo_name": "j4yk/squeakvm-launcher",
"id": "7c0196e0f1390d98a8129c1077077d2b7ac0b5ee",
"size":... |
"""
A script that uses f2py to generate the signature files used to make
the Cython BLAS and LAPACK wrappers from the fortran source code for
LAPACK and the reference BLAS.
To generate the BLAS wrapper signatures call:
python _cython_signature_generator.py blas <blas_directory> <out_file>
To generate the LAPACK wrapp... | {
"content_hash": "d5d4edaefb7c58ac458510439be3831d",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 297,
"avg_line_length": 63.908396946564885,
"alnum_prop": 0.6207596751075012,
"repo_name": "DailyActie/Surrogate-Model",
"id": "3e32f4ee3bff69c241712515ab32a5fa027911ff",
... |
"""
IPython -- An enhanced Interactive Python
One of Python's nicest features is its interactive interpreter. This allows
very fast testing of ideas without the overhead of creating test files as is
typical in most programming languages. However, the interpreter supplied with
the standard Python distribution is fairly... | {
"content_hash": "8a36b1407c0ff05e8b1a193c3de3bb67",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 78,
"avg_line_length": 39.9,
"alnum_prop": 0.6931614751163623,
"repo_name": "toomoresuch/pysonengine",
"id": "ce4f990d792e649226889b8b89de929df396451a",
"size": "2817",
"... |
from .resource import Resource
class GenericResource(Resource):
"""Resource information.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource ID
:vartype id: str
:ivar name: Resource name
:vartype name: str
:ivar type: Resource ty... | {
"content_hash": "849f942c63b33ce571eb32dbe0e649b4",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 130,
"avg_line_length": 36.16129032258065,
"alnum_prop": 0.584299732381802,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "22b5c9ae7fe73bbeb100d32b6bb435fa701400c9",
... |
import six.moves.cPickle as pickle
import os
import shutil
import tempfile
import unittest
import numpy
import theano
from theano.compile.io import In
def test_function_dump():
v = theano.tensor.vector()
fct1 = theano.function([v], v + 1)
try:
tmpdir = tempfile.mkdtemp()
fname = os.path... | {
"content_hash": "e6693ef1d99c962ea64013fa426d4fb1",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 79,
"avg_line_length": 36.329896907216494,
"alnum_prop": 0.5672531214528944,
"repo_name": "cmdunkers/DeeperMind",
"id": "1b023b2c478865e1297047ea9afb30d164fa34df",
"size":... |
from collections import OrderedDict
from .dynamicbinary import DynamicBinary
class BinaryStore:
def __init__(self):
self._binaries = OrderedDict()
def add_binary(self, binary, name=None):
if name is None:
name = binary.get_name()
if name in self._binaries:
rais... | {
"content_hash": "7a707b57746e4fd612975c88db30ada6",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 80,
"avg_line_length": 37.53658536585366,
"alnum_prop": 0.6231319038336582,
"repo_name": "fr3akout/pwny",
"id": "06fa536fa048720c0f2ad9852d214fe0166f2672",
"size": "1539",
... |
import pygame, math, random
from Entity import Entity
from Player import Player
class ShammyTowel(pygame.sprite.Sprite):
def __init__(self, pos = [0,0]):
pygame.sprite.Sprite.__init__(self, self.containers)
self.upImages = [pygame.image.load("RSC/Enemy Images/ththing/OH.png"),
... | {
"content_hash": "5928dd4f316843e0786fe8927b260a2a",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 80,
"avg_line_length": 33.40860215053763,
"alnum_prop": 0.522690698422916,
"repo_name": "KRHS-GameProgramming-2014/Shamwow",
"id": "4bf3bcf09c23f4c952f93c162c8db8e876536796",... |
'''Autogenerated by get_gl_extensions script, do not edit!'''
from OpenGL import platform as _p
from OpenGL.GL import glget
EXTENSION_NAME = 'GL_ARB_ES3_compatibility'
_p.unpack_constants( """GL_COMPRESSED_RGB8_ETC2 0x9274
GL_COMPRESSED_SRGB8_ETC2 0x9275
GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
GL_COMPRESSED_... | {
"content_hash": "8cbbfbbe6652ca7ba5a37f0509a75b91",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 71,
"avg_line_length": 38.69565217391305,
"alnum_prop": 0.802247191011236,
"repo_name": "frederica07/Dragon_Programming_Process",
"id": "b31c5ac8daea4a175ac3a2a99f4f4fbe9ddb6... |
'''OpenGL extension KHR.cl_event
This module customises the behaviour of the
OpenGL.raw.EGL.KHR.cl_event to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/KHR/cl_event.txt
'''
from OpenGL import platform, constant, arrays
from Ope... | {
"content_hash": "47ecad7d3d8d5438fdb2dda9db8eee15",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 71,
"avg_line_length": 31.47826086956522,
"alnum_prop": 0.7817679558011049,
"repo_name": "alexus37/AugmentedRealityChess",
"id": "b784f08da1d7096daa47e69dfb9abb9e0b86a75e",
... |
"""
rnn
model built with tensorflow for constructing standard Recurrent Neural Network
(RNN) and Long Short-Term Memory (LSTM)
"""
import tensorflow as tf
class _BaseRNN(object):
"""base class recurrent neural network"""
def __init__(self, step_size, state_size, num_classes):
self._step_size = ste... | {
"content_hash": "da921db790cba3d071d197a23d320e03",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 79,
"avg_line_length": 40.755102040816325,
"alnum_prop": 0.5384743782340177,
"repo_name": "minggli/chatbot",
"id": "909d27ad7997cf6618b3ff66c53120d9a8f35c83",
"size": "601... |
import math
from copy import deepcopy
from fontTools.misc import transform
from fontParts.base.errors import FontPartsError
from fontParts.base import normalizers
# -------
# Helpers
# -------
class dynamicProperty(object):
"""
This implements functionality that is very similar
to Python's built in prop... | {
"content_hash": "76aefe6dbbc048856b062dbfe77186b8",
"timestamp": "",
"source": "github",
"line_count": 837,
"max_line_length": 79,
"avg_line_length": 28.174432497013143,
"alnum_prop": 0.5607666864557713,
"repo_name": "robofab-developers/fontParts",
"id": "4f814cb78832fa4146b90fc39a3c05d51649819c",
... |
from django.contrib import admin
from .models import Genre, Instrument, Song
admin.site.register(Genre)
admin.site.register(Instrument)
admin.site.register(Song)
# admin.site.register(Followers)
| {
"content_hash": "42283eb34ee0165022d30e7e50d16b2f",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 43,
"avg_line_length": 24.625,
"alnum_prop": 0.8071065989847716,
"repo_name": "ajay2611/mmb",
"id": "56cc369f63491d423777cb8420ec89165c2fb46d",
"size": "197",
"binary": fa... |
'''
Some default compression transforms (gzip, compress, etc).
@author: Michael Eddington
@version: $Id: compress.py 2020 2010-04-14 23:13:14Z meddingt $
'''
#
# Copyright (c) Michael Eddington
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated document... | {
"content_hash": "c086ceebfc5b19ca70e590cb1b7cf009",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 79,
"avg_line_length": 28.49230769230769,
"alnum_prop": 0.728401727861771,
"repo_name": "thecrackofdawn/Peach2.3",
"id": "0755b22fad200f16e75f78ea57303fdb1ce8b634",
"size"... |
"""linkedlist.py: Class representing linkedlist"""
from listnode import ListNode
__author__ = 'Rohit Sinha'
class LinkedList:
def __init__(self):
self.head = None
def is_empty(self):
return self.head is None
def add(self, item):
temp = ListNode(item)
if self.head is No... | {
"content_hash": "352486f594708522379b1b0a5961702d",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 56,
"avg_line_length": 23.157894736842106,
"alnum_prop": 0.5011363636363636,
"repo_name": "rohitsinha54/Learning-Python",
"id": "077ebc721775f77d1f7e1eaa5540660ded4890ca",
... |
"""Copyright 2015 Roger R Labbe Jr.
FilterPy library.
http://github.com/rlabbe/filterpy
Documentation at:
https://filterpy.readthedocs.org
Supporting book at:
https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python
This is licensed under an MIT license. See the readme.MD file
for more information.
"""
fro... | {
"content_hash": "e8cc454ee0f19a831090b8e6b03ca687",
"timestamp": "",
"source": "github",
"line_count": 1074,
"max_line_length": 85,
"avg_line_length": 26.399441340782122,
"alnum_prop": 0.5441046802807463,
"repo_name": "rlabbe/filterpy",
"id": "260109ff711893fa26e01550a3f087da7d665ef0",
"size": "28... |
import re
# These are the regular expressions used to check if an option should be
# used to find a parent entity. The preferred way is using the "parent"
# prefix, as it avoid potential conflicts with other options, but we
# need to support the "identifier" suffix without the "parent" prefix
# for backwards compatib... | {
"content_hash": "26758469080afcb8178b1dd81b1e25c9",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 75,
"avg_line_length": 34.56410256410256,
"alnum_prop": 0.6431750741839762,
"repo_name": "oVirt/ovirt-engine-cli",
"id": "edf626e093502d7a0590730baa68f054a290c9b8",
"size":... |
import os
import unittest as unittest
import sys
from contextlib import contextmanager
from io import StringIO
from version.version import Version, VersionUtils, parse_version
from version.cli import main
class TestSemanticVersion(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.version = Ve... | {
"content_hash": "d00431dd21ef57c97b4f923317af95f5",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 130,
"avg_line_length": 37.22012578616352,
"alnum_prop": 0.6013856032443393,
"repo_name": "rocktavious/pyversion",
"id": "c31a1e7677e5e7c18aac1b4221c630397e693096",
"size"... |
import json
from unittest.mock import ANY, MagicMock, Mock, call, patch
import pytest
import tornado
from jupyterlab_git.git import Git
from jupyterlab_git.handlers import NAMESPACE, setup_handlers, GitHandler
from .testutils import assert_http_error, maybe_future
from tornado.httpclient import HTTPClientError
def... | {
"content_hash": "5984b3ae6c72cbb4bce0a2834da177c7",
"timestamp": "",
"source": "github",
"line_count": 954,
"max_line_length": 166,
"avg_line_length": 30.243186582809223,
"alnum_prop": 0.6031470955219742,
"repo_name": "jupyterlab/jupyterlab-git",
"id": "d9626795f48fbebe3a9e50c6a45bbccfe7f773d7",
"... |
"""Define resources for the BigQuery Routines API."""
from google.protobuf import json_format
import six
import google.cloud._helpers
from google.cloud.bigquery import _helpers
import google.cloud.bigquery_v2.types
class Routine(object):
"""Resource representing a user-defined routine.
See
https://clou... | {
"content_hash": "329cdafa40dc3306e3335b68d055152b",
"timestamp": "",
"source": "github",
"line_count": 490,
"max_line_length": 103,
"avg_line_length": 32.289795918367346,
"alnum_prop": 0.6013778283402856,
"repo_name": "tseaver/google-cloud-python",
"id": "044368e751082307a8ee59cadc30daf5703c1a2b",
... |
from core.himesis import Himesis
import uuid
class HState2CProcDef(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule State2CProcDef.
"""
# Flag this instance as compiled now
self.is_compiled = True
super(HS... | {
"content_hash": "4eaa100758c99a5590114be23e4ddcd5",
"timestamp": "",
"source": "github",
"line_count": 308,
"max_line_length": 579,
"avg_line_length": 42.51948051948052,
"alnum_prop": 0.5047342700061087,
"repo_name": "levilucio/SyVOLT",
"id": "a0ac2a7f682ae4a6a09659cb5ba9e53f67b434f6",
"size": "13... |
'''Tests for shell.py parser'''
from __future__ import (unicode_literals, division, absolute_import, print_function)
import sys
if sys.version_info < (3,):
from io import BytesIO as StrIO
else:
from io import StringIO as StrIO
from powerline.commands.main import get_argparser, finish_args
from tests import TestC... | {
"content_hash": "b7faad56613b57d5b526793e40d9da3b",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 108,
"avg_line_length": 35.201550387596896,
"alnum_prop": 0.5029729134551861,
"repo_name": "bartvm/powerline",
"id": "af3562a3357147a6c880253ed3ea675d76b646ab",
"size": "4... |
from figment import Component
import random
class Sticky(Component):
"""A difficult-to-drop item."""
def __init__(self, stickiness=0.5):
self.stickiness = stickiness
def to_dict(self):
return {"stickiness": self.stickiness}
def roll_for_drop(self):
return random.random() < s... | {
"content_hash": "05ec076a71a347e38b86e88a81cf4f3e",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 48,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.6507462686567164,
"repo_name": "vreon/figment",
"id": "b9a82e2cd8ce1071fb17777dd7cb0f4ec77de5c4",
"size": "335",
... |
from testlib import *
from auxly.filesys import makedirs, delete, isempty, copy
##==============================================================#
## SECTION: Class Definitions #
##==============================================================#
class TestCase(BaseTest):
def test_... | {
"content_hash": "95077bdec2819697c16128cccfbd962a",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 65,
"avg_line_length": 35.90243902439025,
"alnum_prop": 0.47690217391304346,
"repo_name": "jeffrimko/Auxly",
"id": "af5b52eaaf0b21db8b0d739b4ec129b1660d8bb8",
"size": "1671... |
"""A module of potentially useful class types"""
import inspect
__all__ = ['Dict', 'immutableobject', 'Singleton']
__author__ = 'Jon Nappi'
class Dict(dict):
"""A *dict* builtin subclass. Currently the only additional functionality
that this class provides is the addition of the __iadd__ method, which
pr... | {
"content_hash": "206bbed389394b75aa64677e5dd8aab9",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 78,
"avg_line_length": 34.19230769230769,
"alnum_prop": 0.5635545556805399,
"repo_name": "moogar0880/python-misc",
"id": "7eeb9b88456eb273b0ffd1f1b96b0752dd55a43a",
"size"... |
from construct import OptionalGreedyRange, Sequence, StringAdapter, Peek
from construct import LengthValueAdapter, Struct, Switch, Container, IfThenElse
from construct import PascalString
from construct import MetaField, SBInt8, SBInt32, UBInt8, UBInt16
from construct import UBInt32, UBInt64
from twisted.internet impor... | {
"content_hash": "a292ec46e737ab473637ae255e191501",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 79,
"avg_line_length": 23.064935064935064,
"alnum_prop": 0.5957207207207207,
"repo_name": "bravoserver/hammer",
"id": "4455b3583226be106215f289e92eeafdcc2a76d5",
"size": "... |
import placebo
import boto3
import os
import functools
from placebo.serializer import Format
def placebo_session(function):
"""
Decorator to help do testing with placebo.
Simply wrap the function you want to test and make sure to add
a "session" argument so the decorator can pass the placebo session.... | {
"content_hash": "dfe9d542d22d334fe2c8bbf11ac4aa08",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 76,
"avg_line_length": 31.88888888888889,
"alnum_prop": 0.624274099883856,
"repo_name": "garnaat/placebo",
"id": "3b717013cc355a44896af686ecab35ec35f4c703",
"size": "2309",... |
import json
import logging
import os
import re
import webapp2
import uuid
from perf_insights import trace_info
from perf_insights import cloud_config
import third_party.cloudstorage as gcs
from google.appengine.api import datastore_errors
default_retry_params = gcs.RetryParams(initial_delay=0.2,
... | {
"content_hash": "1c9dcde31779e1f814c138e33f0bb4c6",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 79,
"avg_line_length": 33.282051282051285,
"alnum_prop": 0.597457627118644,
"repo_name": "SummerLW/Perf-Insight-Report",
"id": "c1179bc1518c706755c3c80c8df0d653497105e1",
"... |
import os
import cv2
import sys
import h5py
import parmap
import argparse
import numpy as np
import pandas as pd
from tqdm import tqdm as tqdm
import matplotlib.pylab as plt
def dodgeV2(image, mask):
return cv2.divide(image, 255-mask, scale=256)
def make_sketch(filename):
"""
Create sketch for the RGB ima... | {
"content_hash": "c3126e80b017876bd4bb7021b34a0680",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 105,
"avg_line_length": 33.713615023474176,
"alnum_prop": 0.5724829410945551,
"repo_name": "TengdaHan/Convolutional_Sketch_Inversion",
"id": "9d37760bb693239fb0ae799e159badb... |
import json
from twisted.trial import unittest
from nacl.public import PrivateKey, PublicKey, Box
from .common import TwoNodeMixin
from ..mailbox import channel
from ..mailbox.delivery import createMsgA, ReturnTransport, OutboundHTTPTransport
from ..mailbox.server import parseMsgA, parseMsgB
class Transports(TwoNodeMi... | {
"content_hash": "76414374dbc1333e967555982ebf21a5",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 81,
"avg_line_length": 41.92424242424242,
"alnum_prop": 0.5999277195518612,
"repo_name": "warner/petmail",
"id": "5404feed31c7e2d25137b13624a0c7c9aae19b53",
"size": "5534"... |
from CIM14.ENTSOE.Dynamics.IEC61970.Wires.WiresSynchronousMachine import WiresSynchronousMachine
from CIM14.ENTSOE.Dynamics.IEC61970.Wires.WiresRegulatingControl import WiresRegulatingControl
from CIM14.ENTSOE.Dynamics.IEC61970.Wires.WiresRegulatingCondEq import WiresRegulatingCondEq
nsURI = "http://iec.ch/TC57/2009/C... | {
"content_hash": "d743da3f5455da2efb96c1896f0452ed",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 96,
"avg_line_length": 58,
"alnum_prop": 0.8522167487684729,
"repo_name": "rwl/PyCIM",
"id": "4dda8023a8455d9bc81e768c2feee92268798a18",
"size": "1507",
"binary": false,
... |
import os
import unittest
import cobra
import cobra.auth as c_auth
import cobra.auth.shadowfile as c_auth_shadow
import cobra.tests as c_tests
class CobraBasicTest(unittest.TestCase):
#def setUp(self):
#pass
#def tearDown(self):
#pass
def test_cobra_proxy(self):
testobj = c_te... | {
"content_hash": "2d9125621f4db870aed1bc0b7443ab2d",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 87,
"avg_line_length": 28.264957264957264,
"alnum_prop": 0.618385243423042,
"repo_name": "bat-serjo/vivisect",
"id": "c6e6eaed6700b1aaf76ea6aca53cef8d3da742ba",
"size": "3... |
"""
Copyright 2017 Pani Networks 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.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | {
"content_hash": "e8d2fe161fcf4861f7058faad3034c30",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 75,
"avg_line_length": 32.083333333333336,
"alnum_prop": 0.6064935064935065,
"repo_name": "romana/vpc-router",
"id": "24785a007acbf290d91cdd16b7683da21ecad9e4",
"size": "23... |
import sys
import os
import iopc
import ops
import pprint
def buildModule(pkg_enabled, pkg_name, pkg_args, local_repo_path, output_path):
if pkg_enabled == 1:
print "===Env===[" + pkg_name + "]"
ops.mkdir(output_path)
if(os.path.exists(local_repo_path)):
build_pkg = None
... | {
"content_hash": "88691b9e7a58a482b5e2093d38ab32be",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 120,
"avg_line_length": 38.80952380952381,
"alnum_prop": 0.6110429447852761,
"repo_name": "YuanYuLin/PackMan_IOPC",
"id": "675b713bdb9c44289303cf546aa4897e49fd90bd",
"size"... |
import fnmatch
import os
import sys
import codecs
def process_file(path):
with open(path, 'rt') as file:
content = file.read()
file.close();
if(content.startswith(codecs.BOM_UTF8)):
with open(path, 'wt') as file:
file.write(content[len(codecs.BOM_UTF8):]);
... | {
"content_hash": "6a3f25b1d4905f188246ad083743820f",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 64,
"avg_line_length": 30.428571428571427,
"alnum_prop": 0.5993740219092332,
"repo_name": "dava/dava.engine",
"id": "7bdad2bd4a072a85b8179863e38b570a382a8b01",
"size": "662... |
from test_framework.mininode import *
from test_framework.test_framework import moorecointestframework
from test_framework.util import *
import logging
'''
in this test we connect to one node over p2p, send it numerous inv's, and
compare the resulting number of getdata requests to a max allowed value. we
test for exc... | {
"content_hash": "e152bad243e2c9e0f598d45a7cdfbb4c",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 114,
"avg_line_length": 40.38947368421053,
"alnum_prop": 0.5882199635131613,
"repo_name": "moorecoin/MooreCoinMiningAlgorithm",
"id": "b88200c12da7470781825c43b479127a727229b... |
"""
Copyright 2018 ARM Limited
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, software
dis... | {
"content_hash": "bd23f6c58c06f29cd3208e28d08fa203",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 147,
"avg_line_length": 43,
"alnum_prop": 0.5651601579640193,
"repo_name": "andcor02/mbed-os",
"id": "49cee2ff1e3184555dd10ca31603e91cfd580f00",
"size": "4558",
"binary"... |
import threading
from scapy.all import *
import subprocess as sp
import Queue
import time
class Sniffer(threading.Thread):
def __init__(self, queue, *args, **kwargs):
threading.Thread.__init__(self, *args, **kwargs)
self.__queue = queue
sp.Popen(['hostapd', '/etc/hostapd/hostapd.conf'])
... | {
"content_hash": "ce445c3c182abfe2adeba15a3542d80c",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 63,
"avg_line_length": 29.4375,
"alnum_prop": 0.6157112526539278,
"repo_name": "zdavidli/HomeHoneypot",
"id": "7e60f4dff109864a198f6841b5055900935eae01",
"size": "494",
"... |
from django.core.exceptions import PermissionDenied, ImproperlyConfigured
from mellow.roles import Role
def minimum_role_required(role):
def _minimum_role_required(view_func):
def wrapped_view_func(request, *args, **kwargs):
# Ensure that the user is authenticated
if not request.u... | {
"content_hash": "dc28010d473ba94f287f920103f80b98",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 120,
"avg_line_length": 32.1764705882353,
"alnum_prop": 0.6489945155393053,
"repo_name": "flagshipenterprise/django-mellow-auth",
"id": "570b736066c03438163fe1515b105d153c313... |
import contextlib
@contextlib.contextmanager
def nested(*contexts):
with contextlib.ExitStack() as stack:
yield [stack.enter_context(c) for c in contexts]
| {
"content_hash": "b5bb3b160cc18eb19fc5ed17dbc863ea",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 56,
"avg_line_length": 24.142857142857142,
"alnum_prop": 0.7337278106508875,
"repo_name": "openstack/oslo.db",
"id": "47cf511727062724e08d4fd34739f4f9995b2007",
"size": "810... |
"""
An example plugin for Spock
Demonstrates the following functionality:
- Receiving chat messages
- Sending chat commands
- Using inventory
- Moving to location
- Triggering a periodic event using a timer
- Registering for an event upon startup
- Placing blocks
- Reading blocks
"""
__author__ = 'Cosmo Harrigan, Mor... | {
"content_hash": "db9f3da015f392eac630a125bc32f3fa",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 78,
"avg_line_length": 35.18269230769231,
"alnum_prop": 0.6381525006832468,
"repo_name": "MrSwiss/SpockBot",
"id": "4106fdba8bd41588d07ace8a6054fafcd148d52d",
"size": "365... |
#!/usr/bin/env python
import sys
import os
from heapq import heappush, heappop
from collections import defaultdict
filenames = sys.argv[1:]
if len(filenames) == 0:
print "-- Huffman encoding generation tool -- "
print "Usage: ./HuffGen.py file1.txt file2.txt file3.txt ..."
sys.exit(1)
hist = defaultdict(int)
... | {
"content_hash": "deaa7d5d1fb64a337c424c49ccbb271f",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 141,
"avg_line_length": 34.142857142857146,
"alnum_prop": 0.6422594142259415,
"repo_name": "adrfer/swift",
"id": "5e0cadc6bcd0c6b0770a25c357534cbcaa37deb3",
"size": "4780"... |
import _plotly_utils.basevalidators
class OutliercolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="outliercolor", parent_name="violin.marker", **kwargs
):
super(OutliercolorValidator, self).__init__(
plotly_name=plotly_name,
p... | {
"content_hash": "75510ff9638d8d54079c532292fe6f9f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 79,
"avg_line_length": 33.23076923076923,
"alnum_prop": 0.6180555555555556,
"repo_name": "plotly/plotly.py",
"id": "3ffa778f15a382f8ec069ec7a29f9b8ffd90e108",
"size": "432"... |
from __future__ import print_function
import sys
import os
import re
import cv2
import numpy as np
class IkaUtils(object):
@staticmethod
def isWindows():
try:
os.uname()
except AttributeError:
return True
return False
@staticmethod
def dprint(text):
... | {
"content_hash": "3b9226b7fe285579338fe29f82823037",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 84,
"avg_line_length": 29.01360544217687,
"alnum_prop": 0.564126611957796,
"repo_name": "mzsm/IkaLog",
"id": "0914c79046b5043e34d3fbb8de81b57ed24c6979",
"size": "4978",
... |
"""
ServiceType module
"""
from ovs.dal.dataobject import DataObject
from ovs.dal.structures import Property
class ServiceType(DataObject):
"""
A ServiceType represents some kind of service that needs to be managed by the framework.
"""
__properties = [Property('name', str, doc='Name of the ServiceTyp... | {
"content_hash": "20e6bad9553cc75c3e4e79b2310ff01f",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 92,
"avg_line_length": 26.214285714285715,
"alnum_prop": 0.6839237057220708,
"repo_name": "sql-analytics/openvstorage",
"id": "4ee54c2cb2e3bcadbbf70264b175310bf1886be2",
"s... |
class Solution(object):
def findSubsequences(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
def findSubsequencesHelper(nums, pos, seq, result):
if len(seq) >= 2:
result.append(list(seq))
lookup = set()
fo... | {
"content_hash": "b82f42cebec2d8e8491683a15e00ab33",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 66,
"avg_line_length": 34.857142857142854,
"alnum_prop": 0.4685792349726776,
"repo_name": "kamyu104/LeetCode",
"id": "c546bf9d13ad8a33bbd5b65d81d5c77989283ed8",
"size": "14... |
""" Defines the UStr type and HasUniqueStrings mixin class for efficiently
creating lists of objects containing traits whose string values must be
unique within the list.
"""
#-------------------------------------------------------------------------------
# Imports:
#------------------------------------------... | {
"content_hash": "1761d7d58f01285ac5075f2f59037cfb",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 80,
"avg_line_length": 35.98757763975155,
"alnum_prop": 0.49309630652399034,
"repo_name": "burnpanck/traits",
"id": "970aada5ea8a5c490930d5a0ed2c7bcb17d8349e",
"size": "64... |
class ActiveSliceItemController(object):
def __init__(self, active_slice_item, model_part):
self._active_slice_item = active_slice_item
self._model_part = model_part
self.connectSignals()
def connectSignals(self):
a_s_i = self._active_slice_item
m_p = self._model_part
... | {
"content_hash": "1dc1b26a16a8bdf131675a5cc9abdf7b",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 72,
"avg_line_length": 37.125,
"alnum_prop": 0.6835016835016835,
"repo_name": "JMMolenaar/cadnano2.5",
"id": "36e14b2fef65135cba5b37e4df8d7f68f8dd22fb",
"size": "891",
"b... |
from unittest import TestCase
import simplejson as json
from app.storage.storage_encryption import StorageEncryption
# pylint: disable=W0212
class TestStorageEncryption(TestCase):
def setUp(self):
super().setUp()
self.encrypter = StorageEncryption('user_id', 'user_ik', 'pepper')
def test_en... | {
"content_hash": "bc434b4695db008e911b39ff5f3f7402",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 78,
"avg_line_length": 39.90163934426229,
"alnum_prop": 0.637633525061627,
"repo_name": "ONSdigital/eq-survey-runner",
"id": "d8a2893b115ffd6a31ada54d2875ed9f9f619e98",
"si... |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'boilerplate.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.si... | {
"content_hash": "2c2e26bb7613c772657c32402f3317e0",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 67,
"avg_line_length": 31.555555555555557,
"alnum_prop": 0.6461267605633803,
"repo_name": "vellonce/django1.6-bootstrap",
"id": "fffef42d5859e4e037b470c4e5a06cfda0d81d4a",
... |
import errno
import os
import shutil
import struct
from binascii import hexlify, unhexlify
from collections import defaultdict
from configparser import ConfigParser
from datetime import datetime
from functools import partial
from itertools import islice
import msgpack
from .constants import * # NOQA
from .hashindex ... | {
"content_hash": "20c1a5c66bb6cd7c4bf7527198c5e886",
"timestamp": "",
"source": "github",
"line_count": 1417,
"max_line_length": 135,
"avg_line_length": 47.91037402964008,
"alnum_prop": 0.5914802103433546,
"repo_name": "edgewood/borg",
"id": "f73e9cf54c9d29ca1072783b9476bd95c10953e6",
"size": "6788... |
import os
from asyncio import ensure_future
from aiopg.sa import create_engine
from sqlalchemy import (
Column,
Integer,
MetaData,
String,
Table,
)
from urllib import parse
# postgres is not a standard urllib.parse URL
parse.uses_netloc.append("postgres")
metadata = MetaData()
player_stats = Table... | {
"content_hash": "826d8b9073ecf74cf7bd340b47af2271",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 117,
"avg_line_length": 27.633333333333333,
"alnum_prop": 0.6550060313630881,
"repo_name": "philkjacobs/superlatives",
"id": "4a21aaa9bcf7f814d085fc8bb7e0a9514be1fc75",
"si... |
import os
import unittest
import archinfo
import ailment
import angr
from angr.analyses.decompiler.peephole_optimizations import ConstantDereferences
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')
class TestPeepholeOptimizations(unittest.TestCase):
def... | {
"content_hash": "5691288783a49ba3e7ac6784a1d1bd39",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 119,
"avg_line_length": 39.432432432432435,
"alnum_prop": 0.6641535298149417,
"repo_name": "angr/angr",
"id": "4275177baedf41f1ab31ef0704dfda58eb058f5e",
"size": "1512",
... |
"""Helpers for LCN component."""
from __future__ import annotations
import asyncio
from copy import deepcopy
from itertools import chain
import re
from typing import Tuple, Type, Union, cast
import pypck
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
... | {
"content_hash": "85d5752951debb14156c19f587a84203",
"timestamp": "",
"source": "github",
"line_count": 399,
"max_line_length": 93,
"avg_line_length": 33.090225563909776,
"alnum_prop": 0.5966068317806559,
"repo_name": "jawilson/home-assistant",
"id": "b879c2d3f725b48f1fc7fb0b712a453878e665e7",
"siz... |
from __future__ import unicode_literals
from django.utils.translation import ugettext as _
from ..constants import Frequency
from ..constants import Day
# TODO: would like to implement the commented out choices below. See:
# https://github.com/infoagetech/django-recurrence/issues/1
FREQUENCY_CHOICES = (
(Frequen... | {
"content_hash": "2e8dd48abc5451d78a24fd8c45361cfd",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 69,
"avg_line_length": 32,
"alnum_prop": 0.626008064516129,
"repo_name": "InfoAgeTech/django-recurrences",
"id": "52a550355bf1df32fdf2069374573b7bd26207ab",
"size": "992",
... |
import matplotlib.pyplot as plt
import numpy as np
def gen_data(n, start=0, end=10):
x = np.linspace(start, end, n)
y = np.sin(10*x) - x*x
return y
def gen_data_osc(n):
return np.array([1024 + (-2)**(-i/100) for i in range(n)])
def gen_data_rand(n):
return np.random.randn(n) + 0.3*np.... | {
"content_hash": "b7ded47bd87b9373bb26b0862c59b3f0",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 126,
"avg_line_length": 30.43089430894309,
"alnum_prop": 0.6246326476088699,
"repo_name": "Raphael-C-Almeida/Wireless-Sensor-Network",
"id": "63a0f9990b68a3bf75e0260c6761a7a... |
"""
giraffe-facts.py: process a GAM file from the new minimizer-based mapper (vg giraffe) and report runtime statistics by filter.
"""
import argparse
import os
import sys
import time
import subprocess
import collections
import io
import itertools
import json
import random
import math
# Force output to UTF-8. Eventua... | {
"content_hash": "adb41317284a37bd4ea70b1327600924",
"timestamp": "",
"source": "github",
"line_count": 927,
"max_line_length": 207,
"avg_line_length": 38.47033441208198,
"alnum_prop": 0.5875161236049576,
"repo_name": "ekg/vg",
"id": "312137731451c60f786bd3a92f9e4f21a792aa2f",
"size": "35712",
"b... |
import pytest
from polyaxon import settings
from polyaxon.proxies.schemas.gateway import get_base_config
from polyaxon.utils.test_utils import BaseTestCase
@pytest.mark.proxies_mark
class TestGatewayBase(BaseTestCase):
SET_PROXIES_SETTINGS = True
def test_gateway_base_config(self):
expected = r"""
l... | {
"content_hash": "d583e1c8119c65c1a16a2399018deb23",
"timestamp": "",
"source": "github",
"line_count": 459,
"max_line_length": 102,
"avg_line_length": 28.84095860566449,
"alnum_prop": 0.6555370901948935,
"repo_name": "polyaxon/polyaxon",
"id": "61955ab8b8483898f4ec31c426af68d8f6be5a9c",
"size": "1... |
import logging
from settings import *
from time import sleep
from request.queue import StopRequestQueue
from app.component.modifier.blinker import blinker_pool
from board import States
logger = logging.getLogger(__name__)
class Program:
board = None
scheduler = None
service = None
queue = None
def __init... | {
"content_hash": "7da3f61c52a29a96e121ff13592ae9f9",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 118,
"avg_line_length": 32.70175438596491,
"alnum_prop": 0.6925965665236051,
"repo_name": "infrared5/massroute-pi",
"id": "e6007ad9aa373decee9518881416beb7ce718412",
"size"... |
import sys
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFo... | {
"content_hash": "64b8d624d6d6b78c6c66d4a8e67cb849",
"timestamp": "",
"source": "github",
"line_count": 656,
"max_line_length": 201,
"avg_line_length": 44.17530487804878,
"alnum_prop": 0.6409814003243728,
"repo_name": "Azure/azure-sdk-for-python",
"id": "d1a8ca104afea8cf07db7da6c1c7229a0c805e97",
"... |
'''Wrapper for pulse
Generated with:
tools/genwrappers.py pulseaudio
Do not modify this file.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import ctypes
from ctypes import *
import pyglet.lib
_lib = pyglet.lib.load_library('pulse')
_int_types = (c_int16, c_int32)
if hasattr(ctypes, 'c_int64'):
... | {
"content_hash": "cd051d5b3ee4b30ae58b89932f8dc7f4",
"timestamp": "",
"source": "github",
"line_count": 2950,
"max_line_length": 168,
"avg_line_length": 40.10677966101695,
"alnum_prop": 0.7162828043781431,
"repo_name": "nicememory/pie",
"id": "73ca198d321b61b8368d93acd466c91e38e2f4ce",
"size": "118... |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
import logging
try:
import queue
except ImportError:
import Queue as queue
from sleekxmpp.xmlstream import StanzaBase, RESPONSE_TIMEOUT... | {
"content_hash": "eba711aa836196af649d2f57f57177c9",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 70,
"avg_line_length": 27.752475247524753,
"alnum_prop": 0.6036389582590082,
"repo_name": "skinkie/SleekXMPP--XEP-0080-",
"id": "a4bc3545ae6c231ab5be3140efae5d9f64fd5bff",
... |
'''
A script to test quicksort, mergesort and bogosort
'''
import random
import quicksort
import mergesort
import bogosort
from sys import argv
data=[i for i in range(int(argv[-1]))]
random.shuffle(data)
if argv[-2]=='q':
quicksort.quicksort(data)
elif argv[-2]=='m':
mergesort.mergesort(data)
elif argv[-2]=... | {
"content_hash": "2eace303489b078ef8ce4450613aed90",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 50,
"avg_line_length": 17.7,
"alnum_prop": 0.7005649717514124,
"repo_name": "Bolt64/my_code",
"id": "a53fb06311289c771413c3a77c233954dc9515cd",
"size": "374",
"binary": f... |
def is_simple_node(graph, node):
"""A node is "Simple" if none of the following is true
- it has multiple inputs (it joins chains together)
- it has no inputs (it's a root node)
- it has multiple outputs (it splits chains apart)
- it has no outputs (it's a leaf node)
Keyword arguments:
node... | {
"content_hash": "59d0006d1488c9f90a928d2849efddb1",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 69,
"avg_line_length": 27.322580645161292,
"alnum_prop": 0.6080283353010626,
"repo_name": "musec/py-cdg",
"id": "e98e72cf0f8889926f2a60cf3d3e0e31b5eee70e",
"size": "1742",
... |
"""test_args module contains test for input arguments.
It checks if input argument passed by user is valid or not.
If any invalid data is found,
the called function in test_args returns false"""
import numpy as np
from . import pose
from . import super_pose
def is_mat_list(list_matrices):
"""is_mat_list checks(ar... | {
"content_hash": "816276364638924de740889df3c9649e",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 89,
"avg_line_length": 27.01219512195122,
"alnum_prop": 0.5471783295711061,
"repo_name": "adityadua24/robopy",
"id": "2511fa18ce37d9b4674d6fc13636c019214d9ded",
"size": "4... |
from django.conf.urls import include, url
from django.contrib import admin
from jsframework import urls as js_urls
urlpatterns = [
# Examples:
# url(r'^$', 'django_drf_starter_project.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^exercise/', include('exercise_customization... | {
"content_hash": "1da0e6d58bce22985d0fcf9921e0f18b",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 72,
"avg_line_length": 32.8,
"alnum_prop": 0.6686991869918699,
"repo_name": "itsClay/Exercise-Customization-Database",
"id": "6d046abe2669919de0f6d82f10780d6b86bfccae",
"si... |
from __future__ import print_function, unicode_literals
from future.builtins import input, int
from optparse import make_option
try:
from urllib.parse import urlparse
except:
from urlparse import urlparse
from django.contrib.auth import get_user_model
from django.contrib.redirects.models import Redirect
from d... | {
"content_hash": "5f87816c478a0b0c364142c0e12ad5a1",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 79,
"avg_line_length": 40.825278810408925,
"alnum_prop": 0.562921143689674,
"repo_name": "gladgod/zhiliao",
"id": "02cc6257d78840b30e5ad8d347ee3965117528f2",
"size": "1098... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.