text stringlengths 0 1.05M | meta dict |
|---|---|
# a^2 + b^2 = c^2
# a + b + c = p(erimeter)
# c = p-a-b
# a^2 + b^2 = (p-a-b)^2
# b = p(p-2a) / 2(p-a)
def checkValidTri(a,b,c):
if (a**2 + b**2) == c**2:
return True
else: return False
def checkValidAns(a,b,c,p):
if (a+b+c)==p:
return True
else: return False
def getC(a,b):
return... | {
"repo_name": "jamtot/PyProjectEuler",
"path": "39 - Integer right triangles/irt.py",
"copies": "1",
"size": "1392",
"license": "mit",
"hash": -2859073560607884000,
"line_mean": 22.2,
"line_max": 67,
"alpha_frac": 0.4640804598,
"autogenerated": false,
"ratio": 2.835030549898167,
"config_test": ... |
# A 2 player rock-paper-scissors game
# player a inputs one of three choices
# and then, second player does the same
# valid inputs for rock are 'r', 'rock', and 'sang' (in persian)
# also for paper we have 'p', 'paper', and 'kaghaz'
# and finally 's', 'scissors' and 'gheichi' could refer to scissors
#
# in fa... | {
"repo_name": "iamvee/Python-Course",
"path": "Topics/01.Conditions/RockPaper1.py",
"copies": "1",
"size": "1283",
"license": "mit",
"hash": -4291881526591991300,
"line_mean": 30.8974358974,
"line_max": 67,
"alpha_frac": 0.6196414653,
"autogenerated": false,
"ratio": 2.935926773455378,
"config_... |
# A3C -- in progress!
from network import *
class PolicyVNetwork(Network):
def __init__(self, conf):
""" Set up remaining layers, objective and loss functions, gradient
compute and apply ops, network parameter synchronization ops, and
summary ops. """
super(PolicyVNetwork, self... | {
"repo_name": "traai/async-deep-rl",
"path": "algorithms/policy_v_network.py",
"copies": "1",
"size": "6869",
"license": "apache-2.0",
"hash": -4119399797232279600,
"line_mean": 45.7278911565,
"line_max": 108,
"alpha_frac": 0.5147765322,
"autogenerated": false,
"ratio": 3.88737973967176,
"confi... |
"""A 3D vector class which matches Valve conventions.
>>> Vec(1, 2, 3)
Vec(1, 2, 3)
>>> Vec(1, 2, 3) * 2
Vec(2, 4, 6)
>>> Vec.from_str('<4 2 -45>')
Vec(4, 2, -45)
Vectors support arithmetic with scalars, applying the operation to the three
components.
Call Vec.as_tuple() to get a tuple-version... | {
"repo_name": "TeamSpen210/srctools",
"path": "srctools/math.py",
"copies": "1",
"size": "59679",
"license": "unlicense",
"hash": -2966240907222309400,
"line_mean": 31.6650246305,
"line_max": 107,
"alpha_frac": 0.5255449991,
"autogenerated": false,
"ratio": 3.5210926898342083,
"config_test": fa... |
a = 3 # type: str
#? str()
a
b = 3 # type: str but I write more
#? int()
b
c = 3 # type: str # I comment more
#? str()
c
d = "It should not read comments from the next line"
# type: int
#? str()
d
# type: int
e = "It should not read comments from the previous line"
#? str()
e
class BB: pass
def test(a, b):
... | {
"repo_name": "NcLang/vimrc",
"path": "sources_non_forked/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/test/completion/pep0484_comments.py",
"copies": "2",
"size": "1669",
"license": "mit",
"hash": -6595779478990166000,
"line_mean": 14.3119266055,
"line_max": 79,
"alpha_frac": 0.51... |
a = [-5,9]
b = [-4,7]
c = [-3,4]
d = [-2,2]
e = [-1,1]
f = [0,0]
g = [1,1]
h = [2,2]
i = [3,4]
j = [4,7]
k = [5,9]
l = [6,12]
A = [a,b,c,d,e,f,g,h,i,j,k,l]
def Transpose(A):
l1=[]
for i in range(len(A[0])):
l2=[]
for j in range(len(A)):
value = A[j][i]
l2.append(value)
... | {
"repo_name": "newmangonzala/Python-Projects",
"path": "crossValidation.py",
"copies": "1",
"size": "4258",
"license": "mit",
"hash": 5514317151605293000,
"line_mean": 20.8358974359,
"line_max": 70,
"alpha_frac": 0.4560826679,
"autogenerated": false,
"ratio": 2.878972278566599,
"config_test": t... |
#a='61.159.140.123 - - [23/Aug/2014:00:01:42 +0800] "GET /favicon.ico HTTP/1.1" 404 \ "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36 LBBROWSER" "-"'
line_dict={}
line = open('www_access.log','r')
for i in line:
b= i.split(' ')
key = (b[0],b[6],b[8])
... | {
"repo_name": "51reboot/actual_09_homework",
"path": "03/xionghuihui/top_log10.py",
"copies": "1",
"size": "1772",
"license": "mit",
"hash": -8426590600778502000,
"line_mean": 27.5806451613,
"line_max": 208,
"alpha_frac": 0.5101580135,
"autogenerated": false,
"ratio": 2.5170454545454546,
"confi... |
A = 6.9107755 # -ln(0.001)
B = 4.7105307 # -ln(0.009)
C = 2.5133061 # -ln(0.081)
D = 0.3160815 # -ln(0.729)
routes = []
def dijkstra(graph, src, dest, visited=[], distances={}, predecessors={}):
if src not in graph:
raise TypeError('The root of the shortest path tree cannot be fou... | {
"repo_name": "LittleBun/Personal",
"path": "EE618/hw2.py",
"copies": "1",
"size": "3058",
"license": "unlicense",
"hash": -237437106050191650,
"line_mean": 28.6893203883,
"line_max": 78,
"alpha_frac": 0.4401569653,
"autogenerated": false,
"ratio": 3.1689119170984457,
"config_test": false,
"h... |
"""A98 RGB color class."""
from ._space import RE_DEFAULT_MATCH
from .srgb import SRGB
from .xyz import XYZ
from . import _convert as convert
from .. import util
import re
import math
def lin_a98rgb_to_xyz(rgb):
"""
Convert an array of linear-light a98-rgb values to CIE XYZ using D50.D65.
(so no chromati... | {
"repo_name": "dmilith/SublimeText3-dmilith",
"path": "Packages/mdpopups/st3/mdpopups/coloraide/colors/a98_rgb.py",
"copies": "1",
"size": "2071",
"license": "mit",
"hash": -6456953194400418000,
"line_mean": 28.1690140845,
"line_max": 104,
"alpha_frac": 0.6619990343,
"autogenerated": false,
"rati... |
"""A98 RGB color class."""
from ..spaces import RE_DEFAULT_MATCH
from ..spaces import _cat
from .srgb import SRGB
from .xyz import XYZ
from .. import util
import re
import math
def lin_a98rgb_to_xyz(rgb):
"""
Convert an array of linear-light a98-rgb values to CIE XYZ using D50.D65.
(so no chromatic adapt... | {
"repo_name": "facelessuser/sublime-markdown-popups",
"path": "st3/mdpopups/coloraide/spaces/a98_rgb.py",
"copies": "1",
"size": "2047",
"license": "mit",
"hash": -6484839432329325000,
"line_mean": 27.8309859155,
"line_max": 104,
"alpha_frac": 0.6580361505,
"autogenerated": false,
"ratio": 2.7737... |
"""A98 RGB color class."""
from ..spaces import RE_DEFAULT_MATCH
from ..spaces import _cat
from .srgb import SRGB
from .xyz import XYZ
from .. import util
import re
def lin_a98rgb_to_xyz(rgb):
"""
Convert an array of linear-light a98-rgb values to CIE XYZ using D50.D65.
(so no chromatic adaptation needed... | {
"repo_name": "facelessuser/ColorHelper",
"path": "lib/coloraide/spaces/a98_rgb.py",
"copies": "1",
"size": "1999",
"license": "mit",
"hash": -9157492764690160000,
"line_mean": 27.5571428571,
"line_max": 104,
"alpha_frac": 0.6588294147,
"autogenerated": false,
"ratio": 2.7610497237569063,
"conf... |
a = 'A1213pokl'
b = 'bAse730onE'
c = 'asasasasasasasaas'
d = 'QWERTYqwerty'
e = '123456123456'
f = 'QwErTy911poqqqq'
#---------------My Solution-----------------#
def checkio(password):
lower = "abcdefghijklmnopqrstuvwxyz"
upper = lower.upper()
boollower = False
boolupper = False
boolnum = False
... | {
"repo_name": "ismk/Python-Examples",
"path": "checkio.py",
"copies": "1",
"size": "1117",
"license": "mit",
"hash": 976909252119754500,
"line_mean": 21.3125,
"line_max": 53,
"alpha_frac": 0.57564906,
"autogenerated": false,
"ratio": 3.1914285714285713,
"config_test": false,
"has_no_keywords"... |
# aa436.py
#
# This is the Agent for Project 436. An instance of aa436.py runs
# on every host to be monitored. After an aa436.py Agent is started it will:
# - Listen for UDP "I am here" broadcast notifications from ax436.py Servers.
# - Request configuration from the first ax436.py Server that it finds.
# - Commence... | {
"repo_name": "chrisbristow/project-436",
"path": "aa436.py",
"copies": "1",
"size": "19655",
"license": "bsd-2-clause",
"hash": 2314344826890936000,
"line_mean": 31.9229480737,
"line_max": 220,
"alpha_frac": 0.5937420504,
"autogenerated": false,
"ratio": 3.398167358229599,
"config_test": true,... |
#aaaa
import math
import time
import sys
from gps import Gps
def convert_image_location_to_waypoints( current_location, x_size, y_size, x_loc, y_loc): #altitude in meters
'''
creates triangular waypoints from a point in a rectangle and a current gps location
current_location is gps object
x_size, y_size, x_... | {
"repo_name": "alpsayin/python-gps",
"path": "waypoint_calculator.py",
"copies": "1",
"size": "2541",
"license": "mit",
"hash": -6527666918374419000,
"line_mean": 27.8863636364,
"line_max": 109,
"alpha_frac": 0.6654860291,
"autogenerated": false,
"ratio": 2.5384615384615383,
"config_test": fals... |
#aaaa
import getpass
import datetime
def tool(n):
namelist = ['osman','mahmut','sarpulas']
pwlist = ['namso','tumham','salupras']
username = raw_input('Enter username:\n')
print "uname: ", username;
if username in namelist:
i = namelist.index(username)
pw = getpass.getpass(prompt='Enter pass... | {
"repo_name": "sarpulas/idLog",
"path": "aaa.py",
"copies": "1",
"size": "1158",
"license": "mit",
"hash": -5506614869902112000,
"line_mean": 23.6595744681,
"line_max": 114,
"alpha_frac": 0.5898100173,
"autogenerated": false,
"ratio": 3.376093294460641,
"config_test": false,
"has_no_keywords"... |
# Aaargh 0.4
# Taken from https://github.com/wbolster/aaargh
# BSD License per setup.py
"""
Aaargh, an astonishingly awesome application argument helper
"""
from argparse import ArgumentParser
_NO_FUNC = object()
__all__ = ['App', '__version__']
# XXX: Keep version number in sync with setup.py
__version__ = '0.4'... | {
"repo_name": "splunk/splunk-webframework",
"path": "contrib/aaargh/aaargh.py",
"copies": "1",
"size": "5564",
"license": "apache-2.0",
"hash": -5328062065047802000,
"line_mean": 33.5652173913,
"line_max": 78,
"alpha_frac": 0.6035226456,
"autogenerated": false,
"ratio": 4.523577235772358,
"conf... |
# AABB collision example
# KidsCanCode 2016
import pygame as pg
vec = pg.math.Vector2
WIDTH = 800
HEIGHT = 600
FPS = 60
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0, 128)
GREEN = (0, 255, 0, 128)
CYAN = (0, 255, 255, 128)
YELLOW = (255, 255, 0)
LIGHTGRAY = (150, 150, 150)
DARKGRAY = (40, 40, 40)
def dr... | {
"repo_name": "kidscancode/gamedev",
"path": "tutorials/examples/aabb example.py",
"copies": "1",
"size": "2898",
"license": "mit",
"hash": 890904721168602800,
"line_mean": 28.8762886598,
"line_max": 82,
"alpha_frac": 0.5600414079,
"autogenerated": false,
"ratio": 2.670967741935484,
"config_tes... |
>>> a = ['a', 'b', 'c', 'd', 'e']
>>> for index, item in enumerate(a): print index, item # enumerate function will generate an index for the item + item it self.
...
0 a
1 b
2 c
3 d
4 e
#convert a list to string:
list1 = ['1', '2', '3']
str1 = ''.join(list1)
Or if the list is of integers, convert the elements be... | {
"repo_name": "ujjwalkarn/DataSciencePython",
"path": "basic_commands.py",
"copies": "1",
"size": "1533",
"license": "mit",
"hash": 7758785390209645000,
"line_mean": 17.9259259259,
"line_max": 128,
"alpha_frac": 0.6614481409,
"autogenerated": false,
"ratio": 2.8654205607476637,
"config_test": f... |
"""A abstract virtual machine for python bytecode that generates typegraphs.
A VM for python byte code that uses pytype/pytd/cfg ("typegraph") to generate a
trace of the program execution.
"""
# We have names like "byte_NOP":
# pylint: disable=invalid-name
# Bytecodes don't always use all their arguments:
# pylint: ... | {
"repo_name": "pombredanne/pytype",
"path": "pytype/vm.py",
"copies": "1",
"size": "76296",
"license": "apache-2.0",
"hash": 1407455150932517600,
"line_mean": 35.8757854036,
"line_max": 80,
"alpha_frac": 0.6433626927,
"autogenerated": false,
"ratio": 3.55775238983446,
"config_test": false,
"h... |
a = [{'accountId': 36364,
'bareMetalInstanceFlag': 0,
'datacenter': {'id': 3, 'longName': 'Dallas', 'name': 'dal01'},
'domain': 'playdom.com',
'fullyQualifiedDomainName': 'alert-mta-02.playdom.com',
'hardwareStatusId': 5,
'hostname': 'alert-mta-02',
'id': 102434,
'manufacturerSer... | {
"repo_name": "thomasvincent/utilities",
"path": "Standalone_Scripts/softlayer_iphostloc_puller/unused_source/demodict.py",
"copies": "1",
"size": "4606",
"license": "apache-2.0",
"hash": 3572778885764497000,
"line_mean": 48.5376344086,
"line_max": 104,
"alpha_frac": 0.3651758576,
"autogenerated": ... |
# Copyright (c) 2020 Peter Hinch
# Released under the MIT License (MIT) - see LICENSE file
import uasyncio as asyncio
import io
MP_STREAM_POLL_RD = const(1)
MP_STREAM_POLL = const(3)
MP_STREAM_ERROR = const(-1)
class AADC(io.IOBase):
def __init__(self, adc):
self._adc = adc
self._lower = 0
... | {
"repo_name": "peterhinch/micropython-async",
"path": "v3/primitives/aadc.py",
"copies": "1",
"size": "2011",
"license": "mit",
"hash": 1920003651234519000,
"line_mean": 29.0149253731,
"line_max": 79,
"alpha_frac": 0.5638985579,
"autogenerated": false,
"ratio": 3.808712121212121,
"config_test":... |
a = a # e 4
a = 1 # 0 int
l = [a] # 0 [int]
d = {a:l} # 0 {int:[int]}
s = "abc"
c = ord(s[2].lower()[0]) # 0 int # 4 (str) -> int
l2 = [range(i) for i in d] # 0 [[int]]
y = [(a,b) for a,b in {1:'2'}.iteritems()] # 0 [(int,str)]
b = 1 # 0 int
if 0:
b = '' # 4 str
else:
b = str(b) # 4 str # 12 int
... | {
"repo_name": "kmod/icbd",
"path": "icbd/type_analyzer/tests/basic.py",
"copies": "1",
"size": "1818",
"license": "mit",
"hash": -7669605874459881000,
"line_mean": 16.1509433962,
"line_max": 58,
"alpha_frac": 0.4416941694,
"autogenerated": false,
"ratio": 1.9527389903329753,
"config_test": fals... |
# aagen.geometry - module encapsulating interactions with the Shapely library.
import logging
import math
import re
import ast
from aagen.direction import Direction
from shapely.coords import CoordinateSequence
from shapely.geometry.point import Point
from shapely.geometry.linestring import LineString
from shapely.g... | {
"repo_name": "glennmatthews/aagen",
"path": "aagen/geometry.py",
"copies": "1",
"size": "56617",
"license": "mit",
"hash": 5207080264397008000,
"line_mean": 38.4543554007,
"line_max": 80,
"alpha_frac": 0.5547980289,
"autogenerated": false,
"ratio": 3.65766522385167,
"config_test": false,
"ha... |
"""A alternate implementation of the persistent dict found in
http://erezsh.wordpress.com/2009/05/24/filedict-a-persistent-dictionary-in-python/
"""
import sqlite3, UserDict, pickle
def key(k):
return hash(k), pickle.dumps(k)
class persistentDict(UserDict.DictMixin):
def __init__(self, filetable, d=None, **... | {
"repo_name": "zepheira/zenpub",
"path": "lib/persistentdict.py",
"copies": "2",
"size": "2517",
"license": "apache-2.0",
"hash": 7994470178415378000,
"line_mean": 35.4927536232,
"line_max": 110,
"alpha_frac": 0.5613825983,
"autogenerated": false,
"ratio": 3.396761133603239,
"config_test": fals... |
# AAR Natural Language Processing/Machine Learning Project 2015-2016
# Summarizes text using tf-idf technique
# Written by Gautam Mittal
# Mentor: Robert Cheung
# Requires Node.js and Python 2.7
from __future__ import division
import math
from textblob import TextBlob as tb
def tf(word, blob):
return blob.words.c... | {
"repo_name": "gmittal/aar-nlp-research-2016",
"path": "summarize.py",
"copies": "1",
"size": "2003",
"license": "mit",
"hash": -6764328423177965000,
"line_mean": 32.3833333333,
"line_max": 94,
"alpha_frac": 0.6345481777,
"autogenerated": false,
"ratio": 3.383445945945946,
"config_test": false,... |
# AAR Natural Language Processing/Machine Learning Project 2015-2016
# Takes plaintext as input and illustrates interpretation
# Written by Gautam Mittal
# Mentor: Robert Cheung
# Requires Node.js and Python 2.7
# $ npm install && pip install -r requirements.txt
import os, json, uuid, urllib, errno, requests
from os.... | {
"repo_name": "gmittal/aar-nlp-research-2016",
"path": "illustrate.py",
"copies": "1",
"size": "2505",
"license": "mit",
"hash": -2195621201175721200,
"line_mean": 29.9259259259,
"line_max": 109,
"alpha_frac": 0.6031936128,
"autogenerated": false,
"ratio": 3.7276785714285716,
"config_test": fal... |
# AAR Natural Language Processing Project 2015-2016
# Takes plaintext as input and illustrates interpretation
# Written by Gautam Mittal
# Mentor: Robert Cheung
# Requires NLTK and its respective corpora
import re
import nltk
from nltk import CFG, ChartParser, RegexpParser
from nltk.corpus import stopwords, conll2000
... | {
"repo_name": "gmittal/aar-nlp-research-2016",
"path": "text_parse.py",
"copies": "1",
"size": "5047",
"license": "mit",
"hash": 6458818097905399000,
"line_mean": 34.5422535211,
"line_max": 117,
"alpha_frac": 0.5908460472,
"autogenerated": false,
"ratio": 3.526904262753319,
"config_test": false... |
# Aaron Reyes
# MIT license
import os
import time
import urllib
import random
import base64
import ctypes
import ctypes.util
# name of logger program on file system
LOGGER_NAME='.bash_xkey'
# remote logging URL
REMOTE_LOG_URL='<google scripts url here>?{0}'
# load library
x11 = ctypes.cdll.LoadLibrary(ctypes.util.fi... | {
"repo_name": "a-rey/bitflip",
"path": "keylogger/unix/logger.py",
"copies": "1",
"size": "2717",
"license": "mit",
"hash": 2334387897977272000,
"line_mean": 21.8319327731,
"line_max": 155,
"alpha_frac": 0.4729481045,
"autogenerated": false,
"ratio": 2.6225868725868726,
"config_test": false,
... |
aas
asa
sas
import asposewordscloud
from asposewordscloud.WordsApi import WordsApi
from asposewordscloud.models import SaveOptionsData
import asposestoragecloud
from asposestoragecloud.StorageApi import StorageApi
from asposestoragecloud.StorageApi import ResponseMessage
apiKey = "XXXXX" #sepcify App Key
appSid = "X... | {
"repo_name": "asposewords/Aspose_Words_Cloud",
"path": "Examples/Python/Examples/ConvertDocumentAnyFormatThirdPartyStorage.py",
"copies": "2",
"size": "1362",
"license": "mit",
"hash": 471035402669402240,
"line_mean": 32.2195121951,
"line_max": 88,
"alpha_frac": 0.7635829662,
"autogenerated": fals... |
aasta = int(input("Sisesta väljalaskeeaasta: "))
f = open("autod.csv", encoding="UTF-8")
# eemaldan (st. loen eest ära) päiserea
f.readline()
# korjan siia sõnastikku selle aasta mudelite arvud
mudelite_arvud = {}
for rida in f:
jupid = rida.split(";")
# tegelen ainult nende ridadega, mis käivad näidatud ... | {
"repo_name": "macobo/python-grader",
"path": "tasks/MTAT.03.100/2013/Midterm_1/KT2_N10_autod_solution.py",
"copies": "1",
"size": "1196",
"license": "mit",
"hash": 3819378580953038300,
"line_mean": 25.8409090909,
"line_max": 68,
"alpha_frac": 0.6316680779,
"autogenerated": false,
"ratio": 2.3667... |
__a__author__ = 'Ness'
from pylab import *
from numpy import *
''' ----Background
The envelope generators are incharge of the modulation of the sound amplitude in
4 main stages during the sound life cycle.
_____________________________________________ For a basic functional prototype, this module requires of
| Att... | {
"repo_name": "nessBautista/AudioLab",
"path": "prototypes/SoundSynthesis/BasicEnvelopeGenerator.py",
"copies": "1",
"size": "5110",
"license": "cc0-1.0",
"hash": -6365594492089477000,
"line_mean": 31.9677419355,
"line_max": 122,
"alpha_frac": 0.6555772994,
"autogenerated": false,
"ratio": 3.4573... |
#aAvg,aMax,aMin,aP2P,aStd,gAvg,gMax,gMin,gP2P,gStd
ed = {}
ed['aAvg'] = 1.29104272266
ed['aMax'] = 10.3381593065
ed['aMin'] = 0.0566837541211
ed['aP2P'] = 10.2814755524
ed['aStd'] = 2.0007211641
ed['gAvg'] = 200.329659457
ed['gMax'] = 443.405006738
ed['gMin'] = 3.64189053916
ed['gP2P'] = 439.763116198
ed['gStd'] = 18... | {
"repo_name": "cagdasyelen/fall-detection-engine",
"path": "src/DecisionTree.py",
"copies": "1",
"size": "1120",
"license": "apache-2.0",
"hash": -5140749373602360000,
"line_mean": 17.3770491803,
"line_max": 50,
"alpha_frac": 0.4982142857,
"autogenerated": false,
"ratio": 2.101313320825516,
"co... |
"""A backend for the Elasticsearch search engine."""
from __future__ import unicode_literals
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext, ugettext_lazy as _
from reviewboard.search.search_backends.base import (SearchBackend,
... | {
"repo_name": "davidt/reviewboard",
"path": "reviewboard/search/search_backends/elasticsearch.py",
"copies": "2",
"size": "1920",
"license": "mit",
"hash": 4563333462785929700,
"line_mean": 32.6842105263,
"line_max": 72,
"alpha_frac": 0.6260416667,
"autogenerated": false,
"ratio": 4.6943765281173... |
"""A backend for the Elasticsearch search engine."""
from __future__ import unicode_literals
from importlib import import_module
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext, ugettext_lazy as _
from reviewboard.search.search_backends.base ... | {
"repo_name": "reviewboard/reviewboard",
"path": "reviewboard/search/search_backends/elasticsearch.py",
"copies": "2",
"size": "2463",
"license": "mit",
"hash": 2759170254638927000,
"line_mean": 34.6956521739,
"line_max": 77,
"alpha_frac": 0.6224116931,
"autogenerated": false,
"ratio": 4.59514925... |
"""A backend for the Whoosh search engine."""
from __future__ import unicode_literals
import os
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from reviewboard.search.search_backends.base import (Se... | {
"repo_name": "davidt/reviewboard",
"path": "reviewboard/search/search_backends/whoosh.py",
"copies": "2",
"size": "1940",
"license": "mit",
"hash": -6161785956209922000,
"line_mean": 31.8813559322,
"line_max": 77,
"alpha_frac": 0.6087628866,
"autogenerated": false,
"ratio": 4.301552106430155,
... |
"""A backend request handler process.
This file uses zmq.web to implement the backend logic for load balanced
Tornado request handlers.
This version uses a streaming message protocol to enable the backend to send
the HTTP body back to the frontend/browser in multiple asynchronous chunks.
To enable streaming mode, you... | {
"repo_name": "ellisonbg/zmqweb",
"path": "examples/backend_stream.py",
"copies": "1",
"size": "3064",
"license": "bsd-3-clause",
"hash": 7320632415571708000,
"line_mean": 34.6279069767,
"line_max": 93,
"alpha_frac": 0.6543733681,
"autogenerated": false,
"ratio": 4.074468085106383,
"config_test... |
"""A backport of ChainMap from Python 3 to Python 2.
See http://hg.python.org/cpython/file/default/Lib/collections/__init__.py#l756
for original source code. Everything here is lifted directly from there.
"""
from collections import MutableMapping
class ChainMap(MutableMapping):
"""A ChainMap groups multipl... | {
"repo_name": "justanr/Py2ChainMap",
"path": "__init__.py",
"copies": "1",
"size": "3942",
"license": "mit",
"hash": 8991983741950350000,
"line_mean": 29.796875,
"line_max": 96,
"alpha_frac": 0.5915778792,
"autogenerated": false,
"ratio": 4.072314049586777,
"config_test": false,
"has_no_keywo... |
""" A backport of ChainMap from Python 3 to Python 2.
From https://github.com/justanr/Py2ChainMap
See http://hg.python.org/cpython/file/default/Lib/collections/__init__.py#l756
For original source code. Everything here is lifted directly from there.
"""
from collections import MutableMapping
class ChainMap(Mut... | {
"repo_name": "jonathaneunice/Py2ChainMap",
"path": "py2chainmap.py",
"copies": "2",
"size": "3988",
"license": "bsd-3-clause",
"hash": -723510244105619000,
"line_mean": 30.15625,
"line_max": 96,
"alpha_frac": 0.593781344,
"autogenerated": false,
"ratio": 4.048730964467005,
"config_test": false... |
"""abacus_edu URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/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": "jupiny/abacus-edu",
"path": "abacus_edu/abacus_edu/urls.py",
"copies": "1",
"size": "1404",
"license": "mit",
"hash": -4098792528479811000,
"line_mean": 33.243902439,
"line_max": 79,
"alpha_frac": 0.7015669516,
"autogenerated": false,
"ratio": 3.518796992481203,
"config_test": fa... |
# A Banking account for the Bank X
# Some algorithms were created just to demonstrate basic methods
Birthday_data = {'David': '03.03.1994', 'George': '12.01.1991', 'Andrey': '09/05/1990'}
SSN = {'David': '23423443', 'George': '343423423', 'Andrey': '34333432'}
Account_Type = {'David': 'Checking', 'George': 'Saving', '... | {
"repo_name": "MicBrain/Bank_Account_Sample",
"path": "bank.py",
"copies": "1",
"size": "8206",
"license": "mit",
"hash": -4838618070273833000,
"line_mean": 25.2172523962,
"line_max": 103,
"alpha_frac": 0.6295393614,
"autogenerated": false,
"ratio": 2.9560518731988474,
"config_test": false,
"... |
#abAPI
#This API contains the definition of the Angry Birds as an approximate MDP (define states and their successors
# by manipulating the AngryBirdsGame class in AngryBirds.py). We also define a simplified version of the Game States
# by extracting all necessary information to run algorthms.
import os
import sys
i... | {
"repo_name": "imanolarrieta/angrybirds",
"path": "src/abAPI.py",
"copies": "1",
"size": "4277",
"license": "mit",
"hash": 4899484799628583000,
"line_mean": 30.6814814815,
"line_max": 164,
"alpha_frac": 0.6259060089,
"autogenerated": false,
"ratio": 3.81875,
"config_test": false,
"has_no_keyw... |
"""A bare-bones but effective way to run a target callable in parallel
using multiple processes.
POSIX specific.
The reason I opted to use this rather than 'import multiprocessing' is
that multiprocessing uses threads to listen in the background for
results returning on kids' sockets. If possible, I would rather not
... | {
"repo_name": "yaniv-aknin/labour",
"path": "labour/tester/multicall.py",
"copies": "1",
"size": "4096",
"license": "mit",
"hash": -3151217383089081000,
"line_mean": 33.7118644068,
"line_max": 94,
"alpha_frac": 0.6525878906,
"autogenerated": false,
"ratio": 3.775115207373272,
"config_test": fal... |
"""A barebones HTTP server example."""
import subprocess
import traceback
import util
class SimpleHTTPHandler(util.server.Server):
"""A hello world kind of an HTTP server."""
def process_request(self, connection, address):
"""Send the requested file to the connection socket."""
req = util.ht... | {
"repo_name": "cheeseywhiz/cheeseywhiz",
"path": "socket/httpsrv.py",
"copies": "1",
"size": "1590",
"license": "mit",
"hash": -4473114615410046500,
"line_mean": 32.125,
"line_max": 79,
"alpha_frac": 0.5918238994,
"autogenerated": false,
"ratio": 4.504249291784703,
"config_test": false,
"has_... |
""" A barebones workflow for experimentally probing a pretrained tensorflow
graph_def (*.pb) file.
"""
from __future__ import print_function, division
import numpy as np
import tensorflow as tf
# SETTINGS
tensorboard_dir = "/tmp/tf"
graph_file = "mygraph.pb"
tf_graph = tf.Graph()
with tf_graph.as_default():
... | {
"repo_name": "ronrest/convenience_py",
"path": "ml/tf/probe_graphdef_file.py",
"copies": "1",
"size": "2071",
"license": "apache-2.0",
"hash": 307577671181354600,
"line_mean": 28.1690140845,
"line_max": 82,
"alpha_frac": 0.6518590053,
"autogenerated": false,
"ratio": 3.303030303030303,
"config... |
# a bar plot with errorbars
import numpy as np
import matplotlib.pyplot as plt
import itertools
def bar_chart(mean_lists, std_lists, group_labels, tick_labels, colors_list=[], set_separation=.5, side_buffer=0.1):
'''
modified from http://matplotlib.org/examples/api/barchart_demo.html (May 10, 2015)
Th... | {
"repo_name": "drcgw/IPython-Big-Data",
"path": "Project-1-Sequencing/Master Notebook/multigroup_barchart.py",
"copies": "1",
"size": "4663",
"license": "bsd-3-clause",
"hash": -3943400293440957400,
"line_mean": 33.7985074627,
"line_max": 168,
"alpha_frac": 0.5640145829,
"autogenerated": false,
"... |
'''A Base64 Encodeing action for the Manipulate plugin for Coda'''
import cp_actions as cp
import base64
def act(controller, bundle, options):
'''
Required action method
Setting decode=True will decode instead of encoding
'''
context = cp.get_context(controller)
decode = cp.get_optio... | {
"repo_name": "bobthecow/ManipulateCoda",
"path": "src/Support/Scripts/Base64Encode.py",
"copies": "1",
"size": "1085",
"license": "mit",
"hash": 2854165040161782300,
"line_mean": 26.8461538462,
"line_max": 80,
"alpha_frac": 0.6147465438,
"autogenerated": false,
"ratio": 4.392712550607287,
"con... |
"""A base class for contents managers."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from fnmatch import fnmatch
import itertools
import json
import os
import re
from tornado.web import HTTPError, RequestHandler
from ...files.handlers import FilesHandler
fro... | {
"repo_name": "sserrot/champion_relationships",
"path": "venv/Lib/site-packages/notebook/services/contents/manager.py",
"copies": "1",
"size": "16942",
"license": "mit",
"hash": -1723043293957401300,
"line_mean": 30.8458646617,
"line_max": 132,
"alpha_frac": 0.5861763664,
"autogenerated": false,
... |
"""A base class for developing prototype ensemble methods
"""
from __future__ import print_function, division
import os
from datetime import datetime
import shutil
import threading
import time
import warnings
import numpy as np
import pandas as pd
import pyemu
from pyemu.en import ParameterEnsemble, ObservationEnsembl... | {
"repo_name": "jtwhite79/pyemu",
"path": "pyemu/prototypes/ensemble_method.py",
"copies": "1",
"size": "11306",
"license": "bsd-3-clause",
"hash": -9055395939496956000,
"line_mean": 36.3135313531,
"line_max": 94,
"alpha_frac": 0.5669555988,
"autogenerated": false,
"ratio": 3.850817438692098,
"c... |
""" A base class for RNN. """
import torch.nn as nn
class BaseRNN(nn.Module):
r"""
Applies a multi-layer RNN to an input sequence.
Note:
Do not use this class directly, use one of the sub classes.
Args:
vocab_size (int): size of the vocabulary
max_len (int): maximum allowed len... | {
"repo_name": "taras-sereda/pytorch-seq2seq",
"path": "seq2seq/models/baseRNN.py",
"copies": "1",
"size": "1714",
"license": "apache-2.0",
"hash": -7821490979932513000,
"line_mean": 34.7083333333,
"line_max": 105,
"alpha_frac": 0.6015169195,
"autogenerated": false,
"ratio": 3.726086956521739,
"... |
"""A base class for RPC services and proxies.
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2012. Brian Granger, Min Ragan-Kelley
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING.BSD, dist... | {
"repo_name": "ellisonbg/zpyrpc",
"path": "zpyrpc/base.py",
"copies": "1",
"size": "2496",
"license": "bsd-3-clause",
"hash": 6229002890283465000,
"line_mean": 32.7297297297,
"line_max": 87,
"alpha_frac": 0.4655448718,
"autogenerated": false,
"ratio": 5.461706783369803,
"config_test": false,
... |
"""A base class notebook manager.
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of th... | {
"repo_name": "marcoantoniooliveira/labweb",
"path": "oscar/lib/python2.7/site-packages/IPython/html/services/notebooks/nbmanager.py",
"copies": "2",
"size": "8907",
"license": "bsd-3-clause",
"hash": -8183609429854685000,
"line_mean": 36.9021276596,
"line_max": 84,
"alpha_frac": 0.6003143595,
"aut... |
"""A base class notebook manager.
Authors:
* Brian Granger
* Zach Sailer
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed... | {
"repo_name": "Lightmatter/django-inlineformfield",
"path": ".tox/py27/lib/python2.7/site-packages/IPython/html/services/notebooks/nbmanager.py",
"copies": "7",
"size": "9608",
"license": "mit",
"hash": -6648545500617689000,
"line_mean": 32.9505300353,
"line_max": 84,
"alpha_frac": 0.5611990008,
"a... |
"""A base class session manager.
Authors:
* Zach Sailer
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this ... | {
"repo_name": "omni5cience/django-inlineformfield",
"path": ".tox/py27/lib/python2.7/site-packages/IPython/html/services/sessions/sessionmanager.py",
"copies": "8",
"size": "6936",
"license": "mit",
"hash": -2603917421438935000,
"line_mean": 33.8542713568,
"line_max": 90,
"alpha_frac": 0.5415224913,
... |
"""A base class session manager."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import uuid
import sqlite3
from tornado import web
from IPython.config.configurable import LoggingConfigurable
from IPython.utils.py3compat import unicode_type
from IPython.utils.... | {
"repo_name": "mattvonrocketstein/smash",
"path": "smashlib/ipy3x/html/services/sessions/sessionmanager.py",
"copies": "1",
"size": "7542",
"license": "mit",
"hash": 2309167377603177500,
"line_mean": 34.7440758294,
"line_max": 82,
"alpha_frac": 0.5831344471,
"autogenerated": false,
"ratio": 4.607... |
"""A base class session manager."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import uuid
try:
import sqlite3
except ImportError:
# fallback on pysqlite2 if Python was build without sqlite
from pysqlite2 import dbapi2 as sqlite3
from t... | {
"repo_name": "nitin-cherian/LifeLongLearning",
"path": "Python/PythonProgrammingLanguage/Encapsulation/encap_env/lib/python3.5/site-packages/notebook/services/sessions/sessionmanager.py",
"copies": "5",
"size": "8745",
"license": "mit",
"hash": 2121340985598367200,
"line_mean": 35.1363636364,
"line_ma... |
"""A base class session manager."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import uuid
import sqlite3
from tornado import web
from traitlets.config.configurable import LoggingConfigurable
from ipython_genutils.py3compat import unicode_type
from traitlets... | {
"repo_name": "bdh1011/wau",
"path": "venv/lib/python2.7/site-packages/notebook/services/sessions/sessionmanager.py",
"copies": "1",
"size": "7514",
"license": "mit",
"hash": 4386023095671664600,
"line_mean": 35.125,
"line_max": 93,
"alpha_frac": 0.5830449827,
"autogenerated": false,
"ratio": 4.6... |
"""A base class session manager."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import uuid
try:
import sqlite3
except ImportError:
# fallback on pysqlite2 if Python was build without sqlite
from pysqlite2 import dbapi2 as sqlite3
from tornado imp... | {
"repo_name": "sserrot/champion_relationships",
"path": "venv/Lib/site-packages/notebook/services/sessions/sessionmanager.py",
"copies": "1",
"size": "10620",
"license": "mit",
"hash": -7185386996991418000,
"line_mean": 37.6181818182,
"line_max": 102,
"alpha_frac": 0.5959510358,
"autogenerated": fa... |
# A base file for use in fabfiles.
# This file is geared toward a particular directory structure on webfaction and in dev
# Some of it may be useful to other folks, but no guarantees.
# Local Structure
# /
# /db (sqllite for dev and dumps)
# /media
# /appname
# /source (psds and the like)
# Remote Structure (webfact... | {
"repo_name": "skoczen/qi-toolkit",
"path": "qi_toolkit/boltbase.py",
"copies": "1",
"size": "27252",
"license": "bsd-3-clause",
"hash": 542443995684853060,
"line_mean": 37.6553191489,
"line_max": 269,
"alpha_frac": 0.6307426978,
"autogenerated": false,
"ratio": 3.1006940493799067,
"config_test... |
"""A base for handling management of the h5 canvas backend.
Its jobs are as follows:
- Provide a standardised base port for clients to connect to
- Serve up the html wrapper page
- Provide a list of currently available plots (perhaps with a thumbnail)
- Manage the list of plots as time goes by
Simon Ratcliffe (sratcl... | {
"repo_name": "Hojalab/mplh5canvas",
"path": "mplh5canvas/management_server.py",
"copies": "3",
"size": "10812",
"license": "bsd-3-clause",
"hash": -6913254020046609000,
"line_mean": 47.7027027027,
"line_max": 755,
"alpha_frac": 0.589345172,
"autogenerated": false,
"ratio": 4.169687620516776,
"... |
# A baseline town agent.
from agents.navigation.agent import Agent, AgentState
import numpy as np
from agents.navigation.local_planner import LocalPlanner
class RoamingAgent(Agent):
"""
RoamingAgent implements a basic agent that navigates scenes making random
choices when facing an intersection.
This ... | {
"repo_name": "rail-berkeley/d4rl",
"path": "d4rl/carla/town_agent.py",
"copies": "1",
"size": "5344",
"license": "apache-2.0",
"hash": 6374876813106817000,
"line_mean": 34.6266666667,
"line_max": 116,
"alpha_frac": 0.6236901198,
"autogenerated": false,
"ratio": 3.8893740902474527,
"config_test... |
'''A base network for handling common arguments in cortex models.
This is not necessary to use cortex: these are just convenience networks.
'''
import torch.nn as nn
import torch
from .utils import apply_nonlinearity, get_nonlinearity, finish_layer_1d
class BaseNet(nn.Module):
'''Basic convenience network for... | {
"repo_name": "rdevon/cortex",
"path": "cortex/built_ins/networks/base_network.py",
"copies": "1",
"size": "2899",
"license": "bsd-3-clause",
"hash": 8793533040607533000,
"line_mean": 26.875,
"line_max": 73,
"alpha_frac": 0.5484649879,
"autogenerated": false,
"ratio": 3.9766803840877913,
"confi... |
"""A base Transformer.
Used by Convertor to perform actual transformation of a specfile.
Operates with transformer plugins defined in `transformers` package.
"""
import re
from spec2scl import specfile
class Transformer(object):
"""A base Transformer class.
Converts tags and macro definitions in a conven... | {
"repo_name": "sclorg/spec2scl",
"path": "spec2scl/transformer.py",
"copies": "2",
"size": "4517",
"license": "mit",
"hash": 4662356550640623000,
"line_mean": 36.6416666667,
"line_max": 100,
"alpha_frac": 0.6309497454,
"autogenerated": false,
"ratio": 4.41544477028348,
"config_test": false,
"... |
""" A basic class for approximation, integration, and optimization with
active subspaces."""
import numpy as np
from utils.misc import process_inputs_outputs, process_inputs
from utils.simrunners import SimulationRunner, SimulationGradientRunner
from utils.plotters import eigenvalues, subspace_errors, eigenvectors, suf... | {
"repo_name": "meyersw3476/active_subspaces",
"path": "active_subspaces/base.py",
"copies": "1",
"size": "22339",
"license": "mit",
"hash": -2519192052800470500,
"line_mean": 41.9596153846,
"line_max": 99,
"alpha_frac": 0.6447468553,
"autogenerated": false,
"ratio": 4.4244404832640125,
"config_... |
# A Basic Crawler that retrieves all followers of a user and sends the data to the Service Layer
#
# 12-Aug-2013 12:33 AM ATC Developed using Python 2.7
# ATC = Ali Taylan Cemgil,
# Department of Computer Engineering, Bogazici University
# e-mail : taylan.cemgil@boun.edu.tr
import argparse
from twython import Twyt... | {
"repo_name": "boun-cmpe-soslab/drenaj",
"path": "drenaj/client/workers/twitter_api_getfollowers.py",
"copies": "1",
"size": "6376",
"license": "mit",
"hash": -8799007569239333000,
"line_mean": 35.8554913295,
"line_max": 137,
"alpha_frac": 0.6046110414,
"autogenerated": false,
"ratio": 3.49178532... |
"""A basic database set-up for Travis CI.
The set-up uses the 'TRAVIS' (== True) environment variable on Travis
to detect the session, and changes the default database accordingly.
Be mindful of where you place this code, as you may accidentally
assign the default database to another configuration later in your code.... | {
"repo_name": "cloud-taxi/django-amqp-2phase",
"path": "tests/settings.py",
"copies": "1",
"size": "1061",
"license": "bsd-3-clause",
"hash": 3188259280762269000,
"line_mean": 23.1363636364,
"line_max": 72,
"alpha_frac": 0.5353440151,
"autogenerated": false,
"ratio": 3.789285714285714,
"config_... |
"""A basic example of authentication requests within a hug API"""
import hug
import jwt
# Several authenticators are included in hug/authentication.py. These functions
# accept a verify_user function, which can be either an included function (such
# as the basic username/password function demonstrated below), or logic... | {
"repo_name": "timothycrosley/hug",
"path": "examples/authentication.py",
"copies": "1",
"size": "3104",
"license": "mit",
"hash": 7195108274195020000,
"line_mean": 35.0930232558,
"line_max": 100,
"alpha_frac": 0.7152061856,
"autogenerated": false,
"ratio": 3.656065959952886,
"config_test": fal... |
'''A basic example of authentication requests within a hug API'''
import hug
import jwt
# Several authenticators are included in hug/authentication.py. These functions
# accept a verify_user function, which can be either an included function (such
# as the basic username/password function demonstrated below), or logic... | {
"repo_name": "MuhammadAlkarouri/hug",
"path": "examples/authentication.py",
"copies": "1",
"size": "3082",
"license": "mit",
"hash": -7835600686454642000,
"line_mean": 35.6904761905,
"line_max": 106,
"alpha_frac": 0.720311486,
"autogenerated": false,
"ratio": 3.6473372781065088,
"config_test":... |
"""A basic example of using hug.use.Socket to return data from raw sockets"""
import hug
import socket
import struct
import time
http_socket = hug.use.Socket(connect_to=('www.google.com', 80), proto='tcp', pool=4, timeout=10.0)
ntp_service = hug.use.Socket(connect_to=('127.0.0.1', 123), proto='udp', pool=4, timeout=1... | {
"repo_name": "MuhammadAlkarouri/hug",
"path": "examples/use_socket.py",
"copies": "1",
"size": "1092",
"license": "mit",
"hash": -7666298879065699000,
"line_mean": 32.0909090909,
"line_max": 103,
"alpha_frac": 0.6923076923,
"autogenerated": false,
"ratio": 2.9917808219178084,
"config_test": fa... |
"""A basic example of using hug.use.Socket to return data from raw sockets"""
import hug
import socket
import struct
import time
http_socket = hug.use.Socket(connect_to=("www.google.com", 80), proto="tcp", pool=4, timeout=10.0)
ntp_service = hug.use.Socket(connect_to=("127.0.0.1", 123), proto="udp", pool=4, timeout=1... | {
"repo_name": "timothycrosley/hug",
"path": "examples/use_socket.py",
"copies": "1",
"size": "1096",
"license": "mit",
"hash": -845939506402359700,
"line_mean": 30.3142857143,
"line_max": 103,
"alpha_frac": 0.6897810219,
"autogenerated": false,
"ratio": 2.9945355191256833,
"config_test": false,... |
"""A basic example of using the association object pattern.
The association object pattern is a form of many-to-many which
associates additional data with each association between parent/child.
The example illustrates an "order", referencing a collection
of "items", with a particular price paid associated with each "... | {
"repo_name": "ioram7/keystone-federado-pgid2013",
"path": "build/sqlalchemy/examples/association/basic_association.py",
"copies": "2",
"size": "3088",
"license": "apache-2.0",
"hash": 273850825416834020,
"line_mean": 31.8510638298,
"line_max": 78,
"alpha_frac": 0.6544689119,
"autogenerated": false... |
"""A basic example of using the association object pattern.
The association object pattern is a richer form of a many-to-many
relationship.
The model will be an ecommerce example. We will have an Order, which
represents a set of Items purchased by a user. Each Item has a price.
However, the Order must store its own... | {
"repo_name": "obeattie/sqlalchemy",
"path": "examples/association/basic_association.py",
"copies": "1",
"size": "3533",
"license": "mit",
"hash": -1059198587173019900,
"line_mean": 31.712962963,
"line_max": 75,
"alpha_frac": 0.694310784,
"autogenerated": false,
"ratio": 3.5940996948118005,
"co... |
"""A basic extended attributes (xattr) implementation for Linux and MacOS X
"""
import errno
import os
import sys
import tempfile
from ctypes import CDLL, create_string_buffer, c_ssize_t, c_size_t, c_char_p, c_int, c_uint32, get_errno
from ctypes.util import find_library
from .logger import create_logger
logger = crea... | {
"repo_name": "mhubig/borg",
"path": "borg/xattr.py",
"copies": "1",
"size": "10476",
"license": "bsd-3-clause",
"hash": 5725426914976233000,
"line_mean": 36.6834532374,
"line_max": 121,
"alpha_frac": 0.5950744559,
"autogenerated": false,
"ratio": 3.145945945945946,
"config_test": false,
"has... |
"""A basic extended attributes (xattr) implementation for Linux, FreeBSD and MacOS X."""
import errno
import os
import re
import subprocess
import sys
import tempfile
from ctypes import CDLL, create_string_buffer, c_ssize_t, c_size_t, c_char_p, c_int, c_uint32, get_errno
from ctypes.util import find_library
from distu... | {
"repo_name": "edgewood/borg",
"path": "src/borg/xattr.py",
"copies": "4",
"size": "15445",
"license": "bsd-3-clause",
"hash": 1968446070974473500,
"line_mean": 38.8067010309,
"line_max": 116,
"alpha_frac": 0.6055033992,
"autogenerated": false,
"ratio": 3.423093971631206,
"config_test": false,
... |
"""A basic focus script for slitviewers
(changes will be required for gcam and instruments).
Subclass for more functionality.
Take a series of exposures at different focus positions to estimate best focus.
Note:
- The script runs in two phases:
1) If a slitviewer:
Move the boresight and take an exposure. T... | {
"repo_name": "r-owen/stui",
"path": "TUI/Base/BaseFocusScript.py",
"copies": "1",
"size": "70727",
"license": "bsd-3-clause",
"hash": 5207280033848373000,
"line_mean": 38.66741447,
"line_max": 126,
"alpha_frac": 0.5892516295,
"autogenerated": false,
"ratio": 3.804981708629223,
"config_test": t... |
# A basic functional programming in Python
# a function to calculate a squared number
def square(n):
return n ** 2
# Lambda expression to calculate a squared number
lambda_square = lambda x: x**2
print (square(5))
print (lambda_square(5))
# a recursive function to calculate the factorial of a number
def fat(n):
... | {
"repo_name": "felipeparpinelli/algorithms_and_data_structures",
"path": "functional_programming.py",
"copies": "1",
"size": "1032",
"license": "mit",
"hash": -7420935206150086000,
"line_mean": 24.1951219512,
"line_max": 80,
"alpha_frac": 0.6879844961,
"autogenerated": false,
"ratio": 3.155963302... |
"""A basic implementation of a Neural Network
by following the tutorial by Andrew Trask
http://iamtrask.github.io/2015/07/12/basic-python-network/
"""
import numpy as np
# sigmoid function
def nonlin(x, deriv=False):
if deriv==True:
return x * (1-x)
return 1 / (1 + np.exp(-x))
# input dataset
x = np.... | {
"repo_name": "alexandercrosson/ml",
"path": "neural_network/basic.py",
"copies": "1",
"size": "1043",
"license": "mit",
"hash": 2972435385755649500,
"line_mean": 20.2857142857,
"line_max": 58,
"alpha_frac": 0.6049856184,
"autogenerated": false,
"ratio": 3.0231884057971015,
"config_test": false... |
"""A basic implementation of a pushdown stack,
using a subclassed Python list."""
# -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
IS_MAIN = True if __name__ == '__main__' else False
if IS_MAIN:
from os import getcwd
from os import sys
sys.path.append(getcwd())
import operat... | {
"repo_name": "christabor/MoAL",
"path": "MOAL/automata_theory/stack_machine.py",
"copies": "1",
"size": "2927",
"license": "apache-2.0",
"hash": -2736041161995323400,
"line_mean": 26.1018518519,
"line_max": 79,
"alpha_frac": 0.4933378886,
"autogenerated": false,
"ratio": 4.217579250720461,
"co... |
# A basic implementation of merge sort - https://en.wikipedia.org/wiki/Merge_sort
# Uses O(n) storage space
# TODO allocate a work array at beginning instead of smaller, more frequent allocations
# and optimize space usage
# A recursive implementation
def mergesort_rec(array, left=0, right=None):
if right is Non... | {
"repo_name": "calebperkins/algorithms",
"path": "algorithms/mergesort.py",
"copies": "1",
"size": "1544",
"license": "mit",
"hash": -2571218328630572500,
"line_mean": 24.3114754098,
"line_max": 87,
"alpha_frac": 0.5440414508,
"autogenerated": false,
"ratio": 3.313304721030043,
"config_test": f... |
# a basic implementation of the MNIST classifier through multinomial logistic regression
import tensorflow as tf
# import the dataset called MNIST for handwritten digit classification
from tensorflow.examples.tutorials.mnist import input_data
mnist_data = input_data.read_data_sets("MNIST_data/", one_hot=True)
# creat... | {
"repo_name": "RMDev97/Tensor-Flow-Projects",
"path": "MNIST/mnist_basic.py",
"copies": "1",
"size": "2852",
"license": "apache-2.0",
"hash": 7788956957770939000,
"line_mean": 44.2698412698,
"line_max": 118,
"alpha_frac": 0.7545582048,
"autogenerated": false,
"ratio": 3.5340768277571253,
"confi... |
"""A basic in process kernel monitor with autorestarting.
This watches a kernel's state using KernelManager.is_alive and auto
restarts the kernel if it dies.
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import warnings
from zmq.eventloop import ioloop
fro... | {
"repo_name": "sserrot/champion_relationships",
"path": "venv/Lib/site-packages/jupyter_client/ioloop/restarter.py",
"copies": "1",
"size": "2664",
"license": "mit",
"hash": -581819577748755200,
"line_mean": 31.8888888889,
"line_max": 103,
"alpha_frac": 0.5938438438,
"autogenerated": false,
"rati... |
"""A basic in process kernel monitor with autorestarting.
This watches a kernel's state using KernelManager.is_alive and auto
restarts the kernel if it dies.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under th... | {
"repo_name": "mattvonrocketstein/smash",
"path": "smashlib/ipy3x/kernel/ioloop/restarter.py",
"copies": "1",
"size": "1727",
"license": "mit",
"hash": 1995729370133842200,
"line_mean": 29.8392857143,
"line_max": 78,
"alpha_frac": 0.4829183555,
"autogenerated": false,
"ratio": 5.233333333333333,
... |
# This code is licensed under the MIT License.
#
# MIT License
#
# Copyright (c) 2016 Luca Vallerini
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without ... | {
"repo_name": "lucavallerini/miscellanea",
"path": "dama/dama.py",
"copies": "1",
"size": "2251",
"license": "mit",
"hash": -7245532720909321000,
"line_mean": 30.7042253521,
"line_max": 102,
"alpha_frac": 0.6183918259,
"autogenerated": false,
"ratio": 3.5958466453674123,
"config_test": false,
... |
""" A basic job model, and local job implementation.
author: Brian Schrader
since: 2016-01-04
"""
import os
from subprocess import Popen, PIPE
def call(args, stdout=PIPE, stderr=PIPE):
""" Calls the given arguments in a seperate process
and returns the contents of standard out.
"""
p = Popen(args, s... | {
"repo_name": "Sonictherocketman/metapipe",
"path": "metapipe/models/job.py",
"copies": "2",
"size": "2869",
"license": "mit",
"hash": 3285695016634496000,
"line_mean": 27.4059405941,
"line_max": 121,
"alpha_frac": 0.6151969327,
"autogenerated": false,
"ratio": 4.212922173274596,
"config_test":... |
"""A basic kernel monitor with autorestarting.
This watches a kernel's state using KernelManager.is_alive and auto
restarts the kernel if it dies.
It is an incomplete base class, and must be subclassed.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from IPy... | {
"repo_name": "mattvonrocketstein/smash",
"path": "smashlib/ipy3x/kernel/restarter.py",
"copies": "1",
"size": "3781",
"license": "mit",
"hash": 475428733550827140,
"line_mean": 32.1666666667,
"line_max": 113,
"alpha_frac": 0.572335361,
"autogenerated": false,
"ratio": 4.70273631840796,
"config... |
"""A basic module designed to download images on your server.
Please note this is always a risky thing to do.
I've added a pretty basic safety that will check what we downloaded
is REALLY an image, however this could prove not to be enough,
so use with caution."""
import urllib2
import os
from PIL import Image
def do... | {
"repo_name": "Raveline/Gullom",
"path": "downloader.py",
"copies": "1",
"size": "2129",
"license": "mit",
"hash": 2368521082937261600,
"line_mean": 35.7068965517,
"line_max": 122,
"alpha_frac": 0.6580554251,
"autogenerated": false,
"ratio": 3.6146010186757214,
"config_test": false,
"has_no_k... |
"""A basic playground. Most interesting function is draw a shape, basically
move the mouse as you want and pymunk will approximate a Poly shape from the
drawing.
"""
__docformat__ = "reStructuredText"
import pygame
import pymunk as pm
import pymunk.util as u
from pymunk import Vec2d
# TODO: Clean up code
COLLTYPE... | {
"repo_name": "viblo/pymunk",
"path": "examples/playground.py",
"copies": "1",
"size": "12446",
"license": "mit",
"hash": -3578279751607315000,
"line_mean": 33.9606741573,
"line_max": 116,
"alpha_frac": 0.5207295517,
"autogenerated": false,
"ratio": 3.6127721335268506,
"config_test": false,
"... |
"""A basic playground. Most interesting function is draw a shape, basically
move the mouse as you want and pymunk will approximate a Poly shape from the
drawing.
"""
__version__ = "$Id:$"
__docformat__ = "reStructuredText"
import pygame
from pygame.locals import *
from pygame.color import *
import pymunk as pm
from... | {
"repo_name": "imanolarrieta/angrybirds",
"path": "pymunk-4.0.0/examples/playground.py",
"copies": "5",
"size": "12298",
"license": "mit",
"hash": 6784726544429606000,
"line_mean": 35.7104477612,
"line_max": 120,
"alpha_frac": 0.5090258579,
"autogenerated": false,
"ratio": 3.6449318316538233,
"... |
"""A basic playground. Most interesting function is draw a shape, basically
move the mouse as you want and pymunk will approximate a Poly shape from the
drawing.
"""
__version__ = "$Id:$"
__docformat__ = "reStructuredText"
import pygame
from pygame.locals import *
from pygame.color import *
import pymunk... | {
"repo_name": "cfobel/python___pymunk",
"path": "examples/playground.py",
"copies": "1",
"size": "12622",
"license": "mit",
"hash": 8670299500612371000,
"line_mean": 35.6895522388,
"line_max": 120,
"alpha_frac": 0.4955633022,
"autogenerated": false,
"ratio": 3.72220583898555,
"config_test": fal... |
# a basic script for starting the InMoov service
# and attaching the right hand
# an Arduino is required, additionally a computer
# with a microphone and speakers is needed for voice
# control and speech synthesis
# ADD SECOND STAGE CONFIRMATION
# instead of saying: you said... it would say: did you say...? and I wou... | {
"repo_name": "sujitbehera27/MyRoboticsProjects-Arduino",
"path": "src/resource/Python/examples/InMoov.full.py",
"copies": "3",
"size": "2973",
"license": "apache-2.0",
"hash": 5072647497137523000,
"line_mean": 38.64,
"line_max": 124,
"alpha_frac": 0.7285570131,
"autogenerated": false,
"ratio": 2... |
# a basic script for starting the InMoov service
# and attaching the right hand
# an Arduino is required, additionally a computer
# with a microphone and speakers is needed for voice
# control and speech synthesis
inMoov = Runtime.createAndStart("inMoov", "InMoov")
# attach an arduino to InMoo... | {
"repo_name": "DarkRebel/myrobotlab",
"path": "src/resource/Python/examples/InMoov.right.hand.py",
"copies": "2",
"size": "1926",
"license": "apache-2.0",
"hash": 6884017166681605000,
"line_mean": 9.5536723164,
"line_max": 130,
"alpha_frac": 0.6490134995,
"autogenerated": false,
"ratio": 2.568,
... |
# a basic script for starting the InMoov service
# and attaching the right hand
# an Arduino is required, additionally a computer
# with a microphone and speakers is needed for voice
# control and speech synthesis
inMoov = Runtime.createAndStart("inMoov", "InMoov")
# attach an arduino ... | {
"repo_name": "mecax/pyrobotlab",
"path": "toSort/InMoov.right.hand.py",
"copies": "1",
"size": "1985",
"license": "apache-2.0",
"hash": -2543813005616323600,
"line_mean": 7.1652542373,
"line_max": 130,
"alpha_frac": 0.6297229219,
"autogenerated": false,
"ratio": 2.453646477132262,
"config_test... |
"""A basic script to demonstrate usage of the cb2_receive module.
There are a few lines which are commented out. Uncomment these lines to see a
demonstration of the parallel nature of the cb2_receive module."""
# The MIT License (MIT)
#
# Copyright (c) 2016 GTRC.
#
# Permission is hereby granted, free of charge, to a... | {
"repo_name": "IRIM-Technology-Transition-Lab/ur_cb2",
"path": "ur_cb2/receive/cb2_receive_example.py",
"copies": "1",
"size": "2728",
"license": "mit",
"hash": 2564842185178229000,
"line_mean": 39.1176470588,
"line_max": 80,
"alpha_frac": 0.6755865103,
"autogenerated": false,
"ratio": 4.22945736... |
"""A basic script to move to stored points for a cb2 robot.
Basic Usage: Store points using cb2_store_points.py (cb2-record from the
terminal). Run this script, with commandline args."""
# The MIT License (MIT)
#
# Copyright (c) 2016 GTRC.
#
# Permission is hereby granted, free of charge, to any person obtaining a co... | {
"repo_name": "IRIM-Technology-Transition-Lab/ur_cb2",
"path": "ur_cb2/cb2_move_to_points.py",
"copies": "1",
"size": "2871",
"license": "mit",
"hash": 729776699600088700,
"line_mean": 40.0142857143,
"line_max": 80,
"alpha_frac": 0.6485545106,
"autogenerated": false,
"ratio": 4.209677419354839,
... |
"""A basic script to store points from a cb2 robot
Basic Usage: Run the script, with commandline args. Press `c` to capture a
point. Press `s` to save and exit."""
# The MIT License (MIT)
#
# Copyright (c) 2016 GTRC.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software ... | {
"repo_name": "IRIM-Technology-Transition-Lab/ur_cb2",
"path": "ur_cb2/receive/cb2_store_points.py",
"copies": "1",
"size": "4270",
"license": "mit",
"hash": -2380545605268792300,
"line_mean": 39.6666666667,
"line_max": 80,
"alpha_frac": 0.5866510539,
"autogenerated": false,
"ratio": 4.3482688391... |
# A basic set of container classes for register data
# Gordon McGregor gordon.mcgregor@verilab.com
from json import dump, load
from pprint import pprint
__version__ = '0.1a'
class __register_base(object):
def __init__(self, parent, name='undefined'):
self.parent = parent
self.name = name
def... | {
"repo_name": "GordonMcGregor/reg_model",
"path": "reg_data.py",
"copies": "1",
"size": "11699",
"license": "apache-2.0",
"hash": 6011507577058336000,
"line_mean": 28.4685138539,
"line_max": 164,
"alpha_frac": 0.5397042482,
"autogenerated": false,
"ratio": 4.01889385091034,
"config_test": false... |
"""A basic Shock (https://github.com/MG-RAST/Shock) python access class.
Authors:
* Jared Wilkening
* Travis Harrison
"""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import cStringIO
import os... | {
"repo_name": "kbaseIncubator/mock_kbase",
"path": "lib/mock_kbase/clients/shock.py",
"copies": "1",
"size": "10684",
"license": "mit",
"hash": 5915998088704762000,
"line_mean": 41.2292490119,
"line_max": 120,
"alpha_frac": 0.5346312243,
"autogenerated": false,
"ratio": 3.747457032620133,
"conf... |
"""A basic Shock (https://github.com/MG-RAST/Shock) python access class.
Authors:
* Jared Wilkening
* Travis Harrison
"""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import cStringIO
import ... | {
"repo_name": "kbase/narrative",
"path": "src/biokbase/shock.py",
"copies": "2",
"size": "9732",
"license": "mit",
"hash": 4197090025117141500,
"line_mean": 35.4494382022,
"line_max": 88,
"alpha_frac": 0.4799630086,
"autogenerated": false,
"ratio": 3.9950738916256157,
"config_test": false,
"h... |
"""A basic Shock(https://github.com/MG-RAST/Shock) python access class.
Uses shock-client for high performance uploads and download if it is in
the users path.
Authors:
* Jared Wilkening
* Travis Harrison
"""
#-----------------------------------------------------------------------------
# Imports
#----------------... | {
"repo_name": "kbase/probabilistic_annotation",
"path": "lib/biokbase/probabilistic_annotation/Shock.py",
"copies": "1",
"size": "9960",
"license": "mit",
"hash": -7527344736915362000,
"line_mean": 40.1611570248,
"line_max": 161,
"alpha_frac": 0.5144578313,
"autogenerated": false,
"ratio": 3.8029... |
"""A basic (single function) API written using Hug."""
import hug
import redis
"""
Make sure you have redis installed via pip and redis-cli can connect
example add data first: http://127.0.0.1:8000/redis_add?ape=123456&rname=phrase
example call http://127.0.0.1:8000/redis_call?ape=123456&rname=phrase
"""
r = redis.St... | {
"repo_name": "jamesacampbell/python-examples",
"path": "hug_api_example.py",
"copies": "1",
"size": "1357",
"license": "mit",
"hash": -7611011629491509000,
"line_mean": 31.3095238095,
"line_max": 79,
"alpha_frac": 0.6359616802,
"autogenerated": false,
"ratio": 3.098173515981735,
"config_test":... |
"""A basic, stripped down queue.
"""
import collections as _collections
import collections.abc as _collections_abc
import functools as _functools
# Implementation note: The head of the queue at index 0.
@_functools.total_ordering
# TODO(sredmond): Sized,Iterable,Container is called Collection in 3.6+
class BasicQueu... | {
"repo_name": "sredmond/acmpy",
"path": "campy/datastructures/basicqueue.py",
"copies": "1",
"size": "1896",
"license": "mit",
"hash": -6297651866067230000,
"line_mean": 25.7042253521,
"line_max": 96,
"alpha_frac": 0.5928270042,
"autogenerated": false,
"ratio": 3.7995991983967934,
"config_test"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.