text stringlengths 0 1.05M | meta dict |
|---|---|
# Breathlyzer
# facebook puzzle challenge #4
import sys
import os
import logging
logging.basicConfig(level=logging.DEBUG)
#compare and return the diferences in a two words
def compare_words(word1, word2):
wrongs = 0
if word1 != word2:
l = [word1, word2]
m = map(None, *l)
for lette... | {
"repo_name": "andersoncardoso/coding_challenges",
"path": "codejam_and_others/breathlyzer/breathlyzer.py",
"copies": "1",
"size": "1787",
"license": "mit",
"hash": 1299627826453829000,
"line_mean": 23.8194444444,
"line_max": 67,
"alpha_frac": 0.5198656967,
"autogenerated": false,
"ratio": 3.6921... |
# BREIMAN, L. Random forests. Machine Learning, v. 45, n. 1, p. 5–32, 2001.
# Adapted from https://github.com/kevin-keraudren/randomforest-python
import numpy as np
from multiprocessing import Pool, freeze_support
from numpy.random import uniform, random_integers
class RegressionTree(object):
def __init__(self... | {
"repo_name": "lseman/pylspm",
"path": "pylspm/regForest.py",
"copies": "1",
"size": "3880",
"license": "mit",
"hash": -2556180620465188400,
"line_mean": 30.7868852459,
"line_max": 75,
"alpha_frac": 0.5278494069,
"autogenerated": false,
"ratio": 3.8472222222222223,
"config_test": true,
"has_n... |
# Brendan King
# CSE 427
# Homework 1
import numpy as np
import random
import requests
import json, sys
# Constants
UP = 'UP'
LEFT = 'LEFT'
DIAG = 'DIAG'
UNIPROT_BASE_URL = 'http://www.uniprot.org/uniprot/'
def get_score(aa1, aa2):
return 1 if aa1.capitalize() == aa2.capitalize() else -1
class SmithWaterman:
... | {
"repo_name": "kingb12/languagemodelRNN",
"path": "alignment.py",
"copies": "1",
"size": "10480",
"license": "mit",
"hash": 8562154197778571000,
"line_mean": 37.5294117647,
"line_max": 120,
"alpha_frac": 0.548759542,
"autogenerated": false,
"ratio": 3.259720062208398,
"config_test": false,
"h... |
# Brenna Blackwell
# DivideAndRecreate.py
# University of Arkansas
# CSCE Capstone II - Spring 2004
import sys
from PIL import Image, ImageFilter
def main():
try:
original = Image.open("images/TestImage.jpg")
width, height = original.size
oneThird = width / 3
first = 0 + oneThird
second = firs... | {
"repo_name": "BrennaBlackwell/PythonForPi",
"path": "test code/DivideAndRecreate.py",
"copies": "2",
"size": "1372",
"license": "mit",
"hash": 5770765886203268000,
"line_mean": 28.2127659574,
"line_max": 66,
"alpha_frac": 0.7018950437,
"autogenerated": false,
"ratio": 3.1040723981900453,
"conf... |
# Brenna Blackwell
# DivideAndRecreate.py
# University of Arkansas
# CSCE Capstone II - Spring 2004
import sys
from PIL import Image, ImageFilter
def main():
try:
original = Image.open("/home/pi/images/" + sys.argv[1])
width, height = original.size
oneThird = width / 3
first = 0 + oneThird
seco... | {
"repo_name": "BrennaBlackwell/PythonForPi",
"path": "project code/zeus/Manip/manipulation.py",
"copies": "1",
"size": "1430",
"license": "mit",
"hash": 8005397010623490000,
"line_mean": 30.1086956522,
"line_max": 66,
"alpha_frac": 0.6881118881,
"autogenerated": false,
"ratio": 2.9183673469387754... |
### Brett Atkinson
### September, 2015
### Software Design - Project 1.1
### Expanded script specifically for collecting data during events
def poli_twitter_analysis():
"""This function parses Twitter to determine the average sentiment towards political figures during an event"""
candidates = ['trump','walker', '... | {
"repo_name": "brettkinson/SoftwareDesignFall15",
"path": "mop1/project1_2.py",
"copies": "1",
"size": "1533",
"license": "mit",
"hash": 6169817858619610000,
"line_mean": 25.4482758621,
"line_max": 175,
"alpha_frac": 0.6836268754,
"autogenerated": false,
"ratio": 2.767148014440433,
"config_test... |
### Brett Atkinson
### September, 2015
### Software Design - Project 1
def poli_twitter_analysis():
"""This function parses Twitter to determine the average sentiment towards a user-defined political figure"""
print 'This program measures the average sentiment of the populous towards a political candidate through... | {
"repo_name": "brettkinson/SoftwareDesignFall15",
"path": "mop1/project1_1.py",
"copies": "1",
"size": "2942",
"license": "mit",
"hash": -9033356212901965000,
"line_mean": 34.0357142857,
"line_max": 163,
"alpha_frac": 0.6988443236,
"autogenerated": false,
"ratio": 3.0174358974358975,
"config_te... |
### Brett Atkinson
### September, 2015
### Software Design - Project 1
##Updated with regards to NINJA comments, Dec 2015
from pattern.web import Twitter
import indiocio
indicoio.config.api_key = 'f40bb2f1a1746e98919452261d38003a'
def get_tweets():
'''This function parses Twitter to find tweets about a user-defin... | {
"repo_name": "brettkinson/SoftwareDesignFall15",
"path": "mop1/project1_corrections.py",
"copies": "1",
"size": "3123",
"license": "mit",
"hash": -4893839812987272000,
"line_mean": 30.24,
"line_max": 165,
"alpha_frac": 0.692923471,
"autogenerated": false,
"ratio": 2.943449575871819,
"config_te... |
#### Brett Atkinson
#### Software Design - FA'15
#### Project Toolbox - Word Frequency Analysis
""" Analyzes the word frequencies in a book downloaded from
Project Gutenberg """
import string
from collections import Counter
import operator
def get_word_list(file_name):
""" Reads the specified project Gutenberg bo... | {
"repo_name": "brettkinson/SoftwareDesignFall15",
"path": "toolbox/word_frequency_analysis/frequency.py",
"copies": "1",
"size": "2082",
"license": "mit",
"hash": -8378372008145338000,
"line_mean": 24.4024390244,
"line_max": 81,
"alpha_frac": 0.6753121998,
"autogenerated": false,
"ratio": 3.06627... |
# Brett (Berty) Fischler and Hunter (Kenneth) Wapman
# October 2014
# kNN Implementation for Senior Design Project
from collections import Counter
import sets
import math
import sys
import os
from math import isinf
from datetime import datetime
#-------------
# CONSTANTS
#-------------
COEFF_JACCARD = 1.6
COEFF_EUC... | {
"repo_name": "TeamSirius/Utilities",
"path": "kNN.py",
"copies": "1",
"size": "14450",
"license": "apache-2.0",
"hash": -883195961571896200,
"line_mean": 31.618510158,
"line_max": 161,
"alpha_frac": 0.5503806228,
"autogenerated": false,
"ratio": 3.361246801581763,
"config_test": true,
"has_n... |
# Brett Fischler
# March 2015
# Analysis Tool for Errors
import matplotlib.pyplot as plt
import numpy as np
import sys
import math
def showCDF(error_lists):
""" Displays CDF of Accuracy for Various k-NN Distance Metrics """
index = 0
max_bucket = int(max([math.ceil(max(errors) + 2) for errors in error_lis... | {
"repo_name": "TeamSirius/Utilities",
"path": "scripts/visualizeerror.py",
"copies": "1",
"size": "2050",
"license": "apache-2.0",
"hash": 8311119720721862000,
"line_mean": 31.5396825397,
"line_max": 93,
"alpha_frac": 0.5746341463,
"autogenerated": false,
"ratio": 3.3661740558292284,
"config_te... |
""" brew_exts defines generic extensions to Homebrew this file
builds on those abstraction and provides Galaxy specific functionality
not useful to the brew external commands.
"""
from ..deps import brew_exts
DEFAULT_TAP = "homebrew/science"
class HomebrewRecipe(object):
def __init__(self, recipe, version, tap)... | {
"repo_name": "jmchilton/pulsar",
"path": "galaxy/tools/deps/brew_util.py",
"copies": "2",
"size": "1179",
"license": "apache-2.0",
"hash": -4916458931909856000,
"line_mean": 28.475,
"line_max": 72,
"alpha_frac": 0.7090754877,
"autogenerated": false,
"ratio": 4.09375,
"config_test": false,
"h... |
#brew install wxpython
#sudo apt install linuxbrew-wrapper
#sudo apt install python-pip
#pip install SpeechRecognition
#sudo apt-get install python-pyaudio python3-pyaudio
#pip install --allow-unverified=pyaudio pyaudio
#sudo apt-get install python-wxtools
#sudo pip install pyttsx
#sudo pip install wikipedia
#IF MEMOR... | {
"repo_name": "Kostoeva/Holmes",
"path": "Holmes.py",
"copies": "1",
"size": "6951",
"license": "mit",
"hash": 1855289664186684000,
"line_mean": 39.649122807,
"line_max": 163,
"alpha_frac": 0.6269601496,
"autogenerated": false,
"ratio": 3.717112299465241,
"config_test": false,
"has_no_keyword... |
# Brian Keegan, 2012
# This function creates text files containing a list of Wikipedia categories which will be passed to a scraping algorithm.
# Two files are created for each category type, events before 2001 (Wikipedia's founding) and after 2001
#Define schema for naming category types
topics=[('fires', "Category:{... | {
"repo_name": "tothebeat/wikipedia-revisions",
"path": "old/list_generator_2.py",
"copies": "1",
"size": "1418",
"license": "mit",
"hash": -6778896779769516000,
"line_mean": 44.7419354839,
"line_max": 122,
"alpha_frac": 0.6445698166,
"autogenerated": false,
"ratio": 3.2672811059907834,
"config_... |
from __future__ import print_function
import platform
import numpy
_multi=False
_ncpus=1
try:
# May raise ImportError
import multiprocessing
_multi=True
# May raise NotImplementedError
_ncpus = multiprocessing.cpu_count()
except:
pass
__all__ = ('parallel_map',)
def worker(f, ii, chunk, out_q, err_q, ... | {
"repo_name": "jobovy/galpy",
"path": "galpy/util/multi.py",
"copies": "2",
"size": "6512",
"license": "bsd-3-clause",
"hash": -646690954059064800,
"line_mean": 28.4660633484,
"line_max": 74,
"alpha_frac": 0.7100737101,
"autogenerated": false,
"ratio": 4.004920049200492,
"config_test": false,
... |
#Brian Stamm
#CSC 110 - 11/11/14
#HW 6: Binary Number Game
import random #Done for random numbers
import sys #Done to exit the program at the end
WINNING = 10 #Score needed to win/end game, GLOBAL CONSTANT!!!!!!
def main():
computer_score = 0 #Starting score for computer
p... | {
"repo_name": "bkstamm67/python",
"path": "pastHW/binaryGame.py",
"copies": "1",
"size": "4387",
"license": "mit",
"hash": -4376900952835153000,
"line_mean": 42.3131313131,
"line_max": 117,
"alpha_frac": 0.6179621609,
"autogenerated": false,
"ratio": 4.1347785108388315,
"config_test": false,
... |
#Brian Stamm
#CSC 110 - Dr. West
#10.21.14
#Homework 4 - Drawing
#This program is NOT interactive, and it draws the same picture every time. Running this program, you must
#have the Gui tool (Gui3.py) to run this properly, and it must be saved in the same file as this.
from Gui import * # - as mentioned, Gu... | {
"repo_name": "bkstamm67/python",
"path": "pastHW/guiDrawing.py",
"copies": "1",
"size": "4176",
"license": "mit",
"hash": -7495951942383809000,
"line_mean": 47.1294117647,
"line_max": 140,
"alpha_frac": 0.6307471264,
"autogenerated": false,
"ratio": 3.030478955007257,
"config_test": false,
"... |
#Brian Stamm
#CSC 110
#10.29.14
#Homework 5 - Sandy's Sub Shop
import sys
SALES_TAX = 0.095 #Percentage as a decimal, GLOBAL!
def main():
intro() #Introduction function, explain basics to users, HAS SPECIALS LISTED (marked)
instructions() ... | {
"repo_name": "bkstamm67/python",
"path": "pastHW/subShop.py",
"copies": "1",
"size": "5643",
"license": "mit",
"hash": 4251674314444545000,
"line_mean": 46.6465517241,
"line_max": 192,
"alpha_frac": 0.5637072479,
"autogenerated": false,
"ratio": 3.7420424403183024,
"config_test": false,
"has... |
#Brian Stamm
#CSC 110
#11.21.14
#Lab 9 - Advanced Strings
import os
def main():
instructions()
file_name = input("What is the name of the file we are using? ")
file = open(file_name, 'r')
line = file.readline()
upper_count = 0
total_count = 0
lower_count = 0
digit_cou... | {
"repo_name": "bkstamm67/python",
"path": "pastHW/fileStringCounter.py",
"copies": "1",
"size": "1774",
"license": "mit",
"hash": 5274542700267799000,
"line_mean": 26.6129032258,
"line_max": 86,
"alpha_frac": 0.5326944758,
"autogenerated": false,
"ratio": 3.7905982905982905,
"config_test": fals... |
#Brian Stamm
#CSC - 110
#Howework 8 - Encryption/Decryption
#11.18.14
import sys
import os
INSTRUCTION_CHOICE = 1 #GLOBAL CHOICES
DECRYPT_CHOICE = 2
ENCRYPT_CHOICE = 3
QUIT_CHOICE = 4
LETTERS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.!?,\'\";:-' #GLOBAL LIST - contains all lett... | {
"repo_name": "bkstamm67/python",
"path": "pastHW/encrypt.py",
"copies": "1",
"size": "5310",
"license": "mit",
"hash": -2202008579551025400,
"line_mean": 38.2272727273,
"line_max": 158,
"alpha_frac": 0.6378531073,
"autogenerated": false,
"ratio": 3.6926286509040334,
"config_test": false,
"ha... |
#Brian Stamm
#CSC 110
#HW 10 - Cellular Automata
#12.4.14
CELLS=(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
#GLOBAL CONSTANT (tuple), can change to change the # of iterations
def main():
instructions()
function()... | {
"repo_name": "bkstamm67/python",
"path": "pastHW/cellAuto.py",
"copies": "1",
"size": "3652",
"license": "mit",
"hash": -592349545716526800,
"line_mean": 39.0337078652,
"line_max": 137,
"alpha_frac": 0.5509309967,
"autogenerated": false,
"ratio": 3.655655655655656,
"config_test": false,
"has... |
#Brian Stamm
#CSC 110
#HW 1 - Mad Lips
#9.29.14 v2
#Original story
#The other day, I was walking with my dog, and then the most amazing thing happened!
#We were in the middle of Discovery Park, and then a leprechaun jumped out of the bushes!
#“Hello, my name is Patrick! And I will grant you 1 wish(es)!”
#“... | {
"repo_name": "bkstamm67/python",
"path": "pastHW/madLips.py",
"copies": "1",
"size": "2497",
"license": "mit",
"hash": -8421622279064180000,
"line_mean": 42.0892857143,
"line_max": 105,
"alpha_frac": 0.6780072904,
"autogenerated": false,
"ratio": 2.8776223776223775,
"config_test": false,
"ha... |
"""brickset_app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/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')
Cla... | {
"repo_name": "takanory/pymook-samplecode",
"path": "6_web/brickset_app/brickset_app/urls.py",
"copies": "2",
"size": "1112",
"license": "mit",
"hash": 2975038139167421000,
"line_mean": 33.1875,
"line_max": 93,
"alpha_frac": 0.676416819,
"autogenerated": false,
"ratio": 3.3661538461538463,
"con... |
"""Bricks that compose together other bricks in linear sequences."""
import copy
from toolz import interleave
from picklable_itertools.extras import equizip
from ..utils import pack
from .base import Brick, application, lazy
from .interfaces import Feedforward, Initializable
from .simple import Linear
class Sequence... | {
"repo_name": "rizar/attention-lvcsr",
"path": "libs/blocks/blocks/bricks/sequences.py",
"copies": "1",
"size": "5492",
"license": "mit",
"hash": -4201273808453358600,
"line_mean": 32.9012345679,
"line_max": 77,
"alpha_frac": 0.6267297888,
"autogenerated": false,
"ratio": 4.280592361652377,
"co... |
"""Bridge based network management service."""
from __future__ import absolute_import
import errno
import logging
import os
import subprocess
from .. import logcontext as lc
from .. import netdev
from .. import vipfile
from .. import iptables
from ._base_service import BaseResourceServiceImpl
_LOGGER = lc.Containe... | {
"repo_name": "toenuff/treadmill",
"path": "lib/python/treadmill/services/network_service.py",
"copies": "1",
"size": "9883",
"license": "apache-2.0",
"hash": 760879545204534400,
"line_mean": 31.9433333333,
"line_max": 77,
"alpha_frac": 0.5550946069,
"autogenerated": false,
"ratio": 3.75922403955... |
"""Bridge based network management service.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import errno
import logging
import os
import netifaces
import six
from treadmill import iptables
from treadmill import ... | {
"repo_name": "bretttegart/treadmill",
"path": "lib/python/treadmill/services/network_service.py",
"copies": "1",
"size": "13633",
"license": "apache-2.0",
"hash": -4405324438360275000,
"line_mean": 32.4142156863,
"line_max": 78,
"alpha_frac": 0.5659062569,
"autogenerated": false,
"ratio": 3.7371... |
"""Bridge based network management service.
"""
import errno
import logging
import os
import subprocess
import netifaces
from .. import logcontext as lc
from .. import netdev
from .. import vipfile
from .. import iptables
from ._base_service import BaseResourceServiceImpl
_LOGGER = lc.ContainerAdapter(logging.getL... | {
"repo_name": "keithhendry/treadmill",
"path": "treadmill/services/network_service.py",
"copies": "3",
"size": "10815",
"license": "apache-2.0",
"hash": 1327735903718910200,
"line_mean": 31.9725609756,
"line_max": 78,
"alpha_frac": 0.5588534443,
"autogenerated": false,
"ratio": 3.7370421561852107... |
"""Bridge between BMI and a PyMT component."""
import ctypes
import json
import os
from pprint import pformat
import numpy as np
import yaml
from cfunits import Units
from deprecated import deprecated
from scripting.contexts import cd
from ..errors import BmiError
from ..units import UnitConverter, transform_azimuth_... | {
"repo_name": "csdms/coupling",
"path": "pymt/framework/bmi_bridge.py",
"copies": "1",
"size": "17387",
"license": "mit",
"hash": -6552445795531701000,
"line_mean": 28.6201022147,
"line_max": 87,
"alpha_frac": 0.5719215506,
"autogenerated": false,
"ratio": 3.4539133889551055,
"config_test": fal... |
"""Bridge between BMI and a PyMT component."""
import ctypes
import json
import os
from pprint import pformat
import numpy as np
import yaml
import gimli
from deprecated import deprecated
from ..utils import as_cwd
from ..errors import BmiError
from ..units import transform_azimuth_to_math, transform_math_to_azimuth... | {
"repo_name": "csdms/pymt",
"path": "pymt/framework/bmi_bridge.py",
"copies": "1",
"size": "23990",
"license": "mit",
"hash": -2648222949939074600,
"line_mean": 29.3670886076,
"line_max": 86,
"alpha_frac": 0.5715298041,
"autogenerated": false,
"ratio": 3.485398808659015,
"config_test": false,
... |
"""Bridge between emulated_roku and Home Assistant."""
import logging
from emulated_roku import EmulatedRokuCommandHandler, EmulatedRokuServer
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
from homeassistant.core import CoreState, EventOrigin
LOGGER = logging.getLogger(__package... | {
"repo_name": "leppa/home-assistant",
"path": "homeassistant/components/emulated_roku/binding.py",
"copies": "2",
"size": "5694",
"license": "apache-2.0",
"hash": 7084439557539090000,
"line_mean": 30.4585635359,
"line_max": 83,
"alpha_frac": 0.5114155251,
"autogenerated": false,
"ratio": 4.012684... |
"""Bridge between emulated_roku and Home Assistant."""
import logging
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
from homeassistant.core import CoreState, EventOrigin
LOGGER = logging.getLogger(__package__)
EVENT_ROKU_COMMAND = "roku_command"
ATTR_COMMAND_TYPE = "type"
ATTR_... | {
"repo_name": "qedi-r/home-assistant",
"path": "homeassistant/components/emulated_roku/binding.py",
"copies": "4",
"size": "5701",
"license": "apache-2.0",
"hash": -5918072549868597000,
"line_mean": 30.6722222222,
"line_max": 83,
"alpha_frac": 0.5107875811,
"autogenerated": false,
"ratio": 4.0204... |
"""Bridge between emulated_roku and Home Assistant."""
import logging
from homeassistant.const import (
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP)
from homeassistant.core import CoreState, EventOrigin
LOGGER = logging.getLogger('homeassistant.components.emulated_roku')
EVENT_ROKU_COMMAND = 'roku_comman... | {
"repo_name": "nugget/home-assistant",
"path": "homeassistant/components/emulated_roku/binding.py",
"copies": "3",
"size": "5178",
"license": "apache-2.0",
"hash": -4500989876739418000,
"line_mean": 34.2244897959,
"line_max": 79,
"alpha_frac": 0.5677867903,
"autogenerated": false,
"ratio": 3.7467... |
"""Bridge control utilities.
"""
import os
import os.path
import re
import sys
import logging
import httplib2
import socket
import struct
import select
from socket import inet_aton, inet_ntoa
from struct import unpack, pack
from xen.xend.XendLogging import log_netctl, init
from xen.xend.ConfigUtil import getConfigVar
... | {
"repo_name": "Hearen/OnceServer",
"path": "pool_management/bn-xend-core/util/Netctl.py",
"copies": "1",
"size": "40209",
"license": "mit",
"hash": 2272599840739942000,
"line_mean": 34.2092819615,
"line_max": 161,
"alpha_frac": 0.544231391,
"autogenerated": false,
"ratio": 3.243969342476805,
"c... |
from __future__ import print_function
import doctest
import os
import random
import sqlite3
import tempfile
import unittest
import warnings
import time
from datetime import datetime
import bridgedb.Bridges
import bridgedb.Main
import bridgedb.Dist
import bridgedb.schedule
import bridgedb.Storage
import re
import ipa... | {
"repo_name": "pagea/bridgedb",
"path": "lib/bridgedb/Tests.py",
"copies": "1",
"size": "29005",
"license": "bsd-3-clause",
"hash": 9042944390989335000,
"line_mean": 36.1858974359,
"line_max": 93,
"alpha_frac": 0.5824857783,
"autogenerated": false,
"ratio": 3.6470514271344148,
"config_test": tr... |
import calendar
import os
import logging
import binascii
import sqlite3
import time
import hashlib
from contextlib import contextmanager
from contextlib import GeneratorContextManager
from functools import wraps
from ipaddr import IPAddress, IPv6Address, IPv4Address
import sys
import bridgedb.Stability as Stability
f... | {
"repo_name": "mmaker/bridgedb",
"path": "lib/bridgedb/Storage.py",
"copies": "1",
"size": "19097",
"license": "bsd-3-clause",
"hash": 187573904210024700,
"line_mean": 32.1545138889,
"line_max": 116,
"alpha_frac": 0.5808765775,
"autogenerated": false,
"ratio": 3.947292269532865,
"config_test": ... |
import calendar
import os
import logging
import binascii
import sqlite3
import time
import hashlib
from ipaddr import IPAddress, IPv6Address, IPv4Address
import bridgedb.Stability as Stability
from bridgedb.Stability import BridgeHistory
toHex = binascii.b2a_hex
fromHex = binascii.a2b_hex
HEX_ID_LEN = 40
def _escap... | {
"repo_name": "wfn/bridgedb",
"path": "lib/bridgedb/Storage.py",
"copies": "1",
"size": "17379",
"license": "bsd-3-clause",
"hash": 3672852474861614600,
"line_mean": 33.1434184676,
"line_max": 116,
"alpha_frac": 0.5732780943,
"autogenerated": false,
"ratio": 3.7978583916083917,
"config_test": f... |
import calendar
import os
import logging
import binascii
import sqlite3
import time
import sha
from ipaddr import IPAddress, IPv6Address, IPv4Address
import bridgedb.Stability as Stability
from bridgedb.Stability import BridgeHistory
toHex = binascii.b2a_hex
fromHex = binascii.a2b_hex
HEX_ID_LEN = 40
def _escapeVal... | {
"repo_name": "sysrqb/bridgedb",
"path": "lib/bridgedb/Storage.py",
"copies": "1",
"size": "17355",
"license": "bsd-3-clause",
"hash": 5191980091384328000,
"line_mean": 33.0962671906,
"line_max": 116,
"alpha_frac": 0.5726879862,
"autogenerated": false,
"ratio": 3.795931758530184,
"config_test":... |
import calendar
import os
import logging
import binascii
import sqlite3
import time
import sha
toHex = binascii.b2a_hex
fromHex = binascii.a2b_hex
HEX_ID_LEN = 40
def _escapeValue(v):
return "'%s'" % v.replace("'", "''")
def timeToStr(t):
return time.strftime("%Y-%m-%d %H:%M", time.gmtime(t))
def strToTime(... | {
"repo_name": "aagbsn/bridgedb",
"path": "lib/bridgedb/Storage.py",
"copies": "1",
"size": "14867",
"license": "bsd-3-clause",
"hash": 7095164421181864000,
"line_mean": 32.5598194131,
"line_max": 103,
"alpha_frac": 0.5631263873,
"autogenerated": false,
"ratio": 3.847567287784679,
"config_test":... |
import calendar
import os
import logging
import binascii
import sqlite3
import time
toHex = binascii.b2a_hex
fromHex = binascii.a2b_hex
HEX_ID_LEN = 40
def _escapeValue(v):
return "'%s'" % v.replace("'", "''")
def timeToStr(t):
return time.strftime("%Y-%m-%d %H:%M", time.gmtime(t))
def strToTime(t):
ret... | {
"repo_name": "katmagic/BridgeDB",
"path": "lib/bridgedb/Storage.py",
"copies": "1",
"size": "11332",
"license": "bsd-3-clause",
"hash": 418725433856469950,
"line_mean": 31.9418604651,
"line_max": 80,
"alpha_frac": 0.5573596894,
"autogenerated": false,
"ratio": 3.75480450629556,
"config_test": ... |
"""
This module has functions to decide which bridges to hand out to whom.
"""
import bridgedb.Bridges
import bridgedb.Storage
import bridgedb.Util as Util
import logging
import re
import time
from ipaddr import IPv6Address, IPAddress
from bridgedb.crypto import getHMAC
from bridgedb.crypto import getHMACFunc
from ... | {
"repo_name": "wfn/bridgedb",
"path": "lib/bridgedb/Dist.py",
"copies": "1",
"size": "22374",
"license": "bsd-3-clause",
"hash": 6145696246991850000,
"line_mean": 39.1687612208,
"line_max": 80,
"alpha_frac": 0.5871100384,
"autogenerated": false,
"ratio": 4.134910367769359,
"config_test": false,... |
"""
This module has functions to decide which bridges to hand out to whom.
"""
import bridgedb.Bridges
import bridgedb.Storage
import logging
import re
import time
def uniformMap(ip):
"""Map an IP to an arbitrary 'area' string, such that any two /24 addresses
get the same string.
>>> uniformMap('1.2... | {
"repo_name": "katmagic/BridgeDB",
"path": "lib/bridgedb/Dist.py",
"copies": "1",
"size": "10472",
"license": "bsd-3-clause",
"hash": 2467789388862561000,
"line_mean": 35.8732394366,
"line_max": 80,
"alpha_frac": 0.6022727273,
"autogenerated": false,
"ratio": 3.7266903914590745,
"config_test": ... |
"""
This module has low-level functionality for parsing bridges and arranging
them in rings.
"""
import binascii
import bisect
import hmac
import logging
import re
import sha
import socket
import time
import bridgedb.Storage
import bridgedb.Bucket
HEX_FP_LEN = 40
ID_LEN = 20
DIGESTMOD = sha
HEX_DIGEST_LEN = 40
DIG... | {
"repo_name": "aagbsn/bridgedb",
"path": "lib/bridgedb/Bridges.py",
"copies": "1",
"size": "19396",
"license": "bsd-3-clause",
"hash": -5673241822536029000,
"line_mean": 32.0425894378,
"line_max": 105,
"alpha_frac": 0.5784697876,
"autogenerated": false,
"ratio": 3.9680851063829787,
"config_test... |
"""
This module implements functions for dividing time into chunks.
"""
import calendar
import time
KNOWN_INTERVALS = [ "hour", "day", "week", "month" ]
class Schedule:
def intervalStart(self, when):
raise NotImplementedError
def getInterval(self, when):
raise NotImplementedError
def nex... | {
"repo_name": "sysrqb/bridgedb",
"path": "lib/bridgedb/Time.py",
"copies": "2",
"size": "4144",
"license": "bsd-3-clause",
"hash": -8739466601502105000,
"line_mean": 33.8235294118,
"line_max": 78,
"alpha_frac": 0.5381274131,
"autogenerated": false,
"ratio": 3.8548837209302325,
"config_test": fa... |
"""
This module implements the web and email interfaces to the bridge database.
"""
from cStringIO import StringIO
import MimeWriter
import rfc822
import time
import logging
import gettext
import re
from zope.interface import implements
from twisted.internet import reactor
from twisted.internet.defer import Deferre... | {
"repo_name": "aagbsn/bridgedb",
"path": "lib/bridgedb/Server.py",
"copies": "1",
"size": "25261",
"license": "bsd-3-clause",
"hash": 4472699695320875000,
"line_mean": 38.1037151703,
"line_max": 228,
"alpha_frac": 0.5846561894,
"autogenerated": false,
"ratio": 3.8291647718659996,
"config_test":... |
from ipaddr import IPv6Address, IPv4Address
import logging
funcs = {}
def filterAssignBridgesToRing(hmac, numRings, assignedRing):
#XXX: ruleset should have a key unique to this function
# ruleset ensures that the same
ruleset = frozenset([hmac, numRings, assignedRing])
try:
return funcs[rule... | {
"repo_name": "mmaker/bridgedb",
"path": "lib/bridgedb/Filters.py",
"copies": "1",
"size": "4283",
"license": "bsd-3-clause",
"hash": -2710338846634969600,
"line_mean": 33.264,
"line_max": 89,
"alpha_frac": 0.6110203129,
"autogenerated": false,
"ratio": 4.006548175865294,
"config_test": false,
... |
"""
This module implements the email interface to the bridge database.
"""
from StringIO import StringIO
import MimeWriter
import gettext
import gpgme
import logging
import re
import rfc822
import time
from ipaddr import IPv4Address, IPv6Address
from twisted.internet import reactor
from twisted.internet.defer impor... | {
"repo_name": "wfn/bridgedb",
"path": "lib/bridgedb/EmailServer.py",
"copies": "1",
"size": "18975",
"license": "bsd-3-clause",
"hash": -2787980263919400000,
"line_mean": 36.060546875,
"line_max": 83,
"alpha_frac": 0.6203952569,
"autogenerated": false,
"ratio": 3.8087113608992373,
"config_test"... |
"""
This module implements the web (http, https) interfaces to the bridge database.
"""
import base64
import gettext
import logging
import re
import textwrap
import time
import os
from twisted.internet import reactor
import twisted.web.resource
from twisted.web.server import Site
from twisted.web import static
from ... | {
"repo_name": "sysrqb/bridgedb",
"path": "lib/bridgedb/HTTPServer.py",
"copies": "1",
"size": "11187",
"license": "bsd-3-clause",
"hash": -1323901017787736800,
"line_mean": 36.9220338983,
"line_max": 101,
"alpha_frac": 0.6076696165,
"autogenerated": false,
"ratio": 4.085829072315558,
"config_te... |
# BridgeDB i18n strings & helper routines. The string should go into pootle
import os
import gettext
def getLang(lang, localedir=os.path.expanduser("~") + "/share/locale"):
"""Return the Translation instance for a given language. If no Translation
instance is found, return the one for 'en'
"""
retu... | {
"repo_name": "aagbsn/bridgedb",
"path": "lib/bridgedb/I18n.py",
"copies": "1",
"size": "2771",
"license": "bsd-3-clause",
"hash": -6750722420160826000,
"line_mean": 38.5857142857,
"line_max": 82,
"alpha_frac": 0.6932515337,
"autogenerated": false,
"ratio": 3.4465174129353233,
"config_test": fa... |
"""Bridge for connecting a UI instance to nvim."""
import sys
from threading import Semaphore, Thread
from traceback import format_exc
class UIBridge(object):
"""UIBridge class. Connects a Nvim instance to a UI class."""
def connect(self, nvim, ui):
"""Connect nvim and the ui.
This will star... | {
"repo_name": "meatich/NeoSFML",
"path": "build_windows/nvim_bridge.py",
"copies": "1",
"size": "3578",
"license": "apache-2.0",
"hash": -2796053595450384000,
"line_mean": 33.0761904762,
"line_max": 77,
"alpha_frac": 0.4670206819,
"autogenerated": false,
"ratio": 4.379436964504284,
"config_test... |
"""Bridge for connecting a UI instance to nvim."""
import sys
from threading import Semaphore, Thread
from traceback import format_exc
class UIBridge(object):
"""UIBridge class. Connects a Nvim instance to a UI class."""
def connect(self, nvim, ui, profile=None, notify=False):
"""Connect nvim and th... | {
"repo_name": "timeyyy/pytknvim",
"path": "pytknvim/ui_bridge.py",
"copies": "1",
"size": "3630",
"license": "isc",
"hash": 6234726856545337000,
"line_mean": 32.6111111111,
"line_max": 81,
"alpha_frac": 0.4955922865,
"autogenerated": false,
"ratio": 4.211136890951276,
"config_test": false,
"h... |
"""BridgeGroupInterfaces class."""
from fmcapi.api_objects.apiclasstemplate import APIClassTemplate
from fmcapi.api_objects.object_services.securityzones import SecurityZones
from .devicerecords import DeviceRecords
from .physicalinterfaces import PhysicalInterfaces
import logging
class BridgeGroupInterfaces(APIClas... | {
"repo_name": "daxm/fmcapi",
"path": "fmcapi/api_objects/device_services/bridgegroupinterfaces.py",
"copies": "1",
"size": "6008",
"license": "bsd-3-clause",
"hash": -6066829981939466000,
"line_mean": 33.9302325581,
"line_max": 110,
"alpha_frac": 0.5674101198,
"autogenerated": false,
"ratio": 3.9... |
"""Bridge Module
This module contains common code for wifi bridge classes.
"""
import socket
import time
import six
def create_bridge(version, ip, port=None, pause=100, repeat=1, timeout=2):
"""Creates a bridge for a specific version
>>> bridge = create_bridge(4, '192.168.1.182')
>>> bridge.on('all')
... | {
"repo_name": "mookfist/mookfist-lled-controller",
"path": "mookfist_lled_controller/bridge.py",
"copies": "1",
"size": "9034",
"license": "mit",
"hash": 3509023802257287000,
"line_mean": 27.4088050314,
"line_max": 92,
"alpha_frac": 0.55877795,
"autogenerated": false,
"ratio": 3.9902826855123674,... |
"""Bridge
The Bridge Component is used for inter-process communications between
processes. Bridge is used internally when a Component is started in
"process mode" via :meth:`circuits.core.manager.start`. Typically a
Pipe is used as the socket transport between two sides of a Bridge
(*there must be a :class:`~Bridge` i... | {
"repo_name": "eriol/circuits",
"path": "circuits/core/bridge.py",
"copies": "2",
"size": "3527",
"license": "mit",
"hash": 5026925545334625000,
"line_mean": 29.6695652174,
"line_max": 79,
"alpha_frac": 0.5775446555,
"autogenerated": false,
"ratio": 4.021664766248574,
"config_test": false,
"h... |
"""Bridge pattern
Bridge is a structural design pattern. It separates responsibilities into two
orthogonal class hierarchies: implementation and interface. Bridge decouples an
abstraction from its implementation so that the two can vary independently.
The interface class encapsulates an instance of a concrete impleme... | {
"repo_name": "jackaljack/design-patterns",
"path": "bridge.py",
"copies": "1",
"size": "2845",
"license": "mit",
"hash": 1055997226165550600,
"line_mean": 22.3196721311,
"line_max": 80,
"alpha_frac": 0.6738137083,
"autogenerated": false,
"ratio": 4.041193181818182,
"config_test": false,
"has... |
# bridge.py: A bridge plugin
import threading
import traceback
import requests
import discord
import asyncio
import difflib
import smtpd
import inbox
import time
import sys
import re
from hooks import Hook
TOKEN = 'MjE1MDU5NjA4MjMyOTE5MDQw.CpSDgw.smhe9pdnleRBdPnbty6b2H7htOI'
ID_programming = "214558081399521280"
MAI... | {
"repo_name": "tonyolag/sadaharu",
"path": "plugins/bridge.py",
"copies": "1",
"size": "8637",
"license": "mpl-2.0",
"hash": 5116221794525614000,
"line_mean": 40.1285714286,
"line_max": 163,
"alpha_frac": 0.5317818687,
"autogenerated": false,
"ratio": 3.2409005628517824,
"config_test": false,
... |
"""Bridges between the `asyncio` module and Tornado IOLoop.
This is a work in progress and interfaces are subject to change.
To test:
python3.4 -m tornado.test.runtests --ioloop=tornado.platform.asyncio.AsyncIOLoop
python3.4 -m tornado.test.runtests --ioloop=tornado.platform.asyncio.AsyncIOMainLoop
(the tests log a f... | {
"repo_name": "shakamunyi/tornado",
"path": "tornado/platform/asyncio.py",
"copies": "2",
"size": "5216",
"license": "apache-2.0",
"hash": -7678802914664909000,
"line_mean": 35.2222222222,
"line_max": 84,
"alpha_frac": 0.6004601227,
"autogenerated": false,
"ratio": 4.065471551052221,
"config_te... |
"""Bridges between the `asyncio` module and Tornado IOLoop.
.. versionadded:: 3.2
This module integrates Tornado with the ``asyncio`` module introduced
in Python 3.4 (and available `as a separate download
<https://pypi.python.org/pypi/asyncio>`_ for Python 3.3). This makes
it possible to combine the two libraries on... | {
"repo_name": "importcjj/tornado",
"path": "tornado/platform/asyncio.py",
"copies": "6",
"size": "7483",
"license": "apache-2.0",
"hash": 7660426452142891000,
"line_mean": 34.4644549763,
"line_max": 80,
"alpha_frac": 0.6244821596,
"autogenerated": false,
"ratio": 4.031788793103448,
"config_test... |
"""Bridges between the `asyncio` module and Tornado IOLoop.
.. versionadded:: 3.2
This module integrates Tornado with the ``asyncio`` module introduced
in Python 3.4. This makes it possible to combine the two libraries on
the same event loop.
.. deprecated:: 5.0
While the code in this module is still used, it is... | {
"repo_name": "tornadoweb/tornado",
"path": "tornado/platform/asyncio.py",
"copies": "1",
"size": "23303",
"license": "apache-2.0",
"hash": -1417962070693267200,
"line_mean": 36.6462035541,
"line_max": 90,
"alpha_frac": 0.6115521607,
"autogenerated": false,
"ratio": 4.1957148001440405,
"config_... |
"""Bridges transform the state from the encoders so they fit the decoder
Inspired by OpenNMT & google/seq2seq
## Available bridges
@@NoBridge
@@ZeroBridge
@@DenseBridge
"""
import tensorflow as tf
import tensorflow.keras as keras
class Bridge:
"""Transforms the state from the encoders so they fit the decoder""... | {
"repo_name": "jpbottaro/anna",
"path": "anna/model/bridge.py",
"copies": "1",
"size": "1698",
"license": "mit",
"hash": -1096733065398719200,
"line_mean": 27.3,
"line_max": 81,
"alpha_frac": 0.6378091873,
"autogenerated": false,
"ratio": 3.9396751740139213,
"config_test": false,
"has_no_keyw... |
"""Bridge to sublime functionality."""
import sublime
import logging
import re
from .row_col import ZeroIndexedRowCol
_log = logging.getLogger("ECC")
class SublBridge:
"""A small help class that bridges with sublime (maybe will grow)."""
NO_DEFAULT_COMPLETIONS = sublime.INHIBIT_WORD_COMPLETIONS \
... | {
"repo_name": "niosus/EasyClangComplete",
"path": "plugin/utils/subl/subl_bridge.py",
"copies": "1",
"size": "9325",
"license": "mit",
"hash": 8226408051138569000,
"line_mean": 31.1551724138,
"line_max": 79,
"alpha_frac": 0.5832707775,
"autogenerated": false,
"ratio": 4.157378510922872,
"config... |
## BRIE-Beta model
import time
import numpy as np
from scipy. special import betaln
from scipy.sparse import issparse
import tensorflow as tf
import tensorflow_probability as tfp
from tensorflow.math import digamma, polygamma
from tensorflow_probability import distributions as tfd
# def Binomial_constant_ln(X_a, X_... | {
"repo_name": "huangyh09/brie",
"path": "brie/models/model_Beta.py",
"copies": "1",
"size": "8055",
"license": "apache-2.0",
"hash": -1972889665779781600,
"line_mean": 34.8,
"line_max": 85,
"alpha_frac": 0.5338299193,
"autogenerated": false,
"ratio": 3.2545454545454544,
"config_test": false,
... |
# @brief An IPC channel allowing to call methods of an object from a
# remote process. It is based on python's multiprocessing pipes:
# instead of sending data, we send method call requests to an object
# and transmit back the results (or exceptions). Works between
# processes created by fork() (eg. multiprocessin... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/576509_CallPipe_Call_methods_object_remote/recipe-576509.py",
"copies": "1",
"size": "13358",
"license": "mit",
"hash": 82478173400114690,
"line_mean": 36.0027700831,
"line_max": 108,
"alpha_frac": 0.5895343614,
"autogenerated": false,
"ra... |
"""\brief Blockmon's CLI, run it with: sudo python cli.py. At the prompt type
help for a list of commands.
"""
import os
import sys
from core.bmprocess import BMProcessManager
from core.returnvalue import *
from core.block import *
from core.bmlogging import setup_logging
setup_logging(os.getcwd() + "/cli.lo... | {
"repo_name": "netgroup/dstreamon",
"path": "d-streamon/daemon/cli.py",
"copies": "1",
"size": "4272",
"license": "mit",
"hash": -5817732296082323000,
"line_mean": 31.6106870229,
"line_max": 86,
"alpha_frac": 0.5145131086,
"autogenerated": false,
"ratio": 4.053130929791271,
"config_test": false... |
# Brief: Build densnet graph
# Data: 28/Aug./2017
# E-mail: huyixuanhyx@gmail.com
# License: Apache 2.0
# By: Yeephycho @ Hong Kong
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
import config... | {
"repo_name": "yeephycho/densenet-tensorflow",
"path": "net/densenet.py",
"copies": "1",
"size": "8688",
"license": "apache-2.0",
"hash": 8914308684808877000,
"line_mean": 46.7362637363,
"line_max": 167,
"alpha_frac": 0.6427255985,
"autogenerated": false,
"ratio": 3.209456963428149,
"config_tes... |
# Brief: Data provdier for image classification using tfrecord
# Data: 28/Aug./2017
# E-mail: huyixuanhyx@gmail.com
# License: Apache 2.0
# By: Yeephycho @ Hong Kong
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as ... | {
"repo_name": "yeephycho/densenet-tensorflow",
"path": "data_provider/data_provider.py",
"copies": "1",
"size": "5117",
"license": "apache-2.0",
"hash": -6233930229090380000,
"line_mean": 42.3644067797,
"line_max": 125,
"alpha_frac": 0.6324017979,
"autogenerated": false,
"ratio": 3.51925722145804... |
""" Brief example of how to use nuFATE
"""
import numpy as np
import cascade as cas
import earth
#Choose the flavor & index you want
flavor = 2 # 1,2,3 = e, mu, tau; negative sign for antiparticles
gamma = 2. # Power law index of isotropic flux E^-gamma
ReverseTime = False #You want to go backwards or forward? True... | {
"repo_name": "aaronvincent/nuFATE",
"path": "src/python/example.py",
"copies": "1",
"size": "2676",
"license": "mit",
"hash": -4558111898533574700,
"line_mean": 38.9402985075,
"line_max": 165,
"alpha_frac": 0.6640508221,
"autogenerated": false,
"ratio": 2.8650963597430406,
"config_test": false... |
"""@brief Inverts a shape through the deformation chain
@author Chad Vernon - chadvernon@gmail.com - www.chadvernon.com
Example usage:
Pose your skinned model in the pose that you want to correct.
Duplicate the mesh and sculpt in your fixes. Select the original skinned model,
shift select the corrected model and run:... | {
"repo_name": "chadmv/cvshapeinverter",
"path": "scripts/cvshapeinverter.py",
"copies": "1",
"size": "7370",
"license": "mit",
"hash": -1715621100671797000,
"line_mean": 33.6009389671,
"line_max": 99,
"alpha_frac": 0.6675712347,
"autogenerated": false,
"ratio": 3.4455352968676953,
"config_test"... |
"""briefly explain differences between files"""
import difflib
def is_probably_binary(file_name):
"""ref: http://stackoverflow.com/questions/898669/ """
block_size = 1024
with open(file_name, 'rb') as f:
block = f.read(block_size)
while block == block_size:
if '\0' in block:
... | {
"repo_name": "fcostin/system_pytest",
"path": "system_test_machinery/file_diff.py",
"copies": "1",
"size": "1456",
"license": "bsd-2-clause",
"hash": 8565313357133352000,
"line_mean": 29.9787234043,
"line_max": 78,
"alpha_frac": 0.6146978022,
"autogenerated": false,
"ratio": 3.6954314720812182,
... |
# @brief Parses FCE data for MSXML files downloaded from
# http://cmu.smartevals.com.
#
# MSXML is used to compensate for a bug in the FCE export feature: The
# first few lines of any output are cut off. MSXML is the only format to
# have enough useless metadata at the beginning of the file ... | {
"repo_name": "justingallagher/course-api",
"path": "cmu_course_api/parse_fces.py",
"copies": "3",
"size": "2594",
"license": "mit",
"hash": 6261939199173497000,
"line_mean": 32.2564102564,
"line_max": 79,
"alpha_frac": 0.5023130301,
"autogenerated": false,
"ratio": 4.25944170771757,
"config_te... |
## @brief Singleton class to map/convert a security's shortcode and exchange symbol to an id and vice versa.
# Once we have mapped the symbol to an id, we can work just with id's for all securities, and get
# the symbols using this class whenever required
#
class SecurityNameIndexer():
unique_instance = None # ... | {
"repo_name": "cvquant/trade-analysis",
"path": "cdefs/security_name_indexer.py",
"copies": "2",
"size": "1466",
"license": "mit",
"hash": -8058782701095013000,
"line_mean": 38.6216216216,
"line_max": 108,
"alpha_frac": 0.6909959072,
"autogenerated": false,
"ratio": 4.200573065902579,
"config_t... |
# Brief: Test the densenet for image classification
# Data: 24/Aug./2017
# E-mail: huyixuanhyx@gmail.com
# License: Apache 2.0
# By: Yeephycho @ Hong Kong
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import nu... | {
"repo_name": "yeephycho/densenet-tensorflow",
"path": "test.py",
"copies": "1",
"size": "3066",
"license": "apache-2.0",
"hash": 7996739148656787000,
"line_mean": 33.8409090909,
"line_max": 131,
"alpha_frac": 0.6389432485,
"autogenerated": false,
"ratio": 3.6370106761565837,
"config_test": tru... |
import stack
def infixToPostfix(infixexpr):
prec = {}
prec["*"] = 3
prec["/"] = 3
prec["+"] = 2
prec["-"] = 2
prec["("] = 1
opStack = stack.Stack()
postfixList = []
tokenList = infixexpr.split()
for token in tokenList:
if token in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" or toke... | {
"repo_name": "li-ma/homework",
"path": "algorithms/postfix.py",
"copies": "1",
"size": "2007",
"license": "apache-2.0",
"hash": 33433029023853956,
"line_mean": 26.4931506849,
"line_max": 74,
"alpha_frac": 0.5107125062,
"autogenerated": false,
"ratio": 3.8155893536121672,
"config_test": false,
... |
import six
class Node(object):
def __init__(self, data):
self.data = data
self.next = None
def getData(self):
return self.data
def getNext(self):
return self.next
def setData(self, newdata):
self.data = newdata
def setNext(self, newnext):
self.... | {
"repo_name": "li-ma/homework",
"path": "algorithms/linkedlist.py",
"copies": "1",
"size": "2790",
"license": "apache-2.0",
"hash": -4477795033812262000,
"line_mean": 19.977443609,
"line_max": 56,
"alpha_frac": 0.4917562724,
"autogenerated": false,
"ratio": 4.043478260869565,
"config_test": fal... |
## BRIE model
import time
import numpy as np
from scipy.sparse import issparse
import tensorflow as tf
import tensorflow_probability as tfp
from tensorflow_probability import distributions as tfd
class Model_init():
"""Random initialize parameters for BRIE2 model
"""
def __init__(self, Nc, Ng, Kc, Kg, i... | {
"repo_name": "huangyh09/brie",
"path": "brie/models/model_TFProb.py",
"copies": "1",
"size": "10251",
"license": "apache-2.0",
"hash": -4798181158189396000,
"line_mean": 36.5494505495,
"line_max": 81,
"alpha_frac": 0.5036581797,
"autogenerated": false,
"ratio": 3.517844886753603,
"config_test"... |
'''BrightSign UDP Node'''
### Libraries required by this Node
import socket
### Parameters used by this Node
param_ipAddress = Parameter('{"title":"IP Address","desc":"The IP address","schema":{"type":"string"}}')
PORT = 1010
### Functions used by this Node
def send_udp_string(msg):
#open socket
sock = socke... | {
"repo_name": "museumsvictoria/nodel-recipes",
"path": "Brightsign/script.py",
"copies": "2",
"size": "1885",
"license": "mit",
"hash": 914746717639060500,
"line_mean": 25.9285714286,
"line_max": 108,
"alpha_frac": 0.6519893899,
"autogenerated": false,
"ratio": 3.318661971830986,
"config_test":... |
"""bring_back_null_schedule
Revision ID: 73beceabb948
Revises: e7f8a917aa8e
Create Date: 2019-01-17 13:22:21.729334
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from sqlalchemy.sql import table
from redash.models import MutableDict, PseudoJSON
# revision identifiers,... | {
"repo_name": "denisov-vlad/redash",
"path": "migrations/versions/73beceabb948_bring_back_null_schedule.py",
"copies": "3",
"size": "1327",
"license": "bsd-2-clause",
"hash": -7804751759958007000,
"line_mean": 21.8793103448,
"line_max": 86,
"alpha_frac": 0.6525998493,
"autogenerated": false,
"rat... |
# Bring in the Path library
from path import Path
# Create a variable to store my Path for OCD divisions
ocds = Path('/Users/peterfreeze/Sites/ocd-division-ids')
# Create 2 variables, one for storing the calculated size (reduces amount of calculation calls
# that have to be made). And another for storing the actual f... | {
"repo_name": "mysidewalk/training-django",
"path": "01-middling-python/03-files-and-os/solutions/file-operations-ocds-solution.py",
"copies": "1",
"size": "1708",
"license": "mit",
"hash": 6613464570957829000,
"line_mean": 50.7878787879,
"line_max": 100,
"alpha_frac": 0.7318501171,
"autogenerated"... |
# bring needed modules into program
import os
import time
import argparse
from datetime import datetime
from Adafruit_BMP085 import BMP085
import smbus
import math
bmp = BMP085(0x77) #PRESSURE
#Temp initialse
sensorFile = '/sys/bus/w1/devices/28-0000056e80cd/w1_slave'
def readTempRaw():
f = open(sensorFile, 'r')
l... | {
"repo_name": "InvisibleTree/highAltBalloon",
"path": "src/BIGBADLOGGER/main.py",
"copies": "1",
"size": "5261",
"license": "mit",
"hash": 3102160103029059600,
"line_mean": 29.9470588235,
"line_max": 244,
"alpha_frac": 0.6225052271,
"autogenerated": false,
"ratio": 2.4561157796451916,
"config_t... |
# bring needed modules into program
import os
import time
import argparse
from datetime import datetime
# read from the sensor's output file
sensorFile = '/sys/bus/w1/devices/28-0000056e80cd/w1_slave'
def readTempRaw():
f = open(sensorFile, 'r')
lines = f.readlines()
f.close()
return lines
def readTemp():
lines ... | {
"repo_name": "InvisibleTree/highAltBalloon",
"path": "src/tempsense/temp.py",
"copies": "1",
"size": "1602",
"license": "mit",
"hash": -6190997722605743000,
"line_mean": 25.7,
"line_max": 141,
"alpha_frac": 0.6373283396,
"autogenerated": false,
"ratio": 2.766839378238342,
"config_test": false,... |
# brings in a file to help take punctuation
import string
# import webcolors
from turtle import *
#Get our list of colours
colour_list = open("/Users/jack.sarick/Desktop/Program/list_of_colours.txt")
#breaks the list into lines
colour_list = [line.strip("\n").lower() for line in colour_list]
#Ask the user for the boo... | {
"repo_name": "jacksarick/My-Code",
"path": "Python/Libraries that i've messed with/book_colours.py",
"copies": "1",
"size": "1528",
"license": "mit",
"hash": -6832027962648596000,
"line_mean": 20.5352112676,
"line_max": 76,
"alpha_frac": 0.6982984293,
"autogenerated": false,
"ratio": 2.944123314... |
"""Brings the VPHAS catalogue headers in line with ESO's PHASE 3 requirements.
"""
import os
import re
import json
import glob
from datetime import datetime
import numpy as np
from astropy import log
from astropy.io import fits
from astropy.coordinates import SkyCoord
from astropy.time import Time
from surveytools i... | {
"repo_name": "barentsen/surveytools",
"path": "scripts/eso-release/release-preparation.py",
"copies": "1",
"size": "9140",
"license": "mit",
"hash": -3612216497647485000,
"line_mean": 42.7320574163,
"line_max": 108,
"alpha_frac": 0.5878555799,
"autogenerated": false,
"ratio": 2.9493384962891254,... |
"""Brings up a DNS server with container (skydns + skydock) that allow
different dockers to see each other by hostnames.
"""
import common
import docker
def up(uid):
create_service = '{0}/createService.js'.format(common.get_script_dir())
skydns = docker.run(
image='crosbymichael/skydns',
det... | {
"repo_name": "xorver/oneprovider_ccm",
"path": "bamboos/docker/environment/dns.py",
"copies": "1",
"size": "1107",
"license": "mit",
"hash": 2180479317795587000,
"line_mean": 32.5454545455,
"line_max": 75,
"alpha_frac": 0.5853658537,
"autogenerated": false,
"ratio": 3.548076923076923,
"config_... |
"""Brings up a riak cluster."""
from __future__ import print_function
import re
import sys
import time
import common
import docker
RIAK_READY_WAIT_SECONDS = 60 * 5
def _riak(num):
return 'riak{0}'.format(num)
def config_entry(num, uid):
return '{0}:8087'.format(common.format_hostname(_riak(num), uid))
... | {
"repo_name": "xorver/oneprovider_ccm",
"path": "bamboos/docker/environment/riak.py",
"copies": "1",
"size": "3350",
"license": "mit",
"hash": 4018527159451811000,
"line_mean": 27.3898305085,
"line_max": 80,
"alpha_frac": 0.5892537313,
"autogenerated": false,
"ratio": 3.475103734439834,
"config... |
"""Brings up a set of appmock instances."""
import copy
import json
import os
import random
import string
import common
import docker
def _tweak_config(config, name, uid):
cfg = copy.deepcopy(config)
cfg['nodes'] = {'node': cfg['nodes'][name]}
vm_args = cfg['nodes']['node']['vm.args']
vm_args['name... | {
"repo_name": "xorver/oneprovider_ccm",
"path": "bamboos/docker/environment/appmock.py",
"copies": "1",
"size": "2536",
"license": "mit",
"hash": 7983692261395478000,
"line_mean": 30.7,
"line_max": 78,
"alpha_frac": 0.6332807571,
"autogenerated": false,
"ratio": 3.272258064516129,
"config_test"... |
"""Bring time stamps of generated checked-in files into the right order
A versioned configuration file .hgtouch specifies generated files, in the
syntax of make rules.
output: input1 input2
In addition to the dependency syntax, #-comments are supported.
"""
import errno
import os
import time
def parse_config(r... | {
"repo_name": "anbangleo/NlsdeWeb",
"path": "Python-3.6.0/Tools/hg/hgtouch.py",
"copies": "2",
"size": "4248",
"license": "mit",
"hash": -4158648365144164400,
"line_mean": 31.9302325581,
"line_max": 86,
"alpha_frac": 0.5793314501,
"autogenerated": false,
"ratio": 3.962686567164179,
"config_test... |
"""Bring up to master.
Revision ID: b1063869f198
Revises: a68c0e31204e
Create Date: 2017-07-14 02:46:54.173568
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'b1063869f198'
down_revision = 'a68c0e31204e'
branch_labels ... | {
"repo_name": "HERA-Team/Monitor_and_Control",
"path": "alembic/versions/b1063869f198_bring_up_to_master.py",
"copies": "2",
"size": "9857",
"license": "bsd-2-clause",
"hash": 6227360281846028000,
"line_mean": 51.9946236559,
"line_max": 143,
"alpha_frac": 0.6749518109,
"autogenerated": false,
"ra... |
""" Bring-Your-Own-Attention Network
A flexible network w/ dataclass based config for stacking NN blocks including
self-attention (or similar) layers.
Currently used to implement experimential variants of:
* Bottleneck Transformers
* Lambda ResNets
* HaloNets
Consider all of the models definitions here as expe... | {
"repo_name": "rwightman/pytorch-image-models",
"path": "timm/models/byoanet.py",
"copies": "1",
"size": "16509",
"license": "apache-2.0",
"hash": -5822499515122276000,
"line_mean": 36.7780320366,
"line_max": 117,
"alpha_frac": 0.5839239203,
"autogenerated": false,
"ratio": 2.7519586597766295,
... |
""" Bring-Your-Own-Blocks Network
A flexible network w/ dataclass based config for stacking those NN blocks.
This model is currently used to implement the following networks:
GPU Efficient (ResNets) - gernet_l/m/s (original versions called genet, but this was already used (by SENet author)).
Paper: `Neural Architect... | {
"repo_name": "rwightman/pytorch-image-models",
"path": "timm/models/byobnet.py",
"copies": "1",
"size": "47127",
"license": "apache-2.0",
"hash": 94196383547299800,
"line_mean": 39.7673010381,
"line_max": 127,
"alpha_frac": 0.6151463068,
"autogenerated": false,
"ratio": 3.0923228346456693,
"co... |
""" brining
Provides inplace augmentation of python classes with automated
Python to Json, and Json to Python object mapping via
either class decorator or inherited mixin class. This also supports
nested augmented or 'brined' objects
Optional hinting is also provided via a Python class name hint s... | {
"repo_name": "SmithSamuelM/brine",
"path": "brining/__init__.py",
"copies": "1",
"size": "15402",
"license": "mit",
"hash": 8186576258371147000,
"line_mean": 30.6262833676,
"line_max": 94,
"alpha_frac": 0.5968056097,
"autogenerated": false,
"ratio": 4.336148648648648,
"config_test": false,
"... |
BR_LAYER_SRID = 4326
APP_SRID = 3857
from django.core.management import setup_environ
import os
import sys
sys.path.append(os.path.realpath(os.path.join(os.path.dirname(__file__), '..', 'locus')))
import settings
setup_environ(settings)
from django.contrib.gis.utils import LayerMapping
from fbapp.model... | {
"repo_name": "Ecotrust/locus",
"path": "scripts/map_thiessen.py",
"copies": "1",
"size": "1819",
"license": "bsd-3-clause",
"hash": 4921747329752234000,
"line_mean": 29.9473684211,
"line_max": 129,
"alpha_frac": 0.6728971963,
"autogenerated": false,
"ratio": 3.2137809187279154,
"config_test": ... |
"""Broadcast operators"""
from __future__ import absolute_import as _abs
from .import cpp as _cpp
def broadcast_to(data, shape):
"""Broadcast the src to the target shape
We follows the numpy broadcasting rule.
See also https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
Parameters
----... | {
"repo_name": "mlperf/training_results_v0.6",
"path": "Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/topi/python/topi/broadcast.py",
"copies": "1",
"size": "6791",
"license": "apache-2.0",
"hash": -7021690956762640000,
"line_mean": 19.7675840979,
"line_max": 75,
"alpha_frac": 0.5819466... |
# BROJA_2PID.py -- Python module
#
# BROJA_2PID: Bertschinger-Rauh-Olbrich-Jost-Ay (BROJA) bivariate Partial Information Decomposition
# https://github.com/Abzinger/BROJA_2PID
# (c) Abdullah Makkeh, Dirk Oliver Theis
# Permission to use and modify with proper attribution
# (Apache License version 2.0)
#
# Information a... | {
"repo_name": "Abzinger/BROJA_2PID",
"path": "BROJA_2PID.py",
"copies": "1",
"size": "21372",
"license": "apache-2.0",
"hash": 4615989289801758000,
"line_mean": 33.854812398,
"line_max": 209,
"alpha_frac": 0.4563324909,
"autogenerated": false,
"ratio": 3.215833835039133,
"config_test": false,
... |
# Broken: http://menu-mtv-quadhangout.blogspot.com/feeds/posts/default
"""Universal feed parser
Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds
Visit https://code.google.com/p/feedparser/ for the latest version
Visit http://packages.python.org/feedparser/ for the latest documentation
Required:... | {
"repo_name": "huihoo/reader",
"path": "utils/feedparser.py",
"copies": "1",
"size": "165760",
"license": "mit",
"hash": 2726459881200569300,
"line_mean": 40.5441102757,
"line_max": 302,
"alpha_frac": 0.5665299228,
"autogenerated": false,
"ratio": 3.7178423236514524,
"config_test": false,
"ha... |
# broken
def persistence():
starter = 1 # starter number
pers = 1 # starter persistence
dico = {} # let's keep track of some
while (pers < 3):
pers = 0
digits = map(int, str(starter))
# we know for 1 -> 9
if len(digits) == 1:
dico[starter] = p... | {
"repo_name": "julio73/scratchbook",
"path": "code/persistence/persistence.py",
"copies": "1",
"size": "1562",
"license": "mit",
"hash": 612512310372663400,
"line_mean": 26.9107142857,
"line_max": 57,
"alpha_frac": 0.4020486556,
"autogenerated": false,
"ratio": 4.387640449438202,
"config_test":... |
"""Broker Orchestration
The Broker is responsible for:
* Coordinating runs
* Ensuring run transitions
* Providing a rudimentary public API for use by the CLI/Web code
Complete name of environment variables available in a test container:
- BROKER_ID
Unique ID of the broker running this test.
- BROKER_VERSION
... | {
"repo_name": "loads/loads-broker",
"path": "loadsbroker/broker.py",
"copies": "1",
"size": "18076",
"license": "apache-2.0",
"hash": -6334289731994496000,
"line_mean": 32.0457038391,
"line_max": 79,
"alpha_frac": 0.5789444567,
"autogenerated": false,
"ratio": 4.1203555960793254,
"config_test":... |
BROKER_URL = 'amqp://guest:guest@localhost:5672/'
CELERY_RESULT_BACKEND = 'amqp'
CELERY_TASK_SERIALIZER='json'
CELERY_RESULT_SERIALIZER='json'
CELERY_TASK_RESULT_EXPIRES=900 # 15 min
from celery.schedules import crontab
from datetime import timedelta
CELERYBEAT_SCHEDULE = {
# 252 times a day
'every-5-minutes'... | {
"repo_name": "leibowitz/perfmonitor",
"path": "bin/celeryconfig.py",
"copies": "1",
"size": "1548",
"license": "mit",
"hash": 9129039002553988000,
"line_mean": 25.2372881356,
"line_max": 49,
"alpha_frac": 0.5426356589,
"autogenerated": false,
"ratio": 3.4708520179372195,
"config_test": false,
... |
#BROKER_URL = 'amqp://guest:guest@localhost:5672//'
#CELERY_ALWAYS_EAGER = True
CELERY_RESULT_BACKEND = 'amqp'
CELERY_RESULT_PERSISTENT = False
CELERY_TASK_RESULT_EXPIRES = 10
CELERY_DISABLE_RATE_LIMITS = True
CELERY_SEND_TASK_ERROR_EMAILS = True
CELERY_ACKS_LATE = True
CELERYD_PREFETCH_MULTIPLIER = 1 # limit numbe... | {
"repo_name": "unicefuganda/ureport",
"path": "ureport_project/celeryconfig.py",
"copies": "1",
"size": "3912",
"license": "bsd-3-clause",
"hash": 6739010889177300000,
"line_mean": 27.5547445255,
"line_max": 77,
"alpha_frac": 0.601993865,
"autogenerated": false,
"ratio": 3.219753086419753,
"con... |
BROKER_URL = 'amqp://guest:guest@localhost//'
CELERY_ACCEPT_CONTENT = ['json', 'pickle', ]
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangopr... | {
"repo_name": "todrobbins/lmgtdfy",
"path": "opendata/settings_example.py",
"copies": "2",
"size": "2440",
"license": "mit",
"hash": 3830081048660179000,
"line_mean": 22.0188679245,
"line_max": 71,
"alpha_frac": 0.7053278689,
"autogenerated": false,
"ratio": 3.236074270557029,
"config_test": fa... |
"""bromance
Usage: bromance.py <command>
Options:
-h --help Show this screen.
--version Show version.
"""
import sys
import requests
from docopt import docopt
from colorama import init, Style
# Reset color output after each print statement
init(autoreset=True)
# Retrieve entries from the following webs... | {
"repo_name": "mre/bromance",
"path": "bromance.py",
"copies": "1",
"size": "2509",
"license": "mit",
"hash": 6927555489455968000,
"line_mean": 21.4017857143,
"line_max": 74,
"alpha_frac": 0.640892786,
"autogenerated": false,
"ratio": 3.4136054421768707,
"config_test": false,
"has_no_keywords... |
#Brought to you by Jeremy Rubin, 2013
from App import *
from BaseHandler import BaseHandler
class Password(object):
def __init__(self, password, user=None, salt=str(os.urandom(32).encode('hex'))):
self.password = password
self.salt = salt
self.hashed = hashlib.sha512(password+salt).hexdigest()
self.passdict = ... | {
"repo_name": "JeremyRubin/tornado-trails",
"path": "handlers/User.py",
"copies": "1",
"size": "2187",
"license": "mit",
"hash": 6883593444578532000,
"line_mean": 30.7101449275,
"line_max": 81,
"alpha_frac": 0.70781893,
"autogenerated": false,
"ratio": 3.128755364806867,
"config_test": false,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.