text stringlengths 0 1.05M | meta dict |
|---|---|
A simple doctest involves pasting the results of actually using a
function into a string at the beginning of the function. Doctest then
checks to make sure that the usage examples work, including
errors. Note -- doctest ignores traceback information, just include
the first line of the traceback and the actual error. I... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/305292_doctest_unittest_pyth24s_cool_/recipe-305292.py",
"copies": "1",
"size": "1487",
"license": "mit",
"hash": 1964329685491468000,
"line_mean": 32.7954545455,
"line_max": 75,
"alpha_frac": 0.6933422999,
"autogenerated": false,
"ratio":... |
"""A simple drum pattern MIDI sequencer."""
from pyb import millis, delay
class Pattern:
velocities = {
"-": None, # continue note
".": 0, # off
"+": 10, # ghost
"s": 60, # soft
"m": 100, # medium
"x": 120, # hard
}
def __init__(self, src):
... | {
"repo_name": "SpotlightKid/micropython-stm-lib",
"path": "midi/examples/drumseq.py",
"copies": "1",
"size": "2998",
"license": "mit",
"hash": 1276377677343559700,
"line_mean": 30.2291666667,
"line_max": 78,
"alpha_frac": 0.512341561,
"autogenerated": false,
"ratio": 3.7853535353535355,
"config... |
# A simple email notifier for xubuntu xfce4-panel using python imap and notify-osd notification server
# {this snippet works fine}
import urllib2
import feedparser
import os
def Authenticate(user, passwd):
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_password(
realm='New mail feed',
... | {
"repo_name": "cloud-engineering/xfc-email-notifier",
"path": "snippets/snippet_gmail_atom_feed_reader.py",
"copies": "1",
"size": "1506",
"license": "mit",
"hash": -432242933579478800,
"line_mean": 26.8888888889,
"line_max": 102,
"alpha_frac": 0.6812749004,
"autogenerated": false,
"ratio": 3.691... |
"""A simple embedding of an IPython kernel.
"""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import sys
from IPython.lib.kernel import connect_qtconsole
from IPython.kernel.zmq.kernelapp import I... | {
"repo_name": "pioneers/topgear",
"path": "ipython-in-depth/exercises/Embedding/kapp.py",
"copies": "2",
"size": "2328",
"license": "apache-2.0",
"hash": -4110517832691204000,
"line_mean": 37.8,
"line_max": 78,
"alpha_frac": 0.5244845361,
"autogenerated": false,
"ratio": 4.751020408163265,
"con... |
"""A simple engine that talks to a controller over 0MQ.
it handles registration, etc. and launches a kernel
connected to the Controller's Schedulers.
Authors:
* Min RK
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2011 The IPython Development Team
#
# Distr... | {
"repo_name": "noslenfa/tdjangorest",
"path": "uw/lib/python2.7/site-packages/IPython/parallel/engine/engine.py",
"copies": "2",
"size": "13047",
"license": "apache-2.0",
"hash": 5054244083947806000,
"line_mean": 41.7770491803,
"line_max": 127,
"alpha_frac": 0.60780256,
"autogenerated": false,
"r... |
"""A simple engine to query the index."""
import time
import operator
import pickle
import crawler
import preprocessor
import morphosyntactic
import indexer
import save_and_load
class NoIndexError(Exception):
"""
Exception produced when the search engine's index hasn't been initialized.
"""
def ... | {
"repo_name": "nitsas/simple-web-search-engine",
"path": "search_engine.py",
"copies": "1",
"size": "4310",
"license": "mit",
"hash": -1144587110971107200,
"line_mean": 30.6911764706,
"line_max": 78,
"alpha_frac": 0.5552204176,
"autogenerated": false,
"ratio": 4.140249759846301,
"config_test": ... |
"""A simple event tracing framework.
This is used to track events that are happing in irisett. For example
monitors call event.running(...) when they start/stop monitoring etc.
Other parts of irisett can then listen for events that are happening.
For example, the webmgmt ui can send events that are occuring over a we... | {
"repo_name": "beebyte/irisett",
"path": "irisett/event.py",
"copies": "1",
"size": "5132",
"license": "mit",
"hash": 4199092909868628500,
"line_mean": 36.7352941176,
"line_max": 120,
"alpha_frac": 0.6473109899,
"autogenerated": false,
"ratio": 4.2031122031122035,
"config_test": false,
"has_n... |
"""A simple example demonstrating basic usage of pyuv_cffi
This example creates a timer handle and a signal handle, then starts the loop. The timer callback is
run after 1 second, and repeating every 1 second thereafter. The signal handle registers a listener
for the INT signal and allows us to exit the loop by pressi... | {
"repo_name": "veegee/guv",
"path": "examples/pyuv_cffi_example.py",
"copies": "1",
"size": "1060",
"license": "mit",
"hash": 4128176578612776000,
"line_mean": 22.5555555556,
"line_max": 100,
"alpha_frac": 0.658490566,
"autogenerated": false,
"ratio": 3.365079365079365,
"config_test": false,
... |
"""A simple example of building a virtual dataset.
This makes four 'source' HDF5 files, each with a 1D dataset of 100 numbers.
Then it makes a single 4x100 virtual dataset in a separate file, exposing
the four sources as one dataset.
"""
import h5py
import numpy as np
# create some sample data
data = np.arange(0, 10... | {
"repo_name": "h5py/h5py",
"path": "examples/vds_simple.py",
"copies": "1",
"size": "1175",
"license": "bsd-3-clause",
"hash": 6893195572346869000,
"line_mean": 29.9210526316,
"line_max": 75,
"alpha_frac": 0.6604255319,
"autogenerated": false,
"ratio": 2.959697732997481,
"config_test": false,
... |
# A simple example of calculating predictive posteriors in a normal unknown
# mean unknown variance case.
from __future__ import division
from lori import MHRun
import numpy as np
import pylab as p
import matplotlib as mpl
import random
from math import log, exp, pi, lgamma
import scipy.stats as st
import scipy
from... | {
"repo_name": "binarybana/samcnet",
"path": "samcnet/tail.py",
"copies": "1",
"size": "7013",
"license": "mit",
"hash": 2275551134990323700,
"line_mean": 28.8425531915,
"line_max": 95,
"alpha_frac": 0.5511193498,
"autogenerated": false,
"ratio": 3.0111635895234006,
"config_test": false,
"has_... |
"""A simple example of Google Analytics batched user permissions."""
import json
from apiclient.errors import HttpError
from apiclient.http import BatchHttpRequest
def call_back(request_id, response, exception):
"""Handle batched request responses."""
print request_id
if exception is not None:
if isinstance(... | {
"repo_name": "mcohoon/api-samples",
"path": "batching/permissions.py",
"copies": "1",
"size": "2389",
"license": "apache-2.0",
"hash": -3404297649734361600,
"line_mean": 31.7260273973,
"line_max": 80,
"alpha_frac": 0.6224361658,
"autogenerated": false,
"ratio": 4.335753176043557,
"config_test"... |
"""A simple example of how to access the Google Analytics API."""
from apiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials
import re
from collections import OrderedDict
from operator import itemgetter
import yaml
import datetime
def get_service(api_name, api_version, s... | {
"repo_name": "opensourcefeed/opensourcefeed.github.io",
"path": "assets/pageview/fetch.py",
"copies": "1",
"size": "6095",
"license": "mit",
"hash": 3225534384809617000,
"line_mean": 32.679558011,
"line_max": 122,
"alpha_frac": 0.556685808,
"autogenerated": false,
"ratio": 4.265220433869839,
"... |
"""A simple example of how to access the Google Analytics API."""
import argparse
from apiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials
import httplib2
from oauth2client import client
from oauth2client import file
from oauth2client import tools
import os
from . imp... | {
"repo_name": "jonfroehlich/makeabilitylabwebsite",
"path": "website/googleanalytics.py",
"copies": "1",
"size": "3442",
"license": "mit",
"hash": -8046027808778075000,
"line_mean": 31.4716981132,
"line_max": 162,
"alpha_frac": 0.7193492156,
"autogenerated": false,
"ratio": 4.039906103286385,
"... |
"""A simple example of how to access the Google Analytics API."""
import argparse
from apiclient.discovery import build
import httplib2
from oauth2client import client
from oauth2client import file
from oauth2client import tools
def get_service(api_name, api_version, scope, client_secrets_path):
"""Get a service ... | {
"repo_name": "Felixaverlant/starter_kit_python_notebook_gapi",
"path": "auth.py",
"copies": "2",
"size": "1996",
"license": "mit",
"hash": 4952279847229344000,
"line_mean": 31.7213114754,
"line_max": 79,
"alpha_frac": 0.7284569138,
"autogenerated": false,
"ratio": 4.081799591002045,
"config_te... |
"""A simple example of how to access the Google Analytics API."""
import re
from datetime import date
import difflib
from apiclient.discovery import build
from oauth2client.client import SignedJwtAssertionCredentials
import httplib2
import json
import pywikibot
def get_service(api_name, api_version, scope, key_fi... | {
"repo_name": "icyflame/batman",
"path": "scripts/updatestatistics.py",
"copies": "1",
"size": "5295",
"license": "mit",
"hash": -4940328026249490000,
"line_mean": 30.1470588235,
"line_max": 129,
"alpha_frac": 0.6203966006,
"autogenerated": false,
"ratio": 3.862144420131291,
"config_test": fals... |
"""A simple example of how to use IPython.config.application.Application.
This should serve as a simple example that shows how the IPython config
system works. The main classes are:
* IPython.config.configurable.Configurable
* IPython.config.configurable.SingletonConfigurable
* IPython.config.loader.Config
* IPython.... | {
"repo_name": "OSGeo-live/CesiumWidget",
"path": "GSOC/notebooks/ipython/examples/Customization/appconfig.py",
"copies": "3",
"size": "3290",
"license": "apache-2.0",
"hash": 5892795823012296000,
"line_mean": 32.2323232323,
"line_max": 85,
"alpha_frac": 0.6665653495,
"autogenerated": false,
"rati... |
"""A simple example of Pyglet/Twisted integration. A Pyglet window
is displayed, and both Pyglet and Twisted are making scheduled calls
and regular intervals. Interacting with the window doesn't interfere
with either calls.
"""
import pyglet
from pigtwist import pygletreactor
pygletreactor.install() # <- this must com... | {
"repo_name": "padraigkitterick/pyglet-twisted",
"path": "examples/hello_twisted.py",
"copies": "1",
"size": "1357",
"license": "mit",
"hash": 2563591969172420600,
"line_mean": 28.5,
"line_max": 74,
"alpha_frac": 0.6853352985,
"autogenerated": false,
"ratio": 3.8882521489971347,
"config_test": ... |
"""A simple example of sending control commands to the drone via qtdronequi.
The qtdronegui program can accept control commands for the drone over the
network. It listens on UDP port 5560 for JSON formatted control commands.
This program serves as an example of communicating with the drone.
"""
# Import the standar... | {
"repo_name": "rc500/ardrone_archive_aarons_laptop",
"path": "examples/take_off_and_land_corrected.py",
"copies": "1",
"size": "3017",
"license": "apache-2.0",
"hash": 4533511735225645000,
"line_mean": 25.4649122807,
"line_max": 83,
"alpha_frac": 0.6794829301,
"autogenerated": false,
"ratio": 3.6... |
# A simple example of using parser combinators to build an arithmetic
# expression parser.
from pcomb import *
## Actions
def digits_to_number(digits, running=0):
"""Convert a list of digits to an integer"""
if len(digits) == 0:
return running
else:
r = (running * 10) + int(digits[0])
return digits... | {
"repo_name": "MarkChuCarroll/pcomb",
"path": "python/calc.py",
"copies": "1",
"size": "2172",
"license": "apache-2.0",
"hash": 3265189637571956000,
"line_mean": 27.96,
"line_max": 91,
"alpha_frac": 0.6174033149,
"autogenerated": false,
"ratio": 3.2369597615499255,
"config_test": false,
"has_... |
""" A simple example of using the workbench window. """
# Enthought library imports.
from enthought.pyface.action.api import Action, MenuManager
from enthought.pyface.workbench.api import EditorManager, WorkbenchWindow
from enthought.pyface.workbench.api import Perspective, PerspectiveItem
from enthought.pyface.workb... | {
"repo_name": "enthought/traitsgui",
"path": "examples/workbench/example_workbench_window.py",
"copies": "1",
"size": "5712",
"license": "bsd-3-clause",
"hash": -70281229219575144,
"line_mean": 32.2093023256,
"line_max": 79,
"alpha_frac": 0.5280112045,
"autogenerated": false,
"ratio": 4.720661157... |
""" A simple example of using the workbench window. """
# Enthought library imports.
from pyface.action.api import Action, MenuManager
from pyface.workbench.api import EditorManager, WorkbenchWindow
from pyface.workbench.api import Perspective, PerspectiveItem
from pyface.workbench.action.api import MenuBarManager
fr... | {
"repo_name": "geggo/pyface",
"path": "examples/workbench/example_workbench_window.py",
"copies": "5",
"size": "5632",
"license": "bsd-3-clause",
"hash": 8576807347832996000,
"line_mean": 31.7441860465,
"line_max": 79,
"alpha_frac": 0.5227272727,
"autogenerated": false,
"ratio": 4.780984719864176... |
""" A simple example on how to use the GaussianProcess class
in pybrain, for one and two dimensions. """
__author__ = "Thomas Rueckstiess, ruecksti@in.tum.de"
from pybrain.auxiliary import GaussianProcess
from pybrain.datasets import SupervisedDataSet
from scipy import mgrid, sin, cos, array, ravel
from pylab import ... | {
"repo_name": "daanwierstra/pybrain",
"path": "examples/gaussprocess/gp.py",
"copies": "1",
"size": "1351",
"license": "bsd-3-clause",
"hash": -1303602226407199200,
"line_mean": 25,
"line_max": 71,
"alpha_frac": 0.6861584012,
"autogenerated": false,
"ratio": 2.6752475247524754,
"config_test": f... |
"""A simple example to demonstrate a thing with multiple ports. The
thing samples values from a sensor and sends them on different output
ports depending on the divisibility of the value. See docs/ports.rst
for a more detailed explanation.
"""
import random
import asyncio
from thingflow.base import OutputThing, InputT... | {
"repo_name": "mpi-sws-rse/thingflow-python",
"path": "examples/multi_port_example.py",
"copies": "1",
"size": "3182",
"license": "apache-2.0",
"hash": 8192177086743224000,
"line_mean": 38.2839506173,
"line_max": 83,
"alpha_frac": 0.6008799497,
"autogenerated": false,
"ratio": 3.8062200956937797,... |
"""A simple example to demonstrate publishing on multiple topics. The
publisher samples values from a sensor and publishes them on different output
ports depending on the divisibility of the value. See docs/pubsub-topics.rst
for a more detailed explanation.
"""
import random
import asyncio
from antevents.base import P... | {
"repo_name": "mpi-sws-rse/antevents-python",
"path": "examples/multi_topic_publisher.py",
"copies": "1",
"size": "3121",
"license": "apache-2.0",
"hash": 3342870508171240400,
"line_mean": 38.5063291139,
"line_max": 83,
"alpha_frac": 0.5966036527,
"autogenerated": false,
"ratio": 3.91593475533249... |
""" A simple example to show how to access a 3D numpy array. One
example shows how to access the numpy array using blitz type
converters and the other shows how it can be done without using blitz
by accessing the numpy array data directly.
"""
from __future__ import absolute_import, print_function
import scipy.weave... | {
"repo_name": "Kamp9/scipy",
"path": "scipy/weave/examples/array3d.py",
"copies": "100",
"size": "2521",
"license": "bsd-3-clause",
"hash": 2937314798345563000,
"line_mean": 22.5607476636,
"line_max": 69,
"alpha_frac": 0.5295517652,
"autogenerated": false,
"ratio": 3.4392905866302863,
"config_t... |
# A simple exploration of graphs and various functions to work with them.
"""
A graph is a way of representing some kind of relationship between datum;
such as the distances between towns, the cost of a decision or the impact of
an action, latency between a server and users, the routes a packet could
take across a lar... | {
"repo_name": "kfsone/tinker",
"path": "python/graph.py",
"copies": "1",
"size": "5613",
"license": "mit",
"hash": -2161422646755011000,
"line_mean": 34.7515923567,
"line_max": 80,
"alpha_frac": 0.7277748085,
"autogenerated": false,
"ratio": 3.8683666436940043,
"config_test": false,
"has_no_k... |
"""A simple extension that fires a Jenkins job for incoming heads."""
from contextlib import closing
from urllib import urlencode
import re
import urllib2
import urlparse
from mercurial import util
BUILD_URL = 'job/{job}/buildWithParameters'
def reposetup(ui, repo):
"""Set up the Jenkins notification hook.
... | {
"repo_name": "paylogic/poke-jenkins",
"path": "poke_jenkins.py",
"copies": "1",
"size": "3069",
"license": "mit",
"hash": 2085727454695924200,
"line_mean": 35.5357142857,
"line_max": 110,
"alpha_frac": 0.6158357771,
"autogenerated": false,
"ratio": 3.9702457956015524,
"config_test": true,
"h... |
"""A simple extension that renders cells as jinja templates.
For demonstration purposes, this renders in a simple environment with `solution=True`,
so that a solution notebook *template* will be executable.
Input with:
{% if solution %}
solution_code
{% else %}
student_code
{% endif %}
will be e... | {
"repo_name": "danielballan/ipython_extensions",
"path": "extensions/jinjasolution.py",
"copies": "4",
"size": "1427",
"license": "bsd-3-clause",
"hash": 858251839902707200,
"line_mean": 26.4423076923,
"line_max": 86,
"alpha_frac": 0.654519972,
"autogenerated": false,
"ratio": 4.285285285285285,
... |
"""A simple fcntl/flock implementation"""
from os import getpid
from fcntl import flock, LOCK_EX, LOCK_UN, LOCK_NB
class LockError(Exception):
"""Raised when an error is encountered during a lock operation"""
def __init__(self, message, exc=None):
Exception.__init__(self, message, exc)
self.m... | {
"repo_name": "m00dawg/holland",
"path": "holland/core/util/lock.py",
"copies": "1",
"size": "1346",
"license": "bsd-3-clause",
"hash": -8459301700717894000,
"line_mean": 25.92,
"line_max": 73,
"alpha_frac": 0.5631500743,
"autogenerated": false,
"ratio": 4.128834355828221,
"config_test": false,... |
"""A simple file and folder watcher."""
import os
from typing import Iterable
from typing import List
class Watcher:
"""A simple file and folder watcher.
For folders, only checks mtime of the folder and all subdirectories.
So a file change won't be noticed, but only new/deleted files.
"""
__slot... | {
"repo_name": "beancount/fava",
"path": "src/fava/core/watcher.py",
"copies": "2",
"size": "1644",
"license": "mit",
"hash": 1383789833056331300,
"line_mean": 28.8909090909,
"line_max": 77,
"alpha_frac": 0.5474452555,
"autogenerated": false,
"ratio": 4.303664921465969,
"config_test": true,
"h... |
# a simple file extractor
# TODO:
# classify or clean
# PNG TIFF JPG BMP
# Aplib'ed-EXE
# xor-ed information
import os
import sys
import struct
import zlib
def extract(file, data, offset, size, type):
print "found a %s file @ offset %i, size %i" % (file, offset, size)
with open("%s-%s(%04... | {
"repo_name": "angea/corkami",
"path": "misc/python/ex.py",
"copies": "1",
"size": "3166",
"license": "bsd-2-clause",
"hash": -4501369263219005400,
"line_mean": 24.4,
"line_max": 112,
"alpha_frac": 0.4001895136,
"autogenerated": false,
"ratio": 3.6474654377880182,
"config_test": false,
"has_n... |
# A simple file moving module that renames the file
# to its sha1 name in the media directory
import logging
import os
import guid
from baseaction import BaseAction
from ..processingthread import na
from fileprocess.configuration import config
from shutil import move
log = logging.getLogger(__name__)
class Mover(Bas... | {
"repo_name": "JustinTulloss/harmonize.fm",
"path": "fileprocess/fileprocess/actions/mover.py",
"copies": "1",
"size": "1272",
"license": "mit",
"hash": 1788219548217119700,
"line_mean": 26.652173913,
"line_max": 71,
"alpha_frac": 0.5786163522,
"autogenerated": false,
"ratio": 4.090032154340836,
... |
# A simple file system based group store.
#
import os, binascii, shutil, json
from datetime import datetime
DEFAULT_STORE_DIR = '.groups'
STORE_FILE_SUFFIX = '.json'
class FileGroupStore():
def __init__(self, cleanup, store_dir=None):
if not store_dir:
path = os.path.abspath(__file__)
... | {
"repo_name": "xdevops/ibm-containers-emulator",
"path": "api/groupstore.py",
"copies": "1",
"size": "3623",
"license": "apache-2.0",
"hash": -3795921389462529500,
"line_mean": 31.3482142857,
"line_max": 113,
"alpha_frac": 0.5200110406,
"autogenerated": false,
"ratio": 3.7197125256673513,
"conf... |
"""A simple filter that thresholds on input data.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005, Enthought, Inc.
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Copyright (c) 2010, Enthought, Inc.
# License: BSD Style.
import numpy as np
# Enthought library imports.
from t... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/filters/threshold.py",
"copies": "3",
"size": "10670",
"license": "bsd-3-clause",
"hash": -1003981276403537200,
"line_mean": 35.9204152249,
"line_max": 94,
"alpha_frac": 0.5102155576,
"autogenerated": false,
"ratio": 4.464435146443515,
"config_tes... |
# A simple find and replace filter for mcedit.
# Credits to SethBling's original findandreplace.py which can be found here:
# http://sethbling.com/downloads/mcedit-filters/findandreplace/
# This has been rewritten and uses none of the old code from the original filter
# If there are any issues or enhancement request... | {
"repo_name": "qqii/mcedit-filters",
"path": "SimpleFindandReplace.py",
"copies": "1",
"size": "3823",
"license": "mit",
"hash": 766117001750149000,
"line_mean": 34.3981481481,
"line_max": 188,
"alpha_frac": 0.6578603191,
"autogenerated": false,
"ratio": 4.0115424973767055,
"config_test": false... |
"""A simple flow network module.
This module contains the classes and functions written to create, examine,
and solve simple problems on flow networks.
Copyright (C) 2017 Chris Digirolamo
"""
from collections import deque, OrderedDict
from decimal import Decimal
import weakref
INF = Decimal('Infinity')
... | {
"repo_name": "Digirolamo/FlowNet",
"path": "flownet/flownet.py",
"copies": "1",
"size": "13830",
"license": "mit",
"hash": -2619710601620929500,
"line_mean": 30.0138888889,
"line_max": 86,
"alpha_frac": 0.5377440347,
"autogenerated": false,
"ratio": 4.383518225039619,
"config_test": false,
"... |
# A simple FTP client.
#
# The information to write this program was gathered from RFC 959,
# but this is not a complete implementation! Yet it shows how a simple
# FTP client can be built, and you are welcome to extend it to suit
# it to your needs...
#
# How it works (assuming you've read the RFC):
#
# User... | {
"repo_name": "google/google-ctf",
"path": "third_party/edk2/AppPkg/Applications/Python/Python-2.7.2/Demo/sockets/ftp.py",
"copies": "6",
"size": "4074",
"license": "apache-2.0",
"hash": 2552150710960928300,
"line_mean": 25.904109589,
"line_max": 71,
"alpha_frac": 0.6158566519,
"autogenerated": fal... |
"""A simple garbage collection heuritics."""
# stdlib
from typing import List
from typing import Optional
from typing import TYPE_CHECKING
# third party
from typing_extensions import final
# syft relative
from ...common.uid import UID
from ...node.common.action.garbage_collect_batched_action import (
GarbageColle... | {
"repo_name": "OpenMined/PySyft",
"path": "packages/syft/src/syft/core/pointer/garbage_collection/gc_batched.py",
"copies": "1",
"size": "2439",
"license": "apache-2.0",
"hash": 691976117034972800,
"line_mean": 26.1,
"line_max": 80,
"alpha_frac": 0.6166461665,
"autogenerated": false,
"ratio": 4.2... |
"""A simple, generic table parser for HTML.
Inputs:
- source: URL or (plain) filename
- addl_data: dict of additional data to add to each row
Outputs:
- List of dicts containing data from largest table on page
@author n.o.franklin@gmail.com
@date 2017-12-30
"""
from requests import get
from bs4 import BeautifulSoup... | {
"repo_name": "UnitedThruAction/Data",
"path": "Tools/GenericTableParser.py",
"copies": "1",
"size": "1488",
"license": "apache-2.0",
"hash": 195267992053598270,
"line_mean": 26.0545454545,
"line_max": 79,
"alpha_frac": 0.6068548387,
"autogenerated": false,
"ratio": 3.576923076923077,
"config_t... |
""" A simple genetic algorithm for parameter search """
from __future__ import print_function
from collections import OrderedDict
try:
from bayes_opt import BayesianOptimization
bayes_opt_present=True
except Exception:
BayesianOptimization = None
bayes_opt_present=False
from kernel_tuner.strategies... | {
"repo_name": "benvanwerkhoven/kernel_tuner",
"path": "kernel_tuner/strategies/bayes_opt.py",
"copies": "1",
"size": "3306",
"license": "apache-2.0",
"hash": -6082363215708889000,
"line_mean": 35.3296703297,
"line_max": 109,
"alpha_frac": 0.7126436782,
"autogenerated": false,
"ratio": 3.735593220... |
"""A simple GeoHash implementation."""
# Forward and reverse base 32 map
BASESEQUENCE = '0123456789bcdefghjkmnpqrstuvwxyz'
BASE32MAP = dict((k,count) for count,k in enumerate(BASESEQUENCE))
BASE32MAPR = dict((count,k) for count,k in enumerate(BASESEQUENCE))
def _bits_to_float(bits, lower=-90.0, middle=0.0, upper=90.0... | {
"repo_name": "transitland/mapzen-geohash",
"path": "mzgeohash/geohash.py",
"copies": "3",
"size": "4215",
"license": "mit",
"hash": 7292947793124478000,
"line_mean": 30.6917293233,
"line_max": 84,
"alpha_frac": 0.628232503,
"autogenerated": false,
"ratio": 2.8288590604026846,
"config_test": fa... |
"""A simple Google-style logging wrapper."""
import logging
import time
import traceback
import os
import sys
def format_message(record):
try:
record_message = '%s' % (record.msg % record.args)
except TypeError:
record_message = record.msg
return record_message
class GlogFormatter(loggin... | {
"repo_name": "Chilledheart/vim-clangd",
"path": "python/clangd/glog.py",
"copies": "1",
"size": "6659",
"license": "bsd-3-clause",
"hash": 6286148477272031000,
"line_mean": 27.952173913,
"line_max": 90,
"alpha_frac": 0.584472143,
"autogenerated": false,
"ratio": 3.5724248927038627,
"config_tes... |
"""A simple Google-style logging wrapper."""
import logging
import time
import traceback
import os
import sys
import gflags
gflags.DEFINE_string('log_path',
os.path.expanduser('~/.config/windycode/logs/pywdc.log'), 'Log path')
import gflags as flags
FLAGS = flags.FLAGS
def format_message(record):
try:
... | {
"repo_name": "Chilledheart/windycode",
"path": "python/glog.py",
"copies": "1",
"size": "7070",
"license": "bsd-3-clause",
"hash": 7727933797591473000,
"line_mean": 27.28,
"line_max": 90,
"alpha_frac": 0.6024045262,
"autogenerated": false,
"ratio": 3.590655154900965,
"config_test": false,
"h... |
"""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... | {
"repo_name": "benley/python-glog",
"path": "glog.py",
"copies": "1",
"size": "7080",
"license": "bsd-2-clause",
"hash": 2898157753807107600,
"line_mean": 27.6639676113,
"line_max": 90,
"alpha_frac": 0.5997175141,
"autogenerated": false,
"ratio": 3.6177823198773633,
"config_test": false,
"has... |
"""A simple grid plane module.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005, Enthought, Inc.
# License: BSD Style.
# Enthought library imports.
from traits.api import Instance
from traitsui.api import View, Group, Item
# Local imports
from mayavi.core.module import Module
from mayav... | {
"repo_name": "alexandreleroux/mayavi",
"path": "mayavi/modules/grid_plane.py",
"copies": "3",
"size": "3923",
"license": "bsd-3-clause",
"hash": -8398159045276610000,
"line_mean": 34.3423423423,
"line_max": 74,
"alpha_frac": 0.5388733112,
"autogenerated": false,
"ratio": 4.648104265402844,
"co... |
"""A simple guestbook app to test parts of NDB end-to-end."""
import cgi
import logging
import os
import re
import sys
import time
from google.appengine.api import urlfetch
from google.appengine.api import users
from google.appengine.datastore import entity_pb
from google.appengine.ext import webapp
from google.appen... | {
"repo_name": "bslatkin/8-bits",
"path": "appengine-ndb/demo/main.py",
"copies": "1",
"size": "6974",
"license": "apache-2.0",
"hash": -7432421329148439000,
"line_mean": 26.4566929134,
"line_max": 75,
"alpha_frac": 0.6036707772,
"autogenerated": false,
"ratio": 3.6153447382063244,
"config_test"... |
"""A simple gui chat client. It's built off the simpleclient.py in the
Twisted examples, and uses TwistedRenderer to tie the GUI and network
elements together.
The GUI has two screens: LoginScreen and ChatScreen. When the Protocol
detects a server connection, it emits an event to switch to the
ChatScreen. When the Pro... | {
"repo_name": "prim/ocempgui",
"path": "doc/examples/chat/guiclient.py",
"copies": "1",
"size": "9336",
"license": "bsd-2-clause",
"hash": -5928444186705799000,
"line_mean": 37.106122449,
"line_max": 77,
"alpha_frac": 0.6485646958,
"autogenerated": false,
"ratio": 3.947568710359408,
"config_tes... |
"""A simple GUI framework for Pygame.
This framework is not meant as a competitor to PyQt or other, perhaps more
formal, GUI frameworks. Instead, pygameui is but a simple framework for game
prototypes.
The app is comprised of a stack of scenes; the top-most or current scene is
what is displayed in the window. Scenes ... | {
"repo_name": "fictorial/pygameui",
"path": "pygameui/__init__.py",
"copies": "2",
"size": "4921",
"license": "mit",
"hash": 7732615115943387000,
"line_mean": 30.7483870968,
"line_max": 79,
"alpha_frac": 0.6189798821,
"autogenerated": false,
"ratio": 3.8962787015043547,
"config_test": false,
... |
# A simple hash table implementation for learning purposes. You shouldn't actually use this in real code! Python provides a much better implementation with the default dictionary datatype.
class ExampleHashTable(object):
def __init__(self, buckets, hash_function=None):
self.buckets = []
for x in range(buckets):
... | {
"repo_name": "ross-t/python-ds",
"path": "Tables/hashtable.py",
"copies": "1",
"size": "1818",
"license": "mit",
"hash": 8384190014543952000,
"line_mean": 43.3658536585,
"line_max": 197,
"alpha_frac": 0.7227722772,
"autogenerated": false,
"ratio": 3.543859649122807,
"config_test": false,
"ha... |
""" A simple helloworld example
Different workflows are shown here.
"""
from tensorflow import keras
from tensorflow.keras import layers
from keras_tuner.engine.hypermodel import HyperModel
from keras_tuner.engine.hyperparameters import HyperParameters
from keras_tuner.tuners import RandomSearch
(x, y), (val_x, val_... | {
"repo_name": "keras-team/keras-tuner",
"path": "examples/helloworld.py",
"copies": "1",
"size": "7597",
"license": "apache-2.0",
"hash": -2690607335480103400,
"line_mean": 23.6655844156,
"line_max": 84,
"alpha_frac": 0.6103725155,
"autogenerated": false,
"ratio": 3.32472647702407,
"config_test... |
# A simple hello-world example to create a bar graph
import svgdatashapes as s
def example0():
mydata = [ { 'name':'Group A', 'value':38.4 },
{ 'name':'Group B', 'value':67.4 },
{ 'name':'Group C', 'value':49.2 } ]
# get a unique list of the categories for the X axis
cats... | {
"repo_name": "grubbcode/minplot",
"path": "examples/e0.py",
"copies": "2",
"size": "1465",
"license": "mit",
"hash": 5497286994679236000,
"line_mean": 33.0697674419,
"line_max": 83,
"alpha_frac": 0.6027303754,
"autogenerated": false,
"ratio": 3.0520833333333335,
"config_test": false,
"has_no... |
"""A simple 'hello world' sample, which accesses the 'users' service,
and shows how to get information about the current instance.
"""
import logging
import os
import jinja2
import webapp2
from google.appengine.api import app_identity
from google.appengine.api import modules
from google.appengine.api import users
J... | {
"repo_name": "bshaffer/appengine-python-vm-hello",
"path": "main.py",
"copies": "4",
"size": "2207",
"license": "apache-2.0",
"hash": -3304512769843511000,
"line_mean": 30.5285714286,
"line_max": 95,
"alpha_frac": 0.6221114635,
"autogenerated": false,
"ratio": 3.9837545126353793,
"config_test"... |
"""A simple 'hello world' sample, which includes examples of start/stop
handlers, accesses the 'users' service, and shows how to get information about
the current instance.
"""
import logging
import os
import time
import jinja2
import webapp2
from google.appengine.api import app_identity
from google.appengine.api im... | {
"repo_name": "tmatsuo/appengine-python-vm-urlfetch-timeout",
"path": "main.py",
"copies": "1",
"size": "2598",
"license": "apache-2.0",
"hash": 747354666383578600,
"line_mean": 28.5227272727,
"line_max": 80,
"alpha_frac": 0.6485758276,
"autogenerated": false,
"ratio": 3.826215022091311,
"confi... |
"""A simple html INPUT field that acts as a trap for spambots. The general spam-bot
fills in any field there is, ignoring CSS rules and even sometimes falling in a
INPUT TYPE=hidden trap field.
This plugin was based on MathCaptcha by Rob McMullen, which in turn based
database setup code off of BSD licensed TicketModer... | {
"repo_name": "Puppet-Finland/trac",
"path": "files/inputfieldtrapplugin/0.11/inputfieldtrap/InputfieldTrap.py",
"copies": "1",
"size": "3083",
"license": "bsd-2-clause",
"hash": -7791256584193979000,
"line_mean": 37.0617283951,
"line_max": 94,
"alpha_frac": 0.6772624067,
"autogenerated": false,
... |
"""A simple HTML parser based on sgmllib's SGMLParser."""
from sgmllib import SGMLParser
class SimpleHTMLParser(SGMLParser):
"""A simple HTML parser based on sgmllib's SGMLParser."""
def __init__(self):
SGMLParser.__init__(self)
self.hyperlinks = []
def reset(self):
SGMLP... | {
"repo_name": "nitsas/simple-web-search-engine",
"path": "html_parser.py",
"copies": "1",
"size": "1139",
"license": "mit",
"hash": 9103577271141191000,
"line_mean": 20.4905660377,
"line_max": 61,
"alpha_frac": 0.5434591747,
"autogenerated": false,
"ratio": 4.141818181818182,
"config_test": fal... |
# A simple HTML table parser. It turns tables (including nested tables) into arrays
# Nigel Sim <nigel.sim@gmail.com>
# http://simbot.wordpress.com
from HTMLParser import HTMLParser
import re, os
from string import lower
class Table(list):
pass
class Row(list):
pass
class Cell(object):
def __init__(sel... | {
"repo_name": "quoter/protocoller",
"path": "src/protocoller/miner/html_parser.py",
"copies": "1",
"size": "3054",
"license": "mit",
"hash": 2376339353107459000,
"line_mean": 24.2396694215,
"line_max": 85,
"alpha_frac": 0.5671250819,
"autogenerated": false,
"ratio": 3.5265588914549655,
"config_... |
# A simple HTML table parser. It turns tables (including nested tables) into arrays
# Nigel Sim <nigel.sim@gmail.com>
# http://simbot.wordpress.com
from HTMLParser import HTMLParser
import re, string, os
from string import lower
class Table(list):
pass
class Row(list):
pass
class Cell(object):
def __... | {
"repo_name": "sniemi/SamPy",
"path": "sandbox/src/TableParse.py",
"copies": "1",
"size": "2874",
"license": "bsd-2-clause",
"hash": 8216635403772872000,
"line_mean": 26.6346153846,
"line_max": 92,
"alpha_frac": 0.5354906054,
"autogenerated": false,
"ratio": 3.936986301369863,
"config_test": fa... |
"""A simple HTTP/2 file server."""
from functools import partial
import logging
import os.path
import urllib.parse
import sys
import curio
import curio.io
from garage import asyncs
from garage.asyncs.utils import make_server_socket, serve
import http2
async def handle(sock, addr):
session = http2.Session(sock... | {
"repo_name": "clchiou/garage",
"path": "py/http2/examples/simple_server.py",
"copies": "1",
"size": "2455",
"license": "mit",
"hash": -5833332669108239000,
"line_mean": 30.4743589744,
"line_max": 79,
"alpha_frac": 0.5515274949,
"autogenerated": false,
"ratio": 4.119127516778524,
"config_test":... |
"""A simple HTTP client which mixes httplib with gevent and PayPal protecteds.
It provides convenience functions for the standard set of `HTTP methods`_:
>>> http_client.get('http://example.com/foo') # doctest: +SKIP
which are just shortcuts for the corresponding :py:func:`request` call:
>>> http_client.request("ge... | {
"repo_name": "paypal/support",
"path": "support/http_client.py",
"copies": "1",
"size": "13326",
"license": "bsd-3-clause",
"hash": 1613965136536507000,
"line_mean": 31.742014742,
"line_max": 90,
"alpha_frac": 0.6010055531,
"autogenerated": false,
"ratio": 4.169586983729662,
"config_test": fal... |
# a simple http server for an adventure game
# vim: et sw=2 ts=2 sts=2
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from advent import Game
import time
import urlparse
# add games here. As long as they follow the example, they will appear in the drop down menu.
import http_game
# globals
games = {}... | {
"repo_name": "sleepinghungry/wwif",
"path": "bwx_adventure/advent_http.py",
"copies": "3",
"size": "4289",
"license": "mit",
"hash": 9041582820610122000,
"line_mean": 32.2480620155,
"line_max": 261,
"alpha_frac": 0.6248542784,
"autogenerated": false,
"ratio": 3.4257188498402558,
"config_test":... |
# A simple HTTP server implemented using h11 and Trio:
# http://trio.readthedocs.io/en/latest/index.html
# (so requires python 3.5+).
#
# All requests get echoed back a JSON document containing information about
# the request.
#
# This is a rather involved example, since it attempts to both be
# fully-HTTP-compliant ... | {
"repo_name": "python-hyper/h11",
"path": "examples/trio-server.py",
"copies": "1",
"size": "13993",
"license": "mit",
"hash": -7272696534125454000,
"line_mean": 41.021021021,
"line_max": 84,
"alpha_frac": 0.6341027657,
"autogenerated": false,
"ratio": 4.160868272375855,
"config_test": false,
... |
"""A simple ImagePlaneWidget module to view image data.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005-2015, Enthought, Inc.
# License: BSD Style.
# Enthought library imports.
from traits.api import Instance, Bool, on_trait_change
from traitsui.api import View, Group, Item
from tvtk.ap... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/modules/image_plane_widget.py",
"copies": "1",
"size": "4599",
"license": "bsd-3-clause",
"hash": -6773647079528875000,
"line_mean": 35.792,
"line_max": 75,
"alpha_frac": 0.5298978039,
"autogenerated": false,
"ratio": 4.622110552763819,
"config_te... |
"""A simple ImagePlaneWidget module to view image data.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005, Enthought, Inc.
# License: BSD Style.
# Enthought library imports.
from traits.api import Instance, Bool, on_trait_change
from traitsui.api import View, Group, Item
from tvtk.api imp... | {
"repo_name": "liulion/mayavi",
"path": "mayavi/modules/image_plane_widget.py",
"copies": "2",
"size": "4597",
"license": "bsd-3-clause",
"hash": -4210866002973421600,
"line_mean": 34.9140625,
"line_max": 75,
"alpha_frac": 0.5292582119,
"autogenerated": false,
"ratio": 4.634072580645161,
"confi... |
"""A simple implementation of a greedy transition-based parser. Released under BSD license."""
from os import path
import os
import sys
from collections import defaultdict
import random
import time
import pickle
SHIFT = 0; RIGHT = 1; LEFT = 2;
MOVES = (SHIFT, RIGHT, LEFT)
START = ['-START-', '-START2-']
END = ['-END-'... | {
"repo_name": "mdda/ConciseGreedyDependencyParser-in-Scala",
"path": "python/honnibal-original-gist.py",
"copies": "1",
"size": "18445",
"license": "mit",
"hash": -4045423303082530300,
"line_mean": 34.5394990366,
"line_max": 94,
"alpha_frac": 0.5520737327,
"autogenerated": false,
"ratio": 3.20894... |
"""A simple implementation of a greedy transition-based parser. Released under BSD license."""
from os import path
import os
import sys
from collections import defaultdict
import random
import time
import pickle
import re # For sentence splitting only
SHIFT = 0; RIGHT = 1; LEFT = 2;
MOVES = (SHIFT, RIGHT, LEFT)
STA... | {
"repo_name": "mdda/ConciseGreedyDependencyParser-in-Scala",
"path": "python/concise-greedy-dependency-parser.py",
"copies": "1",
"size": "27187",
"license": "mit",
"hash": 6939710676246888000,
"line_mean": 38.2875722543,
"line_max": 241,
"alpha_frac": 0.5703829036,
"autogenerated": false,
"ratio... |
'''A simple implementation of a LRU dict that supports discarding by maximum
capacity and by maximum time not being used.'''
from collections import OrderedDict
import time
class LRUDict(OrderedDict):
'''An dict that can discard least-recently-used items, either by maximum capacity
or by time to live.
An ... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/580645_LRU_dictionary/recipe-580645.py",
"copies": "2",
"size": "3488",
"license": "mit",
"hash": -4153105808697327600,
"line_mean": 32.5384615385,
"line_max": 86,
"alpha_frac": 0.5688073394,
"autogenerated": false,
"ratio": 4.065268065268... |
"""A simple implementation of the quick hull algorithm.
Usually you should only need the L{qhull3d} function, although the module
contains some potentially useful helper functions as well.
Examples
========
Tetrahedron
-----------
>>> import random
>>> tetrahedron = [(0,0,0),(1,0,0),(0,1,0),(0,0,1)]
>>> for i in ra... | {
"repo_name": "griest024/PokyrimTools",
"path": "pyffi-develop/pyffi/utils/quickhull.py",
"copies": "1",
"size": "15381",
"license": "mit",
"hash": -7011242747924011000,
"line_mean": 36.2421307506,
"line_max": 86,
"alpha_frac": 0.6079578701,
"autogenerated": false,
"ratio": 3.6858375269590224,
... |
"""A simple implementation of the specification patter"""
class CompositeQuery(object):
"""Base class for the specification"""
def conjoin(self, other):
"""ConjunctionQuery factory"""
return ConjunctionQuery(self, other)
def __and__(self, other):
return self.conjoin(other)
def ... | {
"repo_name": "myemma/EmmaPython",
"path": "emma/query/spec.py",
"copies": "1",
"size": "1390",
"license": "mit",
"hash": 3574405324476459500,
"line_mean": 26.82,
"line_max": 65,
"alpha_frac": 0.6215827338,
"autogenerated": false,
"ratio": 3.9942528735632186,
"config_test": false,
"has_no_key... |
# a simple implementation to find the longest repeat in a string
import collections
import sys
def extend(a, b, k, s, mm=0):
# extend maximum distance with remaining mismatches
lhs_mm = mm
lhs_dist = []
for offset in xrange(-1, max(-a, -b), -1):
if s[a+offset] != s[b+offset]:
lhs_dist.append( -offset... | {
"repo_name": "supernifty/mgsa",
"path": "mgsa/longest_repeat_mismatches.py",
"copies": "1",
"size": "1533",
"license": "mit",
"hash": -8423077541689592000,
"line_mean": 22.2272727273,
"line_max": 64,
"alpha_frac": 0.5609915199,
"autogenerated": false,
"ratio": 2.8232044198895028,
"config_test"... |
# a simple implementation to find the longest repeat in a string
import sys
def lcp(a, b):
for i in xrange(min(len(a), len(b))):
if a[i] != b[i]:
break
return a[:i]
# build suffixes, sort them
def lrs(s):
suffixes = []
total = len(s)
print "building suffixes for %i..." % total
for i in xrange(to... | {
"repo_name": "supernifty/mgsa",
"path": "mgsa/longest_repeat.py",
"copies": "1",
"size": "1116",
"license": "mit",
"hash": 6615417280296163000,
"line_mean": 22.25,
"line_max": 71,
"alpha_frac": 0.5689964158,
"autogenerated": false,
"ratio": 3.032608695652174,
"config_test": false,
"has_no_ke... |
# A simple in-memory stats library
#
# Inspired by statsd: http://statsd.readthedocs.io/en/v3.1/types.html#gauges
import collections
import json
import logging
import numbers
import numpy as np
import os
import six
import threading
import time
logger = logging.getLogger(__name__)
BYTES = 'bytes'
SECONDS = 'seconds'
... | {
"repo_name": "rht/universe",
"path": "universe/pyprofile/__init__.py",
"copies": "1",
"size": "11881",
"license": "mit",
"hash": 7341790642809417000,
"line_mean": 29.2315521628,
"line_max": 98,
"alpha_frac": 0.5071121959,
"autogenerated": false,
"ratio": 4.019282814614344,
"config_test": false... |
"""A simple inspector overlay for plots
This module provides the SimpleInspectorOverlay for displaying
information gathered from an inspector tool in a TextGrid. By default
it is configured to work with a SimpleInspectorTool.
The module also provides some helper factory functions for creating text
formatters for dic... | {
"repo_name": "ContinuumIO/chaco",
"path": "chaco/overlays/simple_inspector_overlay.py",
"copies": "3",
"size": "6043",
"license": "bsd-3-clause",
"hash": 1583001544072534800,
"line_mean": 30.4739583333,
"line_max": 83,
"alpha_frac": 0.647029621,
"autogenerated": false,
"ratio": 4.540195341848235... |
"""A simple interface for executing bytecodes over a Bluetooth serial port.
From the lms2012 source code documentation:
Beside running user programs the VM is able to execute direct commands from
the Communication Module. In fact direct commands are small programs that
consist of regular byte codes and they are execu... | {
"repo_name": "inductivekickback/ev3",
"path": "ev3/direct_command.py",
"copies": "1",
"size": "72705",
"license": "mit",
"hash": -2377102040094439400,
"line_mean": 31.8535924085,
"line_max": 80,
"alpha_frac": 0.5311464136,
"autogenerated": false,
"ratio": 3.658481356614502,
"config_test": fals... |
"""A simple interface for SNMP sessions."""
import collections
# TODO(soltesz): replace netsnmp with easysnmp when available.
import netsnmp
class Error(Exception):
"""Base error class for simple_session module."""
pass
class SNMPError(Error):
"""A netsnmp error occurred or no results returned."""
... | {
"repo_name": "stephen-soltesz/collectd-mlab",
"path": "site-packages/mlab/disco/simple_session.py",
"copies": "2",
"size": "4161",
"license": "apache-2.0",
"hash": 6345156311470757000,
"line_mean": 28.9352517986,
"line_max": 80,
"alpha_frac": 0.6207642394,
"autogenerated": false,
"ratio": 4.1198... |
"""A simple invertible tokenizer.
Converts from a unicode string to a list of tokens
(represented as Unicode strings).
This tokenizer has the following desirable properties:
- It is invertible.
- Alphanumeric characters are broken away from non-alphanumeric characters.
- A single space between words does not produ... | {
"repo_name": "mlperf/training_results_v0.6",
"path": "Google/benchmarks/transformer/implementations/tpu-v3-256-transformer/transformer/data_generators/tokenizer.py",
"copies": "6",
"size": "5545",
"license": "apache-2.0",
"hash": -1107554320739040400,
"line_mean": 29.9776536313,
"line_max": 80,
"alp... |
"""A simple IRC bot for Twitch.
First things first, you need the Username and OAuth token of the account you
want to login with. Typically this would be for your bot, but you can login with
any Twitch account.
You can get your OAuth token from: http://twitchapps.com/tmi/
A standard bot would look like this:
use... | {
"repo_name": "VoxelDavid/twitch-bot",
"path": "twitchbot/bot.py",
"copies": "1",
"size": "4141",
"license": "mit",
"hash": 4507125435728963600,
"line_mean": 34.093220339,
"line_max": 80,
"alpha_frac": 0.5933349433,
"autogenerated": false,
"ratio": 3.932573599240266,
"config_test": false,
"ha... |
"""A simple library for serializing data to disk and allowing random
access.
Probably best not to use this-- either straightforward pickling or a
"proper" scientific format like netCDF or HDF.
I don't think any subgrid runs use this, but I can't be sure.
"""
import cPickle
import os.path
# i.e. 0.5GB
MAXFILESIZE = ... | {
"repo_name": "rupertnash/subgrid",
"path": "python/dqTools/recordDB.py",
"copies": "2",
"size": "10739",
"license": "mit",
"hash": 5705073775978799000,
"line_mean": 25.7805486284,
"line_max": 78,
"alpha_frac": 0.4905484682,
"autogenerated": false,
"ratio": 3.8463467048710602,
"config_test": fa... |
""" A simple lisp parser for SICP exercises
"""
import re
__all__ = ["parse"]
SPECIEAL_TOKENS = {"'": 'quote',
".": 'dot',}
def tokenize(expr):
regex = re.compile("""(
'| # quote
\(| # left paren
\)| # right paren
... | {
"repo_name": "nalssee/SICP",
"path": "lisp_parser/lp.py",
"copies": "1",
"size": "1723",
"license": "mit",
"hash": -952616051426504400,
"line_mean": 25.1060606061,
"line_max": 76,
"alpha_frac": 0.5153801509,
"autogenerated": false,
"ratio": 3.924829157175399,
"config_test": false,
"has_no_ke... |
""" A simple list box widget with a model-view architecture. """
from __future__ import absolute_import
# Major package imports.
import wx
# Enthought library imports.
from traits.api import Event, Instance, Int
# Local imports.
from .list_box_model import ListBoxModel
from .widget import Widget
class ListBox(Widg... | {
"repo_name": "brett-patterson/pyface",
"path": "pyface/list_box.py",
"copies": "3",
"size": "4046",
"license": "bsd-3-clause",
"hash": 1018576587597123600,
"line_mean": 26.9034482759,
"line_max": 79,
"alpha_frac": 0.4634206624,
"autogenerated": false,
"ratio": 5.01363073110285,
"config_test": ... |
""" A simple list box widget with a model-view architecture. """
# Major package imports.
import wx
# Enthought library imports.
from enthought.traits.api import Event, Instance, Int
# Local imports.
from list_box_model import ListBoxModel
from widget import Widget
class ListBox(Widget):
""" A simple list box... | {
"repo_name": "enthought/traitsgui",
"path": "enthought/pyface/list_box.py",
"copies": "1",
"size": "4016",
"license": "bsd-3-clause",
"hash": -755547686109574100,
"line_mean": 26.6965517241,
"line_max": 79,
"alpha_frac": 0.4616533865,
"autogenerated": false,
"ratio": 5.02,
"config_test": false... |
# A simple loadtest using locust.
# launch using: locust -f simpleloadtest.py --host=http://pencilcode.net
from locust import HttpLocust, TaskSet, task
import simplejson, random, os, resource, string, re
resource.setrlimit(resource.RLIMIT_NOFILE, (65536, 65536))
hosts = os.environ.get('SERVERS').split(',')
passfile... | {
"repo_name": "sakagg/pencilcode",
"path": "admin/simpleloadtest.py",
"copies": "7",
"size": "4009",
"license": "mit",
"hash": 8890432482637129000,
"line_mean": 30.5669291339,
"line_max": 75,
"alpha_frac": 0.5535046146,
"autogenerated": false,
"ratio": 3.510507880910683,
"config_test": false,
... |
"""A simple logger that logs to file and console"""
from logging import (getLogger,
FileHandler,
StreamHandler,
DEBUG,
Formatter,
Filter)
from gobble.config import settings, GOBBLE_MODE
class MultilineFilter(Filt... | {
"repo_name": "openspending/gobble",
"path": "gobble/logger.py",
"copies": "1",
"size": "1691",
"license": "mit",
"hash": -7323440387916573000,
"line_mean": 25.8412698413,
"line_max": 67,
"alpha_frac": 0.6339444116,
"autogenerated": false,
"ratio": 4.206467661691542,
"config_test": false,
"ha... |
"""A simple log mechanism styled after PEP 282."""
# The class here is styled after PEP 282 so that it could later be
# replaced with a standard Python logging implementation.
DEBUG = 1
INFO = 2
WARN = 3
ERROR = 4
FATAL = 5
import sys
class Log:
def __init__(self, threshold=WARN):
self.threshold = thre... | {
"repo_name": "RO-ny9/python-for-android",
"path": "python3-alpha/python3-src/Lib/distutils/log.py",
"copies": "163",
"size": "1908",
"license": "apache-2.0",
"hash": -6223391399144870000,
"line_mean": 24.44,
"line_max": 79,
"alpha_frac": 0.5775681342,
"autogenerated": false,
"ratio": 3.655172413... |
"""A simple log mechanism styled after PEP 282."""
# This module should be kept compatible with Python 1.5.2.
# The class here is styled after PEP 282 so that it could later be
# replaced with a standard Python logging implementation.
DEBUG = 1
INFO = 2
WARN = 3
ERROR = 4
FATAL = 5
import sys
class Log:
def _... | {
"repo_name": "OS2World/APP-INTERNET-torpak_2",
"path": "Lib/distutils/log.py",
"copies": "3",
"size": "1345",
"license": "mit",
"hash": 9007253038514518000,
"line_mean": 21.0491803279,
"line_max": 66,
"alpha_frac": 0.6007434944,
"autogenerated": false,
"ratio": 3.345771144278607,
"config_test"... |
"""A simple log mechanism styled after PEP 282."""
# This module should be kept compatible with Python 2.1.
# The class here is styled after PEP 282 so that it could later be
# replaced with a standard Python logging implementation.
DEBUG = 1
INFO = 2
WARN = 3
ERROR = 4
FATAL = 5
import sys
class Log:
def __i... | {
"repo_name": "abaditsegay/arangodb",
"path": "3rdParty/V8-4.3.61/third_party/python_26/Lib/distutils/log.py",
"copies": "146",
"size": "1606",
"license": "apache-2.0",
"hash": 4936593748975834000,
"line_mean": 22.2753623188,
"line_max": 66,
"alpha_frac": 0.5890410959,
"autogenerated": false,
"ra... |
"""A simple log mechanism styled after PEP 282."""
# This module should be kept compatible with Python 2.1.
# The class here is styled after PEP 282 so that it could later be
# replaced with a standard Python logging implementation.
DEBUG = 1
INFO = 2
WARN = 3
ERROR = 4
FATAL = 5
import sys
class Lo... | {
"repo_name": "babyliynfg/cross",
"path": "tools/project-creator/Python2.6.6/Lib/distutils/log.py",
"copies": "4",
"size": "1675",
"license": "mit",
"hash": -2784889648690216000,
"line_mean": 22.2753623188,
"line_max": 66,
"alpha_frac": 0.5647761194,
"autogenerated": false,
"ratio": 3.58672376873... |
"""A simple management script."""
import os
import random
import string
if os.path.exists('.env'):
for line in open('.env'):
var = line.strip().split('=')
if len(var) == 2:
os.environ[var[0]] = var[1]
from wonk import create_app
app = create_app(os.getenv('FLASK_CONFIG') or 'default'... | {
"repo_name": "beylsp/wonk-server",
"path": "manage.py",
"copies": "1",
"size": "1225",
"license": "mit",
"hash": 9123895510896137000,
"line_mean": 20.875,
"line_max": 72,
"alpha_frac": 0.6114285714,
"autogenerated": false,
"ratio": 3.4801136363636362,
"config_test": false,
"has_no_keywords":... |
""" A simple manager for a task queue.
The manager handles creating, submitting, and managing
running jobs, and can even resubmit jobs that have failed.
author: Brian Schrader
since: 2015-08-27
"""
from .reporting import BaseReportingMixin, HtmlReportingMixin, TextReportingMixin
from .job_template import JobTemplate
... | {
"repo_name": "TorkamaniLab/metapipe",
"path": "metapipe/models/queue.py",
"copies": "2",
"size": "7561",
"license": "mit",
"hash": -4920973104499271000,
"line_mean": 31.4506437768,
"line_max": 84,
"alpha_frac": 0.5557465944,
"autogenerated": false,
"ratio": 4.235854341736695,
"config_test": fa... |
"""A simple mapping between keys and values, but with a limited capacity. When
the max. capacity is reached, the first inserted key/value pair is deleted
"""
# Copyright (c) 2009-2014, Aalborg University (chr@cs.aau.dk)
# All rights reserved.
# Redistribution and use in source anqd binary forms, with or without
# ... | {
"repo_name": "haleemur/pygrametl-python3",
"path": "pygrametl/FIFODict.py",
"copies": "1",
"size": "5160",
"license": "bsd-2-clause",
"hash": 7592236033727209000,
"line_mean": 37.5074626866,
"line_max": 85,
"alpha_frac": 0.6251937984,
"autogenerated": false,
"ratio": 4.3035863219349455,
"confi... |
"""A simple mapping between keys and values, but with a limited capacity. When
the max. capacity is reached, the first inserted key/value pair is deleted
"""
# Copyright (c) 2009-2020, Aalborg University (pygrametl@cs.aau.dk)
# All rights reserved.
# Redistribution and use in source anqd binary forms, with or with... | {
"repo_name": "chrthomsen/pygrametl",
"path": "pygrametl/FIFODict.py",
"copies": "1",
"size": "8707",
"license": "bsd-2-clause",
"hash": 1129533932957132300,
"line_mean": 35.2791666667,
"line_max": 80,
"alpha_frac": 0.6084759389,
"autogenerated": false,
"ratio": 4.338315894369706,
"config_test"... |
"""A simple markov chain text generator."""
import random
import requests
class MarkovGenerator():
"""Pass the input string into the constructor."""
def __init__(self, string: str):
self.words = string.split()
self.number_of_words = len(self.words)
self.word_cache = {}
self.fill... | {
"repo_name": "DualSaturn/server-observer",
"path": "markov_generator.py",
"copies": "1",
"size": "1842",
"license": "mit",
"hash": -9107465236463776000,
"line_mean": 38.1914893617,
"line_max": 88,
"alpha_frac": 0.605320304,
"autogenerated": false,
"ratio": 3.6403162055335967,
"config_test": fa... |
# A simple math addition game
# tutorial at www.techwooten.com
# import random number generator
from random import randint
from player import Player
# use input function to get the players name
name = input('Hello, may I have your name? ')
# create a new Player Object
player = Player(name)
# greet the player
print(... | {
"repo_name": "techwooten/PythonMathGame",
"path": "v4/main.py",
"copies": "1",
"size": "2850",
"license": "mit",
"hash": 7323794156399576000,
"line_mean": 38.0410958904,
"line_max": 112,
"alpha_frac": 0.5305263158,
"autogenerated": false,
"ratio": 4.404945904173107,
"config_test": false,
"ha... |
# A simple math addition game
# tutorial at www.techwooten.com
# import random number generator
from random import randint
class Player:
__score = 0
__name = ''
def __init__(self, name):
self.__score = 0
self.__name = name
def set_name(self, name):
self.__name = name
de... | {
"repo_name": "techwooten/PythonMathGame",
"path": "v3/main.py",
"copies": "1",
"size": "2957",
"license": "mit",
"hash": 3544924494136757000,
"line_mean": 32.2247191011,
"line_max": 113,
"alpha_frac": 0.5326344268,
"autogenerated": false,
"ratio": 4.329428989751098,
"config_test": false,
"ha... |
# A simple math addition game
# tutorial at www.techwooten.com
# import random number generator
from random import randint
# use input function to get the players name
name = input('Hello, may I have your name? ')
# used to track score
score = 0
# greet the player
print('Hello, ' + name + '\n')
# this function us... | {
"repo_name": "techwooten/PythonMathGame",
"path": "v1/main.py",
"copies": "1",
"size": "1220",
"license": "mit",
"hash": -5676428521059782000,
"line_mean": 32.8888888889,
"line_max": 100,
"alpha_frac": 0.6573770492,
"autogenerated": false,
"ratio": 3.6526946107784433,
"config_test": false,
"... |
"""A simple memcache-like server.
The basic data structure maintained is a single in-memory dictionary
mapping string keys to string values, with operations get, set and
delete. (Both keys and values may contain Unicode.)
This is a TCP server listening on port 54321. There is no
authentication.
Requests provide an... | {
"repo_name": "gvanrossum/asyncio",
"path": "examples/cachesvr.py",
"copies": "9",
"size": "9404",
"license": "apache-2.0",
"hash": 7401517286410854000,
"line_mean": 36.7670682731,
"line_max": 77,
"alpha_frac": 0.6063377286,
"autogenerated": false,
"ratio": 3.967932489451477,
"config_test": fal... |
# A simple MicroBit game by Giles Booth
# Tilt and colour in all the squares
# If you win level 20, press reset button to play again
from microbit import display, accelerometer, sleep, Image
from music import play, POWER_UP, NYAN
def get_xy():
yaccel = accelerometer.get_y() * accelerometer_sensitivity
xaccel ... | {
"repo_name": "blogmywiki/tilty",
"path": "tilty.py",
"copies": "1",
"size": "1430",
"license": "mit",
"hash": 1622655304067344000,
"line_mean": 25,
"line_max": 62,
"alpha_frac": 0.6020979021,
"autogenerated": false,
"ratio": 2.900608519269777,
"config_test": false,
"has_no_keywords": false,
... |
# A simple MicroBit game by Giles Booth
# Tilt and colour in all the squares
# If you win level 20, press reset button to play again
#
# MIT License (c) 2016 Giles Booth
from microbit import display, accelerometer, sleep, Image
from music import play, POWER_UP, NYAN
def get_xy():
yaccel = accelerometer.get_y() * ... | {
"repo_name": "microbit-playground/microbit-playground.github.io",
"path": "programs/ninja/_posts/2016-02-17-tilty.py",
"copies": "1",
"size": "1458",
"license": "mit",
"hash": 4310813999682220500,
"line_mean": 24.5789473684,
"line_max": 62,
"alpha_frac": 0.6076817558,
"autogenerated": false,
"ra... |
"""A simple MNIST classifier which displays summaries in TensorBoard.
This is an unimpressive MNIST model, but it is a good example of using
tf.name_scope to make a graph legible in the TensorBoard graph explorer, and of
naming summary tags so that they are grouped meaningfully in TensorBoard.
It demonstrates the func... | {
"repo_name": "Karel-van-de-Plassche/QLKNN-develop",
"path": "tests/gen2_test_files/train_NDNN.py",
"copies": "7",
"size": "27120",
"license": "mit",
"hash": -9111721987032919000,
"line_mean": 44.2754590985,
"line_max": 165,
"alpha_frac": 0.5543879056,
"autogenerated": false,
"ratio": 3.868758915... |
"""A simple model and MCMC execution routine for exploring the properties of the
Gelman-Rubin convergence criterion."""
from pysb import *
from pysb.integrate import odesolve
from matplotlib import pyplot as plt
import numpy as np
import bayessb
import pysb.util
import pickle
# Define a simple exponential decay model... | {
"repo_name": "jmuhlich/bayessb",
"path": "examples/convergence.py",
"copies": "1",
"size": "3660",
"license": "bsd-2-clause",
"hash": 8513122733367172000,
"line_mean": 30.8260869565,
"line_max": 89,
"alpha_frac": 0.6333333333,
"autogenerated": false,
"ratio": 3.2189973614775726,
"config_test":... |
""" A simple model of a standard-compliant Microblog Feed.
This module contains wrappers for all 3 Microblog feed files
(feed, follows, blocks) and adhered to the Open Microblog
Standard. For more information see:
http://openmicroblog.com
author: Brian Schrader
since: 2015-06-01
standard-version: 0.5
"""
fro... | {
"repo_name": "Sonictherocketman/Open-Microblog",
"path": "validator.py",
"copies": "1",
"size": "8835",
"license": "mit",
"hash": -6561351702428765000,
"line_mean": 33.1992031873,
"line_max": 79,
"alpha_frac": 0.5471420487,
"autogenerated": false,
"ratio": 4.523809523809524,
"config_test": fal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.