text stringlengths 0 1.05M | meta dict |
|---|---|
## Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object):
pass
## Dog is-a Animal
class Dog(Animal):
def __init__(self, name):
## Dog has-a name
self.name = name
## Cat is-a Aniaml
class Cat(Animal):
def __init__(self, name):
## Cat has-a name
... | {
"repo_name": "Paul-Haley/LPTHW_python3",
"path": "ex42.py",
"copies": "1",
"size": "1568",
"license": "mit",
"hash": 6522094526725255000,
"line_mean": 18.8481012658,
"line_max": 79,
"alpha_frac": 0.6173469388,
"autogenerated": false,
"ratio": 2.9696969696969697,
"config_test": false,
"has_no... |
## Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object):
pass
## Dog is-a Animal.
class Dog(Animal):
def __init__(self, name):
## Dog has-a name.
self.name = name
## Cat is-a Animal.
class Cat(Animal):
def __init__(self, name):
## Cat has-a na... | {
"repo_name": "afronski/playground-other",
"path": "python/books/learn-python-the-hard-way/ex42.py",
"copies": "1",
"size": "1381",
"license": "mit",
"hash": 2392046382255056400,
"line_mean": 16.9350649351,
"line_max": 71,
"alpha_frac": 0.5923244026,
"autogenerated": false,
"ratio": 2.83572895277... |
## Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object):
pass
## Dog is-a Animal
class Dog(Animal):
def __init__(self, name):
## Dog has-a name
self.name = name
## Cat is-a Animal
class Cat(Animal):
def __init__(self, name):
## Cat has-a name
... | {
"repo_name": "hbenaouich/Learning-Python",
"path": "Learning-Python3-The-Hard-Way/42-Is-A, Objects, and Classes/ex42.py",
"copies": "1",
"size": "1460",
"license": "apache-2.0",
"hash": 2765258478336412700,
"line_mean": 18.2236842105,
"line_max": 71,
"alpha_frac": 0.6178082192,
"autogenerated": fa... |
## Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object):
pass
## Dog is-a animal
class Dog(Animal):
def __init__(self, name):
## __init__ has-a reference with Dog's name
self.name = name
## Cat is-a animal
class Cat(Animal):
def __init__(self, name):
... | {
"repo_name": "chrisortman/CIS-121",
"path": "k0765065/lpthw/ex42.py",
"copies": "1",
"size": "1453",
"license": "mit",
"hash": 929865869857550200,
"line_mean": 18.1184210526,
"line_max": 71,
"alpha_frac": 0.6139022712,
"autogenerated": false,
"ratio": 2.9294354838709675,
"config_test": false,
... |
## Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object):
pass
## Dog is-a(n) Animal
class Dog(Animal):
def __init__(self, name):
## Dog has-a name
self.name = name
## Cat is-a(n) Animal
class Cat(Animal):
def __init__(self, name):
## Cat has-a ... | {
"repo_name": "Furzoom/learnpython",
"path": "learnpythonthehardway/ex42.py",
"copies": "1",
"size": "1285",
"license": "mit",
"hash": -4780861400302553000,
"line_mean": 19.7258064516,
"line_max": 71,
"alpha_frac": 0.6062256809,
"autogenerated": false,
"ratio": 2.8303964757709252,
"config_test"... |
## Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object):
pass
## Dos is-a Animal
class Dog(Animal):
def __init__(self, name):
self.name = name
## Cat is-a Animal
class Cat(Animal):
def __init__(self, name):
self.name = name
## Person is-a object
class ... | {
"repo_name": "CodeSheng/LPLHW",
"path": "ex42.py",
"copies": "1",
"size": "1081",
"license": "apache-2.0",
"hash": 5419582200617410000,
"line_mean": 16.7213114754,
"line_max": 71,
"alpha_frac": 0.625346901,
"autogenerated": false,
"ratio": 2.764705882352941,
"config_test": false,
"has_no_key... |
## Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object):
pass
## is-a
class Dog(Animal):
def __init__(self, name):
## has-a
self.name = name
## is-a
class Cat(Animal):
def __init__(self, name):
## has-a
self.name = name
## is-a
class ... | {
"repo_name": "amolborcar/learnpythonthehardway",
"path": "ex42.py",
"copies": "1",
"size": "1158",
"license": "mit",
"hash": 4202523109551547000,
"line_mean": 14.25,
"line_max": 71,
"alpha_frac": 0.5751295337,
"autogenerated": false,
"ratio": 2.7505938242280283,
"config_test": false,
"has_no... |
## Animal is-a object (yes,sort of confusing) look at the extra credit
class Animal(object):
pass
## ??
class Dog(Animal):
def __init__(self,name):
##??
self.name = name
## ??
class Cat(Animal):
def __init__(self,name):
## ??
self.name = name
## ??
class Person(object... | {
"repo_name": "AisakaTiger/Learn-Python-The-Hard-Way",
"path": "ex42.py",
"copies": "1",
"size": "1038",
"license": "mit",
"hash": -3256692257039010000,
"line_mean": 12.84,
"line_max": 70,
"alpha_frac": 0.5125240848,
"autogenerated": false,
"ratio": 2.7828418230563003,
"config_test": false,
"... |
## Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object):
pass
## ??
class Dog(Animal):
def __init__(self, name):
## ??
self.name = name
## ??
class Cat(Animal):
def __init__(self, name):
## ??
self.name = name
## ??
class Person(objec... | {
"repo_name": "zedshaw/learn-python3-thw-code",
"path": "ex42.py",
"copies": "1",
"size": "1037",
"license": "mit",
"hash": 4254801259559874600,
"line_mean": 12.2948717949,
"line_max": 71,
"alpha_frac": 0.5139826422,
"autogenerated": false,
"ratio": 2.772727272727273,
"config_test": false,
"h... |
## Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object)
pass
## ??
class Dog(Animal):
def __init__(self, name):
## ??
self.name = name
## ??
class Cat(Animal):
def __init__(self, name):
## ??
self.name = name
## ??
class Person(object... | {
"repo_name": "apoloxie/learning-python",
"path": "42/ex42.py",
"copies": "1",
"size": "1034",
"license": "mit",
"hash": 2452911978684430300,
"line_mean": 12.6052631579,
"line_max": 71,
"alpha_frac": 0.5154738878,
"autogenerated": false,
"ratio": 2.764705882352941,
"config_test": false,
"has_... |
## Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object):
pass
## ??
class Dog(Animal):
def __init__(self, name):
## ??
self.name = name
## ??
class Cat(Animal):
def __init__(self, name):
## ??
self.name = name
## ??
class Person(objec... | {
"repo_name": "enkaynitin/python-learn",
"path": "ex42.py",
"copies": "1",
"size": "1035",
"license": "cc0-1.0",
"hash": -4161249300555916300,
"line_mean": 12.6184210526,
"line_max": 71,
"alpha_frac": 0.5149758454,
"autogenerated": false,
"ratio": 2.767379679144385,
"config_test": false,
"has... |
## Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object):
pass
## Dog is-a Animal
class Dog(Animal):
def __init__(self, name):
## Dog has-a name
self.name = name
## Cat is-a Animal
class Cat(Animal):
def __init__(self, name):
## Cat has-a name
self.name = name
## Pers... | {
"repo_name": "CodeCatz/litterbox",
"path": "Pija/LearnPythontheHardWay/ex42.py",
"copies": "1",
"size": "1347",
"license": "mit",
"hash": 316950003191939400,
"line_mean": 16.7368421053,
"line_max": 71,
"alpha_frac": 0.6659242762,
"autogenerated": false,
"ratio": 2.615533980582524,
"config_test... |
#animal OOP assignment
### animal parent class
class Animal(object):
def __init__(self, name):
self.name = name
self.health = 100
def walk(self, x=1):
self.health -= 1*x
return self
def run(self, y=1):
self.health -= 5*y
return self
def displayHealth(self... | {
"repo_name": "authman/Python201609",
"path": "Nguyen_Ken/Assignments/Python OOP/animal.py",
"copies": "1",
"size": "1145",
"license": "mit",
"hash": 311394836570735400,
"line_mean": 21.0192307692,
"line_max": 49,
"alpha_frac": 0.5799126638,
"autogenerated": false,
"ratio": 3.2436260623229463,
... |
# animal.py - create animal table and
# retrieve information from it
import sys
from rdbhdb import rdbhdb as db
from rdbhdb import extensions
DictCursor = extensions.DictCursor
# connect to the RdbHost server
authcode = 'KF7IUQPlwfSth4sBvjdqqanHkojAZzEjMshrkfEV0O53yz6w6v'
try:
conn = db.connect ('s000015', authc... | {
"repo_name": "rdbhost/Rdbhdb",
"path": "examples/animal.py",
"copies": "1",
"size": "2875",
"license": "mit",
"hash": 3213750046008830000,
"line_mean": 28.3469387755,
"line_max": 66,
"alpha_frac": 0.6153043478,
"autogenerated": false,
"ratio": 3.6027568922305764,
"config_test": false,
"has_n... |
animals = {'a': ['aardvark'], 'b': ['baboon'], 'c': ['coati']}
animals['d'] = ['donkey']
animals['d'].append('dog')
animals['d'].append('dingo')
{'a': ['aardvark'], 'c': ['coati'], 'b': ['baboon'], 'd': ['donkey', 'dog', 'dingo']}
def howMany(animals):
"""
returns the number of values in a dictionary
wh... | {
"repo_name": "teichopsia-/python_practice",
"path": "old_class_material/dictionary_practice.py",
"copies": "1",
"size": "1182",
"license": "mpl-2.0",
"hash": -4734342584628461000,
"line_mean": 24.6956521739,
"line_max": 95,
"alpha_frac": 0.5406091371,
"autogenerated": false,
"ratio": 3.229508196... |
animals = { 'a': ['aardvark'], 'b': ['baboon'], 'c': ['coati']}
animals['d'] = ['donkey']
animals['d'].append('dog')
animals['d'].append('dingo')
print howMany(animals)
# 6
def howMany(aDict):
'''
aDict: A dictionary, where all the values are lists.
returns: int, how many values are in the dictionary.
... | {
"repo_name": "teichopsia-/python_practice",
"path": "week_3/dic_count.py",
"copies": "1",
"size": "1139",
"license": "mpl-2.0",
"hash": -6106985654295398000,
"line_mean": 21.78,
"line_max": 71,
"alpha_frac": 0.5961369622,
"autogenerated": false,
"ratio": 3.5817610062893084,
"config_test": fals... |
animals = [
{'name': 'Fluffykins', 'species': 'rabbit'},
{'name': 'Caro', 'species': 'dog'},
{'name': 'Hamilton', 'species': 'dog'},
{'name': 'Harold', 'species': 'fish'},
{'name': 'Ursula', 'species': 'cat'},
{'name': 'Jimmy', 'species': 'fish'}
]
# Get dogs from li... | {
"repo_name": "Valka7a/python-playground",
"path": "projects/training/working_with_collections.py",
"copies": "1",
"size": "1678",
"license": "mit",
"hash": -4557726215841528300,
"line_mean": 20.2405063291,
"line_max": 67,
"alpha_frac": 0.6418355185,
"autogenerated": false,
"ratio": 2.93356643356... |
# animal speed weight lifespan brain
# (mph) (kg) (years) mass (g)
animals = [("dog", 46, 35, 13, 280 ),
("elephant", 30, 3500, 50, 6250 ),
("frog", 5, 0.5, 8, 3 ),
("hippopotamus", 45, 160... | {
"repo_name": "dazz22/udacity-coursework",
"path": "Algorithms_intro_to/l9_quiz2.py",
"copies": "1",
"size": "1245",
"license": "apache-2.0",
"hash": -6339986590129668000,
"line_mean": 48.8,
"line_max": 129,
"alpha_frac": 0.4369477912,
"autogenerated": false,
"ratio": 3.051470588235294,
"config... |
animals=[]
addloop=True
loopno=0
while addloop==True:
addname1=raw_input("Enter animal to add to list:")
animals.append(addname1)
print str("animal added")
loopno=loopno+1
if loopno==5:
addloop=False
program=1
while program==1:
print str(animals)+" This is the list of animals... | {
"repo_name": "husky-prophet/personal-backup",
"path": "lists.py",
"copies": "1",
"size": "1307",
"license": "mit",
"hash": 8631617438289245000,
"line_mean": 44.75,
"line_max": 216,
"alpha_frac": 0.6082631982,
"autogenerated": false,
"ratio": 3.513440860215054,
"config_test": false,
"has_no_k... |
"""Animated brownian motion."""
import numpy as np
from matplotlib.colors import hsv_to_rgb
from galry import *
class MyVisual(Visual):
def initialize(self, X, color, T):
n = X.shape[0]
self.n = n
self.size = n
self.bounds = [0, n]
self.primitive_type = 'LINE_STRIP'... | {
"repo_name": "rossant/galry",
"path": "examples/brownian.py",
"copies": "1",
"size": "2263",
"license": "bsd-3-clause",
"hash": 4279430590562426000,
"line_mean": 23.597826087,
"line_max": 74,
"alpha_frac": 0.5395492709,
"autogenerated": false,
"ratio": 2.82875,
"config_test": false,
"has_no_... |
# Animated Towers of Hanoi using Tk with optional bitmap file in
# background.
#
# Usage: tkhanoi [n [bitmapfile]]
#
# n is the number of pieces to animate; default is 4, maximum 15.
#
# The bitmap file can be any X11 bitmap file (look in
# /usr/include/X11/bitmaps for samples); it is displayed as the
# background of t... | {
"repo_name": "TathagataChakraborti/resource-conflicts",
"path": "PLANROB-2015/seq-sat-lama/Python-2.5.2/Demo/tkinter/guido/hanoi.py",
"copies": "6",
"size": "4637",
"license": "mit",
"hash": -8876093801075369000,
"line_mean": 29.1103896104,
"line_max": 69,
"alpha_frac": 0.5309467328,
"autogenerate... |
"""animate_event.py
Usage:
animate_event.py <f_anim_config>
"""
from sportvu.data.dataset import BaseDataset
from sportvu.data.extractor import BaseExtractor, EncDecExtractor
from sportvu.data.loader import BaseLoader, Seq2SeqLoader
from sportvu.vis.Event import Event
import cPickle as pkl
import yaml
import os
... | {
"repo_name": "wangkua1/sportvu",
"path": "sportvu/animate_event.py",
"copies": "1",
"size": "1067",
"license": "mit",
"hash": -5335725068570691000,
"line_mean": 27.8378378378,
"line_max": 97,
"alpha_frac": 0.7075913777,
"autogenerated": false,
"ratio": 2.8605898123324396,
"config_test": true,
... |
'''Animates distances using single measurment mode'''
from hokuyolx import HokuyoLX
import matplotlib.pyplot as plt
DMAX = 3000
IMIN = 300.
IMAX = 2000.
images = []
fig = None
def get_colors(intens):
max_val = intens.max()
return np.repeat(intens, 3).reshape((4,3))/max_val
def update(laser, plot, text):
... | {
"repo_name": "SkRobo/Eurobot-2017",
"path": "NewCommunication/animate.py",
"copies": "1",
"size": "1305",
"license": "mit",
"hash": -3418679648794265000,
"line_mean": 25.1,
"line_max": 69,
"alpha_frac": 0.6084291188,
"autogenerated": false,
"ratio": 2.8369565217391304,
"config_test": false,
... |
"""Animates the simulation to show quantities that change over time"""
# coding=utf-8
import matplotlib.animation as anim
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import gridspec
from .time_snapshots import FrequencyPlot, \
PhasePlot, SpatialDistributionPlot, IterationCounter, \
Trip... | {
"repo_name": "StanczakDominik/PythonPIC",
"path": "pythonpic/visualization/animation.py",
"copies": "1",
"size": "10546",
"license": "bsd-3-clause",
"hash": -4513514958369669600,
"line_mean": 36.1338028169,
"line_max": 126,
"alpha_frac": 0.5754788545,
"autogenerated": false,
"ratio": 3.762397431... |
'''animation: animate a simulation in a PyQt5 widget'''
from PyQt5 import QtGui, QtCore, QtWidgets
from PyQt5.QtCore import Qt
from dynamics.constants import meter2foot
import numpy as np
class EnergyBar(QtWidgets.QWidget):
'''widget to display potential, kinetic, and dissipated energies'''
def __init__(self... | {
"repo_name": "treygreer/treb",
"path": "treb_sim/src/dynamics/animation.py",
"copies": "1",
"size": "6659",
"license": "mit",
"hash": -3767042638693265400,
"line_mean": 37.9415204678,
"line_max": 77,
"alpha_frac": 0.6089502928,
"autogenerated": false,
"ratio": 3.6249319542732716,
"config_test"... |
"""Animation classes."""
import threading
import time
import random
from abc import abstractmethod, ABC
from lights import colour as lcolour
from lights.action import Effect, TickedEffect, StreamEffect
class StaticEffect(Effect):
"""Constantly display the same colours."""
def run(self, delta):
for i, c... | {
"repo_name": "snorecore/lights",
"path": "lights/action/effects.py",
"copies": "1",
"size": "8035",
"license": "mit",
"hash": 8449938469253829000,
"line_mean": 33.0466101695,
"line_max": 79,
"alpha_frac": 0.592159303,
"autogenerated": false,
"ratio": 3.9367956883880453,
"config_test": false,
... |
"""Animation classes."""
import threading
import time
import random
from abc import abstractmethod, ABC
from lights import colour as lcolour
class EffectThread(threading.Thread):
"""Thread class which runs effects on a string of lights"""
def __init__(self, stop_event, effect):
"""Initialise EffectThr... | {
"repo_name": "snorecore/lights",
"path": "lights/action/__init__.py",
"copies": "1",
"size": "5274",
"license": "mit",
"hash": -315602568332536200,
"line_mean": 29.4855491329,
"line_max": 80,
"alpha_frac": 0.5828593098,
"autogenerated": false,
"ratio": 4.435660218671152,
"config_test": false,
... |
import time
from uiot import colors as _c
class Animation():
def __init__(self, device, command_str):
self.program = command_str.split()
self.device = device
self.playing = True
self.program = command_str.split()
self.step = 0
self.fade_goals = {}
self.lengt... | {
"repo_name": "ulno/micropython-extra-ulno",
"path": "lib/node_types/esp8266/compile/uiot/_rgb_animator.py",
"copies": "1",
"size": "5302",
"license": "mit",
"hash": 2538766561035498500,
"line_mean": 39.1666666667,
"line_max": 101,
"alpha_frac": 0.4677480196,
"autogenerated": false,
"ratio": 3.98... |
"""Animation class which is a DisplayElement which plays animations."""
# animation.py
# Mission Pinball Framework
# Written by Brian Madden & Gabe Knuth
# Released under the MIT License. (See license info at the end of this file.)
# Documentation and more info at http://missionpinball.com/mpf
import time
from mpf.m... | {
"repo_name": "qcapen/mpf",
"path": "mpf/media_controller/elements/animation.py",
"copies": "2",
"size": "13596",
"license": "mit",
"hash": -5960462587478125000,
"line_mean": 36.1475409836,
"line_max": 87,
"alpha_frac": 0.597675787,
"autogenerated": false,
"ratio": 4.356296058955463,
"config_te... |
"""Animation easing functions using cubic bezier curves."""
def _cubic_bezier_parametric(t, p0, p1, p2, p3):
"""Return (x, y) on cubic bezier curve for t in [0, 1]."""
return tuple([
pow(1 - t, 3) * p0[i] +
3 * pow(1 - t, 2) * t * p1[i] +
3 * (1 - t) * pow(t, 2) * p2[i] +
pow(t,... | {
"repo_name": "tdryer/netscramble",
"path": "netscramble/easing.py",
"copies": "1",
"size": "1458",
"license": "bsd-3-clause",
"hash": -8700384179168484000,
"line_mean": 38.4054054054,
"line_max": 78,
"alpha_frac": 0.5871056241,
"autogenerated": false,
"ratio": 2.4628378378378377,
"config_test"... |
import pygame
import os
class Animation(object):
""" This is a simple library that stores frames for a simple animation """
def __init__(self):
""" Constructor - No parameters """
self.frames = []
# Setting this at -1 so the first call of next()
# v----- returns the frame 0 --... | {
"repo_name": "Penaz91/Glitch_Heaven",
"path": "Game/libs/DeprecatedLibs/animation.py",
"copies": "1",
"size": "1846",
"license": "mit",
"hash": -3946918026875217000,
"line_mean": 27.4,
"line_max": 79,
"alpha_frac": 0.570964247,
"autogenerated": false,
"ratio": 4.323185011709602,
"config_test":... |
"""animation loading and manipulating functions.
Please note that this file is alpha, and is subject to modification in
future versions of pgu!
"""
print 'pgu.ani','This module is alpha, and is subject to change.'
import math
import pygame
def _ani_load(tv,name,parts,frames,shape):
l = len(frames)
#print na... | {
"repo_name": "fablab-bayreuth/trommelbold",
"path": "software/ColorfulSequencer/pgu/ani.py",
"copies": "4",
"size": "2923",
"license": "unlicense",
"hash": -3288663067599624700,
"line_mean": 33.3882352941,
"line_max": 106,
"alpha_frac": 0.5788573384,
"autogenerated": false,
"ratio": 3.2191629955... |
"""animation loading and manipulating functions.
Please note that this file is alpha, and is subject to modification in
future versions of pgu!
"""
print ('pgu.ani - This module is alpha, and is subject to change.')
import math
import pygame
# Quick fix for python3
try:
xrange
except:
xrange = range
def _a... | {
"repo_name": "ITA-ftuyama/TG",
"path": "pgu/ani.py",
"copies": "3",
"size": "2952",
"license": "mit",
"hash": -8656625910157725000,
"line_mean": 32.1685393258,
"line_max": 106,
"alpha_frac": 0.5809620596,
"autogenerated": false,
"ratio": 3.222707423580786,
"config_test": false,
"has_no_keywo... |
"""Animation.
Animation is set of keyframes.
Value of selected attribute changes in time.
Keyframe:
(time, value)
Objects have animation manager which manages animation graph and switching."""
from __future__ import division
from operator import itemgetter
from xoinvader.utils import Point, Timer
class Animat... | {
"repo_name": "pankshok/xoinvader",
"path": "xoinvader/animation.py",
"copies": "1",
"size": "8460",
"license": "mit",
"hash": 7379855302645992000,
"line_mean": 29.652173913,
"line_max": 78,
"alpha_frac": 0.6289598109,
"autogenerated": false,
"ratio": 4.417754569190601,
"config_test": false,
... |
"""Animation."""
from matplotlib import animation
import matplotlib.pyplot as plt
import numpy as np
from moviepy.editor import VideoClip
from moviepy.video.io.bindings import mplfig_to_npimage
from .chart_utils import plotwrapper, noticks
__all__ = ['save_movie', 'play', 'save_frames']
def save_movie(make_frame... | {
"repo_name": "nirum/jetpack",
"path": "jetpack/animation.py",
"copies": "2",
"size": "2567",
"license": "mit",
"hash": -8679784352238987000,
"line_mean": 21.7168141593,
"line_max": 79,
"alpha_frac": 0.5890144137,
"autogenerated": false,
"ratio": 3.18091697645601,
"config_test": false,
"has_n... |
# Animation of a quantum harmonic oscillator
#
# Units are such that m_e=1=h_bar=w
#
# When setting the range on n to be larger than roughly 50 there is crazy numbers
# we have discussed this and it appears to be due to the fact that hermite
# polynomials are so large that there is large errors as you go to higher orde... | {
"repo_name": "mannion9/Intro-to-Python",
"path": "Simulations/Harmonic Oscillator Animation.py",
"copies": "1",
"size": "5257",
"license": "mit",
"hash": -4609989653512840700,
"line_mean": 22.1585903084,
"line_max": 110,
"alpha_frac": 0.6380064676,
"autogenerated": false,
"ratio": 2.930323299888... |
# Animation of a quantum particle in a infitie square well
#
# Units are such that m_e=h_bar=1
# There are three main things shown in this simulation
#
# 1) When there is only one state it does not move, and thats why we call
# these states stationary states
#
# 2) When there is the supperposition of two low states ... | {
"repo_name": "mannion9/Intro-to-Python",
"path": "Simulations/Infinite Square Well Animation.py",
"copies": "1",
"size": "4524",
"license": "mit",
"hash": 7109962341381116000,
"line_mean": 25,
"line_max": 96,
"alpha_frac": 0.6432360743,
"autogenerated": false,
"ratio": 2.8870453095086153,
"con... |
# Animation.py
# Aaron Taylor
# Moose Abumeeiz
#
# This is the class for all animations in the game, based on time
# it will advance the frame when it is the correct time
#
from pygame import *
from time import time as cTime
class Animation:
"""Class to handle all animation timing"""
def __init__(self, frames, in... | {
"repo_name": "ExPHAT/binding-of-isaac",
"path": "Animation.py",
"copies": "1",
"size": "2346",
"license": "mit",
"hash": 3485127968386562000,
"line_mean": 26.6,
"line_max": 109,
"alpha_frac": 0.7169650469,
"autogenerated": false,
"ratio": 3.341880341880342,
"config_test": false,
"has_no_keyw... |
# animation.py
# Animation
"""
This is an example of animation using pygame.
An example from Chapter 17 of
'Invent Your Own Games With Python' by Al Sweigart
A.C. LoGreco
"""
import pygame, sys, time
from pygame.locals import *
# set up pygame
pygame.init()
# set up the window
WINDOWWIDTH = 400
WINDOWHEIGHT = 400
w... | {
"repo_name": "aclogreco/InventGamesWP",
"path": "ch17/animation.py",
"copies": "1",
"size": "2838",
"license": "bsd-2-clause",
"hash": -29043018623189908,
"line_mean": 26.5533980583,
"line_max": 75,
"alpha_frac": 0.5412262156,
"autogenerated": false,
"ratio": 3.3825983313468413,
"config_test":... |
"""Animations of pulsating sphere."""
import sfs
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
def particle_displacement(omega, center, radius, amplitude, grid, frames,
figsize=(8, 8), interval=80, blit=True, **kwargs):
"""Generate sound particl... | {
"repo_name": "sfstoolbox/sfs-python",
"path": "doc/examples/animations_pulsating_sphere.py",
"copies": "1",
"size": "4376",
"license": "mit",
"hash": -2020896889671153700,
"line_mean": 37.3859649123,
"line_max": 79,
"alpha_frac": 0.6208866545,
"autogenerated": false,
"ratio": 3.432156862745098,
... |
"""AnimControlInterval module: contains the AnimControlInterval class"""
__all__ = ['AnimControlInterval']
from panda3d.core import *
from panda3d.direct import *
from direct.directnotify.DirectNotifyGlobal import *
from . import Interval
import math
class AnimControlInterval(Interval.Interval):
# create AnimCo... | {
"repo_name": "chandler14362/panda3d",
"path": "direct/src/interval/AnimControlInterval.py",
"copies": "13",
"size": "6933",
"license": "bsd-3-clause",
"hash": 637528143437308200,
"line_mean": 36.8852459016,
"line_max": 96,
"alpha_frac": 0.6252704457,
"autogenerated": false,
"ratio": 4.4243777919... |
"""AnimControlInterval module: contains the AnimControlInterval class"""
__all__ = ['AnimControlInterval']
from pandac.PandaModules import *
from direct.directnotify.DirectNotifyGlobal import *
import Interval
import math
class AnimControlInterval(Interval.Interval):
# create AnimControlInterval DirectNotify ca... | {
"repo_name": "toontownfunserver/Panda3D-1.9.0",
"path": "direct/interval/AnimControlInterval.py",
"copies": "3",
"size": "6984",
"license": "bsd-3-clause",
"hash": 7504903468495585000,
"line_mean": 37.3736263736,
"line_max": 96,
"alpha_frac": 0.6178407789,
"autogenerated": false,
"ratio": 4.4855... |
""" An immutable dictionary
This has been vendored from [python-frozendict](https://github.com/slezica/python-frozendict)
and subsequently modified.
"""
import collections.abc
class frozendict(collections.abc.Mapping):
"""
An immutable wrapper around dictionaries that implements the complete :py:class:`colle... | {
"repo_name": "adamcharnock/lightbus",
"path": "lightbus/utilities/frozendict.py",
"copies": "1",
"size": "1377",
"license": "apache-2.0",
"hash": 9176339919204213000,
"line_mean": 24.9811320755,
"line_max": 105,
"alpha_frac": 0.602033406,
"autogenerated": false,
"ratio": 3.979768786127168,
"co... |
"""An immutable tree implementation that is backed by the filesystem."""
import datetime
import logging
import os
from . import common
class FilesystemTree(common.Tree):
"""An implementation of Tree backed by the filesystem."""
"""Initializer.
For safety reasons, only paths beginning with "repos/" are allowe... | {
"repo_name": "googlearchive/mimic",
"path": "__mimic/filesystem_tree.py",
"copies": "1",
"size": "2167",
"license": "apache-2.0",
"hash": -2627820200982918000,
"line_mean": 27.5131578947,
"line_max": 79,
"alpha_frac": 0.647900323,
"autogenerated": false,
"ratio": 3.5524590163934424,
"config_te... |
#An implementation of a 2 neuron lpu that instantiates a Leaky and a Morrislecar
#into a 1 edge/2node graph. Outputs to a .gefx file. Take from py notebooks.
#matrix support
import numpy as np
np.set_printoptions(threshold = 'nan')
#graph support
import networkx as nx
#input support
import h5py
def create_lpu_0():... | {
"repo_name": "cerrno/neurokernel",
"path": "examples/testLPU_ports/data/testLPU.py",
"copies": "1",
"size": "4073",
"license": "bsd-3-clause",
"hash": 3733883008296280000,
"line_mean": 22.9588235294,
"line_max": 81,
"alpha_frac": 0.4203289958,
"autogenerated": false,
"ratio": 2.8886524822695034,... |
"""An implementation of a binary search tree."""
class Node(object):
"""Create node to for use in a binary search tree."""
def __init__(self, value=None):
"""Create node to push into Doubly link list."""
self.value = value
self.left_child = None
self.right_child = None
de... | {
"repo_name": "rwisecar/data-structures",
"path": "src/bst.py",
"copies": "1",
"size": "8513",
"license": "mit",
"hash": 3473255483819633700,
"line_mean": 30.5296296296,
"line_max": 267,
"alpha_frac": 0.5496299777,
"autogenerated": false,
"ratio": 4.235323383084577,
"config_test": false,
"has... |
""" An implementation of a deep, recurrent Q-Network following
https://gist.github.com/awjuliani/35d2ab3409fc818011b6519f0f1629df#file-deep-recurrent-q-network-ipynb.
Adopted to play Pong, or at least to make an honest attempt at doing so, by taking cues from
https://gist.github.com/karpathy/a4166c7fe253700972fcbc77e... | {
"repo_name": "demelin/learning_reinforcement_learning",
"path": "recurrent_deep_q_network/q_network.py",
"copies": "1",
"size": "9714",
"license": "mit",
"hash": 4361640127983002600,
"line_mean": 55.1387283237,
"line_max": 120,
"alpha_frac": 0.6162479407,
"autogenerated": false,
"ratio": 3.40532... |
"""An implementation of a doubly linked list in Python."""
class Node():
"""Instantiate a node."""
def __init__(self, value=None, nxt=None, previous=None):
"""."""
self.value = value
self.next = nxt
self.previous = previous
class DbLinkedList():
"""Instantiate a doubly l... | {
"repo_name": "ellezv/data_structures",
"path": "src/dll.py",
"copies": "1",
"size": "2544",
"license": "mit",
"hash": 3400972026953004500,
"line_mean": 30.0243902439,
"line_max": 68,
"alpha_frac": 0.5125786164,
"autogenerated": false,
"ratio": 4.393782383419689,
"config_test": false,
"has_no... |
## An implementation of an additivelly homomorphic
## ECC El-Gamal scheme, used in Privex.
from petlib.ec import EcGroup
import pytest
def params_gen(nid=713):
"""Generates the AHEG for an EC group nid"""
G = EcGroup(nid)
g = G.generator()
o = G.order()
return (G, g, o)
def key_gen(params):
... | {
"repo_name": "gdanezis/petlib",
"path": "examples/AHEG.py",
"copies": "1",
"size": "2079",
"license": "bsd-2-clause",
"hash": -1868945703331276800,
"line_mean": 22.1,
"line_max": 59,
"alpha_frac": 0.5738335738,
"autogenerated": false,
"ratio": 3.0174165457184325,
"config_test": false,
"has_n... |
'''An implementation of an agent following the simple SIR model
@author: Joe Schaul <joe.schaul@gmail.com>
'''
from ComplexNetworkSim import NetworkAgent, Sim
#states:
SUSCEPTIBLE = 0
INFECTED = 1
RECOVERED = 2
class SIRSimple(NetworkAgent):
""" an implementation of an agent following the simple SI... | {
"repo_name": "jschaul/ComplexNetworkSim",
"path": "examples/SIR_model/agent_SIR.py",
"copies": "1",
"size": "1542",
"license": "bsd-2-clause",
"hash": 2760000590297408000,
"line_mean": 29.5102040816,
"line_max": 85,
"alpha_frac": 0.5648508431,
"autogenerated": false,
"ratio": 4.057894736842106,
... |
'''An implementation of a neural network with backpropagation and momentum in python. Backpropagation is a method
of training neural networks by working backwards from the output of the training data to the input. In this
implementation, a sigmoid function is used as the transfer function to compute outputs of succ... | {
"repo_name": "fawazn/PyNeural",
"path": "BackProp.py",
"copies": "1",
"size": "3862",
"license": "mit",
"hash": 4880635344595064000,
"line_mean": 42.3908045977,
"line_max": 135,
"alpha_frac": 0.6532884516,
"autogenerated": false,
"ratio": 3.552897884084637,
"config_test": false,
"has_no_keyw... |
"""An implementation of a neural network without classes (just a module)
"""
import numpy
import scipy.optimize
import itertools
def create_training_dict(X, y):
"""Take a set of input features and their labels and package them
along with some useful quantities into a dictionary. This could
be a training,... | {
"repo_name": "galtay/neural_learner",
"path": "nn.py",
"copies": "1",
"size": "8224",
"license": "mit",
"hash": 5919210168104909000,
"line_mean": 29.3468634686,
"line_max": 85,
"alpha_frac": 0.6101653696,
"autogenerated": false,
"ratio": 3.4773784355179704,
"config_test": false,
"has_no_keyw... |
"""An implementation of aNMM Model."""
import keras
from keras.activations import softmax
from keras.initializers import RandomUniform
from matchzoo.engine.base_model import BaseModel
from matchzoo.engine.param import Param
from matchzoo.engine.param_table import ParamTable
from matchzoo.engine import hyper_spaces
... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/models/anmm.py",
"copies": "1",
"size": "2720",
"license": "apache-2.0",
"hash": -7138631072933529000,
"line_mean": 33.4303797468,
"line_max": 75,
"alpha_frac": 0.5794117647,
"autogenerated": false,
"ratio": 3.7414030261348006,
"config_test"... |
""" An implementation of an occupancy field that you can use to implement
your particle filter's laser_update function """
import rospy
from std_msgs.msg import Header, String
from sensor_msgs.msg import LaserScan
from geometry_msgs.msg import PoseStamped, PoseWithCovarianceStamped, PoseArray, Pose, Point, Quater... | {
"repo_name": "DakotaNelson/robo-games",
"path": "ar_locating/scripts/occupancy_field.py",
"copies": "1",
"size": "3761",
"license": "mit",
"hash": 4873690552125065000,
"line_mean": 40.8,
"line_max": 124,
"alpha_frac": 0.6240361606,
"autogenerated": false,
"ratio": 3.764764764764765,
"config_te... |
"""An implementation of a priority queue using a dictionary in Python."""
class PriorityQueue(object):
"""That's it."""
def __init__(self):
"""Initialize a priority queue with default value as None."""
self._container = {}
def insert(self, value, priority=0):
"""Insert tuple in p... | {
"repo_name": "ellezv/data_structures",
"path": "src/priority_queue.py",
"copies": "1",
"size": "1368",
"license": "mit",
"hash": -6587816417267415000,
"line_mean": 39.2352941176,
"line_max": 83,
"alpha_frac": 0.6235380117,
"autogenerated": false,
"ratio": 4.920863309352518,
"config_test": fals... |
"""An implementation of a queue in Python."""
from dll import DbLinkedList
class Queue(object):
"""Create a queue which inherits from Double-linked List."""
def __init__(self, value=None, next=None, previous=None):
"""Initialize new queue from dll using composition."""
self._dblinkedlist = D... | {
"repo_name": "ellezv/data_structures",
"path": "src/queue.py",
"copies": "1",
"size": "1524",
"license": "mit",
"hash": 2904189733749178400,
"line_mean": 32.8666666667,
"line_max": 66,
"alpha_frac": 0.6154855643,
"autogenerated": false,
"ratio": 4.39193083573487,
"config_test": false,
"has_n... |
"""An implementation of ArcII Model."""
import typing
import keras
import matchzoo
from matchzoo.engine.base_model import BaseModel
from matchzoo.engine.param import Param
from matchzoo.engine.param_table import ParamTable
from matchzoo.engine import hyper_spaces
class ArcII(BaseModel):
"""
ArcII Model.
... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/models/arcii.py",
"copies": "1",
"size": "4891",
"license": "apache-2.0",
"hash": 3888581681597291000,
"line_mean": 36.9147286822,
"line_max": 79,
"alpha_frac": 0.5416070333,
"autogenerated": false,
"ratio": 4.002454991816694,
"config_test":... |
"""An implementation of ArcI Model."""
import typing
import keras
from matchzoo.engine.base_model import BaseModel
from matchzoo.engine.param import Param
from matchzoo.engine.param_table import ParamTable
from matchzoo.engine import hyper_spaces
class ArcI(BaseModel):
"""
ArcI Model.
Examples:
... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/models/arci.py",
"copies": "1",
"size": "5386",
"license": "apache-2.0",
"hash": 7616711493528991000,
"line_mean": 37.4714285714,
"line_max": 78,
"alpha_frac": 0.5285926476,
"autogenerated": false,
"ratio": 4.13989239046887,
"config_test": f... |
"""An implementation of a simple event system"""
import logging
class Event:
"""Simple event class"""
def __init__(self, name):
self.__name__ = name
self._handlers = []
self._temp_handlers = []
def add(self, handler):
"""
Add a handler to the event.
The orde... | {
"repo_name": "Chiel92/fate",
"path": "fate/event.py",
"copies": "1",
"size": "1651",
"license": "mit",
"hash": -8464378374748048000,
"line_mean": 30.75,
"line_max": 81,
"alpha_frac": 0.5645063598,
"autogenerated": false,
"ratio": 4.663841807909605,
"config_test": false,
"has_no_keywords": fa... |
"""An implementation of a simple graph in Python."""
class Graph(object):
"""A graph containing nodes and single-directional edges between them.
g.nodes(): return a list of all nodes in the graph
g.edges(): return a list of all edges in the graph
g.add_node(n): adds a new node 'n' to the graph
... | {
"repo_name": "ellezv/data_structures",
"path": "src/simple_graph.py",
"copies": "1",
"size": "5497",
"license": "mit",
"hash": 1565175093637456600,
"line_mean": 34.464516129,
"line_max": 145,
"alpha_frac": 0.5926869201,
"autogenerated": false,
"ratio": 3.7318397827562797,
"config_test": false,... |
"""An implementation of a state-driven autonomous robot."""
from importlib import import_module
import time
import mount
import sensor
MIN_VOLTAGE = 7.0 # Minimum allowable voltage for consistent behavior
MOTOR_LEFT = 0 # Index of the left motor
MOTOR_RIGHT = 1 # Index of the right motor
TRIM_STRAIGHT = -10 #... | {
"repo_name": "mattskone/robot_maze",
"path": "src/robot.py",
"copies": "1",
"size": "4589",
"license": "mit",
"hash": -3732695261205155000,
"line_mean": 28.6064516129,
"line_max": 78,
"alpha_frac": 0.7191109174,
"autogenerated": false,
"ratio": 3.2226123595505616,
"config_test": false,
"has_... |
"""An implementation of a state-driven autonomous robot."""
from importlib import import_module
import time
import mount
import sensor
MOTOR_LEFT = 0 # Index of the left motor
MOTOR_RIGHT = 1 # Index of the right motor
TRIM_STRAIGHT = -10 # Trim setting for straight movement
DEFAULT_SPEED = 60 # Slowest spee... | {
"repo_name": "RLGarner1/robot_maze",
"path": "src/robot.py",
"copies": "1",
"size": "2912",
"license": "mit",
"hash": -1042701084828228000,
"line_mean": 28.12,
"line_max": 74,
"alpha_frac": 0.7163461538,
"autogenerated": false,
"ratio": 3.316628701594533,
"config_test": false,
"has_no_keywor... |
# An implementation of a Stockfighter server in Python 3
# https://github.com/fohristiwhirl/disorderBook
#
# By Stockfighter player Amtiskaw (a.k.a. Fohristiwhirl)
# With help from Medecau and cite-reader
#
# License: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)
#
# --------------------------------------... | {
"repo_name": "fohristiwhirl/disorderBook",
"path": "disorderBook_main.py",
"copies": "1",
"size": "17553",
"license": "mit",
"hash": 8298988983891583000,
"line_mean": 28.4020100503,
"line_max": 139,
"alpha_frac": 0.5650316185,
"autogenerated": false,
"ratio": 3.804291287386216,
"config_test": ... |
"""An implementation of a struct parser which is fast and convenient."""
import struct
format_string_map = dict(
uint64_t="Q",
int64_t="q",
uint32_t="I",
uint16_t="H",
int32_t="i",
int16_t="h",
)
class BaseParser(object):
_format_string = ""
_fields = []
_name = "Unknown"
_def... | {
"repo_name": "blschatz/aff4",
"path": "pyaff4/pyaff4/struct_parser.py",
"copies": "1",
"size": "2374",
"license": "apache-2.0",
"hash": 8702808516373636000,
"line_mean": 25.9772727273,
"line_max": 76,
"alpha_frac": 0.5395956192,
"autogenerated": false,
"ratio": 3.8352180936995155,
"config_test... |
"""An implementation of a top-down, recursive descent, Backus-Naur form (BNF)
parser and a finite-state, BNF grammar supporting n-ary branching structures."""
__authors__ = ['Aaron Levine', 'Zachary Yocum']
__emails__ = ['aclevine@brandeis.edu', 'zyocum@brandeis.edu']
import random
from argparse import ArgumentPars... | {
"repo_name": "zyocum/bnf_parser",
"path": "bnfparse.py",
"copies": "1",
"size": "10079",
"license": "mit",
"hash": -2132109570978392800,
"line_mean": 38.8418972332,
"line_max": 80,
"alpha_frac": 0.5163210636,
"autogenerated": false,
"ratio": 4.481547354379725,
"config_test": false,
"has_no_k... |
"""An implementation of a trie."""
from collections import OrderedDict
class TrieNode(object):
"""Create node to for use in a trie tree."""
def __init__(self, value=None):
"""Create node to push into Doubly link list."""
self.value = value
self.children = OrderedDict()
class Trie(ob... | {
"repo_name": "rwisecar/data-structures",
"path": "src/trie.py",
"copies": "1",
"size": "4131",
"license": "mit",
"hash": 4846799489019826000,
"line_mean": 35.2368421053,
"line_max": 220,
"alpha_frac": 0.5770999758,
"autogenerated": false,
"ratio": 4.5696902654867255,
"config_test": false,
"h... |
"""An implementation of Attention Layer for Bimpm model."""
import tensorflow as tf
from keras import backend as K
from keras.engine import Layer
class AttentionLayer(Layer):
"""
Layer that compute attention for BiMPM model.
For detailed information, see Bilateral Multi-Perspective Matching for
Natu... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/contrib/layers/attention_layer.py",
"copies": "1",
"size": "4960",
"license": "apache-2.0",
"hash": 8161447889173273000,
"line_mean": 33.4444444444,
"line_max": 83,
"alpha_frac": 0.49375,
"autogenerated": false,
"ratio": 3.525230987917555,
"... |
"""An implementation of CDSSM (CLSM) model."""
import typing
import keras
from keras.models import Model
from matchzoo.engine.base_model import BaseModel
from matchzoo.engine.param import Param
from matchzoo.engine.param_table import ParamTable
from matchzoo import preprocessors
from matchzoo.utils import TensorType
... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/models/cdssm.py",
"copies": "1",
"size": "5450",
"license": "apache-2.0",
"hash": -1313027946593110500,
"line_mean": 40.2878787879,
"line_max": 78,
"alpha_frac": 0.587706422,
"autogenerated": false,
"ratio": 4.251170046801872,
"config_test":... |
"""An implementation of Common Lisp's FORMAT."""
from __future__ import with_statement
import sys
from cStringIO import StringIO
from math import log10
import re
import unicodedata
from bindings import bindings
from charpos import CharposStream
from prettyprinter import PrettyPrinter
import printervars
__all__ = ["F... | {
"repo_name": "plotnick/prettyprinter",
"path": "format.py",
"copies": "1",
"size": "37184",
"license": "mit",
"hash": -7743765008277030000,
"line_mean": 33.145087236,
"line_max": 81,
"alpha_frac": 0.5354991394,
"autogenerated": false,
"ratio": 4.011218985976267,
"config_test": false,
"has_no... |
"""An implementation of conlleval.pl https://www.clips.uantwerpen.be/conll2000/chunking/output.html
Input is a conll file with the rightmost columns being gold and predicted tags
in that order. Sentences are separated by a blank line.
Some parts of the perl script are not replicated (this doesn't generate a latex
tab... | {
"repo_name": "dpressel/baseline",
"path": "layers/eight_mile/conlleval.py",
"copies": "1",
"size": "4594",
"license": "apache-2.0",
"hash": -235970400084821540,
"line_mean": 38.947826087,
"line_max": 107,
"alpha_frac": 0.6850239443,
"autogenerated": false,
"ratio": 3.634493670886076,
"config_t... |
# An implementation of Dartmouth BASIC (1964)
from ply import *
keywords = (
'LET','READ','DATA','PRINT','GOTO','IF','THEN','FOR','NEXT','TO','STEP',
'END','STOP','DEF','GOSUB','DIM','REM','RETURN','RUN','LIST','NEW',
)
tokens = keywords + (
'EQUALS','PLUS','MINUS','TIMES','DIVIDE','POWER',
'LPAREN... | {
"repo_name": "eepalms/gem5-newcache",
"path": "ext/ply/example/BASIC/basiclex.py",
"copies": "166",
"size": "1177",
"license": "bsd-3-clause",
"hash": -7429442759498911000,
"line_mean": 14.9054054054,
"line_max": 76,
"alpha_frac": 0.4545454545,
"autogenerated": false,
"ratio": 2.3777777777777778... |
# An implementation of Dartmouth BASIC (1964)
#
from ply import *
import basiclex
tokens = basiclex.tokens
precedence = (
('left', 'PLUS','MINUS'),
('left', 'TIMES','DIVIDE'),
('left', 'POWER'),
('right','UMINUS')
)
#### A BASIC program is a series of stat... | {
"repo_name": "Dexhub/MTX",
"path": "ext/ply/example/BASIC/basparse.py",
"copies": "166",
"size": "8899",
"license": "bsd-3-clause",
"hash": 22320524706773372,
"line_mean": 19.9882075472,
"line_max": 78,
"alpha_frac": 0.5289358355,
"autogenerated": false,
"ratio": 2.8883479389808504,
"config_te... |
# An implementation of Dartmouth BASIC (1964)
#
from ply import *
import basiclex
tokens = basiclex.tokens
precedence = (
('left', 'PLUS', 'MINUS'),
('left', 'TIMES', 'DIVIDE'),
('left', 'POWER'),
('right', 'UMINUS')
)
# A BASIC program is a series of statements. We represent the program as a
# dic... | {
"repo_name": "cloudera/hue",
"path": "desktop/core/ext-py/ply-3.11/example/BASIC/basparse.py",
"copies": "9",
"size": "8850",
"license": "apache-2.0",
"hash": -816632391361357700,
"line_mean": 17.6708860759,
"line_max": 75,
"alpha_frac": 0.5318644068,
"autogenerated": false,
"ratio": 2.872444011... |
# An implementation of Dartmouth BASIC (1964)
#
import sys
sys.path.insert(0,"../..")
if sys.version_info[0] >= 3:
raw_input = input
import basiclex
import basparse
import basinterp
# If a filename has been specified, we try to run it.
# If a runtime error occurs, we bail out and enter
# interactive mode below
... | {
"repo_name": "KuroeKurose/gem5",
"path": "ext/ply/example/BASIC/basic.py",
"copies": "166",
"size": "1533",
"license": "bsd-3-clause",
"hash": -8141337596046289000,
"line_mean": 20.5915492958,
"line_max": 63,
"alpha_frac": 0.5792563601,
"autogenerated": false,
"ratio": 3.6070588235294117,
"con... |
# An implementation of Dartmouth BASIC (1964)
#
import sys
sys.path.insert(0, "../..")
if sys.version_info[0] >= 3:
raw_input = input
import logging
logging.basicConfig(
level=logging.INFO,
filename="parselog.txt",
filemode="w"
)
log = logging.getLogger()
import basiclex
import basparse
import basin... | {
"repo_name": "todaychi/hue",
"path": "desktop/core/ext-py/ply-3.9/example/BASIC/basiclog.py",
"copies": "10",
"size": "1679",
"license": "apache-2.0",
"hash": -5176870297474578000,
"line_mean": 22,
"line_max": 63,
"alpha_frac": 0.5944014294,
"autogenerated": false,
"ratio": 3.564755838641189,
... |
"""An implementation of Decaying Dropout Layer."""
import tensorflow as tf
from keras import backend as K
from keras.engine import Layer
class DecayingDropoutLayer(Layer):
"""
Layer that processes dropout with exponential decayed keep rate during
training.
:param initial_keep_rate: the initial keep r... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/contrib/layers/decaying_dropout_layer.py",
"copies": "1",
"size": "3805",
"license": "apache-2.0",
"hash": 3174055692180741600,
"line_mean": 37.4343434343,
"line_max": 75,
"alpha_frac": 0.5684625493,
"autogenerated": false,
"ratio": 4.22308546... |
"""An implementation of DRMM Model."""
import typing
import keras
import keras.backend as K
import tensorflow as tf
from matchzoo.engine.base_model import BaseModel
from matchzoo.engine.param import Param
from matchzoo.engine.param_table import ParamTable
class DRMM(BaseModel):
"""
DRMM Model.
Examples... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/models/drmm.py",
"copies": "1",
"size": "4248",
"license": "apache-2.0",
"hash": -914664458887159400,
"line_mean": 34.1074380165,
"line_max": 78,
"alpha_frac": 0.5550847458,
"autogenerated": false,
"ratio": 3.8132854578096946,
"config_test":... |
"""An implementation of DRMMTKS Model."""
import typing
import keras
import tensorflow as tf
from matchzoo.engine.base_model import BaseModel
from matchzoo.engine.param import Param
from matchzoo.engine.param_table import ParamTable
from matchzoo.engine import hyper_spaces
class DRMMTKS(BaseModel):
"""
DRMM... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/models/drmmtks.py",
"copies": "1",
"size": "4766",
"license": "apache-2.0",
"hash": 1068782582329549000,
"line_mean": 34.5671641791,
"line_max": 79,
"alpha_frac": 0.5497272346,
"autogenerated": false,
"ratio": 3.6974398758727696,
"config_tes... |
"""An implementation of DSSM, Deep Structured Semantic Model."""
from keras.models import Model
from keras.layers import Input, Dot
from matchzoo.engine.param_table import ParamTable
from matchzoo.engine.base_model import BaseModel
from matchzoo import preprocessors
class DSSM(BaseModel):
"""
Deep structured... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/models/dssm.py",
"copies": "1",
"size": "1847",
"license": "apache-2.0",
"hash": 3212837813646784000,
"line_mean": 31.9821428571,
"line_max": 77,
"alpha_frac": 0.6128857607,
"autogenerated": false,
"ratio": 3.7540650406504064,
"config_test":... |
"""An implementation of EncodingModule for DIIN model."""
import tensorflow as tf
from keras import backend as K
from keras.engine import Layer
from matchzoo.contrib.layers import DecayingDropoutLayer
class EncodingLayer(Layer):
"""
Apply a self-attention layer and a semantic composite fuse gate
to comp... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/contrib/layers/semantic_composite_layer.py",
"copies": "1",
"size": "4198",
"license": "apache-2.0",
"hash": 5283100430458227000,
"line_mean": 33.694214876,
"line_max": 75,
"alpha_frac": 0.5454978561,
"autogenerated": false,
"ratio": 3.4297385... |
"""An implementation of gates that act on qubits.
Gates are unitary operators that act on the space of qubits.
Medium Term Todo:
* Optimize Gate._apply_operators_Qubit to remove the creation of many
intermediate Qubit objects.
* Add commutation relationships to all operators and use this in gate_sort.
* Fix gate_s... | {
"repo_name": "dennisss/sympy",
"path": "sympy/physics/quantum/gate.py",
"copies": "24",
"size": "42016",
"license": "bsd-3-clause",
"hash": 5269753086676920000,
"line_mean": 31.5453137103,
"line_max": 82,
"alpha_frac": 0.5343440594,
"autogenerated": false,
"ratio": 4.072106997480132,
"config_t... |
"""An implementation of gates that act on qubits.
Gates are unitary operators that act on the space of qubits.
Medium Term Todo:
* Optimize Gate._apply_operators_Qubit to remove the creation of many
intermediate Qubit objects.
* Add commutation relationships to all operators and use this in gate_sort.
* Fix gate_so... | {
"repo_name": "Cuuuurzel/KiPyCalc",
"path": "sympy_old/physics/quantum/gate.py",
"copies": "2",
"size": "39057",
"license": "mit",
"hash": -820304495215943400,
"line_mean": 31.4663341646,
"line_max": 87,
"alpha_frac": 0.5364467317,
"autogenerated": false,
"ratio": 4.093596059113301,
"config_tes... |
import math
class LogisticRegression:
# Initialize member variables. We have two member variables
# 1) weight: a dict obejct storing the weight of all features.
# 2) bias: a float value of the bias value.
def __init__(self):
self.rate = 0.01
self.weight = {}
return
# data i... | {
"repo_name": "applecool/AI",
"path": "Logistic Regression/lr.py",
"copies": "1",
"size": "1706",
"license": "mit",
"hash": 1914856542245616400,
"line_mean": 37.7727272727,
"line_max": 72,
"alpha_frac": 0.5896834701,
"autogenerated": false,
"ratio": 4.160975609756098,
"config_test": false,
"h... |
# An implementation of LSTM networks, CTC alignment, and related classes.
#
# This code operates on sequences of vectors as inputs, and either outputs
# sequences of vectors, or symbol sequences. Sequences of vectors are
# represented as 2D arrays, with rows representing vectors at different
# time steps.
#
# The code ... | {
"repo_name": "zuphilip/ocropy",
"path": "ocrolib/lstm.py",
"copies": "1",
"size": "38186",
"license": "apache-2.0",
"hash": -2337910622605893000,
"line_mean": 37.3778894472,
"line_max": 108,
"alpha_frac": 0.603755303,
"autogenerated": false,
"ratio": 3.5334505413158137,
"config_test": false,
... |
"""An implementation of Matching Tensor Layer."""
import typing
import numpy as np
import tensorflow as tf
from keras import backend as K
from keras.engine import Layer
from keras.initializers import constant
class MatchingTensorLayer(Layer):
"""
Layer that captures the basic interactions between two tensors... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/contrib/layers/matching_tensor_layer.py",
"copies": "1",
"size": "5169",
"license": "apache-2.0",
"hash": 8803972556210350000,
"line_mean": 37.2888888889,
"line_max": 78,
"alpha_frac": 0.5451731476,
"autogenerated": false,
"ratio": 4.233415233... |
"""An implementation of MatchPyramid Model."""
import typing
import keras
import matchzoo
from matchzoo.engine.base_model import BaseModel
from matchzoo.engine.param import Param
from matchzoo.engine.param_table import ParamTable
from matchzoo.engine import hyper_spaces
class MatchPyramid(BaseModel):
"""
Ma... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/models/match_pyramid.py",
"copies": "1",
"size": "4014",
"license": "apache-2.0",
"hash": 1656123595082250200,
"line_mean": 34.8392857143,
"line_max": 79,
"alpha_frac": 0.5401096163,
"autogenerated": false,
"ratio": 4.18125,
"config_test": f... |
"""An implementation of Match-SRNN Model."""
import keras
from matchzoo.contrib.layers import MatchingTensorLayer
from matchzoo.contrib.layers import SpatialGRU
from matchzoo.engine import hyper_spaces
from matchzoo.engine.base_model import BaseModel
from matchzoo.engine.param import Param
from matchzoo.engine.param_... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/contrib/models/match_srnn.py",
"copies": "1",
"size": "3058",
"license": "apache-2.0",
"hash": -2351120072906550300,
"line_mean": 31.8817204301,
"line_max": 76,
"alpha_frac": 0.571942446,
"autogenerated": false,
"ratio": 4.013123359580052,
"... |
"""An implementation of MultiPerspectiveLayer for Bimpm model."""
import tensorflow as tf
from keras import backend as K
from keras.engine import Layer
from matchzoo.contrib.layers.attention_layer import AttentionLayer
class MultiPerspectiveLayer(Layer):
"""
A keras implementation of multi-perspective layer... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/contrib/layers/multi_perspective_layer.py",
"copies": "1",
"size": "16251",
"license": "apache-2.0",
"hash": -7697306292055920000,
"line_mean": 33.7243589744,
"line_max": 80,
"alpha_frac": 0.5573810842,
"autogenerated": false,
"ratio": 3.43137... |
"""An implementation of MVLSTM Model."""
import keras
import tensorflow as tf
from matchzoo.engine import hyper_spaces
from matchzoo.engine.base_model import BaseModel
from matchzoo.engine.param import Param
from matchzoo.engine.param_table import ParamTable
class MVLSTM(BaseModel):
"""
MVLSTM Model.
E... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/models/mvlstm.py",
"copies": "1",
"size": "2963",
"license": "apache-2.0",
"hash": -1193117711284654800,
"line_mean": 34.6987951807,
"line_max": 77,
"alpha_frac": 0.5821802227,
"autogenerated": false,
"ratio": 3.755386565272497,
"config_test... |
"""An implementation of qubits and gates acting on them.
Todo:
* Update docstrings.
* Update tests.
* Implement apply using decompose.
* Implement represent using decompose or something smarter. For this to
work we first have to implement represent for SWAP.
* Decide if we want upper index to be inclusive in the co... | {
"repo_name": "souravsingh/sympy",
"path": "sympy/physics/quantum/qft.py",
"copies": "34",
"size": "6297",
"license": "bsd-3-clause",
"hash": -4286954834484160500,
"line_mean": 28.7028301887,
"line_max": 83,
"alpha_frac": 0.5772590122,
"autogenerated": false,
"ratio": 3.688927943760984,
"config... |
"""An implementation of qubits and gates acting on them.
Todo:
* Update docstrings.
* Update tests.
* Implement apply using decompose.
* Implement represent using decompose or something smarter. For this to work
we first have to implement represent for SWAP.
* Decide if we want upper index to be inclusive in the con... | {
"repo_name": "tarballs-are-good/sympy",
"path": "sympy/physics/quantum/qft.py",
"copies": "1",
"size": "6181",
"license": "bsd-3-clause",
"hash": -285427498167477280,
"line_mean": 29.0048543689,
"line_max": 92,
"alpha_frac": 0.5859893221,
"autogenerated": false,
"ratio": 3.6423099587507366,
"c... |
'''An implementation of several types of Restricted Boltzmann Machines.
This code is largely based on the Matlab generously provided by Taylor, Hinton
and Roweis, and described in their 2006 NIPS paper, "Modeling Human Motion Using
Binary Hidden Variables". Their code and results are available online at
http://www.cs.... | {
"repo_name": "mertyildiran/Cerebrum",
"path": "cerebrum/neuralnet/elements/rbm.py",
"copies": "1",
"size": "17740",
"license": "mit",
"hash": 7332081787800155000,
"line_mean": 33.7162426614,
"line_max": 111,
"alpha_frac": 0.7040586246,
"autogenerated": false,
"ratio": 3.1554606901458557,
"conf... |
# An implementation of Speck32/64
from collections import namedtuple, defaultdict
import speck32_64
DiffPair = namedtuple('DifferentialPair', ['p1', 'c1', 'p2', 'c2'])
def main():
speck32_64.ROUNDS = 3
plaintext = 0x12345678
diff = 0x00400000
keytext = 0x1918111009080100
epoch = 500
pairs = []
round_ke... | {
"repo_name": "elliptic-shiho/crypto_misc",
"path": "Speck/pure_diff.py",
"copies": "1",
"size": "1515",
"license": "mit",
"hash": 1359774719850077700,
"line_mean": 25.1206896552,
"line_max": 75,
"alpha_frac": 0.6369636964,
"autogenerated": false,
"ratio": 2.495881383855025,
"config_test": fals... |
# An implementation of Speck32/64
# params
k = 16
alpha = 7
beta = 2
MOD = 2**k
MASK = MOD - 1
ROUNDS = 22
def rol(x, y):
assert 0 < y < k, "Can't shift by negative negative shifts"
return ((x << y) & MASK) | (x >> (k - y))
def ror(x, y):
assert 0 < y < k, "Can't shift by negative negative shifts"
return r... | {
"repo_name": "elliptic-shiho/crypto_misc",
"path": "Speck/speck32_64.py",
"copies": "1",
"size": "1611",
"license": "mit",
"hash": -3113466928769063400,
"line_mean": 18.6463414634,
"line_max": 61,
"alpha_frac": 0.573556797,
"autogenerated": false,
"ratio": 2.5410094637223977,
"config_test": fa... |
"""An implementation of SumBasic Algorithm (Partial for sentence selection).
Ref: Nenkova A, Vanderwende L. The impact of frequency on summarization[J].
Microsoft Research, Redmond, Washington, Tech.
Rep. MSR-TR-2005-101, 2005.
Code: Bo
"""
import os
import nltk
import math
import string
import operator
from... | {
"repo_name": "bwanglzu/Automatic_Question_Generation",
"path": "aqg/utils/sentence_selection.py",
"copies": "1",
"size": "5565",
"license": "mit",
"hash": 6004704151349350000,
"line_mean": 34,
"line_max": 92,
"alpha_frac": 0.6143755615,
"autogenerated": false,
"ratio": 4.656903765690377,
"conf... |
"""An implementation of tabbed pages using only standard Tkinter.
Originally developed for use in IDLE. Based on tabpage.py.
Classes exported:
TabbedPageSet -- A Tkinter implementation of a tabbed-page widget.
TabSet -- A widget containing tabs (buttons) in one or more rows.
"""
from tkinter import *
class InvalidN... | {
"repo_name": "MalloyPower/parsing-python",
"path": "front-end/testsuite-python-lib/Python-3.6.0/Lib/idlelib/tabbedpages.py",
"copies": "4",
"size": "18375",
"license": "mit",
"hash": 1623215505980680200,
"line_mean": 35.8975903614,
"line_max": 80,
"alpha_frac": 0.5680544218,
"autogenerated": false... |
"""An implementation of tabbed pages using only standard Tkinter.
Originally developed for use in IDLE. Based on tabpage.py.
Classes exported:
TabbedPageSet -- A Tkinter implementation of a tabbed-page widget.
TabSet -- A widget containing tabs (buttons) in one or more rows.
"""
from Tkinter import *
cla... | {
"repo_name": "Southpaw-TACTIC/Team",
"path": "src/python/Lib/idlelib/tabbedpages.py",
"copies": "6",
"size": "18678",
"license": "epl-1.0",
"hash": 6106131278314845000,
"line_mean": 36.1183673469,
"line_max": 80,
"alpha_frac": 0.5530035336,
"autogenerated": false,
"ratio": 4.030643072939146,
"... |
# An implementation of the activity selction problem, in which we are given a list of activities
# with start time and end time, and then determine the max amount of activities that can be
# chosen in a certain time frame.
# The input will be of the following format:
# Time frame: {start time} {end time}
# Number ... | {
"repo_name": "pybae/etc",
"path": "Algorithms/activity_selection.py",
"copies": "1",
"size": "1584",
"license": "mit",
"hash": 6930080188253518000,
"line_mean": 35,
"line_max": 96,
"alpha_frac": 0.6710858586,
"autogenerated": false,
"ratio": 3.4813186813186814,
"config_test": false,
"has_no_... |
"""An implementation of the Broyden solver for multi-dimensional root finding
"""
import time
import numpy as np
from frankenstein.tools.io_utils import dumpVec, dumpMat
def broyden_man(func, x0, params=None, B0=None, max_step=1., \
max_iter=100, xconv=5, fconv=6):
"""
Inp:
func (functor):
... | {
"repo_name": "hongzhouye/frankenstein",
"path": "tools/broyden_man.py",
"copies": "1",
"size": "4820",
"license": "bsd-3-clause",
"hash": 8361719442901948000,
"line_mean": 28.7530864198,
"line_max": 77,
"alpha_frac": 0.4991701245,
"autogenerated": false,
"ratio": 3.299110198494182,
"config_tes... |
"""An implementation of the Context Tree Switching model.
The Context Tree Switching algorithm (Veness et al., 2012) is a variable
order Markov model with pleasant regret guarantees. It achieves excellent
performance over binary, and more generally small alphabet data.
This is a fairly vanilla implementation with rea... | {
"repo_name": "mgbellemare/SkipCTS",
"path": "python/cts/model.py",
"copies": "1",
"size": "20650",
"license": "apache-2.0",
"hash": -1822773059174891500,
"line_mean": 37.2407407407,
"line_max": 80,
"alpha_frac": 0.5847457627,
"autogenerated": false,
"ratio": 4.50971827910024,
"config_test": fa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.