text stringlengths 0 1.05M | meta dict |
|---|---|
#!/bin/py
#
# open file
# read contents
# (re)start when third column found
#
import sys
#
# open and read file
#
path="../data/statistics_micro2.lvm"
file = open(path, "r+")
#
# data objects
#
set_names = []
voltage = []
std = []
height = []
voltage2 = []
std2 = []
height2 = []
for line in file... | {
"repo_name": "nicholasmalaya/paleologos",
"path": "exp/press_trans/code/read_micro_stats.py",
"copies": "2",
"size": "1643",
"license": "mit",
"hash": 1977348866010121000,
"line_mean": 17.6704545455,
"line_max": 80,
"alpha_frac": 0.6354230067,
"autogenerated": false,
"ratio": 2.803754266211604,
... |
#!/bin/py
#
# Use scipy to integrate:
#
# dy^2 / dt^2 = -g + r (dh/dt)^2 (object falling with drag)
#
import pylab
import settings_infer
import numpy as np
#
# main function (example)
#
if __name__ == "__main__":
"""Example Driver for Solving Equation of Motion with Drag"""
# --------------------------... | {
"repo_name": "nicholasmalaya/paleologos",
"path": "uq/ps2/ode_driver.py",
"copies": "2",
"size": "1569",
"license": "mit",
"hash": 8757411236960905000,
"line_mean": 25.593220339,
"line_max": 90,
"alpha_frac": 0.5130656469,
"autogenerated": false,
"ratio": 3.4559471365638768,
"config_test": fal... |
#!../../bin/python2.6
import sys
import time
import logging
import cgi
import datetime
import logging
import struct
import hashlib
from socket import error as socket_error
import json
import gevent
from gunicorn.workers.async import ALREADY_HANDLED
from nitrogen import websocket
from . import *
from nitrogen impo... | {
"repo_name": "mikeboers/Nitrogen",
"path": "example/controllers/websocket.py",
"copies": "1",
"size": "3127",
"license": "bsd-3-clause",
"hash": -8491576730773072000,
"line_mean": 24.4227642276,
"line_max": 151,
"alpha_frac": 0.5183882315,
"autogenerated": false,
"ratio": 3.860493827160494,
"c... |
#!../../bin/python2.6
import sys
import time
import logging
import cgi
import datetime
import logging
import struct
import hashlib
import json
import os
from nitrogen.eventstream import Event, Response as EventResponse
from . import *
log = logging.getLogger(__name__)
@route('/')
def do_index(request):
retur... | {
"repo_name": "mikeboers/Nitrogen",
"path": "example/controllers/eventstream.py",
"copies": "1",
"size": "2136",
"license": "bsd-3-clause",
"hash": -4247768316697289700,
"line_mean": 21.7234042553,
"line_max": 151,
"alpha_frac": 0.5669475655,
"autogenerated": false,
"ratio": 3.682758620689655,
... |
#!/bin/python2.7
# -*- coding: utf-8 -*-
"""
Lucas Ou 2014 -- http://lucasou.com
Setup guide: http://guide.python-distribute.org/creation.html
python setup.py sdist bdist_wininst upload
"""
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
packages = [
'newspaper',
... | {
"repo_name": "seem-sky/newspaper",
"path": "setup.py",
"copies": "1",
"size": "1167",
"license": "mit",
"hash": -5748895896981301000,
"line_mean": 21.4423076923,
"line_max": 68,
"alpha_frac": 0.6503856041,
"autogenerated": false,
"ratio": 3.1370967741935485,
"config_test": false,
"has_no_key... |
#!/bin/python2.7
# -*- coding: utf-8 -*-
"""
Lucas Ou-Yang 2014 -- http://codelucas.com
"""
import sys
import os
import codecs
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
packages = [
'newspaper',
]
if sys.argv[-1] == 'publish':
os.system('python3 setup.... | {
"repo_name": "Factr/newspaper",
"path": "setup.py",
"copies": "1",
"size": "1520",
"license": "mit",
"hash": 7773995535336257000,
"line_mean": 23.126984127,
"line_max": 74,
"alpha_frac": 0.6447368421,
"autogenerated": false,
"ratio": 3.408071748878924,
"config_test": false,
"has_no_keywords"... |
#!/bin/python2.7
# -*- coding: utf-8 -*-
"""
Lucas Ou-Yang 2014 -- http://codelucas.com
Setup guide: http://guide.python-distribute.org/creation.html
python setup.py sdist bdist_wininst upload
"""
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
packages = [
'newspap... | {
"repo_name": "cantino/newspaper",
"path": "setup.py",
"copies": "1",
"size": "1937",
"license": "mit",
"hash": -2373257840020266500,
"line_mean": 22.9135802469,
"line_max": 68,
"alpha_frac": 0.6288074342,
"autogenerated": false,
"ratio": 3.1292407108239093,
"config_test": false,
"has_no_keyw... |
#!/bin/python2.7
from __builtin__ import id
import os
import commands
from netaddr import IPNetwork
from scd_new_analisador_conflitos import analise_Conflito
import time
from threading import Thread
import threading, Queue
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "scd.settings")
from django.core.management imp... | {
"repo_name": "felipetomm/POX-Django",
"path": "scd_coletor_thread.py",
"copies": "1",
"size": "11877",
"license": "apache-2.0",
"hash": 1371299953916190500,
"line_mean": 39.6780821918,
"line_max": 119,
"alpha_frac": 0.5544329376,
"autogenerated": false,
"ratio": 3.2863862755949085,
"config_tes... |
#!/bin/python2.7
from __builtin__ import id
import os
import commands
from netaddr import IPNetwork
from scd_new_analisador_conflitos import analise_Conflito
import time
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "scd.settings")
from django.core.management import execute_from_command_line
from django.db.models i... | {
"repo_name": "felipetomm/POX-Django",
"path": "scd_coletor.py",
"copies": "1",
"size": "11279",
"license": "apache-2.0",
"hash": -8828952794193032000,
"line_mean": 40.7777777778,
"line_max": 123,
"alpha_frac": 0.5316960723,
"autogenerated": false,
"ratio": 3.3759353486979946,
"config_test": fa... |
#!/bin/python2.7
from __future__ import division
# -*- coding: utf-8 -*-
'''
Torifier's spam filter offline test tool
to test new filter settings without pyBM running
https://github.com/torifier/PyBitmessage/tree/master/bitmessage-API/spamfilter
https://beamstat.com/chan/general
insert filter part after l... | {
"repo_name": "torifier/PyBitmessage",
"path": "bitmessage-API/spamfilter/spamfilter-test-offline.py",
"copies": "1",
"size": "13794",
"license": "mit",
"hash": -3898299787271984000,
"line_mean": 47.914893617,
"line_max": 202,
"alpha_frac": 0.4553429027,
"autogenerated": false,
"ratio": 4.0499119... |
#!/bin/python2.7
from vars import *
from datetime import datetime
import copy
import sys
#Converts an integer
#to its english
#representation
def toString(number):
if (number == 0):
return 'zero'
if (number == 1):
return 'one'
if (number == 2):
return 'two'
if (number == 3):
... | {
"repo_name": "killerbat00/pyclock",
"path": "clock.py",
"copies": "1",
"size": "2537",
"license": "mit",
"hash": -3562978480868200000,
"line_mean": 25.1546391753,
"line_max": 93,
"alpha_frac": 0.5620811983,
"autogenerated": false,
"ratio": 3.09390243902439,
"config_test": false,
"has_no_keyw... |
#!/bin/python2.7
"""
A tool to insert institutions from CSV files.
Requirements:
- requests
- gusregon
- unicodecsv
- jmespath
Example usage:
To run help text use:
$ python insert_institution_csv.py -h
"""
import argparse
import sys
import itertools
from Queue import Queue
import jmespath
import requests
impo... | {
"repo_name": "watchdogpolska/feder",
"path": "api_examples/export_institution_csv.py",
"copies": "1",
"size": "2509",
"license": "mit",
"hash": -4643127543253811000,
"line_mean": 22.6698113208,
"line_max": 83,
"alpha_frac": 0.571143882,
"autogenerated": false,
"ratio": 3.6627737226277373,
"con... |
#!/bin/python2.7
"""
A tool to insert institutions from CSV files.
Requirements:
- requests
- gusregon
- unicodecsv
- tqdm
Example usage:
To run help text use:
$ python insert_court.py -h
"""
import argparse
import os
import sys
import requests
import requests_cache
import unicodecsv as csv
from gusregon impor... | {
"repo_name": "watchdogpolska/feder",
"path": "api_examples/insert_court.py",
"copies": "1",
"size": "6184",
"license": "mit",
"hash": -3158993506019057000,
"line_mean": 30.0502512563,
"line_max": 88,
"alpha_frac": 0.5324486163,
"autogenerated": false,
"ratio": 3.6867541766109784,
"config_test"... |
#!/bin/python2.7
"""
A tool to insert institutions from CSV files.
Requirements:
- requests
- gusregon
- unicodecsv
- tqdm
Example usage:
To run help text use:
$ python insert_institution_generic.py -h
"""
import argparse
import sys
import requests
import csv
from gusregon import GUS
from utils import environ... | {
"repo_name": "watchdogpolska/feder",
"path": "api_examples/insert_institution_generic.py",
"copies": "1",
"size": "10259",
"license": "mit",
"hash": 3738993617595377700,
"line_mean": 31.6719745223,
"line_max": 88,
"alpha_frac": 0.4992689346,
"autogenerated": false,
"ratio": 4.197626841243863,
... |
#!/bin/python2.7
"""
A tool to insert institutions from CSV files.
Requirements:
- requests
Example usage:
To run help text use:
$ python insert_institution.py -h
To insert prefiltered database use:
$ (cat /tmp/wojewodowie.csv | grep -E 'Wojewoda|TERC') | python insert_institution.py \
... | {
"repo_name": "watchdogpolska/feder",
"path": "api_examples/insert_institution.py",
"copies": "1",
"size": "3108",
"license": "mit",
"hash": 6413899824115572000,
"line_mean": 27,
"line_max": 88,
"alpha_frac": 0.5209137709,
"autogenerated": false,
"ratio": 3.860869565217391,
"config_test": false... |
#!/bin/python2.7
#CLASS PARA VERIFICAR OS GRUPOS DE CONFLITO
class ScdGrupoConflito(object):
def __init__(self):
self.in_port = False
self.ip_src = False
self.ip_dst = False
self.dl_src = False
self.dl_dst = False
self.tp_src = False
self.tp_dst = False
... | {
"repo_name": "felipetomm/POX-Django",
"path": "scd_new_analisador_conflitos.py",
"copies": "1",
"size": "24255",
"license": "apache-2.0",
"hash": -4018301404528995000,
"line_mean": 55.6728971963,
"line_max": 178,
"alpha_frac": 0.4779633065,
"autogenerated": false,
"ratio": 3.220687823662196,
"... |
#!/bin/python2.7
from lib_parser import *
import argparse
################################################################
# lib_self_check
################################################################
def lib_self_check(lib, ls_pin_exception=list()):
"""<< (library_t) lib
1. all the pins in the same bus h... | {
"repo_name": "phdbreak/lib_parser.py",
"path": "lib_checker.py",
"copies": "1",
"size": "6203",
"license": "apache-2.0",
"hash": 6404519096137530000,
"line_mean": 41.4863013699,
"line_max": 163,
"alpha_frac": 0.4754151217,
"autogenerated": false,
"ratio": 3.59177764910249,
"config_test": false... |
import argparse
import sys
import getopt
import random
import re
import time
"""
Author: Rui Martiniano
Date:25/08/2015
Description: converts GATK pileup to plink format
usage: pileup2plink.py [-i] <input.GATK.pileup> [-d] <dataset.bim> [-q] <quality> [-o] <prefix> [-h]
Filters input file (pileup format) and conve... | {
"repo_name": "ruidlpm/Utils",
"path": "pileup2plink.py",
"copies": "1",
"size": "4626",
"license": "mit",
"hash": 3594542265483659300,
"line_mean": 25.5862068966,
"line_max": 169,
"alpha_frac": 0.6374837873,
"autogenerated": false,
"ratio": 2.976833976833977,
"config_test": false,
"has_no_ke... |
import fileinput
import sys
pieces = ['p', 'n', 'b', 'r', 'q', 'k', 'P', 'N', 'B', 'R', 'Q', 'K']
def main():
"""
Reads 8 lines at a time from the file named by the first argument,
converting them into a board and getting all the bitboards for them.
Then prints them out to a file named by the second... | {
"repo_name": "BenedictEggers/coelacanth",
"path": "scripts/bb_gen.py",
"copies": "1",
"size": "2817",
"license": "mit",
"hash": -7447321762083291000,
"line_mean": 25.3271028037,
"line_max": 78,
"alpha_frac": 0.5676251331,
"autogenerated": false,
"ratio": 3.5523329129886507,
"config_test": fals... |
#!/bin/python2
# -*- coding: UTF-8 -*-
from os import remove
import subprocess
from PySide import QtGui, QtCore
from pylab import suptitle, ylim, xlim, scatter, show
class SpektralneGUI(QtGui.QWidget):
def __init__(self):
super(SpektralneGUI, self).__init__()
self.init_ui()
def init_ui(self)... | {
"repo_name": "msoltysik/SelectedTopicsFromAlgebra",
"path": "SpektralneGUI.py",
"copies": "1",
"size": "3459",
"license": "apache-2.0",
"hash": 6302615958343492000,
"line_mean": 32.2403846154,
"line_max": 109,
"alpha_frac": 0.5932889789,
"autogenerated": false,
"ratio": 3.336872586872587,
"con... |
'''
author: atupal
2013.7.21
'''
#import requests,
import time
import re
import threading
from Queue import Queue
import json
from random import randint as rand
import urllib2, random
import ConfigParser
import io
import traceback, sys
config = r'''
[base]
url=http://bksjw.hust.edu.cn/reportServlet
[param]
acti... | {
"repo_name": "atupal/getscore_hub",
"path": "getscore.py",
"copies": "1",
"size": "5945",
"license": "mit",
"hash": 674233729184267900,
"line_mean": 25.3053097345,
"line_max": 264,
"alpha_frac": 0.596804037,
"autogenerated": false,
"ratio": 2.8269139324774133,
"config_test": true,
"has_no_ke... |
#!/bin/python2
# -*- coding: utf-8 -*-
# ex20.py: Functions And Files
# Importing argv from sys library
from sys import argv
# Passing arguments via argv
script, input_file = argv
# Function that prints the entire specified file
def print_all(f):
print f.read()
# Function that resets its position at the beginning... | {
"repo_name": "dadavidson/Python_Lab",
"path": "LP3THW/ex20.py",
"copies": "1",
"size": "1764",
"license": "mit",
"hash": -8443093212235656000,
"line_mean": 28.4166666667,
"line_max": 193,
"alpha_frac": 0.7431972789,
"autogenerated": false,
"ratio": 3.4054054054054053,
"config_test": false,
"... |
#!/bin/python2
# -*- coding: utf-8 -*-
# ex21.py: Functions Can Return Something
def add(a, b):
print "ADDING %d + %d" % (a, b)
return a + b
def subtract(a, b):
print "SUBTRACTING %d - %d" % (a, b)
return a - b
def multiply(a, b):
print "MULTIPLYING %d * %d" % (a, b)
return a * b
def divide... | {
"repo_name": "dadavidson/Python_Lab",
"path": "LP3THW/ex21.py",
"copies": "1",
"size": "1690",
"license": "mit",
"hash": 914808238769050000,
"line_mean": 34.2291666667,
"line_max": 402,
"alpha_frac": 0.6869822485,
"autogenerated": false,
"ratio": 3.2688588007736943,
"config_test": false,
"ha... |
#!/bin/python2
# -*- coding: utf8 -*-
try:
from numpy import *
import matplotlib.pyplot as plt
except Exception as e:
print(e)
import sys
import json
if sys.version_info < (3, 0):
import visual as vs
else:
print("Warning: Python-Visual not found.")
try:
from scipy.special import *
def SphereVolume(di... | {
"repo_name": "Milias/ModellingSimulation",
"path": "Week4/python/graphs.py",
"copies": "1",
"size": "5611",
"license": "mit",
"hash": -3771686301449978000,
"line_mean": 31.2356321839,
"line_max": 162,
"alpha_frac": 0.5892315921,
"autogenerated": false,
"ratio": 2.824269889224572,
"config_test"... |
#!/bin/python2
# Creates calendar.dat an OAuth thing to let program access
# a user's google calendar without knowing their password
# Time stamps are 'RFC 3339 timestamp'
from apiclient.discovery import build
from oauth2client.file import Storage
from oauth2client.client import OAuth2WebServerFlow
from oauth2cli... | {
"repo_name": "illegalprime/super-helpful-and-intelligent-tyrone",
"path": "proprietary/GoogleCalendar/calendarAPI.py",
"copies": "1",
"size": "2823",
"license": "apache-2.0",
"hash": 6119302204374367000,
"line_mean": 23.9911504425,
"line_max": 125,
"alpha_frac": 0.6946510804,
"autogenerated": fals... |
#!bin/python2
from blog.models import User, ROLE_ADMIN
from blog import db
def test_admin(passwd, email):
admin_db = User.query.filter_by(nickname='admin').first()
if admin_db:
if not admin_db.password_correct(passwd) or admin_db.email != email:
return False
return True
def main():
... | {
"repo_name": "pulmro/pulmro-blog",
"path": "create_admin.py",
"copies": "1",
"size": "1082",
"license": "apache-2.0",
"hash": -8634062194510853000,
"line_mean": 29.9428571429,
"line_max": 101,
"alpha_frac": 0.6284658041,
"autogenerated": false,
"ratio": 3.8505338078291813,
"config_test": false... |
#!/bin/python2
from __future__ import print_function, division
import numpy as np
import theano
import theano.tensor as T
class MLP(object):
"""
HiddenLayer + LogisticRegression
"""
def __init__(self, rng, input, n_in, n_hidden, n_out):
"""Initialize the parameters for the multilayer perceptr... | {
"repo_name": "xanxys/shogi_recognizer",
"path": "neuralnet.py",
"copies": "1",
"size": "9417",
"license": "mit",
"hash": -6053214187262896000,
"line_mean": 39.7662337662,
"line_max": 97,
"alpha_frac": 0.595093979,
"autogenerated": false,
"ratio": 4.014066496163683,
"config_test": false,
"has... |
#!/bin/python2
from mysql.connector import (connection) #import library mysql
import datetime #import library mysql
import sys #import library sys
try:
import paho.mqtt.client as mqtt
import paho.mqtt.publish as publish
except ImportError:
# This part is only required to run the example from within the example... | {
"repo_name": "matteb99/mqtt-mysql-telegram",
"path": "python/mqtt-mysql-server.py",
"copies": "1",
"size": "4524",
"license": "mit",
"hash": -3951770608162015000,
"line_mean": 37.0168067227,
"line_max": 137,
"alpha_frac": 0.6821396994,
"autogenerated": false,
"ratio": 3.3240264511388684,
"conf... |
#!/bin/python2
from SimpleCV import *
from ds325 import DS325
depthsense = DS325()
while True:
# THESE THREE ARE SIMPLECV IMAGE
iD = depthsense.getDepth()
#iD.show()
iS = depthsense.getImage()
#iS.show()
iY = depthsense.getSync()
#iY.show()
# in beta
iH = depthsense.getDept... | {
"repo_name": "Snkz/DepthSense-SimpleCV",
"path": "sample_use.py",
"copies": "1",
"size": "1315",
"license": "bsd-2-clause",
"hash": -8401638697070607000,
"line_mean": 24.2884615385,
"line_max": 71,
"alpha_frac": 0.6365019011,
"autogenerated": false,
"ratio": 2.9683972911963883,
"config_test": ... |
#!/bin/python2
import commands
import fcntl
import json
import random
import re
import socket
import struct
import urllib2 as urllib
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from SocketServer import ThreadingMixIn
from cv2 import imshow, namedWindow, setWindowProperty
from datetime import timedelta... | {
"repo_name": "MyrikLD/twoHands",
"path": "main.py",
"copies": "1",
"size": "15969",
"license": "apache-2.0",
"hash": 1628315634395807000,
"line_mean": 23.6816074189,
"line_max": 273,
"alpha_frac": 0.5939006826,
"autogenerated": false,
"ratio": 2.7699913269731136,
"config_test": false,
"has_n... |
#!/bin/python2
import pyglet # Version 1.2.2
# from audio import AudioFile # Sound engine
from math import pi, sin, cos
from collections import OrderedDict
from pyglet.window import key, mouse
from pyglet.gl import *
from lepton import Particle, ParticleGroup, default_system
from lepton.emitter import StaticEmitter
... | {
"repo_name": "NiclasEriksen/py-towerwars",
"path": "deploy/src/main.py",
"copies": "1",
"size": "34748",
"license": "cc0-1.0",
"hash": 7677847190457974000,
"line_mean": 36.0843116329,
"line_max": 79,
"alpha_frac": 0.5002877863,
"autogenerated": false,
"ratio": 3.6438758389261743,
"config_test"... |
#!/bin/python2
import pyglet # Version 1.2.2
# from audio import AudioFile # Sound engine
import os
import glob
from math import pi, sin, cos
from collections import OrderedDict
from pyglet.window import key, mouse
from pyglet.gl import *
from lepton import Particle, ParticleGroup, default_system
from lepton.emitter... | {
"repo_name": "NiclasEriksen/py-towerwars",
"path": "src/main.py",
"copies": "1",
"size": "42075",
"license": "cc0-1.0",
"hash": 5767073345175501000,
"line_mean": 35.3028472821,
"line_max": 78,
"alpha_frac": 0.5033868093,
"autogenerated": false,
"ratio": 3.7390029325513194,
"config_test": false... |
#!/bin/python2
import requests
import json
from bs4 import BeautifulSoup
from urlparse import urljoin
from urllib import quote
from os.path import isfile
import argparse
import unicodedata
import sys
parser = argparse.ArgumentParser(description='Get mcanime anime list from a specified profile.\
... | {
"repo_name": "jlneder/mcanime2mal",
"path": "mcanime2mal.py",
"copies": "1",
"size": "11364",
"license": "mit",
"hash": 1677170192775159300,
"line_mean": 40.7794117647,
"line_max": 159,
"alpha_frac": 0.5752375924,
"autogenerated": false,
"ratio": 3.401376833283448,
"config_test": false,
"has... |
#!/bin/python2
import serial
import json
import os, sys
import time
import subprocess
import itertools
from collections import deque
import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils
class getCounts():
""" Returns a generator function that outputs the counts from the usbcounter device.
t is the no. of data ... | {
"repo_name": "sunjerry019/photonLauncher",
"path": "helpers/getCounts.py",
"copies": "1",
"size": "2767",
"license": "apache-2.0",
"hash": -8691701399077994000,
"line_mean": 33.1604938272,
"line_max": 142,
"alpha_frac": 0.5504156126,
"autogenerated": false,
"ratio": 3.669761273209549,
"config_... |
#!/bin/python2
import signal
from tornado import web, gen, escape
from tornado.options import define, options
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop, PeriodicCallback
from tornado.iostream import StreamClosedError
import json, uuid, os, re
from systemd import journal
def journalctl... | {
"repo_name": "skob/journal",
"path": "webjournal.py",
"copies": "1",
"size": "6560",
"license": "unlicense",
"hash": -2041184610164172000,
"line_mean": 32.641025641,
"line_max": 200,
"alpha_frac": 0.5634146341,
"autogenerated": false,
"ratio": 3.825072886297376,
"config_test": false,
"has_no... |
#!/bin/python2
import time
import json
import httplib2
import gflags
from apiclient.discovery import build
from oauth2client.file import Storage
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run
def getTodaysTimeRange():
nform = '%Y-%m-%dT00:00:00%z'
time_min = time.strftime(... | {
"repo_name": "illegalprime/super-helpful-and-intelligent-tyrone",
"path": "proprietary/GoogleCalendar/getTodaysEvents.py",
"copies": "1",
"size": "3928",
"license": "apache-2.0",
"hash": -8824266823717447000,
"line_mean": 22.9573170732,
"line_max": 98,
"alpha_frac": 0.6759164969,
"autogenerated": ... |
#Author: Stephan Kuschel
### TODO: Write a parallel version of the Monte Carlo Algorithm. Should become an easy example for how to work with parallel programming in python.
import math
import random
import time
def _apfelrekursion(c, max_recursion):
z = 0 + 0j
zehn = range(9)
while max_recursion > 0:
... | {
"repo_name": "AntonioModer/Algorithm-Implementations",
"path": "Mandelbrot_Set/python/skuschel/mandelbrot_set.py",
"copies": "27",
"size": "2449",
"license": "mit",
"hash": 713148626360937500,
"line_mean": 33.9857142857,
"line_max": 147,
"alpha_frac": 0.6149448755,
"autogenerated": false,
"ratio... |
#!/bin/python2
from __future__ import division
from mpi4py import MPI
import time
import subprocess
import argparse
import numpy
import os, sys
import json
import tarfile
import paramiko
from rpiDBUploader import rpiDBUploader
base_dir = os.path.dirname(os.path.realpath(__file__))
root_dir = os.path.abspath(os.path... | {
"repo_name": "sunjerry019/photonLauncher",
"path": "0_hcphotonics/apdflash/odin.py",
"copies": "1",
"size": "3989",
"license": "apache-2.0",
"hash": 7565018493309462000,
"line_mean": 26.8951048951,
"line_max": 132,
"alpha_frac": 0.6500376034,
"autogenerated": false,
"ratio": 2.81311706629055,
... |
#!/bin/python2
from __future__ import division
import cv2
import numpy as np
import math
MAX_DISTANCE_PIXEL = math.sqrt(3*math.pow(255,2))
MIN_SCENE_LENGTH = 10
THRESHOLD = 0.1
def get_key_frames(video_capture):
"""Yields the key frames of the video."""
sucess, previous_frame = video_capture.read()
frame... | {
"repo_name": "mfsec/pija",
"path": "key_frame_extractor.py",
"copies": "2",
"size": "1788",
"license": "mit",
"hash": -5997615349246549000,
"line_mean": 29.3050847458,
"line_max": 86,
"alpha_frac": 0.6275167785,
"autogenerated": false,
"ratio": 3.4057142857142857,
"config_test": false,
"has_... |
#!/bin/python2
from pyo import *
from sequencer import *
from helpers import *
import sys
import time
pyo_server = Server().boot()
if len(sys.argv) == 2:
code = read(sys.argv[1])
else:
print("NOOOOOOOOOOOO")
exit()
sequence = Sequence()
duration = 0
# Parse brainfuck code
code = cleanup(list(code))... | {
"repo_name": "316k/BrainSeqs",
"path": "brainseqs.py",
"copies": "1",
"size": "1449",
"license": "mit",
"hash": -7815609470191207000,
"line_mean": 20.6268656716,
"line_max": 77,
"alpha_frac": 0.6287094548,
"autogenerated": false,
"ratio": 3.0764331210191083,
"config_test": false,
"has_no_key... |
#!/bin/python2
import collections
import re
import subprocess
import sys
PUC = "../pamu2fcfg/pamu2fcfg"
resident = ["", "-r"]
presence = ["", "-P"]
pin = ["", "-N"]
verification = ["", "-V"]
Credential = collections.namedtuple("Credential", "keyhandle pubkey attributes oldformat")
sshformat = 0
def print_test_... | {
"repo_name": "Yubico/pam-u2f",
"path": "tests/regenerate_credentials.py",
"copies": "1",
"size": "4950",
"license": "bsd-2-clause",
"hash": 6575779152852379000,
"line_mean": 33.375,
"line_max": 109,
"alpha_frac": 0.5014141414,
"autogenerated": false,
"ratio": 3.7613981762917934,
"config_test":... |
#!/bin/python2
import forecastio
import json
def getAPIKey():
api_file = open("secret/api.json", "r")
apiInfo = json.loads(api_file.read())
api_file.close()
return apiInfo['key']
def getLocations():
locations_file = open("accounts.json", "r")
locations = json.loads(locations_file.read())
locations_file.... | {
"repo_name": "illegalprime/super-helpful-and-intelligent-tyrone",
"path": "proprietary/ForecastIO/getTodaysWeather.py",
"copies": "1",
"size": "1146",
"license": "apache-2.0",
"hash": 6189697379710778000,
"line_mean": 22.4081632653,
"line_max": 89,
"alpha_frac": 0.6954624782,
"autogenerated": fals... |
#!/bin/python2
import logging
def parser(subparser):
subparser.add_argument('--flavour', help='Flavour name')
subparser.add_argument('--dsize', help='Disk maximum size in GB')
def getFlavourDiskSize(flavour):
from sh import nova, tail, grep, awk
return int(awk(grep(nova("flavor-show", flavour), '| d... | {
"repo_name": "wixyvir/libvirtcan",
"path": "virtimg/virtimg/modules/toFlavour.py",
"copies": "1",
"size": "6020",
"license": "mit",
"hash": -3116948748472714000,
"line_mean": 39.1333333333,
"line_max": 149,
"alpha_frac": 0.5996677741,
"autogenerated": false,
"ratio": 3.1784582893347415,
"confi... |
#! /bin/python2
import numpy
import cv2
import os
import struct
BLACK = (0,)
WHITE = (255,)
DIR_OUT = "./img/"
SIZE_CANVAS = 50
SIZE_FEATURE = 28
SIZE_BLOCK = 32
DIGITS = tuple([chr(ord("0") + i) for i in range(10)] + [""])
FONTS = (cv2.FONT_HERSHEY_SIMPLEX, cv2.FONT_HERSHEY_PLAIN,
cv2.FONT_HERSHEY_DUPLEX, c... | {
"repo_name": "t-lou/JSudokuSolver",
"path": "digit_generator/digit_gen.py",
"copies": "1",
"size": "4207",
"license": "apache-2.0",
"hash": -132811981273554690,
"line_mean": 42.381443299,
"line_max": 133,
"alpha_frac": 0.5795103399,
"autogenerated": false,
"ratio": 2.804666666666667,
"config_t... |
#!/bin/python2
import os, sys, imp
import logging
class ModulesManager(object):
def __init__(self):
self.logger = logging.getLogger('virtimg')
self.modules=dict()
def __iter__(self):
return iter(self.modules.items())
def __getitem__(self, value):
return self.modules[value... | {
"repo_name": "wixyvir/libvirtcan",
"path": "virtimg/virtimg/mod.py",
"copies": "1",
"size": "1413",
"license": "mit",
"hash": 8547447791872499000,
"line_mean": 32.6428571429,
"line_max": 126,
"alpha_frac": 0.5180467091,
"autogenerated": false,
"ratio": 4.632786885245902,
"config_test": false,
... |
#!/bin/python2
import os, sys, struct, StringIO
MAGIC_NUMBER = 0x55D0AFDE
number_of_entries = 0
def list_directory(full_path, local_directory, heado, bino):
print "Packing directory ", full_path, " as ", local_directory
items_in_directory = os.listdir(full_path)
for item in items_in_directory: ... | {
"repo_name": "Enerccio/Cthulhu-OS",
"path": "disk/mkfs.py",
"copies": "1",
"size": "1550",
"license": "mit",
"hash": 2509129737070044000,
"line_mean": 26.6785714286,
"line_max": 102,
"alpha_frac": 0.6167741935,
"autogenerated": false,
"ratio": 2.743362831858407,
"config_test": false,
"has_no... |
#!/bin/python2
import subprocess
import tempfile
class ConsEntry(object):
def __init__(self, key):
self.key = key
self.tmpls = {}
self.external_vars = []
self.num_internal_vars = 0
self.num_constraints = 0
self.Aij = 0
self.Bij = 0
self.Cij = 0
class SubstEntry(object):
def... | {
"repo_name": "srinathtv/pepper",
"path": "compiler/backend/merkle.py",
"copies": "1",
"size": "3897",
"license": "bsd-3-clause",
"hash": 858230308528314400,
"line_mean": 28.9769230769,
"line_max": 124,
"alpha_frac": 0.5778804208,
"autogenerated": false,
"ratio": 3.0709219858156027,
"config_tes... |
#!/bin/python2
import sys
import matplotlib.pyplot as plt
ARG_LIST = ["--diff", "--graph", "--mean"]
def slope(x1, y1, x2, y2):
return (y2 - y1) / (x2 - x1)
def read_file(path, error="\nFile not available: "):
error += path
try:
with open(path, "r") as open_file:
return open_file.re... | {
"repo_name": "maxweis/sensor",
"path": "graph.py",
"copies": "1",
"size": "3620",
"license": "mit",
"hash": 5032484064996806000,
"line_mean": 27.96,
"line_max": 88,
"alpha_frac": 0.4947513812,
"autogenerated": false,
"ratio": 3.4608030592734225,
"config_test": false,
"has_no_keywords": false... |
#!/bin/python2
import time
from threading import *
import signal
import sys
import netifaces
from sniffer_module import *
from dblib.dbSender import *
# globals
shouldQuit = None
otherThread = None
sender = Sender()
hostname = ""
# signal handler
def sigintHandler(signum, frame):
print("Quitting uncleanly")
... | {
"repo_name": "DepthDeluxe/dot11sniffer",
"path": "dot11sniffer.py",
"copies": "1",
"size": "2073",
"license": "mit",
"hash": -6420380892483688000,
"line_mean": 21.0531914894,
"line_max": 91,
"alpha_frac": 0.6695610227,
"autogenerated": false,
"ratio": 4.001930501930502,
"config_test": false,
... |
#!/bin/python2
# This script just reaches out to the New Matter server and asks what the latest firmware is.
# Since their page returns JSON we get the name of the firmware as well as the URL to it as result.
import re
import os.path
import urllib2
import base64
import gzip
import zlib
from StringIO import StringIO
fr... | {
"repo_name": "Xaero252/Mod-T-Scripts",
"path": "latest_firmware.py",
"copies": "1",
"size": "1757",
"license": "mit",
"hash": -1641941974781977300,
"line_mean": 27.3387096774,
"line_max": 175,
"alpha_frac": 0.7450199203,
"autogenerated": false,
"ratio": 2.8112,
"config_test": false,
"has_no_... |
#!/bin/python2
from BeautifulSoup import BeautifulSoup
import urllib2
import re
#getActions() returns a list of all actions from the 2015 session
def getActions():
actions = []
n = range(0,6)
for i in n:
num = str(i*100).zfill(3)
page = urllib2.urlopen("http://clerk.house.gov/evs... | {
"repo_name": "electoralstats/articles",
"path": "dii-dw/Scraper.py",
"copies": "2",
"size": "3019",
"license": "mit",
"hash": 7803220084034669000,
"line_mean": 41.1285714286,
"line_max": 263,
"alpha_frac": 0.588274263,
"autogenerated": false,
"ratio": 3.6373493975903615,
"config_test": false,
... |
#!/bin/python2
import csv
import Scraper
import json
import urllib2
mccarthyID = "M001165"
pelosiID = "P000197"
def findDII(margin):
dii = (-11.0/24)*margin + (2411.0/24)
return dii
#Get all the vote data from the Scraper script
rawActions = Scraper.getActions()
actionsAll = Scraper.filterActi... | {
"repo_name": "electoralstats/articles",
"path": "dii-dw/Dissent.py",
"copies": "1",
"size": "4448",
"license": "mit",
"hash": 3769315297456186000,
"line_mean": 31.4436090226,
"line_max": 164,
"alpha_frac": 0.5870053957,
"autogenerated": false,
"ratio": 3.0528483184625945,
"config_test": false,... |
#!/bin/python2
import csv
import Scraper
def findDII(margin):
dii = (-11.0/24)*margin + (2411.0/24)
return dii
#Get all the vote data from the Scraper script
rawActions = Scraper.getActions()
#First we find the data for all votes
actions = Scraper.filterActions(actions=rawActions, billsOnly=False, ... | {
"repo_name": "electoralstats/articles",
"path": "house-freedom-caucus/RepubDissent.py",
"copies": "1",
"size": "2812",
"license": "mit",
"hash": 4542178667917687300,
"line_mean": 32.7160493827,
"line_max": 141,
"alpha_frac": 0.5949502134,
"autogenerated": false,
"ratio": 3.0042735042735043,
"c... |
""" The main program to load, insert and align images to Klayout. """
# Author: Zhaoen Su <suzhaoen@gmail.com>
# Last updated: 2015-07-22
import sys
import os
import cv2
import numpy as np
from config import config
from package.findFileInfo import read_name, read_pos, read_path, coordinate_correct
fr... | {
"repo_name": "suzhaoen/pkout",
"path": "main.py",
"copies": "1",
"size": "2585",
"license": "mit",
"hash": -1552295844748201700,
"line_mean": 24.3775510204,
"line_max": 83,
"alpha_frac": 0.5984526112,
"autogenerated": false,
"ratio": 3.335483870967742,
"config_test": false,
"has_no_keywords"... |
#!/bin/python2
"""
WIP
gets peak position and fwhm of peak for a certain wavelength range, for highest peak, tracks over time.
zy 18 Nov 2015
"""
from __future__ import division
import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils
import argparse
import time
import os
import math
import re
def checkd... | {
"repo_name": "sunjerry019/photonLauncher",
"path": "0_hcphotonics/0_archive/oceanoptics_outdated/procPeaks.py",
"copies": "1",
"size": "6991",
"license": "apache-2.0",
"hash": 7076073373273136000,
"line_mean": 34.2227979275,
"line_max": 138,
"alpha_frac": 0.4943498784,
"autogenerated": false,
"r... |
#!/bin/python33
from distutils.core import setup
with open('README.rst', 'r') as f:
desc = f.read()
setup(name='wild_sphinx_theme',
version=__import__('wild_sphinx_theme').__version__,
description='Like Nature sphinx theme but allows pygments style to be dark',
long_description=desc,
packages=['w... | {
"repo_name": "rhardouin/wild-sphinx-theme",
"path": "setup.py",
"copies": "1",
"size": "1040",
"license": "bsd-2-clause",
"hash": -6316537390138703000,
"line_mean": 34.8965517241,
"line_max": 80,
"alpha_frac": 0.6298076923,
"autogenerated": false,
"ratio": 3.701067615658363,
"config_test": fal... |
#!/bin/python3.4
import os, sys, json, yaml
import memcache
class MemCacheClient():
"""
My test memcached client class, inteneded to be moved to a official tool lib
"""
def __init__( self, **options ):
self.debug = False
self.hostname = "127.0.0.1"
self.port = "11211"
self.expiry = 0
self.client ... | {
"repo_name": "peitur/aws-utils",
"path": "test/pymemctest.py",
"copies": "1",
"size": "2963",
"license": "apache-2.0",
"hash": -5487596727701965000,
"line_mean": 23.6916666667,
"line_max": 181,
"alpha_frac": 0.5642929463,
"autogenerated": false,
"ratio": 2.7847744360902253,
"config_test": fals... |
#!/bin/python3.4
import sys, getopt
import binascii
import time
import math
import datetime
import csv
def get_step_name(s):
if s == 1:
return "CC_Chg"
elif s == 2:
return "CC_Dchg"
# TODO: 3
elif s == 4:
return "Rest"
# TODO: 5, 6
elif s == 7:
re... | {
"repo_name": "thebestpatrick/nda-extractor",
"path": "bin2csv.py",
"copies": "1",
"size": "7172",
"license": "bsd-2-clause",
"hash": 704558328830409200,
"line_mean": 28.5144032922,
"line_max": 82,
"alpha_frac": 0.574874512,
"autogenerated": false,
"ratio": 3.4282982791587,
"config_test": false... |
#!/bin/python3.4
import sys, getopt
import os
import time, datetime
import math
import datetime
import csv
import yaml
import matplotlib.pyplot as plt
import numpy as np
from io import StringIO
import bin2csv
import graph
def meta_process(m, level=4):
# TODO: custom formats
r = m['year'] + '-' + m['month'] +... | {
"repo_name": "thebestpatrick/nda-extractor",
"path": "reportgenerator.py",
"copies": "1",
"size": "2524",
"license": "bsd-2-clause",
"hash": 6102371193600518000,
"line_mean": 26.4347826087,
"line_max": 83,
"alpha_frac": 0.5974643423,
"autogenerated": false,
"ratio": 3.3788487282463184,
"config... |
#!/bin/python3.4
import re, os, sys
import shlex, time, datetime
import json, yaml
import subprocess, multiprocessing
from pprint import pprint
import memcache
class MemCacheClient():
"""
My test memcached client class, inteneded to be moved to a official tool lib
"""
def __init__( self, **options ):
self... | {
"repo_name": "peitur/aws-utils",
"path": "test/cmd_exec.py",
"copies": "1",
"size": "7148",
"license": "apache-2.0",
"hash": -4415892417511523300,
"line_mean": 27.7068273092,
"line_max": 183,
"alpha_frac": 0.6036653609,
"autogenerated": false,
"ratio": 2.809748427672956,
"config_test": true,
... |
#!/bin/python3.5
import sys
from Grammar import *
from Parser import *
from NDFA import *
from DFA import *
def main(argv):
# The with statement allows objects like files to be used in a way
# that ensures they are always cleaned up promptly and correctly.
with open(argv[1], 'r') as f:
a = Grammar(... | {
"repo_name": "ggabriel96/cfg_analyzer",
"path": "main.py",
"copies": "1",
"size": "1067",
"license": "unlicense",
"hash": -4779913419161823000,
"line_mean": 27.0789473684,
"line_max": 70,
"alpha_frac": 0.572633552,
"autogenerated": false,
"ratio": 3.0838150289017343,
"config_test": false,
"h... |
#!/bin/python3.5
import sys
import argparse
import subprocess
import json
import time
import collections
import capture
Done = collections.namedtuple("Done", ["size"])
Backtrack = collections.namedtuple("Backtrack", [])
Continue = collections.namedtuple("Continue", ["stats", "runtime", "elts"])
def run_accept(filen... | {
"repo_name": "uwplse/Cassius",
"path": "capture/minimize.py",
"copies": "1",
"size": "4370",
"license": "mit",
"hash": -658751269533131000,
"line_mean": 35.7226890756,
"line_max": 147,
"alpha_frac": 0.6121281465,
"autogenerated": false,
"ratio": 3.6908783783783785,
"config_test": false,
"has... |
'''
Created on Aug 18, 2014
@author: Dean4Devil
'''
import os
import sys
path = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, path)
from pycore.http_util import Request, Response, Session, HTTPError
from views.error import Error_404
def application(environ, responder):
'The WSGI entry hook'
... | {
"repo_name": "OpenEngeneeringTaskForce/OETFDev",
"path": "bootstrap.py",
"copies": "1",
"size": "2406",
"license": "mit",
"hash": -808924940713934000,
"line_mean": 36.59375,
"line_max": 172,
"alpha_frac": 0.642560266,
"autogenerated": false,
"ratio": 4.1482758620689655,
"config_test": false,
... |
import sys
import os
import re
# -----------------------------------------------------------------------------
# list of words that should be excluded from mindex comamnds
exclude_list = 'a an and as at by for in of or to'.split()
# -----------------------------------------------------------------------------
def split... | {
"repo_name": "kaskr/CppAD",
"path": "bin/reduce_index.py",
"copies": "2",
"size": "5230",
"license": "epl-1.0",
"hash": 2189189294262369300,
"line_mean": 34.8219178082,
"line_max": 79,
"alpha_frac": 0.5382409178,
"autogenerated": false,
"ratio": 3.210558624923266,
"config_test": false,
"has_... |
#!/bin/python3
# A script for label extraction from unpacked game assets
from os.path import join, dirname, exists, relpath, abspath, basename
from sys import platform
if platform == "win32":
from os.path import normpath as normpath_old
def normpath(path):
return normpath_old(path).replace('\\', '/')
else:
... | {
"repo_name": "SBT-community/Starbound_RU",
"path": "tools/extract_labels.py",
"copies": "1",
"size": "9724",
"license": "apache-2.0",
"hash": -7721553280798585000,
"line_mean": 35.1486988848,
"line_max": 79,
"alpha_frac": 0.6480872069,
"autogenerated": false,
"ratio": 3.6945288753799392,
"conf... |
import os
import pickle
import requests
import click
from git import Repo
API_AI_HEADERS = None
BASE_URL = 'https://api.api.ai/v1/'
DEV_KEY = None
DEV_TOKEN_ENV_NAME = 'API_AI_DEV_TOKEN'
API_AI_HISTORY_DIR = 'api_ai_history'
API_AI_REPO = '{}/{}'.format(os.getcwd(), API_AI_HISTORY_DIR)
@click.group()
def cli():
p... | {
"repo_name": "CamelCaseNotation/api-ai-git",
"path": "api-ai-git.py",
"copies": "1",
"size": "6935",
"license": "mit",
"hash": -2747681762017268000,
"line_mean": 37.5277777778,
"line_max": 125,
"alpha_frac": 0.6399423216,
"autogenerated": false,
"ratio": 3.6385099685204616,
"config_test": fals... |
#!/bin/python3
# Boite
DEBUG = False
class Boite(object):
"""Boite"""
error = {
6: "Item invalid, must be the same as __type_ditem",
7: "Must be int less than taille_max and positive",
8: "Reload only, you can't unload a box",
9: "New taille_max must be a positive integer",
... | {
"repo_name": "NestarZ/drinkdispenser",
"path": "drinkdispenser/data/boite.py",
"copies": "1",
"size": "3525",
"license": "mit",
"hash": 5455739487023158000,
"line_mean": 30.0353982301,
"line_max": 88,
"alpha_frac": 0.5788423154,
"autogenerated": false,
"ratio": 3.244218316373728,
"config_test"... |
#!/bin/python3
# Boite
DEBUG = False
class Tarifs(object):
"""Tarifs"""
error = {
-1: "Price must be defined for (at least) quantity = 1",
0: "Dict must be fill of prices for quantities",
1: "Quantities and prices must be intergers",
2: "Quantities and prices must be positiv... | {
"repo_name": "NestarZ/drinkdispenser",
"path": "drinkdispenser/data/tarifs.py",
"copies": "1",
"size": "2065",
"license": "mit",
"hash": 7110809701702340000,
"line_mean": 32.8032786885,
"line_max": 75,
"alpha_frac": 0.53685742,
"autogenerated": false,
"ratio": 3.70863309352518,
"config_test": ... |
#!/bin/python3
# -*- coding: utf-8 -*-
from runner import Runner
from math import sqrt
import numpy as np
class JupiterRunner(Runner):
def setup(self):
self['number of years'] = 15
self['use all planets'] = False
self['use planets'] = ['Sun', 'Earth', 'Jupiter']
self['steps per yea... | {
"repo_name": "Caronthir/FYS3150",
"path": "Project3/analysis/jupiterrunner.py",
"copies": "1",
"size": "2197",
"license": "mit",
"hash": 998265441564040100,
"line_mean": 36.2372881356,
"line_max": 84,
"alpha_frac": 0.5735093309,
"autogenerated": false,
"ratio": 3.3748079877112134,
"config_test... |
#!/bin/python3
# -*- coding: utf-8 -*-
from runner import Runner
import numpy as np
from math import pi, sqrt
import matplotlib.pyplot as plt
class Escaper(Runner):
def setup(self):
self['number of years'] = 10000
self['do save results'] = True
self['use all planets'] = False
self[... | {
"repo_name": "Caronthir/FYS3150",
"path": "Project3/analysis/findescapevelocity.py",
"copies": "1",
"size": "3129",
"license": "mit",
"hash": -8602666582792989000,
"line_mean": 31.59375,
"line_max": 84,
"alpha_frac": 0.5375519335,
"autogenerated": false,
"ratio": 3.6006904487917146,
"config_te... |
#!/bin/python3
# -*- coding: utf-8 -*-
from runner import Runner
import numpy as np
import matplotlib.pyplot as plt
class Perihelion(Runner):
def setup(self):
self['number of years'] = 100
self['do save results'] = False
self['do save any results'] = False
self['use all planets'] =... | {
"repo_name": "Caronthir/FYS3150",
"path": "Project3/analysis/perihelion.py",
"copies": "1",
"size": "1597",
"license": "mit",
"hash": -217640207070803550,
"line_mean": 33.7173913043,
"line_max": 72,
"alpha_frac": 0.5710707577,
"autogenerated": false,
"ratio": 3.2658486707566463,
"config_test":... |
#!/bin/python3
# -*- coding: utf-8 -*-
from runner import Runner
import pandas as pd
import numpy as np
from itertools import product
from analyze import Analyzer
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(context="poster", style='white')
class ErrorAnalysis(Runner):
def setup(self):
s... | {
"repo_name": "Caronthir/FYS3150",
"path": "Project5/analysis/opg5c.py",
"copies": "1",
"size": "3711",
"license": "mit",
"hash": 6872866153572617000,
"line_mean": 36.11,
"line_max": 90,
"alpha_frac": 0.5225006737,
"autogenerated": false,
"ratio": 3.5410305343511452,
"config_test": false,
"ha... |
#!/bin/python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
from entity.rect import Rect
class RegionList(object):
generator = None
file_name = None
region = None
def load(self, file_path):
self.region ... | {
"repo_name": "keiji/region_cropper",
"path": "tools/src/entity/region_list.py",
"copies": "1",
"size": "1100",
"license": "apache-2.0",
"hash": -6381188095499864000,
"line_mean": 21,
"line_max": 64,
"alpha_frac": 0.6181818182,
"autogenerated": false,
"ratio": 3.7037037037037037,
"config_test":... |
#!/bin/python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import shutil
import sys
import gflags
from PIL import Image, ImageDraw
from common import convertRgb, save_file, get_file_list
from entity.region_list import... | {
"repo_name": "keiji/region_cropper",
"path": "tools/src/crop_regions.py",
"copies": "1",
"size": "3013",
"license": "apache-2.0",
"hash": 2643843407418388500,
"line_mean": 26.785046729,
"line_max": 94,
"alpha_frac": 0.6569122099,
"autogenerated": false,
"ratio": 3.1065830721003134,
"config_tes... |
#!/bin/python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import gflags
from PIL import Image, ImageDraw
from common import get_file_list
from entity.region_list import RegionList
FLAGS = gflags.FLAGS
gfl... | {
"repo_name": "keiji/region_cropper",
"path": "tools/src/remove_regions.py",
"copies": "1",
"size": "2735",
"license": "apache-2.0",
"hash": -1760913427665937200,
"line_mean": 26.412371134,
"line_max": 94,
"alpha_frac": 0.6720571643,
"autogenerated": false,
"ratio": 3.021590909090909,
"config_t... |
#!/bin/python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
from PIL import Image
def get_file_list(dir):
result_list = []
file_list = os.listdir(dir)
file_list = map(lambda f: os.path.join(dir, f),... | {
"repo_name": "keiji/region_cropper",
"path": "tools/src/common.py",
"copies": "1",
"size": "1270",
"license": "apache-2.0",
"hash": 2956193735720867000,
"line_mean": 23.9019607843,
"line_max": 79,
"alpha_frac": 0.6291338583,
"autogenerated": false,
"ratio": 3.207070707070707,
"config_test": fa... |
#!/bin/python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
class Rect(object):
left = 0
top = 0
right = 0
bottom = 0
def width(self):
return (self.right - self.left)
def height(self):
return (self.bottom - ... | {
"repo_name": "keiji/region_cropper",
"path": "tools/src/entity/rect.py",
"copies": "1",
"size": "1284",
"license": "apache-2.0",
"hash": -4778702950754926000,
"line_mean": 21.1379310345,
"line_max": 78,
"alpha_frac": 0.5755451713,
"autogenerated": false,
"ratio": 3.21,
"config_test": false,
... |
#! /bin/python3
# -*- coding : utf-8 -*-
from i3 import command, get_workspaces, i3Exception
from argparse import ArgumentParser
from logging import INFO, WARNING, basicConfig, info, critical
# only workspaces with numbers are managed (binded to super+nb by default)
ALLOWED = [str(i+1) for i in range(10)]
def pa... | {
"repo_name": "emilecaron/i3-shiftworkspace",
"path": "i3shiftworkspaces.py",
"copies": "1",
"size": "2916",
"license": "mit",
"hash": -7358738560998953000,
"line_mean": 27.8712871287,
"line_max": 110,
"alpha_frac": 0.6093964335,
"autogenerated": false,
"ratio": 3.9405405405405407,
"config_test... |
#!/bin/python3
# -*- coding: utf-8 -*-
"""
Get data from sensors and post it to specified mqtt channel in json-format
Requires:
Ruuvitag sensor - pip3 install --user ruuvitag-sensor
Paho MQTT - pip3 install --user paho-mqtt
Example usage:
./post_to_mqtt.py --mac DE:AD:BE:EE:EE:FF -b mqtt.ikenet \
-... | {
"repo_name": "ttu/ruuvitag-sensor",
"path": "examples/post_to_mqtt.py",
"copies": "1",
"size": "3159",
"license": "mit",
"hash": 9102744713413244000,
"line_mean": 28.8018867925,
"line_max": 84,
"alpha_frac": 0.6840772396,
"autogenerated": false,
"ratio": 3.3822269807280514,
"config_test": fals... |
#!bin/python3
# -*- coding: utf-8 -*-
import datetime
import os
import signal
import sys
import threading
import time
from queue import Queue
import requests
import dbengine
import utils
from lastfmfetch import LastFmRetriever
from plugin_handler import load_venue_plugins
from venues.abstract_venue import AbstractVe... | {
"repo_name": "weezel/BandEventNotifier",
"path": "bandeventnotifier.py",
"copies": "1",
"size": "7312",
"license": "isc",
"hash": -2887973498190424000,
"line_mean": 32.8518518519,
"line_max": 115,
"alpha_frac": 0.5110776805,
"autogenerated": false,
"ratio": 3.989088925259138,
"config_test": fa... |
#!/bin/python3
# -*- coding: utf-8 -*-
import json
import argparse
import requests
import logging
from Config import Config
class ApiClient(Config):
def __init__(self, config_file='config.ini'):
super().__init__(config_file)
def createDatasource(self):
logging.info("[POST] NEW DATASOURCE")
url = "{}/{}".f... | {
"repo_name": "sjsafranek/gospatial",
"path": "selenium_tests/ApiClient.py",
"copies": "2",
"size": "2509",
"license": "mit",
"hash": 8165218512665642000,
"line_mean": 27.8505747126,
"line_max": 101,
"alpha_frac": 0.640892786,
"autogenerated": false,
"ratio": 3.0301932367149758,
"config_test": ... |
#!/bin/python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from mpl_toolkits.mplot3d import Axes3D
import seaborn as sns
import argparse
import os
sns.set(context="poster")
class Analyzer:
def __init__(self, path, position, energy, angular_... | {
"repo_name": "Caronthir/FYS3150",
"path": "Project3/analysis/analyze.py",
"copies": "1",
"size": "6982",
"license": "mit",
"hash": -8751860752605201000,
"line_mean": 39.3583815029,
"line_max": 96,
"alpha_frac": 0.5299341163,
"autogenerated": false,
"ratio": 3.489255372313843,
"config_test": fa... |
#!/bin/python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import seaborn as sns
import argparse
import os
import json
import pandas as pd
sns.set(context="poster")
class Analyzer:
def __init__(self, base_path, meta_path):
self.load... | {
"repo_name": "Caronthir/FYS3150",
"path": "Project4/analysis/analyze.py",
"copies": "1",
"size": "9386",
"license": "mit",
"hash": -7948486247725437000,
"line_mean": 36.0909090909,
"line_max": 95,
"alpha_frac": 0.5182225064,
"autogenerated": false,
"ratio": 3.677115987460815,
"config_test": fa... |
#!/bin/python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import argparse
import os
from glob import glob
import re
from tabulate import tabulate
import operator
from latextools import plotable, tag
sns.set()
SHOWPLOTS = True
def plotwrap(*args, **kwargs):
"... | {
"repo_name": "Caronthir/FYS3150",
"path": "Project1/analysis/analyze.py",
"copies": "1",
"size": "3848",
"license": "mit",
"hash": 1374517774668821500,
"line_mean": 33.0530973451,
"line_max": 79,
"alpha_frac": 0.5506756757,
"autogenerated": false,
"ratio": 3.5205855443732847,
"config_test": fa... |
#!/bin/python3
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import re
import matplotlib.pyplot as plt
import seaborn as sns
from runner import Runner
sns.set(context='poster')
class BatchRunner(Runner):
time_pattern = re.compile('CPU time:\s*(.*?)s.*')
def setup_parameters(self, min):
... | {
"repo_name": "Caronthir/FYS3150",
"path": "Project3/analysis/batchrun.py",
"copies": "1",
"size": "3025",
"license": "mit",
"hash": -2154285052106486300,
"line_mean": 35.4457831325,
"line_max": 82,
"alpha_frac": 0.5428099174,
"autogenerated": false,
"ratio": 3.7299630086313194,
"config_test": ... |
#!/bin/python3
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
from collections import defaultdict
import json
categorias_valores_dict = {
"name": "categorias",
"children": []
}
categorias = ['Transporte', 'Comunicação',... | {
"repo_name": "reembolso-deputados/reembolso-deputados.github.io",
"path": "_site/data/AuxScripts/parsing_categorias.py",
"copies": "3",
"size": "1523",
"license": "mit",
"hash": 7591130319239204000,
"line_mean": 34.3953488372,
"line_max": 124,
"alpha_frac": 0.5897435897,
"autogenerated": false,
... |
#!/bin/python3
# -*- coding: utf-8 -*-
import subprocess
import json
import numpy as np
import seaborn as sns
import shlex
sns.set(context='poster')
class Runner:
def __init__(self):
self.base_path = '../data/'
self.param_path = '../data/parameters.json'
self.exe_path = '../cpp/solve'
... | {
"repo_name": "Caronthir/FYS3150",
"path": "Project5/analysis/runner.py",
"copies": "1",
"size": "2089",
"license": "mit",
"hash": 605266752619486600,
"line_mean": 28.8428571429,
"line_max": 79,
"alpha_frac": 0.6026807085,
"autogenerated": false,
"ratio": 3.7775768535262206,
"config_test": fals... |
#!/bin/python3
# -*- coding: utf-8 -*-
class Stats(object):
def __init__(self, ingredients, boissons):
self.boissons = boissons.values()
self.ingredients = ingredients.values()
self.nb_vendu = {boisson.nom: 0 for boisson in self.boissons}
self.dose_sucre = {boisson.nom: [] for boi... | {
"repo_name": "NestarZ/drinkdispenser",
"path": "drinkdispenser/data/stats.py",
"copies": "1",
"size": "3805",
"license": "mit",
"hash": -2481369915746543000,
"line_mean": 33.8899082569,
"line_max": 108,
"alpha_frac": 0.4867210097,
"autogenerated": false,
"ratio": 3.3744454303460514,
"config_te... |
#!/bin/python3
# coding: utf-8
"""sphinxmark setup file."""
# To use a consistent encoding
from codecs import open
from os import path
from setuptools import setup
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') a... | {
"repo_name": "kallimachos/sphinxmark",
"path": "setup.py",
"copies": "1",
"size": "1335",
"license": "apache-2.0",
"hash": -3678053895947123000,
"line_mean": 25.7,
"line_max": 78,
"alpha_frac": 0.6194756554,
"autogenerated": false,
"ratio": 3.997005988023952,
"config_test": false,
"has_no_ke... |
#!/bin/python3
# -*- coding: utf-8 -*-
""" This script contains the class PasswordManager that is usefull for password
secure storage.
This article has been usefull to write this script:
http://throwingfire.com/storing-passwords-securely/
Author: Julien Delplanque
"""
import bcrypt
import json
cla... | {
"repo_name": "juliendelplanque/raspirestmonitor",
"path": "server/passwordmanagement.py",
"copies": "1",
"size": "2869",
"license": "mit",
"hash": -2091680182874537200,
"line_mean": 38.8472222222,
"line_max": 91,
"alpha_frac": 0.6214708958,
"autogenerated": false,
"ratio": 4.346969696969697,
"... |
#!/bin/python3
# -*- coding: utf-8 -*-
try:
from coin import CoinsStocker
from ingredient import Cafe, Sucre, Lait, Chocolat, The
from boite import BoitePiece, BoiteProduit
from tarifs import Tarifs
from stats import Stats
import boisson
import get_change
except (ImportError, SystemError) as... | {
"repo_name": "NestarZ/drinkdispenser",
"path": "drinkdispenser/data/distrib_usine.py",
"copies": "1",
"size": "12913",
"license": "mit",
"hash": -4960110367958874000,
"line_mean": 35.8857142857,
"line_max": 165,
"alpha_frac": 0.5882261813,
"autogenerated": false,
"ratio": 3.4986449864498645,
"... |
#!/bin/python3
# -*- coding: utf-8 -*-
try:
from distrib_usine import Distributeur
except (ImportError, SystemError) as e:
from .distrib_usine import Distributeur
# MODES DE LA MACHINE
class DistributeurFonctionnement(Distributeur):
exception = lambda fct: \
Exception('Action {} indisponnible en... | {
"repo_name": "NestarZ/drinkdispenser",
"path": "drinkdispenser/data/distrib_mode.py",
"copies": "1",
"size": "3154",
"license": "mit",
"hash": 4012160828137846300,
"line_mean": 25.0661157025,
"line_max": 79,
"alpha_frac": 0.6414077362,
"autogenerated": false,
"ratio": 3.5438202247191013,
"conf... |
#!/bin/python3
"""Convert a CSV file to an Optaplanner XML file.
First step to solve the Santa's Sleigh Challenge
https://www.kaggle.com/c/santas-stolen-sleigh
This importer takes a CSV file and outputs an XML optaplanner file.
Created: Ivan Reyes, Alejandro Escobedo
December 18, 2015
"""
import xml.etree.ElementTr... | {
"repo_name": "Darkade/sleigh-importer",
"path": "imporsleigh.py",
"copies": "1",
"size": "4971",
"license": "mit",
"hash": -6955737904466682000,
"line_mean": 27.9011627907,
"line_max": 111,
"alpha_frac": 0.6358881513,
"autogenerated": false,
"ratio": 3.500704225352113,
"config_test": false,
... |
import math
import re
import sys
import apx
START_SECTION=0
NODE_SECTION=1
TYPE_SECTION=2
PROVIDE_SECTION=3
REQUIRE_SECTION=4
_p0=re.compile(r'([\+\-A-Z]+)')
_p1=re.compile(r'([^:]*)')
_p2=re.compile(r'#(.*)')
def strip_comment(apx_text):
return re.sub(_p2, '', apx_text)
def apx_split_line(s):
#remove... | {
"repo_name": "cogu/py-apx",
"path": "apx/parser.py",
"copies": "1",
"size": "7151",
"license": "mit",
"hash": 7672843487357242000,
"line_mean": 31.6529680365,
"line_max": 120,
"alpha_frac": 0.5400643267,
"autogenerated": false,
"ratio": 3.743979057591623,
"config_test": false,
"has_no_keywor... |
#!/bin/python3
"""Create a google map page with places as specified by a .csv file."""
# Based on this awesome example:
# http://stackoverflow.com/questions/22342097/is-it-possible-to-create-a-google-map-from-python
import csv
import logging
import sys
import pygeolib
from pygeocoder import Geocoder
USAGE = __doc__... | {
"repo_name": "cb109/places",
"path": "places.py",
"copies": "1",
"size": "3918",
"license": "mit",
"hash": -6382310175897708000,
"line_mean": 28.2388059701,
"line_max": 95,
"alpha_frac": 0.6143440531,
"autogenerated": false,
"ratio": 3.482666666666667,
"config_test": false,
"has_no_keywords"... |
#!/bin/python3
# Day 0: Mean, Median, and Mode
# https://www.hackerrank.com/challenges/s10-basic-statistics/problem
import operator
def mean(elements):
return sum(elements)/len(elements)
def median(elements):
elements_sorted = sorted(elements)
middle_elements = int(len(elements_sorted)/2)
return (elem... | {
"repo_name": "neiesc/Problem-solving",
"path": "HackerRank/Tutorials/10 Days of Statistics/day0-s10-basic-statistics.py",
"copies": "1",
"size": "1151",
"license": "mit",
"hash": -8291190887468882000,
"line_mean": 29.2894736842,
"line_max": 86,
"alpha_frac": 0.6620330148,
"autogenerated": false,
... |
#!/bin/python3
# Day 1: Interquartile Range
# https://www.hackerrank.com/challenges/s10-interquartile-range/problem
def solve(number_of_elements, elements, frequency):
s = []
for idx, element in enumerate(elements):
frequency_of_element = frequency[idx]
s = s + ([element] * frequency_of_element... | {
"repo_name": "neiesc/Problem-solving",
"path": "HackerRank/Tutorials/10 Days of Statistics/day1-s10-interquartile-range.py",
"copies": "1",
"size": "1573",
"license": "mit",
"hash": 2237091702076953900,
"line_mean": 29.8431372549,
"line_max": 92,
"alpha_frac": 0.6554354736,
"autogenerated": false,... |
#!/bin/python3
# Day 1: Quartiles
# https://www.hackerrank.com/challenges/s10-quartiles/problem
def median_q2(number_of_elements, elements):
elements_sorted = sorted(elements)
middle_elements = int(number_of_elements / 2)
median_result = median(elements_sorted, number_of_elements)
return (median_resu... | {
"repo_name": "neiesc/Problem-solving",
"path": "HackerRank/Tutorials/10 Days of Statistics/day1-s10-quartiles.py",
"copies": "1",
"size": "1327",
"license": "mit",
"hash": 6198795629035461000,
"line_mean": 30.5952380952,
"line_max": 92,
"alpha_frac": 0.6646571213,
"autogenerated": false,
"ratio"... |
#!/bin/python3
# Doomsday algorithm info: https://en.wikipedia.org/wiki/Doomsday_rule
DOOMSDAY_LEAP = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
DOOMSDAY_NOT_LEAP = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
WEEK_DAY_NAMES = {
0: "Sunday",
1: "Monday",
2: "Tuesday",
3: "Wednesday",
4: "Thursday",
5: "Frida... | {
"repo_name": "TheAlgorithms/Python",
"path": "other/doomsday.py",
"copies": "1",
"size": "1569",
"license": "mit",
"hash": 3200687695302007000,
"line_mean": 25.593220339,
"line_max": 77,
"alpha_frac": 0.5481198215,
"autogenerated": false,
"ratio": 2.645868465430017,
"config_test": false,
"ha... |
#!/bin/python3
# encoding: utf8
# notifications.py
import logging
from .telegram import send_message
from .models import connect_database, Timelapse, User
def collect_user_ids_to_notify(database):
# TODO Introduce filtering users to notify
# there should be a field in User object specifying
# if t... | {
"repo_name": "maremun/TimeFlies",
"path": "timeflies/notifications.py",
"copies": "1",
"size": "1259",
"license": "mit",
"hash": -3956061004352520700,
"line_mean": 28.2790697674,
"line_max": 78,
"alpha_frac": 0.6544876886,
"autogenerated": false,
"ratio": 3.769461077844311,
"config_test": fals... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.