text stringlengths 0 1.05M | meta dict |
|---|---|
#!/bin/env python3
import itertools
import re
if __name__ == "__main__":
regex = re.compile(r"^(\w+) would (gain|lose) (\d+) happiness units by sitting next to (\w+)\.$")
with open("d13.txt") as f:
lines = f.read().splitlines()
names = []
relations = dict()
for l in lines:
m = rege... | {
"repo_name": "f-koehler/adventofcode",
"path": "d13.py",
"copies": "1",
"size": "1403",
"license": "mit",
"hash": -1145619634938277900,
"line_mean": 28.8510638298,
"line_max": 101,
"alpha_frac": 0.5310049893,
"autogenerated": false,
"ratio": 3.421951219512195,
"config_test": false,
"has_no_k... |
#!/bin/env python3
import json
import glob
import re
from bs4 import BeautifulSoup
import sys
from nalaf.utils import MUT_CLASS_ID
def main(html_path='', ann_path=''):
documents = {}
# get files from folders
filelist = glob.glob(html_path + "/*.plain.html")
jsonlist = glob.glob(ann_path + "/*.ann.jso... | {
"repo_name": "Rostlab/nalaf",
"path": "nalaf/utils/db_validation.py",
"copies": "1",
"size": "4910",
"license": "apache-2.0",
"hash": -8889367825649171000,
"line_mean": 36.196969697,
"line_max": 98,
"alpha_frac": 0.4900203666,
"autogenerated": false,
"ratio": 4.175170068027211,
"config_test": ... |
#!/bin/env python3
import os
import signal
import pyinotify
import configparser
import argparse
# Subclass configparser.RawConfigPaser to add getlist().
class config(configparser.RawConfigParser):
def getlist(self, section, option):
""" Gets a list from a CSV value. """
# Get the csv from the config.
value = se... | {
"repo_name": "bigfootslair/inspircd_inotify_rehasher",
"path": "inotify_rehash.py",
"copies": "1",
"size": "1767",
"license": "mit",
"hash": -7044535627598992000,
"line_mean": 23.8873239437,
"line_max": 62,
"alpha_frac": 0.7153367289,
"autogenerated": false,
"ratio": 3.302803738317757,
"config... |
#!/bin/env python3
import os
import sys
import subprocess
from server.helper import print_response, get_target_dir
from server.log import log
from commands.parser import parser
from commands.bash_formatter import unescape
from commands.server_parser import server_parser
def main():
arrrsync_args = vars(server_p... | {
"repo_name": "Nukesor/Arrrsync",
"path": "server/arrrsync_server.py",
"copies": "1",
"size": "3780",
"license": "mit",
"hash": 6179377388021782000,
"line_mean": 33.3636363636,
"line_max": 91,
"alpha_frac": 0.5510582011,
"autogenerated": false,
"ratio": 4.18141592920354,
"config_test": false,
... |
#!/bin/env python3
import os
import sys
from daemonize import Daemonize
from pueue.daemon.files import cleanup
from pueue.argument_parser import parser
from pueue.daemon.daemon import Daemon
from pueue.client.factories import print_command_factory
def daemon_factory(path):
"""Create a closure which creates a ru... | {
"repo_name": "Nukesor/Pueuew",
"path": "pueue/__init__.py",
"copies": "1",
"size": "2474",
"license": "mit",
"hash": -7848157994691807000,
"line_mean": 32.8904109589,
"line_max": 89,
"alpha_frac": 0.6285367825,
"autogenerated": false,
"ratio": 4.022764227642276,
"config_test": true,
"has_no_... |
#!/bin/env python3
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import maxthreads
# Lets say you have a function "fun" you want to run within several threads at the same time.
from time import sleep
from threading import active_count
from random import random
def fun():
print('Active threads:... | {
"repo_name": "Zaeb0s/max-threads",
"path": "tests/test.py",
"copies": "1",
"size": "1062",
"license": "mit",
"hash": 2288357023018297900,
"line_mean": 22.6,
"line_max": 93,
"alpha_frac": 0.6826741996,
"autogenerated": false,
"ratio": 3.4705882352941178,
"config_test": false,
"has_no_keywords... |
#!/bin/env python3
import pathlib
import os
import re
import requests
def find_google_css(content):
ret = []
for i in re.finditer(r'@import url\("([\w\W]+?)"\);', content):
ret.append([i.group(), i.groups()[0]])
return ret
def new_file_name(url):
return os.path.join("font", os.path.split(url... | {
"repo_name": "masterfish2015/my_project",
"path": "c/modern_compiler_implementation_in_c/js/strapdown-zeta-0.7.4/utils/localize_font.py",
"copies": "1",
"size": "1811",
"license": "mit",
"hash": -3067163145345675300,
"line_mean": 29.6949152542,
"line_max": 96,
"alpha_frac": 0.5781336278,
"autogene... |
#!/bin/env python3
import re
import itertools
with open("d21.txt") as f:
regex = re.compile(r"^Hit Points: (\d+)\nDamage: (\d+)\nArmor: (\d+)$")
string = f.read()
m = regex.match(string)
boss = (int(m.group(1)), int(m.group(2)), int(m.group(3)))
weapons = [
(8, 4, 0),
(10, 5, 0),
(25, 6, 0... | {
"repo_name": "f-koehler/adventofcode",
"path": "d21.py",
"copies": "1",
"size": "1697",
"license": "mit",
"hash": -7540836416366029000,
"line_mean": 20.4810126582,
"line_max": 75,
"alpha_frac": 0.4425456688,
"autogenerated": false,
"ratio": 2.9258620689655173,
"config_test": false,
"has_no_k... |
#!/bin/env python3
import re
import operator
def distance(reindeer, time):
fly_speed = reindeer[1]
fly_time = reindeer[2]
rest_time = reindeer[3]
resting = False
t = 0
dist = 0
while t < time:
if resting:
t += rest_time
resting = False
else:
... | {
"repo_name": "f-koehler/adventofcode",
"path": "d14.py",
"copies": "1",
"size": "1253",
"license": "mit",
"hash": 2651323646080274000,
"line_mean": 26.2391304348,
"line_max": 112,
"alpha_frac": 0.4948124501,
"autogenerated": false,
"ratio": 3.1964285714285716,
"config_test": false,
"has_no_k... |
#!/bin/env python3
import re
import sys
from itertools import chain
from functools import wraps
math_opcodes = {
'ADD': 0b0000,
'ADC': 0b0001,
'SUB': 0b0010,
'SBC': 0b0011,
'AND': 0b0100,
'OR': 0b0110,
'XOR': 0b0111,
'MOV': 0b1011,
'CMP': 0b1111,
}
other_opcodes = {
'NOP': 0b00... | {
"repo_name": "firemark/katp91",
"path": "scripts/asm.py",
"copies": "1",
"size": "11716",
"license": "mit",
"hash": -8789156614354660000,
"line_mean": 25.5067873303,
"line_max": 93,
"alpha_frac": 0.5157050188,
"autogenerated": false,
"ratio": 3.0855938899130892,
"config_test": false,
"has_no... |
#!/bin/env python3
import re
def part1():
lights = []
for x in range(0, 1000):
lights.append([False for y in range(0, 1000)])
regex = re.compile(r"^(?P<command>turn\son|turn\soff|toggle)\s(?P<x1>\d+),(?P<y1>\d+)\s+through\s+(?P<x2>\d+),(?P<y2>\d+)$")
with open("d06.txt") as f:
commands ... | {
"repo_name": "f-koehler/adventofcode",
"path": "d06.py",
"copies": "1",
"size": "2479",
"license": "mit",
"hash": 4040970108160325000,
"line_mean": 32.0533333333,
"line_max": 128,
"alpha_frac": 0.4497781363,
"autogenerated": false,
"ratio": 2.9975816203143895,
"config_test": false,
"has_no_k... |
#!/bin/env python3
import re
gate_map = dict()
def read_gate_map():
gate_map.clear()
with open("d07.txt") as f:
gates = f.read().splitlines()
for gate in gates:
m = re_set.match(gate)
if m:
d = m.groupdict()
gate_map[d["out"]] = ["set", d["in"], None]
... | {
"repo_name": "f-koehler/adventofcode",
"path": "d07.py",
"copies": "1",
"size": "1888",
"license": "mit",
"hash": 697830711703754500,
"line_mean": 24.5135135135,
"line_max": 117,
"alpha_frac": 0.4872881356,
"autogenerated": false,
"ratio": 3.011164274322169,
"config_test": false,
"has_no_key... |
#!/bin/env python3
import re
regex = re.compile(r"^Sue (\d+): (\w+): (\d+), (\w+): (\d+), (\w+): (\d+)$")
def matching(gift, sue):
for key, val in sue[1].items():
if val != gift[key]:
return False
return True
def matching2(gift, sue):
for key, val in sue[1].items():
if key =... | {
"repo_name": "f-koehler/adventofcode",
"path": "d16.py",
"copies": "1",
"size": "1416",
"license": "mit",
"hash": 8714951713841983000,
"line_mean": 22.2131147541,
"line_max": 76,
"alpha_frac": 0.4251412429,
"autogenerated": false,
"ratio": 3.240274599542334,
"config_test": false,
"has_no_key... |
#!/bin/env python3
import re
regex = re.compile(r"^(\w+): capacity (-?\d+), durability (-?\d+), flavor (-?\d+), texture (-?\d+), calories (-?\d+)$")
ingredients = []
def score(amounts):
capacity = 0
durability = 0
flavor = 0
texture = 0
calories = 0
for i in range(0, len(ingredients)):
... | {
"repo_name": "f-koehler/adventofcode",
"path": "d15.py",
"copies": "1",
"size": "1767",
"license": "mit",
"hash": 5653230158909085000,
"line_mean": 27.0476190476,
"line_max": 119,
"alpha_frac": 0.4787775891,
"autogenerated": false,
"ratio": 3.206896551724138,
"config_test": false,
"has_no_ke... |
#!/bin/env python3
import re
regex = re.compile(r"^(\w+) (\w+|[\+-]\d+)(?:, ([\+-]\d+))?$")
code = []
with open("d23.txt") as f:
lines = f.read().splitlines()
for l in lines:
m = regex.match(l)
instr = [m.group(1)]
if instr[0] == "jmp":
instr.append(int(m.group(2)))
... | {
"repo_name": "f-koehler/adventofcode",
"path": "d23.py",
"copies": "1",
"size": "1431",
"license": "mit",
"hash": 543198695555718300,
"line_mean": 19.4428571429,
"line_max": 62,
"alpha_frac": 0.4668064291,
"autogenerated": false,
"ratio": 3.038216560509554,
"config_test": false,
"has_no_keyw... |
#!/bin/env python3
import selectors
import socket
import loopfunction
import logging
import queue
import maxthreads
class Log:
INDENTATION = 4
def __init__(self, *args_):
self.do = {'errors': False,
'enter': False,
'exit': False,
'args': False}... | {
"repo_name": "Zaeb0s/epoll-socket-server",
"path": "esockets/socket_server.py",
"copies": "1",
"size": "8600",
"license": "mit",
"hash": 7631446790328838000,
"line_mean": 35.9098712446,
"line_max": 107,
"alpha_frac": 0.5444186047,
"autogenerated": false,
"ratio": 4.5891141942369265,
"config_te... |
#!/bin/env python3
import socket
import struct
import click
@click.command()
@click.argument("mac", required=True, nargs=-1)
@click.option("-d", "--destination", default="255.255.255.255")
@click.option("-p", "--port", default=9, help="Specific host to wakeup")
@click.option("-f", "--filename", help="File with mac ad... | {
"repo_name": "dgengtek/scripts",
"path": "admin/wol.py",
"copies": "1",
"size": "2183",
"license": "mit",
"hash": -6025159449594151000,
"line_mean": 27.3506493506,
"line_max": 76,
"alpha_frac": 0.6376546038,
"autogenerated": false,
"ratio": 3.3636363636363638,
"config_test": false,
"has_no_k... |
#!/bin/env python3
import socket
import threading
from time import sleep
import time
import ESocketS
import selectors
host = socket.gethostbyname(socket.gethostname())
port = 1234
server = ESocketS.Socket(selector=selectors.PollSelector())
server.run_in_subthread('all', True)
server.start()
conections = 20000
def ... | {
"repo_name": "Zaeb0s/epoll-socket-server",
"path": "performance_test.py",
"copies": "1",
"size": "1232",
"license": "mit",
"hash": -2952988446313484300,
"line_mean": 20.2413793103,
"line_max": 65,
"alpha_frac": 0.6501623377,
"autogenerated": false,
"ratio": 3.422222222222222,
"config_test": fa... |
#!/bin/env python3
import sqlite3
import leveldb
cache = leveldb.LevelDB('./url.db');
db = sqlite3.connect('im.db', isolation_level=None);
c = db.cursor();
c.execute(
'''create table if not exists movie (
id TEXT PRIMARY KEY,
url TEXT,
title TEXT,
year INTEGER,
rating REAL,
ratingcount INT... | {
"repo_name": "riaqn/imdb-report",
"path": "crawler.py",
"copies": "1",
"size": "4466",
"license": "mit",
"hash": 2668150232946863600,
"line_mean": 35.0161290323,
"line_max": 151,
"alpha_frac": 0.5147783251,
"autogenerated": false,
"ratio": 4.037974683544304,
"config_test": false,
"has_no_key... |
#!/bin/env python3
import subprocess
import argparse
import argcomplete
import getpass
import sys
import os
import errno
from pykeepass import PyKeePass
parser = argparse.ArgumentParser(
'Starting a kerbose session with password stored in keepass database',
formatter_class=argparse.ArgumentDefaultsHelpFormatte... | {
"repo_name": "enochnotsocool/UnixConfig",
"path": "py_script/keekinit.py",
"copies": "1",
"size": "2195",
"license": "mit",
"hash": -2728060899894901000,
"line_mean": 27.141025641,
"line_max": 81,
"alpha_frac": 0.6692482916,
"autogenerated": false,
"ratio": 3.6042692939244665,
"config_test": f... |
#!/bin/env python3
import subprocess
import sys
import os
import pandas as pd
VCFPATH="~/data/NDAR/Daly/VCFs"
METAPATH="~/data/NDAR/Daly/metafiles"
def read_omics_exp():
''' The second line is skipped as it is explaining the header row'''
fn="omics_experiments.txt"
omics_exp = pd.read_csv(os.path.join(METAPATH, fn... | {
"repo_name": "iiiir/ndarpy",
"path": "bin/meta_parser.py",
"copies": "1",
"size": "2992",
"license": "bsd-3-clause",
"hash": -2854538640025230300,
"line_mean": 34.619047619,
"line_max": 145,
"alpha_frac": 0.7002005348,
"autogenerated": false,
"ratio": 2.448445171849427,
"config_test": false,
... |
#!/bin/env python3
import sys
from setuptools import setup, find_packages
def readme():
with open('README.rst', 'r') as f:
return f.read()
pack_name = 'webbed'
with open(pack_name + '/version.py', 'r') as file:
# getting __version__ variable
exec(file.read())
print('Current version:', __version_... | {
"repo_name": "Zaeb0s/max-threads",
"path": "setup.py",
"copies": "1",
"size": "1633",
"license": "mit",
"hash": 1503666972501518600,
"line_mean": 26.2166666667,
"line_max": 70,
"alpha_frac": 0.5823637477,
"autogenerated": false,
"ratio": 3.339468302658487,
"config_test": false,
"has_no_keywo... |
#!/bin/env python3
import sys
import datetime as dt
import subprocess as sp
import time as t
import os
import re
import argparse
import collections
import pdb
PROG = 'mpv'
FILE = os.path.expanduser('alarma.mp3')
def flatten(l):
return flatten(l[0]) + (flatten(l[1:]) if len(l) >
1 else... | {
"repo_name": "IDex/scripts",
"path": "alarm.py",
"copies": "1",
"size": "4429",
"license": "mit",
"hash": 5393818584270831000,
"line_mean": 30.6357142857,
"line_max": 97,
"alpha_frac": 0.4910815082,
"autogenerated": false,
"ratio": 3.8613775065387967,
"config_test": false,
"has_no_keywords":... |
#!/bin/env python3
import sys
import os
import os.path
import glob
import copy
import traceback
import re
import csv
import tempfile
import urllib.request, urllib.parse, urllib.error
import shutil
import atexit
import subprocess
import time
import math
from collections import defaultdict, Counter
from os.path import jo... | {
"repo_name": "HorvathLab/NGS",
"path": "SCReadCounts/src/scReadCounts.py",
"copies": "1",
"size": "10965",
"license": "mit",
"hash": 6490897394947236000,
"line_mean": 37.8829787234,
"line_max": 299,
"alpha_frac": 0.561878705,
"autogenerated": false,
"ratio": 3.716949152542373,
"config_test": f... |
#!/bin/env python3
import sys
import os
import os.path
import glob
import copy
import traceback
import time
import re
import csv
import tempfile
import urllib.request, urllib.parse, urllib.error
import shutil
import atexit
import subprocess
import time
from collections import defaultdict, Counter
from os.path import jo... | {
"repo_name": "HorvathLab/NGS",
"path": "SNPlice/src/SNPlice.py",
"copies": "1",
"size": "19858",
"license": "mit",
"hash": -7242560977236639000,
"line_mean": 34.2717584369,
"line_max": 133,
"alpha_frac": 0.5761909558,
"autogenerated": false,
"ratio": 3.3789348306959335,
"config_test": false,
... |
#!/bin/env python3
import sys
sys.path.append('.')
sys.path.append('../')
import re
from lewas.parsers import split_parser, ParseError
from lewas.models import Measurement
from weather_station import weather_helper
### Discussion: requiring that we pass metrics and units arrays to
### the parser was not a good desig... | {
"repo_name": "LEWASatVT/lewas",
"path": "tests/test.py",
"copies": "1",
"size": "2139",
"license": "mit",
"hash": 7879439401539275000,
"line_mean": 32.9523809524,
"line_max": 109,
"alpha_frac": 0.6736792894,
"autogenerated": false,
"ratio": 3.6752577319587627,
"config_test": false,
"has_no_k... |
#!/bin/env python3
import sys
try:
import sqlite3 as sql
except ImportError:
print("You need an sqlite3 module to run this program!")
import time
try:
import ipfsapi
except ImportError:
print("You need an ipfsapi module to run this program!")
print("pip install ipfsapi")
raise SystemExit
class I... | {
"repo_name": "Efdecjanie/ipfs-db",
"path": "ipfs_db/ipfs_db.py",
"copies": "1",
"size": "4921",
"license": "mit",
"hash": -1489374567872857000,
"line_mean": 39.0081300813,
"line_max": 230,
"alpha_frac": 0.4759195286,
"autogenerated": false,
"ratio": 4.209580838323354,
"config_test": false,
"... |
#!/bin/env python3
import tempfile
import os
import summary_analysis
from subprocess import Popen, PIPE, STDOUT, check_output, CalledProcessError
import sys
import os
import os.path
import glob
import copy
import traceback
import re
import csv
import tempfile
import urllib.request, urllib.parse, urllib.error
import shu... | {
"repo_name": "HorvathLab/NGS",
"path": "RNA2DNAlign/src/RNA2DNAlign.py",
"copies": "1",
"size": "8750",
"license": "mit",
"hash": -8267214855395260000,
"line_mean": 40.0798122066,
"line_max": 301,
"alpha_frac": 0.6380571429,
"autogenerated": false,
"ratio": 3.561253561253561,
"config_test": fa... |
#!/bin/env python3
import threading
class Loop:
"""Makes it easy for one function to go into an infinite loop
"""
def __init__(self, target,
args=(), kwargs={},
on_start=lambda: None,
on_start_args=(), on_start_kwargs={},
on_stop=lambda: ... | {
"repo_name": "Zaeb0s/loop-function",
"path": "loopfunction/loopfunction.py",
"copies": "1",
"size": "4751",
"license": "mit",
"hash": 7355617036305331000,
"line_mean": 35.5461538462,
"line_max": 120,
"alpha_frac": 0.5914544306,
"autogenerated": false,
"ratio": 4.299547511312217,
"config_test":... |
#!/bin/env python3
import time
import math
import sys
import getopt
from threading import Thread
DEBUG=False
class Sensor:
def __init__(self):
self.value = -1
self.file = None
self.filename = ''
def _open(self, name, mode, file = None):
if not file or file.closed:
... | {
"repo_name": "sammy8806/ebsk",
"path": "ebsk.py",
"copies": "1",
"size": "6008",
"license": "mit",
"hash": 1583805848013415400,
"line_mean": 28.3073170732,
"line_max": 105,
"alpha_frac": 0.555758988,
"autogenerated": false,
"ratio": 3.4748409485251592,
"config_test": false,
"has_no_keywords"... |
import time
from alphaGG.command import Command
"""
Return some info about the bot author.
"""
AUTHOR_ID = 124137111975755776
class Author(Command):
command = 'author'
help = 'Returns some info about the author.'
verbose_help = '`author` - Returns some information about the author as well as a link to ... | {
"repo_name": "pundurs/alpha-gg",
"path": "alphaGG/commands/general.py",
"copies": "1",
"size": "1279",
"license": "mit",
"hash": 8402272406548302000,
"line_mean": 25.6666666667,
"line_max": 111,
"alpha_frac": 0.602814699,
"autogenerated": false,
"ratio": 3.5826330532212887,
"config_test": fals... |
#!/bin/env python3
import tkinter as tk
import threading
import queue
import time
a=threading.Thread()
a.start()
q=queue.Queue()
def worker():
q.put('开始处理')
time.sleep(3)
print("worker complete")
q.put('处理完成')
class Application(tk.Frame):
def __init__(self, master=None):
super().__init_... | {
"repo_name": "yuncliu/Learn",
"path": "python/tk_multithread.py",
"copies": "1",
"size": "1820",
"license": "bsd-3-clause",
"hash": 7204840322394045000,
"line_mean": 25.1449275362,
"line_max": 58,
"alpha_frac": 0.5659645233,
"autogenerated": false,
"ratio": 3.33456561922366,
"config_test": fal... |
#!/bin/env python3
# libsvm has a behaviour which I have only seen on the attached dataset
# The data has a 4-level categorical outcome, and 1.5k boolean predictors (almost all false)
# and a heavy bias towards the last category
#
# When we run libsvm's svm_predict_probability(), a reasonable distribution of categorie... | {
"repo_name": "quevedin/statasvm",
"path": "bugs/libsvm_classification/classfail.py",
"copies": "2",
"size": "2235",
"license": "mit",
"hash": -3863217267889065000,
"line_mean": 36.8813559322,
"line_max": 204,
"alpha_frac": 0.6478747204,
"autogenerated": false,
"ratio": 3.486739469578783,
"conf... |
#!/bin/env python3
"""Module for laboratory reporting.
Containers data and interpretations together and then
streamlines it to different output formats.
"""
import matplotlib.pyplot as plt, re
from matplotlib.figure import Figure
import pandas as pd, re, inspect, os
from itertools import count
from unittest.mock impor... | {
"repo_name": "beukueb/leopard",
"path": "leopard/__init__.py",
"copies": "1",
"size": "20701",
"license": "mit",
"hash": 1138979740629823200,
"line_mean": 40.1550695825,
"line_max": 117,
"alpha_frac": 0.5694893966,
"autogenerated": false,
"ratio": 4.191334278193966,
"config_test": false,
"ha... |
# author: Fei Gao
#
# Number Of Islands
#
# Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.
# Example 1:
# 111... | {
"repo_name": "feigaochn/leetcode",
"path": "p200_number_of_islands.py",
"copies": "2",
"size": "2710",
"license": "mit",
"hash": -489810574609728800,
"line_mean": 34.1948051948,
"line_max": 469,
"alpha_frac": 0.5191881919,
"autogenerated": false,
"ratio": 3.570487483530962,
"config_test": true... |
# author: Fei Gao
#
# Remove Element
#
# Given an array and a value, remove all instances of that value in place and
# return the new length.
# The order of elements can be changed. It doesn't matter what you leave beyond
# the new length.
class Solution:
# @param A a list of integers
# @param el... | {
"repo_name": "feigaochn/leetcode",
"path": "p27_remove_element.py",
"copies": "2",
"size": "1197",
"license": "mit",
"hash": 2594659793413009000,
"line_mean": 23.4285714286,
"line_max": 79,
"alpha_frac": 0.4937343358,
"autogenerated": false,
"ratio": 3.5625,
"config_test": false,
"has_no_key... |
# author: Fei Gao
#
# Repeated Dna Sequences
#
# All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the DNA.
# Write a function to find all the 10-letter-long sequences (substrings) tha... | {
"repo_name": "feigaochn/leetcode",
"path": "p187_repeated_dna_sequences.py",
"copies": "2",
"size": "1227",
"license": "mit",
"hash": -5937938335926270000,
"line_mean": 26.8863636364,
"line_max": 195,
"alpha_frac": 0.6177669112,
"autogenerated": false,
"ratio": 3.408333333333333,
"config_test"... |
# author: Fei Gao
#
# Set Matrix Zeroes
#
# Given a m x n matrix, if an element is 0, set its entire row and column to 0.
# Do it in place.
# click to show follow up.
# Follow up:
# Did you use extra space?
# A straight forward solution using O(mn) space is probably a bad idea.
# A simple improvement uses O(m + n) spa... | {
"repo_name": "feigaochn/leetcode",
"path": "p73_set_matrix_zeroes.py",
"copies": "2",
"size": "1750",
"license": "mit",
"hash": 1030429959256179500,
"line_mean": 29.1724137931,
"line_max": 79,
"alpha_frac": 0.4845714286,
"autogenerated": false,
"ratio": 3.9149888143176734,
"config_test": false... |
# author: Fei Gao
#
# Triangle
#
# Given a triangle, find the minimum path sum from top to bottom. Each step you
# may move to adjacent numbers on the row below.
# For example, given the following triangle
# [
# [2],
# [3,4],
# [6,5,7],
# [4,1,8,3]
# ]
# The minimum path sum from top to bottom is 11 (i.e... | {
"repo_name": "feigaochn/leetcode",
"path": "p120_triangle.py",
"copies": "2",
"size": "1362",
"license": "mit",
"hash": -7185149771647058000,
"line_mean": 24.6981132075,
"line_max": 79,
"alpha_frac": 0.5088105727,
"autogenerated": false,
"ratio": 3.1454965357967666,
"config_test": false,
"ha... |
# author: Fei Gao
#
# Valid Sudoku
#
# Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.
# The Sudoku board could be partially filled, where empty cells are filled with the character '.'.
# A partially filled sudoku which is valid.
# Note:
# A valid Sudoku board (partially filled) is not necess... | {
"repo_name": "feigaochn/leetcode",
"path": "p36_valid_sudoku.py",
"copies": "2",
"size": "1951",
"license": "mit",
"hash": 1559947920041499600,
"line_mean": 30.9836065574,
"line_max": 123,
"alpha_frac": 0.4792414147,
"autogenerated": false,
"ratio": 3.695075757575758,
"config_test": false,
"... |
#!/bin/env python3
# Backtracking based solver for Crazy Machines 3 laser puzzles (e.g.campaign 67 (Laser beams and pyramid))
# Solves 67 in 2.5 minutes on an i7-2640m / 1.2 min on an i7-6700
from math import sqrt, pow
class Thingy2D():
def __init__(self, x=0, y=0):
self.x = int(x)
self.y = int(y)
def clone... | {
"repo_name": "TobleMiner/cm3-utils",
"path": "cmlaser.py",
"copies": "1",
"size": "10292",
"license": "mit",
"hash": 3425386544969165300,
"line_mean": 21.6197802198,
"line_max": 125,
"alpha_frac": 0.6541974349,
"autogenerated": false,
"ratio": 2.5852800803818137,
"config_test": false,
"has_n... |
#!/bin/env python3
class Stack(object):
class EmptyStackError(Exception):
pass
def __init__(self, items=None):
if items is None:
self.list = []
else:
self.list = list(items)
def pop(self):
try:
return self.list.pop()
except Index... | {
"repo_name": "GwenIves/Exercises",
"path": "rgpwp/chapter3_stack.py",
"copies": "1",
"size": "1129",
"license": "mit",
"hash": -3281424665597796000,
"line_mean": 16.640625,
"line_max": 43,
"alpha_frac": 0.5110717449,
"autogenerated": false,
"ratio": 3.6070287539936103,
"config_test": false,
... |
#!/bin/env python3
class Tribool(object):
def __init__(self, val):
if val is None:
self.val = None
else:
self.val = bool(val)
def __str__(self):
return str(self.val)
def __repr__(self):
return "{}({})".format(self.__class__.__name__, self.val)
... | {
"repo_name": "GwenIves/Exercises",
"path": "rgpwp/chapter3_tribool.py",
"copies": "1",
"size": "1738",
"license": "mit",
"hash": 2997699461579842600,
"line_mean": 18.0989010989,
"line_max": 71,
"alpha_frac": 0.4470655926,
"autogenerated": false,
"ratio": 3.368217054263566,
"config_test": false... |
#!/bin/env python3
'''Converts GIFs to anim2d files.'''
import json, locale, os, subprocess, sys
try:
gif = sys.argv[1]
out_dir = sys.argv[2]
except:
sys.exit('convert.py [gif] [out]')
if not os.path.exists(out_dir): os.mkdir(out_dir)
subprocess.call(['convert', gif, os.path.join(out_dir, '%d.png')])
size = [in... | {
"repo_name": "PrincessTeruko/anim2d",
"path": "convert.py",
"copies": "1",
"size": "1118",
"license": "mit",
"hash": -2894123556724254000,
"line_mean": 23.8444444444,
"line_max": 66,
"alpha_frac": 0.6118067979,
"autogenerated": false,
"ratio": 2.5701149425287357,
"config_test": false,
"has_n... |
import random
import uuid
from aiohttp import web
class Server:
ports = []
def __init__(self):
# create random object
for i in range(0, random.randint(1, 5)):
self.ports.append({'id': str(uuid.uuid4()), 'name': 'port%d' % i})
async def port_list(self, request):
retu... | {
"repo_name": "redhat-cip/restfuzz",
"path": "demo/demo_server.py",
"copies": "1",
"size": "2061",
"license": "apache-2.0",
"hash": 2536872050158508500,
"line_mean": 30.2272727273,
"line_max": 78,
"alpha_frac": 0.6249393498,
"autogenerated": false,
"ratio": 3.7135135135135133,
"config_test": fa... |
# Copyright 2020 Google LLC
#
# 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, ... | {
"repo_name": "GoogleCloudPlatform/bigquery-oreilly-book",
"path": "blogs/bigquery_backup/helper_utils.py",
"copies": "1",
"size": "2445",
"license": "apache-2.0",
"hash": -387310472071733600,
"line_mean": 32.0405405405,
"line_max": 112,
"alpha_frac": 0.681390593,
"autogenerated": false,
"ratio":... |
from IntelHexRecord import IntelHexRecord
from Avr109 import Avr109
import time
import sys
import os
import traceback
import binascii
class FirmwareSegment(object):
def __init__(self, memory_type, address, data):
self.memory_type = memory_type
self.address = address
self.dat... | {
"repo_name": "mobilinkd/tnc1-python-config",
"path": "BootLoader.py",
"copies": "1",
"size": "6839",
"license": "apache-2.0",
"hash": -3777951354702864000,
"line_mean": 30.2283105023,
"line_max": 133,
"alpha_frac": 0.5221523615,
"autogenerated": false,
"ratio": 4.056346381969158,
"config_test"... |
#!/bin/env python3
def count_shiny_gold(bags, key, visited):
if key == "shiny gold":
return 1
if key in visited:
return 0
return sum(count_shiny_gold(bags, k, visited + [key]) for k in bags[key].keys())
def count_embedded_bags(bags, key, visited):
return sum(v * (count_embedded_bags(b... | {
"repo_name": "bbglab/adventofcode",
"path": "2020/jordi/day7/part1and2.py",
"copies": "1",
"size": "1155",
"license": "mit",
"hash": 8751626546137287000,
"line_mean": 35.09375,
"line_max": 199,
"alpha_frac": 0.5913419913,
"autogenerated": false,
"ratio": 3.031496062992126,
"config_test": false... |
import sys
from eprl import eprl, resolver, util, dbstore, vargs
# catch portage python module import error
# probably a result of not running as root
# continue script and attempt to error out
# at root privilege check
try:
import portage
except ImportError:
print('hmm, can\'t find portage python module, that\... | {
"repo_name": "borysn/eprl",
"path": "eprl/cli.py",
"copies": "1",
"size": "2300",
"license": "mit",
"hash": 7092538700010241000,
"line_mean": 28.8701298701,
"line_max": 84,
"alpha_frac": 0.6634782609,
"autogenerated": false,
"ratio": 3.533026113671275,
"config_test": false,
"has_no_keywords"... |
#!/bin/env python3
"""
Extracts all metro and RER stations from an OSM dump.
"""
import xml.etree.cElementTree as ET
import argparse
import csv
from math import radians, cos, sin, asin, sqrt
class Station(object):
"""A train station"""
def __init__(self, name, osm_id, lat, lon, accessible=False):
self... | {
"repo_name": "emembrives/dispotrains",
"path": "dispotrains.webapp/src/analysis/all_stations.py",
"copies": "1",
"size": "6277",
"license": "apache-2.0",
"hash": 8414462632735734000,
"line_mean": 31.3453608247,
"line_max": 94,
"alpha_frac": 0.6046215139,
"autogenerated": false,
"ratio": 3.517376... |
#!/bin/env python3
'''
Filter mutations based on the various conditions defined by user
'''
from __future__ import print_function
import sys,math;
import argparse;
import re;
parser=argparse.ArgumentParser(description="filter mutations in samples.");
sampledef=parser.add_argument_group('Sample definitions');
sampled... | {
"repo_name": "davidliwei/rnaseqmut",
"path": "script/filtermut.py",
"copies": "1",
"size": "7463",
"license": "mit",
"hash": -2715001619597142500,
"line_mean": 45.3540372671,
"line_max": 351,
"alpha_frac": 0.6725177543,
"autogenerated": false,
"ratio": 2.9197965571205007,
"config_test": false,... |
#!/bin/env python3
#Form select options:
lociOptions = ['', #index 0 not used
'myflqpaper_loci.csv', #index 1
]
alleleOptions = ['', #index 0 not used
'myflqpaper_alleles.csv', #index 1
]
import json, subprocess
appsession = json.load(open('/data/input/AppSession.json'))
infor... | {
"repo_name": "beukueb/myflq",
"path": "src/basespace/myflq_wrapper.py",
"copies": "1",
"size": "4913",
"license": "mit",
"hash": -4295591845148893000,
"line_mean": 37.3828125,
"line_max": 144,
"alpha_frac": 0.5931202931,
"autogenerated": false,
"ratio": 3.4404761904761907,
"config_test": false... |
#!/bin/env python3
from alphaGG import config
from alphaGG.command import Command
"""
Dynamic help command. Responds with the help properties of the registered command classes.
"""
class Help(Command):
command = 'help'
help = 'Shows this message.'
def handle(self):
kw = ' '.join(self.message.co... | {
"repo_name": "pundurs/alpha-gg",
"path": "alphaGG/commands/help.py",
"copies": "1",
"size": "1160",
"license": "mit",
"hash": 2555524437857152000,
"line_mean": 31.2222222222,
"line_max": 114,
"alpha_frac": 0.5793103448,
"autogenerated": false,
"ratio": 4.296296296296297,
"config_test": false,
... |
#!/bin/env python3
from collections import Counter
from django.conf import settings
from django.contrib.auth.decorators import login_required, permission_required
from django.db import models as dm
from django.shortcuts import get_object_or_404, render
from django.views.generic.list import BaseListView
from django.vie... | {
"repo_name": "pundurs/sc2cm",
"path": "sc2clanman/views.py",
"copies": "1",
"size": "4361",
"license": "mit",
"hash": 3447449202292052000,
"line_mean": 32.2900763359,
"line_max": 110,
"alpha_frac": 0.6397615226,
"autogenerated": false,
"ratio": 3.5658217497955844,
"config_test": false,
"has_... |
#!/bin/env python3
from collections import namedtuple
from typing import List
Instruction = namedtuple('Instruction', ['label', 'arg'])
ExecResult = namedtuple('ExecResult', ['pos', 'acc', 'loop'])
INSTRUCTION_SET = {
"nop": lambda x: (+1, x[0]),
"acc": lambda x: (+1, x[0] + x[1]),
"jmp": lambda x: (x[1]... | {
"repo_name": "bbglab/adventofcode",
"path": "2020/jordi/day8/part1and2.py",
"copies": "1",
"size": "1806",
"license": "mit",
"hash": -7320090431136200000,
"line_mean": 31.25,
"line_max": 121,
"alpha_frac": 0.6367663344,
"autogenerated": false,
"ratio": 3.5762376237623763,
"config_test": false,... |
#!/bin/env python3
from copy import copy
import time
import cairo
import sys
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GObject
from numpy import matrix as mat
from transform import rotate_transform as rot, scale_transform as sca, translate_transform as tra
from camera import viewing_t... | {
"repo_name": "kourbou/pythree-gtk",
"path": "play.py",
"copies": "1",
"size": "2940",
"license": "mit",
"hash": -3157108174346075600,
"line_mean": 27,
"line_max": 164,
"alpha_frac": 0.5653061224,
"autogenerated": false,
"ratio": 3.237885462555066,
"config_test": false,
"has_no_keywords": fal... |
#!/bin/env python3
from deluge_client import DelugeRPCClient
import os, shutil
deluge_host="172.18.0.9"
deluge_port=58765
deluge_username="localclient"
deluge_password="01a23b45c67d89e01f23a45b67c89d01e23f4567"
cleanup_path="/downloads/tv"
client = DelugeRPCClient(deluge_host, deluge_port, deluge_username, deluge_pa... | {
"repo_name": "JohnDoee/deluge-client",
"path": "examples/clean_up_torrents_directory.py",
"copies": "1",
"size": "1217",
"license": "mit",
"hash": -7859878293657666000,
"line_mean": 32.8055555556,
"line_max": 139,
"alpha_frac": 0.7066557108,
"autogenerated": false,
"ratio": 2.856807511737089,
... |
#!/bin/env python3
from django.contrib.admin import ModelAdmin
from django.utils.translation import ugettext as _
from django.utils.text import Truncator
"""
Modeladmins, actions and other functions for the ClanMember model.
"""
def make_members(modeladmin, request, queryset):
"""Mark queryset as clan members""... | {
"repo_name": "pundurs/sc2cm",
"path": "sc2clanman/modeladmins/clanmember.py",
"copies": "1",
"size": "3415",
"license": "mit",
"hash": -5999123670718051000,
"line_mean": 32.4803921569,
"line_max": 113,
"alpha_frac": 0.6459736457,
"autogenerated": false,
"ratio": 3.8806818181818183,
"config_tes... |
#!/bin/env python3
from django.http import JsonResponse
from django.utils import timezone
from django.views.generic import View
from django.utils.translation import ugettext as _
from .. import models
def api_response(data, data_kw, message=_('Success'), **kwargs):
"""
Function for preserving the same style ... | {
"repo_name": "pundurs/sc2cm",
"path": "sc2clanman/api/views.py",
"copies": "1",
"size": "2631",
"license": "mit",
"hash": 1275382683206642700,
"line_mean": 27,
"line_max": 110,
"alpha_frac": 0.6218167997,
"autogenerated": false,
"ratio": 3.974320241691843,
"config_test": false,
"has_no_keywo... |
#!/bin/env python3
from .forms import *
import logging
import json
class ChatRoom:
def __init__(self, name, room_id):
self.name = name
self.room_id = room_id
self.clients = []
def add_client(self, client):
client.room_name = self.name
self.clients.append(client)
... | {
"repo_name": "Zaeb0s/websocket-chat-server",
"path": "websocketchat/chat_room.py",
"copies": "1",
"size": "1364",
"license": "mit",
"hash": -3949809888905928700,
"line_mean": 31.4761904762,
"line_max": 87,
"alpha_frac": 0.5674486804,
"autogenerated": false,
"ratio": 3.7888888888888888,
"config... |
#!/bin/env python3
from lxml import html
from lxml.html.clean import clean_html
import requests
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from optparse import make_option
import os
import csv
import json
import yaml
from defaultpw.models import Vendor, VendorMo... | {
"repo_name": "vagabondcoder/django-router-defaults",
"path": "defaultpw/management/commands/read_rw.py",
"copies": "1",
"size": "9022",
"license": "mit",
"hash": -3672903125605415400,
"line_mean": 28.0096463023,
"line_max": 118,
"alpha_frac": 0.6015295943,
"autogenerated": false,
"ratio": 2.9368... |
#! /bin/env python3
from selenium import webdriver
import selenium.common
import argparse
import sys
import pickle
import time
class wait_for_page_load(object):
"""
As seen here:
http://www.obeythetestinggoat.com/how-to-get-selenium-to-wait-for-page-load-after-a-click.html
"""
def __init__(self, b... | {
"repo_name": "nebososo/dropbox-downloader",
"path": "cookie-getter.py",
"copies": "1",
"size": "1895",
"license": "mit",
"hash": -901002580139385700,
"line_mean": 26.0714285714,
"line_max": 98,
"alpha_frac": 0.6374670185,
"autogenerated": false,
"ratio": 3.5890151515151514,
"config_test": fals... |
#!/bin/env python3
from setuptools import setup
from esockets import __version__
import sys
def readme():
with open('README.rst') as f:
return f.read()
print('Current version: ', __version__)
version = __version__.split('.')
if sys.argv[-1] == 'minor':
version[2] = str(int(version[2]) + 1)
del... | {
"repo_name": "Zaeb0s/epoll-socket-server",
"path": "setup.py",
"copies": "1",
"size": "1522",
"license": "mit",
"hash": 3994993279694542000,
"line_mean": 27.7169811321,
"line_max": 108,
"alpha_frac": 0.605781866,
"autogenerated": false,
"ratio": 3.337719298245614,
"config_test": false,
"has_... |
#!/bin/env python3
from threading import Lock, Event
from .exceptions import *
from .RFC6455 import *
import logging
from json import JSONEncoder
class Client:
CONNECTING = 0
OPEN = 1
CLOSING = 2
CLOSED = 3
_states = {CONNECTING: 'Connecting',
OPEN: 'Open',
CLOSING: ... | {
"repo_name": "Zaeb0s/epoll-websocket-server",
"path": "ewebsockets/ClientSocket.py",
"copies": "1",
"size": "7044",
"license": "mit",
"hash": -1364019930560142000,
"line_mean": 35.1230769231,
"line_max": 122,
"alpha_frac": 0.522572402,
"autogenerated": false,
"ratio": 4.380597014925373,
"confi... |
# Hoff -- A gatekeeper for your commits
# Copyright 2016 Ruud van Asseldonk
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# A copy of the License has been included in the root of the repository.
from json import dumps
from sys im... | {
"repo_name": "ruuda/hoff",
"path": "tools/send-webhook.py",
"copies": "1",
"size": "2437",
"license": "apache-2.0",
"hash": 7592927328368518000,
"line_mean": 28.3614457831,
"line_max": 78,
"alpha_frac": 0.5716044317,
"autogenerated": false,
"ratio": 3.6980273141122915,
"config_test": false,
... |
#!/bin/env python3
## Implementing a database for STRs and SNPs
#Database functions
def login(user="""admin""", passwd="""passall""" ,database='', test=False):
"""
Returns the formed connection with the db using variablenames: conn, sql
If test: just tests the connection, and closes it again returning Non... | {
"repo_name": "beukueb/myflq",
"path": "src/MyFLsite/myflq/MyFLdb.py",
"copies": "1",
"size": "13177",
"license": "mit",
"hash": -3401798772716012500,
"line_mean": 42.7774086379,
"line_max": 118,
"alpha_frac": 0.6217651969,
"autogenerated": false,
"ratio": 3.929913510289293,
"config_test": fals... |
#!/bin/env python3
import argparse
from encodings import aliases
def get_blocksize(argument):
try:
blocksize = int(argument)
if not 8 < blocksize < 80:
raise ValueError("Blocksize out of range: {}".format(blocksize))
except ValueError as err:
raise argparse.ArgumentTypeErr... | {
"repo_name": "GwenIves/Exercises",
"path": "pip3/7_2_xdump.py",
"copies": "1",
"size": "2688",
"license": "mit",
"hash": 5395365774550354000,
"line_mean": 28.2173913043,
"line_max": 92,
"alpha_frac": 0.5509672619,
"autogenerated": false,
"ratio": 3.873198847262248,
"config_test": false,
"has... |
#!/bin/env python3
import argparse
import esprima
import json
import logging
import os
import re
import sys
import traceback
logger = logging.getLogger(__name__)
err_context = 3
def get_req_body_elems(obj, elems):
if obj.type in ['FunctionExpression', 'ArrowFunctionExpression']:
get_req_body_elems(obj.... | {
"repo_name": "wekan/wekan",
"path": "openapi/generate_openapi.py",
"copies": "1",
"size": "39522",
"license": "mit",
"hash": 6393007232192367000,
"line_mean": 35.6623376623,
"line_max": 287,
"alpha_frac": 0.4852234199,
"autogenerated": false,
"ratio": 4.665564868374454,
"config_test": false,
... |
#!/bin/env python3
import argparse
import esprima
import json
import os
import re
import sys
def get_req_body_elems(obj, elems):
if obj.type == 'FunctionExpression':
get_req_body_elems(obj.body, elems)
elif obj.type == 'BlockStatement':
for s in obj.body:
get_req_body_elems(s, ele... | {
"repo_name": "GhassenRjab/wekan",
"path": "openapi/generate_openapi.py",
"copies": "1",
"size": "32085",
"license": "mit",
"hash": -935077509083759900,
"line_mean": 34.0655737705,
"line_max": 287,
"alpha_frac": 0.5104877669,
"autogenerated": false,
"ratio": 4.4145569620253164,
"config_test": f... |
#!/bin/env python3
import argparse
import imp
import logging
import sys
import os
import watcher
import config
def main(argv):
parser = argparse.ArgumentParser('mail_notify')
parser.add_argument('maildir')
parser.add_argument('--config', '-c', help="configuration file")
parser.add_argument('--verbos... | {
"repo_name": "Larhard/Maildir-Notifier",
"path": "mail_notify.py",
"copies": "1",
"size": "1199",
"license": "mit",
"hash": 2440021261854703600,
"line_mean": 28.243902439,
"line_max": 96,
"alpha_frac": 0.6613844871,
"autogenerated": false,
"ratio": 3.5791044776119403,
"config_test": true,
"h... |
#!/bin/env python3
import argparse
import json
import logging
import os
import subprocess
import tempfile
from typing import List
from urllib import request
REPO = 'https://raw.githubusercontent.com/gockelhahn/qual-o-mat-data'
class Party:
def __init__(self, id: int, name: str):
self.id = id
self.name = n... | {
"repo_name": "levjj/wahlomat-visualization",
"path": "render.py",
"copies": "1",
"size": "4659",
"license": "mit",
"hash": 6022639553416228000,
"line_mean": 36.8780487805,
"line_max": 116,
"alpha_frac": 0.6312513415,
"autogenerated": false,
"ratio": 3.4460059171597632,
"config_test": false,
... |
#!/bin/env python3
import argparse
import locale
import time
import sys
import os
YEAR_SHOW_LIMIT = 60 * 60 * 24 * 30 * 6
def get_stat(root, path, args):
if args.modified or args.sizes or args.order[0][0] != "n":
return os.lstat(os.path.join(root, path))
else:
return None
def get_sort_key(ar... | {
"repo_name": "GwenIves/Exercises",
"path": "pip3/5_1_ls.py",
"copies": "1",
"size": "3505",
"license": "mit",
"hash": -8647560058402189000,
"line_mean": 25.7557251908,
"line_max": 82,
"alpha_frac": 0.5711840228,
"autogenerated": false,
"ratio": 3.5475708502024292,
"config_test": false,
"has_... |
#!/bin/env python3
import argparse
import os
import queue
import threading
import xml.etree.ElementTree
class Worker(threading.Thread):
def __init__(self, input_queue, output_queue, args):
super().__init__()
self.input_queue = input_queue
self.output_queue = output_queue
self.verb... | {
"repo_name": "GwenIves/Exercises",
"path": "pip3/10_2_xml.py",
"copies": "1",
"size": "3324",
"license": "mit",
"hash": -8289206565836034000,
"line_mean": 24.96875,
"line_max": 95,
"alpha_frac": 0.5385078219,
"autogenerated": false,
"ratio": 4.191677175283733,
"config_test": false,
"has_no_k... |
import argparse
import os
from .glloader import GLLoader
__author__ = 'Miles Lacey'
# -----------------------------------------------------------------------------
PROGRAM_NAME = 'glloader'
PROGRAM_DESC = 'The LSGL command-line utility can be used to generate an ' \
'OpenGL loader library using on... | {
"repo_name": "hamsham/LightSky-GL-Loader",
"path": "lsgl/__main__.py",
"copies": "1",
"size": "3341",
"license": "mit",
"hash": -2245947637267681000,
"line_mean": 36.1222222222,
"line_max": 106,
"alpha_frac": 0.5770727327,
"autogenerated": false,
"ratio": 4.460614152202937,
"config_test": fals... |
#! /bin/env python3
import argparse
import os.path
import sys
def read_file(name):
d = {}
with open(name, "rb") as f:
data = f.read()
d = {
'title': os.path.splitext(os.path.basename(name))[0],
'data': data,
'size': len(data)
}
return d
def read... | {
"repo_name": "Idorobots/atari-xe-multicart",
"path": "buildcart.py",
"copies": "1",
"size": "2871",
"license": "mit",
"hash": -6510726038224591000,
"line_mean": 32.7764705882,
"line_max": 178,
"alpha_frac": 0.5701846047,
"autogenerated": false,
"ratio": 3.233108108108108,
"config_test": false,... |
#! /bin/env python3
import argparse
import sys
import os
import mechanicalsoup
import pickle
import requests
from urllib.parse import unquote_plus
import queue
import shutil
parser = argparse.ArgumentParser()
parser.add_argument("dropbox_url")
parser.add_argument("output_dir")
parser.add_argument("-c" , "--cookies")
... | {
"repo_name": "nebososo/dropbox-downloader",
"path": "dropbox-downloader.py",
"copies": "1",
"size": "1860",
"license": "mit",
"hash": -483156834866246660,
"line_mean": 30.5254237288,
"line_max": 79,
"alpha_frac": 0.6397849462,
"autogenerated": false,
"ratio": 3.463687150837989,
"config_test": ... |
#!/bin/env python3
import cmath
import math
import sys
def get_float(msg, allow_zero):
while True:
try:
x = float(input(msg))
if allow_zero or abs(x) >= sys.float_info.epsilon:
return x
else:
print("Zero not allowed")
except Valu... | {
"repo_name": "GwenIves/Exercises",
"path": "pip3/2_2_quadratic.py",
"copies": "1",
"size": "1291",
"license": "mit",
"hash": 3988370532050035000,
"line_mean": 20.8813559322,
"line_max": 69,
"alpha_frac": 0.4639814098,
"autogenerated": false,
"ratio": 3.1642156862745097,
"config_test": false,
... |
#!/bin/env python3
import collections
import sys
ID, FORENAME, MIDDLENAME, SURNAME, DEPARTMENT = range(5)
NAME_WIDTH = 18
USERNAME_WIDTH = 9
User = collections.namedtuple("User", "username forename middlename surname id")
def main():
users = []
usernames = collections.defaultdict(int)
for filename in ... | {
"repo_name": "GwenIves/Exercises",
"path": "pip3/3_3_generate_usernames.py",
"copies": "1",
"size": "2524",
"license": "mit",
"hash": -1427193459201317000,
"line_mean": 25.0206185567,
"line_max": 92,
"alpha_frac": 0.559429477,
"autogenerated": false,
"ratio": 3.3608521970705727,
"config_test":... |
#!/bin/env python3
import copy
import collections
class Atomic(object):
def __init__(self, container, deep_copy=False):
mutable_collections = (
collections.MutableSequence,
collections.MutableSet,
collections.MutableMapping
)
if not isinstance(container... | {
"repo_name": "GwenIves/Exercises",
"path": "pip3/chapter_8/atomic.py",
"copies": "1",
"size": "1768",
"license": "mit",
"hash": -1290816763791711000,
"line_mean": 22.2631578947,
"line_max": 93,
"alpha_frac": 0.4988687783,
"autogenerated": false,
"ratio": 3.6910229645093944,
"config_test": fals... |
#/bin/env python3
import copy
import json
import os
import re
import warnings
from typing import List, Optional, Set
def rewrite_data_passing_to_use_volumes(
workflow: dict,
volume: dict,
path_prefix: str = 'artifact_data/',
) -> dict:
'''Converts Argo workflow that passes data using arti... | {
"repo_name": "kubeflow/pipelines",
"path": "sdk/python/kfp/compiler/_data_passing_using_volume.py",
"copies": "1",
"size": "10819",
"license": "apache-2.0",
"hash": -650287217100050400,
"line_mean": 53.6414141414,
"line_max": 296,
"alpha_frac": 0.6398927812,
"autogenerated": false,
"ratio": 4.54... |
#!/bin/env python3
import csv
import io
import optparse
import xml.sax.saxutils
MAX_WIDTH = 100
def print_start():
print("<table border='1'>")
def print_end():
print("</table>")
def extract_fields(line):
try:
reader = csv.reader(io.StringIO(line), delimiter=',')
return list(reader)[0]
... | {
"repo_name": "GwenIves/Exercises",
"path": "pip3/2_3_csv2html.py",
"copies": "1",
"size": "2330",
"license": "mit",
"hash": 7607760654602374000,
"line_mean": 21.6213592233,
"line_max": 91,
"alpha_frac": 0.5060085837,
"autogenerated": false,
"ratio": 4.024179620034542,
"config_test": false,
"... |
#!/bin/env python3
import csv
import json
import yaml
def import_HC_data(node_file, interaction_file, xref_source_file, xref_matrix_file, xref_i_file):
SalmoNet = {"node": {}, "interaction": {}, "groups": {}, "strains": []}
#lode xrefs
xref = {"source": {}, "matrix": {}}
with open(xref_source_file) as... | {
"repo_name": "TGAC/SalmoNet",
"path": "scripts/import_HC_data.py",
"copies": "1",
"size": "8986",
"license": "mit",
"hash": 5395946248084150000,
"line_mean": 44.1557788945,
"line_max": 157,
"alpha_frac": 0.4658357445,
"autogenerated": false,
"ratio": 3.5142745404771216,
"config_test": false,
... |
#!/bin/env python3
import csv
import json
OrthologGroups = {"uniprot": {}, "group": {}}
with open("../data/ortholog_groups.csv") as f:
reader = csv.reader(f, delimiter=';')
headers = next(reader)
for row in reader:
if row[0] not in OrthologGroups["group"]:
OrthologGroups["group"][row[0... | {
"repo_name": "NetBiol/SalmoNet",
"path": "scripts/SalmoNet2json.py",
"copies": "2",
"size": "2455",
"license": "mit",
"hash": 7840307594964720000,
"line_mean": 33.1111111111,
"line_max": 97,
"alpha_frac": 0.5197556008,
"autogenerated": false,
"ratio": 3.111533586818758,
"config_test": false,
... |
#!/bin/env python3
import csv
import json
strains = []
SalmoNet = {"node": {}, "interaction": {}, "groups": {}}
with open("../data/HC_nodes.csv") as f:
reader = csv.reader(f, delimiter=";")
header = next(reader)
for row in reader:
SalmoNet["node"][row[0]] = {
"name": row[1],
... | {
"repo_name": "NetBiol/SalmoNet",
"path": "scripts/HC_websitedata.py",
"copies": "1",
"size": "1972",
"license": "mit",
"hash": -8233573691623252000,
"line_mean": 32.4406779661,
"line_max": 101,
"alpha_frac": 0.4619675456,
"autogenerated": false,
"ratio": 3.297658862876254,
"config_test": false... |
#!/bin/env python3
import cv2
import numpy as np
from time import time
from pprint import PrettyPrinter
try:
from comparator.common import *
except:
from common import *
sift = cv2.ORB_create()
sift_f = lambda e: sift.detectAndCompute(e, None) #return (kp, des)
bf = cv2.BFMatcher(cv2.NORM_L1,crossCheck=False)
d... | {
"repo_name": "HKervadec/cmp_imgs",
"path": "comparator/orb.py",
"copies": "1",
"size": "1697",
"license": "mit",
"hash": 6421984807175540000,
"line_mean": 21.64,
"line_max": 74,
"alpha_frac": 0.6776664702,
"autogenerated": false,
"ratio": 2.685126582278481,
"config_test": false,
"has_no_keyw... |
#!/bin/env python3
import datacube
from datacube.api.query import query_group_by
import pandas as pd
from functools import partial
import click
@click.command(name='pixeldrill')
@click.option('--filter_value-value', '-f', type=(str, int))
@click.option('--time-period', '-t', type=(str, str), help='<start-date> <stop... | {
"repo_name": "omad/damootils",
"path": "scripts/pixeldrill.py",
"copies": "1",
"size": "1748",
"license": "apache-2.0",
"hash": -8993264559249627000,
"line_mean": 29.6666666667,
"line_max": 86,
"alpha_frac": 0.6292906178,
"autogenerated": false,
"ratio": 3.237037037037037,
"config_test": false... |
#!/bin/env python3
import datetime
from django.core.management.base import BaseCommand
from django.utils.translation import ugettext as _
from ...models import SyncLog, ClanMember
from ... import sc2player
import sys
class Command(BaseCommand):
""" Goes over all of the members in the database and updates all of ... | {
"repo_name": "pundurs/sc2cm",
"path": "sc2clanman/management/commands/syncmemberdetails.py",
"copies": "1",
"size": "2639",
"license": "mit",
"hash": 3477106680676826000,
"line_mean": 38.3880597015,
"line_max": 104,
"alpha_frac": 0.5831754452,
"autogenerated": false,
"ratio": 4.195548489666137,
... |
#!/bin/env python3
import datetime
import re
import sys
from xml.dom import Node
import html5lib
import requests
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils import timezone
from django.utils.translation import ugettext as _
from ...models import SyncLog, ClanM... | {
"repo_name": "pundurs/sc2cm",
"path": "sc2clanman/management/commands/syncmembers.py",
"copies": "1",
"size": "6618",
"license": "mit",
"hash": -4600896675898492400,
"line_mean": 40.6226415094,
"line_max": 118,
"alpha_frac": 0.5686007857,
"autogenerated": false,
"ratio": 4.070110701107011,
"co... |
#!/bin/env python3
import discord
from alphaGG.data import Database
"""
The base class for defining commands and plugins to use with the bot.
"""
class Command(object):
"""
A class representing a bot command.
"""
command = None
help = '' # Short help command
verbose_help = '' # Verbose hel... | {
"repo_name": "pundurs/alpha-gg",
"path": "alphaGG/command.py",
"copies": "1",
"size": "1851",
"license": "mit",
"hash": 2064650460949100500,
"line_mean": 32.0535714286,
"line_max": 120,
"alpha_frac": 0.6520799568,
"autogenerated": false,
"ratio": 4.721938775510204,
"config_test": false,
"has... |
#!/bin/env python3
import discord
import datetime
from dateutil import parser
import feedparser
from math import floor
from alphaGG.command import Command
"""
Posts new TeamLiquid.net news into a server channel.
"""
class TeamLiquidFeed(Command):
TL_FEED = 'http://www.teamliquid.net/rss/news.xml'
CHANNEL ... | {
"repo_name": "pundurs/alpha-gg",
"path": "alphaGG/commands/teamliquid.py",
"copies": "1",
"size": "2075",
"license": "mit",
"hash": 341465116692524100,
"line_mean": 29.9701492537,
"line_max": 113,
"alpha_frac": 0.6081927711,
"autogenerated": false,
"ratio": 4.060665362035225,
"config_test": fa... |
#!/bin/env python3
import esockets
import logging
from .RFC6455 import *
from .ClientSocket import Client
class Websocket:
def __init__(self,
handle_new_connection=lambda client: True,
handle_websocket_frame=lambda client, frame: True,
on_client_open=lambda clie... | {
"repo_name": "Zaeb0s/epoll-websocket-server",
"path": "ewebsockets/websocket_server.py",
"copies": "1",
"size": "3658",
"license": "mit",
"hash": -720230953622084500,
"line_mean": 37.1041666667,
"line_max": 131,
"alpha_frac": 0.5965008201,
"autogenerated": false,
"ratio": 4.365155131264917,
"c... |
#!/bin/env python3
import ewebsockets
from ewebsockets import Frame, OpCode
from time import time, sleep
import maxthreads
from .forms import *
import logging
from .chat_room import *
from .database import *
from .client import Client
from .crypto import *
import random, string
from .email_functions import *
import pd... | {
"repo_name": "Zaeb0s/websocket-chat-server",
"path": "websocketchat/chat_server.py",
"copies": "1",
"size": "37292",
"license": "mit",
"hash": 7009190959561562000,
"line_mean": 41.8655172414,
"line_max": 142,
"alpha_frac": 0.5098144374,
"autogenerated": false,
"ratio": 4.12704736609119,
"confi... |
#!/bin/env python3
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import GdkPixbuf
from time import time
from comparator import orb, common, comparator
class MainWindow(Gtk.Window):
def __init__(self, target, neighbors=[]):
Gtk.Window.__init__(self, title="Com... | {
"repo_name": "HKervadec/cmp_imgs",
"path": "interface.py",
"copies": "1",
"size": "2519",
"license": "mit",
"hash": 5651931223750871000,
"line_mean": 31.3076923077,
"line_max": 99,
"alpha_frac": 0.621675268,
"autogenerated": false,
"ratio": 3.4744827586206894,
"config_test": false,
"has_no_k... |
#!/bin/env python3
import glob
import pandas as pd
import json
import pprint
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
from collections import defaultdict
def add_freq(e1, e2):
for k in e2:
e1[k] += len(e2[k])
return e1
def analyse(files, results):
for f in f... | {
"repo_name": "freifunk-darmstadt/utilities",
"path": "channel-survey/analyse.py",
"copies": "1",
"size": "1091",
"license": "mit",
"hash": 7103471617125883000,
"line_mean": 19.2037037037,
"line_max": 52,
"alpha_frac": 0.571035747,
"autogenerated": false,
"ratio": 3.577049180327869,
"config_tes... |
#!/bin/env python3
import http.server
import socketserver
from Bio import SeqIO
import json
import io
import gzip
class ProdigalHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
presets = [
{ 'name': 'IAI39.gb', 'id': 1 },
{ 'name': 'O83-H1-str-NRG-857C.gb', 'id': 2 },
{ 'name': '... | {
"repo_name": "TrentonSarnowski/GenomeBusters",
"path": "polymorphs-master/prodigal.py",
"copies": "1",
"size": "5673",
"license": "mit",
"hash": 1887871180478543400,
"line_mean": 34.679245283,
"line_max": 98,
"alpha_frac": 0.5644279922,
"autogenerated": false,
"ratio": 3.90702479338843,
"confi... |
#!/bin/env python3
import itertools
import re
if __name__ == "__main__":
regex = re.compile(r"^(?P<from>\w+) to (?P<to>\w+) = (?P<dist>\d+)$")
with open("d09.txt") as f:
lines = f.read().splitlines()
locations = []
distances = dict()
for l in lines:
m = regex.match(l)
f =... | {
"repo_name": "f-koehler/adventofcode",
"path": "d09.py",
"copies": "1",
"size": "1093",
"license": "mit",
"hash": 4915681873163000000,
"line_mean": 25.0238095238,
"line_max": 73,
"alpha_frac": 0.5096065874,
"autogenerated": false,
"ratio": 3.5953947368421053,
"config_test": false,
"has_no_ke... |
#!/bin/env python3
import json
import os
from pprint import pprint
from requests import get
import subprocess
print("starting...")
def download_latest_release():
print("downloading prodigal...")
req_content = json.loads(get("https://api.github.com/repos/hyattpd/Prodigal/releases/latest").content.decode('utf... | {
"repo_name": "TrentonSarnowski/GenomeBusters",
"path": "polymorphs-master/setup.py",
"copies": "1",
"size": "1030",
"license": "mit",
"hash": -9127763450498961000,
"line_mean": 28.4285714286,
"line_max": 122,
"alpha_frac": 0.6514563107,
"autogenerated": false,
"ratio": 3.468013468013468,
"conf... |
#!/bin/env python3
import logging
import sys
import os
import argparse
import yaml
import subprocess
from colorama import Fore
from colorama import Style
LOGGER = logging.getLogger(__name__)
DEPENDENCIES_YAML = './dependencies.yml'
PACMAN_INST_CMD = ['yay', '-S','--needed']
HOME = os.path.expanduser('~')
# --dotfiles... | {
"repo_name": "DiegoGuidaF/dotfiles",
"path": "setup.py",
"copies": "1",
"size": "3324",
"license": "mit",
"hash": 9036167870443603000,
"line_mean": 39.5365853659,
"line_max": 128,
"alpha_frac": 0.6880264741,
"autogenerated": false,
"ratio": 3.8516801853997684,
"config_test": true,
"has_no_ke... |
#!/bin/env python3
import math as m
# set in / out file
filein = 'NiceClock.kicad_pcb'
fileout = 'NiceClock_.kicad_pcb'
# search for this to get the LED sections in the file
fidx1 = '(module custom_janh:PLCC2 (layer F.Cu) '
# this are the radii where the LEDs are placed
rad1 = (250/2) -6 -5
rad2 = rad1 -5 -5 -5
# ... | {
"repo_name": "janhieber/NiceClock",
"path": "hardware/scripts/place_LEDs.py",
"copies": "1",
"size": "2136",
"license": "mit",
"hash": 3167791530222610000,
"line_mean": 38.5555555556,
"line_max": 110,
"alpha_frac": 0.5711610487,
"autogenerated": false,
"ratio": 2.637037037037037,
"config_test"... |
#!/bin/env python3
import math
class Point(object):
def __init__(self, x=0, y=0):
self.x = x
self.y = y
def __eq__(self, other):
return self.x == other.x and self.y == other.y
def __repr__(self):
return "Point({0.x!r}, {0.y!r})".format(self)
def __str__(self):
... | {
"repo_name": "GwenIves/Exercises",
"path": "pip3/6_1_point.py",
"copies": "1",
"size": "1787",
"license": "mit",
"hash": -6374281412993803000,
"line_mean": 16.87,
"line_max": 56,
"alpha_frac": 0.471740347,
"autogenerated": false,
"ratio": 3.0916955017301038,
"config_test": false,
"has_no_key... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.