text stringlengths 0 1.05M | meta dict |
|---|---|
# Adafruit CC3000 Library Test Data Generator
# Created by Tony DiCola (tony@tonydicola.com)
# Released with the same license as the Adafruit CC3000 library (BSD)
# Create a simple server to listen by default on port 9000 (or on the port specified in
# the first command line parameter), accept any connections, and gen... | {
"repo_name": "tdicola/adafruit_cc3000",
"path": "Rxspeed/generator.py",
"copies": "1",
"size": "2298",
"license": "mit",
"hash": 6969161989438765000,
"line_mean": 34.921875,
"line_max": 89,
"alpha_frac": 0.7458659704,
"autogenerated": false,
"ratio": 3.6246056782334386,
"config_test": false,
... |
from __future__ import print_function
import os
import click
import ampy.files as files
import ampy.pyboard as pyboard
_board = None
@click.group()
@click.option('--port', '-p', envvar='AMPY_PORT', required=True, type=click.STRING,
help='Name of serial port for connected board. Can optionally speci... | {
"repo_name": "Neradoc/ampy",
"path": "ampy/cli.py",
"copies": "1",
"size": "8092",
"license": "mit",
"hash": 2411394328299610600,
"line_mean": 36.2903225806,
"line_max": 148,
"alpha_frac": 0.7016806723,
"autogenerated": false,
"ratio": 3.9338842975206614,
"config_test": false,
"has_no_keywor... |
import ast
import textwrap
from pprint import pformat
from ampy.pyboard import PyboardError
BUFFER_SIZE = 32 # Amount of data to read or write to the serial port at a time.
# This is kept small because small chips and USB to serial
# bridges usually have very small buffers.
cla... | {
"repo_name": "Neradoc/ampy",
"path": "ampy/files.py",
"copies": "1",
"size": "8192",
"license": "mit",
"hash": -7889592218539680000,
"line_mean": 43.2810810811,
"line_max": 87,
"alpha_frac": 0.6042480469,
"autogenerated": false,
"ratio": 4.268890046899426,
"config_test": false,
"has_no_keywo... |
import ast
import textwrap
# Amount of data to read or write to the serial port at a time.
BUFFER_SIZE = 32
# This is kept small because small chips and USB to serial
# bridges usually have very small buffers.
SELECTED_TEXT = None
class DirectoryExistsError(Exception):
pass
class PyboardError(BaseException)... | {
"repo_name": "gepd/uPiotMicroPythonTool",
"path": "tools/ampy/files.py",
"copies": "1",
"size": "10021",
"license": "mit",
"hash": 6284555676198870000,
"line_mean": 37.102661597,
"line_max": 83,
"alpha_frac": 0.5776868576,
"autogenerated": false,
"ratio": 4.5119315623592975,
"config_test": fal... |
import atexit
import _rpi_ws281x as ws
class _LED_Data(object):
"""Wrapper class which makes a SWIG LED color data array look and feel like
a Python list of integers.
"""
def __init__(self, channel, size):
self.size = size
self.channel = channel
def __getitem__(self, pos):
"""Return the 24-bit RGB color v... | {
"repo_name": "vinhui/chistmastree",
"path": "neopixel.py",
"copies": "1",
"size": "5396",
"license": "mit",
"hash": 2701223327000364000,
"line_mean": 36.2137931034,
"line_max": 87,
"alpha_frac": 0.704966642,
"autogenerated": false,
"ratio": 3.0314606741573034,
"config_test": false,
"has_no_k... |
import atexit
import _rpi_ws281x as ws
def Color(red, green, blue, white = 0):
"""Convert the provided red, green, blue color to a 24-bit color value.
Each color component should be a value 0-255 where 0 is the lowest intensity
and 255 is the highest intensity.
"""
return (white << 24) | (red << 16)| (green << ... | {
"repo_name": "weidnerm/pi-ws2812",
"path": "python/neopixel.py",
"copies": "2",
"size": "5683",
"license": "bsd-2-clause",
"hash": -1593879514440192500,
"line_mean": 35.9025974026,
"line_max": 87,
"alpha_frac": 0.7035016717,
"autogenerated": false,
"ratio": 3.045551982851018,
"config_test": fa... |
import _rpi_ws281x as ws
import atexit
def Color(red, green, blue):
"""Convert the provided red, green, blue color to a 24-bit color value.
Each color component should be a value 0-255 where 0 is the lowest intensity
and 255 is the highest intensity.
"""
return (red << 16) | (green << 8) | blue
class _LED_Data... | {
"repo_name": "wannabeCitizen/FireflySim",
"path": "neopixel.py",
"copies": "2",
"size": "5337",
"license": "mit",
"hash": -4299203039890732500,
"line_mean": 34.1118421053,
"line_max": 94,
"alpha_frac": 0.6987071388,
"autogenerated": false,
"ratio": 3.003376477208779,
"config_test": false,
"h... |
import _rpi_ws281x as ws
def Color(red, green, blue):
"""Convert the provided red, green, blue color to a 24-bit color value.
Each color component should be a value 0-255 where 0 is the lowest intensity
and 255 is the highest intensity.
"""
return (red << 16) | (green << 8) | blue
class _LED_Data(object):
"""... | {
"repo_name": "hemstreet/Spruce-Sign",
"path": "node_modules/rpi-ws281x-native/src/rpi2_ws281x/python/neopixel.py",
"copies": "18",
"size": "5022",
"license": "mit",
"hash": -3563247331529087000,
"line_mean": 35.3913043478,
"line_max": 94,
"alpha_frac": 0.704699323,
"autogenerated": false,
"ratio... |
import binascii
from functools import reduce
import logging
import time
import Adafruit_GPIO as GPIO
import Adafruit_GPIO.SPI as SPI
PN532_PREAMBLE = 0x00
PN532_STARTCODE1 = 0x00
PN532_STARTCODE2 = 0xFF
PN532_POSTAMBLE = 0x00
PN532_HOSTT... | {
"repo_name": "adafruit/Adafruit_Python_PN532",
"path": "Adafruit_PN532/PN532.py",
"copies": "1",
"size": "19600",
"license": "mit",
"hash": 3700621445730146000,
"line_mean": 43.6469248292,
"line_max": 247,
"alpha_frac": 0.608622449,
"autogenerated": false,
"ratio": 3.6621823617339313,
"config_... |
import binascii
import logging
import time
import Adafruit_GPIO as GPIO
import Adafruit_GPIO.SPI as SPI
PN532_PREAMBLE = 0x00
PN532_STARTCODE1 = 0x00
PN532_STARTCODE2 = 0xFF
PN532_POSTAMBLE = 0x00
PN532_HOSTTOPN532 = 0x... | {
"repo_name": "t0adie/Adafruit_python_PN532",
"path": "build/lib.linux-armv7l-2.7/Adafruit_PN532/PN532.py",
"copies": "2",
"size": "19014",
"license": "mit",
"hash": 5865809241019065000,
"line_mean": 43.6338028169,
"line_max": 247,
"alpha_frac": 0.6087619649,
"autogenerated": false,
"ratio": 3.63... |
import atexit
import logging
import subprocess
import sys
import time
import Adafruit_MPR121.MPR121 as MPR121
import RPi.GPIO as GPIO
import uinput
# Define mapping of capacitive touch pin presses to keyboard button presses.
KEY_MAPPING = {
0: uinput.KEY_UP, # Each line here should define a dict ... | {
"repo_name": "sgillet1007/raspi_capacitive_drums_scripts",
"path": "examples/keyboard.py",
"copies": "3",
"size": "5758",
"license": "mit",
"hash": -4640473046591304000,
"line_mean": 39.5492957746,
"line_max": 130,
"alpha_frac": 0.7110107676,
"autogenerated": false,
"ratio": 3.585305105853051,
... |
##--Adafruit tutorials -- http://learn.adafruit.com/adafruits-raspberry-pi-lesson-10-stepper-motors
##--Library that controls a stepper motor
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
delay = 5 #milliseconds
#Setup Stepper Motor
coil_A_1_pin = 4
coil_A_2_pin = 17
coil_B_1_pin = 23
coil_B_2_pin = 24... | {
"repo_name": "flyinactor91/Raspi-Hardware",
"path": "Motors/StepperLib.py",
"copies": "1",
"size": "1088",
"license": "mit",
"hash": -1012725041734509600,
"line_mean": 21.6666666667,
"line_max": 99,
"alpha_frac": 0.6746323529,
"autogenerated": false,
"ratio": 2.120857699805068,
"config_test": ... |
"""Adagrad for TensorFlow."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.ops import constant_op
from tensorflow.python.training import optimizer
from tensorflow.python.training import tr... | {
"repo_name": "pavlovml/tensorflow",
"path": "tensorflow/python/training/adagrad.py",
"copies": "5",
"size": "2358",
"license": "apache-2.0",
"hash": -2534742444182775300,
"line_mean": 37.0322580645,
"line_max": 78,
"alpha_frac": 0.6675148431,
"autogenerated": false,
"ratio": 4.06551724137931,
... |
"""Adagrad for TensorFlow."""
from tensorflow.python.framework import ops
from tensorflow.python.ops import constant_op
from tensorflow.python.training import optimizer
from tensorflow.python.training import training_ops
class AdagradOptimizer(optimizer.Optimizer):
"""Optimizer that implements the Adagrad algorithm... | {
"repo_name": "brendandburns/tensorflow",
"path": "tensorflow/python/training/adagrad.py",
"copies": "5",
"size": "2248",
"license": "apache-2.0",
"hash": -8380016622748206000,
"line_mean": 37.7586206897,
"line_max": 78,
"alpha_frac": 0.6632562278,
"autogenerated": false,
"ratio": 4.0577617328519... |
""" AdaHessian Optimizer
Lifted from https://github.com/davda54/ada-hessian/blob/master/ada_hessian.py
Originally licensed MIT, Copyright 2020, David Samuel
"""
import torch
class Adahessian(torch.optim.Optimizer):
"""
Implements the AdaHessian algorithm from "ADAHESSIAN: An Adaptive Second OrderOptimizer fo... | {
"repo_name": "rwightman/pytorch-image-models",
"path": "timm/optim/adahessian.py",
"copies": "1",
"size": "6535",
"license": "apache-2.0",
"hash": 489241746170147260,
"line_mean": 40.891025641,
"line_max": 129,
"alpha_frac": 0.5834736037,
"autogenerated": false,
"ratio": 3.7994186046511627,
"c... |
"""A Dakotathon uncertainty quantification experiment with Hydrotrend.
This experiment uses the `Sampling`_ method to assess the effect of
uncertain mean annual temperature and total annual precipitation
values on the median value of suspended sediment load of the Waipaoa
River over a 10-year interval. The temperature... | {
"repo_name": "mdpiper/AGU-2016",
"path": "hydrotrend-Qs-sampling-study/hydrotrend-sampling-study.py",
"copies": "1",
"size": "2647",
"license": "mit",
"hash": -1752108335903589000,
"line_mean": 35.2602739726,
"line_max": 103,
"alpha_frac": 0.7321496033,
"autogenerated": false,
"ratio": 3.3506329... |
"""A Dakotathon uncertainty quantification experiment with Hydrotrend.
This experiment uses the `Sampling`_ method to assess the effect of
uncertain mean annual temperature (*T*) and total annual precipitation
(*P*) on the maximum value of suspended sediment concentration (*Cs*)
in the Waipaoa River over 1000-year int... | {
"repo_name": "mdpiper/AGU-2016",
"path": "hydrotrend-Cs-sampling-study/hydrotrend-Cs-sampling-study.py",
"copies": "1",
"size": "2914",
"license": "mit",
"hash": 3669670358931460600,
"line_mean": 36.8441558442,
"line_max": 103,
"alpha_frac": 0.7148249828,
"autogenerated": false,
"ratio": 3.29638... |
'''adalfns - place to store azurerm functions which call adal routines'''
import json
import codecs
import os
import requests
from datetime import datetime as dt
import adal
from .settings import get_auth_endpoint, get_resource_endpoint
def get_access_token(tenant_id, application_id, application_secret):
'''get... | {
"repo_name": "gbowerman/azurerm",
"path": "azurerm/adalfns.py",
"copies": "1",
"size": "4400",
"license": "mit",
"hash": 2724203943865479000,
"line_mean": 40.9047619048,
"line_max": 99,
"alpha_frac": 0.5893181818,
"autogenerated": false,
"ratio": 4.127579737335835,
"config_test": false,
"has... |
# ADALINE MODULE
######################################################
DEBUG_W = 0;
class Adaline:
# > Global constants
# > Constructor
# > > n = number of dendrites of the neuron
# > > r = neuron learning rate in (0,1]
# > > inf = lower value of activation function (-1 or 0), defaul... | {
"repo_name": "cabraile/RNA-Modules",
"path": "rna_module.py",
"copies": "1",
"size": "2292",
"license": "mit",
"hash": -5527180974364159000,
"line_mean": 29.972972973,
"line_max": 103,
"alpha_frac": 0.4659685864,
"autogenerated": false,
"ratio": 3.6265822784810124,
"config_test": false,
"has... |
import logging
import os
import platform
import re
import sys
import subprocess
import threading
import time
from .base import Programmer
from ..errors import AdaLinkError
# OSX GUI-based app does not has the same PATH as terminal-based
if platform.system() == 'Darwin':
os.environ["PATH"] = os.environ["PATH"] + '... | {
"repo_name": "adafruit/Adafruit_Adalink",
"path": "adalink/programmers/raspi2.py",
"copies": "1",
"size": "8576",
"license": "mit",
"hash": 8282561190954568000,
"line_mean": 41.0392156863,
"line_max": 102,
"alpha_frac": 0.6028451493,
"autogenerated": false,
"ratio": 4.149008224479923,
"config_... |
# adalink Segger JLink Programmer
#
# Python interface to communicate with a JLink device using the native JLinkExe
# tool provided by Segger. Note that you must have installed Segger JLink
# software from:
# https://www.segger.com/jlink-software.html
#
# Additionally the JLinkExe should be in your system path (or e... | {
"repo_name": "georgeredinger/Adafruit_Adalink",
"path": "adalink/programmers/jlink.py",
"copies": "1",
"size": "8160",
"license": "mit",
"hash": 935020230436525700,
"line_mean": 39.8,
"line_max": 106,
"alpha_frac": 0.6118872549,
"autogenerated": false,
"ratio": 4.1421319796954315,
"config_test... |
import logging
import os
import platform
import re
import sys
import subprocess
import threading
import time
from .base import Programmer
from ..errors import AdaLinkError
logger = logging.getLogger(__name__)
class STLink(Programmer):
# Name used to identify this programmer on the command line.
name = 'st... | {
"repo_name": "georgeredinger/Adafruit_Adalink",
"path": "adalink/programmers/stlink.py",
"copies": "1",
"size": "8130",
"license": "mit",
"hash": 1547223673029283600,
"line_mean": 40.9072164948,
"line_max": 107,
"alpha_frac": 0.6022140221,
"autogenerated": false,
"ratio": 4.223376623376623,
"c... |
import logging
import os
import platform
import re
import sys
import subprocess
import threading
import time
from .base import Programmer
from ..errors import AdaLinkError
# OSX GUI-based app does not has the same PATH as terminal-based
if platform.system() == 'Darwin':
os.environ["PATH"] = os.environ["PATH"] + '... | {
"repo_name": "adafruit/Adafruit_Adalink",
"path": "adalink/programmers/stlink.py",
"copies": "1",
"size": "8581",
"license": "mit",
"hash": 5563684736325253000,
"line_mean": 41.0637254902,
"line_max": 107,
"alpha_frac": 0.6027269549,
"autogenerated": false,
"ratio": 4.1817738791423,
"config_te... |
""" adalist_LBLA.py - list images is part of the
LOB Demo Center mod_python/APACHE web application
$Date: 2008-08-29 16:46:45 +0200 (Fri, 29 Aug 2008) $
$Rev: 67 $
"""
# Copyright 2004-2008 Software AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complia... | {
"repo_name": "flavio-casacurta/Nat2Py",
"path": "Adabas/demo/LobDemoCenter/adalist_LBLA.py",
"copies": "1",
"size": "5399",
"license": "mit",
"hash": 977428143709212300,
"line_mean": 28.1837837838,
"line_max": 119,
"alpha_frac": 0.5426930913,
"autogenerated": false,
"ratio": 3.029741863075196,
... |
"""adam.adam_2
"""
# pylint: disable=C0111
import ctypes
import functools
import operator
def trigger_infinite_loop():
result = None
# When `break` becomes `continue`, this should enter an infinite loop. This
# helps us test timeouts.
# Any object which isn't None passes the truth value testing so h... | {
"repo_name": "sixty-north/cosmic-ray",
"path": "tests/resources/example_project/adam/adam_2.py",
"copies": "1",
"size": "1630",
"license": "mit",
"hash": -5060598191471573000,
"line_mean": 21.3287671233,
"line_max": 79,
"alpha_frac": 0.6484662577,
"autogenerated": false,
"ratio": 3.8902147971360... |
'''Adam Chyb's personal website.'''
from __future__ import absolute_import, print_function
import json
import os
import flask_assetrev
from flask import Flask, g, render_template, send_from_directory
app = Flask(__name__)
app.config.from_object('config')
flask_assetrev.AssetRev(app)
def after_this_request(func):
... | {
"repo_name": "Chybby/chybby.com",
"path": "chybby.py",
"copies": "1",
"size": "1613",
"license": "mit",
"hash": -5223848490077572000,
"line_mean": 25.8833333333,
"line_max": 78,
"alpha_frac": 0.6540607564,
"autogenerated": false,
"ratio": 3.9245742092457423,
"config_test": false,
"has_no_key... |
"""Adam for TensorFlow."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.ops import constant_op
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import math_ops... | {
"repo_name": "brodyh/tensorflow",
"path": "tensorflow/python/training/adam.py",
"copies": "5",
"size": "5747",
"license": "apache-2.0",
"hash": -2943852589925192000,
"line_mean": 38.3630136986,
"line_max": 79,
"alpha_frac": 0.6293718462,
"autogenerated": false,
"ratio": 3.3786008230452675,
"co... |
"""Adam for TensorFlow."""
from tensorflow.python.framework import ops
from tensorflow.python.ops import constant_op
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import state_ops
from tensorflow.python.ops import variables
from tensorflow.pytho... | {
"repo_name": "javierblasco/tensorflow",
"path": "tensorflow/python/training/adam.py",
"copies": "5",
"size": "5637",
"license": "apache-2.0",
"hash": -2820761840088296000,
"line_mean": 38.6971830986,
"line_max": 79,
"alpha_frac": 0.6269292177,
"autogenerated": false,
"ratio": 3.365373134328358,
... |
# a damped, driven pendulum, from Pang, Ch. 4
import math
import numpy
import pylab
class ddpend:
def __init__(self, theta0, omega0, q, b, omega_d):
self.theta0 = theta0 # initial angular displacement
self.omega0 = omega0 # initial angular displacement
self.q = q # ... | {
"repo_name": "bt3gl/Numerical-Methods-for-Physics",
"path": "others/FFT/chaotic_pend.py",
"copies": "1",
"size": "6348",
"license": "apache-2.0",
"hash": -5895859036236177000,
"line_mean": 22.2527472527,
"line_max": 85,
"alpha_frac": 0.5411153119,
"autogenerated": false,
"ratio": 2.8517520215633... |
# Adam Petrone
# August, 2014
import os
import sys
import logging
import subprocess
import platform
BOOTSTRAP_VIRTUALENV_PATH = "env"
REQUIREMENTS_FILE = "requirements"
def get_platform():
platform_line = platform.platform().lower()
if "linux" in platform_line:
return "linux"
elif "darwin" in platform_line:
... | {
"repo_name": "apetrone/gemini",
"path": "tools/bootstrap.py",
"copies": "1",
"size": "2384",
"license": "bsd-2-clause",
"hash": -5418729175523367000,
"line_mean": 22.3725490196,
"line_max": 81,
"alpha_frac": 0.7088926174,
"autogenerated": false,
"ratio": 3.0761290322580646,
"config_test": fals... |
#Adam Pikielny
#Graphics: Assets and Looping
from ggame import App, RectangleAsset, ImageAsset, SoundAsset, Sprite, Sound
from ggame import LineStyle, Color
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
green = Color(0x00ff00, 1)
black = Color(0, 1)
noline = LineStyle(0, black)
bg_asset = RectangleAsset(SCREEN_WIDTH, SCREE... | {
"repo_name": "APikielny/Final-Project-Tanks",
"path": "tutorial3.py",
"copies": "2",
"size": "1710",
"license": "mit",
"hash": 386538838710562560,
"line_mean": 23.7971014493,
"line_max": 76,
"alpha_frac": 0.698245614,
"autogenerated": false,
"ratio": 2.7142857142857144,
"config_test": false,
... |
#adam-use# I THINK: that this is only useful if you have some spec-z's, have already run redsequence.py, and want to examine how well you did getting photo-z's for red-sequence galaxies
# usage: python redsequence [options]
# Identifies and fits the red sequence using apparent magnitude and one color.
# Option of ide... | {
"repo_name": "deapplegate/wtgpipeline",
"path": "plot_rederr.py",
"copies": "1",
"size": "25190",
"license": "mit",
"hash": -1687274840036644400,
"line_mean": 45.3904235727,
"line_max": 309,
"alpha_frac": 0.3617705439,
"autogenerated": false,
"ratio": 4.514336917562724,
"config_test": false,
... |
#adam-use# I THINK: you run redsequence.py before plot_rederr.py. This code identifies red-sequence galaxies!
# usage: python redsequence [options]
# Identifies and fits the red sequence using apparent magnitude and one color.
# Option of identifying star column and only using objects larger.
import pylab
params_pyl... | {
"repo_name": "deapplegate/wtgpipeline",
"path": "redsequence.py",
"copies": "1",
"size": "24118",
"license": "mit",
"hash": 7445156299636904000,
"line_mean": 33.1614730878,
"line_max": 499,
"alpha_frac": 0.5111120325,
"autogenerated": false,
"ratio": 3.4243930143404797,
"config_test": false,
... |
""" AdamW Optimizer
Impl copied from PyTorch master
"""
import math
import torch
from torch.optim.optimizer import Optimizer
class AdamW(Optimizer):
r"""Implements AdamW algorithm.
The original Adam algorithm was proposed in `Adam: A Method for Stochastic Optimization`_.
The AdamW variant was proposed in... | {
"repo_name": "rwightman/pytorch-image-models",
"path": "timm/optim/adamw.py",
"copies": "1",
"size": "4965",
"license": "apache-2.0",
"hash": 4645784281835121000,
"line_mean": 41.4358974359,
"line_max": 116,
"alpha_frac": 0.5605236657,
"autogenerated": false,
"ratio": 4.089785831960461,
"confi... |
"""AdaNet metrics objects and functions.
Copyright 2019 The AdaNet Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Un... | {
"repo_name": "tensorflow/adanet",
"path": "adanet/core/eval_metrics.py",
"copies": "1",
"size": "16930",
"license": "apache-2.0",
"hash": -4162207008953322500,
"line_mean": 38.6487119438,
"line_max": 109,
"alpha_frac": 0.6600708801,
"autogenerated": false,
"ratio": 3.8955361251725726,
"config_... |
# adaped from https://www.djangosnippets.org/snippets/1376/
from os.path import dirname, join, abspath, isdir
from django.apps import apps
from django.core.exceptions import ImproperlyConfigured
from django.template import TemplateDoesNotExist
from django.template.loaders.filesystem import Loader
class NameSpacedLoad... | {
"repo_name": "ojousima/asylum",
"path": "project/asylum/apptemplateloader.py",
"copies": "1",
"size": "1422",
"license": "mit",
"hash": 9164304903014735000,
"line_mean": 37.4324324324,
"line_max": 90,
"alpha_frac": 0.6842475387,
"autogenerated": false,
"ratio": 4.375384615384616,
"config_test"... |
# Adaptado por Artur Augusto - arturaugusto@gmail.com
# This is a near-verbatim translation of the example program
# C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage\Acq-Int Clk\Acq-IntClk.c
import ctypes
import numpy
import time
class DAQmx:
##############################
... | {
"repo_name": "arturaugusto/nidaq",
"path": "nidaq.py",
"copies": "1",
"size": "3248",
"license": "mit",
"hash": -7518471657855507000,
"line_mean": 29.3551401869,
"line_max": 119,
"alpha_frac": 0.6761083744,
"autogenerated": false,
"ratio": 2.734006734006734,
"config_test": false,
"has_no_key... |
"""Adapt an HTTP server."""
import time
class ServerAdapter(object):
"""Adapter for an HTTP server.
If you need to start more than one HTTP server (to serve on multiple
ports, or protocols, etc.), you can manually register each one and then
start them all with bus.start:
s1 = Server... | {
"repo_name": "Apsistec/vboxweb",
"path": "cherrypy/process/servers.py",
"copies": "13",
"size": "9565",
"license": "mit",
"hash": 5483303350625130000,
"line_mean": 34.9586466165,
"line_max": 85,
"alpha_frac": 0.5766858338,
"autogenerated": false,
"ratio": 4.032462057335581,
"config_test": fals... |
"""Adapt an HTTP server."""
import time
class ServerAdapter(object):
"""Adapter for an HTTP server.
If you need to start more than one HTTP server (to serve on multiple
ports, or protocols, etc.), you can manually register each one and then
start them all with bus.start:
... | {
"repo_name": "cread/ec2id",
"path": "cherrypy/process/servers.py",
"copies": "1",
"size": "9831",
"license": "apache-2.0",
"hash": -6917413908885389000,
"line_mean": 34.9586466165,
"line_max": 85,
"alpha_frac": 0.5610822907,
"autogenerated": false,
"ratio": 4.135885570046277,
"config_test": fa... |
'''Adaptation of Keras' 'conv_filter_visualization':
Visualization of the filters of foo_two, via gradient ascent in input space.
'''
from __future__ import print_function
from scipy.misc import imsave
import numpy as np
import time
from foo_three import foo
from keras import backend as K
import random
#flags to d... | {
"repo_name": "santiagolopezg/MODS_ConvNet",
"path": "STM_Code/filter_visualize.py",
"copies": "2",
"size": "6943",
"license": "mit",
"hash": -2294245628684149500,
"line_mean": 28.1722689076,
"line_max": 100,
"alpha_frac": 0.6557683998,
"autogenerated": false,
"ratio": 3.144474637681159,
"confi... |
'''Adaptation of the UJI dataset for the "sequential" version of the problem,
rather than the rasterized Dataset from dlt.data.
'''
import numpy as np
import matplotlib.pyplot as plt
import json
class Dataset:
def __init__(self, vocab, points, breaks, masks, labels):
self.vocab = vocab
self.point... | {
"repo_name": "DouglasOrr/DeepLearnTute",
"path": "dlt/sequence.py",
"copies": "1",
"size": "2510",
"license": "mit",
"hash": 2157138035160680400,
"line_mean": 38.21875,
"line_max": 77,
"alpha_frac": 0.5637450199,
"autogenerated": false,
"ratio": 3.6588921282798834,
"config_test": false,
"has... |
"""Adaptation of Trust Region Reflective algorithm for a linear least-squares
problem."""
import numpy as np
from numpy.linalg import norm
from scipy.linalg import qr, solve_triangular
from scipy.sparse.linalg import lsmr
from scipy.optimize import OptimizeResult
from .givens_elimination import givens_elimination
from... | {
"repo_name": "drpeteb/scipy",
"path": "scipy/optimize/_lsq/trf_linear.py",
"copies": "3",
"size": "7430",
"license": "bsd-3-clause",
"hash": -3934778815466446300,
"line_mean": 29.0809716599,
"line_max": 77,
"alpha_frac": 0.5582772544,
"autogenerated": false,
"ratio": 3.0425880425880427,
"confi... |
# adapted after https://github.com/oduerr/dl_tutorial/blob/master/lasagne/MinimalLasagneCNN.ipynb
import matplotlib.pyplot as plt
import matplotlib.image as imgplot
from lasagne import layers
from lasagne import nonlinearities
from nolearn.lasagne import NeuralNet
import cPickle as pickle
import gzip
import operator
i... | {
"repo_name": "big-data-research/nn_bucharest_workshop_2015",
"path": "nn_demo/cnn_example01.py",
"copies": "2",
"size": "2633",
"license": "apache-2.0",
"hash": 3726758901218209000,
"line_mean": 30.3571428571,
"line_max": 136,
"alpha_frac": 0.6483099126,
"autogenerated": false,
"ratio": 2.945190... |
# Adapted based on sample code by Christian Vogel (vogelchr@vogel.cx)
import math
import operator
import serial
class AM03127():
"""Runs a AM03127-based signboard (http://www.amplus.com.hk/ aka Maplin N00GA)"""
special_map = {
u'\n': ' ',
u'\r': '',
u'<': '<UBC>',
u'>': '<UBE... | {
"repo_name": "barfle/signboard",
"path": "py/AM03127.py",
"copies": "1",
"size": "4461",
"license": "bsd-3-clause",
"hash": 2198427868855969000,
"line_mean": 31.8014705882,
"line_max": 112,
"alpha_frac": 0.5144586416,
"autogenerated": false,
"ratio": 3.626829268292683,
"config_test": false,
... |
# Adapted by Ralph Haygood from the late, lamented sklearn.ensemble.partial_dependence.partial_dependence by Peter Prettenhofer.
#
# The function sklearn.ensemble.partial_dependence.partial_dependence, on which this package (sklearn-gbmi) depended, doesn't exist anymore. It was partially
# replaced by sklearn.inspectio... | {
"repo_name": "ralphhaygood/sklearn-gbmi",
"path": "sklearn_gbmi/partial_dependence.py",
"copies": "1",
"size": "1655",
"license": "mit",
"hash": -3790374796825950000,
"line_mean": 52.3870967742,
"line_max": 157,
"alpha_frac": 0.7510574018,
"autogenerated": false,
"ratio": 3.405349794238683,
"c... |
# Adapted by raspberrypilearning/the-all-seeing-pi from some original code by bennuttall and waveform80
# -------------------------------------------------------------
from PIL import Image
from itertools import chain #cycle
# EDIT THESE VALUES ------------------------
overlays_dir = "/home/pi/photobooth/tests/count... | {
"repo_name": "CaptFennec/photobooth",
"path": "tests/overlay_functions.py",
"copies": "1",
"size": "1894",
"license": "mit",
"hash": 5235295696794256000,
"line_mean": 28.59375,
"line_max": 103,
"alpha_frac": 0.626187962,
"autogenerated": false,
"ratio": 3.649325626204239,
"config_test": false,... |
# Adapted by Willie Lawrence from http://wiki.tcl.tk/27638
_DEFAULT_FONT = {
"a": [[4, 0, 1, 0, 0, 1, 0, 3, 1, 4, 4, 4, 4, 0]],
"b" : [[0, 6, 0, 0, 3, 0, 4, 1, 4, 3, 3, 4, 0, 4]],
"c" : [[4, 0, 1, 0, 0, 1, 0, 3, 1, 4, 4, 4]],
"d" : [[4, 6, 4, 0, 1, 0, 0, 1, 0, 3, 1, 4, 4, 4]],
"e" : [[4, 0, 1, 0, 0, 1, 0, 3, 1, 4,... | {
"repo_name": "cptx032/miniprojects",
"path": "vectorfont.py",
"copies": "1",
"size": "6682",
"license": "unlicense",
"hash": -8162188007733962000,
"line_mean": 36.1277777778,
"line_max": 86,
"alpha_frac": 0.3977850943,
"autogenerated": false,
"ratio": 1.8241878241878242,
"config_test": false,
... |
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2016-2020 Peter Hinch
# buttons.py For TFT driver.
# Adapted for (and requires) uasyncio V3
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2016-2020 Peter Hinch
import uasyncio as asyncio
from tft.driver.ugui import Touchable,... | {
"repo_name": "peterhinch/micropython-tft-gui",
"path": "tft/widgets/buttons.py",
"copies": "1",
"size": "7685",
"license": "mit",
"hash": 5603410194329479000,
"line_mean": 38.0101522843,
"line_max": 109,
"alpha_frac": 0.5927130774,
"autogenerated": false,
"ratio": 3.836744882675986,
"config_te... |
"""Adapted from A3CTFPolicy to add V-trace.
Keep in sync with changes to A3CTFPolicy and VtraceSurrogatePolicy."""
import numpy as np
import logging
import gym
import ray
from ray.rllib.agents.impala import vtrace_tf as vtrace
from ray.rllib.models.tf.tf_action_dist import Categorical
from ray.rllib.policy.sample_ba... | {
"repo_name": "richardliaw/ray",
"path": "rllib/agents/impala/vtrace_tf_policy.py",
"copies": "1",
"size": "11381",
"license": "apache-2.0",
"hash": -8767064036865366000,
"line_mean": 37.3198653199,
"line_max": 79,
"alpha_frac": 0.5960811879,
"autogenerated": false,
"ratio": 3.762314049586777,
... |
# Adapted from a Karma test startup script
# developebd by the Jupyter team here;
# https://github.com/jupyter/jupyter-js-services/blob/master/test/run_test.py
#
# Also uses the flow where we assign a os process group id and shut down the
# server based on that - since the subprocess actually executes the kbase-narrati... | {
"repo_name": "mlhenderson/narrative",
"path": "test/unit/run_tests.py",
"copies": "3",
"size": "2572",
"license": "mit",
"hash": 2487062675549614600,
"line_mean": 29.619047619,
"line_max": 116,
"alpha_frac": 0.6862363919,
"autogenerated": false,
"ratio": 3.4523489932885907,
"config_test": true... |
# adapted from an example in the eff-bot library guide: os-path-walk-example-3.py
import os
import fnmatch
class GlobDirectoryWalker:
# a forward iterator that traverses a directory tree
def __init__(self, directory, pattern="*"):
self.stack = [directory]
self.pattern = pattern
self.f... | {
"repo_name": "p4datasystems/CarnotKE",
"path": "jyhton/ast/globwalk.py",
"copies": "7",
"size": "1121",
"license": "apache-2.0",
"hash": 111662287126218670,
"line_mean": 32.9696969697,
"line_max": 81,
"alpha_frac": 0.5477252453,
"autogenerated": false,
"ratio": 4.413385826771654,
"config_test"... |
"""Adapted from a portion of the model published in:
Input-output behavior of ErbB signaling pathways as revealed by a mass action
model trained against dynamic data. William W Chen, Birgit Schoeberl, Paul J
Jasper, Mario Niepel, Ulrik B Nielsen, Douglas A Lauffenburger & Peter K
Sorger. Mol Syst Biol. 2009;5:239. Epu... | {
"repo_name": "johnbachman/pysb",
"path": "pysb/examples/kinase_cascade.py",
"copies": "5",
"size": "3732",
"license": "bsd-2-clause",
"hash": -8036622948339279000,
"line_mean": 40.010989011,
"line_max": 80,
"alpha_frac": 0.6621114684,
"autogenerated": false,
"ratio": 2.6714387974230496,
"confi... |
import numpy as np
def _wcs_to_celestial_frame_builtin(wcs):
from astropy.coordinates import FK4, FK4NoETerms, FK5, ICRS, Galactic
from astropy.time import Time
from astropy.wcs import WCSSUB_CELESTIAL
# Keep only the celestial part of the axes
wcs = wcs.sub([WCSSUB_CELESTIAL])
if wcs.wcs.l... | {
"repo_name": "JudoWill/glue",
"path": "glue/external/wcsaxes/wcs_utils.py",
"copies": "1",
"size": "4843",
"license": "bsd-3-clause",
"hash": 4348327445934383000,
"line_mean": 34.0942028986,
"line_max": 89,
"alpha_frac": 0.6659095602,
"autogenerated": false,
"ratio": 3.8497615262321143,
"confi... |
# Adapted from boids implementation by Stephen Chappell
# Accessed on 11/20/2012 at http://code.activestate.com/recipes/502240/
# Which was in turn motivated by the following pseudocode:
# http://www.vergenet.net/~conrad/boids/pseudocode.html
# Note: OSC messages (incoming and outgoing) are
# normalized to the r... | {
"repo_name": "tsob/EighthPlague",
"path": "swarm.py",
"copies": "1",
"size": "11042",
"license": "mit",
"hash": 6431619091029339000,
"line_mean": 32.3595166163,
"line_max": 108,
"alpha_frac": 0.5812352835,
"autogenerated": false,
"ratio": 3.273643640675956,
"config_test": false,
"has_no_keyw... |
# Adapted from Borgar: http://stackoverflow.com/questions/222581/python-script-for-minifying-css
# Public Domain as far as I can tell
#
import re
def minify_css(css):
output = ''
# remove comments - this will break a lot of hacks :-P
css = re.sub( r'\s*/\*\s*\*/', "$$HACK1$$", css ) # preserve IE<6 commen... | {
"repo_name": "josephwecker/zml",
"path": ".attic/cssmin.py",
"copies": "1",
"size": "1764",
"license": "mit",
"hash": -6554638939583472000,
"line_mean": 52.4545454545,
"line_max": 173,
"alpha_frac": 0.5379818594,
"autogenerated": false,
"ratio": 2.97972972972973,
"config_test": false,
"has_n... |
class PF59int(int):
"""Instances of this object are elements of the field GF(2^8)
Instances are integers in the range 0 to 255
This field is defined using the irreducable polynomial
x^8 + x^4 + x^3 + x + 1
and using 3 as the generator for the exponent table and log table.
"""
# Maps integer... | {
"repo_name": "dennismckinnon/RS-PF59",
"path": "ffp.py",
"copies": "1",
"size": "3403",
"license": "mit",
"hash": 2465249670744333000,
"line_mean": 34.8210526316,
"line_max": 139,
"alpha_frac": 0.5706729356,
"autogenerated": false,
"ratio": 3.2784200385356455,
"config_test": false,
"has_no_k... |
# Adapted from code written in 2005 by Peter Pearson and placed in the public domain.
from .Point import Point
def _leftmost_bit(x):
# this is closer to constant time than bit-twiddling hacks like those in
# https://graphics.stanford.edu/~seander/bithacks.html
assert x > 0
result = 1
while resul... | {
"repo_name": "shivaenigma/pycoin",
"path": "pycoin/ecdsa/Curve.py",
"copies": "1",
"size": "3384",
"license": "mit",
"hash": 3280825975484031500,
"line_mean": 25.6456692913,
"line_max": 94,
"alpha_frac": 0.4651300236,
"autogenerated": false,
"ratio": 3.3307086614173227,
"config_test": false,
... |
# adapted from cython/tests/run/builtin_abs.pyx
"""
>>> _abs = abs_as_name()
>>> _abs(-5)
5
>>> py_abs(-5)
5
>>> py_abs(-5.5)
5.5
>>> int(int32_abs(-5))
10
>>> int(int_abs(-5))
10
>>> int(long_abs(-5))
10
>>> int(ulong_abs(5))
10
>>> long_long_abs(-(2**33)) == 2**34
True
>>> ulong_long_abs(2**33) == 2**34
True
>>>... | {
"repo_name": "shiquanwang/numba",
"path": "numba/tests/builtins/test_builtin_abs.py",
"copies": "1",
"size": "1733",
"license": "bsd-2-clause",
"hash": -3461256406636048000,
"line_mean": 15.6634615385,
"line_max": 61,
"alpha_frac": 0.5966532025,
"autogenerated": false,
"ratio": 2.489942528735632... |
# Adapted from Daniel Birnbaum's histogram script
import argparse
import gzip
import pipes
import sys
from collections import Counter
import numpy
metrics = ['DP', 'GQ']
def main(args):
f = gzip.open(args.vcf) if args.vcf.endswith('.gz') else open(args.vcf)
if args.output is None: args.output = args.vcf.rep... | {
"repo_name": "konradjk/exac_browser",
"path": "src/precompute_histogram.py",
"copies": "4",
"size": "3502",
"license": "mit",
"hash": 8469355165498237000,
"line_mean": 29.4608695652,
"line_max": 103,
"alpha_frac": 0.5619645917,
"autogenerated": false,
"ratio": 3.6252587991718426,
"config_test"... |
# Adapted from django.contrib.flatpages.middleware
from django.conf import settings
from django.http import Http404, HttpResponse, HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404, render
from django.template import loader, engines
from django.utils.safestring import mark_safe
from airmozi... | {
"repo_name": "blossomica/airmozilla",
"path": "airmozilla/staticpages/views.py",
"copies": "2",
"size": "3146",
"license": "bsd-3-clause",
"hash": 5620058522961308000,
"line_mean": 32.1157894737,
"line_max": 76,
"alpha_frac": 0.6468531469,
"autogenerated": false,
"ratio": 4.161375661375661,
"c... |
# Adapted from Django-MoinMoin
#
# http://code.google.com/p/django-moinmoin/
#
# Visit that page for instructions on how to use ... but instead of copying your settings
# into this file, add this to your moin/wsgi script;
#
# os.environ['DJANGO_SETTINGS_MODULE'] = '<your_django_project>.settings'
#
from MoinMoin.a... | {
"repo_name": "dpla/zen",
"path": "etc/django-moin-auth/djangoAuth.py",
"copies": "2",
"size": "6431",
"license": "apache-2.0",
"hash": -9160776804598502000,
"line_mean": 38.4539877301,
"line_max": 136,
"alpha_frac": 0.5986627274,
"autogenerated": false,
"ratio": 4.264588859416445,
"config_test... |
"""Adapted from djcelery.models."""
import collections
import datetime
import itertools
import json
import celery.schedules
import pretty_cron
import sqlalchemy as sqla
from sqlalchemy import orm
from sqlalchemy.ext import declarative
class Base(object):
id = sqla.Column(sqla.Integer, primary_key=True)
Base =... | {
"repo_name": "adblair/celerycontrib.sqlalchemyscheduler",
"path": "celerycontrib/sqlalchemyscheduler/model.py",
"copies": "1",
"size": "5363",
"license": "mit",
"hash": 4432822859896694000,
"line_mean": 24.6602870813,
"line_max": 77,
"alpha_frac": 0.6009696066,
"autogenerated": false,
"ratio": 3... |
# Adapted from djpubsubhubbub. See License: http://git.participatoryculture.org/djpubsubhubbub/tree/LICENSE
from datetime import datetime, timedelta
import feedparser
import requests
import re
from django.conf import settings
from django.db import models
import hashlib
from apps.push import signals
from apps.rss_fee... | {
"repo_name": "eric-stanley/NewsBlur",
"path": "apps/push/models.py",
"copies": "2",
"size": "6465",
"license": "mit",
"hash": 5155356800891188000,
"line_mean": 36.8070175439,
"line_max": 107,
"alpha_frac": 0.5552977572,
"autogenerated": false,
"ratio": 4.267326732673268,
"config_test": false,
... |
# Adapted from djpubsubhubbub. See License: http://git.participatoryculture.org/djpubsubhubbub/tree/LICENSE
import feedparser
import random
import datetime
from django.http import HttpResponse, Http404
from django.shortcuts import get_object_or_404
from apps.push.models import PushSubscription
from apps.push.signals... | {
"repo_name": "samuelclay/NewsBlur",
"path": "apps/push/views.py",
"copies": "1",
"size": "3357",
"license": "mit",
"hash": -1604661393562460700,
"line_mean": 48.3676470588,
"line_max": 165,
"alpha_frac": 0.6234733393,
"autogenerated": false,
"ratio": 4.049457177322075,
"config_test": true,
"... |
# Adapted from djpubsubhubbub. See License: http://git.participatoryculture.org/djpubsubhubbub/tree/LICENSE
import feedparser
import random
from django.http import HttpResponse, Http404
from django.shortcuts import get_object_or_404
from apps.push.models import PushSubscription
from apps.push.signals import verified... | {
"repo_name": "eric-stanley/NewsBlur",
"path": "apps/push/views.py",
"copies": "3",
"size": "2496",
"license": "mit",
"hash": 6592566531701190000,
"line_mean": 42.7894736842,
"line_max": 138,
"alpha_frac": 0.6181891026,
"autogenerated": false,
"ratio": 4.146179401993355,
"config_test": false,
... |
import re
iana_schemes = [ # http://www.iana.org/assignments/uri-schemes.html
"ftp", "http", "gopher", "mailto", "news", "nntp", "telnet", "wais",
"file", "prospero", "z39.50s", "z39.50r", "cid", "mid", "vemmi",
"service", "imap", "nfs", "acap", "rtsp", "tip", "pop", "data", "dav",
"opaquelocktoken", "sip", "... | {
"repo_name": "jpmckinney/wikipedia-names-your-band",
"path": "html5lib/filters/rfc3987.py",
"copies": "4",
"size": "3613",
"license": "mit",
"hash": -7569966508733653000,
"line_mean": 44.7341772152,
"line_max": 166,
"alpha_frac": 0.5898145585,
"autogenerated": false,
"ratio": 2.9761120263591434,... |
# adapted from firebase/EventSource-Examples/python/chat.py by Shariq Hashme
from sseclient import SSEClient
import requests
from Queue import Queue
import json
import threading
import socket
class ClosableSSEClient(SSEClient):
def __init__(self, *args, **kwargs):
self.should_connect = True
sup... | {
"repo_name": "rliu42/WindowPane",
"path": "server/firebase.py",
"copies": "1",
"size": "3319",
"license": "mit",
"hash": -5598768159721898000,
"line_mean": 25.3492063492,
"line_max": 87,
"alpha_frac": 0.5598071708,
"autogenerated": false,
"ratio": 3.828143021914648,
"config_test": false,
"ha... |
# Adapted from galaxyzoo2.gz2string
def gal_string(datarow,survey='decals'):
""" Determine a string for the consensus GZ2 classification of a
galaxy's morphology.
Parameters
----------
datarow : astropy.io.fits.fitsrec.FITS_record
Iterated element (row) of a final
GZ2 tabl... | {
"repo_name": "willettk/decals",
"path": "python/gz_class.py",
"copies": "1",
"size": "33682",
"license": "mit",
"hash": 5583148498534427000,
"line_mean": 43.9093333333,
"line_max": 198,
"alpha_frac": 0.4367020961,
"autogenerated": false,
"ratio": 3.651957063862084,
"config_test": false,
"has... |
# Adapted from: github.com/aneesha/RAKE/rake.py
# Snipped from: http://sujitpal.blogspot.co.nz/2013/03/implementing-rake-algorithm-with-nltk.html
from __future__ import division
import operator
import nltk
import string
def isPunct(word):
return len(word) == 1 and word in string.punctuation
def isNumeric(word):
... | {
"repo_name": "ToferC/gcclassifier",
"path": "classifier/nltk_rake.py",
"copies": "1",
"size": "3327",
"license": "mit",
"hash": 4881785832597890000,
"line_mean": 34.0315789474,
"line_max": 97,
"alpha_frac": 0.6798917944,
"autogenerated": false,
"ratio": 3.6440306681270536,
"config_test": false... |
# Copyright (c) 2010, Philip Plante of EndlessPaths.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify... | {
"repo_name": "dingzg/onepanel",
"path": "lib/async_process.py",
"copies": "1",
"size": "3422",
"license": "apache-2.0",
"hash": -1971750091696505300,
"line_mean": 35.8064516129,
"line_max": 154,
"alpha_frac": 0.7101110462,
"autogenerated": false,
"ratio": 3.9652375434530707,
"config_test": fal... |
# Adapted from: Hidden Markov Models in Python
# Katrin Erk, March 2013
#
# This HMM addresses the problem of disfluency/end of utterance tagging.
# It estimates the probability of a tag sequence for a given word sequence as
# follows:
#
# Say words = w1....wN
# and tags = t1..tN
#
# then
# P(tags | words) is_proportio... | {
"repo_name": "dsg-bielefeld/deep_disfluency",
"path": "deep_disfluency/decoder/hmm.py",
"copies": "1",
"size": "38494",
"license": "mit",
"hash": 5625781579425193000,
"line_mean": 46.8781094527,
"line_max": 90,
"alpha_frac": 0.5206525692,
"autogenerated": false,
"ratio": 4.185495270196803,
"co... |
'''
The MIT License (MIT)
GrovePi for the Raspberry Pi: an open source platform for connecting Grove Sensors to the Raspberry Pi.
Copyright (C) 2015 Dexter Industries
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to... | {
"repo_name": "tienfuc/iotivity-democlient-snap",
"path": "extlibs/GrovePi/Projects/OLED Weather Station/weather_station.py",
"copies": "9",
"size": "3567",
"license": "apache-2.0",
"hash": 5960213971571810000,
"line_mean": 29.75,
"line_max": 103,
"alpha_frac": 0.6804037006,
"autogenerated": false,... |
# Adapted from http://code.activestate.com/recipes/578668-encode-multipart-form-data-for-uploading-files-via/
import random
def toMultipartMessage(fields, files):
def escape_quote(s):
return s.replace(b'"', b'\\"')
boundary = ''.join(random.choice("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr... | {
"repo_name": "JanSiebert/async-telegram-bot-python",
"path": "AsyncTelegramBot/Multipart.py",
"copies": "1",
"size": "1386",
"license": "mit",
"hash": -1639685851504686800,
"line_mean": 32,
"line_max": 138,
"alpha_frac": 0.575036075,
"autogenerated": false,
"ratio": 3.96,
"config_test": false,... |
# adapted from: http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode#Restarting_Daemon_Processes
import os
import sys
import time
import signal
import threading
import atexit
import Queue
_interval = 1.0
_times = {}
_files = []
_running = False
_queue = Queue.Queue()
_lock = threading.Lock()
def _restart(path)... | {
"repo_name": "pztrick/librewary",
"path": "monitor.py",
"copies": "1",
"size": "3042",
"license": "mit",
"hash": -9073830461368036000,
"line_mean": 24.1404958678,
"line_max": 101,
"alpha_frac": 0.5894148586,
"autogenerated": false,
"ratio": 4.133152173913044,
"config_test": false,
"has_no_ke... |
# adapted from http://djangosnippets.org/snippets/2236/
import math
from itertools import chain
from django.forms.util import flatatt
from django import forms
from django.forms import widgets
from django.utils.encoding import force_unicode
from django.utils.html import conditional_escape
from django.utils.safestring i... | {
"repo_name": "theworldbright/mainsite",
"path": "aspc/housing/forms/widgets.py",
"copies": "1",
"size": "5382",
"license": "mit",
"hash": -3948499760578862000,
"line_mean": 38.8740740741,
"line_max": 138,
"alpha_frac": 0.5994054255,
"autogenerated": false,
"ratio": 3.888728323699422,
"config_t... |
# adapted from http://djangosnippets.org/snippets/2236/
import math
from itertools import chain
from django.forms.utils import flatatt
from django import forms
from django.forms import widgets
from django.utils.encoding import force_unicode
from django.utils.html import conditional_escape
from django.utils.safestring ... | {
"repo_name": "aspc/mainsite",
"path": "aspc/housing/forms/widgets.py",
"copies": "1",
"size": "5383",
"license": "mit",
"hash": 2036253818505839900,
"line_mean": 38.8814814815,
"line_max": 138,
"alpha_frac": 0.599479844,
"autogenerated": false,
"ratio": 3.889450867052023,
"config_test": false,... |
# Adapted from http://github.com/ethereum/pyethapp/
from ethereum.utils import is_string, is_numeric, int_to_big_endian, encode_hex
def decode_number(data):
"""Decode `data` representing a number."""
if hasattr(data, '__int__'):
return data
elif not is_string(data):
success = False
elif... | {
"repo_name": "ryepdx/eth-testrpc",
"path": "testrpc/utils.py",
"copies": "2",
"size": "2268",
"license": "mit",
"hash": 6229898716961939000,
"line_mean": 30.9436619718,
"line_max": 95,
"alpha_frac": 0.5714285714,
"autogenerated": false,
"ratio": 3.5108359133126936,
"config_test": false,
"has... |
# * adapted from http://goo.gl/Us9ps
# * backported from python-3.2+
# * numpy array compatible using joblib.hash
from collections import namedtuple
from functools import update_wrapper
from threading import Lock
_CacheInfo = namedtuple("CacheInfo", ["hits", "misses", "maxsize", "currsize"])
def lru_cache(maxsize=12... | {
"repo_name": "nsf-ri-ubicv/sthor",
"path": "sthor/util/cache.py",
"copies": "1",
"size": "6141",
"license": "bsd-3-clause",
"hash": -2242901729756532500,
"line_mean": 40.7755102041,
"line_max": 95,
"alpha_frac": 0.5196222114,
"autogenerated": false,
"ratio": 4.617293233082707,
"config_test": f... |
# Adapted from http://inventwithpython.com/chapter10.html
# Uses AIMA code under the MIT license http://opensource.org/licenses/MIT
# Tic Tac Toe game using AI and Myro
from Myro import *
from Graphics import *
import random
from games import *
# Make the board window
win = Window("Tic Tac Toe!", 600, 600)
win.setBac... | {
"repo_name": "CSavvy/python",
"path": "extras/ai_tic_tac_toe/Tic Tac Toe.py",
"copies": "1",
"size": "10776",
"license": "mit",
"hash": -995242770800222600,
"line_mean": 31.9571865443,
"line_max": 130,
"alpha_frac": 0.5698775056,
"autogenerated": false,
"ratio": 3.547070441079658,
"config_test... |
# Adapted from: http://jared.geek.nz/2013/feb/linear-led-pwm
INPUT_SIZE = 255 # Input integer size
OUTPUT_SIZE = 255 # Output integer size
INT_TYPE = 'uint8_t'
TABLE_NAME = 'cie';
def cie1931(L):
L = L*100.0
if L <= 8:
return (L/902.3)
else:
return ((L+16.0)/116.0)**3
x = range... | {
"repo_name": "mct/soma",
"path": "pier14/utils/gamma_table_generator.py",
"copies": "2",
"size": "1281",
"license": "apache-2.0",
"hash": -8260972789305646000,
"line_mean": 21.1034482759,
"line_max": 60,
"alpha_frac": 0.5745511319,
"autogenerated": false,
"ratio": 2.5774647887323945,
"config_t... |
# Adapted from http://nbviewer.ipython.org/github/JonathanRaiman/theano_lstm/blob/master/Tutorial.ipynb
import numpy as np
from ..util import file_handling as fh
class Vocab:
def __init__(self, prefix, read_from_filename=None, tokens_to_add=None, add_oov=True):
self.token2index = {}
self.index2t... | {
"repo_name": "dallascard/guac",
"path": "core/feature_extractors/vocabulary.py",
"copies": "1",
"size": "2141",
"license": "apache-2.0",
"hash": -7175240341714396000,
"line_mean": 30.0289855072,
"line_max": 103,
"alpha_frac": 0.6249416161,
"autogenerated": false,
"ratio": 3.3716535433070867,
"... |
#Adapted from http://reviewboard.googlecode.com/svn/trunk/reviewboard/admin/siteconfig.py
from django.conf import settings
from django.contrib.sites.models import Site
from courant.core.siteconfig.models import SiteConfiguration
from courant.core.siteconfig.settings import usersettings
def load_site_config()... | {
"repo_name": "maxcutler/Courant-News",
"path": "courant/core/siteconfig/siteconfig.py",
"copies": "1",
"size": "1557",
"license": "bsd-3-clause",
"hash": -2484264889436468700,
"line_mean": 35.0714285714,
"line_max": 100,
"alpha_frac": 0.6563904945,
"autogenerated": false,
"ratio": 4.579411764705... |
# Adapted from https://audiodestrukt.wordpress.com/2013/06/23/midi-programming-in-python/
import sys, pygame, pygame.midi
from rdflib import Graph, Namespace, Literal, RDF
import uuid
# set up pygame
pygame.init()
pygame.midi.init()
# initialize rdf graph
g = Graph()
# Namespaces
mid = Namespace("http://example.org/m... | {
"repo_name": "albertmeronyo/midi-rdf",
"path": "src/stream-midi-rdf.py",
"copies": "2",
"size": "2271",
"license": "mit",
"hash": 6194014601617474000,
"line_mean": 31.4428571429,
"line_max": 89,
"alpha_frac": 0.5746367239,
"autogenerated": false,
"ratio": 3.5484375,
"config_test": false,
"ha... |
### Adapted from https://blog.dominodatalab.com/creating-interactive-crime-maps-with-folium/
import folium
import pandas as pd
SF_COORDINATES = (69.74, 19.38)
crimedata = pd.read_csv('SFPD_Incidents_-_Current_Year__2015_.csv')
# for speed purposes
MAX_RECORDS = 1000
# create empty map zoomed in on San Francisco
map ... | {
"repo_name": "kmunve/APS",
"path": "viz/geo/aval_active_clusters.py",
"copies": "1",
"size": "1418",
"license": "mit",
"hash": 5370080586126767000,
"line_mean": 31.976744186,
"line_max": 92,
"alpha_frac": 0.6854724965,
"autogenerated": false,
"ratio": 3.023454157782516,
"config_test": false,
... |
# ADAPTED FROM <https://developers.google.com/appengine/articles/sharding_counters>
"""
' Common Package Imports
"""
from google.appengine.ext import ndb
"""
' PURPOSE
' Given a ShardModel and shard manager name, create
' a new Manager for it if none exists, or return
' the current one.
' PARAMETERS
' <ndb... | {
"repo_name": "HunterLarco/sealed",
"path": "server/api/lib/shards/generic.py",
"copies": "1",
"size": "5469",
"license": "apache-2.0",
"hash": -1721267742577071900,
"line_mean": 22.9912280702,
"line_max": 122,
"alpha_frac": 0.6319253977,
"autogenerated": false,
"ratio": 3.6146728354263056,
"co... |
# adapted from https://gist.github.com/cliffano/9868180
import os
import time
import json
from json import JSONEncoder
def json_log(res, host):
if type(res) == type(dict()):
if 'verbose_override' not in res:
res.update({"host": host})
combined_json = JSONEncoder().encode(res)
print(combined_js... | {
"repo_name": "petems/ansible-json",
"path": "callback_plugins/json_logs.py",
"copies": "1",
"size": "1719",
"license": "mit",
"hash": -3937561130576649000,
"line_mean": 21.3376623377,
"line_max": 142,
"alpha_frac": 0.6707388016,
"autogenerated": false,
"ratio": 3.183333333333333,
"config_test"... |
from datetime import datetime
from itertools import chain
from django.conf import settings
import pytz
TZ_DETECT_TIMEZONES = getattr(settings, 'TZ_DETECT_TIMEZONES',
('Australia/Sydney', 'Asia/Tokyo'))
TZ_DETECT_COUNTRIES = getattr(settings, 'TZ_DETECT_COUNTRIES',
... | {
"repo_name": "pierxco/djel",
"path": "djel/utils/tz_detector.py",
"copies": "1",
"size": "3049",
"license": "mit",
"hash": 2837947112853777400,
"line_mean": 35.734939759,
"line_max": 94,
"alpha_frac": 0.6726795671,
"autogenerated": false,
"ratio": 3.9546044098573283,
"config_test": false,
"h... |
"""Adapted from https://github.com/aio-libs/aiobotocore"""
from botocore.exceptions import PaginationError
from botocore.paginate import PageIterator
from botocore.utils import set_value_from_jmespath, merge_dicts
class AsyncPageIterator(PageIterator):
def __init__(self, *args, **kwargs):
super().__init_... | {
"repo_name": "quantmind/pulsar-pusher",
"path": "cloud/asyncbotocore/paginate.py",
"copies": "2",
"size": "6121",
"license": "bsd-3-clause",
"hash": -5166071308594861000,
"line_mean": 44.6791044776,
"line_max": 79,
"alpha_frac": 0.5704950172,
"autogenerated": false,
"ratio": 4.708461538461538,
... |
# Adapted from https://github.com/ansible/ansible/blob/devel/plugins/callbacks/log_plays.py
# And https://gist.github.com/cliffano/9868180
import os
import time
import json
from datetime import datetime
datenow = datetime.now()
datenow = datenow.strftime('%Y-%m-%d')
if not os.path.exists("/var/log/ansible/hosts/html... | {
"repo_name": "petems/ansible-html",
"path": "callback_plugins/html_logs.py",
"copies": "1",
"size": "2482",
"license": "mit",
"hash": 7810453140946592000,
"line_mean": 24.0808080808,
"line_max": 142,
"alpha_frac": 0.6543110395,
"autogenerated": false,
"ratio": 3.0794044665012406,
"config_test"... |
# adapted from https://github.com/ashabbir/Traceroute/blob/master/icmppinger.py
# with more help from https://blogs.oracle.com/ksplice/entry/learning_by_doing_writing_your
# and from http://en.wikipedia.org/wiki/Binary_search_algorithm#Iterative
# and from http://en.wikipedia.org/wi... | {
"repo_name": "raidancampbell/ICMP-traceroute",
"path": "rttMeasurement.py",
"copies": "1",
"size": "6695",
"license": "mit",
"hash": -1113825537242093200,
"line_mean": 39.5818181818,
"line_max": 120,
"alpha_frac": 0.6034353996,
"autogenerated": false,
"ratio": 3.595596133190118,
"config_test":... |
#Adapted from https://github.com/FakeNewsChallenge/fnc-1/blob/master/scorer.py
#Original credit - @bgalbraith
LABELS = ['agree', 'disagree', 'discuss', 'unrelated']
LABELS_RELATED = ['unrelated','related']
RELATED = LABELS[0:3]
def score_submission(gold_labels, test_labels, labels=LABELS, relatedLabels = RELATED):
... | {
"repo_name": "lolotobg/FakeNewsChallenge",
"path": "classic/utils/score.py",
"copies": "1",
"size": "2044",
"license": "mit",
"hash": -7910759830254728000,
"line_mean": 31.9838709677,
"line_max": 104,
"alpha_frac": 0.5807240705,
"autogenerated": false,
"ratio": 3.120610687022901,
"config_test"... |
# original copyright:
# Copyright (c) 2012 Kyle J. Temkin
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to ... | {
"repo_name": "asgeir/pydigilent",
"path": "pydigilent/util/djtg/tap.py",
"copies": "1",
"size": "2815",
"license": "mit",
"hash": -5258900534212269000,
"line_mean": 39.7971014493,
"line_max": 72,
"alpha_frac": 0.6788632327,
"autogenerated": false,
"ratio": 3.0432432432432432,
"config_test": fa... |
# adapted from: https://github.com/kuza55/keras-extras/blob/master/utils/multi_gpu.py
# Original license: Apache License 2.0
# https://github.com/kuza55/keras-extras/blob/master/LICENSE
#
# - data-parallelism at the level of computing predictions and gradients
# in parallel
# - no gradient averaging
# - feed_dict, no... | {
"repo_name": "rossumai/keras-multi-gpu",
"path": "keras_tf_multigpu/kuza55.py",
"copies": "1",
"size": "2410",
"license": "mit",
"hash": -1185708536268974800,
"line_mean": 32.0136986301,
"line_max": 85,
"alpha_frac": 0.5937759336,
"autogenerated": false,
"ratio": 3.7422360248447206,
"config_te... |
# adapted from https://github.com/lisa-lab/DeepLearningTutorials
from collections import OrderedDict
import copy
import os
import re
import codecs
import random
import timeit
from hyperopt import STATUS_OK
import numpy as np
import pandas as pd
from scipy import stats
import theano
from theano import tensor as T
... | {
"repo_name": "dallascard/guac",
"path": "core/rnn/rnn_general.py",
"copies": "1",
"size": "31928",
"license": "apache-2.0",
"hash": 5815242471849275000,
"line_mean": 45.3410740203,
"line_max": 133,
"alpha_frac": 0.5176960661,
"autogenerated": false,
"ratio": 3.367932489451477,
"config_test": t... |
# adapted from https://github.com/lisa-lab/DeepLearningTutorials
from collections import OrderedDict
import sys
import random
import numpy as np
import theano
from theano import tensor as T
from ..data_structures.labeled_tree import LabeledTree
# Otherwise the deepcopy fails
sys.setrecursionlimit(5000)
THEANO_... | {
"repo_name": "dallascard/guac",
"path": "core/rnn/rnn_tree.py",
"copies": "1",
"size": "14622",
"license": "apache-2.0",
"hash": -4219945808028966400,
"line_mean": 32.7690531178,
"line_max": 134,
"alpha_frac": 0.5490356996,
"autogenerated": false,
"ratio": 3.0602762662201757,
"config_test": tr... |
# Copyright (C) 2012 by Will McCutchen and individual contributors.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, co... | {
"repo_name": "thisismyjam/jam-image-filter",
"path": "jam_image_filter/pxl.py",
"copies": "1",
"size": "8234",
"license": "mit",
"hash": 8581117525959983000,
"line_mean": 34.4913793103,
"line_max": 79,
"alpha_frac": 0.6431867865,
"autogenerated": false,
"ratio": 3.4423076923076925,
"config_tes... |
# Adapted from https://github.com/mdeff/cnn_graph
from .tensorflow_constructions import leaky_relu
import scipy.sparse, networkx, tensorflow as tf, numpy as np, pandas as pd
# TODO(mmd): Use generators properly.
def split_into_components(X_df, G):
"""set(X_df.columns) must == set(G.nodes)"""
components = list(net... | {
"repo_name": "mmcdermott/ml_toolkit",
"path": "ml_toolkit/graph_layers.py",
"copies": "1",
"size": "6827",
"license": "mit",
"hash": 4869711976794403000,
"line_mean": 38.4624277457,
"line_max": 110,
"alpha_frac": 0.6185733119,
"autogenerated": false,
"ratio": 3.2571564885496183,
"config_test":... |
# adapted from https://github.com/mozilla/django-csp
from functools import partial
from django.conf import settings
from django.utils.crypto import get_random_string
from django.utils.functional import SimpleLazyObject
from http.client import INTERNAL_SERVER_ERROR, NOT_FOUND
CSP_HEADER = 'Content-Security-Policy'
D... | {
"repo_name": "zentralopensource/zentral",
"path": "server/base/middlewares.py",
"copies": "1",
"size": "2103",
"license": "apache-2.0",
"hash": 3955210482864421400,
"line_mean": 27.4189189189,
"line_max": 89,
"alpha_frac": 0.6462196862,
"autogenerated": false,
"ratio": 3.8166969147005445,
"con... |
"""Adapted from https://github.com/omarish/django-cprofile-middleware/"""
try:
import cProfile as profile
except ImportError:
import profile
import pstats
from cStringIO import StringIO
from django.conf import settings
class ProfilerMiddleware(object):
"""
Simple profile middleware to profile django ... | {
"repo_name": "miurahr/seahub",
"path": "seahub/base/profile.py",
"copies": "6",
"size": "2286",
"license": "apache-2.0",
"hash": -3615370498469275000,
"line_mean": 35.8870967742,
"line_max": 152,
"alpha_frac": 0.6552930884,
"autogenerated": false,
"ratio": 4.156363636363636,
"config_test": fal... |
## Adapted from https://github.com/openai/baselines/blob/master/baselines/ddpg/main.py
import argparse
import time
import os
import logging
from baselines import logger, bench
from baselines.common.misc_util import (
set_global_seeds,
boolean_flag,
)
import baselines.ddpg.training as training
from baselines.ddp... | {
"repo_name": "stanfordnmbl/osim-rl",
"path": "examples/under-construction/train.arm.py",
"copies": "1",
"size": "5830",
"license": "mit",
"hash": 7085158787126972000,
"line_mean": 41.2463768116,
"line_max": 136,
"alpha_frac": 0.6723842196,
"autogenerated": false,
"ratio": 3.3525014376078204,
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.