text stringlengths 0 1.05M | meta dict |
|---|---|
""" Auxiliary Module
----------------
Auxiliary model used across modules. Contain metrics and computations which
may be used by any method.
Not directly callable.
"""
from math import exp, sqrt, log
from sys import float_info
from numpy import zeros, nan, isnan
from numpy.linalg import norm
from s... | {
"repo_name": "lucianamaroun/review_recommendation",
"path": "util/aux.py",
"copies": "1",
"size": "4899",
"license": "mit",
"hash": 851794558079290600,
"line_mean": 29.8113207547,
"line_max": 82,
"alpha_frac": 0.6582976118,
"autogenerated": false,
"ratio": 3.628888888888889,
"config_test": fal... |
# Auxiliary script for running git-persistence on a full repository.
# This is highly customized and it is meant to used as a demo example for uses of git_persistence.py
# The script utilizes also git fame for comparisons. If you want to avoid having to use git fame either remove it
# from the code below or store_ea... | {
"repo_name": "git-persistence/git-persistence",
"path": "examples/run_git_persistence.py",
"copies": "1",
"size": "9550",
"license": "mit",
"hash": -3952937734199923000,
"line_mean": 40.2566371681,
"line_max": 118,
"alpha_frac": 0.550052356,
"autogenerated": false,
"ratio": 4.050042408821035,
... |
"""Auxiliary stuff for task4 which needs accelerating.
This is pure Python version. Cython version is in task4_aux_c.pyx
"""
def smoothing(rho, u, e, q):
"""Smoothing for 2nd order methods."""
grid_size = len(rho)
rho_smooth = rho.copy()
u_smooth = u.copy()
e_smooth = e.copy()
def get_D_p(f, ... | {
"repo_name": "yl3dy/vmetf",
"path": "task4_aux_simple.py",
"copies": "1",
"size": "1046",
"license": "mit",
"hash": -8454792968318320000,
"line_mean": 25.8205128205,
"line_max": 65,
"alpha_frac": 0.4569789675,
"autogenerated": false,
"ratio": 2.4904761904761905,
"config_test": false,
"has_no... |
"""Auxiliary variable classes for storing solutions at points and
along lines to mimic gauges in lab and field experiments.
.. inheritance-diagram:: proteus.Gauges
:parts: 1
"""
from __future__ import print_function
from __future__ import division
from builtins import zip
from builtins import str
from builtins imp... | {
"repo_name": "erdc/proteus",
"path": "proteus/Gauges.py",
"copies": "1",
"size": "34920",
"license": "mit",
"hash": 6289698728600229000,
"line_mean": 43.9420849421,
"line_max": 136,
"alpha_frac": 0.6044100802,
"autogenerated": false,
"ratio": 4.20469596628537,
"config_test": false,
"has_no_k... |
# Auxiliary variables/constants for payload generation.
import base64;
INITIAL_VALUE = 0;
count = INITIAL_VALUE;
user = str('admin');
passfile_path = 'C:\\Users\\user\\Documents\\wordlists\\passwords.txt';
NUMBER_OF_PAYLOADS = sum(1 for line in open(passfile_path));
passwd = list();
for line in open(passfile_path): ... | {
"repo_name": "DarkLighting/OWASP-ZAP-Scripts",
"path": "payloadgenerator/bruteforce.py",
"copies": "1",
"size": "1687",
"license": "mit",
"hash": -8738632653297518000,
"line_mean": 29.125,
"line_max": 79,
"alpha_frac": 0.7042086544,
"autogenerated": false,
"ratio": 3.6594360086767894,
"config_... |
"""Auxiliary widgets for my PyQt apps."""
from __future__ import print_function, division, absolute_import
import logging
from subprocess import call
from pipes import quote
try:
# from PyQt5 import QtCore
from PyQt5.QtWidgets import QWidget, QPushButton
from PyQt5.QtWidgets import QVBoxLayout
except Imp... | {
"repo_name": "andalexo/bgv",
"path": "bgvLauncher/launchers.py",
"copies": "1",
"size": "4752",
"license": "mit",
"hash": 8752241708436413000,
"line_mean": 31.1081081081,
"line_max": 79,
"alpha_frac": 0.6081649832,
"autogenerated": false,
"ratio": 3.594553706505295,
"config_test": false,
"ha... |
"""Auxiliary widgets for my PyQt apps."""
from __future__ import print_function, division, absolute_import
import logging
import sys
from os import name
from os.path import dirname, split, isfile, abspath
from functools import partial
from math import cos, sin, pi
from webbrowser import open_new
try:
from PyQt5... | {
"repo_name": "andalexo/pyqttoolbox",
"path": "auxwidgets.py",
"copies": "1",
"size": "23082",
"license": "mit",
"hash": 4921062101982219000,
"line_mean": 30.9695290859,
"line_max": 79,
"alpha_frac": 0.5756433585,
"autogenerated": false,
"ratio": 3.858575727181545,
"config_test": false,
"has_... |
"""auxlib module provides several useful low-level functions as number thresholding or a couple of linear algebra
operations"""
import numpy as np
_epsilon = 0.0001
def to_colour_1(x):
"""Convert number to float in range [0,1]
Parameters
----------
x : convertible to float
num... | {
"repo_name": "grfrederic/deconvolution",
"path": "deconvolution/auxlib.py",
"copies": "1",
"size": "6427",
"license": "bsd-3-clause",
"hash": 1185617610713673200,
"line_mean": 22.4372623574,
"line_max": 116,
"alpha_frac": 0.4957211763,
"autogenerated": false,
"ratio": 3.5158643326039387,
"conf... |
# A VAB parser based on pyole
from pyole import *
class VBABase(OLEBase):
def _decompress(self, data):
CompressedCurrent = 0
DecompressedCurrent = 0
CompressedRecordEnd = len(data)
DecompressedBuffer = ''
SignatureByte = ord(data[CompressedCurrent])
if Signature... | {
"repo_name": "z3r0zh0u/pyole",
"path": "pyvba.py",
"copies": "1",
"size": "54849",
"license": "mit",
"hash": 1512092323431377200,
"line_mean": 35.9858395145,
"line_max": 144,
"alpha_frac": 0.6180057977,
"autogenerated": false,
"ratio": 3.6883195481137787,
"config_test": false,
"has_no_keywor... |
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
display_menu = ", ".join(sundaes)
menu = "Our available flavors are: {}.".format(display_menu)
print (menu)
#-------------------------------------------------------------------------
name = "Ben"
if name is "Ben":
... | {
"repo_name": "BIMobject-Ben/test",
"path": "play_ground_1.py",
"copies": "1",
"size": "2097",
"license": "bsd-3-clause",
"hash": 5551012559997026000,
"line_mean": 20.8541666667,
"line_max": 87,
"alpha_frac": 0.4182164998,
"autogenerated": false,
"ratio": 3.994285714285714,
"config_test": false... |
available_c = ['0.05','0.01']
row_size = 1001
table_size = row_size*row_size
from array import array as pyarray
import os
class InvalidCError(Exception):
"""Exception about invalid C.
e.g.:
raise InvalidCError(0.6)
"""
def __init__ (self, c):
self.c = str(c)
def __str__ (sel... | {
"repo_name": "daler/MACS",
"path": "MACS2/data/__init__.py",
"copies": "2",
"size": "1026",
"license": "bsd-3-clause",
"hash": 1749428957420746800,
"line_mean": 24.0243902439,
"line_max": 111,
"alpha_frac": 0.5487329435,
"autogenerated": false,
"ratio": 3.176470588235294,
"config_test": false,... |
"""Available commands for the Notebook program are stored in this file"""
import os
import time
LINE_LIMIT = 75
def has_cmd(notebook, arg):
"""
Checks if a word exists in the currently loaded notebook.
"""
if arg:
print notebook.suffix_tree.has_word(arg.lower())
else:
print 'Ar... | {
"repo_name": "MichaelAquilina/Notebook",
"path": "src/commands.py",
"copies": "1",
"size": "3919",
"license": "mit",
"hash": -5739518129037095000,
"line_mean": 29.3875968992,
"line_max": 102,
"alpha_frac": 0.5363613167,
"autogenerated": false,
"ratio": 4.388577827547592,
"config_test": false,
... |
# Available constants:
# They are to assign a type to a field with a value null.
# sdc.NULL_BOOLEAN, sdc.NULL_CHAR, sdc.NULL_BYTE, sdc.NULL_SHORT, sdc.NULL_INTEGER, sdc.NULL_LONG,
# sdc.NULL_FLOAT, sdc.NULL_DOUBLE, sdc.NULL_DATE, sdc.NULL_DATETIME, sdc.NULL_TIME, sdc.NULL_DECIMAL,
# sdc.NULL_BYTE_ARRAY, sdc.NU... | {
"repo_name": "streamsets/datacollector",
"path": "jython-protolib/src/main/resources/com/streamsets/pipeline/stage/processor/jython/default_script.py",
"copies": "2",
"size": "4392",
"license": "apache-2.0",
"hash": -5884618072622286000,
"line_mean": 36.8620689655,
"line_max": 141,
"alpha_frac": 0.6... |
'''Available modules in this package.
Modules are designed to be standard ways of isolating self-contained
pieces of code. This is different from the libraries present within
the ``lib`` folder. These are supposed to be used by all the other
modules.
Modules are executed automatically when the main program is exe... | {
"repo_name": "sankhaMukherjee/myCutter",
"path": "{{cookiecutter.project}}/src/modules/__init__.py",
"copies": "1",
"size": "1507",
"license": "mit",
"hash": -4800635221442058000,
"line_mean": 32.4888888889,
"line_max": 76,
"alpha_frac": 0.7285998673,
"autogenerated": false,
"ratio": 4.197771587... |
AVAILABLE_OPTIONS = [
# ('doc_m2m_threshold', 'Probability threshold for showing document to mass2motif links'),
('log_peakset_intensities', 'Whether or not to log the peakset intensities (true,false)'),
('peakset_matching_tolerance', 'Tolerance to use when... | {
"repo_name": "sdrogers/ms2ldaviz",
"path": "ms2ldaviz/basicviz/constants.py",
"copies": "1",
"size": "2070",
"license": "mit",
"hash": -6389801228127899000,
"line_mean": 47.1395348837,
"line_max": 297,
"alpha_frac": 0.6222222222,
"autogenerated": false,
"ratio": 3.2142857142857144,
"config_tes... |
"""Available protocols the project can handle"""
import enum
import fnmatch
import re
import os
import github
class URIException(Exception):
pass
class Repo:
def __init__(self, name, url):
self.name = name
self.url = url
class Base:
"""Base protocol"""
def __init__(self, **kwargs)... | {
"repo_name": "Mariocj89/gitorg",
"path": "gitorg/protocols.py",
"copies": "1",
"size": "2523",
"license": "mit",
"hash": -4896928550832510000,
"line_mean": 28.3372093023,
"line_max": 88,
"alpha_frac": 0.5727308759,
"autogenerated": false,
"ratio": 3.851908396946565,
"config_test": false,
"ha... |
"""Available slide building classes."""
import json
import os
from docutils import nodes
from sphinx.theming import Theme
from sphinx.builders.html import (
SingleFileHTMLBuilder,
StandaloneHTMLBuilder,
DirectoryHTMLBuilder,
)
from sphinx.util import copy_static_entry
from hieroglyph import writer
from h... | {
"repo_name": "attakei/hieroglyph",
"path": "src/hieroglyph/builder.py",
"copies": "1",
"size": "8043",
"license": "bsd-3-clause",
"hash": -1277479590649896200,
"line_mean": 28.036101083,
"line_max": 79,
"alpha_frac": 0.6291184881,
"autogenerated": false,
"ratio": 4.2645811240721105,
"config_te... |
"""Available slide building classes."""
import json
import os
from docutils import nodes
import sphinx
from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.builders.singlehtml import SingleFileHTMLBuilder
from sphinx.builders.dirhtml import DirectoryHTMLBuilder
from hieroglyph import writer
from hierog... | {
"repo_name": "nyergler/hieroglyph",
"path": "src/hieroglyph/builder.py",
"copies": "1",
"size": "8152",
"license": "bsd-3-clause",
"hash": -3950665716314751000,
"line_mean": 29.3048327138,
"line_max": 106,
"alpha_frac": 0.6469578018,
"autogenerated": false,
"ratio": 4.25914315569488,
"config_t... |
""" Available Transformations.
Mainly wrappers around PIL classes.
"""
import numpy as np
from PIL import Image, ImageFilter, ImageTransform
from termcolor import colored as clr
class Transformation(object):
""" Interface for Transformation objects.
"""
def __init__(self):
self.info = NotImpl... | {
"repo_name": "floringogianu/augment",
"path": "augment/transformations.py",
"copies": "1",
"size": "7004",
"license": "mit",
"hash": 7158803148813076000,
"line_mean": 30.1288888889,
"line_max": 79,
"alpha_frac": 0.5361222159,
"autogenerated": false,
"ratio": 3.335238095238095,
"config_test": f... |
# Available under MIT license. Check README.md for help.
# Dimitris Karagkasidis, https://github.com/pageflt
import gdb
import re
class memstr(gdb.Command):
"""Generate arbitrary strings out of ELF binary's contents"""
def __init__(self):
# Register new command with GDB
super(memstr, self).__... | {
"repo_name": "gatoni/gdb-memstr",
"path": "memstr.py",
"copies": "1",
"size": "3426",
"license": "mit",
"hash": -8733093132898514000,
"line_mean": 37.9318181818,
"line_max": 93,
"alpha_frac": 0.5052539405,
"autogenerated": false,
"ratio": 4.250620347394541,
"config_test": false,
"has_no_keyw... |
"""avalonline 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-... | {
"repo_name": "fako/avalonline",
"path": "avalonline/urls.py",
"copies": "1",
"size": "1037",
"license": "mit",
"hash": -3194997762274777000,
"line_mean": 34.7586206897,
"line_max": 91,
"alpha_frac": 0.6817743491,
"autogenerated": false,
"ratio": 3.261006289308176,
"config_test": false,
"has_... |
# AV analysis downloaded with vt public key have no first_seen
# We should use the last scan date to get an aproximation
import pathmagic
from db_pool import *
from MetaControl.MetaController import *
from pymongo.errors import WriteError
# Walk through a dictionary structure
def read_from_dictionary(source, dic):
... | {
"repo_name": "codexgigassys/codex-backend",
"path": "src/health/2017-01-17-1623-fix_dates_in_av.py",
"copies": "1",
"size": "2237",
"license": "mit",
"hash": 3316697898043393500,
"line_mean": 29.2297297297,
"line_max": 79,
"alpha_frac": 0.5471613768,
"autogenerated": false,
"ratio": 3.9733570159... |
"""avantiweb URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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-... | {
"repo_name": "pauljherrera/avantiweb",
"path": "avantiweb/urls.py",
"copies": "1",
"size": "1845",
"license": "mit",
"hash": -6358947465287335000,
"line_mean": 39.1086956522,
"line_max": 88,
"alpha_frac": 0.6921409214,
"autogenerated": false,
"ratio": 3.5894941634241246,
"config_test": false,
... |
'''avant_link: Python library to extract revenue data from AvantLink
'''
__version__ = '1.0'
__author__ = 'Siddharth Saha (sidchilling@gmail.com)'
import requests
import xml.etree.ElementTree as ET
class AvantLink(object):
BASE_URL = 'https://www.avantlink.com/api.php'
affiliate_id = ''
auth_key = ... | {
"repo_name": "sidchilling/avantlink-revenue-report",
"path": "avant_link/avant_link.py",
"copies": "1",
"size": "3086",
"license": "mit",
"hash": 3261707868135363000,
"line_mean": 35.3058823529,
"line_max": 91,
"alpha_frac": 0.6675307842,
"autogenerated": false,
"ratio": 2.881419234360411,
"co... |
# A variation of the "brute-force" solution using a map dispatching on types.
#
# Tested with Python 3.4
#
# Eli Bendersky [http://eli.thegreenplace.net]
# This code is in the public domain.
class Shape:
@property
def name(self):
return self.__class__
class Rectangle(Shape): pass
class Ellipse(Shape)... | {
"repo_name": "eliben/code-for-blog",
"path": "2016/multiple-dispatch/python/bruteforce_with_map.py",
"copies": "1",
"size": "1112",
"license": "unlicense",
"hash": 2362456420310083600,
"line_mean": 23.7111111111,
"line_max": 77,
"alpha_frac": 0.6492805755,
"autogenerated": false,
"ratio": 2.9340... |
""" A varied but not exhaustive set of the string type and string
formatting examples.
These examples only get into builtin and standard library
string formatting in Python.
With the inclusion of third party libraries you will have even more
templating options.
"""
# There is a string modul... | {
"repo_name": "jeremyosborne/python",
"path": "datatypes/strings.py",
"copies": "1",
"size": "4426",
"license": "mit",
"hash": -3439420334595946000,
"line_mean": 33.3100775194,
"line_max": 81,
"alpha_frac": 0.7087663805,
"autogenerated": false,
"ratio": 3.465935787000783,
"config_test": false,
... |
""" A variety of classes using different libraries to implement `get_json` and `post_json` methods.
"""
import os
import logging as log
# Try to import modules needed for Google App Engine just in case
try:
from google.appengine.api import urlfetch
from google.appengine.runtime import DeadlineExceededError
... | {
"repo_name": "hamx0r/stocktwits",
"path": "requestors.py",
"copies": "1",
"size": "3839",
"license": "mit",
"hash": -7111997576466892000,
"line_mean": 36.637254902,
"line_max": 118,
"alpha_frac": 0.5827038291,
"autogenerated": false,
"ratio": 4.036803364879074,
"config_test": false,
"has_no_... |
"""A variety of utilities to visualize the results from item response theory
training
"""
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
import mirt_util
from train_util import roc_curve_util
def show_roc(predictions):
"""Display an roc curve given a predictions and classi... | {
"repo_name": "bkimo/guacamole",
"path": "mirt/visualize.py",
"copies": "1",
"size": "2848",
"license": "mit",
"hash": 6714113516901773000,
"line_mean": 35.0506329114,
"line_max": 77,
"alpha_frac": 0.6555477528,
"autogenerated": false,
"ratio": 3.7180156657963446,
"config_test": false,
"has_n... |
"""A various settings that enable additional packages that are helpful in day to day development.
"""
import copy
import re
from . import base
INSTALLED_APPS = base.INSTALLED_APPS + (
# Provides a special toolbar which helps with tracking performance issues.
"debug_toolbar",
# Adds various commands like e... | {
"repo_name": "mathjazz/pontoon",
"path": "pontoon/settings/dev.py",
"copies": "3",
"size": "1435",
"license": "bsd-3-clause",
"hash": -5841331687564472000,
"line_mean": 28.8958333333,
"line_max": 97,
"alpha_frac": 0.6543554007,
"autogenerated": false,
"ratio": 4.111747851002866,
"config_test":... |
""" Avatar Message Service -- Taking in UserProfile, HighSchores, CurrentGame & CurrentPage"""
import sys
import random
import inspect
import pprint as pp
DEBUG = True
####################
# CONTEXT HANDLERS #
####################
# Pages
INDEX = "IndexPage"
CATEGORY = 'CategoryPage'
GAME = 'GamePage'
GAME_OVER = ... | {
"repo_name": "leifos/pagefetch",
"path": "pagefetch_project/pagefetch/game_avatar.py",
"copies": "1",
"size": "9970",
"license": "mit",
"hash": 4786573287860362000,
"line_mean": 23.6782178218,
"line_max": 108,
"alpha_frac": 0.5248746239,
"autogenerated": false,
"ratio": 4.650186567164179,
"con... |
# avatar.py
from sanpera import geometry
from libweasyl import ratings
from weasyl.error import WeasylError
from weasyl import define as d
from weasyl import image, media, orm
def avatar_source(userid):
media_items = media.get_user_media(userid)
if media_items.get('avatar-source'):
return media_ite... | {
"repo_name": "dzamie/weasyl",
"path": "weasyl/avatar.py",
"copies": "1",
"size": "1725",
"license": "apache-2.0",
"hash": 4984179630912062000,
"line_mean": 33.5,
"line_max": 84,
"alpha_frac": 0.6753623188,
"autogenerated": false,
"ratio": 3.0913978494623655,
"config_test": false,
"has_no_key... |
''' /av_conv.py '''
'''
Copyright (c) 2012, Max Garvey
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditio... | {
"repo_name": "maxgarvey/l_import",
"path": "word_conv.py",
"copies": "1",
"size": "2560",
"license": "bsd-2-clause",
"hash": -4108620988590260700,
"line_mean": 45.5454545455,
"line_max": 107,
"alpha_frac": 0.703125,
"autogenerated": false,
"ratio": 4.45993031358885,
"config_test": false,
"ha... |
# A vectorized Poisson module
from pysparse.sparse import spmatrix
import numpy
def poisson1d_vec(n):
L = spmatrix.ll_mat(n, n, 3*n-2)
e = numpy.ones(n)
d = numpy.arange(n, dtype=numpy.int)
L.put(2*e, d, d)
L.put(-e[1:], d[1:], d[:-1])
L.put(-e[1:], d[:-1], d[1:])
return L
def poisson1d_sy... | {
"repo_name": "rspeer/csc-pysparse",
"path": "pysparse/tools/poisson_vec.py",
"copies": "2",
"size": "2620",
"license": "bsd-2-clause",
"hash": 8809856740148888000,
"line_mean": 25.7346938776,
"line_max": 43,
"alpha_frac": 0.4935114504,
"autogenerated": false,
"ratio": 2.2469982847341337,
"conf... |
"""Average calculation views"""
from flask_restful import fields, marshal_with
import anthology.database as db
from anthology.resource import ParameterResource
from anthology.fields import ArbitaryFloat, Integer
AVERAGE_FIELDS = {
"average_difficulty": ArbitaryFloat(2),
"level": Integer(),
"algorithm": ... | {
"repo_name": "surfmikko/anthology",
"path": "anthology/songs/average.py",
"copies": "1",
"size": "1028",
"license": "mit",
"hash": 1010462330557166000,
"line_mean": 24.7,
"line_max": 61,
"alpha_frac": 0.6381322957,
"autogenerated": false,
"ratio": 3.969111969111969,
"config_test": false,
"ha... |
"""Average dew point by wind direction."""
import datetime
from collections import OrderedDict
from pandas.io.sql import read_sql
from metpy.units import units
import metpy.calc as mcalc
from pyiem.plot.use_agg import plt
from pyiem.util import get_autoplot_context, get_dbconn
from pyiem.exceptions import NoDataFound
... | {
"repo_name": "akrherz/iem",
"path": "htdocs/plotting/auto/scripts/p79.py",
"copies": "1",
"size": "4840",
"license": "mit",
"hash": 2501033130854075400,
"line_mean": 29.0621118012,
"line_max": 76,
"alpha_frac": 0.542768595,
"autogenerated": false,
"ratio": 3.4326241134751774,
"config_test": fa... |
# Average Draw Number Finder
# CS 257, Fall 2013, Jeff Ondich
# Erin Wilson, Jiatao Cheng, Adam Canady
# This program averages all of the past room draw numbers used to draw rooms
import csv
import math
#### Build list of available rooms ####
room_list_doc = open('roomlist.txt','r')
available_rooms = ... | {
"repo_name": "AdamCanady/CS257-Python-WebApp",
"path": "data_process/processdata.py",
"copies": "1",
"size": "2023",
"license": "mit",
"hash": 3091453159260229600,
"line_mean": 25.3648648649,
"line_max": 90,
"alpha_frac": 0.5936727632,
"autogenerated": false,
"ratio": 3.388609715242881,
"confi... |
#average feature vectors
import numpy as np
import gensim
from gensim import corpora, models, similarities # used for word2vec
from gensim.models.word2vec import Word2Vec # used for word2vec
import sys
from scipy import spatial # used for similarity calculation
class AverageVectorsUtilities(object):
@staticmethod... | {
"repo_name": "jimmycallin/master-thesis",
"path": "architectures/conll16st-hd-sdp/Word2Vec_AverageVectorsUtilities.py",
"copies": "1",
"size": "9270",
"license": "mit",
"hash": -9080172460072497000,
"line_mean": 41.5229357798,
"line_max": 161,
"alpha_frac": 0.6133764833,
"autogenerated": false,
... |
"""Average precision metric for ranking."""
import numpy as np
from matchzoo.engine import base_metric
from . import Precision
class AveragePrecision(base_metric.BaseMetric):
"""Average precision metric."""
ALIAS = ['average_precision', 'ap']
def __init__(self, threshold: float = 0.):
"""
... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/metrics/average_precision.py",
"copies": "1",
"size": "1409",
"license": "apache-2.0",
"hash": 6137457596645973000,
"line_mean": 30.3111111111,
"line_max": 74,
"alpha_frac": 0.5706174592,
"autogenerated": false,
"ratio": 3.9247910863509747,
... |
# Averages all images inside the current directory
# Dan Kolbman 2014
import os, numpy, PIL
from PIL import Image
# Access all PNG files in directory
imlist = [os.path.join(root, name)
for root, dirs, files in os.walk( os.getcwd(), followlinks=True )
for name in files
if name.en... | {
"repo_name": "dankolbman/CleverTind",
"path": "quick_avg.py",
"copies": "1",
"size": "1219",
"license": "mit",
"hash": -2841019923438102000,
"line_mean": 28.0238095238,
"line_max": 78,
"alpha_frac": 0.6579163249,
"autogenerated": false,
"ratio": 3.2248677248677247,
"config_test": false,
"has... |
""" Averages t-values per voxel across all subjects using simple linear regression
This function is used later for our final scripts
Run with:
python mean_across.py
"""
from __future__ import absolute_import, division, print_function
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), "..", "fu... | {
"repo_name": "berkeley-stat159/project-alpha",
"path": "code/utils/scripts/mean_across.py",
"copies": "1",
"size": "2758",
"license": "bsd-3-clause",
"hash": -1433664908186837500,
"line_mean": 32.2289156627,
"line_max": 116,
"alpha_frac": 0.6754894851,
"autogenerated": false,
"ratio": 2.88493723... |
"""Average T and precip"""
import datetime
import psycopg2.extras
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.colors as mpcolors
from pyiem import network
from pyiem.plot import get_cmap, figure
from pyiem.plot.use_agg import plt
from pyiem.util import get_autoplot_context, get_dbc... | {
"repo_name": "akrherz/iem",
"path": "htdocs/plotting/auto/scripts/p95.py",
"copies": "1",
"size": "7455",
"license": "mit",
"hash": -7554944277057887000,
"line_mean": 29.5532786885,
"line_max": 78,
"alpha_frac": 0.5323943662,
"autogenerated": false,
"ratio": 3.2611548556430447,
"config_test": ... |
'''Average values to make sure the statistics don't get to big'''
import numpy as np
import db_sql
from datetime import datetime, timedelta
def write_avg():
'''Calculate and write average values'''
db_sql.init()
sensors = ['temp_out', 'temp_in', 'humidity_out', 'humidity_in', 'wind_d',
'win... | {
"repo_name": "JB26/decode_ws2308",
"path": "weather_avg.py",
"copies": "1",
"size": "3087",
"license": "mit",
"hash": 7345036874992311000,
"line_mean": 43.1,
"line_max": 86,
"alpha_frac": 0.472303207,
"autogenerated": false,
"ratio": 3.9987046632124352,
"config_test": false,
"has_no_keywords... |
# Average versus median
# np_baseball is available
# Import numpy
import numpy as np
# Create np_height from np_baseball
np_height = np.array(np_baseball[:, 0])
# Print out the mean of np_height
print(np.mean(np_height))
# Print out the median of np_height
print(np.median(np_height))
# Explore the b... | {
"repo_name": "iordan93/MS-Data-Science",
"path": "5.2. Introduction to Python for Data Science/Lab 4.3/Basic statistics with NumPy.py",
"copies": "1",
"size": "1644",
"license": "mit",
"hash": 7552427029690998000,
"line_mean": 26.3793103448,
"line_max": 73,
"alpha_frac": 0.7001216545,
"autogenerat... |
# A versioning object representation of the sweep. This will include
# methods for handling the required actions which may be performed
# on a sweep, and will also include integration with the rest of the
# .xinfo hierarchy.
#
# The following properties defined elsewhere impact in the definition
# of the sweep:
#
# la... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Schema/XSweep.py",
"copies": "1",
"size": "33190",
"license": "bsd-3-clause",
"hash": -5534430727907906000,
"line_mean": 35.7960088692,
"line_max": 88,
"alpha_frac": 0.573877674,
"autogenerated": false,
"ratio": 4.109707776126795,
"config_test": fals... |
# A versioning object representing the wavelength level in the .xinfo
# hierarchy. This will include all of the methods for performing operations
# on a wavelength as well as stuff for integration with the rest of the
# .xinfo hierarchy.
#
# The following are properties defined for an XWavelength object:
#
# wavelength... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Schema/XWavelength.py",
"copies": "1",
"size": "7000",
"license": "bsd-3-clause",
"hash": 4235317831326747000,
"line_mean": 28.2887029289,
"line_max": 84,
"alpha_frac": 0.5588571429,
"autogenerated": false,
"ratio": 3.8845726970033296,
"config_test":... |
#a version of ancestral sequence reconstruction where all we care about is F(IVYWREL), so alignment is recoded as 0s (non-IVYWREL) and 1s (IVYWREL). And we try to infer that on every branch of the tree and at the root...
import sys
#var.verboseRead = 1
var.warnReadNoFile = 0
var.nexus_allowAllDigitNames = True # put... | {
"repo_name": "Tancata/phylo",
"path": "ancestral/5comp_binary_Pickle.py",
"copies": "1",
"size": "1952",
"license": "mit",
"hash": 6872997095496758000,
"line_mean": 27.7058823529,
"line_max": 220,
"alpha_frac": 0.6849385246,
"autogenerated": false,
"ratio": 2.4369538077403248,
"config_test": f... |
"""A version of BAX pore assembly where subunits are added to the growing
complex one at a time (contrast with bax_pore.py). Also implements cargo
transport (Smac).
"""
from __future__ import print_function
from pysb import *
from pysb.macros import assemble_pore_sequential, pore_transport, pore_species
Model()
# s1... | {
"repo_name": "pysb/pysb",
"path": "pysb/examples/bax_pore_sequential.py",
"copies": "5",
"size": "2205",
"license": "bsd-2-clause",
"hash": -2743524740059815000,
"line_mean": 36.3728813559,
"line_max": 80,
"alpha_frac": 0.6888888889,
"autogenerated": false,
"ratio": 2.79467680608365,
"config_t... |
"""A version of BAX pore assembly where subunits are added to the growing
complex one at a time (contrast with bax_pore.py). Also implements cargo
transport (Smac).
"""
from pysb import *
from pysb.macros import assemble_pore_sequential, pore_transport, pore_species
Model()
# s1,s2 are ring-formation sites; t is the... | {
"repo_name": "spgarbet/pysb",
"path": "pysb/examples/bax_pore_sequential.py",
"copies": "4",
"size": "2203",
"license": "bsd-2-clause",
"hash": -4112067691497168400,
"line_mean": 37.649122807,
"line_max": 85,
"alpha_frac": 0.6777122106,
"autogenerated": false,
"ratio": 2.7850821744627052,
"con... |
"""A version of BAX pore assembly where the subunits dimerize and then
tetramerize instead of assembling sequentially (contrast with
bax_pore_sequential.py). Inhibition of pore formation by Mcl-1 is also
implemented.
"""
from __future__ import print_function
from pysb import *
Model()
# Each BAX-BAX bond must always... | {
"repo_name": "alubbock/pysb",
"path": "pysb/examples/bax_pore.py",
"copies": "5",
"size": "2560",
"license": "bsd-2-clause",
"hash": 3363878893036103700,
"line_mean": 36.1014492754,
"line_max": 102,
"alpha_frac": 0.6828125,
"autogenerated": false,
"ratio": 2.417374881964117,
"config_test": fal... |
# A version of the ActiveScripting engine that enables rexec support
# This version supports hosting by IE - however, due to Python's
# rexec module being neither completely trusted nor private, it is
# *not* enabled by default.
# As of Python 2.2, rexec is simply not available - thus, if you use this,
# a HTML page ca... | {
"repo_name": "SublimeText/Pywin32",
"path": "lib/x32/win32comext/axscript/client/pyscript_rexec.py",
"copies": "11",
"size": "1986",
"license": "bsd-3-clause",
"hash": 873115575388935200,
"line_mean": 45.1860465116,
"line_max": 148,
"alpha_frac": 0.7482376636,
"autogenerated": false,
"ratio": 3.... |
'''A version of the testbench.py file that produces plots for
the LRI automata'''
# Written by: Steven Porretta
import learning_automata as la
import numpy as np
import matplotlib.pyplot as plt
import argparse
c1 = 0.05
lambda_r = []
n = []
for i in range(0, 7):
lri = la.Linear(c1, 0.7)
a = lri.find_optim... | {
"repo_name": "0xSteve/learning_automata_simulator",
"path": "LRI_plot.py",
"copies": "1",
"size": "1124",
"license": "mit",
"hash": -7546972045715266000,
"line_mean": 29.3783783784,
"line_max": 77,
"alpha_frac": 0.5658362989,
"autogenerated": false,
"ratio": 3.0543478260869565,
"config_test": ... |
# A version of the towers of hanoi using a single integer to represent the state
# of the three stacks.
# Example : hanoi(4)
# Initial state : 1000000004321
# Final state : 1432100000000
def hanoi(size):
stacks = prepare(size)
print(stacks)
stacks = move_stack(size, size, stacks, 0, 1, 2)
def mo... | {
"repo_name": "GillesArcas/numsed",
"path": "examples/hanoi.py",
"copies": "2",
"size": "1281",
"license": "mit",
"hash": 7023509737282569000,
"line_mean": 25.1428571429,
"line_max": 118,
"alpha_frac": 0.5831381733,
"autogenerated": false,
"ratio": 3.124390243902439,
"config_test": false,
"ha... |
# a version rnnlm.py using the transduce() interface.
from dynet import *
import time
import random
LAYERS = 2
INPUT_DIM = 50 #256
HIDDEN_DIM = 50 #1024
VOCAB_SIZE = 0
from collections import defaultdict
from itertools import count, izip
import sys
import util
class RNNLanguageModel:
def __init__(self, model, ... | {
"repo_name": "cherryc/dynet",
"path": "examples/python/rnnlm_transduce.py",
"copies": "3",
"size": "3420",
"license": "apache-2.0",
"hash": 1543068684578709000,
"line_mean": 31.5714285714,
"line_max": 102,
"alpha_frac": 0.5467836257,
"autogenerated": false,
"ratio": 3.437185929648241,
"config_... |
# a version rnnlm.py using the transduce() interface.
from dynet import *
import time
import random
LAYERS = 2
INPUT_DIM = 50 #256
HIDDEN_DIM = 50 #1024
VOCAB_SIZE = 0
import argparse
import sys
import util
try:
from itertools import izip as zip
except ImportError:
pass
class RNNLanguageModel:
def __in... | {
"repo_name": "Peilun-Li/dynet",
"path": "examples/python/rnnlm_transduce.py",
"copies": "2",
"size": "3576",
"license": "apache-2.0",
"hash": -3614702668460737500,
"line_mean": 30.9285714286,
"line_max": 102,
"alpha_frac": 0.5508948546,
"autogenerated": false,
"ratio": 3.4617618586640853,
"con... |
# a version rnnlm.py using the transduce() interface.
from pycnn import *
import time
import random
LAYERS = 2
INPUT_DIM = 50 #256
HIDDEN_DIM = 50 #1024
VOCAB_SIZE = 0
from collections import defaultdict
from itertools import count, izip
import sys
import util
class RNNLanguageModel:
def __init__(self, model, ... | {
"repo_name": "duncanka/lstm-parser",
"path": "cnn/pyexamples/rnnlm_transduce.py",
"copies": "3",
"size": "3417",
"license": "apache-2.0",
"hash": 3671359881186981000,
"line_mean": 31.2358490566,
"line_max": 101,
"alpha_frac": 0.5396546678,
"autogenerated": false,
"ratio": 3.4515151515151516,
"... |
# a version rnnlm.py using the transduce() interface.
import dynet as dy
import time
import random
LAYERS = 2
INPUT_DIM = 50 #256
HIDDEN_DIM = 50 #1024
VOCAB_SIZE = 0
import argparse
import sys
import util
try:
from itertools import izip as zip
except ImportError:
pass
class RNNLanguageModel:
def __ini... | {
"repo_name": "clab/dynet",
"path": "examples/rnnlm/rnnlm_transduce.py",
"copies": "5",
"size": "3338",
"license": "apache-2.0",
"hash": -745431410974378100,
"line_mean": 30.4905660377,
"line_max": 102,
"alpha_frac": 0.5530257639,
"autogenerated": false,
"ratio": 3.4843423799582465,
"config_tes... |
#A very basic first interpreter for campfire language https://github.com/barbuz/campfire/
import sys
import re
class Stack:
#A particular implementation of a stack, with implicit 0s at the bottom and a secondary stack to push popped values to
def __init__(self,other=None):
self.values=list()
s... | {
"repo_name": "barbuz/campfire",
"path": "campfire.py",
"copies": "1",
"size": "3377",
"license": "mit",
"hash": 4559615634431095000,
"line_mean": 32.77,
"line_max": 149,
"alpha_frac": 0.5803968019,
"autogenerated": false,
"ratio": 4.093333333333334,
"config_test": false,
"has_no_keywords": f... |
"""A very basic flipper game.
"""
__version__ = "$Id:$"
__docformat__ = "reStructuredText"
import random
import pygame
from pygame.locals import *
from pygame.color import *
import pymunk
from pymunk import Vec2d
def to_pygame(p):
"""Small hack to convert pymunk to pygame coordinates"""
return int(p.x), int... | {
"repo_name": "sneharavi12/DeepLearningFinals",
"path": "pymunk-pymunk-4.0.0/examples/flipper.py",
"copies": "5",
"size": "4743",
"license": "mit",
"hash": -5745308170984465000,
"line_mean": 30.62,
"line_max": 91,
"alpha_frac": 0.6082648113,
"autogenerated": false,
"ratio": 2.8215348007138608,
... |
"""A very basic flipper game.
"""
__version__ = "$Id:$"
__docformat__ = "reStructuredText"
import random
import pygame
import pymunk
import pymunk.pygame_util
from pymunk import Vec2d
pygame.init()
screen = pygame.display.set_mode((600, 600))
clock = pygame.time.Clock()
running = True
### Physics stuff
space = pym... | {
"repo_name": "viblo/pymunk",
"path": "examples/flipper.py",
"copies": "1",
"size": "4292",
"license": "mit",
"hash": 5956196084110442000,
"line_mean": 29.6571428571,
"line_max": 88,
"alpha_frac": 0.6342031687,
"autogenerated": false,
"ratio": 2.790637191157347,
"config_test": false,
"has_no_... |
"""A very basic flipper game.
"""
__version__ = "$Id:$"
__docformat__ = "reStructuredText"
import random
import pygame
from pygame.locals import *
from pygame.color import *
import pymunk
from pymunk import Vec2d
def to_pygame(p):
"""Small hack to convert pymunk to pygame coordinates"""
retu... | {
"repo_name": "cfobel/python___pymunk",
"path": "examples/flipper.py",
"copies": "1",
"size": "4891",
"license": "mit",
"hash": 7572232055433829000,
"line_mean": 30.6066666667,
"line_max": 91,
"alpha_frac": 0.5894500102,
"autogenerated": false,
"ratio": 2.840301974448316,
"config_test": false,
... |
"""A very basic toy runtime for XBlock tests."""
import logging
import json
from xblock.fields import Scope
from xblock.runtime import (
KvsFieldData, KeyValueStore, Runtime, MemoryIdManager
)
from xblock.test.tools import unabc
log = logging.getLogger(__name__)
class ToyRuntimeKeyValueStore(KeyValueStore):
... | {
"repo_name": "edx/XBlock",
"path": "xblock/test/toy_runtime.py",
"copies": "1",
"size": "4478",
"license": "apache-2.0",
"hash": -3291141672618730000,
"line_mean": 29.462585034,
"line_max": 91,
"alpha_frac": 0.609200536,
"autogenerated": false,
"ratio": 3.867012089810017,
"config_test": false,... |
"""A very basic toy runtime for XBlock tests."""
import logging
try:
import simplejson as json
except ImportError:
import json
from xblock.fields import Scope
from xblock.runtime import (
KvsFieldData, KeyValueStore, Runtime, MemoryIdManager
)
from xblock.test.tools import unabc
log = logging.getLogger(_... | {
"repo_name": "4eek/XBlock",
"path": "xblock/test/toy_runtime.py",
"copies": "7",
"size": "4622",
"license": "apache-2.0",
"hash": 7244702693164374000,
"line_mean": 29.6092715232,
"line_max": 107,
"alpha_frac": 0.6144526179,
"autogenerated": false,
"ratio": 3.87751677852349,
"config_test": fals... |
"""A very basic toy runtime for XBlock tests."""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
try:
import simplejson as json
except ImportError:
import json
import six
from xblock.fields import Scope
from xblock.runtime import (
KvsFieldData, KeyValu... | {
"repo_name": "mitodl/XBlock",
"path": "xblock/test/toy_runtime.py",
"copies": "1",
"size": "4726",
"license": "apache-2.0",
"hash": -1257052093728114200,
"line_mean": 29.2948717949,
"line_max": 107,
"alpha_frac": 0.6182818451,
"autogenerated": false,
"ratio": 3.8769483182936835,
"config_test":... |
# A (very incomplete) urllib2-looking interface to pycurl
# by: Greg Hazel
import os
import sys
import pycurl
from cStringIO import StringIO
from BaseHTTPServer import BaseHTTPRequestHandler
from urllib import urlencode
DEBUG = False
global CA_PATH
CA_PATH = None
http_bindaddr = None
user_agent = None
_pycurl_compr... | {
"repo_name": "forkable/p2pScrapper",
"path": "BitTorrent-5.2.2/BTL/pycurllib.py",
"copies": "3",
"size": "4804",
"license": "mit",
"hash": -3492939664735403500,
"line_mean": 25.5414364641,
"line_max": 80,
"alpha_frac": 0.6101165695,
"autogenerated": false,
"ratio": 3.550628233555063,
"config_t... |
# a very minimal script for InMoov
# although this script is very short you can still
# do voice control of a right hand or finger box
# for any command which you say - you will be required to say a confirmation
# e.g. you say -> open hand, InMoov will ask -> "Did you say open hand?", you will need to
# respond with a ... | {
"repo_name": "MyRobotLab/pyrobotlab",
"path": "toSort/InMoov2.minimal.py",
"copies": "1",
"size": "1978",
"license": "apache-2.0",
"hash": -2826212471760832000,
"line_mean": 34.3214285714,
"line_max": 90,
"alpha_frac": 0.719413549,
"autogenerated": false,
"ratio": 2.720770288858322,
"config_te... |
"""A very silly example of using a scene editor. More complex examples are
available in mayavi. """
# Author: Prabhu Ramachandran <prabhu [at] aero.iitb.ac.in>
# Copyright (c) 2007, Enthought, Inc.
# License: BSD Style.
from traits.api import HasTraits, Enum, Instance, Any
from traitsui.api import View, Item
from t... | {
"repo_name": "liulion/mayavi",
"path": "examples/tvtk/scene_editor.py",
"copies": "5",
"size": "1964",
"license": "bsd-3-clause",
"hash": -6935599943226444000,
"line_mean": 29.6875,
"line_max": 75,
"alpha_frac": 0.5361507128,
"autogenerated": false,
"ratio": 3.8968253968253967,
"config_test": ... |
# a very simple (and silly) mechanism for getting the host_ip
import socket
from BTL.platform import bttime
from BTL.obsoletepythonsupport import set
from BTL.reactor_magic import reactor
from BTL import defer
import BTL.stackthreading as threading
from twisted.internet.protocol import ClientFactory, Protocol
from twi... | {
"repo_name": "rabimba/p2pScrapper",
"path": "BitTorrent-5.2.2/BTL/HostIP.py",
"copies": "6",
"size": "5728",
"license": "mit",
"hash": 6166933150280997000,
"line_mean": 24.9185520362,
"line_max": 80,
"alpha_frac": 0.6033519553,
"autogenerated": false,
"ratio": 3.648407643312102,
"config_test":... |
# a very simple blackjack game
# in the game the cards have the following values ...
# ace 11 or 1
# J, Q, K are 10
# the rest of the cards 2 - 10 are face value
# you start with two cards and add them up
# if you have 21, then you have the best score, a blackjack
# if you have between 1... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/578586_Black_Jack/recipe-578586.py",
"copies": "1",
"size": "3112",
"license": "mit",
"hash": -5620568666380199000,
"line_mean": 30.4343434343,
"line_max": 81,
"alpha_frac": 0.6050771208,
"autogenerated": false,
"ratio": 3.5163841807909604... |
"""A *very* simple command-line accountant's calculator.
Uses the decimal package (introduced in Python 2.4) for calculation accuracy.
Input should be a number (decimal point is optional), an optional space, and an
operator (one of /, *, -, or +). A blank line will output the total.
Inputting just 'q' will output the... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/303176_Very_simple_accountants/recipe-303176.py",
"copies": "1",
"size": "1141",
"license": "mit",
"hash": -7887574400010026000,
"line_mean": 27.525,
"line_max": 79,
"alpha_frac": 0.6038562664,
"autogenerated": false,
"ratio": 3.5545171339... |
"""A very simple contextual bandit example with 3 arms."""
import argparse
import gym
from gym.spaces import Discrete, Box
import numpy as np
import random
import ray
from ray import tune
from ray.rllib.utils.test_utils import check_learning_achieved
parser = argparse.ArgumentParser()
parser.add_argument("--run", ty... | {
"repo_name": "richardliaw/ray",
"path": "rllib/contrib/bandits/examples/simple_context_bandit.py",
"copies": "3",
"size": "1755",
"license": "apache-2.0",
"hash": -1995690564056075300,
"line_mean": 28.25,
"line_max": 78,
"alpha_frac": 0.6205128205,
"autogenerated": false,
"ratio": 3.401162790697... |
"""A very simple engine that randomly suggests problems from exercise_ids"""
import random
from mirt import engine
class SimpleEngine(engine.Engine):
"""A very simple engine that always randomly chooses a question from all
possible questions.
"""
def __init__(self, model_data):
super(Simple... | {
"repo_name": "bkimo/guacamole",
"path": "mirt/simple_engine.py",
"copies": "1",
"size": "1919",
"license": "mit",
"hash": -7151649880137340000,
"line_mean": 31.5254237288,
"line_max": 77,
"alpha_frac": 0.6466909849,
"autogenerated": false,
"ratio": 4.312359550561798,
"config_test": false,
"h... |
# A very simple example of a coroutine/generator scheduler
# Two simple generator functions
def countdown(n):
while n > 0:
print("T-minus", n)
yield
n -= 1
print("Blastoff!")
def countup(n):
x = 0
while x < n:
print("Counting up", x)
yield
x += 1
from c... | {
"repo_name": "hyller/CodeLibrary",
"path": "python-cookbook-master/src/12/using_generators_as_an_alternative_to_threads/simple.py",
"copies": "5",
"size": "1121",
"license": "unlicense",
"hash": 1234611463325698600,
"line_mean": 21.8775510204,
"line_max": 58,
"alpha_frac": 0.548617306,
"autogenera... |
"""A very simple example plugin."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# exampleplugin
#
# Public Functions:
# on_review_created
# get_hooks
#
# -----------------------------------... | {
"repo_name": "valhallasw/phabricator-tools",
"path": "testbed/plugins/exampleplugin.py",
"copies": "1",
"size": "1398",
"license": "apache-2.0",
"hash": -4233677970616018400,
"line_mean": 35.7894736842,
"line_max": 79,
"alpha_frac": 0.4878397711,
"autogenerated": false,
"ratio": 5.13970588235294... |
""" A very simple FCFF NN intended to be used for comparing tensorflow to other
libraries. """
import tensorflow as tf
import numpy as np
class FeedforwardNetwork(object):
""" A simple, fully-connected feedforward neural network. """
def __init__(self, layers, outputs):
"""
Args:
layers: A list ... | {
"repo_name": "djpetti/rpinets",
"path": "tensorflow/simple_feedforward.py",
"copies": "1",
"size": "4670",
"license": "mit",
"hash": 4937305742914077000,
"line_mean": 36.0634920635,
"line_max": 80,
"alpha_frac": 0.6638115632,
"autogenerated": false,
"ratio": 4.078602620087336,
"config_test": f... |
# a very simple flask app for manually tagging the testing and training data
import flask
import json
import sys
import os
sys.path.append('.')
APP = flask.Flask(__name__)
from atnr import data
@APP.route("/")
def root():
return flask.render_template('root.jinja2')
@APP.route("/tail-character-locations/")
def... | {
"repo_name": "kevinjdolan/Automated-Tail-Number-Recognition",
"path": "atnr/tagging.py",
"copies": "1",
"size": "3554",
"license": "mit",
"hash": -1707901599323612400,
"line_mean": 29.3846153846,
"line_max": 82,
"alpha_frac": 0.6041080473,
"autogenerated": false,
"ratio": 3.953281423804227,
"c... |
# A very simple Flask Hello World app for you to get started with...
from flask import Flask, redirect, url_for, session, request, jsonify, render_template, flash
from flask_oauthlib.client import OAuth
from flask_sqlalchemy import SQLAlchemy
import os
import requests
import datetime
from bs4 import BeautifulSoup
# Y... | {
"repo_name": "joshua-taylor/blogapp",
"path": "App.py",
"copies": "1",
"size": "6900",
"license": "mit",
"hash": 4987777570792674000,
"line_mean": 27.9915966387,
"line_max": 175,
"alpha_frac": 0.655942029,
"autogenerated": false,
"ratio": 3.109508787742226,
"config_test": true,
"has_no_keywo... |
"""A very simple implementation of a caching geocoder using the Google Maps
(community-supported) Web Services Geocoding API.
Input: 1. Pandas dataframe containing a column named 'address_string'
2. Google Maps API key. See https://goo.gl/XSBqid
Output: Geopandas geodataframe containing a geometry column, m... | {
"repo_name": "UnitedThruAction/Data",
"path": "Tools/CachingGeocoder.py",
"copies": "1",
"size": "2690",
"license": "apache-2.0",
"hash": 7115887478879316000,
"line_mean": 33.4871794872,
"line_max": 83,
"alpha_frac": 0.5795539033,
"autogenerated": false,
"ratio": 3.9327485380116958,
"config_te... |
""" A very simple LeNet implementation intended to be used for comparing
tensorflow to other libraries. """
import tensorflow as tf
from simple_feedforward import FeedforwardNetwork
class LeNetClassifier(FeedforwardNetwork):
""" A classifier built upon the Convolutional Neural Network as described by
Yan LeCun... | {
"repo_name": "djpetti/rpinets",
"path": "tensorflow/simple_lenet.py",
"copies": "1",
"size": "5947",
"license": "mit",
"hash": 8869086654876344000,
"line_mean": 40.5874125874,
"line_max": 82,
"alpha_frac": 0.6578106608,
"autogenerated": false,
"ratio": 3.899672131147541,
"config_test": false,
... |
"""A very simple MNIST classifer, modified to display data in TensorBoard.
See extensive documentation for the original model at
http://tensorflow.org/tutorials/mnist/beginners/index.md
See documentaion on the TensorBoard specific pieces at
http://tensorflow.org/how_tos/summaries_and_tensorboard/index.md
If you modi... | {
"repo_name": "NumesSanguis/MLTensor",
"path": "tutorial/mnist_with_summaries.py",
"copies": "1",
"size": "3329",
"license": "apache-2.0",
"hash": -2085473557388747800,
"line_mean": 35.1847826087,
"line_max": 78,
"alpha_frac": 0.6683688795,
"autogenerated": false,
"ratio": 3.329,
"config_test":... |
"""A very simple MNIST classifer.
See extensive documentation at ??????? (insert public URL)
"""
from __future__ import print_function
# Import data
import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
import tensorflow as tf
sess = tf.InteractiveSession()
# Create the model
x = tf.placeh... | {
"repo_name": "aksaxena80/test",
"path": "tensorflow/g3doc/tutorials/mnist/mnist_softmax.py",
"copies": "3",
"size": "1026",
"license": "apache-2.0",
"hash": -2363233780345772500,
"line_mean": 29.1764705882,
"line_max": 76,
"alpha_frac": 0.7037037037,
"autogenerated": false,
"ratio": 2.8820224719... |
"""A very simple MNIST classifer.
See extensive documentation at
http://tensorflow.org/tutorials/mnist/beginners/index.md
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Import data
import input_data
mnist = input_data.read_data_sets("/tmp/data/", one... | {
"repo_name": "brodyh/tensorflow",
"path": "tensorflow/g3doc/tutorials/mnist/mnist_softmax.py",
"copies": "5",
"size": "1126",
"license": "apache-2.0",
"hash": -799696937801406300,
"line_mean": 29.4324324324,
"line_max": 76,
"alpha_frac": 0.7175843694,
"autogenerated": false,
"ratio": 2.955380577... |
"""A very simple MNIST classifer.
See extensive documentation at
http://tensorflow.org/tutorials/mnist/beginners/index.md
"""
from __future__ import print_function
# Import data
import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
import tensorflow as tf
sess = tf.InteractiveSession()
# C... | {
"repo_name": "javierblasco/tensorflow",
"path": "tensorflow/g3doc/tutorials/mnist/mnist_softmax.py",
"copies": "2",
"size": "1055",
"license": "apache-2.0",
"hash": 5624015395005801000,
"line_mean": 29.1428571429,
"line_max": 76,
"alpha_frac": 0.7146919431,
"autogenerated": false,
"ratio": 2.890... |
"""A very simple MNIST classifier.
See extensive documentation at
http://tensorflow.org/tutorials/mnist/beginners/index.md
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Import data
from tensorflow.examples.tutorials.mnist import input_data
import t... | {
"repo_name": "obulpathi/docker",
"path": "tensorflow/code/mnist.py",
"copies": "1",
"size": "1423",
"license": "apache-2.0",
"hash": -4856665611191301000,
"line_mean": 30.6222222222,
"line_max": 119,
"alpha_frac": 0.72452565,
"autogenerated": false,
"ratio": 2.9957894736842103,
"config_test": ... |
# A very simple notetaking application that uses Python to load
# and save a string in a text file in the user's home directory.
import os
import threading
import time
import pyotherside
class Notes:
def __init__(self):
self.filename = os.path.expanduser('~/pyotherside_notes.txt')
self.thread = N... | {
"repo_name": "blueghost56/pyotherside",
"path": "examples/notes_example.py",
"copies": "2",
"size": "1136",
"license": "isc",
"hash": -4228353038228636700,
"line_mean": 26.7073170732,
"line_max": 69,
"alpha_frac": 0.6153169014,
"autogenerated": false,
"ratio": 3.7740863787375414,
"config_test"... |
"""A very simple parser for Windows Portable Executable (PE) files"""
from collections import OrderedDict
from ..io import FilePart
from ..util import *
DosHeader = Struct('DosHeader', [
('magic', Struct.STR % 2),
('...', 58),
('peHeaderOffset', Struct.INT32),
])
dosHeaderMagic = b'MZ'
PeHeader = Struct('PeHeade... | {
"repo_name": "ma1co/fwtool.py",
"path": "fwtool/pe/__init__.py",
"copies": "1",
"size": "1372",
"license": "mit",
"hash": 8081375953553329000,
"line_mean": 25.3846153846,
"line_max": 129,
"alpha_frac": 0.6873177843,
"autogenerated": false,
"ratio": 3.298076923076923,
"config_test": false,
"h... |
# A very simple progressbar module
# idea from:
# http://stackoverflow.com/questions/3002085/python-to-print-out-status-bar-and-percentage
import sys
def show_progress(progress, width=40):
"""
Displays the progressbar with the given percentage.
Make sure that no other output to stdout or stderr is done d... | {
"repo_name": "patflick/tsppi",
"path": "src/pappi/utils/progressbar.py",
"copies": "1",
"size": "1583",
"license": "mit",
"hash": -6035541906771607000,
"line_mean": 35.8139534884,
"line_max": 90,
"alpha_frac": 0.6437144662,
"autogenerated": false,
"ratio": 3.977386934673367,
"config_test": fal... |
# A very simple setup script to create 2 executables.
#
# hello.py is a simple "hello, world" type program, which alse allows
# to explore the environment in which the script runs.
#
# test_wx.py is a simple wxPython program, it will be converted into a
# console-less program.
#
# If you don't have wxPython installed, ... | {
"repo_name": "xran-deex/PyChat",
"path": "setup.py",
"copies": "1",
"size": "1849",
"license": "mit",
"hash": 5907606677441260000,
"line_mean": 32.0178571429,
"line_max": 309,
"alpha_frac": 0.6489994592,
"autogenerated": false,
"ratio": 3.430426716141002,
"config_test": false,
"has_no_keywor... |
# A very simple setup script to create 2 executables.
#
# hello.py is a simple "hello, world" type program, which alse allows
# to explore the environment in which the script runs.
#
# test_wx.py is a simple wxPython program, it will be converted into a
# console-less program.
#
# If you don't have wxPython ins... | {
"repo_name": "pupboss/xndian",
"path": "deploy/site-packages/py2exe/samples/simple/setup.py",
"copies": "1",
"size": "1084",
"license": "mit",
"hash": -1172568425667199200,
"line_mean": 28.9714285714,
"line_max": 71,
"alpha_frac": 0.6780442804,
"autogenerated": false,
"ratio": 3.463258785942492,... |
from gimpfu import *
def format_font(image, drawable, glyph_width, glyph_height, num_glyphs):
pdb.gimp_image_convert_rgb(image)
new_width = glyph_width * num_glyphs
new_img = pdb.gimp_image_new(new_width, glyph_height, pdb.gimp_image_base_type(image))
layer_type = pdb.gimp_drawable_type(drawable)
... | {
"repo_name": "mchesser/platformer",
"path": "util/font-format.py",
"copies": "2",
"size": "2473",
"license": "mit",
"hash": 1700213757052560000,
"line_mean": 40.9152542373,
"line_max": 94,
"alpha_frac": 0.6906591185,
"autogenerated": false,
"ratio": 3.615497076023392,
"config_test": false,
"... |
""" A very simple Tosca daemon. Every ten seconds it looks for new programs in
"run" or "destroy" status, and executes them.
TODO: Replace this with observer and/or model_policies ?
"""
import os
import sys
from threading import Thread
import time
# add the parent directory to sys.path
import os,sys,inspect
... | {
"repo_name": "cboling/xos",
"path": "xos/tosca/daemon.py",
"copies": "4",
"size": "2688",
"license": "apache-2.0",
"hash": -7443735236425066000,
"line_mean": 28.2173913043,
"line_max": 86,
"alpha_frac": 0.5974702381,
"autogenerated": false,
"ratio": 3.9704579025110784,
"config_test": false,
... |
# a very simplistic model for global wires
# assuming constant delay and energy per length
class GlobalWire:
def __init__(self, **kwargs):
self.e_per_l = kwargs["eperl"]*1e-9
self.t_per_l = kwargs["tperl"]*1e-6
def get_delay(self, l):
return self.t_per_l * l
def get_energy(self, l)... | {
"repo_name": "subhasis256/cache_spice",
"path": "scripts/global_wire.py",
"copies": "1",
"size": "1160",
"license": "mit",
"hash": 1832140357387334100,
"line_mean": 28,
"line_max": 65,
"alpha_frac": 0.5982758621,
"autogenerated": false,
"ratio": 3.381924198250729,
"config_test": false,
"has_... |
# A very slow arithmetic coder for Python.
#
# "Rationals explode quickly in term of space and ... time."
# -- comment in Rational.py (probably Tim Peters)
#
# Really. Don't use this for real work. Read Mark Nelson's
# Dr. Dobb's article on the topic at
# http://dogma.net/markn/articles/arith/part1.... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/306626_arithmetic_coder/recipe-306626.py",
"copies": "1",
"size": "3345",
"license": "mit",
"hash": 4095395625957983000,
"line_mean": 28.6017699115,
"line_max": 71,
"alpha_frac": 0.5838565022,
"autogenerated": false,
"ratio": 3.48800834202... |
# A very thin layer over leveldb - it mostly serializes JSON back and forth.
import leveldb
import utils
try:
import json
except ImportError:
import simplejson as json
class Cabinet(object):
"""Persistent data storage using JSON and berkeley db"""
def __init__(self, filename, encoder=json.JSONEncode... | {
"repo_name": "exsodus3249/kite",
"path": "src/back/kite/cabinet.py",
"copies": "2",
"size": "2142",
"license": "bsd-3-clause",
"hash": -1334098545364127500,
"line_mean": 28.75,
"line_max": 108,
"alpha_frac": 0.5854341737,
"autogenerated": false,
"ratio": 3.9740259740259742,
"config_test": fals... |
"""A very thin Python wrapper over the WaniKani API.
The aim of this module is to model the API as closely as possible while
ensuring the correct Python type is used for each field in the API. The syntax
for using the library has been made as simple as possible.
Usage
-----
1. Import the WaniKani class. `from crabiga... | {
"repo_name": "jonesinator/crabigator",
"path": "crabigator/wanikani.py",
"copies": "1",
"size": "11127",
"license": "mit",
"hash": 3943128890640465400,
"line_mean": 40.2111111111,
"line_max": 79,
"alpha_frac": 0.6185854228,
"autogenerated": false,
"ratio": 3.7389112903225805,
"config_test": fa... |
import json
import select
import socket
from datetime import datetime
from random import randint
from threading import Thread
from time import sleep
PORT = 6001
MAX_CLIENTS = 5
class DataProducerThread(Thread):
def __init__(self, q):
super(DataProducerThread, self).__init__()
self.running = True... | {
"repo_name": "umermansoor/TrafficDistributor",
"path": "tools/dummy_server.py",
"copies": "1",
"size": "1902",
"license": "mit",
"hash": -1506264506103368400,
"line_mean": 23.3846153846,
"line_max": 77,
"alpha_frac": 0.5462670873,
"autogenerated": false,
"ratio": 4.1347826086956525,
"config_te... |
# A very very minimal BeautifulSoup immitation.
#
# BS uses SGMLlib to parse, which converts everything to lower case.
# This uses real xml parsing to mimic the parts of BS we use.
import xml.dom.minidom
def _getText(node):
nodelist = node.childNodes
rc = []
for node in nodelist:
if node.nodeType ... | {
"repo_name": "galaxy001/libtorrent",
"path": "BitTorrent-4.4.0/BitTorrent/BeautifulSupe.py",
"copies": "10",
"size": "3419",
"license": "mit",
"hash": -7860178015475556000,
"line_mean": 24.9015151515,
"line_max": 85,
"alpha_frac": 0.492834162,
"autogenerated": false,
"ratio": 4.614035087719298,
... |
"""A very *very* simple module for dealing with command-line parsing when the
only things you need to worry about are arguments and switches. Uses
POSIX-esque command-line splitting, because non-POSIX-esque command-line
splitting is silly."""
import shlex
class CloptError(Exception):
pass
class Switch(list):
... | {
"repo_name": "MrJohz/K-Eight",
"path": "tools/clopt.py",
"copies": "1",
"size": "4696",
"license": "bsd-2-clause",
"hash": -4770102875316371000,
"line_mean": 30.7364864865,
"line_max": 79,
"alpha_frac": 0.5519591141,
"autogenerated": false,
"ratio": 3.824104234527687,
"config_test": false,
"... |
"""Avg dew point at temperature."""
from collections import OrderedDict
import datetime
from pandas.io.sql import read_sql
from metpy.units import units
import metpy.calc as mcalc
from pyiem.util import get_autoplot_context, get_dbconn
from pyiem.plot.use_agg import plt
from pyiem.exceptions import NoDataFound
MDICT ... | {
"repo_name": "akrherz/iem",
"path": "htdocs/plotting/auto/scripts/p78.py",
"copies": "1",
"size": "6214",
"license": "mit",
"hash": -1398878135461066500,
"line_mean": 30.2261306533,
"line_max": 79,
"alpha_frac": 0.5374959768,
"autogenerated": false,
"ratio": 3.3480603448275863,
"config_test": ... |
""" AvgPool2d w/ Same Padding
Hacked together by / Copyright 2020 Ross Wightman
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import List, Tuple, Optional
from .helpers import to_2tuple
from .padding import pad_same, get_padding_value
def avg_pool2d_same(x, kernel_size: List[int... | {
"repo_name": "rwightman/pytorch-image-models",
"path": "timm/models/layers/pool2d_same.py",
"copies": "1",
"size": "3045",
"license": "apache-2.0",
"hash": -5499321361321153000,
"line_mean": 40.7123287671,
"line_max": 106,
"alpha_frac": 0.6430213465,
"autogenerated": false,
"ratio": 3.2393617021... |
avg_pool = AvgPool2D(3, strides=3, input_shape=(None, None, 3))
img_in = np.expand_dims(sample_image, 0)
img_out_avg_pool = avg_pool(img_in).numpy()
# Same operation implemented with a convolution
def my_init(shape=(3, 3, 3, 3), dtype=None):
array = np.zeros(shape=shape, dtype="float32")
array[:, :, 0, 0] = ... | {
"repo_name": "m2dsupsdlclass/lectures-labs",
"path": "labs/04_conv_nets/solutions/average_as_conv.py",
"copies": "1",
"size": "1325",
"license": "mit",
"hash": -6577215123619231000,
"line_mean": 34.8108108108,
"line_max": 85,
"alpha_frac": 0.6467924528,
"autogenerated": false,
"ratio": 2.7376033... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.