text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'sulantha'
class SortingObject:
def __init__(self, values):
self.record_id = 0 if 'record_id' not in values else values['record_id']
self.study = values['study']
self.rid = values['rid']
self.scan_type = values['scan_type']
self.scan_date = values['scan_date']
... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Manager/SQLTables/SortingObject.py",
"copies": "1",
"size": "1567",
"license": "apache-2.0",
"hash": 6138671634081119000,
"line_mean": 43.8,
"line_max": 104,
"alpha_frac": 0.5386088066,
"autogenerated": false,
"ratio": 3.577625570776256,
... |
__author__ = 'sulantha'
class SQLBuilder:
def __init__(self):
pass
def getSQL_AddNewEntryToSortingTable(self, values):
return "INSERT IGNORE INTO Sorting VALUES ({0}) ".format(values)
def getSQL_getUnmovedFilesFromSortingTable(self, studyID, allowedScanTypes):
return "SELECT * FRO... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Manager/SQL/SQLBuilder.py",
"copies": "1",
"size": "4652",
"license": "apache-2.0",
"hash": 3869562582940668400,
"line_mean": 72.8412698413,
"line_max": 138,
"alpha_frac": 0.4765692175,
"autogenerated": false,
"ratio": 4.88655462184874,
... |
__author__ = 'Sulantha'
figOutputPath = 'FIGOutput/RFC/'
all_list = ['Age_bl', 'PTGENDER', 'APOE_bin', 'PTAU181P_bl', 'PTAU_Pos', 'ABETA142', 'ABETA142_Pos',
'PTAU_AB142_Ratio', 'Total_TAU', 'TTAU_AB142_Ratio', 'PTAU_TTAU_Ratio', 'AV45_bl_Global_SUVR_NEW', 'FDG_bl_Global_SUVR_NEW', 'AV45_region1', 'AV... | {
"repo_name": "sulantha2006/Conversion",
"path": "Python/RUSRandomForest/Config.py",
"copies": "1",
"size": "2311",
"license": "mit",
"hash": 1572367405002663000,
"line_mean": 54.0238095238,
"line_max": 172,
"alpha_frac": 0.4997836434,
"autogenerated": false,
"ratio": 2.870807453416149,
"config... |
__author__ = 'sulantha'
from Utils.DbUtils import DbUtils
import Config.PipelineConfig as pc
from Pipelines.ADNI_T1.ADNI_T1_Helper import ADNI_T1_Helper
from Utils.PipelineLogger import PipelineLogger
import distutils.dir_util
import distutils.file_util
import shutil
import subprocess
from Manager.QSubJob import QSubJ... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Pipelines/ADNI_AV1451/ADNI_V1_AV1451.py",
"copies": "1",
"size": "7573",
"license": "apache-2.0",
"hash": 5284871693449291000,
"line_mean": 57.2538461538,
"line_max": 279,
"alpha_frac": 0.6154760333,
"autogenerated": false,
"ratio": 3.897... |
__author__ = 'sulantha'
from Utils.DbUtils import DbUtils
import Config.PipelineConfig as pc
from Pipelines.DIAN_T1.DIAN_T1_Helper import DIAN_T1_Helper
from Utils.PipelineLogger import PipelineLogger
import distutils.dir_util
import distutils.file_util
import shutil
import subprocess
from Manager.QSubJob import QSubJ... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Pipelines/DIAN_FDG/DIAN_V1_FDG.py",
"copies": "1",
"size": "7729",
"license": "apache-2.0",
"hash": -6028995915650165000,
"line_mean": 57.1127819549,
"line_max": 323,
"alpha_frac": 0.6126277656,
"autogenerated": false,
"ratio": 3.84145129... |
__author__ = 'Sulantha'
from Utils.DbUtils import DbUtils
import glob, os, sys, fileinput
if __name__ == '__main__':
DBClient = DbUtils()
sql1 = "SELECT * FROM Processing WHERE PROCESSED = 1 AND MODALITY ='T1'"
res = DBClient.executeAllResults(sql1)
for result in res:
proc_id = result[0]
... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Utils/fixOldProcNonLinearDisplacementFile.py",
"copies": "1",
"size": "1363",
"license": "apache-2.0",
"hash": -5029327863175526000,
"line_mean": 43,
"line_max": 100,
"alpha_frac": 0.6001467351,
"autogenerated": false,
"ratio": 3.02217294... |
__author__ = 'sulantha'
from Utils.PipelineLogger import PipelineLogger
from Utils.DbUtils import DbUtils
import Config.PipelineConfig as pc
from datetime import datetime
import itertools
class ADNI_T1_Fmri_Helper:
def __init__(self):
self.DBClient = DbUtils()
self.MatchDBClient = DbUtils(database... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Pipelines/ADNI_T1/ADNI_T1_Fmri_Helper.py",
"copies": "1",
"size": "8586",
"license": "apache-2.0",
"hash": 3786508884176854000,
"line_mean": 67.1428571429,
"line_max": 272,
"alpha_frac": 0.6119263918,
"autogenerated": false,
"ratio": 3.52... |
__author__ = 'sulantha'
from Utils.PipelineLogger import PipelineLogger
from Utils.DbUtils import DbUtils
import Config.PipelineConfig as pc
from datetime import datetime
import itertools
class DIAN_T1_Helper:
def __init__(self):
self.DBClient = DbUtils()
self.MatchDBClient = DbUtils(database=pc.D... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Pipelines/DIAN_T1/DIAN_T1_Helper.py",
"copies": "1",
"size": "6987",
"license": "apache-2.0",
"hash": -2187656214522763500,
"line_mean": 60.8318584071,
"line_max": 231,
"alpha_frac": 0.5598969515,
"autogenerated": false,
"ratio": 3.862354... |
__author__ = 'sulantha'
from Utils.PipelineLogger import PipelineLogger
from Utils.DbUtils import DbUtils
import distutils.dir_util
import shutil
import subprocess
from Manager.QSubJob import QSubJob
from Manager.QSubJobHanlder import QSubJobHandler
import socket
import Config.PipelineConfig as pc
import os
import dis... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Pipelines/ADNI_T1/ADNI_V1_T1.py",
"copies": "1",
"size": "12463",
"license": "apache-2.0",
"hash": -7581249483863401000,
"line_mean": 64.5947368421,
"line_max": 219,
"alpha_frac": 0.6047500602,
"autogenerated": false,
"ratio": 4.118638466... |
__author__ = 'sulantha'
import os
import Config.ConverterConfig as cc
from Converters.ConversionScripts.ADNI_V1_T1 import ADNI_V1_T1
from Converters.ConversionScripts.ADNI_V1_PET import ADNI_V1_PET
from Converters.ConversionScripts.ADNI_V1_Fmri import ADNI_V1_Fmri
from Converters.ConversionScripts.DIAN_V1_PET import D... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Converters/Raw2MINCConverter.py",
"copies": "1",
"size": "6717",
"license": "apache-2.0",
"hash": 6745612061640662000,
"line_mean": 50.6692307692,
"line_max": 112,
"alpha_frac": 0.4903974989,
"autogenerated": false,
"ratio": 3.27978515625... |
__author__ = 'sulantha'
maskList = '/home/sulantha/Desktop/ManualMaskMatch.csv'
outputpath = '/data/data03/MANUAL_MASK'
from Utils.DbUtils import DbUtils
import shutil
Dbclient = DbUtils()
with open(maskList, 'r') as inf:
for line in inf:
row = line.split(',')
if row[0].strip() == 'None' or row[1... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Utils/sortManualMask.py",
"copies": "1",
"size": "1313",
"license": "apache-2.0",
"hash": -5607046441414013000,
"line_mean": 38.7878787879,
"line_max": 215,
"alpha_frac": 0.5369383092,
"autogenerated": false,
"ratio": 3.1946472019464722,
... |
__author__ = 'sulantha'
xfmList = '/home/sulantha/Desktop/petMatchNew2.csv'
outputpath = '/data/data03/MANUAL_XFM'
from Utils.DbUtils import DbUtils
import shutil
Dbclient = DbUtils()
with open(xfmList, 'r') as inf:
for line in inf:
row = line.split(',')
if row[0].strip() == 'None' or row[2].strip... | {
"repo_name": "sulantha2006/Processing_Pipeline",
"path": "Utils/sortManualXFMs.py",
"copies": "1",
"size": "1376",
"license": "apache-2.0",
"hash": 518300887987250940,
"line_mean": 40.696969697,
"line_max": 141,
"alpha_frac": 0.4927325581,
"autogenerated": false,
"ratio": 3.1559633027522938,
"... |
__author__ = 'Sumanth Srinivasan'
from lxml import html
import requests
from titlecase import titlecase
import fileinput
textFile = open("text.txt", "a")
page = requests.get('http://www.billboard.com/charts/year-end/2015/hot-100-songs')
tree = html.fromstring(page.content)
title = tree.xpath('//h2[@class="chart-ro... | {
"repo_name": "r0nind/fusepop",
"path": "lyrics.py",
"copies": "1",
"size": "2488",
"license": "apache-2.0",
"hash": 1102200193597661700,
"line_mean": 26.0543478261,
"line_max": 82,
"alpha_frac": 0.6036977492,
"autogenerated": false,
"ratio": 2.9760765550239237,
"config_test": false,
"has_no_... |
__author__ = 'sumant'
import argparse
import logging
import os
import requests
import time
import urllib
def main(args):
directory = args.dest_dir
if not os.path.exists(directory):
os.makedirs(directory)
headers = {'User-Agent':
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) ... | {
"repo_name": "sumant85/code",
"path": "python/scrape_coursera.py",
"copies": "1",
"size": "2261",
"license": "mit",
"hash": -1185359370311038000,
"line_mean": 39.375,
"line_max": 113,
"alpha_frac": 0.6187527643,
"autogenerated": false,
"ratio": 3.3898050974512746,
"config_test": false,
"has_... |
__author__ = 'sumeetrohatgi'
from rest_framework import serializers
from hunts.models import Hunt, Business, Comment, Follow
class HuntSerializer(serializers.ModelSerializer):
class Meta:
model = Hunt
fields = ('huntId', 'businessId', 'category', 'description',
'price', 'currenc... | {
"repo_name": "srohatgi/cloud",
"path": "huntnet/hunts/serializers.py",
"copies": "1",
"size": "1206",
"license": "apache-2.0",
"hash": 8523979766769780000,
"line_mean": 33.4571428571,
"line_max": 73,
"alpha_frac": 0.6011608624,
"autogenerated": false,
"ratio": 4.144329896907217,
"config_test":... |
__author__ = 'Sumit.S'
import re
import optparse
import sqlite3
import sys
import os
def read_file(filepath):
open_file = open(filepath, "rb")
return "".join("{:02x}".format(int(ord(c))) for c in open_file.read(50))
def file_size(filepath):
try:
size = float(os.path.getsize(filepath))
ret... | {
"repo_name": "c0d3sh3lf/File-Signature-Analyzer",
"path": "file_analyzer.py",
"copies": "1",
"size": "3684",
"license": "mit",
"hash": 7078863472597270000,
"line_mean": 33.4392523364,
"line_max": 202,
"alpha_frac": 0.4581976113,
"autogenerated": false,
"ratio": 3.8738170347003154,
"config_test... |
import argparse
import pickle
import os
import types
import requests
import json
from importlib.machinery import SourceFileLoader
import unittest
TOKEN_PICKLE_FILE_NAME = "access_token"
HOST = "theteamlab.io"
ASSIGNMENT_NAME = "alloy_problem.py"
def getArgumentsParser(argv=None):
parser = argparse.ArgumentParse... | {
"repo_name": "TeamLab/Gachon_CS50_OR_KMOOC",
"path": "gurobi_quiz/alloy_problem/submit.py",
"copies": "1",
"size": "8548",
"license": "mit",
"hash": 6754446697196088000,
"line_mean": 34.6050420168,
"line_max": 142,
"alpha_frac": 0.6364172764,
"autogenerated": false,
"ratio": 3.6636402939904884,
... |
__author__ = "Sunil Kumar (kumar.sunil.p@gmail.com)"
__copyright__ = "Copyright 2014, Washington University in St. Louis"
__credits__ = ["Sunil Kumar", "Steve Pieper", "Dan Marcus"]
__license__ = "XNAT Software License Agreement " + \
"(see: http://xnat.org/about/license.php)"
__version__ = "2.1.1"
__main... | {
"repo_name": "MokaCreativeLLC/XNATSlicer",
"path": "XNATSlicer/XnatSlicerLib/ui/FolderMaker.py",
"copies": "1",
"size": "18465",
"license": "bsd-3-clause",
"hash": 5001207382556107000,
"line_mean": 31.1130434783,
"line_max": 80,
"alpha_frac": 0.5510966694,
"autogenerated": false,
"ratio": 4.2234... |
__author__ = "Sunil Kumar (kumar.sunil.p@gmail.com)"
__copyright__ = "Copyright 2014, Washington University in St. Louis"
__credits__ = ["Sunil Kumar", "Tim Olsen", "Dan Marcus", "Rick Herrick"]
__license__ = "XNAT Software License Agreement " + \
"(see: http://xnat.org/about/license.php)"
__version__ = "... | {
"repo_name": "MokaCreativeLLC/XNATSlicer",
"path": "XNATSlicer/XnatSlicerLib/ext/Xnat/Xnat.py",
"copies": "1",
"size": "47589",
"license": "bsd-3-clause",
"hash": -7894638645820610000,
"line_mean": 31.3514615908,
"line_max": 88,
"alpha_frac": 0.4670827292,
"autogenerated": false,
"ratio": 4.9535... |
__author__ = "Sunil"
__copyright__ = "Copyright 2016"
__license__ = "MIT License"
__version__ = "0.1.0"
__email__ = "suba5417@colorado.edu"
from pyspark.sql import SQLContext
from pyspark.ml.feature import IndexToString
from pyspark.mllib.linalg import Vectors
from pyspark.ml.feature import StringIndexer
from pyspark... | {
"repo_name": "Sunhick/music-cognita",
"path": "src/genreClassifier.py",
"copies": "1",
"size": "2158",
"license": "mit",
"hash": -2218785437537986600,
"line_mean": 35.593220339,
"line_max": 145,
"alpha_frac": 0.7201112141,
"autogenerated": false,
"ratio": 3.069701280227596,
"config_test": fals... |
#the musical notes
notes = ["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"]
#the tuning of the guitar
tuning = ['E','A','D','G','B','E']
#the octaves of the notes corresponding to the tuning
octaves = [1,1,2,2,2,3]
#tuning and octaves set to be reversed - tabs viewed bottom to top
tuning = tuning[::-1]
octaves =... | {
"repo_name": "sunilnayak133/pytabber",
"path": "tabber.py",
"copies": "1",
"size": "5634",
"license": "mit",
"hash": 1129153265650315300,
"line_mean": 25.7014218009,
"line_max": 126,
"alpha_frac": 0.6771388001,
"autogenerated": false,
"ratio": 2.728329297820823,
"config_test": false,
"has_no... |
__author__ = 'Sunjoong LEE <sunjoong@gmail.com>'
__date__ = '2006-06-20'
__version__ = '1.0.0'
from new import function as mkfunction
def extractFunction(func, name = None):
"""Extract a nested function and make a new one.
Example1>> def func(arg1, arg2):
def sub_func(x, y):
... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/496806_Extract_inner_functiclass_or/recipe-496806.py",
"copies": "1",
"size": "1541",
"license": "mit",
"hash": 9198403865788852000,
"line_mean": 27.537037037,
"line_max": 70,
"alpha_frac": 0.4853990915,
"autogenerated": false,
"ratio": 3.... |
__author__ = 'sunnyday'
import simplejson
import logging
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError
from http import Http
logger = logging.getLogger(__name__)
class VirusTotalClient(object):
URL = "https://www.virustotal.com/vtapi/v2/url"
API_KEY = "a61... | {
"repo_name": "synnyday/test_ss",
"path": "test_ss/virustotal_client.py",
"copies": "1",
"size": "1388",
"license": "unlicense",
"hash": -4042491812025319400,
"line_mean": 32.0714285714,
"line_max": 80,
"alpha_frac": 0.636167147,
"autogenerated": false,
"ratio": 3.505050505050505,
"config_test"... |
__author__ = 'sunshangchun'
import commands
def exec_shell(cmd):
output = commands.getstatusoutput(cmd)
return (output[0], output[1].split("\n"))
def get_partition(line):
output = line.strip(" ").split(" ")
path_info = output[-1].rsplit("/", 2)
return path_info
def dfs_ls(path):
cmd = "hado... | {
"repo_name": "joyyoj/blog",
"path": "scripts/py/utils.py",
"copies": "1",
"size": "2162",
"license": "bsd-3-clause",
"hash": 409763937715899300,
"line_mean": 32.2615384615,
"line_max": 127,
"alpha_frac": 0.5476410731,
"autogenerated": false,
"ratio": 3.0195530726256985,
"config_test": false,
... |
__author__ = 'sunshine'
import os
import sys
import time
import subprocess
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
def log(s):
print('[Monitor] %s' % s)
class MyFileSystemEventHander(FileSystemEventHandler):
def __init__(self, fn):
super(MyFileSys... | {
"repo_name": "myangeline/awesome",
"path": "www/pymonitor.py",
"copies": "1",
"size": "1733",
"license": "apache-2.0",
"hash": 6855652501584178000,
"line_mean": 22.12,
"line_max": 94,
"alpha_frac": 0.6197345643,
"autogenerated": false,
"ratio": 3.718884120171674,
"config_test": false,
"has_n... |
__author__ = 'sunshine'
class Page(object):
"""
Page object for display pages.
"""
def __init__(self, item_count, page_index=1, page_size=10):
"""
Init Pagination by item_count, page_index and page_size.
>>> p1 = Page(100, 1)
>>> p1.page_count
10
>>> p1... | {
"repo_name": "myangeline/awesome",
"path": "www/apis.py",
"copies": "1",
"size": "2578",
"license": "apache-2.0",
"hash": 6193014113411285000,
"line_mean": 27.3406593407,
"line_max": 105,
"alpha_frac": 0.5515903801,
"autogenerated": false,
"ratio": 3.704022988505747,
"config_test": false,
"h... |
__author__ = 'sunwj'
"Get the different ones from two list"
def gen_diff(type,seta,setb):
setab = seta - setb
tmps = ''
for s in setab:
tmps+=s
#tmps+="\n"
#print "a-b"+tmps
fab = open('/home/sunwj/'+type+'-fab.txt','w')
fab.writelines(tmps)
fab.close()
setba = s... | {
"repo_name": "swenker/studio",
"path": "python/sysops/get_list_difference_3m.py",
"copies": "1",
"size": "1090",
"license": "apache-2.0",
"hash": 3932218497496994300,
"line_mean": 14.1388888889,
"line_max": 50,
"alpha_frac": 0.5623853211,
"autogenerated": false,
"ratio": 2.5829383886255926,
"c... |
__author__ = 'sunwj'
import MySQLdb as mdb
import datetime
dbuser='mscc_reader'
dbpasswd='R1e2a3d4er!'
dbname='sunwj_test'
dbhost='db.qasvc.mscc.cn'
dbcon = None
print datetime.datetime.now()
try:
dbcon=mdb.connect(dbhost,dbuser,dbpasswd,dbname)
dbcur=dbcon.cursor()
#dbcur.execute("SELECT VERSION()")... | {
"repo_name": "swenker/studio",
"path": "python/sysops/3m_mau_statistics.py",
"copies": "1",
"size": "1529",
"license": "apache-2.0",
"hash": 3700989835794211300,
"line_mean": 21.5,
"line_max": 170,
"alpha_frac": 0.6062786135,
"autogenerated": false,
"ratio": 2.9805068226120857,
"config_test": ... |
__author__ = 'sunwj'
class LogParser():
def parse_raw_log(self,log_file_path):
"parse log to extract uid,itemid, magazineid "
print "hello"
outfile=file("uid_mid_weight.txt","w")
ummap={}
try:
with open(log_file_path) as f:
for line in f:
... | {
"repo_name": "swenker/studio",
"path": "python/datamining/log_handler.py",
"copies": "1",
"size": "1700",
"license": "apache-2.0",
"hash": -2554375296887610400,
"line_mean": 27.3333333333,
"line_max": 128,
"alpha_frac": 0.3823529412,
"autogenerated": false,
"ratio": 4.5092838196286475,
"config... |
__author__ = 'sunwj'
import httplib
import urllib
import hashlib
qasvc_url=''
# qasvc_host='push.qasvc.mscc.cn'
qasvc_host='push.qasvc.mcitech.cn'
HTTP_METHOD="POST"
key="22fe3263315576157435d396c913871"
appId="mci-multimediamagazine"
rawParams={"appId":appId,
"pushType":"2",
"criteria":"que... | {
"repo_name": "swenker/studio",
"path": "python/sysops/cpp_push_test.py",
"copies": "1",
"size": "2390",
"license": "apache-2.0",
"hash": 7055831118067887000,
"line_mean": 29.2658227848,
"line_max": 234,
"alpha_frac": 0.6476987448,
"autogenerated": false,
"ratio": 2.8622754491017965,
"config_te... |
__author__ = 'suparngupta'
import hashlib
from flask import request, g, abort
import rethinkdb as r
import helpers.auth as auth
from app import app
from models.Error import *
@app.route("/session/login/", methods=['POST'])
def login_user():
body = request.get_json()
print(body)
if "username" not in bod... | {
"repo_name": "suparngp/letswikit",
"path": "ui/controllers/session.py",
"copies": "1",
"size": "2826",
"license": "apache-2.0",
"hash": 6741824301179808000,
"line_mean": 31.4827586207,
"line_max": 108,
"alpha_frac": 0.5980184006,
"autogenerated": false,
"ratio": 3.595419847328244,
"config_test... |
__author__ = 'surchs'
import sys
import numpy as np
from matplotlib import gridspec
from nilearn import plotting as nlp
from matplotlib import pyplot as plt
from matplotlib import colors as mpc
def add_subplot_axes(ax, rect, axisbg='w'):
fig = plt.gcf()
box = ax.get_position()
width = box.width
height... | {
"repo_name": "surchs/brainbox",
"path": "visu/base.py",
"copies": "1",
"size": "8414",
"license": "mit",
"hash": -8054908546902702000,
"line_mean": 31.9960784314,
"line_max": 79,
"alpha_frac": 0.5444497266,
"autogenerated": false,
"ratio": 3.3152088258471237,
"config_test": false,
"has_no_ke... |
__author__ = 'surchs'
import sys
import time
import numpy as np
class Counter(object):
"""
Counter Class
"""
def __init__(self, total=None):
self.count = 0
self.total = total
self.start = time.time()
self.times = np.array([0])
self.avg = 0
self.took = 0... | {
"repo_name": "surchs/brainbox",
"path": "tools/base.py",
"copies": "1",
"size": "2884",
"license": "mit",
"hash": -304082438070315600,
"line_mean": 33.3333333333,
"line_max": 81,
"alpha_frac": 0.4431345354,
"autogenerated": false,
"ratio": 4.33033033033033,
"config_test": false,
"has_no_keyw... |
__author__ = 'sureshbvn'
from nltk.model import NgramModel
import nltk
from nltk.corpus import brown
from nltk.probability import LidstoneProbDist, WittenBellProbDist
from nltk.corpus import brown
from nltk import MLEProbDist
from nltk.probability import LidstoneProbDist, WittenBellProbDist
estimator = lambda fdist, b... | {
"repo_name": "sureshbvn/nlpProject",
"path": "nGramModel/nlt.py",
"copies": "1",
"size": "1047",
"license": "mit",
"hash": -9075462989496761000,
"line_mean": 25.8461538462,
"line_max": 118,
"alpha_frac": 0.7344794651,
"autogenerated": false,
"ratio": 3.2018348623853212,
"config_test": false,
... |
__author__ = 'sureshbvn'
import nltk
from nltk.util import ngrams
from nltk.probability import ConditionalProbDist
class Parsing:
def __init__(self, fileName, nValue):
self.file_to_be_parsed = fileName
self.outpufile = "output.txt"
self.outpufile_modified="ouput_modified.txt"
se... | {
"repo_name": "sureshbvn/nlpProject",
"path": "nGramModel/Parsing.py",
"copies": "1",
"size": "2873",
"license": "mit",
"hash": 48332021039693976,
"line_mean": 25.1181818182,
"line_max": 146,
"alpha_frac": 0.5241907414,
"autogenerated": false,
"ratio": 3.851206434316354,
"config_test": false,
... |
__author__ = "Suresh Sundriyal"
__version__ = "0.0.1"
__license__ = "BSD 2-clause"
import math
# Fixup for Python3
try:
xrange
except:
xrange = range
_64_1 = int('1'*64, 2)
def _hashlist(hash, hash_count):
# Takes a 128-bit hash and creates 'num' number of hashes.
hash = int(hash, 16)
l = hash >... | {
"repo_name": "sureshsundriyal/bloomfilter-python",
"path": "bloomfilter.py",
"copies": "1",
"size": "1630",
"license": "bsd-2-clause",
"hash": -9133719618406613000,
"line_mean": 25.7213114754,
"line_max": 72,
"alpha_frac": 0.5147239264,
"autogenerated": false,
"ratio": 3.2213438735177866,
"con... |
__author__ = 'surge'
from flask import Flask, render_template, redirect, abort, make_response
#from flask_script import Manager
from flask_bootstrap import Bootstrap
app = Flask(__name__)
#manager = Manager(app)
bootstrap = Bootstrap(app)
@app.route('/')
def index():
return render_template('index.html')
@app.rou... | {
"repo_name": "WSCoders/whatsgoodhere",
"path": "web/app.py",
"copies": "1",
"size": "1164",
"license": "apache-2.0",
"hash": 9132917706132049000,
"line_mean": 22.3,
"line_max": 72,
"alpha_frac": 0.676975945,
"autogenerated": false,
"ratio": 3.3448275862068964,
"config_test": false,
"has_no_k... |
__author__ = 'Sushant'
class ClusterIndices(object):
@staticmethod
def calculate_EI_index(graph, cluster_nodes, standardize=True):
all_edges = graph.get_edges()
external_connections_strength = 0.0
internal_connections_strength = 0.0
internal_nodes = len(cluster_nodes)
e... | {
"repo_name": "sushanttripathy/graphene",
"path": "graphene/clusterindices.py",
"copies": "1",
"size": "1343",
"license": "mit",
"hash": -5715360479933781000,
"line_mean": 43.8,
"line_max": 146,
"alpha_frac": 0.6046165302,
"autogenerated": false,
"ratio": 4.647058823529412,
"config_test": false... |
__author__ = 'Sushant'
from autovivification import AutoVivification
from collections import namedtuple
NodeDescriptor = namedtuple("NodeDescriptor", "id label")
GraphEdge = namedtuple("GraphEdge", "source target strength")
class Graph(object):
def __init__(self):
self.nodes = {}
self.edges = A... | {
"repo_name": "sushanttripathy/graphene",
"path": "graphene/graph.py",
"copies": "1",
"size": "2738",
"license": "mit",
"hash": -3796470357898015000,
"line_mean": 27.2268041237,
"line_max": 101,
"alpha_frac": 0.5160701242,
"autogenerated": false,
"ratio": 3.7922437673130194,
"config_test": fals... |
__author__ = 'Sushant'
from graph import Graph
from graph import AutoVivification
class FloydWarshall(Graph):
def __init__(self):
super(FloydWarshall, self).__init__()
self.minimum_distances = AutoVivification()
return
def calculate_all_shortest_paths(self):
for m in self.nod... | {
"repo_name": "sushanttripathy/graphene",
"path": "graphene/floydwarshall.py",
"copies": "1",
"size": "1624",
"license": "mit",
"hash": -5065767674535720000,
"line_mean": 29.641509434,
"line_max": 114,
"alpha_frac": 0.5745073892,
"autogenerated": false,
"ratio": 3.3347022587268995,
"config_test... |
__author__ = 'sushant'
from . import customjson
import requests
import logging, time
from pyappacitive import AppacitiveError
logger = logging.getLogger('pyappacitive')
logger.addHandler(logging.NullHandler())
def put(url, headers, payload):
start_time = time.time()
response_from_api = requests.put(url, p... | {
"repo_name": "appacitive/pyappacitive",
"path": "pyappacitive/utilities/http.py",
"copies": "1",
"size": "3165",
"license": "mit",
"hash": -6453334791397536000,
"line_mean": 27.7727272727,
"line_max": 71,
"alpha_frac": 0.595892575,
"autogenerated": false,
"ratio": 3.822463768115942,
"config_te... |
__author__ = 'sushil, abdullahS'
import zmq
import logging
import os
import time
import psutil
import json
from hydra.lib import util
from hydra.lib.hdaemon import HDaemonRepSrv
from hydra.lib.childmgr import ChildManager
from pprint import pformat
l = util.createlogger('HSub', logging.INFO)
class HDZmqsRepSrv(HDae... | {
"repo_name": "sushilks/hydra",
"path": "src/main/python/hydra/zmqtest/zmq_sub.py",
"copies": "4",
"size": "5975",
"license": "apache-2.0",
"hash": -5667164788989641000,
"line_mean": 38.0522875817,
"line_max": 108,
"alpha_frac": 0.5630125523,
"autogenerated": false,
"ratio": 3.360517435320585,
... |
__author__ = 'sushil'
from marathon import MarathonClient
from pprint import pprint, pformat # NOQA
from hydra.lib import util
import marathon
import requests
import json
import time
import sys
import logging
import re
import traceback
l = util.createlogger('API', logging.INFO)
# l.setLevel(logging.DEBUG)
class M... | {
"repo_name": "sushilks/hydra",
"path": "src/main/python/hydra/lib/mmapi.py",
"copies": "4",
"size": "8913",
"license": "apache-2.0",
"hash": -7800960922946918000,
"line_mean": 34.939516129,
"line_max": 117,
"alpha_frac": 0.5439246045,
"autogenerated": false,
"ratio": 3.632029339853301,
"config... |
__author__ = 'sushil'
from pprint import pprint, pformat # NOQA
import logging
import os
import sys
from datetime import datetime
from hydra.lib import util
from hydra.zmqtest.runtest import RunTestZMQ
from hydra.lib.boundary import Scanner
from optparse import OptionParser
l = util.createlogger('runSuitMaxRate', lo... | {
"repo_name": "sushilks/hydra",
"path": "src/main/python/hydra/zmqtest/maxrate_test.py",
"copies": "4",
"size": "7976",
"license": "apache-2.0",
"hash": 7812629064742485000,
"line_mean": 51.1307189542,
"line_max": 111,
"alpha_frac": 0.5833751254,
"autogenerated": false,
"ratio": 3.697728326379230... |
__author__ = 'sushil'
from threading import Thread
import os
import sys
import requests
try:
# Python 2.x
from SocketServer import ThreadingMixIn
from SimpleHTTPServer import SimpleHTTPRequestHandler
from BaseHTTPServer import HTTPServer
except ImportError:
# Python 3.x
from socketserver impor... | {
"repo_name": "tahir24434/hydra",
"path": "src/main/python/hydra/lib/appserver.py",
"copies": "4",
"size": "1500",
"license": "apache-2.0",
"hash": 3157184563639959600,
"line_mean": 27.8461538462,
"line_max": 97,
"alpha_frac": 0.66,
"autogenerated": false,
"ratio": 4.437869822485207,
"config_te... |
__author__ = 'sushil'
import subprocess
import signal
import sys
import time
import atexit
import psutil
import logging
from hydra.lib import util
l = util.createlogger('cmgr', logging.INFO)
class ChildManager(object):
def __init__(self, sighandler=True):
if sighandler:
signal.signal(signal.... | {
"repo_name": "sushilks/hydra",
"path": "src/main/python/hydra/lib/childmgr.py",
"copies": "4",
"size": "3211",
"license": "apache-2.0",
"hash": 8781558812525563000,
"line_mean": 32.1030927835,
"line_max": 89,
"alpha_frac": 0.4933042666,
"autogenerated": false,
"ratio": 4.292780748663102,
"conf... |
__author__ = 'sushil'
import zmq
import random
import time
import threading
import sys
import os
# REQ -> REP
# PUB -> SUB
class Test(object):
def __init__(self, argv):
p0 = os.environ.get('PORT0')
print("REQ PORT0 = " + p0)
self.port_rep = p0
self.port_pub = argv[1]
self.... | {
"repo_name": "tahir24434/hydra",
"path": "src/main/python/hydra/selftest/agents.py",
"copies": "4",
"size": "4173",
"license": "apache-2.0",
"hash": -3955799438844457500,
"line_mean": 33.2049180328,
"line_max": 105,
"alpha_frac": 0.5109034268,
"autogenerated": false,
"ratio": 3.6223958333333335,... |
__author__ = 'SusnikT12'
import time
class Igra():
def __init__(self, vmesnik):
self.vodoravne = [[False for i in range(7)] for j in range(8)]
self.navpicne = [[False for i in range(8)] for j in range(7)]
self.matrika_kvadratov = [[0 for i in range(7)]for j in range(7)]
self.vmesni... | {
"repo_name": "KorosecN13/Pikice-in-skatle",
"path": "igra.py",
"copies": "2",
"size": "11047",
"license": "mit",
"hash": -2816350070280751000,
"line_mean": 43.188,
"line_max": 150,
"alpha_frac": 0.5279261338,
"autogenerated": false,
"ratio": 2.7576135796305543,
"config_test": false,
"has_no_... |
__author__ = 'SusnikT12'
import threading
import time
import random
class Clovek():
def __init__(self, vmesnik, ime, stevec, barva):
self.ime = ime
self.stevec = stevec
self.barva = barva
self.vmesnik = vmesnik
self.igra = None
def igraj(self):
""" caka, da ig... | {
"repo_name": "KorosecN13/Pikice-in-katle",
"path": "igralci.py",
"copies": "2",
"size": "32856",
"license": "mit",
"hash": -8509757026898091000,
"line_mean": 47.6681481481,
"line_max": 184,
"alpha_frac": 0.5166357189,
"autogenerated": false,
"ratio": 2.8241918844566714,
"config_test": false,
... |
# Standard library imports.
import unittest
import numpy
# Local imports.
from .common import get_example_data
# Enthought library imports
from mayavi.sources.image_reader import ImageReader
from mayavi.tests.data_reader_test_base import DataReaderTestBase
class TestDEMImageReader(DataReaderTestBase):
def setu... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/tests/test_image_data_reader.py",
"copies": "1",
"size": "3594",
"license": "bsd-3-clause",
"hash": -5858304562105263000,
"line_mean": 32.9056603774,
"line_max": 83,
"alpha_frac": 0.6051752922,
"autogenerated": false,
"ratio": 3.66734693877551,
"c... |
# Standard library imports.
import unittest
# Local imports.
from common import get_example_data
# Enthought library imports
from tvtk.common import is_old_pipeline
from mayavi.sources.unstructured_grid_reader import UnstructuredGridReader
from mayavi.tests.data_reader_test_base import DataReaderTestBase
old_pipeli... | {
"repo_name": "liulion/mayavi",
"path": "mayavi/tests/test_unstructured_data_reader.py",
"copies": "2",
"size": "4891",
"license": "bsd-3-clause",
"hash": -5948567537373111000,
"line_mean": 33.6879432624,
"line_max": 76,
"alpha_frac": 0.6231854426,
"autogenerated": false,
"ratio": 3.6283382789317... |
# Standard library imports.
import unittest
from numpy import random, allclose, arange
# Local imports.
from mayavi.core.null_engine import NullEngine
# Enthought library imports
from mayavi.sources.vtk_data_source import VTKDataSource
from mayavi.modules.grid_plane import GridPlane
from mayavi.modules.axes import A... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/tests/test_extract_grid_filter.py",
"copies": "3",
"size": "6908",
"license": "bsd-3-clause",
"hash": -3642221798760110000,
"line_mean": 34.2448979592,
"line_max": 75,
"alpha_frac": 0.5444412276,
"autogenerated": false,
"ratio": 3.2989493791786058,
... |
# Standard library imports.
from os.path import abspath
from io import BytesIO
import copy
import numpy
import unittest
# Local imports.
from mayavi.core.null_engine import NullEngine
from mayavi.sources.vtk_data_source import VTKDataSource
from mayavi.modules.outline import Outline
from mayavi.modules.iso_surface i... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/tests/test_contour.py",
"copies": "1",
"size": "6044",
"license": "bsd-3-clause",
"hash": 4760004808907895000,
"line_mean": 29.9948717949,
"line_max": 122,
"alpha_frac": 0.6012574454,
"autogenerated": false,
"ratio": 3.67639902676399,
"config_test... |
# Standard library imports.
from os.path import abspath
from io import BytesIO
import copy
import unittest
from . import datasets
# Local imports.
from mayavi.core.engine import Engine
from mayavi.core.null_engine import NullEngine
# Enthought library imports
from mayavi.sources.vtk_data_source import VTKDataSource
... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/tests/test_grid_plane.py",
"copies": "1",
"size": "4221",
"license": "bsd-3-clause",
"hash": -2094951777543734300,
"line_mean": 28.5174825175,
"line_max": 122,
"alpha_frac": 0.609334281,
"autogenerated": false,
"ratio": 3.7255075022065314,
"config... |
# Standard library imports.
from os.path import abspath
from io import BytesIO
import numpy
import unittest
from numpy import array
# Enthought library imports.
from tvtk.common import is_old_pipeline
from mayavi.core.null_engine import NullEngine
from mayavi.sources.builtin_image import BuiltinImage
from mayavi.modu... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/tests/test_builtin_image.py",
"copies": "1",
"size": "4187",
"license": "bsd-3-clause",
"hash": -7405986866243597000,
"line_mean": 31.4573643411,
"line_max": 115,
"alpha_frac": 0.6247910198,
"autogenerated": false,
"ratio": 3.5725255972696246,
"co... |
# Standard library imports.
from os.path import abspath
from StringIO import StringIO
import copy
import unittest
# Local imports.
from common import get_example_data
# Enthought library imports
from mayavi.core.null_engine import NullEngine
from mayavi.sources.vtk_xml_file_reader import VTKXMLFileReader
from mayavi... | {
"repo_name": "alexandreleroux/mayavi",
"path": "mayavi/tests/test_image_data_probe.py",
"copies": "2",
"size": "4096",
"license": "bsd-3-clause",
"hash": 4393572845719171600,
"line_mean": 30.5076923077,
"line_max": 122,
"alpha_frac": 0.6086425781,
"autogenerated": false,
"ratio": 3.7440585009140... |
# Standard library imports.
import numpy
from numpy import linspace, cos, sin, pi, empty, sqrt,array,arange,random
# Enthought library imports
from tvtk.api import tvtk
def generate_annulus(r=None, theta=None, z=None):
""" Generate points for structured grid for a cylindrical annular
volume. This meth... | {
"repo_name": "liulion/mayavi",
"path": "mayavi/tests/datasets.py",
"copies": "5",
"size": "5474",
"license": "bsd-3-clause",
"hash": 7036764518868326000,
"line_mean": 34.7777777778,
"line_max": 73,
"alpha_frac": 0.5924369748,
"autogenerated": false,
"ratio": 3.171494785631518,
"config_test": f... |
__author__ = 'svalleru'
import sys
import json
import smtplib
def get_email_creds():
with open('gmailAccount.cfg', 'r') as efile:
creds = [efile.next().strip() for x in xrange(2)]
email, passwd = creds[0].split('=')[1], creds[1].split('=')[1]
return email, passwd
def get_sms_params(**par... | {
"repo_name": "svalleru/PyText",
"path": "pyText.py",
"copies": "1",
"size": "2152",
"license": "mit",
"hash": 3721683295828487700,
"line_mean": 33.7258064516,
"line_max": 145,
"alpha_frac": 0.5710966543,
"autogenerated": false,
"ratio": 3.788732394366197,
"config_test": false,
"has_no_keywor... |
import time
from cloudmesh_client.common.Shell import Shell
from write2files import HostsWriter
from IPy import IP
import cmd
import os, sys
import getpass
import time
class VMS(cmd.Cmd):
def setup(self, cloud="chameleon", user='cc'):
self.cloud = 'cloud='+cloud
self.cloudUser = user
#prin... | {
"repo_name": "scottmcclary1/sp17-i524",
"path": "project/S17-IR-P008/code/Zeppelin/az.py",
"copies": "19",
"size": "14434",
"license": "apache-2.0",
"hash": 8716251214280924000,
"line_mean": 38.5452054795,
"line_max": 124,
"alpha_frac": 0.4740196758,
"autogenerated": false,
"ratio": 4.4521900061... |
import os
class HostsWriter():
def __init__(self):
# removing Ip config files
# delete hosts
if os.path.isfile("hosts") == True:
os.remove("hosts")
# delete sprak-defaults.conf
if os.path.isfile("spark-defaults.conf") == True:
os.remove("spark-de... | {
"repo_name": "abhishek8gupta/sp17-i524",
"path": "project/S17-IR-P008/code/Zeppelin/write2files.py",
"copies": "19",
"size": "3160",
"license": "apache-2.0",
"hash": -2621348747890490000,
"line_mean": 32.9784946237,
"line_max": 120,
"alpha_frac": 0.532278481,
"autogenerated": false,
"ratio": 3.5... |
__author__ = 'svfilhol'
import matplotlib.pyplot as plt
import numpy as np
import cv2
def kernel_square(nPix):
"""
Function to defin a square kernel of equal value for performing averaging
:param nPix: size of the kernel in pixel
:return: kernel matrix
"""
print("Averaging kernel of " + str(n... | {
"repo_name": "ArcticSnow/dempy",
"path": "dempy/decomposition/smooth2d.py",
"copies": "1",
"size": "3186",
"license": "mit",
"hash": 8312601073198223000,
"line_mean": 27.1946902655,
"line_max": 111,
"alpha_frac": 0.6192718142,
"autogenerated": false,
"ratio": 3.304979253112033,
"config_test": ... |
__author__ = 'svfilhol'
import pandas as pd
import scipy.spatial as sp
import pyproj as Proj
import geopandas
from shapely.geometry import Point
# Function open shapefile
def loadSHP(filename):
return ogr.Open(filename)
# Function to extract coordinates of points in the shapefile (valid for point shapefile)
def ... | {
"repo_name": "ArcticSnow/dempy",
"path": "dempy/shp_func.py",
"copies": "1",
"size": "2406",
"license": "mit",
"hash": -7178165247241524000,
"line_mean": 27.6547619048,
"line_max": 96,
"alpha_frac": 0.6566916043,
"autogenerated": false,
"ratio": 3.407932011331445,
"config_test": false,
"has_... |
__author__ = 'svfilhol'
# Example:
# os.system("qgis-colorramp.py --vmin 0 --vmax 0.18 --extend -1 5 /home/svfilhol/Downloads/nrwc_Sim.cpt")
def qgis_colorramp(Zmin, Zmax, Extmin, Extmax, cptFile):
"""
Function to produce colorscale based on .cpt file available at (http://soliton.vm.bytemark.co.uk/pub/cpt-c... | {
"repo_name": "ArcticSnow/dempy",
"path": "dempy/Qgis_tool.py",
"copies": "1",
"size": "1322",
"license": "mit",
"hash": -4356629103828104700,
"line_mean": 33.7894736842,
"line_max": 145,
"alpha_frac": 0.6694402421,
"autogenerated": false,
"ratio": 3.1105882352941174,
"config_test": false,
"h... |
"""
=========================
Multilabel classification
=========================
This example simulates a multi-label document classification problem. The
dataset is generated randomly based on the following process:
- pick the number of labels: n ~ Poisson(n_labels)
- n times, choose a class c: c ~ Multinom... | {
"repo_name": "chrsrds/scikit-learn",
"path": "examples/plot_multilabel.py",
"copies": "22",
"size": "4132",
"license": "bsd-3-clause",
"hash": -2925861880867113500,
"line_mean": 35.5663716814,
"line_max": 79,
"alpha_frac": 0.6393998064,
"autogenerated": false,
"ratio": 3.3703099510603587,
"con... |
__author__ = 'swabyears'
import paramiko
import argparse
from time import sleep
import getpass
'''
Script to grab the CDP and LLDP neihbors and display them.
'''
def main():
def disable_paging(remote_conn):
'''Dsiable paging on a Cisco router'''
remote_conn.send("terminal length 0\n")
sle... | {
"repo_name": "sambyers/CiscoIOSScripts",
"path": "l2adjacency.py",
"copies": "1",
"size": "3134",
"license": "mit",
"hash": 2104616902414933000,
"line_mean": 33.8222222222,
"line_max": 118,
"alpha_frac": 0.5673261008,
"autogenerated": false,
"ratio": 3.739856801909308,
"config_test": false,
... |
__author__ = 'swabyears'
import paramiko
import argparse
from time import sleep
import getpass
'''
Script to grab the IP protocols running and the peers for each protocol.
'''
def main():
devices_this_script_works_on = \
('Cisco Adaptive Security Appliance Software','Cisco IOS XE Software','Cisco IOS Software... | {
"repo_name": "sambyers/CiscoIOSScripts",
"path": "CiscoIPProtoPeers.py",
"copies": "1",
"size": "5581",
"license": "mit",
"hash": 6478586083928605000,
"line_mean": 35.2467532468,
"line_max": 118,
"alpha_frac": 0.5628023652,
"autogenerated": false,
"ratio": 4.041274438812454,
"config_test": fal... |
__author__ = 'swabyears'
import paramiko
import argparse
import time
import re
'''
Script to grab the port a particular MAC address is showing up on.
mac2port.py -h for help.
'''
switches_this_script_works_on = ['C3560','C2960','C2950','C3750']
def disable_paging(remote_conn):
'''Dsiable paging on a Cisco router'... | {
"repo_name": "sambyers/CiscoIOSScripts",
"path": "mac2port.py",
"copies": "1",
"size": "3266",
"license": "mit",
"hash": -2961697879861831000,
"line_mean": 35.3,
"line_max": 118,
"alpha_frac": 0.5799142682,
"autogenerated": false,
"ratio": 3.6779279279279278,
"config_test": false,
"has_no_ke... |
__author__ = 'swabyears'
import requests
import json
'''
Test app to change the banner on a Cisco CSR 1000v with the REST API.
'''
def main():
# CONSTANTS
base_uri = 'https://192.168.174.132:55443/api/v1/'
username = 'cisco'
password = 'cisco'
r = requests.post(base_uri+'auth/token-services', auth... | {
"repo_name": "sambyers/Csr_api_test",
"path": "csr.py",
"copies": "1",
"size": "1113",
"license": "mit",
"hash": -2851738475212102000,
"line_mean": 26.825,
"line_max": 109,
"alpha_frac": 0.6100628931,
"autogenerated": false,
"ratio": 3.3727272727272726,
"config_test": false,
"has_no_keywords... |
"""Handler for producing orchestration metering from Heat notification
events.
"""
from oslo.config import cfg
import oslo.messaging
from ceilometer import plugin
from ceilometer import sample
OPTS = [
cfg.StrOpt('heat_control_exchange',
default='heat',
help="Exchange name for H... | {
"repo_name": "nttdata-osscloud/ceilometer",
"path": "ceilometer/orchestration/notifications.py",
"copies": "2",
"size": "2499",
"license": "apache-2.0",
"hash": 8757216198743631000,
"line_mean": 31.4545454545,
"line_max": 79,
"alpha_frac": 0.6222488996,
"autogenerated": false,
"ratio": 4.0241545... |
"""Handler for producing orchestration metering from Heat notification
events.
"""
from oslo.config import cfg
from ceilometer import plugin
from ceilometer import sample
OPTS = [
cfg.StrOpt('heat_control_exchange',
default='heat',
help="Exchange name for Heat notifications"),
]... | {
"repo_name": "NeCTAR-RC/ceilometer",
"path": "ceilometer/orchestration/notifications.py",
"copies": "1",
"size": "2390",
"license": "apache-2.0",
"hash": -5816240557088172000,
"line_mean": 30.4473684211,
"line_max": 75,
"alpha_frac": 0.6117154812,
"autogenerated": false,
"ratio": 3.9833333333333... |
import datetime
import mock
from oslo.config import cfg
from oslotest import base
from ceilometer.openstack.common import log
from ceilometer.orchestration import notifications
from ceilometer import sample
NOW = datetime.datetime.isoformat(datetime.datetime.utcnow())
TENANT_ID = u'4c35985848bf4419b3f3d52c22e5792d... | {
"repo_name": "luogangyi/Ceilometer-oVirt",
"path": "ceilometer/tests/orchestration/test_notifications.py",
"copies": "6",
"size": "4441",
"license": "apache-2.0",
"hash": -3079273256624687600,
"line_mean": 32.9007633588,
"line_max": 76,
"alpha_frac": 0.6221571718,
"autogenerated": false,
"ratio"... |
import redis_lock
import logging
class RWLock:
READ = 'R'
WRITE = 'W'
def __init__(self, redis_conn, name, mode, expire=30, auto_renew=False):
assert mode in (self.READ, self.WRITE), 'Invalid mode.'
assert name, 'Invalid name. Should not be empty'
self.__mode = mode
self... | {
"repo_name": "swapnilsm/redis-rw-lock",
"path": "redis_rw_lock/__init__.py",
"copies": "1",
"size": "3828",
"license": "mit",
"hash": 7134229646612945000,
"line_mean": 37.6666666667,
"line_max": 101,
"alpha_frac": 0.6008359457,
"autogenerated": false,
"ratio": 3.7201166180758016,
"config_test"... |
import unittest
import redis
import threading
import time
import copy
from redis_rw_lock import RWLock
class Writer(threading.Thread):
def __init__(self, buffer_, rw_lock, init_sleep_time, sleep_time, to_write):
"""
@param buffer_: common buffer_ shared by the readers and writers
@type b... | {
"repo_name": "swapnilsm/redis-rw-lock",
"path": "tests.py",
"copies": "1",
"size": "7444",
"license": "mit",
"hash": 4514380159307094500,
"line_mean": 39.4565217391,
"line_max": 83,
"alpha_frac": 0.6209027405,
"autogenerated": false,
"ratio": 3.6869737493808814,
"config_test": true,
"has_no_... |
__author__ = 'Swathi Gangisetty'
import unittest
from eucaops import Eucaops
import argparse
class EUCA2782(unittest.TestCase):
def setUp(self):
self.tester = eucaops
def test_EUCA2782(self):
### Create a bucket in Walrus
self.bucket_obj = self.tester.create_bucket('bucket_euca2782')... | {
"repo_name": "nephomaniac/eutester",
"path": "testcases/cloud_user/s3/EUCA-2782.py",
"copies": "6",
"size": "2519",
"license": "bsd-2-clause",
"hash": 4168378969978966500,
"line_mean": 37.7692307692,
"line_max": 136,
"alpha_frac": 0.6760619293,
"autogenerated": false,
"ratio": 3.973186119873817,... |
__author__ = 'Swathi Gangisetty'
import unittest
from eucaops import Eucaops
import argparse
key_with_star_name = 'special characters%unravelled_bigtime/abc*'
key_with_dollar_name = 'special characters%unravelled_bigtime/abc$'
key_with_exclamation_name = 'special characters%unravelled_bigtime/abc!'
key_with_percent_n... | {
"repo_name": "nagyistoce/eutester",
"path": "testcases/cloud_user/s3/EUCA-3453.py",
"copies": "6",
"size": "12079",
"license": "bsd-2-clause",
"hash": 3094699711513780000,
"line_mean": 46.9325396825,
"line_max": 116,
"alpha_frac": 0.6850732677,
"autogenerated": false,
"ratio": 3.177012098895318,... |
__author__ = 'swebb'
"""Example demonstration of the two-stream instability using the
multisymplectic electrostatic algorithm. The beam is assumed initially cold,
while the plasma has some RMS velocity spread.
Recall that all units are CGS.
"""
from opal.fields import discrete_fourier_electrostatic as dfe
from opal.... | {
"repo_name": "radiasoft/opal",
"path": "examples/two-stream_instability.py",
"copies": "1",
"size": "5517",
"license": "apache-2.0",
"hash": 4169540351265150000,
"line_mean": 28.9836956522,
"line_max": 79,
"alpha_frac": 0.6561537067,
"autogenerated": false,
"ratio": 3.172512938470385,
"config_... |
__author__ = 'swebb'
failed = False
try:
from opal.interpolaters_depositers import tent_dfes
import numpy as np
from matplotlib import pyplot as plt
weights = np.array([10., 15.]) #, 5.])
ptclsize = 0.01
nmodes = 2
dimension = 2
pos = np.zeros((2,dimension))
vel = np.zeros((2,d... | {
"repo_name": "radiasoft/opal",
"path": "tests/interpolaters_depositers/tent_dfes.py",
"copies": "1",
"size": "3823",
"license": "apache-2.0",
"hash": -5469889864006480000,
"line_mean": 33.1428571429,
"line_max": 82,
"alpha_frac": 0.5090243264,
"autogenerated": false,
"ratio": 3.3891843971631204,... |
__author__ = 'swebb'
from matplotlib import pyplot as plt
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
mpl.rc('text', usetex=True)
from radtrack.ptclmovers.RbBorisVay import RbBorisVay
import scipy.constants as consts
import numpy as np
try:
dt = 1.e-8
B = [1.e-5 * np.array([1., 0.1, 0.]... | {
"repo_name": "radiasoft/radtrack",
"path": "experimental/laserHeater/testBorisVay.py",
"copies": "1",
"size": "2673",
"license": "apache-2.0",
"hash": -7174112521866401000,
"line_mean": 24.7115384615,
"line_max": 78,
"alpha_frac": 0.5731387954,
"autogenerated": false,
"ratio": 2.512218045112782,... |
__author__ = 'swebb'
from matplotlib import pyplot as plt
import numpy as np
class fodocell(object):
def __init__(self, Lu, l, K):
self.Lu = Lu
self.quad_K = K
self.quad_l = l
rootK = np.sqrt(K)
rootKl = rootK*l
quadF = np.matrix(np.zeros((4,4)))
quadF[0,0] ... | {
"repo_name": "radiasoft/radtrack",
"path": "radtrack/fel/fodocell.py",
"copies": "1",
"size": "4443",
"license": "apache-2.0",
"hash": -549592183944193500,
"line_mean": 34.544,
"line_max": 78,
"alpha_frac": 0.5671843349,
"autogenerated": false,
"ratio": 2.885064935064935,
"config_test": false,... |
__author__ = 'swebb'
import numpy as np
#from numba import jit
class non_rel_ptcl:
def __init__(self, pd):
self.num_ptcls = pd['number of particles']
self.dimension = pd['dimensions']
self.mass = pd['mass']
self.pos = np.zeros((self.num_ptcls, self.dimension))
self.vel =... | {
"repo_name": "radiasoft/opal",
"path": "opal/particles/non_rel_ptcl.py",
"copies": "1",
"size": "2371",
"license": "apache-2.0",
"hash": -8324327683410916000,
"line_mean": 23.2040816327,
"line_max": 74,
"alpha_frac": 0.5246731337,
"autogenerated": false,
"ratio": 3.6931464174454827,
"config_te... |
__author__ = 'swebb'
import numpy as np
#from numba import jit
class tent_dfes:
def __init__(self, pd):
self.type = 'spectral'
self.ptcl_size = pd['particle size']
self.charge2mass = pd['charge']/pd['mass']
self.charge = pd['charge']
self.rho = 0.
def add_field(sel... | {
"repo_name": "radiasoft/opal",
"path": "opal/interpolaters_depositers/tent_dfes.py",
"copies": "1",
"size": "3828",
"license": "apache-2.0",
"hash": 4902898048055350000,
"line_mean": 32.0086206897,
"line_max": 85,
"alpha_frac": 0.5694879833,
"autogenerated": false,
"ratio": 3.991657977059437,
... |
__author__ = 'swebb'
import numpy as np
from numba import jit
class discrete_fourier_electrostatic:
def __init__(self, params_dictionary):
self.type = 'spectral'
self.n_modes = params_dictionary['n_modes']
self.dk = params_dictionary['delta k']
dims = params_dictionary['dimensio... | {
"repo_name": "radiasoft/opal",
"path": "opal/fields/discrete_fourier_electrostatic.py",
"copies": "1",
"size": "2557",
"license": "apache-2.0",
"hash": -1017598267553627500,
"line_mean": 25.3711340206,
"line_max": 76,
"alpha_frac": 0.5428236214,
"autogenerated": false,
"ratio": 3.771386430678466... |
__author__ = 'swebb'
"""
This is a test to determine whether the two-body Coulomb attraction between
an electron and a positron is correct.
"""
from opal.fields import discrete_fourier_electrostatic as dfe
from opal.interpolaters_depositers import tent_dfes as depinterp
from opal.particles import non_rel_ptcl as ptcls... | {
"repo_name": "radiasoft/opal",
"path": "tests/integration_tests/coulomb_interaction.py",
"copies": "1",
"size": "3488",
"license": "apache-2.0",
"hash": 2746771910584078000,
"line_mean": 27.8347107438,
"line_max": 80,
"alpha_frac": 0.6918004587,
"autogenerated": false,
"ratio": 3.321904761904762... |
__author__ = 'swebb'
"""
Test of the energy conservation
"""
from opal.fields import discrete_fourier_electrostatic as dfe
from opal.interpolaters_depositers import tent_dfes as depinterp
from opal.particles import non_rel_ptcl as ptcls
from opal.boundaries import particle_boundaries
from opal.auxiliary import const... | {
"repo_name": "radiasoft/opal",
"path": "examples/thermal_plasma.py",
"copies": "1",
"size": "6662",
"license": "apache-2.0",
"hash": -5691923758379793000,
"line_mean": 26.9957983193,
"line_max": 79,
"alpha_frac": 0.62248574,
"autogenerated": false,
"ratio": 3.240272373540856,
"config_test": fa... |
__author__ = 'swebb'
try:
from opal.fields import discrete_fourier_electrostatic as dfes
from matplotlib import pyplot as plt
import numpy as np
dimensions = 2
dk = 0.1
nmodes = 2
pd = {}
pd['dimensions'] = dimensions
pd['delta k'] = np.array([dk]*dimensions)
pd['n_modes'] = n... | {
"repo_name": "radiasoft/opal",
"path": "tests/fields/electrostatic/dfes.py",
"copies": "1",
"size": "1717",
"license": "apache-2.0",
"hash": 1996690626430367200,
"line_mean": 28.1186440678,
"line_max": 66,
"alpha_frac": 0.4618520676,
"autogenerated": false,
"ratio": 3.8411633109619685,
"config... |
__author__ = "swilkins"
"""
A simple API to the Olog client in python
"""
from .OlogClient import OlogClient
from .OlogDataTypes import LogEntry, Logbook, Tag, Attachment, Property
def logentry_to_dict(log):
rtn = dict()
lid = log.id
if not lid:
return rtn
rtn['id'] = lid
def update(na... | {
"repo_name": "ericdill/pyOlog",
"path": "pyOlog/SimpleOlogClient.py",
"copies": "2",
"size": "9159",
"license": "mit",
"hash": 3295325016169168000,
"line_mean": 27.4440993789,
"line_max": 78,
"alpha_frac": 0.5260399607,
"autogenerated": false,
"ratio": 4.843469063987309,
"config_test": false,
... |
import numpy as np
class DrawTree:
def __init__(self, tree, parent=None, depth=0, number=1):
self.x = -1.
self.y = depth
self.tree = tree
self.children = [DrawTree(c, self, depth + 1, i + 1)
for i, c
in enumerate(tree.children)]
... | {
"repo_name": "huzq/scikit-learn",
"path": "sklearn/tree/_reingold_tilford.py",
"copies": "20",
"size": "5184",
"license": "bsd-3-clause",
"hash": -5307677673322827000,
"line_mean": 26.5744680851,
"line_max": 88,
"alpha_frac": 0.5223765432,
"autogenerated": false,
"ratio": 3.433112582781457,
"c... |
__author__ = 'swvenu'
from scrapy.spiders import Rule, CrawlSpider
from crawler.items import CrawlerItem
from urlparse import urlparse
from scrapy.linkextractors.lxmlhtml import LxmlLinkExtractor
import scrapy
import re
class MySpider(CrawlSpider):
name = "udayavani"
allowed_domains = ["udayavani.com"]
#s... | {
"repo_name": "vswamy/summarizer",
"path": "crawler/crawler/spiders/udayavani_spider.py",
"copies": "1",
"size": "1851",
"license": "apache-2.0",
"hash": -7015265440608381000,
"line_mean": 33.2962962963,
"line_max": 200,
"alpha_frac": 0.5775256618,
"autogenerated": false,
"ratio": 3.5596153846153... |
__author__ = 'sxjscience'
import mxnet as mx
import numpy
import cv2
import logging
import os
from utils import *
from replay_memory import ReplayMemory
from game import Game
from game import DEFAULT_MAX_EPISODE_STEP
logger = logging.getLogger(__name__)
_dirname = os.path.dirname(os.path.realpath(__file__))
_default... | {
"repo_name": "EvanzzzZ/mxnet",
"path": "example/reinforcement-learning/dqn/atari_game.py",
"copies": "16",
"size": "6362",
"license": "apache-2.0",
"hash": -624515289624130000,
"line_mean": 40.0451612903,
"line_max": 100,
"alpha_frac": 0.5869223515,
"autogenerated": false,
"ratio": 3.80730101735... |
from m5.SimObject import SimObject
from m5.params import *
class BranchPredictor(SimObject):
type = 'BranchPredictor'
cxx_class = 'BPredUnit'
cxx_header = "cpu/pred/bpred_unit.hh"
abstract = True
numThreads = Param.Unsigned(1, "Number of threads")
BTBEntries = Param.Unsigned(4096, "Number of ... | {
"repo_name": "yashpatel5400/neuropath",
"path": "predictor/BranchPredictor.py",
"copies": "1",
"size": "4093",
"license": "mit",
"hash": -8779713442959638000,
"line_mean": 39.1274509804,
"line_max": 79,
"alpha_frac": 0.7129245053,
"autogenerated": false,
"ratio": 3.4510961214165263,
"config_te... |
import re
# declare ---------------------------------------------------------------------
def add_monitor_param(parser, mandatory=False):
parser.add_argument('-m', '--monitor',
type=int,
choices=[0, 1],
default=-1,
... | {
"repo_name": "syl20bnr/i3ci",
"path": "_deprecated/scripts/menu/common.py",
"copies": "1",
"size": "1341",
"license": "mit",
"hash": 6219459621622446000,
"line_mean": 25.82,
"line_max": 79,
"alpha_frac": 0.4601043997,
"autogenerated": false,
"ratio": 4.45514950166113,
"config_test": false,
"... |
import os
from subprocess import Popen, PIPE
MODULE_PATH = os.path.dirname(os.path.abspath(__file__))
MENU = os.path.normpath(os.path.join(MODULE_PATH, '../../bin/i3ci_menu'))
def call(p=None,
a=100,
f='fixed',
lmax=8,
lv=True,
m=-1,
h=16,
r=False,
... | {
"repo_name": "syl20bnr/i3ci",
"path": "_deprecated/scripts/menu/i3ci_menu.py",
"copies": "1",
"size": "1070",
"license": "mit",
"hash": -6278663016276104000,
"line_mean": 24.4761904762,
"line_max": 73,
"alpha_frac": 0.485046729,
"autogenerated": false,
"ratio": 2.955801104972376,
"config_test"... |
__author__ = "Sylvain Dangin"
__licence__ = "Apache 2.0"
__version__ = "1.0"
__maintainer__ = "Sylvain Dangin"
__email__ = "sylvain.dangin@gmail.com"
__status__ = "Development"
class concat():
def action(input_data, params, current_row, current_index):
"""Concat multiple columns in the cell.
:param... | {
"repo_name": "Sylvaner/PyConverter",
"path": "actions/concat.py",
"copies": "1",
"size": "1072",
"license": "apache-2.0",
"hash": -7315304831593305000,
"line_mean": 34.7333333333,
"line_max": 67,
"alpha_frac": 0.5429104478,
"autogenerated": false,
"ratio": 3.9267399267399266,
"config_test": fa... |
__author__ = "Sylvain Dangin"
__licence__ = "Apache 2.0"
__version__ = "1.0"
__maintainer__ = "Sylvain Dangin"
__email__ = "sylvain.dangin@gmail.com"
__status__ = "Development"
class last_word():
def transform(input_data):
"""Get the last word of a string with more than one word.
:param in... | {
"repo_name": "Sylvaner/PyConverter",
"path": "transforms/last_word.py",
"copies": "1",
"size": "1323",
"license": "apache-2.0",
"hash": -4835079148325673000,
"line_mean": 37.9117647059,
"line_max": 74,
"alpha_frac": 0.4678760393,
"autogenerated": false,
"ratio": 4.469594594594595,
"config_test... |
__author__ = "Sylvain Dangin"
__licence__ = "Apache 2.0"
__version__ = "1.0"
__maintainer__ = "Sylvain Dangin"
__email__ = "sylvain.dangin@gmail.com"
__status__ = "Development"
from datetime import datetime
class date_format():
def action(input_data, params, current_row, current_index):
"""Convert date fr... | {
"repo_name": "Sylvaner/PyConverter",
"path": "actions/date_format.py",
"copies": "1",
"size": "1140",
"license": "apache-2.0",
"hash": 8666766003514663000,
"line_mean": 37,
"line_max": 93,
"alpha_frac": 0.5815789474,
"autogenerated": false,
"ratio": 3.9310344827586206,
"config_test": false,
... |
__author__ = 'Syngularity'
# from BeautifulSoup import BeautifulSoup
from htmlmin import minify
from bs4 import BeautifulSoup
import re
import os
import sys
import js_compress
import css_compressor
class IndexHtmlExtractor:
def __init__(self, path_to_index_html):
self.index_html_soup = BeautifulSoup(rea... | {
"repo_name": "Syngularity-Infinyt/Js13kCompiler",
"path": "js13k_compiler.py",
"copies": "1",
"size": "3664",
"license": "unlicense",
"hash": -3577410950805203500,
"line_mean": 31.4247787611,
"line_max": 108,
"alpha_frac": 0.6424672489,
"autogenerated": false,
"ratio": 3.2140350877192985,
"con... |
__author__ = 'Syngularity'
import json
import httplib
import urllib
class JsCompressor:
def __init__(self, js_code, js_version='ECMASCRIPT5', compilation_level='ADVANCED_OPTIMIZATIONS'):
self.js_code = js_code
self.js_version = js_version
self.compilation_level = compilation_level
de... | {
"repo_name": "Syngularity-Infinyt/Js13kCompiler",
"path": "js_compress.py",
"copies": "1",
"size": "3513",
"license": "unlicense",
"hash": 5922164735638350000,
"line_mean": 36.3723404255,
"line_max": 109,
"alpha_frac": 0.6142897808,
"autogenerated": false,
"ratio": 4.084883720930232,
"config_t... |
import os.path as op
import numpy as np
from scipy import linalg
import warnings
from nose.tools import assert_true
import mne
from mne.datasets import testing
from mne.beamformer import rap_music
from mne.utils import run_tests_if_main
data_path = testing.data_path(download=False)
fname_ave = op.join(data_path, '... | {
"repo_name": "nicproulx/mne-python",
"path": "mne/beamformer/tests/test_rap_music.py",
"copies": "2",
"size": "6662",
"license": "bsd-3-clause",
"hash": 2900864771070426600,
"line_mean": 36.4269662921,
"line_max": 78,
"alpha_frac": 0.5712999099,
"autogenerated": false,
"ratio": 3.126231816048803... |
import numpy as np
from scipy.linalg import norm
from ..utils import _check_option
# TODO: Add more localization accuracy functions. For example, distance between
# true dipole position (in simulated stc) and the centroid of the
# estimated activity.
def _check_stc(stc1, stc2):
"""Check that stcs a... | {
"repo_name": "adykstra/mne-python",
"path": "mne/simulation/metrics.py",
"copies": "8",
"size": "1982",
"license": "bsd-3-clause",
"hash": 2888989481573127700,
"line_mean": 29.4923076923,
"line_max": 79,
"alpha_frac": 0.6493440969,
"autogenerated": false,
"ratio": 3.8410852713178296,
"config_t... |
import numpy as np
from scipy.linalg import norm
# TODO: Add more localization accuracy functions. For example, distance between
# true dipole position (in simulated stc) and the centroid of the
# estimated activity.
def _check_stc(stc1, stc2):
"""Check that stcs are compatible."""
if stc1.data.... | {
"repo_name": "nicproulx/mne-python",
"path": "mne/simulation/metrics.py",
"copies": "2",
"size": "2105",
"license": "bsd-3-clause",
"hash": 2132229267297134000,
"line_mean": 29.9558823529,
"line_max": 79,
"alpha_frac": 0.6370546318,
"autogenerated": false,
"ratio": 3.919925512104283,
"config_t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.