text stringlengths 0 1.05M | meta dict |
|---|---|
#a simple model with a single hidden layer might look like this:
import numpy as np
from keras.models import Sequential
from keras.layers.core import Dense, Activation
# X has shape (num_rows, num_cols), where the training data are stored
# as row vectors
X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]], dtype=n... | {
"repo_name": "coolsgupta/machine_learning_nanodegree",
"path": "Deep_Learning/Deep_neural_networks/keras_steps.py",
"copies": "1",
"size": "1055",
"license": "mit",
"hash": 3788796258949207000,
"line_mean": 28.3333333333,
"line_max": 88,
"alpha_frac": 0.6947867299,
"autogenerated": false,
"ratio... |
"""A simple module for dealing with preferences that are used by scripts. Based almost entirely on MacPrefs.
To save some preferences:
myPrefs = RFPrefs(drive/directory/directory/myPrefs.plist)
myPrefs.myString = 'xyz'
myPrefs.myInteger = 1234
myPrefs.myList = ['a', 'b', 'c']
myPrefs.myDict = {'a':1, 'b':2}
myPrefs.sa... | {
"repo_name": "moyogo/robofab",
"path": "Lib/robofab/tools/rfPrefs.py",
"copies": "8",
"size": "3021",
"license": "bsd-3-clause",
"hash": -7774102452557674000,
"line_mean": 23.762295082,
"line_max": 108,
"alpha_frac": 0.6689837802,
"autogenerated": false,
"ratio": 2.9851778656126484,
"config_te... |
"""A simple money counting game for kids."""
import random
import sys
class Money:
def __init__(self):
pass
@staticmethod
def display_intro():
"""Display the introduction at the start of program execution."""
print('*' * 75)
print('This is a simple money countinggame to h... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/578988_Money_Game/recipe-578988.py",
"copies": "1",
"size": "7075",
"license": "mit",
"hash": 2561880338605069000,
"line_mean": 40.3742690058,
"line_max": 90,
"alpha_frac": 0.4130035336,
"autogenerated": false,
"ratio": 4.609120521172638,
... |
"""A simple monitor with alerts for Unix
"""
import argparse
import logging
import sys
from simple_monitor_alert.sma import SMA, SMAService
SMA_INI_FILE = '/etc/simple-monitor-alert/sma.ini'
MONITORS_DIR = '/etc/simple-monitor-alert/monitors-enabled/'
ALERTS_DIR = '/etc/simple-monitor-alert/alerts/'
def create_l... | {
"repo_name": "Nekmo/simple-monitor-alert",
"path": "simple_monitor_alert/management.py",
"copies": "1",
"size": "4378",
"license": "mit",
"hash": 4622013368238354000,
"line_mean": 36.4188034188,
"line_max": 106,
"alpha_frac": 0.6407035176,
"autogenerated": false,
"ratio": 3.761168384879725,
"c... |
"""A simple mool extension to bump maven dependency version in a BLD file."""
import argparse
import mool.shared_utils as su
import utils.bld_parser as bp
import utils.file_utils as fu
def _parse_command_line(program_name, cmd_line):
"""Parse command line to generate arguments."""
parser = argparse.ArgumentParse... | {
"repo_name": "rocketfuel/mool",
"path": "build_tool/bu.scripts/extensions/bump_mvn_version.py",
"copies": "1",
"size": "2989",
"license": "bsd-3-clause",
"hash": -2826822727679306000,
"line_mean": 44.2878787879,
"line_max": 77,
"alpha_frac": 0.6045500167,
"autogenerated": false,
"ratio": 3.54988... |
"""A simple multi-agent env with two agents playing rock paper scissors.
This demonstrates running the following policies in competition:
(1) heuristic policy of repeating the same move
(2) heuristic policy of beating the last opponent move
(3) LSTM/feedforward PG policies
(4) LSTM policy with custom e... | {
"repo_name": "stephanie-wang/ray",
"path": "rllib/examples/rock_paper_scissors_multiagent.py",
"copies": "1",
"size": "6325",
"license": "apache-2.0",
"hash": -485597076072613440,
"line_mean": 29.7038834951,
"line_max": 78,
"alpha_frac": 0.5397628458,
"autogenerated": false,
"ratio": 3.727165586... |
"""A simple multi-step wizard that uses the flask application session.
Creating multi-step forms of arbitrary length is simple and intuitive.
Example usage:
```
from flask.ext.wtf import FlaskForm
class MultiStepTest1(FlaskForm):
field1 = StringField(validators=[validators.DataRequired()],)
field2 = StringF... | {
"repo_name": "christabor/flask_extras",
"path": "flask_extras/forms/wizard.py",
"copies": "2",
"size": "8426",
"license": "mit",
"hash": -8154990187578291000,
"line_mean": 34.7033898305,
"line_max": 79,
"alpha_frac": 0.5954189414,
"autogenerated": false,
"ratio": 4.26417004048583,
"config_test... |
"""A simple music-representation language suitable for hymn tunes,
part-songs, and other brief, vocal-style works.
"""
# TODO: figure out how to make fermatas in bass staves upside-down in
# the template
import codecs
import copy
from parsimonious import Grammar, NodeVisitor
from doremi.lilypond import *
from dore... | {
"repo_name": "JasonFruit/doremi",
"path": "doremi/doremi_parser.py",
"copies": "1",
"size": "12775",
"license": "mit",
"hash": -1205490265218397200,
"line_mean": 33.3413978495,
"line_max": 77,
"alpha_frac": 0.5135029354,
"autogenerated": false,
"ratio": 4.109038275972981,
"config_test": false,... |
"""A simple Naive-Bayes classifier designed to train on any number of features,
and then classify documents into one of two mutually exclusive categories.
Implements the algorithm described for spam filtering here:
http://en.wikipedia.org/wiki/Naive_Bayes_classifier#Document_classification
"""
from collections import ... | {
"repo_name": "sbrother/chn-machine-learning-talk",
"path": "classifier.py",
"copies": "1",
"size": "1960",
"license": "mit",
"hash": -5624954487269544000,
"line_mean": 48,
"line_max": 89,
"alpha_frac": 0.6336734694,
"autogenerated": false,
"ratio": 3.9918533604887982,
"config_test": false,
"... |
# A simple neural network which learns XOR using back propagation.
import random
from math import exp
# See wikipedia for the neural network structure
# http://en.wikipedia.org/wiki/Feedforward_neural_network
# http://en.wikipedia.org/wiki/File:XOR_perceptron_net.png
# Pitiful inline diagram:
# z-b3 ... | {
"repo_name": "devinplatt/XOR-neural-network",
"path": "xor.py",
"copies": "1",
"size": "3954",
"license": "mit",
"hash": 2425651085025210000,
"line_mean": 28.7293233083,
"line_max": 71,
"alpha_frac": 0.5510875063,
"autogenerated": false,
"ratio": 2.496212121212121,
"config_test": false,
"has... |
"""A simple number and datetime addition JSON API.
Demonstrates different strategies for parsing arguments
with the FalconParser.
Run the app:
$ pip install gunicorn
$ gunicorn examples.falcon_example:app
Try the following with httpie (a cURL-like utility, http://httpie.org):
$ pip install httpie
$ ... | {
"repo_name": "sloria/webargs",
"path": "examples/falcon_example.py",
"copies": "1",
"size": "2623",
"license": "mit",
"hash": 3976010312239829500,
"line_mean": 26.9042553191,
"line_max": 85,
"alpha_frac": 0.6359130766,
"autogenerated": false,
"ratio": 3.492676431424767,
"config_test": false,
... |
"""A simple number and datetime addition JSON API.
Run the app:
$ python examples/aiohttp_example.py
Try the following with httpie (a cURL-like utility, http://httpie.org):
$ pip install httpie
$ http GET :5001/
$ http GET :5001/ name==Ada
$ http POST :5001/add x=40 y=2
$ http POST :5001/date... | {
"repo_name": "Basis/webargs",
"path": "examples/aiohttp_example.py",
"copies": "1",
"size": "2624",
"license": "mit",
"hash": -8257689671009240000,
"line_mean": 26.914893617,
"line_max": 84,
"alpha_frac": 0.6459603659,
"autogenerated": false,
"ratio": 3.3173198482932995,
"config_test": false,
... |
"""A simple number and datetime addition JSON API.
Run the app:
$ python examples/bottle_example.py
Try the following with httpie (a cURL-like utility, http://httpie.org):
$ pip install httpie
$ http GET :5001/
$ http GET :5001/ name==Ada
$ http POST :5001/add x=40 y=2
$ http POST :5001/datea... | {
"repo_name": "hyunchel/webargs",
"path": "examples/bottle_example.py",
"copies": "1",
"size": "1970",
"license": "mit",
"hash": 2207214155787856000,
"line_mean": 26.7464788732,
"line_max": 73,
"alpha_frac": 0.6563451777,
"autogenerated": false,
"ratio": 3.272425249169435,
"config_test": false,... |
"""A simple number and datetime addition JSON API.
Run the app:
$ python examples/flask_example.py
Try the following with httpie (a cURL-like utility, http://httpie.org):
$ pip install httpie
$ http GET :5001/
$ http GET :5001/ name==Ada
$ http POST :5001/add x=40 y=2
$ http POST :5001/datead... | {
"repo_name": "yufeiminds/webargs",
"path": "examples/flask_example.py",
"copies": "4",
"size": "2061",
"license": "mit",
"hash": 8704752024359293000,
"line_mean": 26.1184210526,
"line_max": 73,
"alpha_frac": 0.6521106259,
"autogenerated": false,
"ratio": 3.2610759493670884,
"config_test": fals... |
"""A simple number and datetime addition JSON API.
Run the app:
$ python examples/pyramid_example.py
Try the following with httpie (a cURL-like utility, http://httpie.org):
$ pip install httpie
$ http GET :5001/
$ http GET :5001/ name==Ada
$ http POST :5001/add x=40 y=2
$ http POST :5001/date... | {
"repo_name": "sloria/webargs",
"path": "examples/pyramid_example.py",
"copies": "1",
"size": "2374",
"license": "mit",
"hash": 1906335846003752200,
"line_mean": 27.9512195122,
"line_max": 85,
"alpha_frac": 0.6655433867,
"autogenerated": false,
"ratio": 3.2835408022130013,
"config_test": true,
... |
"""A simple number and datetime addition JSON API.
Run the app:
$ python examples/tornado_example.py
Try the following with httpie (a cURL-like utility, http://httpie.org):
$ pip install httpie
$ http GET :5001/
$ http GET :5001/ name==Ada
$ http POST :5001/add x=40 y=2
$ http POST :5001/date... | {
"repo_name": "jmcarp/webargs",
"path": "examples/tornado_example.py",
"copies": "4",
"size": "2673",
"license": "mit",
"hash": 6587536953654920000,
"line_mean": 27.4361702128,
"line_max": 73,
"alpha_frac": 0.6210250655,
"autogenerated": false,
"ratio": 3.6024258760107815,
"config_test": false,... |
"""A simple object database. As long as the server is not running in
multiprocess mode that's good enough.
"""
import dbm
from pickle import dumps
from pickle import loads
from threading import Lock
class Database:
def __init__(self, filename):
self.filename = filename
self._fs = dbm.open(filename... | {
"repo_name": "pallets/werkzeug",
"path": "examples/cupoftee/db.py",
"copies": "1",
"size": "1668",
"license": "bsd-3-clause",
"hash": 2953181254301571000,
"line_mean": 23.8955223881,
"line_max": 68,
"alpha_frac": 0.5041966427,
"autogenerated": false,
"ratio": 4.149253731343284,
"config_test": ... |
'''A simple parallax rendering module'''
# -*- coding: utf-8 -*-
# Copyright (C) , 2012 Åke Forslund (ake.forslund@gmail.com)
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this per... | {
"repo_name": "lewiscowper/inferno",
"path": "parallax.py",
"copies": "1",
"size": "3083",
"license": "mit",
"hash": -3160580409265154600,
"line_mean": 39.025974026,
"line_max": 79,
"alpha_frac": 0.6278390655,
"autogenerated": false,
"ratio": 3.8333333333333335,
"config_test": false,
"has_no_... |
"""A simple parallel nearest neighbors classifier.
This one is parallelized using multiprocessing. It splits the training data into
chunks and processes them in parallel using a pool of worker processes.
"""
import multiprocessing
import numpy as np
from shredsim import classifiers
def _init_nn_global(init_all_sa... | {
"repo_name": "xa4a/shredsim",
"path": "shredsim/classifiers/nn.py",
"copies": "1",
"size": "1987",
"license": "mit",
"hash": -4332657686122779000,
"line_mean": 26.985915493,
"line_max": 80,
"alpha_frac": 0.5933568193,
"autogenerated": false,
"ratio": 3.974,
"config_test": false,
"has_no_keyw... |
"""a simple 'parser' for :ex commands
"""
from collections import namedtuple
import re
from itertools import takewhile
from vex import ex_error
from vex import parsers
# Data used to parse strings into ex commands and map them to an actual
# Sublime Text command.
#
# command
# The Sublime Text command to be... | {
"repo_name": "SublimeText/VintageEx",
"path": "vex/ex_command_parser.py",
"copies": "1",
"size": "19121",
"license": "mit",
"hash": -4063670113969387000,
"line_mean": 47.2853535354,
"line_max": 135,
"alpha_frac": 0.3578264735,
"autogenerated": false,
"ratio": 4.980724146913259,
"config_test": ... |
"""a simple 'parser' for :ex commands
"""
from collections import namedtuple
import re
from itertools import takewhile
from VintageousEx.vex import ex_error
from VintageousEx.vex import parsers
# Data used to parse strings into ex commands and map them to an actual
# Sublime Text command.
#
# command
# The ... | {
"repo_name": "gak/VintageousEx",
"path": "vex/ex_command_parser.py",
"copies": "1",
"size": "19079",
"license": "mit",
"hash": -7971690527752942000,
"line_mean": 47.3012658228,
"line_max": 135,
"alpha_frac": 0.3594003879,
"autogenerated": false,
"ratio": 4.962028608582575,
"config_test": false... |
"""A simple parser for "new ascii format" cpio archives"""
from . import *
from ..io import *
from ..util import *
CpioHeader = Struct('CpioHeader', [
('magic', Struct.STR % 6),
('inode', Struct.STR % 8),
('mode', Struct.STR % 8),
('uid', Struct.STR % 8),
('gid', Struct.STR % 8),
('nlink', Struct.STR % 8),
('m... | {
"repo_name": "ma1co/fwtool.py",
"path": "fwtool/archive/cpio.py",
"copies": "1",
"size": "1443",
"license": "mit",
"hash": 1320602102924121000,
"line_mean": 24.7678571429,
"line_max": 69,
"alpha_frac": 0.6403326403,
"autogenerated": false,
"ratio": 3.0443037974683542,
"config_test": false,
"... |
"""A simple parser for tar archives"""
import io
from stat import *
import tarfile
from . import *
from ..util import *
TarHeader = Struct('TarHeader', [
('...', 257),
('magic', Struct.STR % 8),
('...', 235),
])
tarHeaderMagic = [b'ustar\x0000', b'ustar \0']
def _convertFileType(type):
return {
tarfile.REGTY... | {
"repo_name": "ma1co/fwtool.py",
"path": "fwtool/archive/tar.py",
"copies": "1",
"size": "1139",
"license": "mit",
"hash": 8760037356466184000,
"line_mean": 23.7608695652,
"line_max": 110,
"alpha_frac": 0.678665496,
"autogenerated": false,
"ratio": 2.981675392670157,
"config_test": false,
"ha... |
"""A simple parser for zip archives"""
from collections import namedtuple
import time
import zipfile
ZipFile = namedtuple('ZipFile', 'path, size, mtime, contents')
from ..util import *
ZipHeader = Struct('ZipHeader', [
('magic', Struct.STR % 4),
('...', 26),
])
zipHeaderMagic = b'PK\x03\x04'
class _MySharedFile... | {
"repo_name": "ma1co/fwtool.py",
"path": "fwtool/zip/__init__.py",
"copies": "1",
"size": "1241",
"license": "mit",
"hash": -2969467289764412000,
"line_mean": 22.4150943396,
"line_max": 62,
"alpha_frac": 0.6615632554,
"autogenerated": false,
"ratio": 3.3181818181818183,
"config_test": false,
... |
# A simple Pascal interpreter that just adds two single-digit integers
# Token types
#
# EOF token indicates no more input left for lexical analysis
INTEGER, PLUS, EOF = 'INTEGER', 'PLUS', 'EOF'
class Token(object):
def __init__(self, type, value):
# token type: INTEGER, PLUS, or EOF
self.type = type
#... | {
"repo_name": "RagBillySandstone/google-python-exercises",
"path": "my_own_exercises/pascal_interpreter/calc1.py",
"copies": "1",
"size": "3487",
"license": "apache-2.0",
"hash": 5737986754006318000,
"line_mean": 25.6183206107,
"line_max": 70,
"alpha_frac": 0.6389446516,
"autogenerated": false,
"... |
"""A simple pet shop
Shows a list of animals, and you can click on each one.
Image resizing and page view tracking performed using lightbus.
"""
import lightbus
from flask import Flask
from lightbus_examples.ex03_worked_example.store.bus import bus
app = Flask(__name__)
lightbus.configure_logging()
PETS = (
"... | {
"repo_name": "adamcharnock/lightbus",
"path": "lightbus_examples/ex03_worked_example/store/web.py",
"copies": "1",
"size": "1064",
"license": "apache-2.0",
"hash": -2600018102164512000,
"line_mean": 24.3333333333,
"line_max": 82,
"alpha_frac": 0.6447368421,
"autogenerated": false,
"ratio": 2.867... |
""" A simple PID controller class.
This is a mostly literal C++ -> Python translation of the ROS
control_toolbox Pid class: http://ros.org/wiki/control_toolbox.
"""
import time
import math
# from http://w3.cs.jmu.edu/spragunr/CS354_S13/labs/pa1/pid.py
#*************************************************************... | {
"repo_name": "smaria/autonomous-sailing-robot",
"path": "src/boat_pid_control/src/boat_pid_control/pid_controller_class.py",
"copies": "2",
"size": "8112",
"license": "bsd-2-clause",
"hash": -40225032037028410,
"line_mean": 33.8154506438,
"line_max": 77,
"alpha_frac": 0.5658284024,
"autogenerated"... |
"""A simple plotting tool to create spectral diagnostics plots similar to those
originally proposed by M. Kromer (see, for example, Kromer et al. 2013, figure
4).
"""
import logging
import numpy as np
import astropy.units as units
import astropy.constants as csts
import pandas as pd
try:
import astropy.modeling.bl... | {
"repo_name": "tardis-sn/tardisanalysis",
"path": "tardis_kromer_plot.py",
"copies": "1",
"size": "37750",
"license": "bsd-3-clause",
"hash": 5773500574254749000,
"line_mean": 37.4811416922,
"line_max": 128,
"alpha_frac": 0.5572980132,
"autogenerated": false,
"ratio": 4.0499946357686945,
"confi... |
#A simple program illustration chaotic behavior.
#Example from Python programing
def showGrid(n, firstForm, secondForm, firstDisplay, secondDisplay):
print("formula " + str(firstForm) + " " + str(secondForm))
print("------------------------------")
for i in range(n):
one = str(firstDisplay[i])
two = str(secon... | {
"repo_name": "src053/violentPy",
"path": "chap1/chaosmulti.py",
"copies": "2",
"size": "2470",
"license": "cc0-1.0",
"hash": -2581088859241928700,
"line_mean": 34.8115942029,
"line_max": 163,
"alpha_frac": 0.6356275304,
"autogenerated": false,
"ratio": 2.7353266888150607,
"config_test": false,... |
# A simple program that implements the solution to the phrase generation problem using
# genetic algorithms as given in the search.ipynb notebook.
#
# Type on the home screen to change the target phrase
# Click on the slider to change genetic algorithm parameters
# Click 'GO' to run the algorithm with the specified va... | {
"repo_name": "Chipe1/aima-python",
"path": "gui/genetic_algorithm_example.py",
"copies": "2",
"size": "7497",
"license": "mit",
"hash": 8644554138786683000,
"line_mean": 38.6666666667,
"line_max": 118,
"alpha_frac": 0.6733360011,
"autogenerated": false,
"ratio": 3.523026315789474,
"config_test... |
# A simple program that resembles the falling of stars or snow on a screen
# Coded in Python 2.7.10 with PyGame
# by Brett Burley-Inners :: 11/7/2015
import pygame, time, random, sys
pygame.init()
# Default dimensions of the game window (px)
display_width = 1280
display_height = 720
# Create a canvas to di... | {
"repo_name": "burleyinnersbm07/python_fallingStars",
"path": "FallingStars.py",
"copies": "1",
"size": "16995",
"license": "mit",
"hash": -6557350294473700000,
"line_mean": 60.3537906137,
"line_max": 202,
"alpha_frac": 0.6955575169,
"autogenerated": false,
"ratio": 3.296799224054316,
"config_t... |
# A simple program that resembles the falling of stars or snow on a screen
# Coded in Python 2.7.10 with PyGame
# by Brett Burley-Inners :: 11/7/2015
import pygame, time, random, sys
pygame.init()
# Default dimensions of the game window (px) test
display_width = 320
display_height = 240
# Create a canvas to display... | {
"repo_name": "burleyinnersbm07/DontTouchThat",
"path": "DontTouchThat.py",
"copies": "1",
"size": "6041",
"license": "mit",
"hash": 8681486047025737000,
"line_mean": 28.1835748792,
"line_max": 191,
"alpha_frac": 0.651878828,
"autogenerated": false,
"ratio": 3.506094022054556,
"config_test": fa... |
"""A simple "pull API" for HTML parsing, after Perl's HTML::TokeParser.
Examples
This program extracts all links from a document. It will print one
line for each link, containing the URL and the textual description
between the <A>...</A> tags:
import pullparser, sys
f = file(sys.argv[1])
p = pullparser.PullParser(f... | {
"repo_name": "deanhiller/databus",
"path": "webapp/play1.3.x/samples-and-tests/i-am-a-developer/mechanize/_pullparser.py",
"copies": "15",
"size": "14326",
"license": "mpl-2.0",
"hash": 4533353619315691500,
"line_mean": 35.7333333333,
"line_max": 79,
"alpha_frac": 0.5743403602,
"autogenerated": fa... |
"""A simple Python callstack sampler."""
import contextlib
import datetime
import signal
import traceback
class CallstackSampler(object):
"""A simple signal-based Python callstack sampler.
"""
def __init__(self, interval=None):
self.stacks = []
self.interval = 0.001 if interval is None else interval
... | {
"repo_name": "tombstone/models",
"path": "official/utils/misc/callstack_sampler.py",
"copies": "6",
"size": "1640",
"license": "apache-2.0",
"hash": -9065000327958715000,
"line_mean": 25.4516129032,
"line_max": 79,
"alpha_frac": 0.6615853659,
"autogenerated": false,
"ratio": 3.8770685579196216,
... |
# A simple Pythone program to analysis addon _common directory and copy each files to firefox or chrome directory to form different addons
#coding=utf-8
import os,shutil
import sys
import datetime
SOURCE_DIR = '_common'
# Different build target configs
# file mark is used to set file specified to single platform. e.... | {
"repo_name": "partridgejiang/Kekule.js",
"path": "src/_extras/browserAddOns/build.py",
"copies": "2",
"size": "4779",
"license": "mit",
"hash": 6141471993913872000,
"line_mean": 29.253164557,
"line_max": 160,
"alpha_frac": 0.6913580247,
"autogenerated": false,
"ratio": 3.181757656458056,
"conf... |
"""A simple python library for getting caller ID name information."""
from re import sub
from requests import get
from requests.exceptions import ConnectionError, Timeout
from .errors import InvalidPhoneNumberError
class Phone(object):
"""An object that holds a single phone's information.
:attr str OPENC... | {
"repo_name": "telephonyresearch/python-opencnam",
"path": "opencnam/opencnam.py",
"copies": "1",
"size": "2551",
"license": "unlicense",
"hash": -7880276795674655000,
"line_mean": 35.4428571429,
"line_max": 93,
"alpha_frac": 0.6232849863,
"autogenerated": false,
"ratio": 4.2026359143327845,
"c... |
"""A simple python module to add a retry function decorator"""
import functools
import itertools
import logging
import os
from select import poll, POLLIN
from threading import Timer
import time
from decorator import decorator
class _DummyException(Exception):
pass
class MaximumRetriesExceeded(Exception):
p... | {
"repo_name": "seemethere/retry.it",
"path": "retry.py",
"copies": "1",
"size": "3885",
"license": "mit",
"hash": -3026290403476526000,
"line_mean": 31.6470588235,
"line_max": 77,
"alpha_frac": 0.5608751609,
"autogenerated": false,
"ratio": 4.880653266331659,
"config_test": false,
"has_no_key... |
"""A simple Python object browser.
This will create a tree that can be used to browse the objects in a given
Python namespace. Like Console.py, this is a demo only, and needs a lot
of work before it would be a truly valuable tool.
"""
from pawt import swing
from types import *
import java
leaves = (None, TypeType, I... | {
"repo_name": "JaDogg/__py_playground",
"path": "reference/examples-v3/JavaScript/python/tests/jython/ObjectTree.py",
"copies": "2",
"size": "3026",
"license": "mit",
"hash": -1167417185375021800,
"line_mean": 21.25,
"line_max": 73,
"alpha_frac": 0.570720423,
"autogenerated": false,
"ratio": 3.80... |
""" A simple python script that uses the leastsq function from SciPy to carry out a nonlinear
regression. Outputs a bunch of different measures to be used in judging the fit. Requires an input
file with x and y columns, no headings. Pass filename as an argument.
"""
import numpy, sys
from scipy.optimize import leasts... | {
"repo_name": "scotthartley/NMR_dilution_fit",
"path": "NMR_dilution_fit.py",
"copies": "1",
"size": "2684",
"license": "mit",
"hash": 8867641672662189000,
"line_mean": 34.7866666667,
"line_max": 100,
"alpha_frac": 0.6717585693,
"autogenerated": false,
"ratio": 3.1173054587688735,
"config_test"... |
"""A simple Python template renderer, for a nano-subset of Django syntax."""
# Coincidentally named the same as http://code.activestate.com/recipes/496702/
import re
from coverage.backward import set # pylint: disable=W0622
class CodeBuilder(object):
"""Build source code conveniently."""
... | {
"repo_name": "nicolargo/intellij-community",
"path": "python/helpers/coverage/templite.py",
"copies": "160",
"size": "6868",
"license": "apache-2.0",
"hash": 3202730924089401000,
"line_mean": 32.0192307692,
"line_max": 79,
"alpha_frac": 0.5039312755,
"autogenerated": false,
"ratio": 4.1954795357... |
"""A simple Python template renderer, for a nano-subset of Django syntax."""
# Coincidentally named the same as http://code.activestate.com/recipes/496702/
import re, sys
class Templite(object):
"""A simple template renderer, for a nano-subset of Django syntax.
Supported constructs are extended variable acc... | {
"repo_name": "xin3liang/platform_external_chromium_org_third_party_WebKit",
"path": "Tools/Scripts/webkitpy/thirdparty/coverage/templite.py",
"copies": "123",
"size": "5701",
"license": "bsd-3-clause",
"hash": -2725975340414378500,
"line_mean": 33.343373494,
"line_max": 79,
"alpha_frac": 0.493597614... |
INF = 1e30
EPS = 1e-6
class Vec:
def __init__(self, x, y, z):
self.x, self.y, self.z = x, y, z
def __neg__(self):
return Vec(-self.x, -self.y, -self.z)
def __add__(self, rhs):
return Vec(self.x + rhs.x, self.y + rhs.y, self.z + rhs.z)
def __sub__(self, rhs):
return V... | {
"repo_name": "trezor/micropython",
"path": "tests/perf_bench/misc_raytrace.py",
"copies": "2",
"size": "7278",
"license": "mit",
"hash": 6367417923459072000,
"line_mean": 29.0743801653,
"line_max": 98,
"alpha_frac": 0.5299532839,
"autogenerated": false,
"ratio": 3.004954582989265,
"config_test... |
INF = 1e30
EPS = 1e-6
class Vec:
def __init__(self, x, y, z):
self.x, self.y, self.z = x, y, z
def __neg__(self):
return Vec(-self.x, -self.y, -self.z)
def __add__(self, rhs):
return Vec(self.x + rhs.x, self.y + rhs.y, self.z + rhs.z)
def __sub__(self, rhs):
return ... | {
"repo_name": "dpgeorge/micropython",
"path": "tests/perf_bench/misc_raytrace.py",
"copies": "15",
"size": "7296",
"license": "mit",
"hash": 852058171284267800,
"line_mean": 27.2790697674,
"line_max": 98,
"alpha_frac": 0.5286458333,
"autogenerated": false,
"ratio": 3.0123864574731627,
"config_t... |
""" A simple recurrent neural network that detects parity for arbitrary sequences. """
__author__ = 'Tom Schaul (tom@idsia.ch)'
from datasets import ParityDataSet #@UnresolvedImport
from pybrain.supervised.trainers.backprop import BackpropTrainer
from pybrain.structure import RecurrentNetwork, LinearLayer, TanhLayer,... | {
"repo_name": "daanwierstra/pybrain",
"path": "examples/backprop/parityrnn.py",
"copies": "1",
"size": "1983",
"license": "bsd-3-clause",
"hash": -4245234454435755500,
"line_mean": 30.4761904762,
"line_max": 96,
"alpha_frac": 0.6212808875,
"autogenerated": false,
"ratio": 3.4667832167832167,
"c... |
__author__ = 'Tom Schaul, tom@idsia.ch and Daan Wierstra'
from datasets import AnBnCnDataSet #@UnresolvedImport
from pybrain.supervised import BackpropTrainer
from pybrain.structure import FullConnection, RecurrentNetwork, TanhLayer, LinearLayer, BiasUnit
def testTraining():
# the AnBnCn dataset (sequential)
... | {
"repo_name": "daanwierstra/pybrain",
"path": "examples/backprop/backpropanbncn.py",
"copies": "1",
"size": "1135",
"license": "bsd-3-clause",
"hash": -531837281751026050,
"line_mean": 33.4242424242,
"line_max": 96,
"alpha_frac": 0.6925110132,
"autogenerated": false,
"ratio": 3.3579881656804735,
... |
# A simple recursive descent parser that implements an integer
# calculator. This parser suffers from an associativity problem
# due to using BNF-y recursion for rules like <term> ad <expr>
#
# BNF:
#
# <stmt> : set <id> = <expr>
# | <expr>
# <expr> : <term> + <expr>
# | <term> - <expr>
# ... | {
"repo_name": "evandrix/Splat",
"path": "doc/parser/rd_parser_bnf.py",
"copies": "1",
"size": "5304",
"license": "mit",
"hash": -1430179665722663400,
"line_mean": 27.2127659574,
"line_max": 67,
"alpha_frac": 0.4283559578,
"autogenerated": false,
"ratio": 3.837916063675832,
"config_test": false,... |
# A simple recursive descent parser that implements an integer
# calculator. This parser suffers from an associativity problem
# due to using BNF-y recursion for rules like <term> ad <expr>
#
# BNF:
#
# <stmt> : set <id> = <expr>
# | <expr>
# <expr> : <term> + <expr>
# | <term> - <... | {
"repo_name": "shaoguangleo/code-for-blog",
"path": "2009/py_rd_parser_example/rd_parser_bnf.py",
"copies": "12",
"size": "5481",
"license": "unlicense",
"hash": 8007292128277706000,
"line_mean": 27.2127659574,
"line_max": 67,
"alpha_frac": 0.4145228973,
"autogenerated": false,
"ratio": 3.8680310... |
"""A simple regression problem using integer data."""
import random
import numpy as np
from pyshgp.gp.selection import Lexicase
from pyshgp.gp.estimators import PushEstimator
from pyshgp.gp.genome import GeneSpawner
from pyshgp.push.instruction_set import InstructionSet
def target_function(a, b):
"""Generate a ... | {
"repo_name": "erp12/pyshgp",
"path": "examples/integer_regression.py",
"copies": "1",
"size": "1036",
"license": "mit",
"hash": 8999730877668130000,
"line_mean": 20.5833333333,
"line_max": 76,
"alpha_frac": 0.638996139,
"autogenerated": false,
"ratio": 3.158536585365854,
"config_test": false,
... |
""" A simple restful webservice to provide access to the wiki.db"""
import json
from bottle import Bottle, run, response, static_file, redirect
from dbfunctions import Wikidb
api = Bottle()
db = Wikidb()
@api.route('/static/<filepath:path>')
def static(filepath):
return static_file(filepath, root='./static')
@... | {
"repo_name": "mtik00/bottle-wiki",
"path": "wikiapi.py",
"copies": "1",
"size": "1234",
"license": "mit",
"hash": 6322702629511475000,
"line_mean": 28.380952381,
"line_max": 91,
"alpha_frac": 0.6896272285,
"autogenerated": false,
"ratio": 3.535816618911175,
"config_test": false,
"has_no_keyw... |
""" A simple restful webservice to provide access to the wiki.db"""
import json
from bottle import run, response, static_file, redirect, request, route
from db.dbfunctions import Wikidb
db = Wikidb()
@route('/static/<filepath:path>')
def static(filepath):
return static_file(filepath, root='./static')
... | {
"repo_name": "pysprings/bottle-wiki",
"path": "wikiapi.py",
"copies": "1",
"size": "2193",
"license": "mit",
"hash": 8602430130283323000,
"line_mean": 32.265625,
"line_max": 100,
"alpha_frac": 0.6484268126,
"autogenerated": false,
"ratio": 3.5658536585365854,
"config_test": false,
"has_no_ke... |
"""A simpler interface to netCDF files.
"""
from pycdf import *
import numpy as N
import os.path
CREATE = NC.CREATE|NC.WRITE|NC.BIT64_OFFSET
def get_or_def_dim(ncf, name, length):
try:
len = ncf.dimensions()[name]
dim = ncf.inq_dimid(name)
except KeyError:
dim = ncf.def_dim(name, lengt... | {
"repo_name": "joakimstenhammar/subgrid",
"path": "python/dqTools/ncdx.py",
"copies": "2",
"size": "14609",
"license": "mit",
"hash": -509490569945319500,
"line_mean": 27.533203125,
"line_max": 87,
"alpha_frac": 0.4984598535,
"autogenerated": false,
"ratio": 4.011257550796266,
"config_test": fa... |
"""A simple root of supervisor tree and a generic container."""
___all__ = [
'serve',
]
import logging
import os
import signal
import curio
from garage import asyncs
from garage.okay import OKAY, NOT_OKAY
LOG = logging.getLogger(__name__)
# The root node of the supervisor tree
async def serve(graceful_exit,... | {
"repo_name": "clchiou/garage",
"path": "py/garage/garage/asyncs/servers.py",
"copies": "1",
"size": "3066",
"license": "mit",
"hash": 5898986106729975000,
"line_mean": 30.9375,
"line_max": 76,
"alpha_frac": 0.5988258317,
"autogenerated": false,
"ratio": 4.082556591211718,
"config_test": false,... |
#A simple ROS node in python that listens for and responds to communication
#from the Julia node
import rospy
from geometry_msgs.msg import PoseStamped, Vector3
from std_srvs.srv import SetBool, SetBoolRequest, SetBoolResponse
from nav_msgs.srv import GetPlan, GetPlanRequest, GetPlanResponse
class Echo(object):
... | {
"repo_name": "phobon/RobotOS.jl",
"path": "test/echonode.py",
"copies": "3",
"size": "1766",
"license": "mit",
"hash": 1980502211784039700,
"line_mean": 31.7037037037,
"line_max": 90,
"alpha_frac": 0.6347678369,
"autogenerated": false,
"ratio": 3.3574144486692017,
"config_test": false,
"has_... |
# A simple round off error estimation of polynomial expressions
# Alexey Solovyev, 2016
# https://github.com/monadius/poly_fp
# MIT License
from fractions import Fraction
from numbers import Rational
# This flag controls string conversion behavior of some internal objects.
# If True then additional information is pri... | {
"repo_name": "monadius/poly_fp",
"path": "poly_fp.py",
"copies": "1",
"size": "21765",
"license": "mit",
"hash": -5490345021547478000,
"line_mean": 27.7137203166,
"line_max": 104,
"alpha_frac": 0.5770273375,
"autogenerated": false,
"ratio": 3.3198596705308114,
"config_test": false,
"has_no_k... |
"""A simple RPC client that shows how to do load balancing."""
#-----------------------------------------------------------------------------
# Copyright (C) 2012. Brian Granger, Min Ragan-Kelley
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING.BSD, distributed as par... | {
"repo_name": "ellisonbg/zpyrpc",
"path": "examples/client.py",
"copies": "1",
"size": "1211",
"license": "bsd-3-clause",
"hash": 8125012656837247000,
"line_mean": 35.696969697,
"line_max": 78,
"alpha_frac": 0.5664739884,
"autogenerated": false,
"ratio": 4.023255813953488,
"config_test": false,... |
"""A simple RPC server that show how to run multiple RPC services."""
#-----------------------------------------------------------------------------
# Copyright (C) 2012. Brian Granger, Min Ragan-Kelley
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING.BSD, distributed... | {
"repo_name": "ellisonbg/zpyrpc",
"path": "examples/server.py",
"copies": "1",
"size": "1926",
"license": "bsd-3-clause",
"hash": -4625399187713788000,
"line_mean": 26.5142857143,
"line_max": 78,
"alpha_frac": 0.5716510903,
"autogenerated": false,
"ratio": 3.647727272727273,
"config_test": fals... |
"""A simple rss parse and printer"""
import webapp2
from lib import feedparser
URL = 'https://www.youtube.com/rss/user/VEVO/feed.rss'
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/html'
self.response.headers['Charset'] = 'UTF-8'
... | {
"repo_name": "robertoallende/feedparser-gae",
"path": "parserss.py",
"copies": "1",
"size": "1112",
"license": "mit",
"hash": -838971317141064400,
"line_mean": 26.825,
"line_max": 66,
"alpha_frac": 0.5395683453,
"autogenerated": false,
"ratio": 3.8344827586206898,
"config_test": false,
"has_... |
"""A simple script demonstrating the basic usage of the cb2_robot class"""
# The MIT License (MIT)
#
# Copyright (c) 2016 GTRC.
#
# 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 rest... | {
"repo_name": "IRIM-Technology-Transition-Lab/ur_cb2",
"path": "ur_cb2/cb2_robot_example.py",
"copies": "1",
"size": "2970",
"license": "mit",
"hash": 6426528930396537000,
"line_mean": 36.125,
"line_max": 80,
"alpha_frac": 0.6400673401,
"autogenerated": false,
"ratio": 3.498233215547703,
"confi... |
# A simple script for enabling and disabling per-vif and tunnel interface rules for explicitly
# allowing broadcast/multicast traffic from the tunnel ports and on the port where the VIF is attached
import copy
import os
import sys
import cloudstack_pluginlib as pluginlib
pluginlib.setup_logging("/var/log/cloud/ovstu... | {
"repo_name": "MissionCriticalCloud/cosmic",
"path": "cosmic-core/scripts/src/main/resources/scripts/vm/hypervisor/xenserver/ovs-vif-flows.py",
"copies": "2",
"size": "5227",
"license": "apache-2.0",
"hash": 8195013757565932000,
"line_mean": 39.2076923077,
"line_max": 102,
"alpha_frac": 0.5758561316,... |
#A simple script for testing pypair
from pypair import Tournament
import random
import os
home = os.path.expanduser("~")
to = Tournament()
#for p in range(10):
# to.addPlayer( p, "Timmy" )
to.loadPlayersCSV("playerlist.csv")
pairings1 = to.pairRound()
print(pairings1)
for table in pairings1:
if not type(... | {
"repo_name": "JeffHoogland/pypair",
"path": "test.py",
"copies": "1",
"size": "3363",
"license": "bsd-3-clause",
"hash": 2284880252990313000,
"line_mean": 22.3541666667,
"line_max": 42,
"alpha_frac": 0.5504014273,
"autogenerated": false,
"ratio": 2.9474145486415426,
"config_test": false,
"ha... |
"""A simple script that attempts to directly download a single blob from a given peer"""
import argparse
import logging
import sys
import tempfile
from twisted.internet import defer
from twisted.internet import reactor
from zope.interface import implements
from lbrynet import interfaces
from lbrynet import conf
from ... | {
"repo_name": "zestyr/lbry",
"path": "scripts/download_blob_from_peer.py",
"copies": "1",
"size": "4405",
"license": "mit",
"hash": 4201455234363465700,
"line_mean": 28.1721854305,
"line_max": 91,
"alpha_frac": 0.6819523269,
"autogenerated": false,
"ratio": 3.837108013937282,
"config_test": fal... |
"""A simple script that connects with a wii controller and starts experiment"""
import errno
import time
from select import poll, POLLIN
import threading
import Queue
from src.experiment import Experiment
from src.tasks_gui import TasksGui
class App(threading.Thread):
"""A application class puts accel data into a... | {
"repo_name": "GordonLesti/SlidingWindowFilter-experiment",
"path": "src/xwiimote_recorder.py",
"copies": "1",
"size": "4312",
"license": "mit",
"hash": -1697340315910570200,
"line_mean": 33.7741935484,
"line_max": 79,
"alpha_frac": 0.4782003711,
"autogenerated": false,
"ratio": 4.091081593927893... |
# a simple script that will generate a forwarding DLL assembler listing
# for example, to create a forwarder for an ollydbg plugin to an immunity debugger plugin
# 1. edit DLLNAME and forwarders
# 2. run makefw.py <myfile.asm>
# 3. compile with yasm 'yasm -o <myfile.exe> <myfile.asm>"
DLLNAME = "multiasm"
f... | {
"repo_name": "angea/corkami",
"path": "misc/python/makefw.py",
"copies": "1",
"size": "5192",
"license": "bsd-2-clause",
"hash": 7285663245564081000,
"line_mean": 31.2820512821,
"line_max": 122,
"alpha_frac": 0.6515793529,
"autogenerated": false,
"ratio": 3.3027989821882953,
"config_test": fal... |
"""A simple script to create, train, validate, and save the default model"""
from __future__ import division, print_function
import datetime as dt
import time
import os
from nflwin import model
def main():
start = time.time()
win_probability_model = model.WPModel()
training_seasons = [2009, 2010, 20... | {
"repo_name": "AndrewRook/PyWPA",
"path": "make_default_model.py",
"copies": "2",
"size": "2244",
"license": "mit",
"hash": -2067965776947239400,
"line_mean": 43.88,
"line_max": 110,
"alpha_frac": 0.5592691622,
"autogenerated": false,
"ratio": 3.849056603773585,
"config_test": false,
"has_no_... |
# A simple script to generate fake data
import datetime as dt
import json
import math
import random
import sys
USAGE = "Usage: python make_fake_fixtures.py [num_of_members] [num_of_games] [num_of_tournaments]"
# Fake Names: First and Last
GIVEN_NAMES = ["bruce", "malcolm", "kobe", "peter", "kaylee", "inara"]
LAST_NAM... | {
"repo_name": "usgo/agagd",
"path": "scripts/make_fake_fixtures.py",
"copies": "1",
"size": "7869",
"license": "mit",
"hash": 1389344228129396000,
"line_mean": 32.0630252101,
"line_max": 103,
"alpha_frac": 0.4895158216,
"autogenerated": false,
"ratio": 3.3090832632464258,
"config_test": false,
... |
#A simple script to read values from a delta inverter and post them to
#PVoutput.org
import time, subprocess,serial,argparse,sys
from deltaInv import DeltaInverter
from time import localtime, strftime
#PVOutput.org API Values - UPDATE THESE TO YOURS!
SYSTEMID=""
APIKEY=""
parser = argparse.ArgumentParser... | {
"repo_name": "stik79/DeltaPVOutput",
"path": "DeltaPVOutput.py",
"copies": "1",
"size": "2775",
"license": "mit",
"hash": 2367953907977773000,
"line_mean": 33.5769230769,
"line_max": 149,
"alpha_frac": 0.6079279279,
"autogenerated": false,
"ratio": 3.3035714285714284,
"config_test": false,
"... |
#A simple script to read values from a delta inverter and post them to
#PVoutput.org
import time, subprocess,serial
from deltaInv import DeltaInverter
from time import localtime, strftime
#PVOutput.org API Values - UPDATE THESE TO YOURS!
#Array of SystemID's that correlate to the inverter number
#ie. the ... | {
"repo_name": "stik79/DeltaPVOutput",
"path": "MultipleDeltaPVOutput.py",
"copies": "1",
"size": "3846",
"license": "mit",
"hash": -2255734265482382800,
"line_mean": 31.1551724138,
"line_max": 99,
"alpha_frac": 0.5813832553,
"autogenerated": false,
"ratio": 3.218410041841004,
"config_test": fal... |
"""A simple script to recourse over a directory and rewrite files to an ACM repo.
ACM repos are structured a certain way. In particular cluster and namespace
resources need to be in different directories. This script takes as
an input a directory and rewrites all the resources into the target
directory.
"""
import ar... | {
"repo_name": "kubeflow/gcp-blueprints",
"path": "kubeflow/hack/to_acm_structure.py",
"copies": "1",
"size": "2259",
"license": "apache-2.0",
"hash": -189903350661568700,
"line_mean": 29.527027027,
"line_max": 81,
"alpha_frac": 0.5816733068,
"autogenerated": false,
"ratio": 3.921875,
"config_te... |
# A simple script to snag deprecated proto fields and add them to runtime_features.cc
from __future__ import print_function
import re
import subprocess
import fileinput
from six.moves import input
# Sorts out the list of deprecated proto fields which should be disallowed and returns a tuple of
# email and code chang... | {
"repo_name": "eklitzke/envoy",
"path": "tools/deprecate_features/deprecate_features.py",
"copies": "6",
"size": "2596",
"license": "apache-2.0",
"hash": -4001395691198682000,
"line_mean": 37.7462686567,
"line_max": 98,
"alpha_frac": 0.6926040062,
"autogenerated": false,
"ratio": 3.62064156206415... |
# A simple script to snag deprecated proto fields and add them to runtime_features.h
import re
import subprocess
import fileinput
# Sorts out the list of deprecated proto fields which should be disallowed and returns a tuple of
# email and code changes.
def deprecate_proto():
grep_output = subprocess.check_output(... | {
"repo_name": "dnoe/envoy",
"path": "tools/deprecate_features/deprecate_features.py",
"copies": "1",
"size": "3852",
"license": "apache-2.0",
"hash": 2288945230812145700,
"line_mean": 37.1386138614,
"line_max": 98,
"alpha_frac": 0.6913291796,
"autogenerated": false,
"ratio": 3.556786703601108,
... |
### Designed to be run inside of Pythonista on an iOS device.
### This limits some of the libraries we can use as Pythonista
### has a pretty limited subset up Python (hence we get to re-invent
### the wheel here). On the other hand, PROGRAMING! On iOS! So that's
### useful.
import json
import sys
import urllib2
impo... | {
"repo_name": "lvaughn/py-rtm-insert",
"path": "py_rtm_insert.py",
"copies": "1",
"size": "7401",
"license": "bsd-3-clause",
"hash": -2532028572394056700,
"line_mean": 36.1909547739,
"line_max": 117,
"alpha_frac": 0.5741116065,
"autogenerated": false,
"ratio": 3.8426791277258565,
"config_test":... |
# a simple script to trim MNGs and corresponding WAVs without recompression
# Ange Albertini, BSD Licence 2013
# only MHRD-(IHDR/[PLTE/]IDAT/IEND)*-MEND are supported
# tEXt and FRAM are dropped
# complex framerate via FRAM not supported
# 1- run with -d <STARTFRAME> <RANGE> to get xxx frames
# 2- run with ... | {
"repo_name": "angea/corkami",
"path": "misc/python/trimmer.py",
"copies": "1",
"size": "2969",
"license": "bsd-2-clause",
"hash": -3952667479980866000,
"line_mean": 23.5948275862,
"line_max": 90,
"alpha_frac": 0.5611316942,
"autogenerated": false,
"ratio": 2.8062381852551983,
"config_test": fa... |
"""A simple server for central log processing from multiple threads or
processes.
"""
import logging
import multiprocessing
import warnings
from .server import LogServer, LogServerProcess, LogServerThread
from ._constants import DEFAULT_FORMAT
__version__ = "0.3.1"
def run_server(handlers=[], host=None, port=None... | {
"repo_name": "mivade/logserver",
"path": "logserver/__init__.py",
"copies": "1",
"size": "2877",
"license": "mit",
"hash": -3612927125690753000,
"line_mean": 34.5185185185,
"line_max": 79,
"alpha_frac": 0.6906499826,
"autogenerated": false,
"ratio": 4.187772925764192,
"config_test": false,
"... |
"""A simple set of tools for building accented glyphs.
# Hey look! A demonstration:
from robofab.accentBuilder import AccentTools, buildRelatedAccentList
font = CurrentFont
# a list of accented glyphs that you want to build
myList=['Aacute', 'aacute']
# search for glyphs related to glyphs in myList and add them to myLi... | {
"repo_name": "adrientetar/robofab",
"path": "Lib/robofab/tools/accentBuilder.py",
"copies": "1",
"size": "12412",
"license": "bsd-3-clause",
"hash": 6301245850819760000,
"line_mean": 34.6666666667,
"line_max": 124,
"alpha_frac": 0.7106832098,
"autogenerated": false,
"ratio": 3.28794701986755,
... |
"""A simple setup module for MkDocs-Merge, based on the pip setup.py file.
See:
https://github.com/pypa/pip/blob/1.5.6/setup.py
"""
import codecs
import os
import re
from setuptools import setup, find_packages
HERE = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
# intentionally *not* adding an en... | {
"repo_name": "ovasquez/mkdocs-merge",
"path": "setup.py",
"copies": "1",
"size": "2430",
"license": "mit",
"hash": 7493832025103100000,
"line_mean": 30.1538461538,
"line_max": 79,
"alpha_frac": 0.5880658436,
"autogenerated": false,
"ratio": 3.7442218798151004,
"config_test": false,
"has_no_k... |
# A simple setup script to create an executable using PyQt4. This also
# demonstrates the method for creating a Windows executable that does not have
# an associated console.
#
# PyQt4app.py is a very simple type of PyQt4 application
#
# Run the build process by running the command 'python setup.py build'
#
# If everyt... | {
"repo_name": "narthollis/eve-mcl",
"path": "setup.py",
"copies": "1",
"size": "1062",
"license": "bsd-2-clause",
"hash": -2808741308415549400,
"line_mean": 24.9268292683,
"line_max": 78,
"alpha_frac": 0.5951035782,
"autogenerated": false,
"ratio": 4.100386100386101,
"config_test": false,
"ha... |
# A simple setup script to create an executable using PyQt4. This also
# demonstrates the method for creating a Windows executable that does not have
# an associated console.
#
# PyQt4app.py is a very simple type of PyQt4 application
#
# Run the build process by running the command 'python setup.py build'
#
# I... | {
"repo_name": "bsobotka/amv_tracker",
"path": "setup.py",
"copies": "1",
"size": "1042",
"license": "mit",
"hash": 7800845134199603000,
"line_mean": 32.7333333333,
"line_max": 91,
"alpha_frac": 0.6938579655,
"autogenerated": false,
"ratio": 3.789090909090909,
"config_test": false,
"has_no_key... |
# A simple setup script to create various executables with
# different User Access Control flags in the manifest.
# Run the build process by entering 'setup.py py2exe' or
# 'python setup.py py2exe' in a console prompt.
#
# If everything works well, you should find a subdirectory named 'dist'
# containing lots ... | {
"repo_name": "pupboss/xndian",
"path": "deploy/site-packages/py2exe/samples/user_access_control/setup.py",
"copies": "1",
"size": "1548",
"license": "mit",
"hash": -8942405317529518000,
"line_mean": 31.652173913,
"line_max": 71,
"alpha_frac": 0.6595607235,
"autogenerated": false,
"ratio": 3.4630... |
""" A simple setuptools file """
from setuptools import setup
setup(
name="PyPi_py3",
version='0.1 dev',
description='Ensure proper python3 adherence among pypi package maintainers',
long_description="""Inspired by Guido's talk at PyCon2015, many packages on the pypi repository are still
... | {
"repo_name": "SunPowered/pypi_py3",
"path": "setup.py",
"copies": "1",
"size": "1085",
"license": "mit",
"hash": -8999620628796216000,
"line_mean": 37.75,
"line_max": 109,
"alpha_frac": 0.6285714286,
"autogenerated": false,
"ratio": 4.305555555555555,
"config_test": false,
"has_no_keywords":... |
"""A simple simulator for the OPC LED panels.
Usage: python simulator.py
To make the LED-bot talk to this server, change the server address to
`localhost:7890` in your configuration.
"""
from struct import unpack
import SocketServer
W = 64
H = 32
led_num = W * H
led_width = led_height = led_spacing = 3
screen_w... | {
"repo_name": "marqsm/LED-bot",
"path": "LEDBot/simulator.py",
"copies": "1",
"size": "2476",
"license": "mit",
"hash": 2031069806492160500,
"line_mean": 25.3404255319,
"line_max": 101,
"alpha_frac": 0.6175282714,
"autogenerated": false,
"ratio": 3.63049853372434,
"config_test": false,
"has_n... |
"""A simple Slack integration via webhook
Inspired by slackweb http://qiita.com/satoshi03/items/14495bf431b1932cb90b
"""
import json
import urllib3
import certifi
class Slack:
def __init__(self, url):
"""Config a Slack connection"""
self.url = url
# The connection is initiated lazily by... | {
"repo_name": "pycontw/pycontw2016",
"path": "src/proposals/management/commands/slack.py",
"copies": "1",
"size": "1109",
"license": "mit",
"hash": -5768779436617011000,
"line_mean": 26.725,
"line_max": 74,
"alpha_frac": 0.5960324617,
"autogenerated": false,
"ratio": 4.032727272727273,
"config_... |
"""A simple socket interface."""
import socket
from multiprocessing import Process
from botbot.debug import debug
class Bot(object):
"""Socket bot"""
def __init__(self, host, port, debug=False):
"""Initialize the bot with host and port. Debig is an optional
flag that enables all reads and w... | {
"repo_name": "khile/botbot",
"path": "botbot/bot.py",
"copies": "1",
"size": "1045",
"license": "mit",
"hash": 7522091326867453000,
"line_mean": 27.2432432432,
"line_max": 71,
"alpha_frac": 0.5837320574,
"autogenerated": false,
"ratio": 3.973384030418251,
"config_test": false,
"has_no_keywor... |
"""A simple source that allows one to view a suitably shaped numpy
array as ImageData. This supports both scalar and vector data.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005, Enthought, Inc.
# License: BSD Style.
# Standard library imports.
import numpy
from vtk.util import vtkConst... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/sources/array_source.py",
"copies": "3",
"size": "10789",
"license": "bsd-3-clause",
"hash": 8465167727326842000,
"line_mean": 38.6654411765,
"line_max": 119,
"alpha_frac": 0.5693762165,
"autogenerated": false,
"ratio": 3.979712283290299,
"config_... |
# A simple sphinx plugin which creates HTML redirections from old names
# to new names. It does this by looking for files named "redirect" in
# the documentation source and using the contents to create simple HTML
# redirection pages for changed filenames.
#
# Redirect file should contain one redirect per line, where e... | {
"repo_name": "mrgaaron/docs",
"path": "source/sphinxext/redirect.py",
"copies": "1",
"size": "2204",
"license": "mit",
"hash": 5962539522616888000,
"line_mean": 37.6842105263,
"line_max": 79,
"alpha_frac": 0.6415607985,
"autogenerated": false,
"ratio": 3.9078014184397163,
"config_test": false,... |
'''A simple standalone target for the scheme interpreter.'''
from __future__ import absolute_import
import os
import sys
here = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(here, 'lang-scheme'))
from rpython.rlib.parsing.makepackrat import BacktrackException
from rpython.rlib.streamio impo... | {
"repo_name": "jptomo/rpython-lang-scheme",
"path": "targetscheme.py",
"copies": "1",
"size": "1581",
"license": "mit",
"hash": -168653382044187550,
"line_mean": 23.3230769231,
"line_max": 70,
"alpha_frac": 0.6034155598,
"autogenerated": false,
"ratio": 3.5369127516778525,
"config_test": false,... |
'''A simple storage interface for feature collections.
.. This software is released under an MIT/X11 open source license.
Copyright 2012-2014 Diffeo, Inc.
Compatible interfaces on both ElasticSearch and :mod:`kvlayer`
are provided.
ElasticSearch based storage
===========================
:mod:`dossier.store` provi... | {
"repo_name": "dossier/dossier.store",
"path": "dossier/store/__init__.py",
"copies": "1",
"size": "3174",
"license": "mit",
"hash": 9137373948712843000,
"line_mean": 28.119266055,
"line_max": 72,
"alpha_frac": 0.6764335224,
"autogenerated": false,
"ratio": 3.720984759671747,
"config_test": fal... |
'''A simple storage interface for labels (ground truth data).
.. This software is released under an MIT/X11 open source license.
Copyright 2012-2014 Diffeo, Inc.
:mod:`dossier.label` provides a convenient interface to a
:mod:`kvlayer` table for storing ground truth data, otherwise known as
"labels." Each label, at... | {
"repo_name": "dossier/dossier.label",
"path": "dossier/label/__init__.py",
"copies": "1",
"size": "2292",
"license": "mit",
"hash": -4056349066417656300,
"line_mean": 30.8333333333,
"line_max": 76,
"alpha_frac": 0.7059336824,
"autogenerated": false,
"ratio": 3.794701986754967,
"config_test": f... |
"""A simple store using only in-process memory."""
from __future__ import unicode_literals
import copy
import time
import six
from openid.store import nonce
class ServerAssocs(object):
def __init__(self):
self.assocs = {}
def set(self, assoc):
self.assocs[assoc.handle] = assoc
def get... | {
"repo_name": "openid/python-openid",
"path": "openid/store/memstore.py",
"copies": "1",
"size": "3649",
"license": "apache-2.0",
"hash": -3276404655914737000,
"line_mean": 27.5078125,
"line_max": 94,
"alpha_frac": 0.5861879967,
"autogenerated": false,
"ratio": 4.058954393770857,
"config_test":... |
#A simple substitution encryption using alphabet strings and dictionaries
"""
Good programming practice tells us to make as few heavy system calls as possible. And where possible, we should front-load the heavy work if it will save us significant time later. crypt-1 called shift() for each character in the phrase. Tha... | {
"repo_name": "mttaggart/python-cs",
"path": "crypt/crypt-2.py",
"copies": "1",
"size": "1524",
"license": "mit",
"hash": 5558027791181760000,
"line_mean": 33.6363636364,
"line_max": 408,
"alpha_frac": 0.6738845144,
"autogenerated": false,
"ratio": 4.118918918918919,
"config_test": false,
"ha... |
#A simple substitution encryption using alphabet strings
import string
import sys #Hey, a new module!
args = sys.argv
try:
shift_count = int(sys.argv[1])
except:
shift_count = 0
try:
phrase_to_encrypt = sys.argv[2]
except IndexError:
print("No phrase given!")
exit()
lowers = string.ascii_lowercase
... | {
"repo_name": "mttaggart/python-cs",
"path": "crypt/crypt-1.py",
"copies": "1",
"size": "1574",
"license": "mit",
"hash": 2577147471215328000,
"line_mean": 31.1224489796,
"line_max": 265,
"alpha_frac": 0.6880559085,
"autogenerated": false,
"ratio": 4.098958333333333,
"config_test": false,
"ha... |
"""A simple tasks manager using the Dropbox Datastore API.
This example requires Python 2.7 (for OrderedDict).
This uses the same data model as the JavaScript tutorial example.
The code is somewhat uncharacteristic for Flask apps (e.g. it doesn't
use template files). The advantage of this style is that the entire
a... | {
"repo_name": "bhunter/stopdroproll",
"path": "src/dropbox-python-sdk-2.1.0/example/datastore_app/tasks.py",
"copies": "6",
"size": "7334",
"license": "isc",
"hash": 956610087651548000,
"line_mean": 31.5955555556,
"line_max": 100,
"alpha_frac": 0.5784019635,
"autogenerated": false,
"ratio": 4.047... |
# A simple test for a vtkTkRenderWidget. Run it like so:
# python TestTkRenderWidget.py -B $VTK_DATA_ROOT/Baseline/Rendering
import os
import vtk
from vtk.test import Testing
import Tkinter
from vtk.tk.vtkTkRenderWidget import vtkTkRenderWidget
class TestTkRenderWidget(Testing.vtkTest):
# Stick your VTK ... | {
"repo_name": "sgh/vtk",
"path": "Rendering/Testing/Python/TestTkRenderWidget.py",
"copies": "2",
"size": "1845",
"license": "bsd-3-clause",
"hash": 1545545865803008000,
"line_mean": 27.3846153846,
"line_max": 72,
"alpha_frac": 0.6764227642,
"autogenerated": false,
"ratio": 3.742393509127789,
"... |
# a simple text encoder using the Huffman coding algorithm
class TreeNode:
parent, child0, child1 = None, None, None
is_leaf = False
code = ''
def __init__(self, child0, child1):
self.count = child0.count + child1.count
self.child0, self.child1 = child0, child1
def set_children_code... | {
"repo_name": "m-elagdar/Assignments",
"path": "huffman_encoder.py",
"copies": "1",
"size": "2541",
"license": "apache-2.0",
"hash": 5948893015218084000,
"line_mean": 35.3142857143,
"line_max": 109,
"alpha_frac": 0.6253443526,
"autogenerated": false,
"ratio": 3.2164556962025315,
"config_test": ... |
"""A simple text window used to display either Python code with some
simple syntax highlighting, or some other document which will be formatted as
though it was an html file or a simple text file.
The syntax highlighter for Python code is really inadequate; HELP!! :-)
"""
try:
from PyQt4 import QtGui, QtCore
... | {
"repo_name": "aroberge/easygui_qt",
"path": "easygui_qt/show_text_window.py",
"copies": "1",
"size": "5272",
"license": "bsd-3-clause",
"hash": -8414295623541997000,
"line_mean": 32.3670886076,
"line_max": 93,
"alpha_frac": 0.5992033384,
"autogenerated": false,
"ratio": 3.984882842025699,
"con... |
"""A simple, threaded HTTPS server."""
from http.server import HTTPServer, SimpleHTTPRequestHandler
from socketserver import ThreadingMixIn
from ssl import wrap_socket
from typing import Mapping
__version__ = '0.1'
__author__ = 'Chris Calderon'
__email__ = 'pythonwiz@protonmail.com'
__license__ = 'MIT'
class Threade... | {
"repo_name": "ChrisCalderon/webserver",
"path": "webserver/__init__.py",
"copies": "1",
"size": "2368",
"license": "mit",
"hash": -4233666685929304000,
"line_mean": 32.8285714286,
"line_max": 72,
"alpha_frac": 0.5760135135,
"autogenerated": false,
"ratio": 4.369003690036901,
"config_test": fal... |
"""A simple thread subclass for making ev3 function calls asynchronous.
EXAMPLE USAGE:
import time
from ev3 import *
finished = False
def keep_alive_finished(result):
global finished
print 'The keep_alive() function returned: ', result
finished = True
if ("__main__" =... | {
"repo_name": "inductivekickback/ev3",
"path": "ev3/async.py",
"copies": "1",
"size": "2034",
"license": "mit",
"hash": -7988026229714290000,
"line_mean": 21.3516483516,
"line_max": 79,
"alpha_frac": 0.5486725664,
"autogenerated": false,
"ratio": 4.355460385438972,
"config_test": false,
"has_... |
"""A simple three-species chemical kinetics system known as "Robertson's
example", as presented in:
H. H. Robertson, The solution of a set of reaction rate equations, in Numerical
Analysis: An Introduction, J. Walsh, ed., Academic Press, 1966, pp. 178-182.
"""
# exported from PySB model 'robertson'
import numpy
impo... | {
"repo_name": "LoLab-VU/pysb",
"path": "doc/examples/robertson_standalone.py",
"copies": "5",
"size": "4685",
"license": "bsd-2-clause",
"hash": -6646888092559642000,
"line_mean": 35.0384615385,
"line_max": 80,
"alpha_frac": 0.5592315902,
"autogenerated": false,
"ratio": 3.4072727272727272,
"co... |
# A simple tool to connect to the Ensembl server and retrieve feature
# information using the Ensembl REST API.
from __future__ import print_function
import json
import optparse
from itertools import islice
import requests
from six.moves.urllib.parse import urljoin
parser = optparse.OptionParser()
parser.add_option(... | {
"repo_name": "anilthanki/tgac-galaxytools",
"path": "tools/Ensembl-REST/get_feature_info.py",
"copies": "2",
"size": "1637",
"license": "mit",
"hash": -4122030656891136500,
"line_mean": 29.3148148148,
"line_max": 175,
"alpha_frac": 0.6188149053,
"autogenerated": false,
"ratio": 3.806976744186046... |
# A simple tool to connect to the Ensembl server and retrieve feature
# information using the Ensembl REST API.
from __future__ import print_function
import json
import optparse
import requests
from six.moves.urllib.parse import urljoin
parser = optparse.OptionParser()
parser.add_option('-i', '--input', help='List o... | {
"repo_name": "PerlaTroncosoRey/tgac-galaxytools",
"path": "tools/Ensembl-REST/get_feature_info.py",
"copies": "2",
"size": "1619",
"license": "mit",
"hash": -6053193215913318000,
"line_mean": 36.6511627907,
"line_max": 175,
"alpha_frac": 0.6565781347,
"autogenerated": false,
"ratio": 3.687927107... |
# A simple tool to connect to the Ensembl server and retrieve genetree using
# the Ensembl REST API.
from __future__ import print_function
import optparse
import requests
from six.moves.urllib.parse import urljoin
parser = optparse.OptionParser()
parser.add_option('--id_type', type='choice', default='gene_id',
... | {
"repo_name": "TGAC/earlham-galaxytools",
"path": "tools/Ensembl-REST/get_genetree.py",
"copies": "1",
"size": "2401",
"license": "mit",
"hash": 6423734922536142000,
"line_mean": 41.875,
"line_max": 152,
"alpha_frac": 0.6322365681,
"autogenerated": false,
"ratio": 3.49490538573508,
"config_test... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.