text stringlengths 0 1.05M | meta dict |
|---|---|
# 20140106
# Jan Mojzis
# Public domain.
import nacl.raw as nacl
from util import fromhex, flip_bit
def verify_32_test():
"""
"""
for x in range(0, 10):
x = nacl.randombytes(nacl.crypto_verify_32_BYTES)
y = x
nacl.crypto_verify... | {
"repo_name": "warner/python-tweetnacl",
"path": "test/test_verify_32.py",
"copies": "1",
"size": "1052",
"license": "mit",
"hash": -8473345606953848000,
"line_mean": 20.4693877551,
"line_max": 66,
"alpha_frac": 0.4657794677,
"autogenerated": false,
"ratio": 3.8254545454545457,
"config_test": f... |
# 2014-01 Jason Roebuck
# Product of work for GEOG 590 @ Portland State University
# May be used for whatever!
# github.com/jtroe/GEOG-590 - Fork me on github!
def main():
# Declare a good, old fashioned greeting.
greeting = 'Hello, Portland!'
print greeting
# print a separator
print '======'
... | {
"repo_name": "jtroe/GEOG-590",
"path": "Assignment1/helloworld.py",
"copies": "1",
"size": "1136",
"license": "unlicense",
"hash": -78463452423160820,
"line_mean": 27.425,
"line_max": 79,
"alpha_frac": 0.6126760563,
"autogenerated": false,
"ratio": 3.2737752161383287,
"config_test": false,
"... |
# 2014-01 Jason Roebuck
# Product of work for GEOG 590 @ Portland State University
# May be used for whatever!
# github.com/jtroe/GEOG-590 - Fork me on github!
import arcpy
import os
def main():
for shp in AllShapefiles():
shpDesc = arcpy.Describe(shp)
print shpDesc.name, 'is a' ,shpDesc.shapeType ... | {
"repo_name": "jtroe/GEOG-590",
"path": "Assignment1/shapefile.py",
"copies": "1",
"size": "1316",
"license": "unlicense",
"hash": -6873687935475607000,
"line_mean": 37.7352941176,
"line_max": 136,
"alpha_frac": 0.6253799392,
"autogenerated": false,
"ratio": 3.5,
"config_test": false,
"has_no... |
# 2014.04.29
# S.Rodney
# HST Filter transmission curves: plotting and such
import numpy as np
from matplotlib import pylab as pl
import os
topdir = os.path.abspath( '.' )
try :
sndataroot = os.environ['SNDATA_ROOT']
os.chdir( sndataroot+'/filters/HST_CANDELS')
w435, f435 = np.loadtxt( 'ACS_WFC_F435W.da... | {
"repo_name": "srodney/hstsntools",
"path": "filters.py",
"copies": "1",
"size": "9454",
"license": "mit",
"hash": -2819375483928643600,
"line_mean": 36.6653386454,
"line_max": 132,
"alpha_frac": 0.6180452718,
"autogenerated": false,
"ratio": 2.697289586305278,
"config_test": false,
"has_no_k... |
# 2014/07/01
####
class Solution:
# @param s, a string
# @return a boolean
def isPalindrome(self, s):
i = 0 # left side of string
j = len(s)-1 # right side of string
while i < j:
# Skip non-alphanumeric entries
while not Solution.isAlphaNumeric(s[i]) a... | {
"repo_name": "ldamewood/leetcode",
"path": "python/valid-palindrome.py",
"copies": "1",
"size": "1044",
"license": "mit",
"hash": 201068602755902370,
"line_mean": 27.2432432432,
"line_max": 62,
"alpha_frac": 0.5114942529,
"autogenerated": false,
"ratio": 3.7419354838709675,
"config_test": fals... |
# 2014/07/01
####
class Solution:
# @return a tuple, (index1, index2)
def twoSum(self, num, target):
idx = sorted((val,i) for i,val in enumerate(num)) # N LogN time
# Ignore parts of the array that are larger than (target - min)
end = 0;
while (end < len(num) and idx[en... | {
"repo_name": "ldamewood/leetcode",
"path": "python/two-sum.py",
"copies": "1",
"size": "1183",
"license": "mit",
"hash": -7263006440049146000,
"line_mean": 28.6,
"line_max": 71,
"alpha_frac": 0.5012679628,
"autogenerated": false,
"ratio": 3.10498687664042,
"config_test": false,
"has_no_keywo... |
# 2014 07 02 I.Zliobaite
# visualization of events over time based on grid ("heatmaps")
# place a grid over the city, count events in each square
import data_processing
import plotting
#define parameters
param_grid_width = 1 #km
param_discretization_step = 30 #in minutes
param_map_alpha = 0.97 #fading factor for prev... | {
"repo_name": "zliobaite/Heatmaps",
"path": "run_make_heatmap_movie.py",
"copies": "1",
"size": "1873",
"license": "mit",
"hash": -8190499199132564000,
"line_mean": 51.0277777778,
"line_max": 184,
"alpha_frac": 0.8051254672,
"autogenerated": false,
"ratio": 3.1908006814310053,
"config_test": fa... |
# 2014-07-10/DN - attempting to implement argparse so that user, pwd & IP can be
# passed in from CLI.
# 2014-07-10/DN - Works with my ASA but I had to add an enable option as the enable pwd
# is different. Might be nice to default the enable password to the user password if
# that was supplied.
import pexp... | {
"repo_name": "SivagnanamCiena/asa-capture",
"path": "asa-capture.py",
"copies": "2",
"size": "2741",
"license": "mit",
"hash": -7041156504277109000,
"line_mean": 36.5479452055,
"line_max": 119,
"alpha_frac": 0.7362276541,
"autogenerated": false,
"ratio": 3.6304635761589403,
"config_test": fals... |
# 2014 10 21 I.Zliobaite
# extracts cansat data
#RUN: python run_extract_distribution.py
file_data = "2014-10-18 14-30-47.txt"
from collections import defaultdict
import math
import numpy as np
import time, datetime
import matplotlib.pyplot as plt
#param_filter = 'mavlink_global_position_int_t'
param_filter = 'mavl... | {
"repo_name": "zliobaite/cansat2014_analysis",
"path": "run_extract_data.py",
"copies": "1",
"size": "3601",
"license": "mit",
"hash": 9087469836820177000,
"line_mean": 23.6643835616,
"line_max": 134,
"alpha_frac": 0.6475978895,
"autogenerated": false,
"ratio": 2.37532981530343,
"config_test": ... |
import os, sys, re
from optparse import OptionParser
import matplotlib
# If you want to use a different backend, replace Agg with
# Cairo, PS, SVG, GD, Paint etc.
# Agg stands for "antigrain rendering" and produces PNG files
matplotlib.use('Agg')
from pylab import *
##**Phillip Kent** 2014-12-10: Commented out
# Av... | {
"repo_name": "Interoute/API-fun-and-education",
"path": "Sparkplot.py",
"copies": "1",
"size": "13056",
"license": "apache-2.0",
"hash": -8528301233139460000,
"line_mean": 42.3754152824,
"line_max": 128,
"alpha_frac": 0.5736060049,
"autogenerated": false,
"ratio": 3.858156028368794,
"config_te... |
# 2014-12-17
# build by qianqians
# deletenote
def deletenote(filestr):
genfilestr = []
count = 0
errornote = ""
for i in range(len(filestr)):
str = filestr[i]
while(1):
if count == 1:
indexafter = str.find("*/")
if indexafter is not -1:
... | {
"repo_name": "yinchunlong/abelkhan-1",
"path": "juggle/parser/deletenote.py",
"copies": "2",
"size": "1136",
"license": "mit",
"hash": -6030613838607477000,
"line_mean": 24.8181818182,
"line_max": 69,
"alpha_frac": 0.4093309859,
"autogenerated": false,
"ratio": 4.47244094488189,
"config_test":... |
# 2014-12-18
# build by qianqians
# statemachine
#module name{
# void func();
# int func(int);
# array func(int, string)
# map func(int, array, bool, float, string)
#}
from deletenonespacelstrip import deleteNoneSpacelstrip
class struct(object):
def __init__(self):
self.keyworld = ''
self... | {
"repo_name": "darklost/darkforce",
"path": "juggle/codegen/statemachine.py",
"copies": "1",
"size": "4132",
"license": "bsd-3-clause",
"hash": -5010113497845450000,
"line_mean": 25.1582278481,
"line_max": 75,
"alpha_frac": 0.488625363,
"autogenerated": false,
"ratio": 4.25979381443299,
"config... |
# 2014-12-18
# build by qianqians
# statemachine
#module name{
# void func();
# int func(int);
# array func(int, string)
# table func(int, array, bool, float, string)
#}
from deletenonespacelstrip import deleteNoneSpacelstrip
class func(object):
def __init__(self):
self.keyworld = ''
self... | {
"repo_name": "yinchunlong/abelkhan-1",
"path": "juggle/parser/statemachine.py",
"copies": "2",
"size": "3589",
"license": "mit",
"hash": -6355696387092756000,
"line_mean": 27.9435483871,
"line_max": 109,
"alpha_frac": 0.502925606,
"autogenerated": false,
"ratio": 4.182983682983683,
"config_tes... |
# 2014-12-24
# build by qianqians
# codegenclient
import os
import argvs
from gentools import maketypetocpptype, makeret
def codegencaller(filelist):
if not os.path.isdir(argvs.build_path):
os.mkdir(argvs.build_path)
if not os.path.isdir(argvs.build_path + 'caller'):
os.mkdir(argvs.build_path ... | {
"repo_name": "darklost/darkforce",
"path": "juggle/codegen/codegencaller.py",
"copies": "1",
"size": "3991",
"license": "bsd-3-clause",
"hash": -1620573965216761000,
"line_mean": 50.1794871795,
"line_max": 194,
"alpha_frac": 0.4645452268,
"autogenerated": false,
"ratio": 3.1155347384855583,
"c... |
# 2014-12-24
# build by qianqians
# codegenclient
import os
import argvs
def maketypegetvalue(type):
if type == 'int':
return 'int64_t'
if type == 'float':
return 'double'
if type == 'bool':
return 'bool'
if type == 'string' or type == 'std::string':
return 'std::sstrin... | {
"repo_name": "darklost/darkforce",
"path": "juggle/codegen/gentools.py",
"copies": "1",
"size": "7307",
"license": "bsd-3-clause",
"hash": -1414411826315958000,
"line_mean": 38.2903225806,
"line_max": 112,
"alpha_frac": 0.448610921,
"autogenerated": false,
"ratio": 3.0144389438943895,
"config_... |
# 2014. 12. 9 by Hans Roh hansroh@gmail.com
__version__ = "0.32.8"
version_info = tuple (map (lambda x: not x.isdigit () and x or int (x), __version__.split (".")))
NAME = "Skitai/%s.%s" % version_info [:2]
import aquests # should be first for psycopg2 compat
from rs4 import deco, importer
from rs4.psutil import se... | {
"repo_name": "hansroh/skitai",
"path": "skitai/__init__.py",
"copies": "1",
"size": "25472",
"license": "mit",
"hash": -5078284102318700000,
"line_mean": 31.080604534,
"line_max": 139,
"alpha_frac": 0.5772220477,
"autogenerated": false,
"ratio": 3.552084785943383,
"config_test": true,
"has_n... |
# 2014 — Loïc Sander
# Group spacing in Robofont
from vanilla import FloatingWindow, CheckBox
from mojo.events import addObserver, removeObserver
from mojo.UI import CurrentSpaceCenter
metricsPrefix = '.mtrx'
leftIndicator = '_L_'
rightIndicator = '_R_'
class spacingObserver(object):
def __init__(self):
... | {
"repo_name": "miguelsousa/Robofont-scripts",
"path": "SpacingObserver/spacing-observer.py",
"copies": "2",
"size": "4965",
"license": "mit",
"hash": 8432294947806881000,
"line_mean": 41.4188034188,
"line_max": 181,
"alpha_frac": 0.6187021362,
"autogenerated": false,
"ratio": 4.367957746478873,
... |
"""2015-01-06, mlr:
A new RSS feed has been added: http://www.cafc.uscourts.gov/rss-opinions.php
"""
from juriscraper.OpinionSite import OpinionSite
import time
from datetime import date
from juriscraper.lib.string_utils import clean_string, titlecase
class Site(OpinionSite):
def __init__(self):
sup... | {
"repo_name": "brianwc/juriscraper",
"path": "opinions/united_states/federal_appellate/cafc.py",
"copies": "1",
"size": "2555",
"license": "bsd-2-clause",
"hash": -9006571003247090000,
"line_mean": 41.5833333333,
"line_max": 124,
"alpha_frac": 0.5953033268,
"autogenerated": false,
"ratio": 3.2465... |
# 2015.03.10 14:42:13 UTC
import sys
import os
path = os.path.split(os.path.realpath(__file__))[0]
sys.path.append(path + '/utils/Python_Utils')
sys.path.append(path + '../utils/Python_Utils')
sys.path.append(path + '/utils/liac-arff')
sys.path.append(path + '../utils/liac-arff')
import numpy as np
import scipy as sc
i... | {
"repo_name": "rustle1314/latent_factor_multi_label",
"path": "arffio.py",
"copies": "2",
"size": "4722",
"license": "mit",
"hash": -6347312248906894000,
"line_mean": 30.9054054054,
"line_max": 75,
"alpha_frac": 0.458068615,
"autogenerated": false,
"ratio": 3.434181818181818,
"config_test": fal... |
# 2015-03-23 LLB remove 1s wait time between snapshots
import corr, adc5g, httplib
import matplotlib.pyplot as plt
import numpy as np
import scipy.optimize
import sys, time
r2 = corr.katcp_wrapper.FpgaClient('r2dbe-1')
r2.wait_connected()
if len(sys.argv) == 2:
rpt = int(sys.argv[1])
else:
rpt = 30
def gaus... | {
"repo_name": "sao-eht/lmtscripts",
"path": "2017/corestats.py",
"copies": "1",
"size": "1243",
"license": "mit",
"hash": -1473173349834098400,
"line_mean": 27.25,
"line_max": 91,
"alpha_frac": 0.5792437651,
"autogenerated": false,
"ratio": 2.3147113594040967,
"config_test": false,
"has_no_ke... |
# 2015.05.05 18:39:54 CST
# Embedded file name: easycard.py
import sys
import datetime
import hashlib
import urllib
import urllib2
import json
from Crypto.Cipher import DES3
import pytz
version = '0.3'
copyright = 'Copyright (C) 2015 Zhi-Wei Cai.'
key = 'EasyCardToKingay23456789'
iv = '01234567'
salt = 'L0CalKing'
cons... | {
"repo_name": "akpotter/Easy-Card",
"path": "bin/easycard.py",
"copies": "1",
"size": "4031",
"license": "mit",
"hash": 6244177657748126000,
"line_mean": 39.7171717172,
"line_max": 273,
"alpha_frac": 0.5472587447,
"autogenerated": false,
"ratio": 2.590616966580977,
"config_test": false,
"has_... |
# 20:15:05:11:32:44 - itead - radar
# 30:14:11:21:15:80 - HC-06 - redbot
import time
from bluetooth import *
import matplotlib.pyplot as plt
# Generate the master table
# masterTable = [[0 for x in range(10)] for x in range(10)]
all_results_x = list()
all_results_y = list()
WAIT_TIME = 10
RADAR_MAC = "20:15:05:11:32... | {
"repo_name": "oneasteriskone/IA-Project",
"path": "Core/core.py",
"copies": "1",
"size": "2044",
"license": "apache-2.0",
"hash": -8713766114074854000,
"line_mean": 17.9259259259,
"line_max": 61,
"alpha_frac": 0.6550880626,
"autogenerated": false,
"ratio": 2.590621039290241,
"config_test": fal... |
""" 2015-07-23
Perform coordinate conversions from the command line.
Uses
"""
import argparse
import pyperclip
# p1 = argparse.ArgumentParser()
# p1.add_argument('x')
# print p1.parse_args(['123'])
#
# p2 = argparse.ArgumentParser()
# p2.add_argument('-d', action='store_const',const='dak')
# print p2.p... | {
"repo_name": "aembillo/MNWellRecordGui",
"path": "src/Coord_cmd.py",
"copies": "1",
"size": "2521",
"license": "bsd-3-clause",
"hash": -3486733237548961300,
"line_mean": 27.6590909091,
"line_max": 127,
"alpha_frac": 0.6049186831,
"autogenerated": false,
"ratio": 2.8977011494252873,
"config_tes... |
# 2015-9-26
import argparse
import os
from glob import glob
import logging
PASSBOOK_PATH = os.path.expanduser('~/Dropbox/conf/passbook')
class Passbook(object):
def __init__(self, path):
self._path = path
def getgen(self, domain):
path = os.path.join(self._path, domain)
try:
... | {
"repo_name": "axplus/pw",
"path": "pw/passbook.py",
"copies": "1",
"size": "1162",
"license": "bsd-3-clause",
"hash": 1513915822937282000,
"line_mean": 20.9245283019,
"line_max": 69,
"alpha_frac": 0.5851979346,
"autogenerated": false,
"ratio": 3.3011363636363638,
"config_test": false,
"has_n... |
# 2015-9-26
import hmac
import hashlib
SALT = '$$'
class Gen1(object):
@staticmethod
def generate(salt, domain):
pass
class Gen2(object):
@staticmethod
def generate(salt, domain):
op = '%s%s%s' % (salt, domain, SALT)
mobj = hmac.new(domain, op, hashlib.md5)
m = ... | {
"repo_name": "axplus/pw",
"path": "pw/gens.py",
"copies": "1",
"size": "2584",
"license": "bsd-3-clause",
"hash": 1417941303908960500,
"line_mean": 19.3464566929,
"line_max": 78,
"alpha_frac": 0.4593653251,
"autogenerated": false,
"ratio": 3.178351783517835,
"config_test": false,
"has_no_key... |
# 2015
from sqlalchemy import Column, ForeignKey, Integer,Float,String,UniqueConstraint,Date
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Profile(Base):
__tablename__ = "profile"
id = Column(Integer, primary_key=True)
name = Column(String, unique=True, nullab... | {
"repo_name": "nikhil1290/weekend-fun",
"path": "database/models.py",
"copies": "1",
"size": "3274",
"license": "apache-2.0",
"hash": -1384027333019080700,
"line_mean": 31.74,
"line_max": 104,
"alpha_frac": 0.620647526,
"autogenerated": false,
"ratio": 3.5053533190578157,
"config_test": false,
... |
"""2015 SciPy John Hunter Excellence in Plotting Contest
Author: Robert Nikutta <robert.nikutta@gmail.com>
Title: Clustering of astronomical objects in WISE 3D color space
Based on: Nikutta, Hunt-Walker, Ivezic, Nenkova, Elitzur,
'The meaning of WISE colours - I. The Galaxy and its satellites',
MNRAS 442, 3361-3379 ... | {
"repo_name": "rnikutta/wise3Dstereoscopic",
"path": "plot.py",
"copies": "1",
"size": "8856",
"license": "bsd-3-clause",
"hash": -6096504724906592000,
"line_mean": 37.3376623377,
"line_max": 182,
"alpha_frac": 0.6225158085,
"autogenerated": false,
"ratio": 3.1183098591549294,
"config_test": fa... |
# 2016-02-12 juerg maier
# Use Danevit Hartenberg parameters to calculate current x,y,z Position of Palm
# As I could not make JNumeric work I used my own matrix calcs
from copy import copy, deepcopy
import math
leftPort = "/dev/ttyACM1"
rightPort = "/dev/ttyACM0"
i01 = Runtime.createAndStart("i01", "InMoov")
leftH... | {
"repo_name": "MyRobotLab/pyrobotlab",
"path": "home/juerg/lookathand.py",
"copies": "1",
"size": "7280",
"license": "apache-2.0",
"hash": -5538957785101586000,
"line_mean": 28.2369477912,
"line_max": 125,
"alpha_frac": 0.5870879121,
"autogenerated": false,
"ratio": 2.3067173637515843,
"config_... |
# 2016-06-06 Updating for Keras 1.0 API
import numpy as np
import keras
from keras.models import Sequential
from keras.layers import Layer, Dense, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.layers.normalization import BatchNormalization
from keras.layers.pooling im... | {
"repo_name": "keunwoochoi/music-auto_tagging-keras",
"path": "compact_cnn/models.py",
"copies": "1",
"size": "4115",
"license": "mit",
"hash": -5887317292793120000,
"line_mean": 36.752293578,
"line_max": 102,
"alpha_frac": 0.5657351154,
"autogenerated": false,
"ratio": 3.651286601597161,
"conf... |
# 2016.06.22 21:44:58 EDT
#Embedded file name: e84.py
import random, pylab
ccDeck = chDeck = list(range(12))
random.shuffle(ccDeck)
random.shuffle(chDeck)
def rollDice():
a, b = random.choice(list(range(1, 5))), random.choice(list(range(1, 5)))
return (a + b, a == b)
def nextRailroad(currentSquare):
retu... | {
"repo_name": "nickfarrington/euler-misc-py",
"path": "e84.py",
"copies": "1",
"size": "2510",
"license": "mit",
"hash": 8682058603909443000,
"line_mean": 19.5737704918,
"line_max": 77,
"alpha_frac": 0.5561752988,
"autogenerated": false,
"ratio": 3.173198482932996,
"config_test": false,
"has_... |
# 2016. 1. 10 by Hans Roh hansroh@gmail.com
__version__ = "0.29.3.18"
version_info = tuple (map (lambda x: not x.isdigit () and x or int (x), __version__.split (".")))
import os, sys
from rs4 import asyncore
import timeit
import time, math, random
from . import lifetime, queue, request_builder, response_builder, st... | {
"repo_name": "hansroh/aquests",
"path": "aquests/__init__.py",
"copies": "1",
"size": "14635",
"license": "mit",
"hash": 7939229146424259000,
"line_mean": 24.7658450704,
"line_max": 240,
"alpha_frac": 0.6405876324,
"autogenerated": false,
"ratio": 2.978831671076735,
"config_test": false,
"ha... |
#2016-2017 PERSONAL PROJECTS: TurtleChat!
#WRITE YOUR NAME HERE!
#####################################################################################
# IMPORTS #
##################################################################################... | {
"repo_name": "golfit/mine",
"path": "turtle_chat_view_soln.py",
"copies": "1",
"size": "11152",
"license": "mit",
"hash": -1906027312392177000,
"line_mean": 40.7677902622,
"line_max": 103,
"alpha_frac": 0.5290530846,
"autogenerated": false,
"ratio": 4.404423380726699,
"config_test": false,
"... |
# 2016/2017 Project - Andre Calatre, 73207
# "Simulation of an epidemic" - 16/5/2017
# Plotting Multiple Simulations of a SIR Epidemic Model
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
#Choosing the values for c and r to stud... | {
"repo_name": "calatre/epidemics_network",
"path": "plt/SIR 1 plot_maxs.py",
"copies": "1",
"size": "1093",
"license": "apache-2.0",
"hash": -8013712713071753000,
"line_mean": 23.2888888889,
"line_max": 72,
"alpha_frac": 0.6861848124,
"autogenerated": false,
"ratio": 2.355603448275862,
"config_... |
# 2016/2017 Project - Andre Calatre, 73207
# "Simulation of an epidemic" - 16/5/2017
# Plotting Multiple Simulations of a SIR Epidemic Model
#import numpy as np
import pandas as pd
#Choosing the values for c and r to study
cvalues = [0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1,
... | {
"repo_name": "calatre/epidemics_network",
"path": "treat/SIR 1 get_last.py",
"copies": "1",
"size": "1066",
"license": "apache-2.0",
"hash": -7777139695356525000,
"line_mean": 28.6111111111,
"line_max": 73,
"alpha_frac": 0.552532833,
"autogenerated": false,
"ratio": 2.7760416666666665,
"config... |
# 2016/2017 Project - Andre Calatre, 73207
# "Simulation of an epidemic" - 24/5/2017
# Plotting Multiple Simulations of a SIR Epidemic Model
# Based on the US unemployment example on Bokeh Website:
# http://bokeh.pydata.org/en/latest/docs/gallery/unemployment.html
import pandas as pd
from math import pi
from bokeh.... | {
"repo_name": "calatre/epidemics_network",
"path": "plt/SIR 1 plot_maxs_bokeh.py",
"copies": "1",
"size": "2873",
"license": "apache-2.0",
"hash": 2585485054602428400,
"line_mean": 33.6265060241,
"line_max": 87,
"alpha_frac": 0.6912634876,
"autogenerated": false,
"ratio": 2.9049544994944387,
"c... |
# 2016-7-1
# build by qianqians
# gencaller
import tools
def gencaller(module_name, funcs):
code = "/*this caller file is codegen by juggle for c++*/\n"
code += "#ifndef _" + module_name + "_caller_h\n"
code += "#define _" + module_name + "_caller_h\n"
code += "#include <sstream>\n"
... | {
"repo_name": "qianqians/juggle",
"path": "gen/c++/gencaller.py",
"copies": "1",
"size": "2097",
"license": "mit",
"hash": 6737726920838020000,
"line_mean": 38.5660377358,
"line_max": 138,
"alpha_frac": 0.4124940391,
"autogenerated": false,
"ratio": 3.4320785597381342,
"config_test": false,
"... |
# 2016-7-1
# build by qianqians
# gencaller
import tools
def gencaller(module_name, funcs):
code = "/*this caller file is codegen by juggle for c#*/\n"
code += "using System;\n"
code += "using System.Collections;\n"
code += "using System.IO;\n\n"
code += "namespace caller\n"
... | {
"repo_name": "qianqians/juggle",
"path": "gen/csharp/gencaller.py",
"copies": "2",
"size": "1483",
"license": "mit",
"hash": 7652083402910832000,
"line_mean": 35.1707317073,
"line_max": 87,
"alpha_frac": 0.3769386379,
"autogenerated": false,
"ratio": 3.744949494949495,
"config_test": false,
... |
# 2016-7-1
# build by qianqians
# gencharp
import sys
sys.path.append("./parser")
sys.path.append("./gen/csharp")
import os
import gencaller
import genmodule
import jparser
def gen(inputdir, outputdir):
defmodulelist = []
if not os.path.isdir(outputdir):
os.mkdir(outputdir)
i... | {
"repo_name": "yinchunlong/abelkhan-1",
"path": "juggle/gencsharp.py",
"copies": "2",
"size": "1894",
"license": "mit",
"hash": 8161867277421184000,
"line_mean": 36.88,
"line_max": 102,
"alpha_frac": 0.454593453,
"autogenerated": false,
"ratio": 4.563855421686747,
"config_test": false,
"has_n... |
# 2016-7-1
# build by qianqians
# genmodule
import tools
def genmodule(module_name, funcs):
code = "/*this module file is codegen by juggle for c++*/\n"
code += "#ifndef _" + module_name + "_module_h\n"
code += "#define _" + module_name + "_module_h\n"
code += "#include \"Imodule.h\"\n... | {
"repo_name": "qianqians/juggle",
"path": "gen/c++/genmodule.py",
"copies": "1",
"size": "2056",
"license": "mit",
"hash": 3931534873124948500,
"line_mean": 37.0740740741,
"line_max": 169,
"alpha_frac": 0.388618677,
"autogenerated": false,
"ratio": 3.557093425605536,
"config_test": false,
"ha... |
# 2016-7-1
# build by qianqians
# genmodule
import tools
def genmodule(module_name, funcs):
code = "/*this module file is codegen by juggle for c#*/\n"
code += "using System;\n"
code += "using System.Collections;\n"
code += "using System.Collections.Generic;\n\n"
code += "name... | {
"repo_name": "yinchunlong/abelkhan-1",
"path": "juggle/gen/csharp/genmodule.py",
"copies": "2",
"size": "1981",
"license": "mit",
"hash": -6751743012167336000,
"line_mean": 38.62,
"line_max": 147,
"alpha_frac": 0.3513377082,
"autogenerated": false,
"ratio": 3.9305555555555554,
"config_test": f... |
# 2016-7-4
# build by qianqians
# gencpp
import sys
sys.path.append("./parser")
sys.path.append("./gen/c++")
import os
import gencaller
import genmodule
import jparser
def gen(inputdir, outputdir):
defmodulelist = []
if not os.path.isdir(outputdir):
os.mkdir(outputdir)
if not... | {
"repo_name": "qianqians/juggle",
"path": "gencpp.py",
"copies": "2",
"size": "1887",
"license": "mit",
"hash": -7196260972915257000,
"line_mean": 36.74,
"line_max": 101,
"alpha_frac": 0.4515103339,
"autogenerated": false,
"ratio": 4.557971014492754,
"config_test": false,
"has_no_keywords": f... |
"""2016 advent of code day 2.
The document goes on to explain that each button to be pressed can be found by
starting on the previous button and moving to adjacent buttons on the keypad:
U moves up, D moves down, L moves left, and R moves right. Each line of
instructions corresponds to one button, starting at the prev... | {
"repo_name": "shaggy245/adventofcode",
"path": "day02/day2-1.py",
"copies": "1",
"size": "2171",
"license": "mit",
"hash": 1472131348718046500,
"line_mean": 30.9264705882,
"line_max": 79,
"alpha_frac": 0.6623675725,
"autogenerated": false,
"ratio": 3.1926470588235296,
"config_test": false,
"... |
"""2016 advent of code day 2.
You finally arrive at the bathroom (it's a several minute walk from the lobby
so visitors can behold the many fancy conference rooms and water coolers on
this floor) and go to punch in the code. Much to your bladder's dismay, the
keypad is not at all like you imagined it. Instead, you are... | {
"repo_name": "shaggy245/adventofcode",
"path": "day02/day2-2.py",
"copies": "1",
"size": "2214",
"license": "mit",
"hash": -4353596083384190500,
"line_mean": 30.1830985915,
"line_max": 78,
"alpha_frac": 0.5975609756,
"autogenerated": false,
"ratio": 3.016348773841962,
"config_test": false,
"... |
"""2016 Q3: prime connections"""
from math import log2
from collections import deque
def find_primes(prime_limit):
primes = set()
# For a performance hack, you can swap this for an array, but as it is, a
# list is just about fast enough.
#
# numbers = array.array('L', range(0, prime_limit + 1))
... | {
"repo_name": "matthewelse/british-informatics-olympiad",
"path": "2016/q3.py",
"copies": "1",
"size": "1713",
"license": "mit",
"hash": -4659171648748305000,
"line_mean": 23.1267605634,
"line_max": 77,
"alpha_frac": 0.5545826036,
"autogenerated": false,
"ratio": 3.4397590361445785,
"config_tes... |
# 2016. Vlachos Group Geun Ho Gu. University of Delaware.
"""
==========
Exceptions
==========
All the exceptions are listed here.
"""
import re
drawmolonerror = 0
if drawmolonerror:
from .DrawMol import moltosvg
__all__ = []
class SemiEmpiricalMethodError(Exception):
""" errors related to semi-empirical m... | {
"repo_name": "VlachosGroup/VlachosGroupAdditivity",
"path": "pgradd/Error.py",
"copies": "1",
"size": "6168",
"license": "mit",
"hash": -4526702245921388500,
"line_mean": 27.1643835616,
"line_max": 79,
"alpha_frac": 0.6214332036,
"autogenerated": false,
"ratio": 3.9361837906828336,
"config_tes... |
# 20170126 Fixed the wrong last trading day of spot month
import ael
import acm
import HTI_Util
import HTI_FeedTrade_EDD_Util
import os
import sys, traceback
import datetime
import sqlite3
import csv
import decimal
import account_journal
import win32com.client
from collections import defaultdict
ael_variables = [['po... | {
"repo_name": "frederick623/HTI",
"path": "option_exercise/spot_option_exercise.py",
"copies": "1",
"size": "8203",
"license": "apache-2.0",
"hash": -6215987411586748000,
"line_mean": 35.7892376682,
"line_max": 332,
"alpha_frac": 0.6411069121,
"autogenerated": false,
"ratio": 2.5836220472440945,
... |
# 20170226 Add more additional info
import acm
import ael
import HTI_Util
import HTI_FeedTrade_EDD_Util
import fnmatch
import datetime
import os
import sys
import csv
import re
import sqlite3
import math
import glob
import win32com.client
import traceback
ael_variables = [['asofdate', 'Date', 'string', [str(ael.date_t... | {
"repo_name": "frederick623/HTI",
"path": "fa_collateral_upload/HTI_Loan_Collateral_Automation.py",
"copies": "2",
"size": "25027",
"license": "apache-2.0",
"hash": -7546975289725523000,
"line_mean": 38.4141732283,
"line_max": 202,
"alpha_frac": 0.5425340632,
"autogenerated": false,
"ratio": 3.25... |
# 2017-03-11 jkang
# simple logistic regression
# Python3.5
# Tensorflow1.0.1
# ref:
# - http://web.stanford.edu/class/cs20si/
# - iris dataset from Matlab Neural Network example
#
# Input: iris data (4 features)
# Output: iris label (3 categories)
import tensorflow as tf
import scipy.io as sio
import numpy as np
impo... | {
"repo_name": "jaekookang/useful_bits",
"path": "Machine_Learning/Logistic_Regression/Python/logistic_regression.py",
"copies": "1",
"size": "2300",
"license": "mit",
"hash": -5382456724383367000,
"line_mean": 30.5068493151,
"line_max": 75,
"alpha_frac": 0.6413043478,
"autogenerated": false,
"rat... |
# [2017-03-27] Challenge #308 [Easy] Let it burn
# https://www.reddit.com/r/dailyprogrammer/comments/61ub0j/20170327_challenge_308_easy_let_it_burn/
house = ["#############/#",
"# | #",
"# # #",
"# # #",
"####### #",
"# _ #",
"###############"]
coor... | {
"repo_name": "brendanwr/DailyProgrammer",
"path": "308 [Easy] Let it burn/main.py",
"copies": "1",
"size": "1671",
"license": "apache-2.0",
"hash": 3020778790403995600,
"line_mean": 16.40625,
"line_max": 99,
"alpha_frac": 0.4901256732,
"autogenerated": false,
"ratio": 2.109848484848485,
"confi... |
# [2017-05-05 20:52:55 EDT Karthik Murugadoss]
"""
Classes and functions for file handling utilities
"""
import inspect
import json
import logging
import msgpack
import pandas as pd
import pickle
from rpy2.robjects import pandas2ri, r
class ReadTableFromFile:
"""
Make the contents of a file containing tabula... | {
"repo_name": "karthikmurugadoss/utilities",
"path": "utilities/utilities.py",
"copies": "1",
"size": "8695",
"license": "mit",
"hash": 6074481764486404000,
"line_mean": 28.0802675585,
"line_max": 225,
"alpha_frac": 0.5978148361,
"autogenerated": false,
"ratio": 3.925507900677201,
"config_test"... |
# 20170614 Add manual trade
import ael
import acm
import HTI_Util
import HTI_Email_Util
import HTI_FeedTrade_EDD_Util
import os
import sys, traceback
import datetime
import sqlite3
import csv
import decimal
import account_journal
import win32com.client
ael_variables = [['startdate', 'Start Date', 'string', [str(ael.da... | {
"repo_name": "frederick623/HTI",
"path": "position_monitor/trade_record_dump.py",
"copies": "1",
"size": "10535",
"license": "apache-2.0",
"hash": 1223940939909537300,
"line_mean": 34.9590443686,
"line_max": 328,
"alpha_frac": 0.5383958234,
"autogenerated": false,
"ratio": 3.193391936950591,
"... |
# 20170714 1日に複数記事があった場合にも対応
import urllib.request
from bs4 import BeautifulSoup
import xlsxwriter
#def show_input():
print('01:石森 虹花')
print('02:今泉 佑唯')
print('03:上村 莉菜')
print('04:尾関 梨香')
print('05:織田 奈那')
print('06:小池 美波')
print('07:小林 由依')
print('08:齋藤 冬優花')
print('09:佐藤 詩織')
print('10:志田 愛佳')
print('11:菅井 友香')
p... | {
"repo_name": "connpy/DIY",
"path": "blog_parser/prototype/blog_parser.py",
"copies": "1",
"size": "4459",
"license": "mit",
"hash": 7491866306332680000,
"line_mean": 24.4765625,
"line_max": 138,
"alpha_frac": 0.6323213738,
"autogenerated": false,
"ratio": 1.6337675350701404,
"config_test": fal... |
# 20171115 Add Indicative Fee Column
import acm
import ael
import HTI_Util
import HTI_FeedTrade_EDD_Util
import fnmatch
import datetime
import os
import sys
import csv
import re
import sqlite3
import win32com.client
ael_variables = [['asofdate', 'Date', 'string', [str(ael.date_today()), 'Today'], 'Today', 1, 0, 'Repor... | {
"repo_name": "frederick623/pb",
"path": "sbl_daily_report/HTI_SBLDailyReport.py",
"copies": "2",
"size": "17147",
"license": "apache-2.0",
"hash": -3280978081480082000,
"line_mean": 33.6424242424,
"line_max": 231,
"alpha_frac": 0.642328104,
"autogenerated": false,
"ratio": 2.5190245335683854,
... |
# 2017-2020 by Gregor Engberding , MIT License
import logging
import sys
from PySide2.QtCore import QAbstractItemModel, QModelIndex, Qt, QJsonDocument, QJsonParseError
from PySide2.QtWidgets import QApplication, QTreeView
DEMO_JSON = b"""{
"firstName": "John",
"lastName": "Smith"... | {
"repo_name": "GrxE/PyQJsonModel",
"path": "PyQtJsonModel.py",
"copies": "1",
"size": "8740",
"license": "mit",
"hash": 7947939591568140000,
"line_mean": 27.6459016393,
"line_max": 94,
"alpha_frac": 0.5108160696,
"autogenerated": false,
"ratio": 4.2702834799608995,
"config_test": false,
"has_... |
# 2017, Andrei N., Tudor B.
from sphinx.addnodes import centered
from ._ignore_Agent import Agent
from ._ignore_Agent import Transition
import matplotlib.pyplot as plt
from random import choice
import logging
import os
import numpy as np
import math
import random
import torch
import torch.nn as nn
import torch.opti... | {
"repo_name": "village-people/flying-pig",
"path": "ai_challenge/agents/_ignorebeta_dqn_agent_batch.py",
"copies": "1",
"size": "3884",
"license": "mit",
"hash": -2802093736148931600,
"line_mean": 29.34375,
"line_max": 88,
"alpha_frac": 0.5816168898,
"autogenerated": false,
"ratio": 3.92323232323... |
# 2017 DeepCrystal Technologies - Patrick Hop
#
# Data loading a splitting file
#
# MIT License - have fun!!
# ===========================================================
import os
import random
from collections import OrderedDict
import deepchem as dc
from deepchem.utils import ScaffoldGenerator
from deepchem.utils.... | {
"repo_name": "rbharath/deepchem",
"path": "contrib/mpnn/donkey.py",
"copies": "7",
"size": "3029",
"license": "mit",
"hash": 4020478410432092700,
"line_mean": 28.9900990099,
"line_max": 78,
"alpha_frac": 0.6688676131,
"autogenerated": false,
"ratio": 3.3957399103139014,
"config_test": true,
... |
# 2017 DeepCrystal Technologies - Patrick Hop
#
# Message Passing Neural Network for Chemical Multigraphs
#
# MIT License - have fun!!
# ===========================================================
import deepchem as dc
from rdkit import Chem, DataStructs
from rdkit.Chem import AllChem
import torch
import torch.nn as... | {
"repo_name": "joegomes/deepchem",
"path": "contrib/mpnn/mpnn_baseline.py",
"copies": "1",
"size": "5877",
"license": "mit",
"hash": 3313331438272065000,
"line_mean": 26.8530805687,
"line_max": 96,
"alpha_frac": 0.6212353241,
"autogenerated": false,
"ratio": 2.8529126213592235,
"config_test": f... |
# 2017 DeepCrystal Technologies - Patrick Hop
#
# Message Passing Neural Network SELU [MPNN-S] for Chemical Multigraphs
#
# MIT License - have fun!!
# ===========================================================
import math
import deepchem as dc
from rdkit import Chem, DataStructs
from rdkit.Chem import AllChem
impor... | {
"repo_name": "lilleswing/deepchem",
"path": "contrib/mpnn/mpnn.py",
"copies": "5",
"size": "5567",
"license": "mit",
"hash": 5036992968658853000,
"line_mean": 29.5879120879,
"line_max": 114,
"alpha_frac": 0.6215196695,
"autogenerated": false,
"ratio": 2.8578028747433266,
"config_test": false,
... |
# 2017-Oct-27 00:08
# WNixalo
# Testing out image-resize speedups without/with pillow-simd
# Image is a (1680,1050) jpg
from os.path import expanduser; import scipy.misc
import matplotlib.pyplot as plt; import cv2; import PIL
from time import time
root = expanduser('~/')
path = root + '/Deshar/DoomPy/images/Hiigaran... | {
"repo_name": "WNoxchi/Kaukasos",
"path": "misc/pillow-simd-benchmark.py",
"copies": "1",
"size": "3479",
"license": "mit",
"hash": -3095876359882642400,
"line_mean": 28.4745762712,
"line_max": 89,
"alpha_frac": 0.5879815986,
"autogenerated": false,
"ratio": 2.9650468883205456,
"config_test": f... |
# 2017-Oct-30 01:20 WNixalo PyTorch tutorial
# http://pytorch.org/tutorials/beginner/blitz/autograd_tutorial.html
# Autograd: Automatic Differentiation
# pytorch autograd is a define-by-run framework: meaning your backprop is
# defined by how your code is run, and that every single iteration can be different.
... | {
"repo_name": "WNoxchi/Kaukasos",
"path": "pytorch/pytorch_01_autograd.py",
"copies": "1",
"size": "1795",
"license": "mit",
"hash": 2597864016968073000,
"line_mean": 22.5657894737,
"line_max": 84,
"alpha_frac": 0.7280848688,
"autogenerated": false,
"ratio": 3.2096774193548385,
"config_test": f... |
# 20180205 Catch Barrier state exception
import acm
import ael
import HTI_Util
import HTI_FeedTrade_EDD_Util
import datetime
import os
import sys
import win32com.client
import locale
from itertools import groupby
from operator import itemgetter
ael_variables = [['posdate', 'Date', 'string', [str(ael.date_today()), 'To... | {
"repo_name": "frederick623/HTI",
"path": "eln_automation/ELN_Automation.py",
"copies": "1",
"size": "12812",
"license": "apache-2.0",
"hash": -679905762388497500,
"line_mean": 50.6653225806,
"line_max": 213,
"alpha_frac": 0.6463471745,
"autogenerated": false,
"ratio": 2.573724387304138,
"confi... |
# 20180524 Add multiple FA client support
import os
import sys
import re
import sqlite3
import csv
import fnmatch
import decimal
import datetime
import xlrd
import math
from FeeCalc import FeeCalc
PATH_DICT = {
"trd_dir": "\\\\p7fs0003\\nd\\3033-Horizon-FA-Share\\PB_DeltaOne\\Ullink_Trade_Output",
"trd_filename... | {
"repo_name": "frederick623/pb",
"path": "ul_automation/ullink_to_fa.py",
"copies": "2",
"size": "17803",
"license": "apache-2.0",
"hash": 7798542864870544000,
"line_mean": 38.389380531,
"line_max": 501,
"alpha_frac": 0.6751109364,
"autogenerated": false,
"ratio": 2.603539046504826,
"config_tes... |
# 20180524 Add multiple FA client support
import os
import sys
import re
import sqlite3
import csv
import fnmatch
import xlrd
import win32com.client
import traceback
import time
import glob
PATH_DICT = {
"pos_dir": "\\\\p7fs0003\\nd\\3033-Horizon-FA-Share\\PB_DeltaOne\\Daily_Data" ,
"pos_filename": "PositionDe... | {
"repo_name": "frederick623/HTI",
"path": "ul_automation/ullink_long_short_limit.py",
"copies": "2",
"size": "14883",
"license": "apache-2.0",
"hash": -7219457117454632000,
"line_mean": 35.0387409201,
"line_max": 204,
"alpha_frac": 0.6204394275,
"autogenerated": false,
"ratio": 2.4763727121464227... |
# 20180629 add SFMM as default portfolio
import ael
import acm
import HTI_Util
import HTI_Email_Util
import HTI_FeedTrade_EDD_Util
import os
import sys, traceback
import datetime
import sqlite3
import csv
import decimal
import fo_margin
import re
import sys
import win32com.client
import time
import ast
import glob
ae... | {
"repo_name": "frederick623/HTI",
"path": "frr/account_journal.py",
"copies": "1",
"size": "127328",
"license": "apache-2.0",
"hash": 22835979140801616,
"line_mean": 41.756212223,
"line_max": 360,
"alpha_frac": 0.5430384519,
"autogenerated": false,
"ratio": 3.037259672725538,
"config_test": fal... |
# 20181018 Add empty trade file checking
import os
import sys
import re
import csv
import numpy as np
import fnmatch
import math
import datetime
import xlrd
import traceback
import glob
import pypdftk
from FeeCalc import FeeCalc
PATH_DICT = {
"ull_dir": "\\\\p7fs0003\\nd\\3033-Horizon-FA-Share\\PB_DeltaOne\\FA_Tra... | {
"repo_name": "frederick623/HTI",
"path": "ul_automation/pb_trd_consol.py",
"copies": "2",
"size": "11351",
"license": "apache-2.0",
"hash": 7650355894278971000,
"line_mean": 34.037037037,
"line_max": 502,
"alpha_frac": 0.6450532993,
"autogenerated": false,
"ratio": 2.475681570338059,
"config_t... |
# 2018-3-16
# build by qianqians
# genjs
import sys
sys.path.append("./parser")
sys.path.append("./gen/js")
import os
import gencaller
import genmodule
import jparser
def gen(inputdir, outputdir):
defmodulelist = []
if not os.path.isdir(outputdir):
os.mkdir(outputdir)
if not ... | {
"repo_name": "qianqians/juggle",
"path": "genjs.py",
"copies": "1",
"size": "1888",
"license": "mit",
"hash": 114693483364166180,
"line_mean": 36.76,
"line_max": 102,
"alpha_frac": 0.4528601695,
"autogenerated": false,
"ratio": 4.571428571428571,
"config_test": false,
"has_no_keywords": fals... |
# 2018-3-16
# build by qianqians
# genmodule
def gencaller(module_name, funcs):
code = "/*this caller file is codegen by juggle for js*/\n"
code += "function " + module_name + "_caller(ch){\n"
code += " Icaller.call(this, \"" + module_name + "\", ch);\n\n"
for i in funcs:
... | {
"repo_name": "qianqians/juggle",
"path": "gen/js/gencaller.py",
"copies": "1",
"size": "1435",
"license": "mit",
"hash": -569487170830817800,
"line_mean": 37.7837837838,
"line_max": 96,
"alpha_frac": 0.3797909408,
"autogenerated": false,
"ratio": 3.8266666666666667,
"config_test": false,
"ha... |
# 2018-3-16
# build by qianqians
# genmodule
def genmodule(module_name, funcs):
code = "/*this module file is codegen by juggle for js*/\n"
code += "function " + module_name + "_module(){\n"
code += " eventobj.call(this);\n"
code += " Imodule.call(this, \"" + module_name + "\");\... | {
"repo_name": "qianqians/juggle",
"path": "gen/js/genmodule.py",
"copies": "1",
"size": "1464",
"license": "mit",
"hash": 984540081742851600,
"line_mean": 36.5384615385,
"line_max": 96,
"alpha_frac": 0.3756830601,
"autogenerated": false,
"ratio": 3.9460916442048517,
"config_test": false,
"has... |
# 2019 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | {
"repo_name": "ocampocj/cloud-custodian",
"path": "tools/c7n_azure/c7n_azure/resources/dns_zone.py",
"copies": "3",
"size": "1218",
"license": "apache-2.0",
"hash": -1725719483398756000,
"line_mean": 28.7073170732,
"line_max": 74,
"alpha_frac": 0.7019704433,
"autogenerated": false,
"ratio": 4.087... |
# 2019 RBH started lines-based ttt program
import numpy as np
# Cells
# 0 1 2 <- row 0 R0
# 3 4 5 <- row 1 R1
# 6 7 8 <- row 2 R2
# / \
# / | | | \
# D0 C0 C1 C2 D1 three columns and two diagonals
Empty, Black, White, Num_Cells, Num... | {
"repo_name": "ryanbhayward/games-puzzles-algorithms",
"path": "simple/ttt/ttt_lines.py",
"copies": "1",
"size": "1634",
"license": "mit",
"hash": -4476568399219366400,
"line_mean": 31.0392156863,
"line_max": 79,
"alpha_frac": 0.5263157895,
"autogenerated": false,
"ratio": 2.340974212034384,
"c... |
# 201. Bitwise AND of Numbers Range
#
# Given a range [m, n] where 0 <= m <= n <= 2147483647,
# return the bitwise AND of all numbers in this range, inclusive.
#
# For example, given the range [5, 7], you should return 4.
# http://www.cnblogs.com/grandyang/p/4431646.html
# The problem is all about finding the longest c... | {
"repo_name": "gengwg/leetcode",
"path": "201_bitwise_and_numbers_range.py",
"copies": "1",
"size": "1417",
"license": "apache-2.0",
"hash": 8990862597345494000,
"line_mean": 25.2407407407,
"line_max": 88,
"alpha_frac": 0.556104446,
"autogenerated": false,
"ratio": 3.4476885644768855,
"config_t... |
# 2020-05-04 13:45:07.486536
from alembic import op
import sqlalchemy as sa
revision = '39a2a2285c4e'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('groups',
sa.Column('id', sa.BigInteger(), nullab... | {
"repo_name": "KrusnikViers/Zordon",
"path": "app/database/migrations/versions/auto_20200504_134507_39a2a2285c4e.py",
"copies": "1",
"size": "3168",
"license": "mit",
"hash": -5546894797215536000,
"line_mean": 42.397260274,
"line_max": 110,
"alpha_frac": 0.6613005051,
"autogenerated": false,
"rat... |
# 2020-05-13 Robinhood
# It's tax season! Given a set of transactions, find out the cost basis for each sell transaction and compute the overall capital gain/loss. The cost basis for a sold equity is the price at which the equity being sold was bought at. The transactions are processed in FIFO order.
# You are provided... | {
"repo_name": "jackchi/interview-prep",
"path": "interviews-from-companies/buy_sell_stocks_robinhood.py",
"copies": "1",
"size": "3279",
"license": "mit",
"hash": 4498996294003962400,
"line_mean": 33.8404255319,
"line_max": 278,
"alpha_frac": 0.5804580153,
"autogenerated": false,
"ratio": 3.66741... |
__author__ = 'Libao Jin'
__date__ = 'December 15, 2015'
class Solution(object):
def isHappy(self, n):
"""
:type n: int
:rtype: bool
"""
if n == 1:
return True
elif n == 0:
return False
else:
appeared_numbers = [n]
... | {
"repo_name": "jinlibao/LeetCode-Solutions",
"path": "solutions/202_Happy_Number.py",
"copies": "2",
"size": "1086",
"license": "mit",
"hash": 6410306104919180000,
"line_mean": 23.6818181818,
"line_max": 53,
"alpha_frac": 0.3784530387,
"autogenerated": false,
"ratio": 3.949090909090909,
"config... |
# 202. Happy Number
#
# Write an algorithm to determine if a number is "happy".
#
# A happy number is a number defined by the following process:
# Starting with any positive integer, replace the number by the sum of the squares of its digits,
# and repeat the process until the number equals 1 (where it will stay),
# or... | {
"repo_name": "gengwg/leetcode",
"path": "202_happy_number.py",
"copies": "1",
"size": "2339",
"license": "apache-2.0",
"hash": -3049637916538346000,
"line_mean": 24.4239130435,
"line_max": 97,
"alpha_frac": 0.4805472424,
"autogenerated": false,
"ratio": 3.8407224958949095,
"config_test": false... |
# 203. Remove Linked List Elements - LeetCode
# https://leetcode.com/problems/remove-linked-list-elements/description/
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class LinkedList(object):
def __init__(self, lst):
se... | {
"repo_name": "heyf/cloaked-octo-adventure",
"path": "leetcode/203_remove-linked-list-elements.py",
"copies": "1",
"size": "1642",
"license": "mit",
"hash": -6959397047682234000,
"line_mean": 23.5223880597,
"line_max": 72,
"alpha_frac": 0.4610231425,
"autogenerated": false,
"ratio": 3.22593320235... |
# 203. Remove Linked List Elements
#
# Remove all elements from a linked list of integers that have value val.
#
# Example
# Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6
# Return: 1 --> 2 --> 3 --> 4 --> 5
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.va... | {
"repo_name": "gengwg/leetcode",
"path": "203_remove_linked_list_elements.py",
"copies": "1",
"size": "1736",
"license": "apache-2.0",
"hash": -1413017446685017900,
"line_mean": 25.303030303,
"line_max": 83,
"alpha_frac": 0.508640553,
"autogenerated": false,
"ratio": 3.9454545454545453,
"config... |
""" 2048 game (with GUI) using Pyglet openGL """
import random
import pyglet
from pyglet.window import key
from pyglet.gl import (GL_COLOR_BUFFER_BIT, GL_TRIANGLE_STRIP, GL_BLEND,
GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, glClear,
glEnable, glDisable, glBlendFunc)
from ai impo... | {
"repo_name": "rcbyron/2048-ai",
"path": "client/game.py",
"copies": "1",
"size": "11608",
"license": "mit",
"hash": 2019859869324549000,
"line_mean": 35.7341772152,
"line_max": 95,
"alpha_frac": 0.4763094418,
"autogenerated": false,
"ratio": 3.398126463700234,
"config_test": false,
"has_no_k... |
"""2048
2048 is a simple game where you combine tiles by sliding them up, down, left, or
right with the arrow keys. You can actually get a fairly high score by repeatedly
sliding in an up, right, down, and left pattern over and over again.
Write a program that will open the game at https://gabrielecirulli.github.io/2... | {
"repo_name": "JoseALermaIII/python-tutorials",
"path": "pythontutorials/books/AutomateTheBoringStuff/Ch11/Projects/P3_2048.py",
"copies": "1",
"size": "2490",
"license": "mit",
"hash": 7399014100949717000,
"line_mean": 32.2,
"line_max": 95,
"alpha_frac": 0.6646586345,
"autogenerated": false,
"ra... |
# 2048.py
# Aug 22, 2015
# Written in python / pygame by DavidSousaRJ - david.sousarj@gmail.com
# License: Creative Commons
# Sorry about some comments in portuguese!
#
# Apr 4, 2017 - n2o.matt@gmail.com
# Make changes in how the move is implemented, since the original game
# forces the player to chose another directio... | {
"repo_name": "davidsousarj/2048py",
"path": "2048py.py",
"copies": "1",
"size": "8037",
"license": "cc0-1.0",
"hash": -4233168921847481000,
"line_mean": 28.5477941176,
"line_max": 88,
"alpha_frac": 0.5275600348,
"autogenerated": false,
"ratio": 3.23420523138833,
"config_test": false,
"has_no... |
#2048 (python replica)
#By Banji Afolabi
#VERSION 1.3
#hbb: Header Button or Border
#MTT: Merged This Turn
# * : Remove All Of These Comments To View Board Log As You Play
import pygame, sys, random
from pygame.locals import *
#CONSTANTS
WINDOWHEIGHT = 625
WINDOWWIDTH = 500
HEADERHEIGHT = 125
TILESIZE = 100
GAPSIZE ... | {
"repo_name": "Bamiji/2048-python-replica",
"path": "2048.py",
"copies": "1",
"size": "48196",
"license": "mit",
"hash": -6165717539106588000,
"line_mean": 44.425070688,
"line_max": 165,
"alpha_frac": 0.3630176778,
"autogenerated": false,
"ratio": 3.956329010014776,
"config_test": false,
"has... |
# 2048 - Yet another 2048 clone
# by KidsCanCode 2014
# For educational purposes only
# TODO:
# Animate moving tiles
import pygame
import sys
import random
# define some colors (R, G, B)
BLACK = (0, 0, 0)
BGCOLOR = BLACK
# constants for game options
FPS = 15
TILESIZE = 100
MARGIN = 5
BORDER = 8
WIDTH = TILESIZE * 4... | {
"repo_name": "kidscancode/gamedev",
"path": "2048/2048.py",
"copies": "1",
"size": "8932",
"license": "mit",
"hash": 3467010507176010000,
"line_mean": 34.728,
"line_max": 81,
"alpha_frac": 0.4769368562,
"autogenerated": false,
"ratio": 4.116129032258065,
"config_test": false,
"has_no_keyword... |
# 204. Count Primes - LeetCode
# https://leetcode.com/problems/count-primes/description/
# Count the number of prime numbers less than a non-negative number, n.
class Solution(object):
def countPrimes_MLE(self, n):
# with input 1500000
jump_dict = {}
count = 0
if n < 3:
... | {
"repo_name": "heyf/cloaked-octo-adventure",
"path": "leetcode/204_count-primes.py",
"copies": "1",
"size": "1166",
"license": "mit",
"hash": -4349046907691009500,
"line_mean": 21.4423076923,
"line_max": 71,
"alpha_frac": 0.4339622642,
"autogenerated": false,
"ratio": 3.533333333333333,
"config... |
# 204. Count Primes
#
# Count the number of prime numbers less than a non-negative number, n.
class Solution(object):
# Time Limit Exceeded
def countPrimes(self, n):
"""
:type n: int
:rtype: int
"""
count = 0
for i in range(2, n):
if self.isPrime(i)... | {
"repo_name": "gengwg/leetcode",
"path": "204_count_primes.py",
"copies": "1",
"size": "1544",
"license": "apache-2.0",
"hash": -6361385058013722000,
"line_mean": 24.7333333333,
"line_max": 71,
"alpha_frac": 0.4417098446,
"autogenerated": false,
"ratio": 3.599067599067599,
"config_test": false,... |
# 205 - Isomorphic Strings (Easy)
# https://leetcode.com/problems/isomorphic-strings/
class Solution(object):
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
# Check if the characters from s can be replaced consistently to
# obtai... | {
"repo_name": "zubie7a/Algorithms",
"path": "LeetCode/01_Easy/lc_205.py",
"copies": "1",
"size": "1442",
"license": "mit",
"hash": 9195111788973638000,
"line_mean": 39.0555555556,
"line_max": 79,
"alpha_frac": 0.567961165,
"autogenerated": false,
"ratio": 3.9184782608695654,
"config_test": fals... |
# 205. Isomorphic Strings
#
# Given two strings s and t, determine if they are isomorphic.
#
# Two strings are isomorphic if the characters in s can be replaced to get t.
#
# All occurrences of a character must be replaced with another character while preserving the order of characters.
# No two characters may map to t... | {
"repo_name": "gengwg/leetcode",
"path": "205_isomorphic_strings.py",
"copies": "1",
"size": "1871",
"license": "apache-2.0",
"hash": 8485230635641269000,
"line_mean": 27.7846153846,
"line_max": 114,
"alpha_frac": 0.5537145911,
"autogenerated": false,
"ratio": 3.408014571948998,
"config_test": ... |
# 206 - Reverse Linked List (Easy)
# https://leetcode.com/problems/reverse-linked-list/
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution(object):
def reverseList(self, head):
"""
... | {
"repo_name": "zubie7a/Algorithms",
"path": "LeetCode/01_Easy/lc_206.py",
"copies": "1",
"size": "1444",
"license": "mit",
"hash": 6319966006035280000,
"line_mean": 35.1,
"line_max": 81,
"alpha_frac": 0.5664819945,
"autogenerated": false,
"ratio": 4.598726114649682,
"config_test": false,
"has... |
"""206. Reverse Linked List
Easy
URL: https://leetcode.com/problems/reverse-linked-list/
Reverse a singly linked list.
Example:
Input: 1->2->3->4->5->NULL
Output: 5->4->3->2->1->NULL
Follow up:
A linked list can be reversed either iteratively or recursively.
Could you implement both?
"""
# Definition for singly-l... | {
"repo_name": "bowen0701/algorithms_data_structures",
"path": "lc0206_reverse_linked_list.py",
"copies": "1",
"size": "3328",
"license": "bsd-2-clause",
"hash": 7543627975628936000,
"line_mean": 23.8358208955,
"line_max": 75,
"alpha_frac": 0.5943509615,
"autogenerated": false,
"ratio": 3.88331388... |
__author__ = 'Libao Jin'
__date__ = 'December 15, 2015'
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def reverseList(self, head):
"""
:type head: ListNode
:rtype: ListNode
... | {
"repo_name": "jinlibao/LeetCode-Solutions",
"path": "solutions/206_Reverse_Linked_List_2.py",
"copies": "2",
"size": "1172",
"license": "mit",
"hash": 9016142337985712000,
"line_mean": 21.9803921569,
"line_max": 44,
"alpha_frac": 0.5264505119,
"autogenerated": false,
"ratio": 3.426900584795322,
... |
# 206. Reverse Linked List
#
# Reverse a singly linked list.
#
# click to show more hints.
#
# Hint:
# A linked list can be reversed either iteratively or recursively. Could you implement both?
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# ... | {
"repo_name": "gengwg/leetcode",
"path": "206_reverse_linked_list.py",
"copies": "1",
"size": "2389",
"license": "apache-2.0",
"hash": 5374376708313924000,
"line_mean": 25.2527472527,
"line_max": 92,
"alpha_frac": 0.5588112181,
"autogenerated": false,
"ratio": 3.8408360128617365,
"config_test":... |
# 206. Reverse Linked List
#
# Reverse a singly-linked list.
#
# Implementation of iterative, recursive, and tail recursive solutions.
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
def reverse_iter(head):
revrsd = None
w... | {
"repo_name": "afbarnard/glowing-broccoli",
"path": "lc/000206.py",
"copies": "1",
"size": "1828",
"license": "mit",
"hash": -5089296812074880000,
"line_mean": 25.1142857143,
"line_max": 72,
"alpha_frac": 0.6384026258,
"autogenerated": false,
"ratio": 3.738241308793456,
"config_test": false,
... |
# 207. Course Schedule
#
# There are a total of n courses you have to take, labeled from 0 to n - 1.
#
# Some courses may have prerequisites,
# for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]
#
# Given the total number of courses and a list of prerequisite pairs,
# is ... | {
"repo_name": "gengwg/leetcode",
"path": "207_course_schedule.py",
"copies": "1",
"size": "3568",
"license": "apache-2.0",
"hash": 4915252508118550000,
"line_mean": 31.7339449541,
"line_max": 108,
"alpha_frac": 0.5916479821,
"autogenerated": false,
"ratio": 3.6974093264248706,
"config_test": fa... |
# 209. Minimum Size Subarray Sum
#
# Given an array of n positive integers and a positive integer s,
# find the minimal length of a contiguous subarray of which the sum >= s.
# If there isn't one, return 0 instead.
#
# For example, given the array [2,3,1,2,4,3] and s = 7,
# the subarray [4,3] has the minimal length und... | {
"repo_name": "gengwg/leetcode",
"path": "209_min_size_subarray_sum.py",
"copies": "1",
"size": "3138",
"license": "apache-2.0",
"hash": 8230000352524756000,
"line_mean": 32.7419354839,
"line_max": 116,
"alpha_frac": 0.5098789038,
"autogenerated": false,
"ratio": 3.606896551724138,
"config_test... |
"""20 may 2014
5pm
24-16 degrees N
120-121 degrees E
Test:
in: COMPREF-10min, COMPREF0, WRFs +- 6 hours
out: matching results/ranking
cd /media/TOSHIBA\ EXT/ARMOR/python
ipython
"""
# 0. parameters, imports and set up
# 1. get the wrf filepaths
# 2. matching and scoring
# imports
import os, time, pickle, da... | {
"repo_name": "yaukwankiu/armor",
"path": "tests/trackingTest20140901.py",
"copies": "1",
"size": "10885",
"license": "cc0-1.0",
"hash": -3927693927953870300,
"line_mean": 34.4560260586,
"line_max": 160,
"alpha_frac": 0.5380799265,
"autogenerated": false,
"ratio": 3.2855418050105643,
"config_te... |
"""20 may 2014
5pm
24-16 degrees N
120-121 degrees E
Test:
in: COMPREF-10min, COMPREF0, WRFs +- 6 hours
out: matching results/ranking
cd /media/TOSHIBA\ EXT/ARMOR/python
ipython
"""
# 0. parameters, imports and set up
# 1. get the wrf filepaths
# 2. matching and scoring
# filepath para... | {
"repo_name": "yaukwankiu/armor",
"path": "tests/localFeaturesTest20141210.py",
"copies": "1",
"size": "10201",
"license": "cc0-1.0",
"hash": 224209239756510560,
"line_mean": 35.0945454545,
"line_max": 160,
"alpha_frac": 0.5228899128,
"autogenerated": false,
"ratio": 3.26432,
"config_test": fal... |
# 20.
print_log('\n20. Prover creates Proof for Proof Request\n')
prover_requested_creds = json.dumps({
'self_attested_attributes': {},
'requested_attributes': {
'attr1_referent': {
'cred_id': prover_cred_for_attr1['referent'],
... | {
"repo_name": "peacekeeper/indy-sdk",
"path": "docs/how-tos/negotiate-proof/python/step4.py",
"copies": "2",
"size": "1566",
"license": "apache-2.0",
"hash": -611209338153532400,
"line_mean": 49.5483870968,
"line_max": 92,
"alpha_frac": 0.4380587484,
"autogenerated": false,
"ratio": 4.5,
"confi... |
''' 20-plot_SL_coverage_restriction.py
===============================================
AIM: Plots the Stray Light coverage restriction in %.
INPUT: files: - <orbit_id>_misc/ : files from 12-<...>.py
variables: see section PARAMETERS (below)
OUTPUT: in <orbit_id>_<SL_angle>figures/ : <orbit_id>_<threshold_obs_time>_... | {
"repo_name": "kuntzer/SALSA-public",
"path": "20_plot_SL_coverage_restriction.py",
"copies": "1",
"size": "3070",
"license": "bsd-3-clause",
"hash": 3698788077424903700,
"line_mean": 26.1681415929,
"line_max": 115,
"alpha_frac": 0.6214983713,
"autogenerated": false,
"ratio": 3.057768924302789,
... |
# 20. Valid Parentheses - LeetCode
# https://leetcode.com/problems/valid-parentheses/description/
# '(', ')', '{', '}', '[' and ']'
# stack base
# Submit 1: "]" edge case
# Submit 2: "[(({})}]" WA
## Logic Failed: ord("(") - ord("}") = -85 < 3
# print ord("(") - ord(")")
# print ord("(") - ord("]") x
# pri... | {
"repo_name": "heyf/cloaked-octo-adventure",
"path": "leetcode/020_valid-parentheses.py",
"copies": "1",
"size": "1075",
"license": "mit",
"hash": 7792605488298479000,
"line_mean": 24.619047619,
"line_max": 62,
"alpha_frac": 0.4027906977,
"autogenerated": false,
"ratio": 3.2282282282282284,
"co... |
# 210. Course Schedule II
#
# There are a total of n courses you have to take, labeled from 0 to n - 1.
#
# Some courses may have prerequisites, for example to take course 0 you have to first take course 1,
# which is expressed as a pair: [0,1]
#
# Given the total number of courses and a list of prerequisite pairs,
# r... | {
"repo_name": "gengwg/leetcode",
"path": "210_course_schedule_ii.py",
"copies": "1",
"size": "3590",
"license": "apache-2.0",
"hash": -7844058311122188000,
"line_mean": 33.5192307692,
"line_max": 108,
"alpha_frac": 0.5922005571,
"autogenerated": false,
"ratio": 3.6520854526958293,
"config_test"... |
# 211. Add and Search Word - Data structure design
#
# Design a data structure that supports the following two operations:
#
# void addWord(word)
# bool search(word)
#
# search(word) can search a literal word or a regular expression string containing
# only letters a-z or .. A . means it can represent any one letter.
#... | {
"repo_name": "gengwg/leetcode",
"path": "211_add_and_search_word.py",
"copies": "1",
"size": "2673",
"license": "apache-2.0",
"hash": 7863006037851692000,
"line_mean": 28.0543478261,
"line_max": 120,
"alpha_frac": 0.5914702581,
"autogenerated": false,
"ratio": 3.7754237288135593,
"config_test"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.