text stringlengths 0 1.05M | meta dict |
|---|---|
"""Base configuration implementation."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2018 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use ... | {
"repo_name": "wackerly/faucet",
"path": "faucet/conf.py",
"copies": "1",
"size": "5573",
"license": "apache-2.0",
"hash": -314875595044324540,
"line_mean": 36.6554054054,
"line_max": 112,
"alpha_frac": 0.6036246187,
"autogenerated": false,
"ratio": 3.963726884779516,
"config_test": true,
"ha... |
'''Base configurations for tests'''
import os
import pytest
import bs4 as bs
import subprocess
import sys
sys.path.insert(0, 'generator')
import webpageGenerator as gen
@pytest.fixture(scope="session")
def sitemap_name():
return 'sitemap.xml'
@pytest.fixture(scope="session")
def root_directory():
return su... | {
"repo_name": "jmwerner/recipes",
"path": "tests/conftest.py",
"copies": "1",
"size": "7927",
"license": "mit",
"hash": 6845434906230842000,
"line_mean": 37.2946859903,
"line_max": 134,
"alpha_frac": 0.6076204895,
"autogenerated": false,
"ratio": 3.6694444444444443,
"config_test": true,
"has_... |
"""Base contract for lite layers implementation."""
# TODO(petrux): consider about getting rid of the Layer super class.
# Such class is extremely useful when dealing with unpacked/unstacked
# tensors, but since the tensor array and symbolic looping ops are now
# alive an' kickin' in TF, there is no need anymore ... | {
"repo_name": "petrux/LiTeFlow",
"path": "liteflow/layers.py",
"copies": "1",
"size": "38826",
"license": "apache-2.0",
"hash": -4852741000548363000,
"line_mean": 42.8711864407,
"line_max": 107,
"alpha_frac": 0.6407561943,
"autogenerated": false,
"ratio": 4.2483860378597225,
"config_test": fals... |
"""Base controller(s) which take in a dictionary and return a model."""
from flask import request, session
from peanuts.lib.database import db
__all__ = ['BaseController', 'BaseRestController']
class BaseController(object):
"""A base controller class with some utility functions."""
def __init__(self):
... | {
"repo_name": "astex/peanuts",
"path": "peanuts/controllers/base.py",
"copies": "1",
"size": "1821",
"license": "mit",
"hash": 7864501724481555000,
"line_mean": 27.9047619048,
"line_max": 77,
"alpha_frac": 0.6051619989,
"autogenerated": false,
"ratio": 4.0198675496688745,
"config_test": false,
... |
''' Base Converter class and utilities. '''
from abc import ABCMeta, abstractmethod, abstractproperty
import inspect
from pliers.transformers import Transformer
from pliers.utils import listify, EnvironmentKeyMixin
from pliers import config
import pliers
class Converter(Transformer, metaclass=ABCMeta):
''' Bas... | {
"repo_name": "tyarkoni/featureX",
"path": "pliers/converters/base.py",
"copies": "2",
"size": "1990",
"license": "bsd-3-clause",
"hash": 7425672573311028000,
"line_mean": 30.5873015873,
"line_max": 78,
"alpha_frac": 0.656281407,
"autogenerated": false,
"ratio": 4.225053078556264,
"config_test"... |
" base.core "
from flask import request, current_app
from flask_mail import Message
from logging import Handler, ERROR
from ..ext import mail
def loader_meta(app=None):
" Configure application. "
from .views import core
app.register_blueprint(core)
from .ext import admin
admin.init_app(app)
... | {
"repo_name": "klen/fquest",
"path": "base/core/__init__.py",
"copies": "2",
"size": "1040",
"license": "bsd-3-clause",
"hash": -413720246413729500,
"line_mean": 23.7619047619,
"line_max": 86,
"alpha_frac": 0.6807692308,
"autogenerated": false,
"ratio": 3.611111111111111,
"config_test": false,
... |
"""Base core views."""
from django.contrib.auth import mixins as auth_mixins
from django.urls import reverse
from django.utils.http import is_safe_url
from django.views import generic
from ..extensions import exts_pool
def find_nextlocation(request, user):
"""Find next location for given user after login."""
... | {
"repo_name": "modoboa/modoboa",
"path": "modoboa/core/views/base.py",
"copies": "1",
"size": "1355",
"license": "isc",
"hash": 7794140998071429000,
"line_mean": 32.0487804878,
"line_max": 77,
"alpha_frac": 0.6686346863,
"autogenerated": false,
"ratio": 4.081325301204819,
"config_test": false,
... |
"""Base core views."""
from django.core.urlresolvers import reverse
from django.views import generic
from django.contrib.auth import mixins as auth_mixins
from ..extensions import exts_pool
def find_nextlocation(request, user):
"""Find next location for given user after login."""
if not user.last_login:
... | {
"repo_name": "carragom/modoboa",
"path": "modoboa/core/views/base.py",
"copies": "1",
"size": "1254",
"license": "isc",
"hash": -8543824151505805000,
"line_mean": 33.8333333333,
"line_max": 77,
"alpha_frac": 0.6547049442,
"autogenerated": false,
"ratio": 4.250847457627119,
"config_test": false... |
"""Base core views."""
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.views import generic
from django.contrib.auth import mixins as auth_mixins
from ..extensions import exts_pool
def find_nextlocation(request, user):
"""Find next location for given user after... | {
"repo_name": "bearstech/modoboa",
"path": "modoboa/core/views/base.py",
"copies": "1",
"size": "1295",
"license": "isc",
"hash": 328090935473556540,
"line_mean": 33.0789473684,
"line_max": 77,
"alpha_frac": 0.6579150579,
"autogenerated": false,
"ratio": 4.245901639344262,
"config_test": false,... |
""" Base cross-quantity estimators. """
from scipy.special import psi
from numpy import mean, log
from ite.cost.x_initialization import InitKnnK
from ite.cost.x_verification import VerEqualDSubspaces
from ite.shared import volume_of_the_unit_ball, knn_distances
class BCCE_KnnK(InitKnnK, VerEqualDSubspaces):
"""... | {
"repo_name": "gdikov/vae-playground",
"path": "third_party/ite/cost/base_c.py",
"copies": "1",
"size": "2026",
"license": "mit",
"hash": 1884364153069564000,
"line_mean": 29.696969697,
"line_max": 72,
"alpha_frac": 0.5671273445,
"autogenerated": false,
"ratio": 3.617857142857143,
"config_test"... |
"""Base daemon process."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from daemons.daemonize import simple as simple_daemonize
from daemons.interfaces import message
from daemons.pid import simple as simple_pid
f... | {
"repo_name": "kevinconway/PyPerf",
"path": "pyperf/daemons/base.py",
"copies": "1",
"size": "1587",
"license": "apache-2.0",
"hash": 1848360939758145800,
"line_mean": 34.2666666667,
"line_max": 64,
"alpha_frac": 0.6855702583,
"autogenerated": false,
"ratio": 4.408333333333333,
"config_test": f... |
# based and modified from
# https://github.com/micropython/micropython-lib/tree/master/upysh
# mods: ulno
import sys
import os
class LS:
def __repr__(self):
self.__call__()
return ""
def __call__(self, path="."):
l = os.listdir(path)
l.sort()
for f in l:
... | {
"repo_name": "ulno/micropython-extra-ulno",
"path": "lib/node_types/esp8266/freeze/uiot/sh.py",
"copies": "1",
"size": "1631",
"license": "mit",
"hash": 8508965323262356000,
"line_mean": 16.9230769231,
"line_max": 71,
"alpha_frac": 0.4904966278,
"autogenerated": false,
"ratio": 3.083175803402646... |
"""Base DashboardWidget of the dashboard_app."""
from django.utils.timezone import now
from . import models
class DashboardWidgetBase(object):
"""All DashboardWidgets must inherit this base class."""
update_interval = 1
template_name = 'dashboard_app/partials/widget.html'
def __init__(self, **kwargs... | {
"repo_name": "bitmazk/django-dashboard-app",
"path": "dashboard_app/widget_base.py",
"copies": "1",
"size": "3926",
"license": "mit",
"hash": -9082382821737483000,
"line_mean": 31.4462809917,
"line_max": 77,
"alpha_frac": 0.6136016302,
"autogenerated": false,
"ratio": 4.640661938534279,
"confi... |
"""Base DashboardWidget of the ``django-metrics-dashboard`` app."""
from django.utils.translation import ugettext_lazy as _
from django.utils.timezone import datetime, now
from metrics_dashboard.models import DashboardWidgetSettings
class DashboardWidgetBase(object):
"""All DashboardWidgets must inherit this bas... | {
"repo_name": "bitmazk/django-metrics-dashboard",
"path": "metrics_dashboard/widget_base.py",
"copies": "1",
"size": "2978",
"license": "mit",
"hash": 174173281107804300,
"line_mean": 29.7010309278,
"line_max": 79,
"alpha_frac": 0.5852921424,
"autogenerated": false,
"ratio": 4.4183976261127595,
... |
"""Base database object support."""
from table import Record
class Database(object):
entry_class = None
table_map = None
def __init__(self):
self.tables = {}
def lookup(self, root_table_name, entry_id):
"""Creates an entry object.
Finds a record based upon ... | {
"repo_name": "Paludis/jblite",
"path": "jblite/db.py",
"copies": "1",
"size": "1937",
"license": "bsd-2-clause",
"hash": 3165004192783264000,
"line_mean": 32.5892857143,
"line_max": 73,
"alpha_frac": 0.561177078,
"autogenerated": false,
"ratio": 4.382352941176471,
"config_test": false,
"has_... |
"""``base_data_collector`` is the base class for the ``collect_*_data``
addins.
Most of it's funtionality is already ensured to be working by the tests
for those other addins, but we want to specifically test some scenarios
here that are relevant for people writing custom addins based on it.
"""
import dateti... | {
"repo_name": "miracle2k/feedplatform",
"path": "tests/lib/feeds/test_base_data_collector.py",
"copies": "1",
"size": "2218",
"license": "bsd-2-clause",
"hash": 6587345295042505000,
"line_mean": 31.6363636364,
"line_max": 85,
"alpha_frac": 0.6370604148,
"autogenerated": false,
"ratio": 4.08471454... |
"""Base datasets functionality."""
# Authors: Kyle Kastner
# Michael Eickenberg
# License: BSD 3 Clause
import os
import numpy as np
from PIL import Image
from sklearn.datasets.base import Bunch
try:
import urllib.request as urllib # for backwards compatibility
except ImportError:
import urllib2 as u... | {
"repo_name": "sklearn-theano/sklearn-theano",
"path": "sklearn_theano/datasets/base.py",
"copies": "1",
"size": "4476",
"license": "bsd-3-clause",
"hash": 3820148503775119000,
"line_mean": 30.7446808511,
"line_max": 79,
"alpha_frac": 0.5978552279,
"autogenerated": false,
"ratio": 3.9057591623036... |
''' Base datastore class for Automatron '''
class BaseDatastore(object):
''' Base class for Runbook datastore plugins to import '''
def __init__(self, config=None):
''' Initialize the database class '''
self.config = config
self.dbc = None
def connect(self):
''' Connect to... | {
"repo_name": "madflojo/automatron",
"path": "core/db.py",
"copies": "1",
"size": "1896",
"license": "apache-2.0",
"hash": -7836524182225761000,
"line_mean": 24.9726027397,
"line_max": 83,
"alpha_frac": 0.539556962,
"autogenerated": false,
"ratio": 4.503562945368171,
"config_test": true,
"has... |
"""Base datastore model class for an authenticated account.
"""
from google.cloud import ndb
from .webutil import models, util
class BaseAuth(models.StringIdModel):
"""Datastore base model class for an authenticated user.
Provides methods that return information about this user and make OAuth-signed
requests ... | {
"repo_name": "snarfed/oauth-dropins",
"path": "oauth_dropins/models.py",
"copies": "1",
"size": "4093",
"license": "unlicense",
"hash": 2031558906183037200,
"line_mean": 31.4841269841,
"line_max": 80,
"alpha_frac": 0.6884925483,
"autogenerated": false,
"ratio": 4.101202404809619,
"config_test"... |
"""Base datastore model class for an authenticated account.
"""
import logging
import urllib2
import appengine_config
import handlers
from webutil import models
from webutil import util
from google.appengine.ext import ndb
class BaseAuth(models.StringIdModel):
"""Datastore base model class for an authenticated u... | {
"repo_name": "kylewm/oauth-dropins",
"path": "models.py",
"copies": "1",
"size": "3341",
"license": "unlicense",
"hash": -7971854429252523000,
"line_mean": 29.9351851852,
"line_max": 80,
"alpha_frac": 0.6961987429,
"autogenerated": false,
"ratio": 3.991636798088411,
"config_test": false,
"ha... |
"""Base datastore models and queries for beardo-control
"""
# future imports
from __future__ import absolute_import
# stdlib imports
import logging
# third-party imports
from google.appengine.datastore.datastore_query import Cursor
from google.appengine.ext import ndb
class BaseModel(ndb.Model):
"""Common data/... | {
"repo_name": "paddycarey/beardo-control",
"path": "app/app/models/base.py",
"copies": "1",
"size": "2607",
"license": "mit",
"hash": 399322200354788100,
"line_mean": 32.4230769231,
"line_max": 118,
"alpha_frac": 0.6616800921,
"autogenerated": false,
"ratio": 3.6770098730606486,
"config_test": ... |
"""Base datastore models and queries
"""
# future imports
from __future__ import absolute_import
# stdlib imports
import datetime
import logging
from collections import OrderedDict
from uuid import uuid4
# third-party imports
from google.appengine.api import memcache
from google.appengine.ext import ndb
# local impo... | {
"repo_name": "mjmcconnell/sra",
"path": "src-server/app/models/base.py",
"copies": "1",
"size": "6598",
"license": "apache-2.0",
"hash": -2812527829535127000,
"line_mean": 29.4055299539,
"line_max": 78,
"alpha_frac": 0.5756289785,
"autogenerated": false,
"ratio": 4.287199480181936,
"config_tes... |
"""Base Datastore module."""
class Datastore(object):
"""A Datastore represents storage for any key-value pair.
Datastores are general enough to be backed by all kinds of different storage:
in-memory caches, databases, a remote datastore, flat files on disk, etc.
The general idea is to wrap a more c... | {
"repo_name": "alexandonian/ptutils",
"path": "ptutils/datastore/base.py",
"copies": "1",
"size": "5657",
"license": "mit",
"hash": -6432159965380454000,
"line_mean": 27.4271356784,
"line_max": 82,
"alpha_frac": 0.6056213541,
"autogenerated": false,
"ratio": 4.86414445399828,
"config_test": fal... |
"""Base datastructures for manipulated images."""
from PIL import Image
from django.core.files.uploadedfile import InMemoryUploadedFile
from ..settings import QUAL, VERSATILEIMAGEFIELD_PROGRESSIVE_JPEG
from ..utils import get_image_metadata_from_file
EXIF_ORIENTATION_KEY = 274
class ProcessedImage(object):
"""... | {
"repo_name": "respondcreate/django-versatileimagefield",
"path": "versatileimagefield/datastructures/base.py",
"copies": "2",
"size": "6091",
"license": "mit",
"hash": 1579608548714839800,
"line_mean": 34.8294117647,
"line_max": 77,
"alpha_frac": 0.5818420621,
"autogenerated": false,
"ratio": 4.... |
"""Base data structures for the SDK."""
class RecordCollection(object):
"""
Class for handling query records.
Attributes:
records (list of :class:`Record <helios.core.structure.Record>`):
Raw record data for debugging purposes.
"""
def __init__(self, records=None):
s... | {
"repo_name": "harris-helios/helios-sdk-python",
"path": "helios/core/structure.py",
"copies": "1",
"size": "2867",
"license": "mit",
"hash": -1451432667095118000,
"line_mean": 26.3047619048,
"line_max": 79,
"alpha_frac": 0.599581444,
"autogenerated": false,
"ratio": 4.472698907956318,
"config_... |
"""Base DebugPanel class"""
class DebugPanel(object):
"""
Base class for debug panels.
"""
# name = Base
has_content = False # If content returns something, set to true in subclass
# If the client is able to activate/de-activate the panel
user_enable = False
# We'll maintain a local ... | {
"repo_name": "dcifuen/cloudbday",
"path": "src/lib/flask_debugtoolbar/panels/__init__.py",
"copies": "17",
"size": "1521",
"license": "mit",
"hash": -2213491119057082400,
"line_mean": 23.9344262295,
"line_max": 79,
"alpha_frac": 0.6272189349,
"autogenerated": false,
"ratio": 4.473529411764706,
... |
"""Base DebugPanel class"""
class DebugPanel(object):
"""
Base class for debug panels.
"""
# name = Base
has_content = False # If content returns something, set to true in subclass
# If the client is able to activate/de-activate the panel
user_enable = False
# We'll maintain a local... | {
"repo_name": "Jumpscale/web",
"path": "pythonlib/flask_debugtoolbar/panels/__init__.py",
"copies": "3",
"size": "1520",
"license": "apache-2.0",
"hash": 5222929788520488000,
"line_mean": 24.7627118644,
"line_max": 80,
"alpha_frac": 0.6276315789,
"autogenerated": false,
"ratio": 4.457478005865102... |
"""Base DebugPanel class"""
class DebugPanel(object):
"""
Base class for debug panels.
"""
# name = Base
# If content returns something, set to true in subclass
has_content = False
# If the client is able to activate/de-activate the panel
user_enable = False
# We'll maintain a l... | {
"repo_name": "bcarroll/authmgr",
"path": "python-3.6.2-Win64/Lib/site-packages/flask_debugtoolbar/panels/__init__.py",
"copies": "4",
"size": "1524",
"license": "bsd-3-clause",
"hash": -1804046274432679400,
"line_mean": 23.9836065574,
"line_max": 75,
"alpha_frac": 0.625984252,
"autogenerated": fal... |
"""Base definitions for RPC."""
# pylint: disable=invalid-name
from __future__ import absolute_import
import socket
import time
import json
import errno
import struct
import random
import logging
from .._ffi.function import _init_api
from .._ffi.base import py_str
# Magic header for RPC data plane
RPC_MAGIC = 0xff2... | {
"repo_name": "mlperf/training_results_v0.6",
"path": "Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/python/tvm/rpc/base.py",
"copies": "1",
"size": "3547",
"license": "apache-2.0",
"hash": 3240152069284337700,
"line_mean": 21.0310559006,
"line_max": 79,
"alpha_frac": 0.585283338,
"a... |
"Base definitions for transports based on IP networking."
import os
import socket
import logging
from thespian.actors import ActorAddress
_localAddresses = set(['', '127.0.0.1', 'localhost', None])
def _probeAddrInfo(usage, useAddr, af, socktype, proto):
try:
return socket.getaddrinfo(useAddr, 0, af, s... | {
"repo_name": "kquick/Thespian",
"path": "thespian/system/transport/IPBase.py",
"copies": "1",
"size": "12752",
"license": "mit",
"hash": -4714366323952078000,
"line_mean": 38.602484472,
"line_max": 88,
"alpha_frac": 0.5280740276,
"autogenerated": false,
"ratio": 4.3641341546885695,
"config_tes... |
"Base definitions for transports based on IP networking."
import socket
import logging
from thespian.actors import ActorAddress
_localAddresses = set(['', '127.0.0.1', 'localhost', None])
def _probeAddrInfo(usage, useAddr, af, socktype, proto):
try:
return socket.getaddrinfo(useAddr, 0, af, socktype, ... | {
"repo_name": "godaddy/Thespian",
"path": "thespian/system/transport/IPBase.py",
"copies": "1",
"size": "11817",
"license": "mit",
"hash": -6214706941043138000,
"line_mean": 38.1291390728,
"line_max": 88,
"alpha_frac": 0.5308453922,
"autogenerated": false,
"ratio": 4.362126245847176,
"config_te... |
"""Base details for the myStrom Python bindings."""
import asyncio
import json
import aiohttp
import async_timeout
from typing import Any, Mapping, Optional
import socket
from .exceptions import MyStromConnectionError, MyStromError
import pkg_resources
__version__ = pkg_resources.get_distribution("setuptools").versio... | {
"repo_name": "fabaff/python-mystrom",
"path": "pymystrom/__init__.py",
"copies": "1",
"size": "1710",
"license": "mit",
"hash": 315516738938429700,
"line_mean": 28.4827586207,
"line_max": 87,
"alpha_frac": 0.6543859649,
"autogenerated": false,
"ratio": 4.090909090909091,
"config_test": false,
... |
"""Based flow request handlers. Clients should use the individual site modules.
Example usage:
application = webapp2.WSGIApplication([
('/oauth_start', facebook.StartHandler.to('/oauth_callback')),
('/oauth_callback', facebook.CallbackHandler.to('/done')),
('/done', AuthenticatedHandler),
...
]
"""
import l... | {
"repo_name": "snarfed/oauth-dropins",
"path": "oauth_dropins/handlers.py",
"copies": "1",
"size": "7596",
"license": "unlicense",
"hash": 9079405036015586000,
"line_mean": 33.5272727273,
"line_max": 116,
"alpha_frac": 0.667983149,
"autogenerated": false,
"ratio": 3.981132075471698,
"config_tes... |
# Based from http://pythonhosted.org/setuptools/setuptools.html#automatic-script-creation
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long descr... | {
"repo_name": "TC01/calcpkg",
"path": "setup.py",
"copies": "1",
"size": "3330",
"license": "mit",
"hash": -7635503069089923000,
"line_mean": 34.8064516129,
"line_max": 95,
"alpha_frac": 0.7219219219,
"autogenerated": false,
"ratio": 3.479623824451411,
"config_test": false,
"has_no_keywords":... |
import time
import HT16K33
class Matrix16x8(HT16K33.HT16K33):
"""Single color 16x8 matrix LED backpack display."""
def __init__(self, **kwargs):
"""Initialize display. All arguments will be passed to the HT16K33 class
initializer, including optional I2C address and bus number parameters.
... | {
"repo_name": "LoveBootCaptain/WeatherPi",
"path": "Modules/Driver/Matrix16x8.py",
"copies": "1",
"size": "3650",
"license": "mit",
"hash": 2780685470032540700,
"line_mean": 34.7843137255,
"line_max": 85,
"alpha_frac": 0.5476712329,
"autogenerated": false,
"ratio": 3.7590113285272913,
"config_t... |
# based heavily on
# https://twistedmatrix.com/documents/current/_downloads/emailserver.tac
# , which is MIT-licensed.
import sys
from zope.interface import implements
from twisted.internet import defer, reactor
from twisted.mail import smtp
from twisted.mail.imap4 import LOGINCredentials, PLAINCredentials
from twi... | {
"repo_name": "sandstorm-io/sandcats",
"path": "sandcats/testing_smtpd.py",
"copies": "1",
"size": "3288",
"license": "apache-2.0",
"hash": 1597611703640817200,
"line_mean": 28.0973451327,
"line_max": 80,
"alpha_frac": 0.6815693431,
"autogenerated": false,
"ratio": 4.0997506234413965,
"config_t... |
# based heavily on work from https://gist.github.com/NicolasT/4519146
from __future__ import absolute_import, division, print_function
import os
import os.path
import ctypes
import ctypes.util
def make_splice():
'''Set up a splice(2) wrapper'''
# Load libc
libc_name = ctypes.util.find_library('c')
... | {
"repo_name": "drie/aioldsplice",
"path": "aioldsplice/splice.py",
"copies": "1",
"size": "2191",
"license": "mit",
"hash": -2392743356247033000,
"line_mean": 26.3875,
"line_max": 80,
"alpha_frac": 0.6179826563,
"autogenerated": false,
"ratio": 3.0096153846153846,
"config_test": false,
"has_n... |
BASE_DIRECTORY = '/home/ryanarnold/complaints_categorizer/'
RAW_CSV_PATH = 'globals/data/raw.csv'
RAW_TRAIN_JSON_PATH = 'globals/data/raw_train.json'
RAW_DEVTEST_JSON_PATH = 'globals/data/raw_dev.json'
RAW_EVALTEST_JSON_PATH = 'globals/data/raw_eval.json'
RAW_SUB_TRAIN_JSON_PATH = 'globals/data/raw_sub_train.json'
RAW_... | {
"repo_name": "ryanarnold/complaints_categorizer",
"path": "constants.py",
"copies": "1",
"size": "2407",
"license": "mit",
"hash": -4123642249150876700,
"line_mean": 38.4590163934,
"line_max": 77,
"alpha_frac": 0.6763606149,
"autogenerated": false,
"ratio": 2.5909580193756727,
"config_test": t... |
BASE_DIR = '.' ###
DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'AUTOCOMMIT': True, 'ATOMIC_REQUESTS': False, 'NAME': './db.sqlite3', 'TEST_MIRROR': None, 'CONN_MAX_AGE': 0, 'TEST_NAME': None, 'TIME_ZONE': 'UTC', 'TEST_COLLATION': None, 'PORT': '', 'HOST': '', 'USER': '', 'TEST_CHARSET': None, 'PAS... | {
"repo_name": "fmierlo/django-default-settings",
"path": "release/1.6/diff_settings.py",
"copies": "1",
"size": "1165",
"license": "bsd-3-clause",
"hash": 2475013142601825000,
"line_mean": 82.2142857143,
"line_max": 340,
"alpha_frac": 0.7330472103,
"autogenerated": false,
"ratio": 3.5303030303030... |
""" base dispatchers
"""
from typing import Dict, Any, Callable, Iterable
class DispatchBase(object):
""" Base class for dispatcher application"""
def __init__(
self,
applications: Dict[str, Callable] = None,
extra_environ: Dict[str, Any] = None) -> None:
if appli... | {
"repo_name": "aodag/WebDispatch",
"path": "webdispatch/base.py",
"copies": "1",
"size": "2161",
"license": "mit",
"hash": 1767096910099392500,
"line_mean": 32.2461538462,
"line_max": 76,
"alpha_frac": 0.568718186,
"autogenerated": false,
"ratio": 4.40122199592668,
"config_test": false,
"has_... |
""" Base divergence estimators. """
from numpy import mean, log, absolute, sqrt, floor, sum, arange, vstack, \
dot, abs
from scipy.spatial.distance import cdist, pdist
from ite.cost.x_initialization import InitX, InitKnnK, InitKnnKiTi, \
InitKnnKAlpha, InitKnnK... | {
"repo_name": "gdikov/vae-playground",
"path": "third_party/ite/cost/base_d.py",
"copies": "1",
"size": "45726",
"license": "mit",
"hash": 2835261611757863400,
"line_mean": 33.1748878924,
"line_max": 79,
"alpha_frac": 0.5548265757,
"autogenerated": false,
"ratio": 3.4295357383934597,
"config_te... |
"""Base Django settings for Goldstone."""
# Copyright 2015 Solinea, 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... | {
"repo_name": "slashk/goldstone-server",
"path": "goldstone/settings/base.py",
"copies": "1",
"size": "13962",
"license": "apache-2.0",
"hash": 4692649638615250000,
"line_mean": 31.3194444444,
"line_max": 79,
"alpha_frac": 0.6597192379,
"autogenerated": false,
"ratio": 3.5644625989277507,
"conf... |
"""Base Django settings for ulm"""
import sys
from os.path import join, abspath, dirname
# PATH vars
# pylint: disable=C0103,W0142
here = lambda *x: join(abspath(dirname(__file__)), *x) # noqa
PROJECT_ROOT = here("..")
root = lambda *x: join(abspath(PROJECT_ROOT), *x) # noqa
sys.path.insert(0, root('apps'))
DEBU... | {
"repo_name": "dupuy/ulm",
"path": "ulm/settings/base.py",
"copies": "1",
"size": "5028",
"license": "bsd-3-clause",
"hash": 5154966447445446000,
"line_mean": 27.7314285714,
"line_max": 79,
"alpha_frac": 0.6919252188,
"autogenerated": false,
"ratio": 3.6043010752688174,
"config_test": false,
... |
# Base Django settings, suitable for production.
# Imported (and partly overridden) by developmentsettings.py which also
# imports localsettings.py (which isn't stored in svn). Buildout takes care
# of using the correct one.
# So: "DEBUG = TRUE" goes into developmentsettings.py and per-developer
# database ports go in... | {
"repo_name": "ddsc/ddsc-site",
"path": "ddsc_site/settings.py",
"copies": "1",
"size": "5749",
"license": "mit",
"hash": 7444326568069686000,
"line_mean": 31.1173184358,
"line_max": 78,
"alpha_frac": 0.7185597495,
"autogenerated": false,
"ratio": 3.4716183574879227,
"config_test": false,
"ha... |
"""Based loosely on admin filterspecs, these are more focused on delivering controls appropriate per field type
Different filter controls can be registered per field type. When assembling a set of filter controls, these field types will generate the appropriate set of fields. These controls will be based upon what is ... | {
"repo_name": "nikolajbaer/django-reportengine",
"path": "reportengine/filtercontrols.py",
"copies": "1",
"size": "3517",
"license": "bsd-3-clause",
"hash": 1673931010164683300,
"line_mean": 45.8933333333,
"line_max": 368,
"alpha_frac": 0.6986067671,
"autogenerated": false,
"ratio": 3.91648106904... |
# Based loosely on the code written by folks at Wheaton College, including:
# https://github.com/goodmanj/domecontrol
import time
from panoptes.pocs.dome import abstract_serial_dome
class Protocol:
# Status codes, produced when not responding to an input. They are oriented towards
# reporting whether the tw... | {
"repo_name": "panoptes/POCS",
"path": "src/panoptes/pocs/dome/astrohaven.py",
"copies": "1",
"size": "9414",
"license": "mit",
"hash": -8053536470278339000,
"line_mean": 42.7860465116,
"line_max": 139,
"alpha_frac": 0.6049500744,
"autogenerated": false,
"ratio": 3.9176029962546814,
"config_tes... |
BASEDN = "ou=testing,dc=example,dc=org"
ROOTDN = "cn=root,%s" % BASEDN
ROOTPW = "secret"
SLAPD_CONFIG = """\
# See slapd.conf(5) for details on configuration options.
include %(schema_dir)s/core.schema
include %(schema_dir)s/cosine.schema
include %(schema_dir)s/inetorgperson.schema
#include %(schema_dir)... | {
"repo_name": "Glottotopia/aagd",
"path": "moin/local/moin/MoinMoin/_tests/ldap_testdata.py",
"copies": "1",
"size": "2768",
"license": "mit",
"hash": -1299987037424849200,
"line_mean": 22.9369369369,
"line_max": 72,
"alpha_frac": 0.6719653179,
"autogenerated": false,
"ratio": 2.8244897959183675,... |
"""Base document class."""
import contextlib
import warnings
from collections import OrderedDict
from bson import ObjectId, SON
from aiomongodel.errors import ValidationError
from aiomongodel.queryset import MotorQuerySet
from aiomongodel.fields import Field, ObjectIdField, SynonymField, _Empty
from aiomongodel.utils... | {
"repo_name": "ilex/aiomongodel",
"path": "aiomongodel/document.py",
"copies": "1",
"size": "17611",
"license": "mit",
"hash": -4598127688127670000,
"line_mean": 31.0783242259,
"line_max": 78,
"alpha_frac": 0.5719152802,
"autogenerated": false,
"ratio": 4.478891149542218,
"config_test": false,
... |
# Based off https://github.com/ModusCreateOrg/alexa-skill-demo/blob/master/lambda_function.py
#import urllib2
#import json
def lambda_handler(event, context):
'''
if (event["session"]["application"]["applicationId"] !=
"amzn1.echo-sdk-ams.app.bd304b90-xxxx-xxxx-xxxx-xxxxd4772bab"):
raise V... | {
"repo_name": "chngchinboon/AlexaScheduleBot",
"path": "src/lambda_function.py",
"copies": "1",
"size": "6318",
"license": "apache-2.0",
"hash": -2394162510723080000,
"line_mean": 33.1405405405,
"line_max": 169,
"alpha_frac": 0.6326789107,
"autogenerated": false,
"ratio": 3.7218621096051856,
"c... |
# Based off https://github.com/noamraph/tqdm
__all__ = [
'brogressbar',
'rowgressbar',
]
import sys
import time
def format_interval(t):
mins, s = divmod(int(t), 60)
h, m = divmod(mins, 60)
if h:
return '%d:%02d:%02d' % (h, m, s)
else:
return '%02d:%02d' % (m, s)
def format_me... | {
"repo_name": "tpn/tpn",
"path": "lib/tpn/progressbar.py",
"copies": "1",
"size": "8039",
"license": "mit",
"hash": -1433812969561606700,
"line_mean": 26.4368600683,
"line_max": 79,
"alpha_frac": 0.5082721732,
"autogenerated": false,
"ratio": 3.5212439772229525,
"config_test": false,
"has_no_... |
## Based off of example at http://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field-examples.htm#ESRI_SECTION1_11EAB368A53B4D1C9618A58A1B09F9D0
## Goal: reclassify a numeric field
## Example use case: convert a lake's dissolved oxygen measurements into four categories of species habitability
## ... | {
"repo_name": "soyrice/tabular",
"path": "docs/scripts/logical.py",
"copies": "1",
"size": "1201",
"license": "mit",
"hash": -1794841782450681900,
"line_mean": 36.53125,
"line_max": 166,
"alpha_frac": 0.7235636969,
"autogenerated": false,
"ratio": 3.3735955056179776,
"config_test": false,
"ha... |
## Based off of example at http://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field-examples.htm#ESRI_SECTION1_F3F8CD77A9F647ABBA678A76ADB86E15
## Goal: calculate the percent increase of a numeric field
## Example use case: identify the rate of temperate increase as weather stations move inland
... | {
"repo_name": "soyrice/tabular",
"path": "docs/scripts/accumulative.py",
"copies": "1",
"size": "1207",
"license": "mit",
"hash": -4188170521952223000,
"line_mean": 34.5294117647,
"line_max": 166,
"alpha_frac": 0.7381938691,
"autogenerated": false,
"ratio": 3.4096045197740112,
"config_test": fa... |
#based off of example code
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D
from keras.datasets import mnist
def main():
#load data
(x_train, y_train), (x_test, y_test) = mnist.load_data()
#flatten data
x_train = x_train.reshape(x_train.shape[... | {
"repo_name": "PradeeshSuganthan/mnist-classifier",
"path": "keras_cnn.py",
"copies": "1",
"size": "1314",
"license": "mit",
"hash": -3971327240278186000,
"line_mean": 25.8367346939,
"line_max": 92,
"alpha_frac": 0.6818873668,
"autogenerated": false,
"ratio": 2.7663157894736843,
"config_test": ... |
# Based off of figleaf's CoverageData object,
# Though currently doesn't have support for figleaf sections or
# coverage.py arcs.
import os
class CoverageData(object):
"""
In general, do not pickle this object; it's simpler and more
straightforward to just pass the basic Python objects around
(e.g. Cov... | {
"repo_name": "dugan/coverage-reporter",
"path": "coverage_reporter/data.py",
"copies": "1",
"size": "3841",
"license": "mit",
"hash": -8311614225333281000,
"line_mean": 34.5648148148,
"line_max": 77,
"alpha_frac": 0.5696433221,
"autogenerated": false,
"ratio": 4.026205450733753,
"config_test":... |
# Based off of flat pages but no database needed. Concept is that we have dynamic
# urls based off of a docroot that extend from a template. Each developer page is a template
# relative to DOCROOT_URL. The purpose is to bypass having to enter urls for each page we build
# which would get out of hand quickly. Furthe... | {
"repo_name": "sstacha/uweb-install",
"path": "cms_files/middleware.py",
"copies": "1",
"size": "2703",
"license": "apache-2.0",
"hash": 8302101305715788000,
"line_mean": 46.4210526316,
"line_max": 111,
"alpha_frac": 0.658527562,
"autogenerated": false,
"ratio": 4.573604060913706,
"config_test"... |
# based off of http://appliedmechanics.asmedigitalcollection.asme.org/article.aspx?articleid=1402336
# and discussion at http://stackoverflow.com/a/20056658
def center(triangle) :
# calculate the lat/lon of the centroid's spherical polar coodinates
# math from http://mathworld.wolfram.com/SphericalCoordinates.... | {
"repo_name": "soyrice/autozoom",
"path": "zoom/center.py",
"copies": "1",
"size": "3891",
"license": "mit",
"hash": -6915432661232138000,
"line_mean": 39.53125,
"line_max": 109,
"alpha_frac": 0.5582112567,
"autogenerated": false,
"ratio": 3.176326530612245,
"config_test": false,
"has_no_keyw... |
#Based off of http://wiki.wxpython.org/GLCanvas
#Lots of help from http://wiki.wxpython.org/Getting%20Started
from OpenGL.GL import *
from OpenGL.arrays import vbo
import wx
from wx import glcanvas
from Cameras3D import *
from LaplacianSound import *
from struct import *
from sys import exit, argv
import random
import... | {
"repo_name": "ctralie/CurveMusification",
"path": "LME/LMEGUI.py",
"copies": "1",
"size": "22158",
"license": "apache-2.0",
"hash": 3439203837884690000,
"line_mean": 40.0333333333,
"line_max": 153,
"alpha_frac": 0.5969401571,
"autogenerated": false,
"ratio": 3.528343949044586,
"config_test": f... |
#Based off of http://wiki.wxpython.org/GLCanvas
#Lots of help from http://wiki.wxpython.org/Getting%20Started
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import wx
from wx import glcanvas
from Cameras3D import *
from sys import exit, argv
import random
import numpy as np
import scipy.io ... | {
"repo_name": "ctralie/MorseSSM",
"path": "skeletonViewer.py",
"copies": "1",
"size": "11356",
"license": "apache-2.0",
"hash": -4130607863687368700,
"line_mean": 36.6026490066,
"line_max": 155,
"alpha_frac": 0.6066396619,
"autogenerated": false,
"ratio": 3.35678391959799,
"config_test": false,... |
#Based off of http://wiki.wxpython.org/GLCanvas
#Lots of help from http://wiki.wxpython.org/Getting%20Started
import sys
sys.path.append("S3DGLPy")
from OpenGL.GL import *
from OpenGL.arrays import vbo
import wx
from wx import glcanvas
from Primitives3D import *
from PolyMesh import *
from LaplacianMesh import *
from ... | {
"repo_name": "COMPSCI290-S2016/Group3_LaplacianMesh",
"path": "LapGUI.py",
"copies": "1",
"size": "31160",
"license": "apache-2.0",
"hash": 999094685089423500,
"line_mean": 45.2314540059,
"line_max": 738,
"alpha_frac": 0.6153401797,
"autogenerated": false,
"ratio": 3.557889929207582,
"config_t... |
#based off of insertquery.py
#Java/SQL stuff
from java.lang import *
#Grinder stuff
from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
#misc
import time
import sys
#project specific
from framework import TSdata_w, TSdata_h, importstrs
#import relevant t_DATABASENAME depending on set... | {
"repo_name": "sagark/tsdb-perf-test",
"path": "tests/01_append_tests/horizontal.py",
"copies": "1",
"size": "3829",
"license": "bsd-2-clause",
"hash": -7876562185063825000,
"line_mean": 33.8090909091,
"line_max": 88,
"alpha_frac": 0.5557586837,
"autogenerated": false,
"ratio": 3.809950248756219,... |
#based off of neuralnetworksanddeeplearning.com
import numpy as np
import gzip
import struct
import random
epochs = 10 #number of training cycles
y_train = np.zeros((60000,10)) #initialize for one-hot encoding
alpha = 100 #learning rate
batchsize = 6
num_neurons
def main():
print "Test"
#read in data
images_train... | {
"repo_name": "PradeeshSuganthan/mnist-classifier",
"path": "mlp.py",
"copies": "1",
"size": "4683",
"license": "mit",
"hash": 2670317334518944300,
"line_mean": 22.6565656566,
"line_max": 86,
"alpha_frac": 0.6818278881,
"autogenerated": false,
"ratio": 2.6913793103448276,
"config_test": true,
... |
"""Based off of:
https://github.com/jacobgil/keras-grad-cam/blob/master/grad-cam.py
"""
from keras.layers.core import Lambda
from keras.models import Sequential
from keras.models import load_model
from tensorflow.python.framework import ops
import keras.backend as K
import tensorflow as tf
import numpy as np
import ker... | {
"repo_name": "nick-monto/SpeechRecog_CNN",
"path": "gradCAM_LangNet.py",
"copies": "1",
"size": "7380",
"license": "mit",
"hash": -7918045175482662000,
"line_mean": 32.3936651584,
"line_max": 100,
"alpha_frac": 0.6387533875,
"autogenerated": false,
"ratio": 3.3575978161965425,
"config_test": f... |
# Based off of sample from https://github.com/pypa/sampleproject
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='SPF2I... | {
"repo_name": "nathandines/SPF2IP",
"path": "setup.py",
"copies": "1",
"size": "1468",
"license": "mit",
"hash": -3540259704031204400,
"line_mean": 25.6909090909,
"line_max": 71,
"alpha_frac": 0.6158038147,
"autogenerated": false,
"ratio": 3.9251336898395723,
"config_test": false,
"has_no_key... |
"""Based off of the list of args taken, this module contains the
function calling the correct command to execute it."""
import subprocess
import sys
import os
from memesh_builtins import ls, clear, memesh_print, edit, meme, memesh_help, cd
from shell import READLINE, USER_HOME
from status import Status
if READLINE... | {
"repo_name": "ZeRoPoint1/memesh",
"path": "execute.py",
"copies": "1",
"size": "2576",
"license": "mit",
"hash": -8461666056170930000,
"line_mean": 27.9438202247,
"line_max": 80,
"alpha_frac": 0.5675465839,
"autogenerated": false,
"ratio": 3.956989247311828,
"config_test": false,
"has_no_key... |
# based off pyindi-client-code/pip/pyindi-client/examples/tuto-scripts/tuto-ccd.py
import time
import sys
import threading
try:
import PyIndi
except:
print "Cannot continue without PyIndi installed"
sys.exit(1)
class IndiClient(PyIndi.BaseClient):
def __init__(self):
super(IndiClient, sel... | {
"repo_name": "warnerem/pyASC",
"path": "ASC/allsky.py",
"copies": "3",
"size": "3856",
"license": "mit",
"hash": -6989340416516447000,
"line_mean": 26.9420289855,
"line_max": 106,
"alpha_frac": 0.6698651452,
"autogenerated": false,
"ratio": 3.2540084388185653,
"config_test": false,
"has_no_k... |
# Based off repl from RDanny by Danny.
# Will fail if the bot does not have embed permissions.
# Embed designed and implemented by taciturasa.
# Released under the MIT License.
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Rapptz
#
# Permission is hereby granted, free of charge, to any person obtaining a
#... | {
"repo_name": "cmdrflexo/humberto",
"path": "scripts/_OLD_/embedshell.py",
"copies": "1",
"size": "14068",
"license": "mit",
"hash": 1755806508759535900,
"line_mean": 35.3209549072,
"line_max": 86,
"alpha_frac": 0.494953085,
"autogenerated": false,
"ratio": 4.500319897632758,
"config_test": fal... |
# Based off the setup.py from https://github.com/pypa/sampleproject
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
l... | {
"repo_name": "GTmmiller/backloggery-puller",
"path": "setup.py",
"copies": "2",
"size": "1330",
"license": "mit",
"hash": -4479577836935251000,
"line_mean": 24.0943396226,
"line_max": 112,
"alpha_frac": 0.6323308271,
"autogenerated": false,
"ratio": 3.9233038348082596,
"config_test": false,
... |
# Based on a blog post by Steve Eddins:
# http://blogs.mathworks.com/steve/2010/12/23/two-dimensional-histograms/
from skimage import io, color, exposure
import numpy as np
url = 'http://blogs.mathworks.com/images/steve/2010/mms.jpg'
import os
if not os.path.exists('mm.jpg'):
print("Downloading M&M's...")
f... | {
"repo_name": "scikit-image/skimage-demos",
"path": "mm_color_select.py",
"copies": "1",
"size": "2262",
"license": "bsd-3-clause",
"hash": -7206287687433388000,
"line_mean": 24.7045454545,
"line_max": 73,
"alpha_frac": 0.633510168,
"autogenerated": false,
"ratio": 2.71875,
"config_test": false... |
# Based on a cryptography program written for a Udacity project
# Produces private key and decrypts message.
# Based on counting binary 1's and 0's multiplication used in calculating key.
# In this example, there are 26 multiplications.
# The timing attack is a type of side channel attack.
# http://en.wikipedia.... | {
"repo_name": "richierichrawr/Diffie-Hellman_timing_attack_cryptanalysis",
"path": "dh.attack.py",
"copies": "1",
"size": "6475",
"license": "mit",
"hash": 8704542329890470000,
"line_mean": 25.9791666667,
"line_max": 97,
"alpha_frac": 0.646023166,
"autogenerated": false,
"ratio": 3.19911067193675... |
# based on a Java version:
# Based on original version written in BCPL by Dr Martin Richards
# in 1981 at Cambridge University Computer Laboratory, England
# and a C++ version derived from a Smalltalk version written by
# L Peter Deutsch.
# Java version: Copyright (C) 1995 Sun Microsystems, Inc.
# Translation fr... | {
"repo_name": "wdv4758h/ZipPy",
"path": "edu.uci.python.benchmark/src/benchmarks/richards3-timed.py",
"copies": "1",
"size": "10454",
"license": "bsd-3-clause",
"hash": 2573882521415995000,
"line_mean": 22.7613636364,
"line_max": 97,
"alpha_frac": 0.5518461833,
"autogenerated": false,
"ratio": 3.... |
# Based on an example from http://masnun.com/2010/01/01/sending-mail-via-postfix-a-perfect-python-example.html
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders
fr... | {
"repo_name": "kyokley/MediaViewer",
"path": "mediaviewer/utils.py",
"copies": "1",
"size": "4531",
"license": "mit",
"hash": -1179163443574646800,
"line_mean": 31.3642857143,
"line_max": 110,
"alpha_frac": 0.5780180976,
"autogenerated": false,
"ratio": 3.7726894254787675,
"config_test": false,... |
"""Based on a Python Cookbook entry.
Title: Decorator for BindingConstants at compile time
Submitter: Raymond Hettinger
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/277940
Example uses:
Importing
=========
from schevo.lib import optimize
Module optimization
===================
import sys
optimize.bind_... | {
"repo_name": "Schevo/schevo",
"path": "schevo/lib/optimize.py",
"copies": "1",
"size": "7085",
"license": "mit",
"hash": 7232797464927136000,
"line_mean": 28.398340249,
"line_max": 79,
"alpha_frac": 0.5846153846,
"autogenerated": false,
"ratio": 3.7666135034556087,
"config_test": false,
"has... |
# Based on @berenm's pull request https://github.com/quarnster/SublimeClang/pull/135
# Create the database with cmake with for example: cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
# or you could have set(CMAKE_EXPORT_COMPILE_COMMANDS ON) in your CMakeLists.txt
# Usage within SublimeClang:
# "sublimeclang_options_scri... | {
"repo_name": "beemogmbh/osrm-backend",
"path": "cmake/cmake_options_script.py",
"copies": "13",
"size": "1508",
"license": "bsd-2-clause",
"hash": -7113677122326237000,
"line_mean": 34.0697674419,
"line_max": 147,
"alpha_frac": 0.6903183024,
"autogenerated": false,
"ratio": 3.2570194384449245,
... |
class Topology:
"""Encaptulation of the shape and dimentionality of a cellular automata"""
def get(self, address):
raise NotImplementedError
def set(self, address, state):
raise NotImplementedError
def normalize(self, address):
raise NotImplementedError
... | {
"repo_name": "wichovw/tca-gt",
"path": "server/tca/cellaut.py",
"copies": "1",
"size": "2703",
"license": "mit",
"hash": -7128172644492420000,
"line_mean": 28.0752688172,
"line_max": 79,
"alpha_frac": 0.5834258232,
"autogenerated": false,
"ratio": 4.345659163987138,
"config_test": false,
"ha... |
# Based on C++ code by Thomas Monjalon
# Developed by Daniel Eloff on 14/9/07
import wx
def change_intensity(color, fac):
rgb = [color.Red(), color.Green(), color.Blue()]
for i, intensity in enumerate(rgb):
rgb[i] = min(int(round(intensity*fac, 0)), 255)
return wx.Color(*rgb)
class L... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/533125_wxPython_LED_control/recipe-533125.py",
"copies": "1",
"size": "2634",
"license": "mit",
"hash": 775546540786324000,
"line_mean": 31.1219512195,
"line_max": 118,
"alpha_frac": 0.5018982536,
"autogenerated": false,
"ratio": 3.5983606... |
""" Based on C code from: http://nlp.cs.nyu.edu/evalb/
"""
def bracketing(ts):
buf = list(range((len(ts) + 1) / 2 + 1))
buf = list(reversed(list(zip(buf[:-1], buf[1:]))))
stack = []
ret = []
for t in ts:
if t == 0:
stack.append(buf.pop())
elif t == 1:
R, L =... | {
"repo_name": "nyu-mll/spinn",
"path": "python/spinn/util/evalb.py",
"copies": "1",
"size": "1062",
"license": "mit",
"hash": 8099636929709040000,
"line_mean": 26.2307692308,
"line_max": 69,
"alpha_frac": 0.4303201507,
"autogenerated": false,
"ratio": 3.0872093023255816,
"config_test": false,
... |
"""Based on chillee's answer at Fri, 6 Jan 2017, 05:06:
There's so many convoluted substring solutions.
1/3 = 3/9 = 0.(3)
1/7 = 148257/999999 = 0.(148257)
Therefore, the length of the repeating portion is length of the numerator when
you set the denominator equal to some string of 9s.
There's one other thing to keep... | {
"repo_name": "dawran6/project-euler",
"path": "26-reciprocal-cycles.py",
"copies": "1",
"size": "1065",
"license": "mit",
"hash": 3204270693829979600,
"line_mean": 30.3235294118,
"line_max": 79,
"alpha_frac": 0.620657277,
"autogenerated": false,
"ratio": 3.2078313253012047,
"config_test": fals... |
#Based on code by Francois Caron
from source.exptiltedstable import *
from scipy import integrate
from numpy import *
from pylab import *
from nose.tools import nottest
def etstablepdf(x, V0, alpha, tau):
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# % pdf of the exponentially tilte... | {
"repo_name": "msperber/bipartite",
"path": "bipartite-py/test/test_exptiltedstable.py",
"copies": "1",
"size": "3916",
"license": "mit",
"hash": 7904003056024579000,
"line_mean": 23.1728395062,
"line_max": 132,
"alpha_frac": 0.5847803882,
"autogenerated": false,
"ratio": 2.5329883570504528,
"c... |
# based on code by Francois Caron
import numpy as np
import sys
from math import *
def establernd(V0,alpha,tau,n):
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#% Random variate generation for the exponentially tilted stable distribution
#% with Laplace transform (in z)
#% exp(-V0 * ... | {
"repo_name": "msperber/bipartite",
"path": "bipartite-py/source/exptiltedstable.py",
"copies": "1",
"size": "4784",
"license": "mit",
"hash": 7770552513956811000,
"line_mean": 33.6666666667,
"line_max": 187,
"alpha_frac": 0.4471153846,
"autogenerated": false,
"ratio": 2.859533771667663,
"confi... |
species = 'Hs'
platform = "exon"
vendor = 'Affymetrix'
compendium_platform = "exon"
codingtype = 'protein_coding'
platform = vendor, platform
exp_output = None
geneModels = False
modelSize = None
permute = False
useMulti = False
finalNumberSetsToOutput = 10
cross_vali... | {
"repo_name": "wuxue/altanalyze",
"path": "LineageProfilerIterate.py",
"copies": "1",
"size": "110096",
"license": "apache-2.0",
"hash": 7359493827624974000,
"line_mean": 45.4152613828,
"line_max": 318,
"alpha_frac": 0.6002670397,
"autogenerated": false,
"ratio": 3.846417216923453,
"config_test... |
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
... | {
"repo_name": "kdaily/altanalyze",
"path": "LineageProfilerIterate.py",
"copies": "1",
"size": "95158",
"license": "apache-2.0",
"hash": 2056496478255144700,
"line_mean": 44.7387033399,
"line_max": 318,
"alpha_frac": 0.5805082074,
"autogenerated": false,
"ratio": 3.8463217461600645,
"config_tes... |
# Based on code from http://lethain.com/genetic-algorithms-cool-name-damn-simple/
from random import randint, random
from operator import add
from functools import reduce
from math import sin, cos, pi, sqrt
from track import Track, Vector
from map import Point
from operator import itemgetter
class Population():
"... | {
"repo_name": "Faerbit/evol-racer",
"path": "population.py",
"copies": "1",
"size": "5533",
"license": "mit",
"hash": -161757263251928930,
"line_mean": 37.4236111111,
"line_max": 100,
"alpha_frac": 0.6038315561,
"autogenerated": false,
"ratio": 4.28250773993808,
"config_test": false,
"has_no_... |
# Based on code from https://github.com/AlJohri/OpenSubtitles
# by Al Johri <al.johri@gmail.com>
import xml.etree.ElementTree as ET
import datetime
import os
import sys
import json
import re
import pprint
from gzip import GzipFile
from tqdm import tqdm
"""
Load the opensubtitles dialog corpus.
"""
class OpensubsDat... | {
"repo_name": "AbdelrahmanRadwan/Open-Domain-CahtBot",
"path": "chatbot/data_preprocessing/opensubsdata.py",
"copies": "11",
"size": "4126",
"license": "apache-2.0",
"hash": 3286706067414288000,
"line_mean": 30.022556391,
"line_max": 121,
"alpha_frac": 0.5123606398,
"autogenerated": false,
"ratio... |
"""Based on code from https://github.com/edwardslabs/cleverwrap.py"""
import requests
class CleverWrap:
""" A simple wrapper class for the www.cleverbot.com api. """
url = "https://www.cleverbot.com/getreply"
def __init__(self, api_key, name="CleverBot"):
""" Initialize the class with an api key... | {
"repo_name": "Yorimor/zurok_bot",
"path": "yorimor/cb/cleverbot.py",
"copies": "1",
"size": "2838",
"license": "mit",
"hash": 5348232981610786000,
"line_mean": 29.847826087,
"line_max": 100,
"alpha_frac": 0.5299506695,
"autogenerated": false,
"ratio": 4.0369843527738265,
"config_test": false,
... |
# Based on code from: https://github.com/j4cbo/j4cDAC/blob/master/tools/tester/talk.py
import dac
from itertools import combinations
import math
import sys
from leapyosc import client
from leapyosc.client import (BaseLeapListener, RealPartTrackerMixin,
BundledMixin, LinearScalingMixin, OSCLeapList... | {
"repo_name": "topher515/laser-fingers",
"path": "leaplaser.py",
"copies": "1",
"size": "14168",
"license": "mit",
"hash": 736441758211471200,
"line_mean": 25.531835206,
"line_max": 97,
"alpha_frac": 0.5055759458,
"autogenerated": false,
"ratio": 3.3637226970560303,
"config_test": false,
"has... |
# Based on code from https://github.com/mattalexpugh/python-games/blob/master/pong-gui.py
# Made by Matt Pugh, distributed as GPLv2
# This code has been modified
# https://stackoverflow.com/questions/16115378/tkinter-example-code-for-multiple-windows-why-wont-buttons-load-correctly
import Tkinter as tk
import random
... | {
"repo_name": "FDelporte/PiGameConsole",
"path": "PongGui.py",
"copies": "1",
"size": "8313",
"license": "apache-2.0",
"hash": 3619982265878778400,
"line_mean": 33.6375,
"line_max": 250,
"alpha_frac": 0.5154577168,
"autogenerated": false,
"ratio": 3.9398104265402845,
"config_test": false,
"ha... |
# Based on code from https://github.com/msabramo/requests-unixsocket/blob/master/requests_unixsocket/adapters.py
# License: Apache License 2.0
# Contributors: https://github.com/msabramo/requests-unixsocket/graphs/contributors
import socket, requests, os
from requests.adapters import HTTPAdapter
from requests.compat ... | {
"repo_name": "metacontainer/metac",
"path": "py/metac/unix_http.py",
"copies": "1",
"size": "2040",
"license": "mit",
"hash": 458346225444393860,
"line_mean": 30.875,
"line_max": 112,
"alpha_frac": 0.6745098039,
"autogenerated": false,
"ratio": 3.7777777777777777,
"config_test": false,
"has_... |
# Based on code from https://github.com/nomel/beaglebone
# Generates device tree overlays for runtime config of every gpio pin.
# creates dts files, compile script, and install script
#
# Usage:
# python3 generateGPIOOverlays.py # generates the dts files in the dts directory.
# cd generated
# sh compile.sh
# sh... | {
"repo_name": "SaintGimp/BeagleBoneHardware",
"path": "gimpbbio/overlays/generateGPIOOverlays.py",
"copies": "1",
"size": "11476",
"license": "mit",
"hash": 6613808585618824000,
"line_mean": 31.0558659218,
"line_max": 133,
"alpha_frac": 0.6294876264,
"autogenerated": false,
"ratio": 2.54456762749... |
# Based on code from https://github.com/nomel/beaglebone
def populate(template, values):
# template is a string containing tags. the tags get replaced with the entries from the values dictionary.
# example:
# > template = "hello there <<your name>>!"
# > values = {"your name": "bukaroo banzai"}
# > p... | {
"repo_name": "SaintGimp/BeagleBoneHardware",
"path": "gimpbbio/overlays/templates.py",
"copies": "1",
"size": "2780",
"license": "mit",
"hash": 4093660518468565500,
"line_mean": 23.0630630631,
"line_max": 107,
"alpha_frac": 0.5715827338,
"autogenerated": false,
"ratio": 3.0382513661202184,
"co... |
"""Based on code from timeout_socket.py, with some tweaks for compatibility.
These tweaks should really be rolled back into timeout_socket, but it's
not totally clear who is maintaining it at this point. In the meantime,
we'll use a different module name for our tweaked version to avoid any
confusion.
T... | {
"repo_name": "burzillibus/RobHome",
"path": "venv/lib/python2.7/site-packages/wstools/TimeoutSocket.py",
"copies": "3",
"size": "5478",
"license": "mit",
"hash": -521512034191397800,
"line_mean": 27.8315789474,
"line_max": 76,
"alpha_frac": 0.4686016794,
"autogenerated": false,
"ratio": 4.078927... |
# Based on code in
# https://github.com/julian121266/RecurrentHighwayNetworks/blob/master/theano_rhn.py
# by The Swiss AI lab IDSIA.
import numpy as np
import theano
import theano.tensor as tt
from theano.ifelse import ifelse
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
import numbers
import fu... | {
"repo_name": "gchrupala/funktional",
"path": "funktional/rhn.py",
"copies": "1",
"size": "7752",
"license": "mit",
"hash": -8535996660004701000,
"line_mean": 41.1304347826,
"line_max": 129,
"alpha_frac": 0.6059081527,
"autogenerated": false,
"ratio": 3.1397326852976915,
"config_test": false,
... |
# Based on code writted by Davi Frossard, 2016
import tensorflow as tf
import layers
FLAGS = tf.app.flags.FLAGS
class shallow:
'''
Weights can be downloaded from:
https://www.cs.toronto.edu/~frossard/vgg16/vgg16_weights.npz
'''
def __init__(self, x, y):
'''
Sets up network enough... | {
"repo_name": "slippy0/AppraisalNet",
"path": "shallow.py",
"copies": "1",
"size": "4384",
"license": "mit",
"hash": 7614096980718047000,
"line_mean": 29.6573426573,
"line_max": 94,
"alpha_frac": 0.5127737226,
"autogenerated": false,
"ratio": 3.808861859252824,
"config_test": false,
"has_no_k... |
# Based on code writted by Davi Frossard, 2016
import tensorflow as tf
import numpy as np
import layers
FLAGS = tf.app.flags.FLAGS
class vgg16:
'''
VGG16 Model with ImageNet pretrained weight loader method
Weights can be downloaded from:
https://www.cs.toronto.edu/~frossard/vgg16/vgg16_weights.npz
... | {
"repo_name": "slippy0/AppraisalNet",
"path": "vgg16.py",
"copies": "1",
"size": "10515",
"license": "mit",
"hash": -1797744860451040300,
"line_mean": 31.859375,
"line_max": 94,
"alpha_frac": 0.499191631,
"autogenerated": false,
"ratio": 3.801518438177874,
"config_test": false,
"has_no_keywor... |
""" based on **Context Managers in the Standard Library** chapter
' I think we should be careful with this; it could lead to mistakes
like:
f = open(filename)
with f:
BLOCK1
with f:
BLOCK2
which does not do what one might think (f is closed before BLOCK2
is entered).
'
"""
import sys
def... | {
"repo_name": "nwinds/py-with-study",
"path": "pep343_ex_wrong_with.py",
"copies": "1",
"size": "1179",
"license": "mit",
"hash": -4436864874856275500,
"line_mean": 21.6730769231,
"line_max": 68,
"alpha_frac": 0.5597964377,
"autogenerated": false,
"ratio": 3.638888888888889,
"config_test": fals... |
# Based on CSV, but rewrote because
# values in different columns required concatinaton
import io
import csv
import hashlib
from dojo.models import Finding, Endpoint
import re
from urllib.parse import urlparse
import socket
MAPPINGS = {"title": "Vulnerability Name",
'description': 'Description',
... | {
"repo_name": "OWASP/django-DefectDojo",
"path": "dojo/tools/trustwave/parser.py",
"copies": "2",
"size": "6936",
"license": "bsd-3-clause",
"hash": -990028422957281500,
"line_mean": 36.9016393443,
"line_max": 539,
"alpha_frac": 0.476355248,
"autogenerated": false,
"ratio": 4.1310303752233475,
... |
# Retrieve a singular cgl dictionary
def retrieve(check_id):
return cgls.find_one( {'chatID': str(check_id)} )
def getMe(chatID):
cgl = retrieve(chatID)
return 'You are ' + cgl['name'].title() + ' from ' + cgl['cg'][0].upper() + '.\n\nContact @njyjn if not correct.'
def getName(chatID):
try:
... | {
"repo_name": "njyjn/AttendanceBot",
"path": "manager.py",
"copies": "1",
"size": "12471",
"license": "mit",
"hash": -6379062369152758000,
"line_mean": 32.6145552561,
"line_max": 190,
"alpha_frac": 0.5695613824,
"autogenerated": false,
"ratio": 3.4139063783191896,
"config_test": false,
"has_n... |
# Based on design in:
# <http://www.turbogears.org/docs/plugins/template.html>
# <http://projects.dowski.com/view/buffet>
import pkg_resources
available_engines = dict([ (entry_point.name, entry_point.load())
for entry_point in pkg_resources.
iter_entry_points('python.templating.engines') ... | {
"repo_name": "SergeVL/oort.python-oortpub",
"path": "oort/util/templating.py",
"copies": "3",
"size": "1642",
"license": "bsd-3-clause",
"hash": -7964085673421781000,
"line_mean": 34.6956521739,
"line_max": 77,
"alpha_frac": 0.6151035323,
"autogenerated": false,
"ratio": 3.8454332552693207,
"c... |
# based on dicttoxml.py from https://github.com/quandyfactory/dicttoxml/blob/master/dicttoxml.py
from random import randint
import numbers
import collections
from xml.dom.minidom import parseString
def make_id(element, start=100000, end=999999):
"""
Returns a random integer
"""
return '%s_%s' % (elem... | {
"repo_name": "brainsqueeze/OpenAgClassifier",
"path": "src/model/json_to_xml.py",
"copies": "2",
"size": "9886",
"license": "mpl-2.0",
"hash": -1657905739396391200,
"line_mean": 29.701863354,
"line_max": 119,
"alpha_frac": 0.5425854744,
"autogenerated": false,
"ratio": 3.701235492324972,
"conf... |
# based on django.contrib.admin.__init__.py
from django.utils.importlib import import_module
LOADING = False
from django.conf import settings
REGISTRATION_MODULE_NAME = getattr(
settings, 'DBGETTEXT_REGISTRATION_MODULE_NAME', 'dbgettext_registration')
def autodiscover():
"""
Auto-discover INSTALLED_APPS ... | {
"repo_name": "jezdez/kuma",
"path": "vendor/packages/dbgettext/__init__.py",
"copies": "26",
"size": "1115",
"license": "mpl-2.0",
"hash": -7531819164186308000,
"line_mean": 25.5476190476,
"line_max": 77,
"alpha_frac": 0.66367713,
"autogenerated": false,
"ratio": 4.099264705882353,
"config_tes... |
# Based on Django "How to write reusable apps" tutorial.
import os
import setuptools
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setuptools.setup(
name='django-... | {
"repo_name": "jmuhlich/django-conferenceabstract",
"path": "setup.py",
"copies": "1",
"size": "1148",
"license": "mit",
"hash": 6552385664728733000,
"line_mean": 32.7647058824,
"line_max": 78,
"alpha_frac": 0.6419860627,
"autogenerated": false,
"ratio": 3.8915254237288135,
"config_test": false... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.