text stringlengths 0 1.05M | meta dict |
|---|---|
#!/bin/env python
import os
import sys
try:
sys.path.append('demoproject')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "demoproject.settings")
from django.conf import settings
from django.test import Client
settings.DATABASES['default']['NAME'] = '/tmp/chartit.demo.sqlite'
try:
... | {
"repo_name": "pgollakota/django-chartit",
"path": "render_demo_site.py",
"copies": "2",
"size": "1545",
"license": "bsd-2-clause",
"hash": -2224811545898708200,
"line_mean": 27.0909090909,
"line_max": 80,
"alpha_frac": 0.6517799353,
"autogenerated": false,
"ratio": 4.256198347107438,
"config_t... |
#!/bin/env/python
import os
# ------------------------------- Filesystem
def ls():
return os.listdir('.')
def isHidden(path):
filename = os.path.basename(path)
return filename.startswith('.')
def isVisible(path):
return not isHidden(path)
def joinPaths(dir, contents):
return map(lambda f: os.path.join(dir, f)... | {
"repo_name": "dblalock/flock",
"path": "python/utils/files.py",
"copies": "2",
"size": "1905",
"license": "mit",
"hash": -4344470206369590300,
"line_mean": 26.2142857143,
"line_max": 79,
"alpha_frac": 0.7170603675,
"autogenerated": false,
"ratio": 3,
"config_test": false,
"has_no_keywords": ... |
#! /bin/env python
import os
from .bov_io import tofile
class IDatabase(object):
def __init__(self):
pass
def open(self, path, var_name):
pass
def write(self, field):
pass
def close(self):
pass
class Database(IDatabase):
def __init__(self):
super(Dat... | {
"repo_name": "csdms/coupling",
"path": "deprecated/printers/bov/database.py",
"copies": "1",
"size": "1273",
"license": "mit",
"hash": -7460367730148215000,
"line_mean": 19.5322580645,
"line_max": 73,
"alpha_frac": 0.5263157895,
"autogenerated": false,
"ratio": 3.8228228228228227,
"config_test... |
#! /bin/env python
import os
thisdir = os.path.abspath(os.path.dirname(__file__))
sourcedir = os.path.join(thisdir,'source')
libdir = os.path.join(thisdir,'lib')
__version__ = '1.3'
def build(sources,libs,out,minified_out,header=None):
sources = [os.path.join(sourcedir,s) for s in sources]
libs = [os.path.j... | {
"repo_name": "pylover/joop",
"path": "build.py",
"copies": "1",
"size": "2022",
"license": "mit",
"hash": 2214355809550165200,
"line_mean": 26.3243243243,
"line_max": 91,
"alpha_frac": 0.5529179031,
"autogenerated": false,
"ratio": 3.5851063829787235,
"config_test": false,
"has_no_keywords":... |
#!/bin/env python
import os.path
import re
import sys
import xml.sax
prefix = None
class_types = {
'object-type',
'value-type',
'interface-type'
}
scope_types = class_types | {
'namespace-type'
}
#==============================================================================
class typesystem_parser(xml.sax... | {
"repo_name": "kfieldho/vivia",
"path": "CMake/list_typesystem_sources.py",
"copies": "3",
"size": "2154",
"license": "bsd-3-clause",
"hash": 6273714721262369000,
"line_mean": 30.6764705882,
"line_max": 79,
"alpha_frac": 0.4661095636,
"autogenerated": false,
"ratio": 4.582978723404255,
"config_... |
#!/bin/env python
import os, string, cgi, time, webbrowser, threading, socket
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
JSON = '{ text: "This is the response." }'
PORT = 8000
class LaunchBrowser(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.start(... | {
"repo_name": "smartfile/client-js",
"path": "test.py",
"copies": "1",
"size": "1952",
"license": "bsd-3-clause",
"hash": -4208798266368848400,
"line_mean": 30.4838709677,
"line_max": 96,
"alpha_frac": 0.5271516393,
"autogenerated": false,
"ratio": 3.9918200408997957,
"config_test": false,
"h... |
import os, sys, glob
JAVA_LICENSE = """\
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright (c) 2013, 6WIND S.A. All rights reserved. *
* *
* This file is part of the Jenkins Lockable Resources Plu... | {
"repo_name": "McFoggy/lockable-resources-plugin",
"path": "check_licenses.py",
"copies": "5",
"size": "2908",
"license": "mit",
"hash": -7121579461479974000,
"line_mean": 33.2117647059,
"line_max": 78,
"alpha_frac": 0.4002751032,
"autogenerated": false,
"ratio": 3.9672578444747613,
"config_tes... |
import os, sys, glob
JAVA_LICENSE = """\
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright (c) 2015, 6WIND S.A. All rights reserved. *
* *
* This file is part of the Jenkins Lockable Resources Plu... | {
"repo_name": "6WIND/killable-shell",
"path": "check_licenses.py",
"copies": "1",
"size": "2909",
"license": "mit",
"hash": 3775612655695802400,
"line_mean": 32.8255813953,
"line_max": 78,
"alpha_frac": 0.4001375043,
"autogenerated": false,
"ratio": 3.9686221009549794,
"config_test": false,
"... |
#!/bin/env python
import pandas as pd
import seaborn as sns
import argparse
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser()
parser.add_argument("--max_cp", type=int, required=False, help="max_cp to plot and filter along", default=-1)
parser.add_argument("--input_table", type=str, required=True, h... | {
"repo_name": "EichlerLab/read_depth_genotyper",
"path": "scripts/genotype_violin.py",
"copies": "1",
"size": "3228",
"license": "mit",
"hash": -2693566485798008300,
"line_mean": 39.8607594937,
"line_max": 186,
"alpha_frac": 0.686802974,
"autogenerated": false,
"ratio": 2.626525630593979,
"conf... |
#!/bin/env python
import psycopg2
# default values
class SQL:
user = "user"
pwd = "123456"
host = "localhost"
db = "data"
hist_table = "historicaldata"
create_hist_table = """
create table if not exists historicaldata (
symbol varchar(10),
date date,
volume integer,
low numeric... | {
"repo_name": "jodvova/stocks",
"path": "sql.py",
"copies": "1",
"size": "1556",
"license": "apache-2.0",
"hash": -7047494357918454000,
"line_mean": 27.8148148148,
"line_max": 78,
"alpha_frac": 0.530848329,
"autogenerated": false,
"ratio": 3.9693877551020407,
"config_test": false,
"has_no_key... |
#!/bin/env python
import psync
import argparse
import pprint
def inspect_workers():
workers = {}
i = psync.app.control.inspect()
a = i.active()
if a:
for k, activelist in a.iteritems():
if k not in workers:
workers[ k ] = { 'num_active': 0, 'num_reserved': 0 }
... | {
"repo_name": "ncsa/psync",
"path": "scripts/psync_status.py",
"copies": "1",
"size": "1322",
"license": "bsd-3-clause",
"hash": 1557242630252256500,
"line_mean": 25.9795918367,
"line_max": 78,
"alpha_frac": 0.5257186082,
"autogenerated": false,
"ratio": 3.2803970223325063,
"config_test": false... |
#!/bin/env python
import psync
import re
import pprint
class ActiveTask( object ):
re_repr = re.compile( '<FSItem [^ ]+ ([^>]+)>' )
def __init__( self, t_id, t_name, t_args, t_kwargs ):
self.id = t_id
self.name = t_name
self.args = self.re_repr.findall( t_args )
self.kwargs = ... | {
"repo_name": "ncsa/psync",
"path": "scripts/workers_active_tasks.py",
"copies": "1",
"size": "1121",
"license": "bsd-3-clause",
"hash": -3089996755225657300,
"line_mean": 22.3541666667,
"line_max": 72,
"alpha_frac": 0.498661909,
"autogenerated": false,
"ratio": 3.3765060240963853,
"config_test... |
#!/bin/env python
import psync
import time
import datetime
import pprint
import argparse
import os
import stat
import fsitem
def process_cmdline():
help_txt = """Note: TGT must already exist.
After psync is done, the inside of TGT will look identical to the inside of SRC.
This is equivalent to 'rsync ... ... | {
"repo_name": "ncsa/psync",
"path": "scripts/start_psync.py",
"copies": "1",
"size": "3601",
"license": "bsd-3-clause",
"hash": -5704989560211794000,
"line_mean": 34.6534653465,
"line_max": 87,
"alpha_frac": 0.6006664815,
"autogenerated": false,
"ratio": 3.5269343780607247,
"config_test": false... |
#!/bin/env python
import pygmmis
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.lines as lines
import matplotlib.cm
import datetime
from functools import partial
import logging
def plotResults(orig, data, gmm, patch=None, description=None, disp=None):
fig... | {
"repo_name": "pmelchior/pygmmis",
"path": "tests/test.py",
"copies": "1",
"size": "11302",
"license": "mit",
"hash": -3860953843084140500,
"line_mean": 37.3118644068,
"line_max": 193,
"alpha_frac": 0.5849407185,
"autogenerated": false,
"ratio": 2.993114406779661,
"config_test": false,
"has_n... |
#!/bin/env python
import pymysql
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root',passwd='toor',db='gdelt')
cur = conn.cursor()
#Columns:
# 1 Date = Required
# 2 Source = Required <-- Country code only?
# 3 Target = Required <-- Doesn't look hard to include everything
# 4 Cameocode ... | {
"repo_name": "samzhang111/diplomacy-viz",
"path": "scratch/parsetodb3.py",
"copies": "1",
"size": "3398",
"license": "bsd-3-clause",
"hash": -490623856403473800,
"line_mean": 26.4032258065,
"line_max": 89,
"alpha_frac": 0.5726898175,
"autogenerated": false,
"ratio": 3.055755395683453,
"config_... |
#!/bin/env python
import random, ctypes, struct, time
from hook_internals import *
r = random.Random()
class Mod1:
call = 0
def f1(self, registers, hit_count):
#import pdb; pdb.set_trace()
#print (registers)
if is_32bit:
string_address = memory.get_ptr(registers.esp+0x2c... | {
"repo_name": "synap5e/pymod",
"path": "main.py",
"copies": "1",
"size": "3268",
"license": "mit",
"hash": 7878143013839160000,
"line_mean": 32.0101010101,
"line_max": 104,
"alpha_frac": 0.5474296206,
"autogenerated": false,
"ratio": 3.461864406779661,
"config_test": false,
"has_no_keywords":... |
#!/bin/env python
import random
import numpy
from math import log, exp, cos, sin, pi
panel_width = 76.2
panel_length = 305
panel_depth = 2.54
panel_sep = 30.5-1*panel_depth
def intensity(theta, depth):
log_i = (-(8e-4*depth)/cos(theta)+
1.53*log(cos(theta))+(8e-4*depth))
i = sin(theta)*e... | {
"repo_name": "steveherrin/PhDThesis",
"path": "Thesis/scripts/muon_flux/test_esch_efficiency.py",
"copies": "1",
"size": "1996",
"license": "mit",
"hash": 2628860212644578300,
"line_mean": 24.9220779221,
"line_max": 76,
"alpha_frac": 0.5365731463,
"autogenerated": false,
"ratio": 2.9791044776119... |
#!/bin/env python
import random
import string
import time
import unittest
from ixf import IXFClient
class TestIXFClient(unittest.TestCase):
def setUp(self):
self.db = IXFClient()
self.db = IXFClient(host='localhost', port=7003, user='dev', password='test')
def _get_obj(self, typ, id):
... | {
"repo_name": "euro-ix/ixf-client-py",
"path": "tests/test_ixfclient.py",
"copies": "2",
"size": "3505",
"license": "mit",
"hash": 6497604438189415000,
"line_mean": 26.5984251969,
"line_max": 105,
"alpha_frac": 0.5326676177,
"autogenerated": false,
"ratio": 3.2544103992571958,
"config_test": tr... |
#!/bin/env python
import random
def mergesort(array):
pass
def bucketsort(array):
pass
def raddixsort(array):
pass
def bubblesort(array):
'''
'''
l = len(array)
for i in range(0,l):
for j in range(i + 1, l):
if array[i] > array[j]:
array[i], array[j] = array[j], array[i]
return array
def inserts... | {
"repo_name": "lvfeng1130/Python",
"path": "sort.py",
"copies": "1",
"size": "2773",
"license": "mit",
"hash": -5720133116796368000,
"line_mean": 17.3642384106,
"line_max": 84,
"alpha_frac": 0.589253516,
"autogenerated": false,
"ratio": 2.271089271089271,
"config_test": false,
"has_no_keyword... |
#!/bin/env python
import re
from django.conf import settings
from .interface import VomsInterface
from .models import VomsUser
def run():
"""
Update VOMS mapping nickname <-> (DN, CA) in the database
:return: dictionary, 'added', 'removed' - records added/removed,
'details' - more informatio... | {
"repo_name": "PanDAWMS/panda-bigmon-atlas",
"path": "atlas/auth/voms/collector.py",
"copies": "1",
"size": "2316",
"license": "apache-2.0",
"hash": -2182960778856697300,
"line_mean": 27.5925925926,
"line_max": 80,
"alpha_frac": 0.4892055268,
"autogenerated": false,
"ratio": 4.226277372262774,
... |
#!/bin/env python
import re
import json
from subprocess import Popen, PIPE
def extract(path):
f = open(path, 'r')
h = {}
for line in f:
line = line.strip()
m = re.search('^\s*def\s*(.*)\((.*)\)\s*:\s*(.*)$', line)
method_name = m.group(1)
params_str = m.group(2)
ret... | {
"repo_name": "yu-iskw/gen-sparkr",
"path": "parse.py",
"copies": "1",
"size": "1983",
"license": "apache-2.0",
"hash": -5582828615445891000,
"line_mean": 24.1012658228,
"line_max": 101,
"alpha_frac": 0.4972264246,
"autogenerated": false,
"ratio": 3.213938411669368,
"config_test": false,
"has... |
#!/bin/env python
import re
import os
import numpy
from optparse import OptionParser
DEBUG=False
def normalized(a, axis=-1, order=2):
l2 = numpy.atleast_1d(numpy.linalg.norm(a, order, axis))
l2[l2==0] = 1
return a / numpy.expand_dims(l2, axis)
def get_center(vertices):
return [float(sum(val))/float... | {
"repo_name": "SONIC3D/gendev-macos",
"path": "extras/obj2mesh/obj2mesh.py",
"copies": "1",
"size": "9115",
"license": "bsd-3-clause",
"hash": -7410470422087725000,
"line_mean": 30.2157534247,
"line_max": 125,
"alpha_frac": 0.4522216127,
"autogenerated": false,
"ratio": 3.53431562621171,
"confi... |
#!/bin/env python
import re
import subprocess
def resize(primary=None, primary_mode=None,
secondary=None, secondary_mode=None, secondary_location="--right-of",
toggle=False, clone=False):
screeninfo = subprocess.check_output(['xrandr']).decode()
screens = sorted(re.findall("(\w+) connected", s... | {
"repo_name": "flacjacket/dotfiles",
"path": "dotfiles/qtile/resize.py",
"copies": "1",
"size": "2511",
"license": "mit",
"hash": 6872326677696574000,
"line_mean": 32.48,
"line_max": 98,
"alpha_frac": 0.5870171247,
"autogenerated": false,
"ratio": 3.7816265060240966,
"config_test": false,
"ha... |
#!/bin/env python
import re
old_pattern = re.compile(r'%\w')
new_pattern = re.compile(r'\{(\w+(\.\w+|\[\w+\])?)\}')
__formaters = {}
def format(text, *a, **kw):
f = __formaters.get(text)
if f is None:
f = formater(text)
__formaters[text] = f
return f(*a, **kw)
#return formater(text)(... | {
"repo_name": "itxx00/dashboard",
"path": "rrd/utils/format.py",
"copies": "5",
"size": "1971",
"license": "apache-2.0",
"hash": 6027971849544779000,
"line_mean": 27.9852941176,
"line_max": 64,
"alpha_frac": 0.4520547945,
"autogenerated": false,
"ratio": 3.023006134969325,
"config_test": false,... |
#!/bin/env python
import re
percent_pattern = re.compile(r'%\w')
brace_pattern = re.compile(r'\{[\w\d\.\[\]_]+\}')
__formaters = {}
def format(text, *a, **kw):
f = __formaters.get(text)
if f is None:
f = formater(text)
__formaters[text] = f
return f(*a, **kw)
def formater(text):
"""... | {
"repo_name": "douban/douban-utils",
"path": "douban/utils/format.py",
"copies": "1",
"size": "1181",
"license": "bsd-3-clause",
"hash": 3632725405977328000,
"line_mean": 24.1276595745,
"line_max": 97,
"alpha_frac": 0.4953429297,
"autogenerated": false,
"ratio": 2.866504854368932,
"config_test"... |
#!/bin/env python
import re, sys
from os import system
import copy
def ftolower(name):
first = name[0]
rest = name[1:]
#return name.lower()
return (first.lower()+rest)
def plotGraph(links,fin):
fout = fin[:-3]
fw = open(fout+'.dot', 'w')
fp = open(ftolower(fout)+'A.pl','w')
print>>fw, "digraph G { "
... | {
"repo_name": "BorisMitrovic/sorted-reformation",
"path": "extract.py",
"copies": "1",
"size": "1252",
"license": "mit",
"hash": -5768360649501136000,
"line_mean": 19.5245901639,
"line_max": 69,
"alpha_frac": 0.5311501597,
"autogenerated": false,
"ratio": 2.3847619047619046,
"config_test": fals... |
#!/bin/env python
import re, time
from datetime import datetime
import mechanize
from tardyrush import db, models
def post_to_vbulletin_3_7(url, forum_id, username, password, subject, message):
retval = None
url = url.strip('/')
def find_login_form(form):
if re.search("login\.php", form.action):... | {
"repo_name": "kenrobbins/tardyrush",
"path": "forum_poster.py",
"copies": "1",
"size": "3482",
"license": "mit",
"hash": -9109363865571907000,
"line_mean": 27.0806451613,
"line_max": 96,
"alpha_frac": 0.5336013785,
"autogenerated": false,
"ratio": 3.728051391862955,
"config_test": false,
"ha... |
#!/bin/env python
import ROOT
from math import pi, sqrt, sin, acos, atan, atan2, sin, cos, tan
import array
import numpy
#ROOT.gStyle.SetNumberContours(10)
m_x = ROOT.RooRealVar("#mu_{x}", "#mu_{x}", 1)
m_y = ROOT.RooRealVar("#mu_{y}", "#mu_{y}", 1)
s_x = ROOT.RooRealVar("#sigma_{x}", "#sigma_{x}", 0.07)
s_y = ROOT... | {
"repo_name": "steveherrin/PhDThesis",
"path": "Thesis/scripts/toy_anticorrelation_plot.py",
"copies": "1",
"size": "6559",
"license": "mit",
"hash": 4627337069184485000,
"line_mean": 30.9951219512,
"line_max": 138,
"alpha_frac": 0.5622808355,
"autogenerated": false,
"ratio": 2.0439389217824866,
... |
#!/bin/env python
import ROOT
import numpy
import array
import scipy.integrate
from math import pi, sin, cos, acos, pow, exp, log
def surface_flux(theta, E):
if E < 0:
return 0
else:
return 0.14*pow(E, -2.7)*(1/(1+1.1*E*cos(theta)/115)
+0.054/(1+1.1*E*cos(thet... | {
"repo_name": "steveherrin/PhDThesis",
"path": "Thesis/scripts/muon_flux/plot_muon_spectrum.py",
"copies": "1",
"size": "4624",
"license": "mit",
"hash": 1119307730169804300,
"line_mean": 27.7204968944,
"line_max": 90,
"alpha_frac": 0.5374134948,
"autogenerated": false,
"ratio": 2.336533602829712... |
#!/bin/env python
import rules_parser as r
class StateMachine(object):
"""
StateMachine which hold the current state and enable the state transition based on rules file
"""
def __init__(self, state):
super(StateMachine, self).__init__()
self.state = state
def transit(self, event):
acceptable_events = Rule... | {
"repo_name": "imzjy/dsl",
"path": "external/statemachine/state_machine.py",
"copies": "1",
"size": "1417",
"license": "mit",
"hash": -8438380138914776000,
"line_mean": 23.0338983051,
"line_max": 94,
"alpha_frac": 0.7099505999,
"autogenerated": false,
"ratio": 3.170022371364653,
"config_test": ... |
#!/bin/env python
import SimpleITK as sitk
import numpy as np
import math
import itertools
from timeit import Timer
import matplotlib.pyplot as plt
import os
num_threads = int(os.environ['ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS'])
sz = [128*3]*3
t_repeat = 3
t_number = 1
factors = [f for f in range(2, 34) if sz[-1]%(f*... | {
"repo_name": "blowekamp/itkBinShrink",
"path": "Documentation/utils/binshrink_performace.py",
"copies": "1",
"size": "2709",
"license": "apache-2.0",
"hash": 4156996676461067300,
"line_mean": 26.09,
"line_max": 79,
"alpha_frac": 0.6762643042,
"autogenerated": false,
"ratio": 2.872746553552492,
... |
#!/bin/env python
import SimpleITK as sitk
import numpy as np
import math
import time
def marschner_lobb(size=40, alpha=0.25, f_M=6.0):
img = sitk.PhysicalPointSource( sitk.sitkVectorFloat32, [size]*3, [-1]*3, [2.0/size]*3)
imgx = sitk.VectorIndexSelectionCast(img, 0)
imgy = sitk.VectorIndexSelectionCast(... | {
"repo_name": "blowekamp/itkBinShrink",
"path": "Documentation/utils/make_marschner_lobb.py",
"copies": "1",
"size": "2435",
"license": "apache-2.0",
"hash": -3008275322885276000,
"line_mean": 25.4673913043,
"line_max": 91,
"alpha_frac": 0.6513347023,
"autogenerated": false,
"ratio": 2.5338189386... |
#!/bin/env python
# Imports
import nmap
from pysphere import VIServer, VIProperty, MORTypes, VIApiException
from pysphere.resources import VimService_services as VI
from pysphere.vi_task import VITask
from netaddr import *
import sys
# Supporting Functions
def setupConnection(host, user, password):
server = V... | {
"repo_name": "phpsystems/vsphereenum",
"path": "vsphere-discovery.py",
"copies": "1",
"size": "2417",
"license": "apache-2.0",
"hash": 8729863691290161000,
"line_mean": 33.0422535211,
"line_max": 123,
"alpha_frac": 0.5589573852,
"autogenerated": false,
"ratio": 3.9493464052287583,
"config_test... |
#!/bin/env python
import SOAPpy
import parca
import json
import subprocess
import datetime
import sys
import os
import os.path
from sqlalchemy import *
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
import tempfile
import time
import signal
import select
import logging
... | {
"repo_name": "victor-yacovlev/parca",
"path": "python/parca/soap_server.py",
"copies": "1",
"size": "12143",
"license": "mit",
"hash": -4785292786196311000,
"line_mean": 28.1199040767,
"line_max": 125,
"alpha_frac": 0.5785226056,
"autogenerated": false,
"ratio": 3.348869277440706,
"config_test... |
#!/bin/env python
import socket, re, shlex, operator
HOST = "localhost"
PORT = 6379
def get_parts(data):
lexer = shlex.shlex(data, posix=True)
lexer.whitespace_split = True
return tuple(lexer)
def pub_all():
print 'Publishing all'
s.sendall('KEYS *\r\n')
data = s.recv(1024)
parts = get_parts(data)
... | {
"repo_name": "samphippen/compdis",
"path": "monitor.py",
"copies": "1",
"size": "2714",
"license": "mit",
"hash": -4314968177418593300,
"line_mean": 20.3700787402,
"line_max": 80,
"alpha_frac": 0.6193809875,
"autogenerated": false,
"ratio": 2.2749371332774517,
"config_test": false,
"has_no_k... |
#! /bin/env python
import struct
import bson
import sys
#import pymongo
'''
valid bson physical format: int32 e_list 0x00
1. the "int32"(little-endian) is the total number of bytes comprising the document
2. the "e_list" is the elements of this document
3. the "0x00" is the end flag of this document
remo... | {
"repo_name": "ashun/mongorecover",
"path": "mongorecover.py",
"copies": "1",
"size": "2188",
"license": "bsd-2-clause",
"hash": 7290071310154889000,
"line_mean": 27.7894736842,
"line_max": 152,
"alpha_frac": 0.5767824497,
"autogenerated": false,
"ratio": 3.386996904024768,
"config_test": false... |
#!/bin/env python
import subprocess
from webservice.base_webservice import BaseWebservice
from record import Record
import os
from utils import Utils
class KnowledgeGraph(object):
kg_cache = {}
"""docstring for KnowageGraph"""
def __init__(self):
super(KnowledgeGraph, self).__init__()
self.webservice =... | {
"repo_name": "roscopecoltran/scraper",
"path": ".staging/meta-engines/xlinkBook/knowledgegraph.py",
"copies": "1",
"size": "3163",
"license": "mit",
"hash": 6686123085481455000,
"line_mean": 31.2755102041,
"line_max": 89,
"alpha_frac": 0.5156496997,
"autogenerated": false,
"ratio": 3.97361809045... |
#!/bin/env python
import subprocess
import logging
fmt = "%(asctime)-15s %(levelname)s %(filename)s %(lineno)d %(process)d %(message)s"
datefmt = "%a %d %b %Y %H:%M:%S"
logging.basicConfig(format=fmt, datefmt=datefmt, level=logging.INFO)
def ipset_basic_struct(action, ipset_name, ip):
cmd = ['ipset', action]
... | {
"repo_name": "RushnAttack/GreenBeret-core",
"path": "ipset_wrapper.py",
"copies": "1",
"size": "1172",
"license": "mit",
"hash": 841645327721104900,
"line_mean": 28.3,
"line_max": 131,
"alpha_frac": 0.6313993174,
"autogenerated": false,
"ratio": 2.997442455242967,
"config_test": false,
"has_... |
#!bin/env python
import subprocess
import os.path
import unittest, re
class TestSafety(unittest.TestCase):
@classmethod
def setUpClass(self):
# clean up, just in case
subprocess.call('rm -rf remote local 2>> /dev/null', shell=True)
# Create "local" and "remote" repositories
... | {
"repo_name": "3ptscience/git-project",
"path": "test/test_safety.py",
"copies": "2",
"size": "3731",
"license": "mit",
"hash": 136397695827884900,
"line_mean": 48.7466666667,
"line_max": 144,
"alpha_frac": 0.6577325114,
"autogenerated": false,
"ratio": 3.838477366255144,
"config_test": true,
... |
#!bin/env python
import subprocess
import os.path
import unittest, re
class TestSaveLoad(unittest.TestCase):
@classmethod
def setUpClass(self):
# ensure we start with a clean slate, just in case
subprocess.call('rm -rf remote local 2>> /dev/null', shell=True)
# Initialize "remote" ... | {
"repo_name": "3ptscience/git-project",
"path": "test/test_loadfail.py",
"copies": "2",
"size": "2989",
"license": "mit",
"hash": 6548568263466321000,
"line_mean": 43.6119402985,
"line_max": 144,
"alpha_frac": 0.6590833055,
"autogenerated": false,
"ratio": 3.8468468468468466,
"config_test": tru... |
#!/bin/env python
import subprocess
import re
"""*nix netstat scraper implementation(s)"""
class NetstatException(Exception):
"""
Thrown whenever there's a netstat issue.
"""
pass
class Netstat:
"""
An abstract class that will define netstat scraper implementation.
Extend this class to... | {
"repo_name": "dmotles/ddos-evicerate",
"path": "netstat.py",
"copies": "1",
"size": "2373",
"license": "bsd-3-clause",
"hash": -7589220588193060000,
"line_mean": 23.4639175258,
"line_max": 81,
"alpha_frac": 0.5857564265,
"autogenerated": false,
"ratio": 3.568421052631579,
"config_test": false,... |
#!/bin/env python
import subprocess
# key for number of detected fails
K_FAILS = 'fails'
# key for bool if "onFail" was triggered
K_ALERTED = 'alerted'
# key for interval in minutes
K_INTERVAL = 'interval'
# key for incoming ping token
K_TOKEN = 'token'
# key for api result success state
K_SUCCESS = 'success'
# speci... | {
"repo_name": "NoUsername/uptester",
"path": "commons.py",
"copies": "1",
"size": "1507",
"license": "mit",
"hash": -4052242872102644700,
"line_mean": 28,
"line_max": 88,
"alpha_frac": 0.7153284672,
"autogenerated": false,
"ratio": 2.881453154875717,
"config_test": false,
"has_no_keywords": f... |
#!/bin/env python
import subprocess,pysam, sys, re
def namesortbam(inbam,outbam):
print "sorting by name:",inbam,"-->",outbam
outbam = re.sub('.bam$','',outbam)
sortargs = ['samtools','sort','-n','-m','20000000000',inbam,outbam]
subprocess.call(sortargs)
def compare(bamfile1,bamfile2):
bam1sort ... | {
"repo_name": "chaelir/bamsurgeon",
"path": "etc/comparemapping.py",
"copies": "1",
"size": "2109",
"license": "mit",
"hash": -5639806454623715000,
"line_mean": 33.0161290323,
"line_max": 119,
"alpha_frac": 0.5798956852,
"autogenerated": false,
"ratio": 3.200303490136571,
"config_test": false,
... |
#! /bin/env python
import sys
from six.moves import range
import numpy as np
import xml.dom.minidom
from landlab.io.vtk.encoders import encode
from landlab.io.vtk.vtktypes import SYS_TO_VTK_ENDIAN, NUMPY_TO_VTK_TYPE
class VtkExtent(object):
def __init__(self, shape):
assert(len(shape) <= 3)
se... | {
"repo_name": "SiccarPoint/landlab",
"path": "landlab/io/vtk/vtkxml.py",
"copies": "6",
"size": "6566",
"license": "mit",
"hash": -4285887582611655700,
"line_mean": 27.547826087,
"line_max": 78,
"alpha_frac": 0.5784343588,
"autogenerated": false,
"ratio": 3.7096045197740115,
"config_test": fals... |
#!/bin/env python
import sys
import base64
import urllib2
import xml.etree.ElementTree as ET
if len(sys.argv) != 3:
print >> sys.stderr, '\nUsage: %s <username> <password> \n\n<username> and <password> should be credentials of a administrator.\n' % sys.argv[0]
exit(1)
endpoint = 'http://127.0.0.1:8182'
auth ... | {
"repo_name": "slipstream/SlipStreamServer",
"path": "rpm/src/main/migrations/012_edit_save_all_users.py",
"copies": "1",
"size": "2122",
"license": "apache-2.0",
"hash": 7182597176666498000,
"line_mean": 54.8421052632,
"line_max": 871,
"alpha_frac": 0.705466541,
"autogenerated": false,
"ratio": ... |
#!/bin/env python
import sys
import getopt
import json
import localPageCache
from urllib.parse import urlparse, parse_qs
from bs4 import BeautifulSoup
import difflib
import unicodedata
from pprint import pprint
try:
opts, args = getopt.getopt(sys.argv[1:], "v", ["print"])
except getopt.GetoptError:
print('get... | {
"repo_name": "kyro38/TagData",
"path": "mobitrans.py",
"copies": "1",
"size": "6232",
"license": "apache-2.0",
"hash": 7250947834685435000,
"line_mean": 30.16,
"line_max": 132,
"alpha_frac": 0.604139923,
"autogenerated": false,
"ratio": 3.444997236042012,
"config_test": false,
"has_no_keywor... |
#!/bin/env python
import sys
import gzip
import argparse
from svtools.vcf.file import Vcf
from svtools.vcf.variant import Variant
import svtools.utils as su
def set_from_string(string):
'''
Convert a comma separated string to a set of strings
'''
if string == '':
return set()
else:
... | {
"repo_name": "abelhj/svtools",
"path": "scripts/sname_overlap.py",
"copies": "2",
"size": "3718",
"license": "mit",
"hash": 8936008489469783000,
"line_mean": 36.18,
"line_max": 187,
"alpha_frac": 0.6231845078,
"autogenerated": false,
"ratio": 3.729187562688064,
"config_test": false,
"has_no_... |
#!/bin/env python
import sys
import json
from httplib import HTTPConnection
from optparse import OptionParser
def fetchMetrics(host, port, url):
connection = HTTPConnection(host, port)
connection.request("GET", url)
response = connection.getresponse()
if response.status == 200:
try:
... | {
"repo_name": "linkslice/graphite-tools",
"path": "check_graphite.py",
"copies": "1",
"size": "4246",
"license": "mit",
"hash": 5012300432022300000,
"line_mean": 28.2827586207,
"line_max": 116,
"alpha_frac": 0.5605275553,
"autogenerated": false,
"ratio": 3.8954128440366973,
"config_test": false... |
#!/bin/env python
import sys
import json
import pywbem
import argparse
import logging
import logging.handlers
log_level = logging.INFO
def ecom_connect(ecom_ip, ecom_user, ecom_pass, default_namespace="/root/emc"):
""" returns a connection to the ecom server """
ecom_url = "https://%s:5989" % ecom_ip
l... | {
"repo_name": "ktelep/EMC-Zabbix-Integration",
"path": "emc_vnx_discovery.py",
"copies": "1",
"size": "15966",
"license": "mit",
"hash": 3494767167284088300,
"line_mean": 31.8518518519,
"line_max": 79,
"alpha_frac": 0.5967054992,
"autogenerated": false,
"ratio": 3.856521739130435,
"config_test"... |
#!/bin/env python
import sys
import json
import pywbem
import argparse
def add_vnx(spa_ip, spb_ip, array_user, array_pass,
ecom_ip, ecom_user="admin", ecom_pass="#1Password"):
ecom_url = "https://%s:5989" % ecom_ip
ecom_conn = pywbem.WBEMConnection(ecom_url,(ecom_user,ecom_pass),
... | {
"repo_name": "ktelep/EMC-Zabbix-Integration",
"path": "tools/ecom_vnx_manage.py",
"copies": "1",
"size": "1832",
"license": "mit",
"hash": 1185847642486838000,
"line_mean": 34.2307692308,
"line_max": 75,
"alpha_frac": 0.5720524017,
"autogenerated": false,
"ratio": 3.49618320610687,
"config_tes... |
#!/bin/env python
import sys
import json
import string
import re
fh = open(sys.argv[1])
result = json.load(fh)
# dump the json
#for k,v in result.items():
# print '%s:%s\n' % (k,v)
print 'Parsing %s' % (sys.argv[1])
if ('result' in result.keys()):
print 'Successful execution with result: %s' % (result['resu... | {
"repo_name": "University-of-Auckland/federationregistry2-Tuakiri",
"path": "scripts/upgrades/major-release/2/refreshdb/refresh-db-json-result.py",
"copies": "2",
"size": "1069",
"license": "apache-2.0",
"hash": 443464928112516100,
"line_mean": 23.2954545455,
"line_max": 69,
"alpha_frac": 0.618334892... |
#!/bin/env python
import sys
import json
def readJSON(path):
f = open(path, 'r')
jsonData = json.load(f)
f.close()
return jsonData
def aggregate(d):
nd = {}
for k in d:
if d[k]['name'] in nd:
nd[d[k]['name']].append(d[k]['params'])
else:
nd[d[k]['name'... | {
"repo_name": "yu-iskw/gen-sparkr",
"path": "generate-r.py",
"copies": "1",
"size": "6041",
"license": "apache-2.0",
"hash": -3223631832933467600,
"line_mean": 25.96875,
"line_max": 104,
"alpha_frac": 0.5212713127,
"autogenerated": false,
"ratio": 3.40721940214326,
"config_test": false,
"has_... |
#!/bin/env python
import sys
import os
from pycparser import parse_file, c_generator, c_ast
sys.path.extend(['.', '..'])
class StructVisitor(c_ast.NodeVisitor):
def visit_Struct(self, node):
try:
if not 'cef_base_t' in node.decls[0].type.type.names:
return
except Attr... | {
"repo_name": "schachmat/smurf",
"path": "implement_interface.py",
"copies": "1",
"size": "6348",
"license": "isc",
"hash": -4247330625968024000,
"line_mean": 38.9245283019,
"line_max": 103,
"alpha_frac": 0.5055135476,
"autogenerated": false,
"ratio": 3.318348144276006,
"config_test": false,
... |
#!/bin/env python
import sys
import os
import re
EXAMPLE_DIR = "examples"
TAG_DIR = "tags"
FILE_PATH = os.path.dirname(os.path.realpath(__file__))
def clear_folder(folder):
# Subroutine derived from http://stackoverflow.com/questions/185936/delete-folder-contents-in-python
for the_file in os.listdir(folder)... | {
"repo_name": "bitemyapp/bakerstreet",
"path": "docs/source/extract_tags.py",
"copies": "4",
"size": "3133",
"license": "apache-2.0",
"hash": -1311810439046243600,
"line_mean": 30.9693877551,
"line_max": 104,
"alpha_frac": 0.5735716566,
"autogenerated": false,
"ratio": 3.2567567567567566,
"conf... |
#!/bin/env python
import sys
import os
import subprocess
import argparse
import re
import shutil
import rpm
import urlparse
import traceback
import toposort
class SPECTemplate(object):
def __init__(self, specFilename, outputDir, inputDir=None, buildRootInclude=None, translateTable=None, repositoryDir=None, allP... | {
"repo_name": "maximilianhuber/myconfig",
"path": "nix/nixpkgs/pkgs/build-support/templaterpm/nix-template-rpm.py",
"copies": "3",
"size": "18995",
"license": "mit",
"hash": 7542226782861476000,
"line_mean": 35.6698841699,
"line_max": 322,
"alpha_frac": 0.6198999737,
"autogenerated": false,
"rati... |
#! /bin/env python
import sys
import os
import tarfile
import argparse
from os.path import dirname, join, abspath
from shutil import copy, copytree, rmtree
from subprocess import check_call
from contextlib import closing
parser = argparse.ArgumentParser(
description='Build dynamic cluster RPM',
)
pars... | {
"repo_name": "eResearchSA/dynamiccluster",
"path": "pkg/build.py",
"copies": "1",
"size": "1787",
"license": "apache-2.0",
"hash": -8378292276989505000,
"line_mean": 29.8275862069,
"line_max": 103,
"alpha_frac": 0.6496922216,
"autogenerated": false,
"ratio": 3.1461267605633805,
"config_test": ... |
#!/bin/env python
import sys
import os
import threading
import time
import psycopg2
descriptors = list()
_Worker_Thread = None
_Lock = threading.Lock() # synchronization lock
metric_results = {}
def metric_of(name):
global metric_results
return metric_results.get(name,0)
# These are the defaults set for the... | {
"repo_name": "mentalblock/ganglia_postgresql",
"path": "python_modules/postgresql.py",
"copies": "1",
"size": "12313",
"license": "mit",
"hash": 131293195827211300,
"line_mean": 34.7936046512,
"line_max": 104,
"alpha_frac": 0.5421099651,
"autogenerated": false,
"ratio": 3.6821172248803826,
"co... |
#!/bin/env python
import sys
import platform
# check python version
if sys.version_info < (2, 7, 0):
print ("Current python version %s, "
"but require version %s or above") % \
(platform.python_version(), "2.7.0")
sys.exit(1)
import argparse
import subprocess
import time
# parse command line ... | {
"repo_name": "unix1986/universe",
"path": "sample/python/argparser_qps.py",
"copies": "1",
"size": "1632",
"license": "bsd-2-clause",
"hash": 2624643718646686700,
"line_mean": 25.7540983607,
"line_max": 92,
"alpha_frac": 0.5778186275,
"autogenerated": false,
"ratio": 3.571115973741794,
"config... |
#!/bin/env python
import sys
import re
from subprocess import check_call, CalledProcessError
assert len(sys.argv) > 3, 'Usage: uic.py <input file> <output file> <pyuic command>'
in_file = sys.argv[1]
out_file = sys.argv[2]
try:
check_call(sys.argv[3:] + ['-o', out_file, in_file])
except CalledProcessError as ex... | {
"repo_name": "MjnMixael/knossos",
"path": "tools/common/uic.py",
"copies": "1",
"size": "1138",
"license": "apache-2.0",
"hash": 7372838390607287000,
"line_mean": 31.5142857143,
"line_max": 122,
"alpha_frac": 0.716168717,
"autogenerated": false,
"ratio": 3.117808219178082,
"config_test": false... |
#!/bin/env python
import sys
import requests
from datetime import datetime
from sql import SQL, sql_sink
class request:
parameters = {
'q': '',
'format': 'json',
'diagnostics': 'false',
'env': 'store://datatables.org/alltableswithkeys',
'callback': ''
}
historical_... | {
"repo_name": "jodvova/stocks",
"path": "common.py",
"copies": "1",
"size": "5078",
"license": "apache-2.0",
"hash": 7754358570929913000,
"line_mean": 36.6148148148,
"line_max": 169,
"alpha_frac": 0.5638046475,
"autogenerated": false,
"ratio": 3.4497282608695654,
"config_test": false,
"has_no... |
#!/bin/env python
import sys
import requests
import json
RETURN_OK = True
RETURN_KO = False
URL_PATH = 'http://{0}/api/v1.0/system/alert'
SEVERITY_MAPPING = {'FATAL':5, 'CRIT':4, 'WARN':3, 'INFO':2, 'OK':0}
SEVERITY_PRINTING_MAPPING = {5:'criticalAlerts', 3:'warningAlerts', 2:'infoAlerts', 0:'clearedAlerts'}
DEFAULT... | {
"repo_name": "N-faycal/ZenPacks.iXsystems.TrueNAS",
"path": "ZenPacks/iXsystems/TrueNAS/libexec/getTrueNASAlerts.py",
"copies": "2",
"size": "2365",
"license": "bsd-2-clause",
"hash": -8604117914272840000,
"line_mean": 23.6354166667,
"line_max": 159,
"alpha_frac": 0.6177589852,
"autogenerated": fa... |
#!/bin/env python
import sys
import shlex,subprocess
from psphere.client import Client
from psphere.managedobjects import HostSystem
zabbix_sender = 'zabbix_senderパス'
zabbix_server = 'Zabbixサーバホスト名orIPアドレス'
esxi_host = sys.argv[1] #HyperVisor hostname
username = sys.argv[2] #HyperVisor login username
password = sy... | {
"repo_name": "tech-sketch/zabbix_book_sample",
"path": "1st_edition/Chapter7/host_resource_utilization.py",
"copies": "1",
"size": "1173",
"license": "apache-2.0",
"hash": -6776895261750569000,
"line_mean": 34.84375,
"line_max": 141,
"alpha_frac": 0.7401918047,
"autogenerated": false,
"ratio": 2... |
#!/bin/env python
import sys
import subprocess
import datetime
import logging
import os
import json
from multiprocessing import Process
from common.utils import Util
class Worker(object):
def __init__(self,db_name,hdfs_app_path,kafka_consumer,conf_type,processes=None):
self._initialize_members(db_name,... | {
"repo_name": "kpeiruza/incubator-spot",
"path": "spot-ingest/pipelines/flow/worker.py",
"copies": "1",
"size": "4291",
"license": "apache-2.0",
"hash": 421841892701048640,
"line_mean": 40.6601941748,
"line_max": 273,
"alpha_frac": 0.6203682125,
"autogenerated": false,
"ratio": 3.3654901960784316... |
#!/bin/env python
import sys
import uuid
import time
import signal
import logging
from argparse import ArgumentParser
from logging.handlers import RotatingFileHandler
from threading import Thread
class LoggerManager:
def __init__(self, args):
# KB to bytes
self.max_bytes = (args.size * 1000)
... | {
"repo_name": "nokute78/fluent-bit",
"path": "tests/runtime_shell/in_tail/logger_file.py",
"copies": "2",
"size": "2384",
"license": "apache-2.0",
"hash": 1219278258265363200,
"line_mean": 32.1111111111,
"line_max": 89,
"alpha_frac": 0.5746644295,
"autogenerated": false,
"ratio": 4.18980667838312... |
#!/bin/env python
import sys
import uwhd
import time
import random
# Start up the GPIO for talking to the 32x32 panels
io = uwhd.GPIO()
if not io.Init():
print 'Try running this as:'
print ''
print '$ sudo PYTHONPATH=path/to/build/lib python uwhd-demo.py'
sys.exit(-1)
print "GPIO inited"
# number of rows of... | {
"repo_name": "Navisjon/uwh-display",
"path": "tools/uwhd-demo-py/uwhd-demo.py",
"copies": "2",
"size": "2220",
"license": "bsd-3-clause",
"hash": 6799329013510953000,
"line_mean": 22.125,
"line_max": 74,
"alpha_frac": 0.709009009,
"autogenerated": false,
"ratio": 3.004059539918809,
"config_tes... |
#!/bin/env python
import sys
class Interval:
def __init__(self,chr,start,end,etc):
self.chr = chr
self.start = int(start)
self.end = int(end)
self.info = etc
def cmp(self,ivl):
if self.chr == ivl.chr:
if (self.start <= ivl.start and self.end >= ivl.start) or... | {
"repo_name": "chaelir/bamsurgeon",
"path": "etc/dedup.py",
"copies": "1",
"size": "1365",
"license": "mit",
"hash": 3916351506771347500,
"line_mean": 25.7647058824,
"line_max": 118,
"alpha_frac": 0.4901098901,
"autogenerated": false,
"ratio": 3.2422802850356294,
"config_test": false,
"has_no... |
#! /bin/env python
import sys
import numpy as np
import xml.dom.minidom
from landlab.io.vtk.encoders import encode
from landlab.io.vtk.vtktypes import SYS_TO_VTK_ENDIAN, NUMPY_TO_VTK_TYPE
class VtkExtent(object):
def __init__(self, shape):
assert(len(shape) <= 3)
self._shape = tuple(shape)
... | {
"repo_name": "decvalts/landlab",
"path": "landlab/io/vtk/vtkxml.py",
"copies": "1",
"size": "6584",
"license": "mit",
"hash": 5365338088332298000,
"line_mean": 29.7663551402,
"line_max": 79,
"alpha_frac": 0.5742709599,
"autogenerated": false,
"ratio": 3.726089417091115,
"config_test": false,
... |
#!/bin/env python
import sys
pad = 10000
class Interval:
def __init__(self,chr,start,end,etc):
self.chr = chr
self.start = int(start)
self.end = int(end)
self.info = etc
def cmp(self,ivl):
if self.chr == ivl.chr:
if (self.start <= ivl.start and self.end >= ... | {
"repo_name": "MischaLundberg/bamsurgeon",
"path": "scripts/dedup.py",
"copies": "2",
"size": "1370",
"license": "mit",
"hash": 5300063862278832000,
"line_mean": 25.3461538462,
"line_max": 118,
"alpha_frac": 0.4927007299,
"autogenerated": false,
"ratio": 3.215962441314554,
"config_test": false,... |
#!/bin/env python
import sys
sys.path.append('.')
from sim.api import *
from sim.basics import *
from rip_router import RIPRouter
import sim.topo as topo
import os
import time
failed = False
class FakeEntity (Entity):
def __init__(self, expected, to_announce):
self.expect = expected
self.announc... | {
"repo_name": "zhaoyan1117/RoutingProtocols",
"path": "tests/implicit_withdrawal_test.py",
"copies": "1",
"size": "1758",
"license": "bsd-3-clause",
"hash": 5875838781551364000,
"line_mean": 23.7605633803,
"line_max": 69,
"alpha_frac": 0.606370876,
"autogenerated": false,
"ratio": 3.6247422680412... |
#!/bin/env python
import sys
sys.path.append('.')
from sim.api import *
from sim.basics import *
from rip_router import RIPRouter
import sim.topo as topo
import os
import time
received = False
failed = False
class FakeEntity (Entity):
def __init__(self, expected, to_announce):
self.expect = expected
... | {
"repo_name": "zhaoyan1117/RoutingProtocols",
"path": "tests/poison_reverse_test.py",
"copies": "1",
"size": "1951",
"license": "bsd-3-clause",
"hash": -751282362354348200,
"line_mean": 24.6710526316,
"line_max": 69,
"alpha_frac": 0.5884161968,
"autogenerated": false,
"ratio": 3.840551181102362,
... |
#!/bin/env python
import sys
sys.path.append('.')
from sim.api import *
from sim.basics import *
from rip_router import RIPRouter
import sim.topo as topo
import os
import time
testing = True
failed = False
waittime = 5
expectedUpdate1 = {}
expectedSender1 = {}
testCaseNum = 0
class FakeEntity (Entity):
def __in... | {
"repo_name": "zhaoyan1117/RoutingProtocols",
"path": "tests/test_01_v0.75.py",
"copies": "1",
"size": "11478",
"license": "bsd-3-clause",
"hash": -4893987092627570000,
"line_mean": 29.8548387097,
"line_max": 206,
"alpha_frac": 0.5325840739,
"autogenerated": false,
"ratio": 3.0534716679968077,
... |
#!/bin/env python
import sys, os, math, types, time, datetime
from urllib import urlopen
from urllib import urlretrieve
from urlparse import urlparse
#import Numeric as N
import numpy as N
import numpy.ma as MA
#import matplotlib.numerix.ma as MA
import matplotlib
matplotlib.use('Agg')
import matplotlib.pylab as M
fro... | {
"repo_name": "dataplumber/nexus",
"path": "climatology/clim/plotlib.py",
"copies": "1",
"size": "33780",
"license": "apache-2.0",
"hash": -3533001104020507000,
"line_mean": 39.0711743772,
"line_max": 106,
"alpha_frac": 0.5783599763,
"autogenerated": false,
"ratio": 3.438867962944111,
"config_t... |
#!/bin/env python
import sys, os
from subprocess import Popen, PIPE
from multiprocessing import Process, Queue
"""Start the serial.py jobs. Start this with (python start.py &> start.log)&
"""
n_procs = 10
file_1 = None
file_2 = "mill2_fof_sorted.h5" #"sub_haloes_global_coords_sorted_indexed.h5" #"all_haloes_gif2.h5... | {
"repo_name": "brunetto/MasterThesisCode",
"path": "master_code/start/start.py",
"copies": "1",
"size": "2411",
"license": "mit",
"hash": -2294949477644567000,
"line_mean": 25.7888888889,
"line_max": 114,
"alpha_frac": 0.6167565326,
"autogenerated": false,
"ratio": 3.009987515605493,
"config_te... |
#!/bin/env python
import sys, os
from subprocess import Popen, PIPE
from multiprocessing import Process, Queue
"""This script starts n_procs processes that in parallel take the
number of the data file from a common queue and with a loop apply the
analysys code to the data starting it with a bash command using Popen
"... | {
"repo_name": "brunetto/MasterThesisCode",
"path": "master_code/otherMiscCode/CF_CCF-code-template/start/start.py",
"copies": "1",
"size": "2451",
"license": "mit",
"hash": 481284843401049540,
"line_mean": 27.8352941176,
"line_max": 107,
"alpha_frac": 0.6022031824,
"autogenerated": false,
"ratio"... |
#!/bin/env python
import tensorflow as tf
import flask
import glob
import os
session = None
model = None
app = flask.Flask("colorbot-app-server")
@app.route("/v1/predict")
def predict():
color_query = flask.request.args.get("color")
if color_query == None:
return
if len(color_query) > 64:
... | {
"repo_name": "andrewortman/colorbot",
"path": "serving/server.py",
"copies": "1",
"size": "1409",
"license": "mit",
"hash": 3733041914648037400,
"line_mean": 22.4833333333,
"line_max": 101,
"alpha_frac": 0.6394606104,
"autogenerated": false,
"ratio": 3.346793349168646,
"config_test": true,
"... |
#!/bin/env python
import time
import logging
import os
import json
from multiprocessing import Process
from common.utils import Util
from common.file_collector import FileWatcher
from multiprocessing import Pool
from common.kafka_client import KafkaTopic
class Collector(object):
def __init__(self,hdfs_app_path,k... | {
"repo_name": "kpeiruza/incubator-spot",
"path": "spot-ingest/pipelines/flow/collector.py",
"copies": "1",
"size": "4122",
"license": "apache-2.0",
"hash": -1140040368397863400,
"line_mean": 36.4727272727,
"line_max": 182,
"alpha_frac": 0.596069869,
"autogenerated": false,
"ratio": 3.903409090909... |
#!/bin/env python
import time
import optparse
from sql import SQL, sql_sink
from common import *
class driver:
no_data_error = "No data for: %s"
request_failed_error = "Failed to request data for: %s"
def __init__(self, file, options):
self.file_ = file
self.options_ = options
... | {
"repo_name": "jodvova/stocks",
"path": "downloader.py",
"copies": "1",
"size": "3422",
"license": "apache-2.0",
"hash": 8864033814425881000,
"line_mean": 32.8811881188,
"line_max": 97,
"alpha_frac": 0.5146113384,
"autogenerated": false,
"ratio": 3.9243119266055047,
"config_test": false,
"has... |
#/bin/env python
import time
import os
import subprocess
import json
import logging
from multiprocessing import Process
from common.utils import Util
from common.file_collector import FileWatcher
from multiprocessing import Pool
from common.kafka_client import KafkaTopic
class Collector(object):
def __init__(sel... | {
"repo_name": "kpeiruza/incubator-spot",
"path": "spot-ingest/pipelines/dns/collector.py",
"copies": "1",
"size": "5151",
"license": "apache-2.0",
"hash": -7204551859501905000,
"line_mean": 38.6230769231,
"line_max": 228,
"alpha_frac": 0.5913414871,
"autogenerated": false,
"ratio": 3.821216617210... |
#!/bin/env python
import time
import simtk.openmm as mm
from simtk.openmm import app
from simtk.openmm import Platform
from simtk.unit import *
import numpy as np
from mdtraj.reporters import NetCDFReporter
from smarty import *
import sys
import numpy as np
from ast import literal_eval
molname = [sys.argv[1]]
SMIRKS_... | {
"repo_name": "bmanubay/open-forcefield-tools",
"path": "single-molecule-property-generation/simulate_for_posterior.py",
"copies": "1",
"size": "3159",
"license": "mit",
"hash": 8260212758971251000,
"line_mean": 34.8977272727,
"line_max": 148,
"alpha_frac": 0.6951566952,
"autogenerated": false,
"... |
#!/bin/env python
import time, re, os
from slackclient import SlackClient
import txsplain
token = os.getenv("TXSPLAIN_SLACK_TOKEN")
sc = SlackClient(token)
if not sc.rtm_connect():
exit("Failed to connect.")
def activates_bot(msg):
tx_hash_regex = re.compile(r"(\<@U03TC7URZ\>:?\s+)?([0-9a-f]{64})(\s+verbose... | {
"repo_name": "mDuo13/txsplain",
"path": "bot.py",
"copies": "1",
"size": "1257",
"license": "mit",
"hash": -2035288048445090600,
"line_mean": 26.9333333333,
"line_max": 99,
"alpha_frac": 0.5704057279,
"autogenerated": false,
"ratio": 3.0733496332518335,
"config_test": false,
"has_no_keywords... |
#!/bin/env python
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from concurrent.futures import ThreadPoolExecutor
from functools import partial, wraps
import time
from tornado.options import define, options
define("port", default=8000, help="run on the given port", type=in... | {
"repo_name": "dongweiming/speakerdeck",
"path": "tornado/6_done_callback_sleep.py",
"copies": "1",
"size": "1427",
"license": "apache-2.0",
"hash": 8585561473813754000,
"line_mean": 25.9245283019,
"line_max": 81,
"alpha_frac": 0.6517168886,
"autogenerated": false,
"ratio": 3.8777173913043477,
... |
#!/bin/env python
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import tornado.gen
import tornado.httpclient
import tcelery
import sleep_task as tasks
from tornado.options import define, options
define("port", default=8000, help="run on the given port", type=int)
tcelery.... | {
"repo_name": "dongweiming/speakerdeck",
"path": "tornado/4_celery_async_sleep.py",
"copies": "1",
"size": "1036",
"license": "apache-2.0",
"hash": 1036798476949668000,
"line_mean": 27.7777777778,
"line_max": 70,
"alpha_frac": 0.7133204633,
"autogenerated": false,
"ratio": 3.673758865248227,
"c... |
#!/bin/env python
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import tornado.gen
import tornado.httpclient
import tornado.concurrent
import tornado.ioloop
import time
def test(t, callback=None, **kwargs):
future = tornado.concurrent.Future()
return future
from t... | {
"repo_name": "dongweiming/speakerdeck",
"path": "tornado/2_asynchronous_sleep.py",
"copies": "1",
"size": "1160",
"license": "apache-2.0",
"hash": -3062850686800913000,
"line_mean": 26.619047619,
"line_max": 70,
"alpha_frac": 0.7017241379,
"autogenerated": false,
"ratio": 3.7540453074433655,
"... |
#!/bin/env python
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import tornado.httpclient
import time
from tornado.options import define, options
define("port", default=8000, help="run on the given port", type=int)
class SleepHandler(tornado.web.RequestHandler):
@torn... | {
"repo_name": "wangjun/BT-Share",
"path": "web/test/request-sync.py",
"copies": "2",
"size": "1317",
"license": "mit",
"hash": -8950415595503730000,
"line_mean": 31.925,
"line_max": 71,
"alpha_frac": 0.6681852696,
"autogenerated": false,
"ratio": 3.741477272727273,
"config_test": false,
"has_... |
#!/bin/env python
import urllib, re, os
from xml.parsers import expat
class blv :
def __init__(self):
self.baseUrl = 'https://twiki.cern.ch/twiki/bin/view/LCG/WLCGBaselineVersions'
self.nextIsVersion = False
self.oldCvmfsVersion = ''
self.newCvmfsVersion = ''
self.cvmfsVersionFile = 'cvmfsVersi... | {
"repo_name": "roiser/WLCG",
"path": "ssbCvmfsStatus/wlcg-getCvmfsBaseLineVersion.py",
"copies": "1",
"size": "1507",
"license": "mit",
"hash": -2690382806312445400,
"line_mean": 31.7608695652,
"line_max": 129,
"alpha_frac": 0.6595885866,
"autogenerated": false,
"ratio": 3.10082304526749,
"conf... |
#!/bin/env/python
infileList = []
keyList = []
cList = (
"GBR",
"FIN",
"CHS",
"PUR",
"CLM",
"IBS",
"CEU",
"YRI",
"CHB",
"JPT",
"LWK",
"ASW",
"MXL",
"TSI",
)
for i in range(1,23):
infileList.appe... | {
"repo_name": "CORDEA/analysis_of_1000genomes-data",
"path": "programs/OLD/cluster.py",
"copies": "1",
"size": "1452",
"license": "apache-2.0",
"hash": 7327896532776087000,
"line_mean": 25.8888888889,
"line_max": 84,
"alpha_frac": 0.4063360882,
"autogenerated": false,
"ratio": 3.3689095127610207,... |
#!/bin/env/python
infileList = []
keyList = []
for i in range(1,23):
infileList.append("vcf/proc_input.chr" + str(i) + ".vcf")
keyList.append("cluster_chr" + str(i))
infileList.append("vcf/proc_input.chrX.vcf")
keyList.append("cluster_chrX")
for l in range(len(infileList)):
files = open(infileList[l], "r... | {
"repo_name": "CORDEA/analysis_of_1000genomes-data",
"path": "programs/OLD/cluster_allele.py",
"copies": "1",
"size": "1502",
"license": "apache-2.0",
"hash": 6833580006365245000,
"line_mean": 30.2916666667,
"line_max": 91,
"alpha_frac": 0.4047936085,
"autogenerated": false,
"ratio": 3.7929292929... |
#!/bin/env/python
infileList = []
keyList = []
infileList = ["opensnp/openid.vcf"]
one = 0
for l in range(len(infileList)):
files = open(infileList[l], "r")
outFile = open("opensnp/opid.freq.vcf", "w")
line = files.readline()
count = 0
cDict = {}
while line:
all = 0
if not co... | {
"repo_name": "CORDEA/analysis_of_1000genomes-data",
"path": "programs/OLD/openid.freq.py",
"copies": "1",
"size": "1938",
"license": "apache-2.0",
"hash": -760442991290711900,
"line_mean": 31.8474576271,
"line_max": 91,
"alpha_frac": 0.2868937049,
"autogenerated": false,
"ratio": 4.8089330024813... |
#!/bin/env/python
infileList = ["proc_input.chr17.vcf"]
GBR = []
FIN = []
CHS = []
PUR = []
CLM = []
IBS = []
CEU = []
YRI = []
CHB = []
JPT = []
LWK = []
ASW = []
MXL = []
TSI = []
gbr = []
fin = []
chs = []
pur = []
clm = []
ibs = []
ceu = []
yri = []
chb = []
jpt = []
lwk = []
asw = []
mxl = []
tsi = []
head = op... | {
"repo_name": "CORDEA/analysis_of_1000genomes-data",
"path": "programs/OLD/sampleToinfo.py",
"copies": "1",
"size": "2706",
"license": "apache-2.0",
"hash": -417709426960908000,
"line_mean": 20.8225806452,
"line_max": 84,
"alpha_frac": 0.3983739837,
"autogenerated": false,
"ratio": 2.836477987421... |
#!/bin/env python
# Initalize the indicated serial port and continuously read the temperatures
# and graph them in a window. Show the discovered sensors and allow the user
# to select the color associated with it.
# Also allow them to control the refresh rate.
""" DigiTemp PyGTK Graph display """
import string, os,... | {
"repo_name": "jens-maus/cuxd",
"path": "src/digitemp/python/gui/dttest.py",
"copies": "1",
"size": "1053",
"license": "bsd-3-clause",
"hash": 1179711423261186800,
"line_mean": 24.7073170732,
"line_max": 76,
"alpha_frac": 0.6191832858,
"autogenerated": false,
"ratio": 3.3858520900321545,
"confi... |
#!/bin/env python
"""
JSON Dripper
Connects to HOST and downloads all folders from JSON_DIRS
at the speed defined by MAX_BANDWIDTH.
The prefix acs_ is added to the local destination folder.
It checks that the remote dir is a number (000, 001...).
Requites ssh pub key added to remote host.
"""
import logging
import pa... | {
"repo_name": "eddebc/Cyberbit",
"path": "dripper.py",
"copies": "1",
"size": "3133",
"license": "mit",
"hash": -5056944915051487000,
"line_mean": 28.0092592593,
"line_max": 86,
"alpha_frac": 0.6230450048,
"autogenerated": false,
"ratio": 3.308342133051742,
"config_test": false,
"has_no_keywo... |
#!/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache Lice... | {
"repo_name": "lym/allura-git",
"path": "scripts/perf/benchmark-scm.py",
"copies": "3",
"size": "5601",
"license": "apache-2.0",
"hash": 5123681258308686000,
"line_mean": 34.9038461538,
"line_max": 89,
"alpha_frac": 0.6009641136,
"autogenerated": false,
"ratio": 3.611218568665377,
"config_test"... |
#!/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License... | {
"repo_name": "thammegowda/incubator-joshua",
"path": "scripts/lm/compile_berkeley.py",
"copies": "4",
"size": "1457",
"license": "apache-2.0",
"hash": 8837828997399229000,
"line_mean": 44.53125,
"line_max": 190,
"alpha_frac": 0.7611530542,
"autogenerated": false,
"ratio": 3.6064356435643563,
"... |
#!/bin/env python
#
# 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, software
# ... | {
"repo_name": "wfarner/aurora",
"path": "src/main/python/apache/aurora/tools/java/organize_imports.py",
"copies": "11",
"size": "4397",
"license": "apache-2.0",
"hash": -8365651369729200000,
"line_mean": 28.7094594595,
"line_max": 80,
"alpha_frac": 0.6606777348,
"autogenerated": false,
"ratio": 3... |
#!/bin/env python
""" list of uitility functions waiting to be copied """
import os
def mkdir(path):
""" create directory if not exists """
if not os.path.isdir(path):
os.makedirs(path)
def touch(path, content=''):
""" create new file like a boss """
dirname = os.path.dirname(path)
mkdir(dirname)
with open(... | {
"repo_name": "NearHuscarl/dotfiles",
"path": "script/python/lib.py",
"copies": "1",
"size": "2523",
"license": "bsd-3-clause",
"hash": -8277147435049847000,
"line_mean": 20.9391304348,
"line_max": 92,
"alpha_frac": 0.6769718589,
"autogenerated": false,
"ratio": 3.0544794188861983,
"config_test... |
#!/bin/env python
# Load 3-lead ECG recordings from SHAREE Database:
# https://physionet.org/content/shareedb/1.0.0/
from __future__ import division, print_function
import matplotlib.pyplot as plt
import numpy as np
import os
from . import paths
from . import files
from joblib import Memory
_memory = Memory('.', v... | {
"repo_name": "dblalock/bolt",
"path": "experiments/python/datasets/incart.py",
"copies": "1",
"size": "2301",
"license": "mpl-2.0",
"hash": -8420534221705843000,
"line_mean": 25.7558139535,
"line_max": 73,
"alpha_frac": 0.6079965233,
"autogenerated": false,
"ratio": 3.191400832177531,
"config_... |
#!/bin/env python
# mainly for sys.argv[], sys.argv[0] is the name of the program
import sys
# mainly for arrays
import numpy as np
def bsearchrec(alist, item, imin, imax):
if imin > imax:
return
else:
imid = imin + ((imax - imin) / 2)
if alist[imid] > item:
return bsearch... | {
"repo_name": "ketancmaheshwari/hello-goog",
"path": "src/python/binarysearch.py",
"copies": "1",
"size": "1063",
"license": "apache-2.0",
"hash": 5735580447155363000,
"line_mean": 22.6222222222,
"line_max": 63,
"alpha_frac": 0.5126999059,
"autogenerated": false,
"ratio": 3.126470588235294,
"co... |
#!/bin/env python
"""
Make appropriate INCAR and KPOINTS files for VASP calculation
from POSCAR and POTCAR files. Number of division in each k-space direction
must be set, otherwise default NORMAL accuracy setting will be chosen.
Usage:
prepare.py [options] POSCAR
Options:
-h, --help Show this help message and e... | {
"repo_name": "ryokbys/nap",
"path": "nappy/vasp/prepare.py",
"copies": "1",
"size": "14528",
"license": "mit",
"hash": -3700475934804141000,
"line_mean": 34.2621359223,
"line_max": 153,
"alpha_frac": 0.5507984581,
"autogenerated": false,
"ratio": 2.9936121986400166,
"config_test": false,
"ha... |
#! /bin/env python
#
# Michael Gibson 17 July 2015
import sys, struct, math, os, time
import numpy as np
from intanutil.read_header import read_header
from intanutil.get_bytes_per_data_block import get_bytes_per_data_block
from intanutil.read_one_data_block import read_one_data_block
from intanutil.notch_filter impor... | {
"repo_name": "britodasilva/pyhfo",
"path": "pyhfo/io/load_intan_rhd_format.py",
"copies": "1",
"size": "9056",
"license": "mit",
"hash": 1268039355551712000,
"line_mean": 45.9222797927,
"line_max": 165,
"alpha_frac": 0.6199204947,
"autogenerated": false,
"ratio": 3.5019334880123743,
"config_te... |
#! /bin/env python
#
# Michael Gibson 23 April 2015
import sys, struct
from intanutil.qstring import read_qstring
def read_header(fid):
"""Reads the Intan File Format header from the given file."""
# Check 'magic number' at beginning of file to make sure this is an Intan
# Technologies RHD2000 data file.... | {
"repo_name": "britodasilva/pyhfo",
"path": "pyhfo/io/read_header.py",
"copies": "3",
"size": "6235",
"license": "mit",
"hash": 2181421450263586800,
"line_mean": 47.3333333333,
"line_max": 236,
"alpha_frac": 0.6224538893,
"autogenerated": false,
"ratio": 3.652606912712361,
"config_test": false,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.