text stringlengths 0 1.05M | meta dict |
|---|---|
"""Advices for generating call graph"""
# pylint: disable=W0603
import inspect
import re
import os
COUNT = -1
DEPTH_MARKER = "|"
ENTER_MARKER = ">"
EXIT_MARKER = "<"
RJUST_LONG = 50
RJUST_SMALL = 25
def increase_depth(*arg, **kw): # pylint: disable=W0613
"""Increase count of marker that signifies depth in th... | {
"repo_name": "host-anshu/simpleInterceptor",
"path": "example/call_graph/advices.py",
"copies": "1",
"size": "2704",
"license": "mit",
"hash": -6268839843266755000,
"line_mean": 35.0533333333,
"line_max": 97,
"alpha_frac": 0.5403106509,
"autogenerated": false,
"ratio": 3.9131693198263386,
"con... |
"""AdWords reporting tools"""
__author__ = 'thorwhalen'
# This pfile contains function to deal with AdWords reporting
import datetime
import pandas as pd
import numpy as np
import pickle
from adspygoogle import AdWordsClient
import ut as ms
import ut.aw.manip
import ut.daf.ch as daf_ch
# import ut.misc.erenev.data_s... | {
"repo_name": "thorwhalen/ut",
"path": "aw/reporting.py",
"copies": "1",
"size": "58017",
"license": "mit",
"hash": -1168586740445189600,
"line_mean": 48.8,
"line_max": 148,
"alpha_frac": 0.6012030956,
"autogenerated": false,
"ratio": 3.5253691438293737,
"config_test": false,
"has_no_keywords... |
from adxl345 import ADXL345
from math import sqrt
import time
import requests
URL = 'http://admin.kaist.ac.kr:3535/get_data?'
ID = '1'
ON_OFF_STANDARD = 0.12
SLEEP_DELAY = 0.1
ACCUMULATED_NUMBER = 10
ACCUMULATED_STANDARD = 10
# Use BLE Beacon
BLE_USED = False
# Fixed hex
BLE_HEX_FIXED_FORWARD = 'sudo hcitool -i hci... | {
"repo_name": "ben-jung/iow-rpi",
"path": "sensor.py",
"copies": "1",
"size": "2702",
"license": "bsd-2-clause",
"hash": -1977219367714727700,
"line_mean": 27.4421052632,
"line_max": 141,
"alpha_frac": 0.5662472243,
"autogenerated": false,
"ratio": 3.0257558790593504,
"config_test": false,
"h... |
import smbus
#from time import sleep
bus = smbus.SMBus(1)
# ADXL345 constants
EARTH_GRAVITY_MS2 = 9.80665
SCALE_MULTIPLIER = 0.004
DATA_FORMAT = 0x31
BW_RATE = 0x2C
POWER_CTL = 0x2D
BW_RATE_1600HZ = 0x0F
BW_RATE_800HZ = 0x0E
BW_RATE_400HZ = 0x0D
BW_RATE_200HZ ... | {
"repo_name": "chasecaleb/adxl345-python",
"path": "adxl345.py",
"copies": "1",
"size": "3068",
"license": "bsd-3-clause",
"hash": 1978653184105043500,
"line_mean": 26.3928571429,
"line_max": 76,
"alpha_frac": 0.563559322,
"autogenerated": false,
"ratio": 2.9415148609779482,
"config_test": fals... |
import smbus
from time import sleep
#bus = smbus.SMBus(0) #GEN1_I2C
bus = smbus.SMBus(1) #GEN2_I2C
#bus = smbus.SMBus(4) #PWR_I2C
# ADXL345 constants
EARTH_GRAVITY_MS2 = 9.80665
SCALE_MULTIPLIER = 0.004
DATA_FORMAT = 0x31
BW_RATE = 0x2C
POWER_CTL = 0x2D
BW_RATE_1600HZ = 0x0F... | {
"repo_name": "NeuroRoboticTech/Jetduino",
"path": "Software/Python/grove_accelerometer_16g/adxl345.py",
"copies": "1",
"size": "3057",
"license": "mit",
"hash": -3383403207416500000,
"line_mean": 26.5495495495,
"line_max": 76,
"alpha_frac": 0.551193981,
"autogenerated": false,
"ratio": 2.8866855... |
import smbus
from time import sleep
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO_OUT = [5, 6, 13, 19, 26, 12, 16 ,20]
for i in range(8):
GPIO.setup(GPIO_OUT[i],GPIO.OUT)
# select the correct i2c bus for this revision of Raspberry Pi
revision = ([l[12:-1] for l in open('/proc/cpuinfo','r').read... | {
"repo_name": "Kaiyan2015/MEng",
"path": "adxl345.py",
"copies": "1",
"size": "3472",
"license": "bsd-3-clause",
"hash": 3849775709629254700,
"line_mean": 24.1594202899,
"line_max": 103,
"alpha_frac": 0.5944700461,
"autogenerated": false,
"ratio": 2.556701030927835,
"config_test": false,
"has... |
from machine import I2C, Pin
from time import sleep
# select the correct i2c bus for this revision of Raspberry Pi
#revision = ([l[12:-1] for l in open('/proc/cpuinfo','r').readlines() if l[:8]=="Revision"]+['0000'])[0]
#bus = smbus.SMBus(1 if int(revision, 16) >= 4 else 0)
bus = I2C(scl = Pin(5), sda = Pin(4), freq ... | {
"repo_name": "mpi-sws-rse/antevents-python",
"path": "micropython/sensors/adxl345_upy.py",
"copies": "2",
"size": "3579",
"license": "apache-2.0",
"hash": 2519189862114084000,
"line_mean": 29.0756302521,
"line_max": 104,
"alpha_frac": 0.5613299804,
"autogenerated": false,
"ratio": 2.916870415647... |
import smbus
from time import sleep
# select the correct i2c bus for this revision of Raspberry Pi
revision = ([l[12:-1] for l in open('/proc/cpuinfo','r').readlines() if l[:8]=="Revision"]+['0000'])[0]
bus = smbus.SMBus(1 if int(revision, 16) >= 4 else 0)
# ADXL345 constants
EARTH_GRAVITY_MS2 = 9.80665
SCALE_MUL... | {
"repo_name": "jeonghoonkang/BerePi",
"path": "apps/accelerometer/adxl345/adxl345.py",
"copies": "1",
"size": "3237",
"license": "bsd-2-clause",
"hash": -23054883697433036,
"line_mean": 26.9051724138,
"line_max": 103,
"alpha_frac": 0.5607043559,
"autogenerated": false,
"ratio": 2.961573650503202,... |
import smbus
from time import sleep
# select the correct i2c bus for this revision of Raspberry Pi
revision = ([l[12:-1] for l in open('/proc/cpuinfo','r').readlines() if l[:8]=="Revision"]+['0000'])[0]
bus = smbus.SMBus(1 if int(revision, 16) >= 4 else 0)
# ADXL345 constants
EARTH_GRAVITY_MS2 = 9.80665
SCALE_MULT... | {
"repo_name": "mimilei/almd",
"path": "adxl345.py",
"copies": "1",
"size": "3204",
"license": "bsd-3-clause",
"hash": 6480738634941766000,
"line_mean": 27.3539823009,
"line_max": 103,
"alpha_frac": 0.5602372035,
"autogenerated": false,
"ratio": 2.891696750902527,
"config_test": false,
"has_no... |
# A Dynamic Programming based Python Program for the Egg Dropping Puzzle
INT_MAX = 32767
# Function to get minimum number of trials needed in worst
# case with n eggs and k floors
def egg_drop(n, k):
# A 2D table where entery eggFloor[i][j] will represent minimum
# number of trials needed for i eggs and j flo... | {
"repo_name": "amaozhao/algorithms",
"path": "algorithms/dp/egg_drop.py",
"copies": "1",
"size": "1089",
"license": "mit",
"hash": 2316435244537988600,
"line_mean": 34.1290322581,
"line_max": 72,
"alpha_frac": 0.5821854913,
"autogenerated": false,
"ratio": 3.0762711864406778,
"config_test": fal... |
# AEBN
import re, os, platform, urllib, cgi
PLUGIN_LOG_TITLE='AEBN' # Log Title
VERSION_NO = '2017.07.26.0'
# Delay used when requesting HTML, may be good to have to prevent being
# banned from the site
REQUEST_DELAY = 0
# URLS
BASE_URL='http://gay.theater.aebn.net'
BASE_VIDEO_DETAILS_URL=BASE_URL + '%... | {
"repo_name": "iklier/plex-gay-metadata-agent",
"path": "AEBN.bundle/Contents/Code/__init__.py",
"copies": "2",
"size": "16090",
"license": "mit",
"hash": 578482785861798900,
"line_mean": 40.795212766,
"line_max": 211,
"alpha_frac": 0.6121814792,
"autogenerated": false,
"ratio": 3.044465468306528... |
"""aebovl -- overlay bracketed exposures to create a composite image
Usage:
aebovl -l<val> [-d<val> -a<val> -m -h] <normal> <under> <over>
Where:
-l <val> light limit (0-255). Pixels lighter than this value are considered
to be too light. Default: 127
-d <val> dark limit (0-255). Pixels darker than this v... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/519636_aebovl__Automatic_Exposure_Bracket_Image/recipe-519636.py",
"copies": "1",
"size": "5329",
"license": "mit",
"hash": -6093576822878314000,
"line_mean": 39.679389313,
"line_max": 80,
"alpha_frac": 0.6543441546,
"autogenerated": false,
... |
""" aecodecs -- Convert from common Python types to Apple Event Manager types and vice-versa. """
import datetime, struct, sys
from Foundation import NSAppleEventDescriptor, NSURL
from . import kae
__all__ = ['Codecs', 'AEType', 'AEEnum']
######################################################################
d... | {
"repo_name": "encima/NeuroSocket",
"path": "libs/py-applescript-1.0.0/applescript/aecodecs.py",
"copies": "1",
"size": "8309",
"license": "mit",
"hash": 2743566242988660000,
"line_mean": 29.8884758364,
"line_max": 224,
"alpha_frac": 0.6962330004,
"autogenerated": false,
"ratio": 3.18596625766871... |
"""A eden.motif.SequenceMotif wrapper for comparison against Meme."""
from utilities import MotifWrapper, MuscleAlignWrapper
from eden.motif import SequenceMotif
class EdenWrapper(MotifWrapper):
"""Wrapper for EDeN Sequence Motif."""
def __init__(self,
alphabet='dna',
gap_i... | {
"repo_name": "fabriziocosta/pyMotif",
"path": "eden_wrapper.py",
"copies": "1",
"size": "5407",
"license": "mit",
"hash": 7395897665126314000,
"line_mean": 38.1811594203,
"line_max": 91,
"alpha_frac": 0.5010171999,
"autogenerated": false,
"ratio": 4.211059190031152,
"config_test": false,
"ha... |
"""A eden.sequence_motif_decomposer.SequenceMotifDecomposer wrapper for comparison against Meme."""
from utilities import MotifWrapper, MuscleAlignWrapper
from eden.sequence_motif_decomposer import SequenceMotifDecomposer as SMoD
from sklearn.linear_model import SGDClassifier
from sklearn.cluster import MiniBatchKMean... | {
"repo_name": "fabriziocosta/pyMotif",
"path": "smod_wrapper.py",
"copies": "1",
"size": "5881",
"license": "mit",
"hash": -3949292761035741000,
"line_mean": 37.9470198675,
"line_max": 99,
"alpha_frac": 0.5189593607,
"autogenerated": false,
"ratio": 4.0670816044260025,
"config_test": false,
"... |
"""A entity class for mobile_app."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_ICON, CONF_NAME, CONF_UNIQUE_ID, CONF_WEBHOOK_ID
from homeassistant.core import callback
from homeassistant.helpers.device_registry import DeviceEntry
from homeassistant.helpers.dispatcher impo... | {
"repo_name": "adrienbrault/home-assistant",
"path": "homeassistant/components/mobile_app/entity.py",
"copies": "2",
"size": "3357",
"license": "mit",
"hash": -4849492624514028000,
"line_mean": 30.3738317757,
"line_max": 85,
"alpha_frac": 0.63598451,
"autogenerated": false,
"ratio": 4.10893512851... |
"""A entity class for mobile_app."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_WEBHOOK_ID
from homeassistant.core import callback
from homeassistant.helpers.device_registry import DeviceEntry
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homea... | {
"repo_name": "jabesq/home-assistant",
"path": "homeassistant/components/mobile_app/entity.py",
"copies": "2",
"size": "3386",
"license": "apache-2.0",
"hash": -4612995344400242000,
"line_mean": 33.5510204082,
"line_max": 78,
"alpha_frac": 0.6086828116,
"autogenerated": false,
"ratio": 4.43774574... |
"""aenumerate - enumerate for async for"""
import asyncio
from collections import abc
class aenumerate(abc.AsyncIterator):
"""enumerate for async for"""
def __init__(self, aiterable, start=0):
self._aiterable = aiterable
self._i = start - 1
async def __aiter__(self):
self._ait = ... | {
"repo_name": "tebeka/pythonwise",
"path": "aenumerate.py",
"copies": "1",
"size": "1396",
"license": "bsd-3-clause",
"hash": -8611413296447194000,
"line_mean": 30.0222222222,
"line_max": 74,
"alpha_frac": 0.6303724928,
"autogenerated": false,
"ratio": 3.664041994750656,
"config_test": false,
... |
import os
from math import pi
import numpy as np
import math
import matplotlib.pyplot as plt
from commonse.utilities import check_gradient_unit_test
from rotorse.rotoraero import Coefficients, SetupRunVarSpeed, \
RegulatedPowerCurve, AEP
from rotorse.rotoraerodefaults import RotorAeroVSVPWithCCBlade,GeometrySpline... | {
"repo_name": "lewisli/wind-turbine-mdo",
"path": "AEPEvaluator.py",
"copies": "1",
"size": "6121",
"license": "mit",
"hash": 9125375081895629000,
"line_mean": 38.7467532468,
"line_max": 150,
"alpha_frac": 0.6969449436,
"autogenerated": false,
"ratio": 2.803939532753092,
"config_test": false,
... |
"""Aerial position model."""
import logging
from auvsi_suas.models import distance
from auvsi_suas.models.gps_position import GpsPositionMixin
from django.contrib import admin
from django.core import validators
from django.db import models
logger = logging.getLogger(__name__)
ALTITUDE_MSL_FT_MIN = -2000 # Lowest po... | {
"repo_name": "auvsi-suas/interop",
"path": "server/auvsi_suas/models/aerial_position.py",
"copies": "1",
"size": "1980",
"license": "apache-2.0",
"hash": 7287422018853348000,
"line_mean": 29.9375,
"line_max": 75,
"alpha_frac": 0.6671717172,
"autogenerated": false,
"ratio": 4.008097165991903,
"... |
"""
This module contains a library of classes devoted to modeling aircraft parts.
The main purpose of this library is to model various types of aircraft parts.
Currently only wing objects are suported, however in the future it is possible
that fuselages as well as other parts will be added.
:SUMARRY OF THE METHODS:
... | {
"repo_name": "bennames/AeroComBAT-Project",
"path": "AeroComBAT/Aerodynamics.py",
"copies": "1",
"size": "33707",
"license": "mit",
"hash": -6898875933253331000,
"line_mean": 38.149825784,
"line_max": 100,
"alpha_frac": 0.5486397484,
"autogenerated": false,
"ratio": 3.252629547428351,
"config_... |
'Aerosol.py tests'
import time
import numpy as np
import aerosol
aero = aerosol.AeroData("./images/img6.jpg")
def test_all():
'''
Purpose: runs all test functions
Inputs: None
Outputs: Prints the number of tests that were passed
Returns: None
Assumptions: N/A
... | {
"repo_name": "Aerolyzer/Aerolyzer",
"path": "aerolyzer/test_aerosol.py",
"copies": "1",
"size": "1657",
"license": "apache-2.0",
"hash": -5645738348085358000,
"line_mean": 26.1639344262,
"line_max": 91,
"alpha_frac": 0.5878092939,
"autogenerated": false,
"ratio": 3.503171247357294,
"config_tes... |
a = <error descr="Python does not support a trailing 'u'">12u</error>
b = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not support a trailing 'l'.">12l</warning>
c = <error descr="Python does not support a trailing 'll'">12ll</error>
d = <error descr="Python does not support a trailing 'U'">12U</error>
e =... | {
"repo_name": "leafclick/intellij-community",
"path": "python/testData/inspections/PyCompatibilityInspection/numericLiteralExpression.py",
"copies": "1",
"size": "1867",
"license": "apache-2.0",
"hash": -7222352221494946000,
"line_mean": 80.2173913043,
"line_max": 193,
"alpha_frac": 0.7064809855,
"... |
a = <error descr="Python does not support a trailing 'u'">12u</error>
b = <warning descr="Python versions 3.5, 3.6, 3.7, 3.8, 3.9, 3.10 do not support a trailing 'l'">12l</warning>
c = <error descr="Python does not support a trailing 'll'">12ll</error>
d = <error descr="Python does not support a trailing 'U'">12U</erro... | {
"repo_name": "JetBrains/intellij-community",
"path": "python/testData/inspections/PyCompatibilityInspection/numericLiteralExpression.py",
"copies": "10",
"size": "1886",
"license": "apache-2.0",
"hash": -8854427697581713000,
"line_mean": 81.0434782609,
"line_max": 200,
"alpha_frac": 0.7057264051,
... |
""" AES-128 """
from __future__ import division, absolute_import
import pyrtl
from pyrtl.rtllib import libutils
# TODO:
# 2) All ROMs should be synchronous. This should be easy once (3) is completed
# 3) Right now decryption generates one GIANT combinatorial block. Instead
# it should generate one of 2 options --... | {
"repo_name": "deekshadangwal/PyRTL",
"path": "pyrtl/rtllib/aes.py",
"copies": "1",
"size": "14048",
"license": "bsd-3-clause",
"hash": -1779640991857497900,
"line_mean": 45.5165562914,
"line_max": 92,
"alpha_frac": 0.5793707289,
"autogenerated": false,
"ratio": 2.7686243594797006,
"config_test... |
# AES 192/256 bit encryption (Internet draft)
# http://tools.ietf.org/html/draft-blumenthal-aes-usm-04
from pysnmp.proto.secmod.rfc3826.priv import aes
from pysnmp.proto.secmod.rfc3414.auth import hmacmd5, hmacsha
from pysnmp.proto.secmod.rfc3414 import localkey
from pysnmp.proto import error
from math import ceil
try:... | {
"repo_name": "imron/scalyr-agent-2",
"path": "scalyr_agent/third_party/pysnmp/proto/secmod/eso/priv/aesbase.py",
"copies": "2",
"size": "1273",
"license": "apache-2.0",
"hash": 2771728608659005000,
"line_mean": 37.5757575758,
"line_max": 73,
"alpha_frac": 0.671641791,
"autogenerated": false,
"ra... |
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives import padding
from cryptography.hazmat.backends import default_backend
class AESCipher:
# EFFECTS: Constructor that sets the IV to
def __init__(self, iv, key):
self.iv = iv
backen... | {
"repo_name": "hologram-io/hologram-python",
"path": "Hologram/Authentication/AES/AESCipher.py",
"copies": "1",
"size": "1421",
"license": "mit",
"hash": 8564344184000206000,
"line_mean": 33.6585365854,
"line_max": 83,
"alpha_frac": 0.6988036594,
"autogenerated": false,
"ratio": 3.739473684210526... |
KLEN_OPTIONS = {
16: 10,
24: 12,
32: 14}
RCON = [ # http://en.wikipedia.org/wiki/Rijndael_key_schedule
0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40,
0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a,
0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a,
0xd4, 0xb3, 0x7d,... | {
"repo_name": "inuitwallet/NuBippy",
"path": "encrypt/aes.py",
"copies": "1",
"size": "10543",
"license": "mit",
"hash": 8971340324680281000,
"line_mean": 37.9040590406,
"line_max": 94,
"alpha_frac": 0.5859812198,
"autogenerated": false,
"ratio": 2.1455026455026456,
"config_test": false,
"has... |
# AES trial decryption FeatherModule by Daniel Crowley
#
# Try various common AES keys and check for proper padding
from Crypto.Cipher import AES
import feathermodules
# Our main function
def aes_key_brute(samples):
# Check that the samples are the correct size to match AES
if not all([len(sample) % 16 == 0 fo... | {
"repo_name": "nccgroup/featherduster",
"path": "feathermodules/block/aes_key_brute.py",
"copies": "1",
"size": "5220",
"license": "bsd-3-clause",
"hash": -7432172728107185000,
"line_mean": 38.2481203008,
"line_max": 154,
"alpha_frac": 0.6111111111,
"autogenerated": false,
"ratio": 3.670886075949... |
""" Aether library - routines for a modelling the lung
The Aether library is an advanced modelling library for models of the lung.
"""
classifiers = """\
Development Status :: 4 - Beta
Intended Audience :: Developers
Intended Audience :: Education
Intended Audience :: Science/Research
License :: OSI Approved :: Apach... | {
"repo_name": "LungNoodle/lungsim",
"path": "src/bindings/python/setup.in.py",
"copies": "1",
"size": "1601",
"license": "apache-2.0",
"hash": 914464364239322200,
"line_mean": 29.7884615385,
"line_max": 87,
"alpha_frac": 0.7170518426,
"autogenerated": false,
"ratio": 3.697459584295612,
"config_... |
"""aetypes - Python objects representing various AE types."""
from Carbon.AppleEvents import *
import struct
from types import *
import string
#
# convoluted, since there are cyclic dependencies between this file and
# aetools_convert.
#
def pack(*args, **kwargs):
from aepack import pack
return pack( *args, *... | {
"repo_name": "MalloyPower/parsing-python",
"path": "front-end/testsuite-python-lib/Python-2.4/Lib/plat-mac/aetypes.py",
"copies": "1",
"size": "14915",
"license": "mit",
"hash": 1464577773710701800,
"line_mean": 25.2588028169,
"line_max": 87,
"alpha_frac": 0.5521957761,
"autogenerated": false,
"... |
"""aetypes - Python objects representing various AE types."""
from warnings import warnpy3k
warnpy3k("In 3.x, the aetypes module is removed.", stacklevel=2)
from Carbon.AppleEvents import *
import struct
from types import *
import string
#
# convoluted, since there are cyclic dependencies between this file and
# aet... | {
"repo_name": "wskplho/sl4a",
"path": "python/src/Lib/plat-mac/aetypes.py",
"copies": "33",
"size": "15011",
"license": "apache-2.0",
"hash": -1968584301339179800,
"line_mean": 25.288966725,
"line_max": 87,
"alpha_frac": 0.553594031,
"autogenerated": false,
"ratio": 3.366449876653958,
"config_t... |
"""A eventlet based handler."""
from __future__ import absolute_import
import contextlib
import logging
import eventlet
from eventlet.green import select as green_select
from eventlet.green import socket as green_socket
from eventlet.green import time as green_time
from eventlet.green import threading as green_thread... | {
"repo_name": "kawamon/hue",
"path": "desktop/core/ext-py/kazoo-2.8.0/kazoo/handlers/eventlet.py",
"copies": "3",
"size": "5579",
"license": "apache-2.0",
"hash": -7586523435406491000,
"line_mean": 30.1675977654,
"line_max": 78,
"alpha_frac": 0.625201649,
"autogenerated": false,
"ratio": 4.466773... |
"""A eventlet based handler."""
from __future__ import absolute_import
import contextlib
import logging
import kazoo.python2atexit as python2atexit
import eventlet
from eventlet.green import select as green_select
from eventlet.green import socket as green_socket
from eventlet.green import time as green_time
from ev... | {
"repo_name": "kormat/kazoo",
"path": "kazoo/handlers/eventlet.py",
"copies": "13",
"size": "5365",
"license": "apache-2.0",
"hash": 1308649559128967400,
"line_mean": 30.0115606936,
"line_max": 78,
"alpha_frac": 0.6288909599,
"autogenerated": false,
"ratio": 4.444904722452361,
"config_test": fa... |
"""ae_web URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | {
"repo_name": "arrayexpress/ae_auto",
"path": "ae_web/ae_web/urls.py",
"copies": "1",
"size": "3592",
"license": "apache-2.0",
"hash": 746222809652551800,
"line_mean": 46.8933333333,
"line_max": 119,
"alpha_frac": 0.6968262806,
"autogenerated": false,
"ratio": 3.407969639468691,
"config_test": ... |
"""A experimental script for setting up DVS recording with Tracking dataset.
This script uses Sacred from IDSIA lab to setup the experiment.
This allows me to configure experiment by JSON file.
Author: Yuhuang Hu
Email : duugyue100@gmail.com
"""
from sacred import Experiment
import os
import cPickle as pickle
impor... | {
"repo_name": "duguyue100/spikefuel",
"path": "scripts/dvs_tracking_exp.py",
"copies": "1",
"size": "4540",
"license": "mit",
"hash": 3993334908465649000,
"line_mean": 32.8805970149,
"line_max": 78,
"alpha_frac": 0.5552863436,
"autogenerated": false,
"ratio": 3.9894551845342705,
"config_test": ... |
"""A experimental script for setting up DVS recording with VOT dataset.
This script uses Sacred from IDSIA lab to setup the experiment.
This allows me to configure experiment by JSON file.
Author: Yuhuang Hu
Email : duugyue100@gmail.com
"""
from sacred import Experiment
import os
import cPickle as pickle
import num... | {
"repo_name": "duguyue100/spikefuel",
"path": "scripts/dvs_vot_exp.py",
"copies": "1",
"size": "4517",
"license": "mit",
"hash": 1409361087306467600,
"line_mean": 31.731884058,
"line_max": 76,
"alpha_frac": 0.571175559,
"autogenerated": false,
"ratio": 3.6339501206757845,
"config_test": false,
... |
a = f"{0[ ]:X>+10d}"
a = f"{0[ ]!s:X>+10d}"
a = f"{0[ ]:Xd>+10d}" #invalid
a : source.python
: source.python
= : keyword.operator.assignment.python, source.python
: source.python
f : meta.fstring.python, source.python, storage.type.string.python, strin... | {
"repo_name": "MagicStack/MagicPython",
"path": "test/fstrings/simple1.py",
"copies": "1",
"size": "4248",
"license": "mit",
"hash": -6016978812674962000,
"line_mean": 73.5263157895,
"line_max": 151,
"alpha_frac": 0.6819679849,
"autogenerated": false,
"ratio": 3.789473684210526,
"config_test": ... |
# A fab file for executing commands on remote Linux hosts
from fabric.api import env
from fabric.api import run
import paramiko
import socket
env.use_ssh_config = True
env.user = 'vikash'
def is_host_up(host, port):
# Set the timeout
original_timeout = socket.getdefaulttimeout()
new_timeout = 3
sock... | {
"repo_name": "vikash-india/UnixNotes2Myself",
"path": "linux/scripts/archive/remote_executer_fabfile.py",
"copies": "1",
"size": "1030",
"license": "mit",
"hash": -8708543737761951000,
"line_mean": 25.4102564103,
"line_max": 83,
"alpha_frac": 0.6524271845,
"autogenerated": false,
"ratio": 3.5395... |
'''A facade to all the modules for mp3scrub functionality. Can also be used
as a CLI.
'''
import re, os
from shutil import move
from mp3scrub import globalz
from mp3scrub.util import strtool, mylog, fileio
from mp3scrub.util.musicTypes import Artist, Album, Track, MP3File
from mp3scrub.netquery import puidquery, tagGu... | {
"repo_name": "sgoranson/mp3scrub",
"path": "mp3scrub/scrubCmds.py",
"copies": "1",
"size": "13683",
"license": "mit",
"hash": 3825504415991876000,
"line_mean": 35.2944297082,
"line_max": 102,
"alpha_frac": 0.5486369948,
"autogenerated": false,
"ratio": 3.700108166576528,
"config_test": false,
... |
""" A factory for building individual commands based on the full list
of commands and inputs.
author: Brian Schrader
since: 2016-01-12
"""
from .tokens import Input, Output, PathToken, CommentToken
from .command import Command
from .command_template import CommandTemplate
from .grammar import OR_TOKEN, AND_TOKEN
d... | {
"repo_name": "Sonictherocketman/metapipe",
"path": "metapipe/models/command_template_factory.py",
"copies": "2",
"size": "5303",
"license": "mit",
"hash": -3543494928946701000,
"line_mean": 26.6197916667,
"line_max": 78,
"alpha_frac": 0.5977748444,
"autogenerated": false,
"ratio": 4.14296875,
... |
# A factory for Indexer class instances. This will return an indexer
# suitable for using in the context defined in the input.
import logging
import os
import time
from xia2.DriverExceptions.NotAvailableError import NotAvailableError
from xia2.Handlers.Phil import PhilIndex
from xia2.Handlers.PipelineSelection impor... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Modules/Indexer/IndexerFactory.py",
"copies": "1",
"size": "5257",
"license": "bsd-3-clause",
"hash": 1093246189227757700,
"line_mean": 33.1363636364,
"line_max": 88,
"alpha_frac": 0.6686322998,
"autogenerated": false,
"ratio": 3.709950599858857,
"co... |
# A factory for Integrater implementations. At the moment this will
# support only XDS and the null integrater implementation.
import logging
import os
from xia2.DriverExceptions.NotAvailableError import NotAvailableError
from xia2.Handlers.Phil import PhilIndex
from xia2.Handlers.PipelineSelection import get_prefer... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Modules/Integrater/IntegraterFactory.py",
"copies": "1",
"size": "5115",
"license": "bsd-3-clause",
"hash": 1356374139325041400,
"line_mean": 33.7959183673,
"line_max": 88,
"alpha_frac": 0.6490713587,
"autogenerated": false,
"ratio": 3.825729244577412,... |
"""A factory for unique sentinel values.
`Sentinel` objects are unique in the sense that they are equal only to
themselves. `Sentinel` objects can not be pickled.
Written by Peter Duerr
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ i... | {
"repo_name": "duerrp/pyexperiment",
"path": "pyexperiment/utils/sentinel.py",
"copies": "4",
"size": "1515",
"license": "mit",
"hash": -2257626471346534000,
"line_mean": 25.5789473684,
"line_max": 70,
"alpha_frac": 0.5570957096,
"autogenerated": false,
"ratio": 4.6189024390243905,
"config_test... |
''' A failsafe wrapper for python3 unicode text file handling and also a
working example of using UltiSnips'''
import tempfile
import struct
import logging
logger = logging.getLogger(__name__)
def mixed_text_decoder(datablock):
if isinstance(datablock, str):
return datablock
cunpack = struct.Struct('=... | {
"repo_name": "SkyLeach/poweruser_tools",
"path": "skypy/clean_unicode_spooler.py",
"copies": "1",
"size": "1374",
"license": "unlicense",
"hash": 4179673942756320000,
"line_mean": 34.2307692308,
"line_max": 79,
"alpha_frac": 0.6608442504,
"autogenerated": false,
"ratio": 3.6157894736842104,
"c... |
"""A fake AirPlay device."""
import binascii
from collections import namedtuple
import logging
import plistlib
from typing import Optional
from aiohttp import web
from pyatv.support.net import unused_port
from tests.utils import simple_get
_LOGGER = logging.getLogger(__name__)
# --- START AUTHENTICATION DATA VAL... | {
"repo_name": "postlund/pyatv",
"path": "tests/fake_device/airplay.py",
"copies": "1",
"size": "10163",
"license": "mit",
"hash": 5192651712560401000,
"line_mean": 47.1658767773,
"line_max": 726,
"alpha_frac": 0.7340352258,
"autogenerated": false,
"ratio": 3.0528687293481527,
"config_test": fal... |
"""A fake application's model objects"""
from datetime import datetime
from zope.sqlalchemy import ZopeTransactionExtension
from sqlalchemy import Table, ForeignKey, Column
from sqlalchemy.orm import scoped_session, sessionmaker, relation, backref, \
synonym
from sqlalchemy.ext.declarative ... | {
"repo_name": "lucius-feng/tg2",
"path": "tests/fixtures/model.py",
"copies": "3",
"size": "1600",
"license": "mit",
"hash": 2295129228073881000,
"line_mean": 32.3333333333,
"line_max": 79,
"alpha_frac": 0.706875,
"autogenerated": false,
"ratio": 4.3478260869565215,
"config_test": false,
"has... |
a=[[False for x in range(1000)]for x in range(1000)]
def sumfunction(counter):
if(a[counter[0]][counter[1]]!=True):
a[counter[0]][counter[1]]=True
return 1
else:
return 0
def main():
file=open("input3.txt")
data=file.read()
counter=[500, 500]
counter_robo=[500, 500]
answer=0
track=1
for letter in data... | {
"repo_name": "abdulfaizp/adventofcode",
"path": "xmas3_1.py",
"copies": "1",
"size": "1089",
"license": "cc0-1.0",
"hash": -2497184055739047000,
"line_mean": 18.8181818182,
"line_max": 52,
"alpha_frac": 0.6189164371,
"autogenerated": false,
"ratio": 2.675675675675676,
"config_test": false,
"... |
"""A fancy pants plot of a given VTEC headline."""
# local
from datetime import timezone
# third party
import pandas as pd
from geopandas import read_postgis
from pyiem.nws import vtec
from pyiem.plot.geoplot import MapPlot
from pyiem.util import get_autoplot_context, get_dbconn, utc
from pyiem.exceptions import NoDat... | {
"repo_name": "akrherz/iem",
"path": "htdocs/plotting/auto/scripts200/p208.py",
"copies": "1",
"size": "11996",
"license": "mit",
"hash": 5809693833892676000,
"line_mean": 31.8657534247,
"line_max": 79,
"alpha_frac": 0.5063354451,
"autogenerated": false,
"ratio": 3.5127379209370426,
"config_tes... |
""" A fantastic python code to determine the quenched SFH parameters of galaxies using emcee (http://dan.iel.fm/emcee/current/). This file contains all the functions needed to determine the mean SFH parameters of a population.
N.B. The data files .ised_ASCII contain the extracted bc03 models and have a 0 in th... | {
"repo_name": "zooniverse/starpy",
"path": "posterior.py",
"copies": "2",
"size": "25744",
"license": "apache-2.0",
"hash": -7317574959128430000,
"line_mean": 45.3855855856,
"line_max": 411,
"alpha_frac": 0.6239123679,
"autogenerated": false,
"ratio": 3.218402300287536,
"config_test": false,
... |
"""A fastener class for bolted joint calculations."""
import math
import numpy as np
class Fastener:
"""Fastener class containing an ID, location in space, and load vector."""
def __init__(self,
ID,
xyz,
diameter,
E,
G,
... | {
"repo_name": "sharkweek/mechpy",
"path": "mechpy/bolted_joints/fastener.py",
"copies": "1",
"size": "2150",
"license": "mit",
"hash": 6927011280653962000,
"line_mean": 27.6666666667,
"line_max": 78,
"alpha_frac": 0.5237209302,
"autogenerated": false,
"ratio": 3.866906474820144,
"config_test": ... |
'''A faster implementation than DendroPy.
These methods do not deal with missing or uncertain sequence data.
It is up to the user to filter out uncertain base calls, otherwise methods
will revert to Dendropy functions (which are not guaranteed to be correct for
uncertain base calls).
'''
import numpy as np
import math... | {
"repo_name": "andrewguy/biostructmap",
"path": "biostructmap/population_stats.py",
"copies": "1",
"size": "3497",
"license": "mit",
"hash": 1240266993093476400,
"line_mean": 33.2843137255,
"line_max": 82,
"alpha_frac": 0.6354017729,
"autogenerated": false,
"ratio": 3.2590866728797763,
"config_... |
""" A fast implementation of the Voigt function.
"""
# p2.6+ compatibility
from __future__ import division, print_function, unicode_literals
import numpy as np
from math import sqrt, pi
sqrtpi = sqrt(pi)
# u values corresponding to H table values below
U = np.arange(0, 20, 0.01)
# Table of h1 and h3 for use in Voi... | {
"repo_name": "nhmc/LAE",
"path": "python_modules/barak/voigt.py",
"copies": "1",
"size": "73286",
"license": "mit",
"hash": 6486640700283049000,
"line_mean": 63.1172353456,
"line_max": 78,
"alpha_frac": 0.7392953634,
"autogenerated": false,
"ratio": 2.181585449349567,
"config_test": false,
"... |
"""A fast, lightweight, and secure session WSGI middleware for use with GAE."""
from Cookie import CookieError, SimpleCookie
from base64 import b64decode, b64encode
import datetime
import hashlib
import hmac
import logging
import pickle
import os
import threading
import time
from google.appengine.api import memcache
f... | {
"repo_name": "seanpont/widowmaker-invitational",
"path": "lib/gaesessions/__init__.py",
"copies": "14",
"size": "21839",
"license": "mit",
"hash": 3650760255328601000,
"line_mean": 41.4058252427,
"line_max": 173,
"alpha_frac": 0.6205870232,
"autogenerated": false,
"ratio": 4.051762523191095,
"... |
"""A fast, lightweight, and secure session WSGI middleware for use with GAE."""
import datetime
import hashlib
import hmac
import logging
import os
import pickle
import threading
import time
from Cookie import CookieError, SimpleCookie
from base64 import b64decode, b64encode
from google.appengine.api import memcache
f... | {
"repo_name": "rhefner1/ghidonations",
"path": "gaesessions/__init__.py",
"copies": "1",
"size": "21922",
"license": "apache-2.0",
"hash": -3185394978976203300,
"line_mean": 40.8358778626,
"line_max": 123,
"alpha_frac": 0.6182373871,
"autogenerated": false,
"ratio": 4.061133753241942,
"config_t... |
"""A fast, lightweight, and secure session WSGI middleware for use with GAE."""
from Cookie import CookieError, SimpleCookie
from base64 import b64decode, b64encode
import datetime
import hashlib
import hmac
import logging
import pickle
import os
import threading
import time
from google.appengine.api import memcache... | {
"repo_name": "rice-apps/petition-app",
"path": "authentication/gaesessions.py",
"copies": "1",
"size": "21927",
"license": "mit",
"hash": 4062767842706723000,
"line_mean": 41.0057471264,
"line_max": 120,
"alpha_frac": 0.6180964108,
"autogenerated": false,
"ratio": 4.062812673707615,
"config_te... |
""" AFDKOPython copyCFFCharstrings.py -src <file1> -dst <file2>[,file3,...filen_n]
Copies the CFF charstrings and subrs from src to dst fonts.
"""
__help__ = """AFDKOPython copyCFFCharstrings.py -src <file1> -dst <file2>
Copies the CFF charstrings and subrs from src to dst.
v1.002 Aug 27 1014
"""
import os
import s... | {
"repo_name": "shannpersand/cooper-type",
"path": "_resources/FDK Adobe/Tools/SharedData/FDKScripts/copyCFFCharstrings.py",
"copies": "1",
"size": "5754",
"license": "cc0-1.0",
"hash": -1566179258001377800,
"line_mean": 25.8878504673,
"line_max": 188,
"alpha_frac": 0.7036843935,
"autogenerated": fa... |
#! AFDKOPython
import sys, pickle, os
from mutatorMath.ufo.document import DesignSpaceDocumentWriter
def main():
family = pickle.load(sys.stdin)
generate_designspace(family, 'font.designspace')
def generate_designspace(family, path):
def normalize_path(path):
return os.path.join(family['working_... | {
"repo_name": "mooniak/hindkit",
"path": "hindkit/AFDKOPython/generate_designspace.py",
"copies": "1",
"size": "1566",
"license": "mit",
"hash": -7516400354499871000,
"line_mean": 26,
"line_max": 70,
"alpha_frac": 0.5683269476,
"autogenerated": false,
"ratio": 4.088772845953002,
"config_test": ... |
# A feature decorator
import functools
FEATURE_CONFIG = {}
class FeatureSetupError(Exception): pass
def feature_setup(config, update=False):
'''
Expects a file name with JSON formatted contents
{
"DEFAULT": {
"active": true,
"doc": "The default active feature"
}
... | {
"repo_name": "cyrilthomas/feature",
"path": "feature.py",
"copies": "1",
"size": "1627",
"license": "mit",
"hash": 3117333696473817000,
"line_mean": 24.8412698413,
"line_max": 103,
"alpha_frac": 0.5617701291,
"autogenerated": false,
"ratio": 4.150510204081633,
"config_test": true,
"has_no_ke... |
# A feed-forward DNN with 5 hidden layers using sigmoid activations.
import os
import time
import tensorflow as tf
#import ffn
import argparse
from ffn26752l6 import *
device_str = ''
def set_parameters(epochs, minibatch, iterations, device_id):
"""
iterations means the number of iterations in each epoch
... | {
"repo_name": "hclhkbu/dlbench",
"path": "synthetic/experiments/tensorflow/fc/ffn26752l6bm.py",
"copies": "2",
"size": "3127",
"license": "mit",
"hash": 8270168528972925000,
"line_mean": 35.3604651163,
"line_max": 123,
"alpha_frac": 0.6514230892,
"autogenerated": false,
"ratio": 3.855733662145499... |
# A feed-forward DNN with 5 hidden layers using sigmoid activations.
import time
import tensorflow as tf
import ffn
import argparse
from ffn import *
device_str = ''
def set_parameters(epochs, minibatch, iterations, device_id):
"""
iterations means the number of iterations in each epoch
"""
global d... | {
"repo_name": "linmajia/dlbench",
"path": "synthetic/experiments/tensorflow/fc/ffnbm.py",
"copies": "2",
"size": "2696",
"license": "mit",
"hash": 949856742463735900,
"line_mean": 33.5641025641,
"line_max": 122,
"alpha_frac": 0.6461424332,
"autogenerated": false,
"ratio": 3.982274741506647,
"co... |
# A feed-forward DNN with 5 hidden layers using sigmoid activations.
import time
import tensorflow as tf
import ffn
from ffn import *
if __name__ == '__main__':
minibatchSize = 1024
program_start_time = time.time()
# Create the model
if (FLAGS.noInputFeed):
features, labels = getFake... | {
"repo_name": "hclhkbu/dlbench",
"path": "synthetic/experiments/tensorflow/fc/ffn_exp.py",
"copies": "2",
"size": "1516",
"license": "mit",
"hash": -7083709089150383000,
"line_mean": 31.9565217391,
"line_max": 105,
"alpha_frac": 0.6833773087,
"autogenerated": false,
"ratio": 3.9072164948453607,
... |
# A feed-forward DNN with 5 hidden layers using sigmoid activations.
import time
import tensorflow as tf
#from ffn import *
from ffn26752 import *
minibatchSize = 1024
program_start_time = time.time()
# Create the model
if (FLAGS.noInputFeed):
features, labels = getFakeMinibatch(minibatchSize)
else:
features ... | {
"repo_name": "hclhkbu/dlbench",
"path": "synthetic/experiments/tensorflow/fc/ffn1080.py",
"copies": "2",
"size": "1501",
"license": "mit",
"hash": -2773150321940359000,
"line_mean": 30.9361702128,
"line_max": 116,
"alpha_frac": 0.7421718854,
"autogenerated": false,
"ratio": 3.5400943396226414,
... |
"""A few convenience functions to setup the Heisenberg model.
.. math::
H=\sum_{i}\vec{S}_{i}\cdot\vec{S}_{i+1}=
\sum_{i}\left[S^{z}_{i}S^{z}_{i+1}+
\frac{1}{2}\left(S^{\dagger}_{i}S^{-}_{i+1}+
S^{-}_{i}S^{\dagger}_{i+1}\right)\right]
"""
class HeisenbergModel(object):
"""Implements a few convenie... | {
"repo_name": "iglpdc/dmrg101",
"path": "dmrg101/utils/models/heisenberg_model.py",
"copies": "2",
"size": "3156",
"license": "mit",
"hash": 6006273256473236000,
"line_mean": 39.987012987,
"line_max": 77,
"alpha_frac": 0.5773130545,
"autogenerated": false,
"ratio": 2.9801699716713883,
"config_t... |
"""A few convenience functions to setup the Hubbard model.
.. math::
H=\sum_{i}\vec{S}_{i}\cdot\vec{S}_{i+1}=
\sum_{i}\left[S^{z}_{i}S^{z}_{i+1}+
\frac{1}{2}\left(S^{\dagger}_{i}S^{-}_{i+1}+
S^{-}_{i}S^{\dagger}_{i+1}\right)\right]
"""
class HubbardModel(object):
"""Implements a few convenience fu... | {
"repo_name": "chanul13/hubbard_dimer",
"path": "dmrg101/utils/models/hubbard_model.py",
"copies": "1",
"size": "5799",
"license": "mit",
"hash": 4855553149288449000,
"line_mean": 53.1962616822,
"line_max": 116,
"alpha_frac": 0.5987239179,
"autogenerated": false,
"ratio": 2.6884561891515992,
"c... |
"""A few convenience functions to setup the Ising model in a TF.
TFIM stands for Ising model in a transverse field, i.e.:
.. math::
H=\sum_{i}\left[S^{z}_{i}S^{z}_{i+1} + h S^{x}_{i}\right)\right]
"""
class TranverseFieldIsingModel(object):
"""Implements a few convenience functions for the TFIM.
Does... | {
"repo_name": "iglpdc/dmrg101",
"path": "dmrg101/utils/models/tfi_model.py",
"copies": "2",
"size": "2957",
"license": "mit",
"hash": -5009058996563521000,
"line_mean": 39.5068493151,
"line_max": 79,
"alpha_frac": 0.5894487656,
"autogenerated": false,
"ratio": 3.1357370095440085,
"config_test":... |
# A few convenient math functions for the bicorr project
import matplotlib
#matplotlib.use('agg') # for flux
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style='ticks')
import sys
import os
import os.path
import scipy.io as sio
from scipy.optimize import curve_fit
import time
import numpy as np
np.s... | {
"repo_name": "pfschus/fission_bicorrelation",
"path": "scripts/bicorr_math.py",
"copies": "1",
"size": "5188",
"license": "mit",
"hash": -5487174353924035000,
"line_mean": 23.3615023474,
"line_max": 145,
"alpha_frac": 0.5836545875,
"autogenerated": false,
"ratio": 3.560741249142073,
"config_te... |
'''A few functions to check whether the data in the estimator file is fine.
'''
from dmrg_helpers.core.dmrg_exceptions import DMRGException
def process_estimator_name(estimator_name):
'''Process the name of the estimator and tries to extract the operators and
sites involved.
Parameters
----------... | {
"repo_name": "iglpdc/dmrg_helpers",
"path": "dmrg_helpers/extract/process_estimator_name.py",
"copies": "1",
"size": "1893",
"license": "mit",
"hash": -7094766706356059000,
"line_mean": 29.0476190476,
"line_max": 79,
"alpha_frac": 0.6455361859,
"autogenerated": false,
"ratio": 4.27313769751693,
... |
"""A few helper functions for serverv-py.
Surprisingly, there aren't common functions to convert
from QBasic times to Python datetimes.
"""
from datetime import datetime, date
from collections import namedtuple
def qb_time_to_datetime(year, yday, hour, minute, doublesecond):
"""Convert a QB-format time to a date... | {
"repo_name": "OCESS/serverv-py",
"path": "serverv-py/utility.py",
"copies": "1",
"size": "2216",
"license": "mit",
"hash": 3056297919810087000,
"line_mean": 32.0746268657,
"line_max": 76,
"alpha_frac": 0.5992779783,
"autogenerated": false,
"ratio": 3.3223388305847075,
"config_test": false,
"... |
'''A few helper functions for the Thread study.'''
def init_sqlite_file(c):
''' Set up the tables. '''
tables = []
tables.append(('event_kinds',
['id INTEGER PRIMARY KEY', 'name TEXT']))
tables.append(('processes',
['id INTEGER PRIMARY KEY', 'name TEXT', 'friendly_name TEXT']))
tabl... | {
"repo_name": "benjaminy/ThreadMeasurement",
"path": "TraceConverters/thread_study_utils.py",
"copies": "1",
"size": "1881",
"license": "mit",
"hash": 7403315063189546000,
"line_mean": 35.8823529412,
"line_max": 71,
"alpha_frac": 0.5715045189,
"autogenerated": false,
"ratio": 3.8466257668711656,
... |
# a few helpful filter functions
from spitfire.runtime.udn import UndefinedPlaceholder
# decorate a function object so the default filter will not be applied to the
# value of a placeholder. this is handy when building functions that will
# create data that could be double-escaped and you don't wnat to constantly
# i... | {
"repo_name": "eklitzke/spitfire",
"path": "spitfire/runtime/filters.py",
"copies": "1",
"size": "1139",
"license": "bsd-3-clause",
"hash": -609531609762857300,
"line_mean": 29.7837837838,
"line_max": 79,
"alpha_frac": 0.7050043898,
"autogenerated": false,
"ratio": 3.847972972972973,
"config_te... |
'''A few methods for dealing with gene annotation from snpEff.'''
__author__ = "dpark@broadinstitute.org"
__version__ = "PLACEHOLDER"
__date__ = "PLACEHOLDER"
import sqlite3, itertools, urllib, logging, re, os
import util.file, util.misc
log = logging.getLogger(__name__)
class SnpAnnotater(object):
''' Add anno... | {
"repo_name": "broadinstitute/cms",
"path": "cms/util/old/annot.py",
"copies": "1",
"size": "7188",
"license": "bsd-2-clause",
"hash": -2021669786897336800,
"line_mean": 43.3703703704,
"line_max": 144,
"alpha_frac": 0.5139120757,
"autogenerated": false,
"ratio": 3.6505840528186897,
"config_test... |
'''A few miscellaneous functions and objects used by the datastream and datastreamdiff modules.
'''
import re
import sys
import time
import json
import numpy as np
import datetime as dt
# regex for checking netcdf file names
ncfname_re = \
re.compile('^([a-z]{3})([a-z0-9]*)([A-Z]\d+)\.([a-z]\d).'
+'... | {
"repo_name": "CesiumLifeJacket/overwatch",
"path": "dummy_project/ncr/subdir/utils.py",
"copies": "2",
"size": "3169",
"license": "mit",
"hash": 2777706655101118000,
"line_mean": 31.0101010101,
"line_max": 95,
"alpha_frac": 0.5900915115,
"autogenerated": false,
"ratio": 3.5487122060470324,
"co... |
'''A few miscellaneous tools. '''
from __future__ import print_function, division # Division of integers with / should never round!
import collections
import itertools
import logging
import os
import re
import subprocess
import multiprocessing
import sys
import util.file
log = logging.getLogger(__name__)
__author__... | {
"repo_name": "broadinstitute/cms",
"path": "cms/util/misc.py",
"copies": "1",
"size": "14792",
"license": "bsd-2-clause",
"hash": -4408463980622262300,
"line_mean": 34.818401937,
"line_max": 98,
"alpha_frac": 0.5513791239,
"autogenerated": false,
"ratio": 4.295005807200929,
"config_test": fals... |
'''A few pure-python statistical tools to avoid the need to install scipy. '''
from __future__ import division # Division of integers with / should never round!
from math import exp, log, sqrt, gamma, lgamma, erf
import itertools
__author__ = "dpark@broadinstitute.org, irwin@broadinstitute.org"
try:
# Python 3.4
... | {
"repo_name": "broadinstitute/cms",
"path": "cms/util/stats.py",
"copies": "1",
"size": "7924",
"license": "bsd-2-clause",
"hash": 8284199714528943000,
"line_mean": 38.2277227723,
"line_max": 81,
"alpha_frac": 0.5884654215,
"autogenerated": false,
"ratio": 3.4723926380368098,
"config_test": fal... |
'''A few simple examples of recursion.'''
def sum1(xs):
'''We can recursively sum a list of numbers.'''
if len(xs) == 0:
return 0
else:
return xs[0] + sum1(xs[1:])
def sum2(xs):
'''Or do the same thing iteratively.'''
y = 0
for x in xs:
y += x
return y
def product1... | {
"repo_name": "twright/Python-Examples",
"path": "recursion_examples.py",
"copies": "1",
"size": "1365",
"license": "unlicense",
"hash": 2449193552415364600,
"line_mean": 23.375,
"line_max": 77,
"alpha_frac": 0.5626373626,
"autogenerated": false,
"ratio": 3.3292682926829267,
"config_test": fals... |
"""A few subroutines written to interface with the SMS API.
Currently not in use and so un-maintained,
but I think it should all basically still work.
"""
import simplejson as json
import os
import sys
import getpass
import warnings
import time
import glob
import httplib
import urllib
import pysovo.utils as utils
de... | {
"repo_name": "timstaley/pysovo",
"path": "pysovo/comms/sms.py",
"copies": "1",
"size": "3668",
"license": "bsd-2-clause",
"hash": -4573503130731165700,
"line_mean": 25.9705882353,
"line_max": 85,
"alpha_frac": 0.6175027263,
"autogenerated": false,
"ratio": 4.048565121412803,
"config_test": tru... |
""" A few tests for BorderSwipingNetworks
>>> from pybrain import MotherConnection
>>> from scipy import ones, array
We will use a simple 3-dimensional network:
>>> dim = 3
>>> size = 3
>>> hsize = 1
It is possible to define some weights before construction:
>>> predefined = {'outconn': Moth... | {
"repo_name": "zygmuntz/pybrain",
"path": "pybrain/tests/unittests/structure/networks/test_borderswipingnetwork.py",
"copies": "31",
"size": "2820",
"license": "bsd-3-clause",
"hash": 3172192282942634500,
"line_mean": 28.375,
"line_max": 114,
"alpha_frac": 0.659929078,
"autogenerated": false,
"ra... |
""" A few tests for BorderSwipingNetworks
>>> from pybrain import MotherConnection
>>> from scipy import ones, array
We will use a simple 3-dimensional network:
>>> dim = 3
>>> size = 3
>>> hsize = 1
It is possible to define some weights before cosntruction:
>>> predefined = {'... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/tests/unittests/test_borderswipingnetwork.py",
"copies": "1",
"size": "2937",
"license": "bsd-3-clause",
"hash": 7808063341258796000,
"line_mean": 29.59375,
"line_max": 114,
"alpha_frac": 0.633299285,
"autogenerated": false,
"ratio": 3.341296... |
"""A few tests for classes and functions from kernel/modelingtools
"""
#!/usr/bin/env python
import numpy as np
import siconos.kernel as K
t0 = 0
T = 10
r = 0.1
g = 9.81
m = 1
e = 0.9
theta = 0.5
h = 0.005
q = np.array([1, 0, 0])
v = np.array([0, 0, 0])
mass = np.eye(3)
mass[2, 2] = 3. / 5 * r * r
weight = np.arr... | {
"repo_name": "siconos/siconos-deb",
"path": "kernel/swig/tests/test_modelingTools.py",
"copies": "1",
"size": "1095",
"license": "apache-2.0",
"hash": 3254588241091078700,
"line_mean": 20.0576923077,
"line_max": 66,
"alpha_frac": 0.6310502283,
"autogenerated": false,
"ratio": 2.4829931972789114,... |
"""A few tests using a server (and --fullstate so that know will 'see' uniform numbers)"""
from __future__ import print_function
import os
import subprocess
import sys
import time
import hfo
hfo_env = hfo.HFOEnvironment()
def try_step(): # if a game ends within ~5 frames, something is wrong...
status = hfo_env.... | {
"repo_name": "LARG/HFO",
"path": "tests/test_with_server_fullstate.py",
"copies": "2",
"size": "3979",
"license": "mit",
"hash": -7458352879266243000,
"line_mean": 32.4369747899,
"line_max": 102,
"alpha_frac": 0.528524755,
"autogenerated": false,
"ratio": 3.3493265993265995,
"config_test": fal... |
"""A few tests using a server"""
from __future__ import print_function
import os
import subprocess
import sys
import time
import hfo
hfo_env = hfo.HFOEnvironment()
def try_step(): # if a game ends within ~20 frames, something is wrong...
status = hfo_env.step()
assert (status ==
hfo.IN_GAME... | {
"repo_name": "mhauskn/HFO",
"path": "tests/test_with_server.py",
"copies": "2",
"size": "4021",
"license": "mit",
"hash": -1793857208741640400,
"line_mean": 32.5083333333,
"line_max": 102,
"alpha_frac": 0.5254911714,
"autogenerated": false,
"ratio": 3.293202293202293,
"config_test": false,
"... |
"""A few things that didn't seem to fit anywhere else."""
import os, os.path
import pwd
import tempfile
import fcntl
import errno
import threading
import subprocess
import shutil
import sys
import logger
PID_FILE = '/var/run/nodemanager.pid'
####################
def get_default_if():
interface = get_if_from_hwa... | {
"repo_name": "wangyang2013/NodeManager",
"path": "tools.py",
"copies": "2",
"size": "11449",
"license": "apache-2.0",
"hash": -6975115171925987000,
"line_mean": 33.6939393939,
"line_max": 324,
"alpha_frac": 0.6115817975,
"autogenerated": false,
"ratio": 3.5227692307692307,
"config_test": true,... |
# a few utilities common to sfi and sfaadmin
def optparse_listvalue_callback(option, opt, value, parser):
former=getattr(parser.values,option.dest)
if not former: former=[]
# support for using e.g. sfi update -t slice -x the.slice.hrn -r none
# instead of -r '' which is painful and does not pass well t... | {
"repo_name": "yippeecw/sfa",
"path": "sfa/client/common.py",
"copies": "2",
"size": "3567",
"license": "mit",
"hash": 5748487680873300000,
"line_mean": 36.5473684211,
"line_max": 111,
"alpha_frac": 0.6212503504,
"autogenerated": false,
"ratio": 3.463106796116505,
"config_test": false,
"has_n... |
# A few utilities for dealing with certainty judgments
def cert_or(a, b):
if a > 0 and b > 0:
return a + b - a * b
elif a < 0 and b < 0:
return a + b + a * b
else:
return (a + b) / (1 - min(abs(a), abs(b)))
def cert_and(a, b):
return min(a, b)
def is_cert(x):
return Cert.f... | {
"repo_name": "jhenahan/pycin",
"path": "shell.py",
"copies": "1",
"size": "10424",
"license": "mit",
"hash": -7320549787899603000,
"line_mean": 30.877675841,
"line_max": 102,
"alpha_frac": 0.5510360706,
"autogenerated": false,
"ratio": 3.8085495067592254,
"config_test": false,
"has_no_keywor... |
""" A few utilities for Indian Buffet Processes. """
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros, rand, array, sqrt
from numpy.random import beta
def leftordered(M):
""" Returns the given matrix in left-ordered-form. """
l = list(M.T)
l.sort(key=tuple)
return array(l)[::-1].T
... | {
"repo_name": "sepehr125/pybrain",
"path": "pybrain/tools/ibp.py",
"copies": "25",
"size": "2150",
"license": "bsd-3-clause",
"hash": -6824234915666958000,
"line_mean": 26.5641025641,
"line_max": 94,
"alpha_frac": 0.616744186,
"autogenerated": false,
"ratio": 3.5073409461663947,
"config_test": ... |
"""A few utility functions concerning indexable things"""
from hawkweed.functional.primitives import curry
from hawkweed.functional.mathematical import inc, dec
def first(element):
"""
A wrapper around element[0].
params:
element: an element that implements __getitem__
"""
return element[0... | {
"repo_name": "hellerve/hawkweed",
"path": "hawkweed/functional/list_prims.py",
"copies": "1",
"size": "2639",
"license": "mit",
"hash": 8964633804039210000,
"line_mean": 20.4552845528,
"line_max": 58,
"alpha_frac": 0.6131110269,
"autogenerated": false,
"ratio": 3.986404833836858,
"config_test"... |
# A few utility functions
import itertools
import numpy as np
###############################################
# Generally useful functions #
###############################################
# useful with reshape
def linearize_indices(indices, dims):
res = []
remain = indices
for i, _ in en... | {
"repo_name": "yjernite/DeepCRF",
"path": "utils.py",
"copies": "1",
"size": "15564",
"license": "mit",
"hash": 5032182127618894000,
"line_mean": 38.2040302267,
"line_max": 109,
"alpha_frac": 0.4693523516,
"autogenerated": false,
"ratio": 3.7189964157706092,
"config_test": true,
"has_no_keywo... |
# aff/dic output
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import sys
import unicodedata
def NFD(unistr):
return unicodedata.normalize('NFD', unistr)
def ... | {
"repo_name": "changwoo/hunspell-dict-ko",
"path": "make-aff-dic.py",
"copies": "1",
"size": "9883",
"license": "mpl-2.0",
"hash": -7829373850463896000,
"line_mean": 32.6308243728,
"line_max": 93,
"alpha_frac": 0.4775658105,
"autogenerated": false,
"ratio": 3.1914965986394557,
"config_test": fa... |
# AFF file utility
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import config
from flags import *
from jamo import *
import suffix
import josa
import unicodedata
... | {
"repo_name": "changwoo/hunspell-dict-ko",
"path": "aff.py",
"copies": "1",
"size": "11154",
"license": "mpl-2.0",
"hash": -4456701804743460400,
"line_mean": 32.3767123288,
"line_max": 77,
"alpha_frac": 0.5762364047,
"autogenerated": false,
"ratio": 1.626773493573694,
"config_test": false,
"h... |
# affiliates.py
from django import template
from django.utils import html
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
import urllib;
if (not vars().has_key('ITUNES_AFFILIATE_ID')):
ITUNES_AFFILIATE_ID = 'FU9TTuAveps'
if (not vars().has_key('AMAZON_AFFILIAT... | {
"repo_name": "winks/hyde",
"path": "hydeengine/templatetags/affliiates.py",
"copies": "62",
"size": "4305",
"license": "mit",
"hash": 5220269701794594000,
"line_mean": 36.7631578947,
"line_max": 165,
"alpha_frac": 0.6680603949,
"autogenerated": false,
"ratio": 2.9833679833679834,
"config_test"... |
# Affine Cipher Hacker
# http://inventwithpython.com/hacking (BSD Licensed)
# Affine Hacker copied from AL Sweigart
# Implement this into Main
import pyperclip, affineCipher, detectEnglish, cryptomath
SILENT_MODE = False
def main():
# You might want to copy & paste this text from the source code at
# http://i... | {
"repo_name": "brandonskerritt51/Ciphey",
"path": "source/AffineHacker.py",
"copies": "1",
"size": "2082",
"license": "mit",
"hash": -7774710397419433000,
"line_mean": 33.131147541,
"line_max": 79,
"alpha_frac": 0.6340057637,
"autogenerated": false,
"ratio": 3.834254143646409,
"config_test": fa... |
# Affine Cipher Hacker
# http://inventwithpython.com/hacking (BSD Licensed)
import pyperclip, affineCipher, detectEnglish, cryptomath
SILENT_MODE = False
def main():
# You might want to copy & paste this text from the source code at
# http://invpy.com/affineHacker.py
myMessage = """U&'<3dJ^Gjx'-3^MS'Sj0j... | {
"repo_name": "coolhacks/python-hacks",
"path": "examples/codebreaker/affineHacker.py",
"copies": "1",
"size": "2121",
"license": "mit",
"hash": -1399614942504336100,
"line_mean": 34.3666666667,
"line_max": 148,
"alpha_frac": 0.6265912306,
"autogenerated": false,
"ratio": 3.4154589371980677,
"c... |
"""Affine Cipher Hacker
Implements a function that can hack an affine cipher encrypted message.
Attributes:
SILENT_MODE (bool): Specifies whether to print all key attempts.
Note:
* https://www.nostarch.com/crackingcodes/ (BSD Licensed)
"""
from pythontutorials.books.CrackingCodes.Ch14.affineCipher import d... | {
"repo_name": "JoseALermaIII/python-tutorials",
"path": "pythontutorials/books/CrackingCodes/Ch15/affineHacker.py",
"copies": "1",
"size": "2921",
"license": "mit",
"hash": 7821984454907578000,
"line_mean": 32.1931818182,
"line_max": 114,
"alpha_frac": 0.6699760356,
"autogenerated": false,
"ratio... |
# Affine Cipher Hacker
# http://inventwithpython.com/hacking (BSD Licensed)
import pyperclip, affineCipher, detectEnglish, cryptomath
SILENT_MODE = False
def main():
# You might want to copy & paste this text from the source code at
# http://invpy.com/affineHacker.py
myMessage = """U&'<3dJ^Gjx'... | {
"repo_name": "SafeW3rd/Ciphers",
"path": "affineHacker.py",
"copies": "1",
"size": "2180",
"license": "mit",
"hash": -2016764720417632800,
"line_mean": 34.3666666667,
"line_max": 148,
"alpha_frac": 0.6096330275,
"autogenerated": false,
"ratio": 3.4935897435897436,
"config_test": false,
"has_... |
# Affine Cipher
# http://inventwithpython.com/hacking (BSD Licensed)
import sys, pyperclip, cryptomath, random
SYMBOLS = """ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~""" # note the space at the front
def main():
myMessage = """"A computer would deserve to be c... | {
"repo_name": "coolhacks/python-hacks",
"path": "examples/codebreaker/affineCipher.py",
"copies": "1",
"size": "2955",
"license": "mit",
"hash": -131558046693880850,
"line_mean": 35.0487804878,
"line_max": 148,
"alpha_frac": 0.6345177665,
"autogenerated": false,
"ratio": 3.5262529832935563,
"co... |
"""Affine Cipher
Provides functions that implement affine cipher encryption and decryption.
Attributes:
SYMBOLS (str): String containing all symbols that can be encrypted/decrypted.
Example:
>>> import pythontutorials.books.CrackingCodes.Ch14.affineCipher as affineCipher
>>> someString = 'Enthusiasm is c... | {
"repo_name": "JoseALermaIII/python-tutorials",
"path": "pythontutorials/books/CrackingCodes/Ch14/affineCipher.py",
"copies": "1",
"size": "5506",
"license": "mit",
"hash": -2644642832449897500,
"line_mean": 31.9700598802,
"line_max": 108,
"alpha_frac": 0.6600072648,
"autogenerated": false,
"rati... |
# Affine Cipher
# http://inventwithpython.com/hacking (BSD Licensed)
import sys, pyperclip, cryptomath, random
SYMBOLS = """ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~""" # note the space at the front
def main():
myMessage = """"A computer would deserve... | {
"repo_name": "brandonskerritt51/Ciphey",
"path": "source/affineCipher.py",
"copies": "1",
"size": "3038",
"license": "mit",
"hash": 164405921672283870,
"line_mean": 35.0487804878,
"line_max": 148,
"alpha_frac": 0.6171823568,
"autogenerated": false,
"ratio": 3.603795966785291,
"config_test": fa... |
""" Affine image registration module consisting of the following classes:
AffineMap: encapsulates the necessary information to perform affine
transforms between two domains, defined by a `static` and a `moving`
image. The `domain` of the transform is the set of points in the
`static` image'... | {
"repo_name": "nilgoyyou/dipy",
"path": "dipy/align/imaffine.py",
"copies": "2",
"size": "57192",
"license": "bsd-3-clause",
"hash": -2217354619437348600,
"line_mean": 45.6112469438,
"line_max": 105,
"alpha_frac": 0.5965169954,
"autogenerated": false,
"ratio": 4.5136137637124145,
"config_test":... |
"""Affine measure"""
import numpy as np
from py_stringmatching import utils
from six.moves import xrange
from py_stringmatching.similarity_measure.sequence_similarity_measure import \
SequenceSimilarityMeasure
def sim_ident(char1, char2):
return int(char1 == ... | {
"repo_name": "Anson-Doan/py_stringmatching",
"path": "py_stringmatching/similarity_measure/affine.py",
"copies": "1",
"size": "5192",
"license": "bsd-3-clause",
"hash": -6131511115504364000,
"line_mean": 31.6540880503,
"line_max": 187,
"alpha_frac": 0.5381355932,
"autogenerated": false,
"ratio":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.