text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'david'
from typing import List, Iterable
from multiprocessing import Pool
import time
def compute(a: float)->float:
"""
Here will just compute the result and return it
"""
a = a*2+1
a = 0.0+a-1
a = a/2
return a ** 2 + 1 + 0.6 ** a
def f1():
"""
first try is to run a ... | {
"repo_name": "sixhat/swipe",
"path": "python/map_speed.py",
"copies": "1",
"size": "1312",
"license": "bsd-2-clause",
"hash": -4580548918781323300,
"line_mean": 21.6206896552,
"line_max": 103,
"alpha_frac": 0.6089939024,
"autogenerated": false,
"ratio": 2.9351230425055927,
"config_test": false... |
class dstat_plugin(dstat):
"""
Read and Write average wait times of block devices.
Displays the average read and write wait times of block devices
"""
def __init__(self):
self.nick = ('rawait', 'wawait')
self.type = 'f'
self.width = 4
self.scale = 1
self.di... | {
"repo_name": "SpamapS/dstat-plugins",
"path": "dstat_plugins/plugins/dstat_disk_wait.py",
"copies": "4",
"size": "2773",
"license": "apache-2.0",
"hash": -685894545756549400,
"line_mean": 33.2345679012,
"line_max": 113,
"alpha_frac": 0.4933285251,
"autogenerated": false,
"ratio": 3.4361833952912... |
__author__ = 'david'
import os
import sys
from ifind.seeker.trec_qrel_handler import TrecQrelHandler
def ratio(rels, nonrels):
""" expect two floats
"""
dem = rels + nonrels
if dem > 0.0:
return round((rels * rels) / dem, 2)
else:
return 0.0
def get_perf():
OUT_FILE = 'user_pe... | {
"repo_name": "leifos/treconomics",
"path": "treconomics_project/get_user_perf.py",
"copies": "1",
"size": "2651",
"license": "mit",
"hash": 4223220133843679000,
"line_mean": 28.797752809,
"line_max": 111,
"alpha_frac": 0.5582798944,
"autogenerated": false,
"ratio": 3.7763532763532766,
"config_... |
__author__ = 'david'
import RPi.GPIO as GPIO
import time
def updateLEDs(grid, x, y):
x_channel_list = x
y_channel_list = y
numx = numy = 0
for x in grid:
for y in x:
if (y):
GPIO.output(x_channel_list[numx], GPIO.HIGH)
GPIO.output(y_channel_list[numy]... | {
"repo_name": "TheRedshift/AudioAffair",
"path": "src/lights.py",
"copies": "1",
"size": "1510",
"license": "mit",
"hash": -1390069222630456000,
"line_mean": 26.9814814815,
"line_max": 63,
"alpha_frac": 0.5132450331,
"autogenerated": false,
"ratio": 3.2683982683982684,
"config_test": false,
"... |
__author__ = 'David'
class HexCharacterMapping:
characters = {}
def __init__(self):
self.characters[' '] = ' '
self.characters['!'] = '!'
self.characters['"'] = '"'
self.characters['#'] = '#'
self.characters['$'] = '$'
self.characters['... | {
"repo_name": "idcodeoverflow/SocialNetworkAnalyzer",
"path": "PreprocessingLayout/html/HexCharacterMapping.py",
"copies": "1",
"size": "18351",
"license": "mit",
"hash": -441409084347398000,
"line_mean": 38.3978021978,
"line_max": 43,
"alpha_frac": 0.4520807765,
"autogenerated": false,
"ratio": ... |
__author__ = 'david'
from ifind.common.language_model import LanguageModel
from simiir.text_classifiers.lm_classifier import LMTextClassifier
from simiir.utils.lm_methods import extract_term_dict_from_text
import logging
log = logging.getLogger('lm_classifer.TopicBasedLMTextClassifier')
class TopicBasedLMTextClassif... | {
"repo_name": "leifos/simiir",
"path": "simiir/text_classifiers/lm_topic_classifier.py",
"copies": "1",
"size": "3785",
"license": "mit",
"hash": -926621738521203500,
"line_mean": 48.8157894737,
"line_max": 155,
"alpha_frac": 0.6763540291,
"autogenerated": false,
"ratio": 4.078663793103448,
"co... |
__author__ = 'david'
from ifind.common.query_generation import SingleQueryGeneration
from ifind.common.language_model import LanguageModel
from ifind.common.query_ranker import QueryRanker
def extract_term_dict_from_text(text, stopword_file):
"""
takes text, parses it, and counts how many times each term occu... | {
"repo_name": "leifos/simiir",
"path": "simiir/utils/lm_methods.py",
"copies": "1",
"size": "1478",
"license": "mit",
"hash": -7500718137630771000,
"line_mean": 33.3953488372,
"line_max": 95,
"alpha_frac": 0.7077131258,
"autogenerated": false,
"ratio": 3.667493796526055,
"config_test": false,
... |
__author__ = 'David'
from peewee import *
from datetime import datetime
from loadextantdata import get_data
db = SqliteDatabase("Housing.db")
class Housing(Model):
"""
The base model for the housing database.
"""
building_name = CharField(max_length=100)
address = CharField(max_length=255)
n... | {
"repo_name": "katzwigmore/Portland-Housing-Tracker",
"path": "housingdatabase.py",
"copies": "1",
"size": "5247",
"license": "mit",
"hash": 6413536851545229000,
"line_mean": 29.6842105263,
"line_max": 117,
"alpha_frac": 0.5605107681,
"autogenerated": false,
"ratio": 4.0548686244204015,
"config... |
__author__ = 'david'
import abc
from simiir.text_classifiers.base_classifier import BaseTextClassifier
from simiir.utils.data_handlers import get_data_handler
from random import random
import logging
log = logging.getLogger('base_informed_trec_classifier')
class BaseInformedTrecTextClassifier(BaseTextClassifier):
... | {
"repo_name": "leifos/simiir",
"path": "simiir/text_classifiers/base_informed_trec_classifier.py",
"copies": "1",
"size": "2215",
"license": "mit",
"hash": 7621437724282774000,
"line_mean": 34.1587301587,
"line_max": 139,
"alpha_frac": 0.6239277652,
"autogenerated": false,
"ratio": 4.132462686567... |
__author__ = "David"
import requests
import json
import sys
from add_playlist import add_playlist
from youtube_playlist import load_config, send_get_request
uploader_id = str()
config = load_config()
def usage_message():
print("USAGE: {0} [id/username] uploader-details".format(sys.argv[0]))
exit(-1)
def pr... | {
"repo_name": "Ratheronfire/YouTube-Playlist-Manager",
"path": "find_account_playlists.py",
"copies": "1",
"size": "3843",
"license": "mit",
"hash": -2401400945610634000,
"line_mean": 32.7192982456,
"line_max": 118,
"alpha_frac": 0.5576372626,
"autogenerated": false,
"ratio": 3.881818181818182,
... |
__author__ = 'David'
import sys
from PyQt4 import QtGui, QtCore, uic
from pgdb import PGDatabase
form_class = uic.loadUiType("App/mainUI.ui")[0]
class GUI(QtGui.QMainWindow, form_class):
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)
self.setupUi(self)
self.dat... | {
"repo_name": "lfgcodeLinc/JonsTeam",
"path": "Client/App/gui.py",
"copies": "1",
"size": "13436",
"license": "mit",
"hash": -3881752539859926000,
"line_mean": 39.5921450151,
"line_max": 93,
"alpha_frac": 0.653617148,
"autogenerated": false,
"ratio": 4.1139007960808325,
"config_test": false,
... |
__author__ = 'david'
import telnetlib
import socket
from time import sleep
class PioneerAvClientException(Exception):
pass
class VSX528Telnet(object):
"Telnet client to Pioneer VSX-528 AV"""
INPUTS = { "CD" : "01",
"TUNER" : "02",
"DVD" : "04",
... | {
"repo_name": "encinas/pioneeravclient",
"path": "pioneeravclient/clients.py",
"copies": "1",
"size": "3024",
"license": "bsd-3-clause",
"hash": 776796296398712000,
"line_mean": 28.0865384615,
"line_max": 86,
"alpha_frac": 0.4990079365,
"autogenerated": false,
"ratio": 3.7333333333333334,
"conf... |
__author__ = 'David'
class FacebookUser:
facebookUserId = 0
userName = ''
name = ''
@classmethod
def ini(self, facebookuserid: int, firstname: str, gender: str, lastname: str, link: str, locale: str,
name: str, username: str):
self.facebookUserId = facebookuserid
self... | {
"repo_name": "idcodeoverflow/SocialNetworkAnalyzer",
"path": "EntitiesLayout/FacebookUser.py",
"copies": "1",
"size": "1240",
"license": "mit",
"hash": 4908739451044219000,
"line_mean": 29.243902439,
"line_max": 111,
"alpha_frac": 0.5177419355,
"autogenerated": false,
"ratio": 3.8271604938271606... |
__author__ = 'David'
import psycopg2
class PGDatabase(object):
def __init__(self):
# Connect to a database
url = "postgres://vqesjlxdyoxqvq:HR5OD_Svzd48Nwzu6FN4-VTZd6@ec2-54-243-245-159.compute-1.amazonaws.com:5432/dabosh8r2vtap1"
self.connection = psycopg2.connect(url)
# Open a ... | {
"repo_name": "lfgcodeLinc/JonsTeam",
"path": "Client/App/pgdb.py",
"copies": "1",
"size": "3246",
"license": "mit",
"hash": 1154065018798875400,
"line_mean": 34.2826086957,
"line_max": 131,
"alpha_frac": 0.6247689464,
"autogenerated": false,
"ratio": 3.800936768149883,
"config_test": false,
... |
__author__ = 'davidnovogrodsky_wrk'
# making a port scanner
__author__ = 'davidnovogrodsky_wrk'
import socket
import time
import threading
from queue import Queue
# the print command is not thread safe
# to prevent collisions use a lock
print_lock = threading.Lock()
target = 'pythonprogramming.net'
# define the por... | {
"repo_name": "DavidNovo/ExplorationsWithPython",
"path": "threadedPortScanner.py",
"copies": "1",
"size": "1253",
"license": "mit",
"hash": 4935628672741614000,
"line_mean": 22.2037037037,
"line_max": 57,
"alpha_frac": 0.6568236233,
"autogenerated": false,
"ratio": 3.54957507082153,
"config_te... |
__author__ = 'David'
__version__ = 2
import os
import redis
import base64
import cPickle
from ifind.seeker.trec_qrel_handler import TrecQrelHandler
#
# Revised datahandler classes -- considering code refactoring in September 2017.
# Author: David Maxwell
# Date: 2017-09-24
#
def get_data_handler(filename=None, ho... | {
"repo_name": "leifos/simiir",
"path": "simiir/utils/data_handlers.py",
"copies": "1",
"size": "4520",
"license": "mit",
"hash": -1644649796903854800,
"line_mean": 36.9915966387,
"line_max": 115,
"alpha_frac": 0.635619469,
"autogenerated": false,
"ratio": 4.24015009380863,
"config_test": false,... |
__author__ = 'David Oreper'
class PeopleDataKeys:
def __init__(self):
pass
MANAGER = "Manager"
NAME = "HR Name"
NICK_NAME = "Nickname"
LEVEL = "Level"
TITLE = "Title"
FUNCTION = "Function"
PROJECT = "Project"
#PROJECT = "Cost Center"
FEATURE_TEAM = "Feature Team"
TYP... | {
"repo_name": "Hitachi-Data-Systems/org-chart-builder",
"path": "orgchart_keys.py",
"copies": "1",
"size": "5505",
"license": "apache-2.0",
"hash": 2294652481058351600,
"line_mean": 43.3951612903,
"line_max": 267,
"alpha_frac": 0.561489555,
"autogenerated": false,
"ratio": 2.8332475553268144,
"... |
__author__ = 'David Oreper'
class FilterCriteria:
def __init__(self,):
pass
def matches(self, aPerson):
return True
class KeyMatchesCriteria(FilterCriteria):
def __init__(self, expectedValue):
FilterCriteria.__init__(self)
self.expectedValue = expectedValue or ""
def... | {
"repo_name": "Hitachi-Data-Systems/org-chart-builder",
"path": "people_filter_criteria.py",
"copies": "1",
"size": "3899",
"license": "apache-2.0",
"hash": 1552389800296185300,
"line_mean": 29.7007874016,
"line_max": 110,
"alpha_frac": 0.6614516543,
"autogenerated": false,
"ratio": 3.90290290290... |
import unittest
from sunpy.roi.chaincode import Chaincode
import numpy as np
class CCTests(unittest.TestCase):
def testEnds(self):
cc = Chaincode([0, 0], "2460") # Can I test more than one path? How?
end = [0, 0]
self.failUnless(cc.matchend(end))
def testEndsFalse(self):
cc =... | {
"repo_name": "mjm159/sunpy",
"path": "sunpy/tests/roi/chaincode_test.py",
"copies": "1",
"size": "2226",
"license": "bsd-2-clause",
"hash": 2508294367186981400,
"line_mean": 30.8,
"line_max": 76,
"alpha_frac": 0.5736747529,
"autogenerated": false,
"ratio": 3.0831024930747923,
"config_test": tr... |
"""app.controllers.forms
Define all form objects used in the application.
"""
# Import required data from the Flask WTForms extension.
from flask.ext.wtf import Form
from flask.ext.wtf.file import FileField, FileAllowed, FileRequired
from wtforms import StringField, SubmitField
from wtforms.validators import Require... | {
"repo_name": "davidtimmons/text-scalpel-app",
"path": "app/controllers/forms.py",
"copies": "1",
"size": "1081",
"license": "mit",
"hash": -2448655471722583600,
"line_mean": 30.7941176471,
"line_max": 78,
"alpha_frac": 0.6216466235,
"autogenerated": false,
"ratio": 4.6594827586206895,
"config_... |
"""app.models.visitor
Sets up the database models associated with an application visitor.
"""
# Import the Flask SQLAlchemy database object associated with this application.
from ..createapp import db
class User(db.Model):
"""Create a user database model to store account state information."""
# Create SQL... | {
"repo_name": "davidtimmons/text-scalpel-app",
"path": "app/models/visitor.py",
"copies": "1",
"size": "1657",
"license": "mit",
"hash": 8897061969041905000,
"line_mean": 32.8163265306,
"line_max": 84,
"alpha_frac": 0.6813518407,
"autogenerated": false,
"ratio": 3.8267898383371826,
"config_test... |
"""app.views.routes
Registers the application site map on the Flask blueprint object and manages app
view functionality presented to the user.
"""
from flask import current_app, redirect, render_template, session, url_for
from werkzeug import secure_filename
from ..createapp import db
from ..createblueprint import b... | {
"repo_name": "davidtimmons/text-scalpel-app",
"path": "app/views/routes.py",
"copies": "1",
"size": "4911",
"license": "mit",
"hash": 989646301621477400,
"line_mean": 35.9248120301,
"line_max": 80,
"alpha_frac": 0.6120952963,
"autogenerated": false,
"ratio": 4.428313796212804,
"config_test": f... |
__author__ = 'daweim0'
import os
import datasets
import datasets.imdb
import cPickle
import numpy as np
import cv2
from fcn.config import cfg
class lov_synthetic(datasets.imdb):
def __init__(self, image_set, lov_path = None):
datasets.imdb.__init__(self, 'lov_synthetic_' + image_set)
self._image_s... | {
"repo_name": "daweim0/Just-some-image-features",
"path": "lib/datasets/lov_synthetic.py",
"copies": "1",
"size": "12835",
"license": "mit",
"hash": 1894668566564073700,
"line_mean": 35.776504298,
"line_max": 148,
"alpha_frac": 0.5382937281,
"autogenerated": false,
"ratio": 3.4364123159303883,
... |
__author__ = 'Dawei'
import math
longest = 1
longestStart = 1
computed = {1:1}
def getCount(i):
number = i
count = 0
while True:
if number in computed:
return computed[number]
if number % 2 == 0:
lognumber = math.log2(number)
intlognumber = int(logn... | {
"repo_name": "fresky/ProjectEulerSolution",
"path": "014.py",
"copies": "1",
"size": "1148",
"license": "mit",
"hash": -5321454442302309000,
"line_mean": 21.0769230769,
"line_max": 52,
"alpha_frac": 0.5069686411,
"autogenerated": false,
"ratio": 3.6913183279742765,
"config_test": false,
"has... |
__author__ = 'Dawei'
bignumber = '''
37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309513058123726617309629
91942213363574161572522430563301811072406154908250
23067588207539346171171980310421047513778063246676
892616706966236338201363784... | {
"repo_name": "fresky/ProjectEulerSolution",
"path": "013.py",
"copies": "1",
"size": "5581",
"license": "mit",
"hash": -1193688646553723100,
"line_mean": 40.3481481481,
"line_max": 50,
"alpha_frac": 0.9485755241,
"autogenerated": false,
"ratio": 2.3234804329725227,
"config_test": false,
"has... |
__author__ = 'Dawei'
words = {1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',8:'eight',9:'nine',10:'ten'
,11:'eleven',12:'twelve', 13:'thirteen', 14:'fourteen', 15:'fifteen'
, 16:'sixteen',17:'seventeen',18:'eighteen',19:'nineteen', 20:'twenty'}
twowords = {2:'twenty'
, 3:'thirty', 4:'forty'... | {
"repo_name": "fresky/ProjectEulerSolution",
"path": "017.py",
"copies": "1",
"size": "1208",
"license": "mit",
"hash": -306416977183477060,
"line_mean": 23.6734693878,
"line_max": 98,
"alpha_frac": 0.6100993377,
"autogenerated": false,
"ratio": 2.6666666666666665,
"config_test": false,
"has_... |
__author__ = 'dbaker'
import hashlib
import optparse
import os
from shutil import copyfile
def hashfile(filePath):
sha1 = hashlib.sha1()
f = open(filePath, 'rb')
try:
sha1.update(f.read())
finally:
f.close()
return sha1.hexdigest()
parser = optparse.OptionParser()
parser.add_o... | {
"repo_name": "daniebker/PyNewcopy",
"path": "CopyNewFiles.py",
"copies": "1",
"size": "1539",
"license": "mit",
"hash": 828405050522693200,
"line_mean": 30.4081632653,
"line_max": 96,
"alpha_frac": 0.604288499,
"autogenerated": false,
"ratio": 4.335211267605634,
"config_test": false,
"has_no... |
__author__ = 'dborysenko'
from pysphere import VIServer
from models import Vcenter
import ssl
def connect_vcenter(vcenter):
#default_context = ssl._create_default_https_context
server = VIServer()
try:
#ssl._create_default_https_context = ssl._create_unverified_context
server.connect(vcent... | {
"repo_name": "borisensx/ansiblePower",
"path": "vmware/vmvc.py",
"copies": "1",
"size": "1353",
"license": "mit",
"hash": 1349740994675121700,
"line_mean": 28.4130434783,
"line_max": 85,
"alpha_frac": 0.6614929786,
"autogenerated": false,
"ratio": 3.5793650793650795,
"config_test": false,
"h... |
__author__ = 'dcard'
from optparse import OptionParser
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ..preprocessing import label_reader
def main():
usage = "%prog dataset filename.csv"
parser = OptionParser(usage=usage)
(options, args) = parser.parse_args()
find_mos... | {
"repo_name": "dallascard/guac",
"path": "core/evaluation/find_most_errors.py",
"copies": "1",
"size": "1235",
"license": "apache-2.0",
"hash": -6092429443715663000,
"line_mean": 24.2040816327,
"line_max": 96,
"alpha_frac": 0.6510121457,
"autogenerated": false,
"ratio": 3.3651226158038146,
"con... |
__author__ = 'dcl9'
from render import render_template
import argparse
import yaml
def generate_preferences_track_dict(metadata):
d = dict()
d['track_name'] = metadata['track_name']
d['bigbed_url'] = metadata['track_filename']
d['short_label'] = '{} vs. {}'.format(metadata['proteins'][0], metadata['pro... | {
"repo_name": "Duke-GCB/TrackHubGenerator",
"path": "python/render/render_tracks.py",
"copies": "1",
"size": "1902",
"license": "mit",
"hash": -1480492012125097700,
"line_mean": 35.5769230769,
"line_max": 158,
"alpha_frac": 0.6366982124,
"autogenerated": false,
"ratio": 3.414721723518851,
"conf... |
__author__ = 'dc'
import uuid
import random
import tornado.web
import sae.kvdb
kv = sae.kvdb.KVClient()
op_set = ('up', 'down', 'left', 'right')
status_set = ('start', 'running', 'finish', 'failed')
main_info = '''<html>
<head>
<title>2048judge</title>
</head>
<body>
<p>welcome to 2048 ai judge</p>
<p>first use</... | {
"repo_name": "dccrazyboy/2048judge",
"path": "handler.py",
"copies": "1",
"size": "5231",
"license": "mit",
"hash": 9170223502177002000,
"line_mean": 26.5315789474,
"line_max": 83,
"alpha_frac": 0.4826992927,
"autogenerated": false,
"ratio": 3.2350030921459494,
"config_test": false,
"has_no_... |
__author__ = 'dcowden'
"""
Tests for CadQuery Selectors
These tests do not construct any solids, they test only selectors that query
an existing solid
"""
import math
import unittest,sys
import os.path
#my modules
from tests import BaseTest,makeUnitCube,makeUnitSquareWire
from cadquery import *
from ca... | {
"repo_name": "huskier/cadquery",
"path": "tests/TestCQSelectors.py",
"copies": "1",
"size": "17196",
"license": "apache-2.0",
"hash": 9137331437236900000,
"line_mean": 36.5480349345,
"line_max": 113,
"alpha_frac": 0.5377413352,
"autogenerated": false,
"ratio": 3.2052190121155637,
"config_test"... |
__author__ = 'ddeconti'
# Goes through fda approved drug list from Joe
# Scrapes wikipedia for the drug smiles
# Gets unique smiles string from set
# prints to screen for analysis outside script
import random
import re
import sys
import time
import wikipedia
from bs4 import BeautifulSoup
def scrape_for_smiles(name, ... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/file_manipulation/fda_approved_smiles_wikipedia_scrape.py",
"copies": "1",
"size": "2870",
"license": "mit",
"hash": -5231856349739147000,
"line_mean": 26.0754716981,
"line_max": 78,
"alpha_frac": 0.5843205575,
"autogenerated": false,... |
__author__ = 'ddeconti'
import base64
import numpy
import sys
import pickle
from io import BytesIO
from flask import Flask, render_template, request, make_response, send_file
from rdkit import DataStructs
from rdkit.Chem import AllChem, MolFromSmiles, Draw
#from app import app
app = Flask(__name__)
@app.route('/'... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "web_app_frontend/app/views.py",
"copies": "1",
"size": "2396",
"license": "mit",
"hash": 322642044279495600,
"line_mean": 26.5402298851,
"line_max": 75,
"alpha_frac": 0.5976627713,
"autogenerated": false,
"ratio": 3.422857142857143,
"config_test":... |
__author__ = 'ddeconti'
import FileHandler
import math
import numpy
import pickle
import sys
from bokeh.plotting import figure, output_file, show, HBox
from rdkit.Chem import AllChem, MolFromSmiles
def plot_scatter(x, y, title, x_label, y_label, color="red"):
plot = figure(x_axis_label=x_label,
... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/clustering/lregress_predicted_PAINS.py",
"copies": "1",
"size": "2788",
"license": "mit",
"hash": -3652999253744932400,
"line_mean": 31.0574712644,
"line_max": 77,
"alpha_frac": 0.581061693,
"autogenerated": false,
"ratio": 3.408312... |
__author__ = 'ddeconti'
import FileHandler
import matplotlib.pyplot as plt
import numpy
import sys
import scipy.cluster.hierarchy as hcluster
from bokeh.plotting import figure, output_file, show, VBox, HBox
from rdkit import DataStructs
from sklearn.decomposition.pca import PCA
def pca_plot(fp_list, clusters):
... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/clustering/hclust_PAINS.py",
"copies": "1",
"size": "1977",
"license": "mit",
"hash": 6109634984811112000,
"line_mean": 28.5223880597,
"line_max": 80,
"alpha_frac": 0.5897824987,
"autogenerated": false,
"ratio": 3.2094155844155843,
... |
__author__ = 'ddeconti'
import FileHandler
import numpy
import pickle
import random
import sys
from rdkit.Chem import AllChem, SDMolSupplier
from rdkit import Chem, DataStructs
from sklearn.cross_validation import train_test_split, StratifiedKFold
from sklearn.ensemble import RandomForestClassifier
def optimize_rf(t... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/classifier/random_forest_analysis.py",
"copies": "1",
"size": "4363",
"license": "mit",
"hash": 4448526765426525700,
"line_mean": 33.3622047244,
"line_max": 78,
"alpha_frac": 0.5340362136,
"autogenerated": false,
"ratio": 3.28786737... |
__author__ = 'ddeconti'
import FileHandler
import numpy
import random
import pickle
import sys
from rdkit import DataStructs
from rdkit.Chem import AllChem, SDMolSupplier
from sklearn.cross_validation import train_test_split
from sklearn.neighbors import KNeighborsClassifier
def optimize_knn(target_train, target_tes... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/classifier/knn_analysis.py",
"copies": "1",
"size": "3662",
"license": "mit",
"hash": -7822300753026449000,
"line_mean": 31.4159292035,
"line_max": 78,
"alpha_frac": 0.5674494812,
"autogenerated": false,
"ratio": 3.1487532244196044,... |
__author__ = 'ddeconti'
import FileHandler
import numpy
import random
import sys
from bokeh.plotting import figure, output_file, show, VBox, HBox
from rdkit import DataStructs
from rdkit.Chem import AllChem, SDMolSupplier
from sklearn.decomposition.pca import PCA
from sklearn.cross_validation import train_test_split
... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/clustering/pca_plots_on_fp.py",
"copies": "1",
"size": "3717",
"license": "mit",
"hash": -8352905608510267000,
"line_mean": 33.7476635514,
"line_max": 77,
"alpha_frac": 0.5881086898,
"autogenerated": false,
"ratio": 2.93370165745856... |
__author__ = 'ddeconti'
import FileHandler
import pickle
import sys
from bokeh.palettes import Blues9
from bokeh.plotting import output_file, figure, show, VBox, HBox
from bokeh.charts import Histogram, HeatMap
from rdkit import DataStructs
def similarity_compare(fp):
tanimoto_matrix = [[1] * len(fp)] * len(fp)
... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/classifier/basic_stats_plotting.py",
"copies": "1",
"size": "3480",
"license": "mit",
"hash": -36656988482466296,
"line_mean": 31.2314814815,
"line_max": 72,
"alpha_frac": 0.6060344828,
"autogenerated": false,
"ratio": 3.14647377938... |
__author__ = 'ddeconti'
import FileHandler
import random
import sys
from bokeh.charts import output_file, Histogram, show
from bokeh.models import Range1d
from rdkit.Chem.Fingerprints import FingerprintMols
from rdkit.Chem import AllChem, DataStructs, SDMolSupplier, Fingerprints
def randomly_pick_from_sdf(sdf_filen... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/classifier/histogram.py",
"copies": "1",
"size": "2269",
"license": "mit",
"hash": 6381512365689395000,
"line_mean": 27.7341772152,
"line_max": 72,
"alpha_frac": 0.6315557514,
"autogenerated": false,
"ratio": 2.950585175552666,
"c... |
__author__ = 'ddeconti'
import FileObjects
import random
import re
import sys
from rdkit.Chem import AllChem, MolFromSmiles
from rdkit.Chem.rdSLNParse import MolFromSLN
from rdkit.Chem import SDMolSupplier
class WikiScrapedDB():
'''
Custom wrapper around drug name - side effect counts - gene count - SMILES
... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/classifier/FileHandler.py",
"copies": "2",
"size": "8509",
"license": "mit",
"hash": -5555985953902499000,
"line_mean": 27.9421768707,
"line_max": 78,
"alpha_frac": 0.5233282407,
"autogenerated": false,
"ratio": 3.7435107787065554,
... |
__author__ = 'ddeconti'
import FileObjects
import re
import sys
from rdkit.Chem import AllChem, MolFromSmiles
from rdkit.Chem.rdSLNParse import MolFromSLN
from rdkit.Chem import SDMolSupplier
class WikiScrapedDB():
'''
Custom wrapper around drug name - side effect counts - gene count - SMILES
Produce a ... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/clustering/FileHandler.py",
"copies": "1",
"size": "7819",
"license": "mit",
"hash": 8171442052276227000,
"line_mean": 27.4327272727,
"line_max": 78,
"alpha_frac": 0.5223174319,
"autogenerated": false,
"ratio": 3.7537205952952473,
... |
__author__ = 'ddeconti'
import numpy
import pickle
from rdkit.Chem import AllChem, MolFromSmiles
from rdkit import DataStructs
import sys
def parse_smiles(rf, fda_filename):
try:
handle = open(fda_filename, 'rU')
except IOError:
sys.stderr.write("IOError\n")
sys.exit()
fpm_list = ... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/file_manipulation/filter_fda_for_PAINS.py",
"copies": "1",
"size": "1239",
"license": "mit",
"hash": 6310865192790266000,
"line_mean": 24.8125,
"line_max": 68,
"alpha_frac": 0.5528652139,
"autogenerated": false,
"ratio": 3.144670050... |
__author__ = 'ddeconti'
import pickle
import FileHandler
import sys
import numpy
import random
from bokeh.plotting import figure, output_file, show, VBox, HBox
from rdkit import DataStructs
from rdkit.Chem import AllChem, SDMolSupplier
def randomly_pick_from_sdf(sdf_filename):
sdf_struct = SDMolSupplier(sdf_fil... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/classifier/rf_roc.py",
"copies": "1",
"size": "2448",
"license": "mit",
"hash": 2386385120189677000,
"line_mean": 25.3225806452,
"line_max": 71,
"alpha_frac": 0.5477941176,
"autogenerated": false,
"ratio": 3.3534246575342466,
"con... |
__author__ = 'ddeconti'
import sys
def parse_chemicals(filename):
chem_dict = {}
try:
handle = open(filename, 'rU')
except IOError as e:
sys.stderr.write("IOError: " + str(e) +
"\nError in parse_chemicals()\n")
sys.exit()
for line in handle:
lin... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/classifier/build_promiscuity_index_from_stitch.py",
"copies": "1",
"size": "1600",
"license": "mit",
"hash": -8201000231034797000,
"line_mean": 27.5892857143,
"line_max": 62,
"alpha_frac": 0.54375,
"autogenerated": false,
"ratio": 3... |
__author__ = 'ddeconti'
'''
Compresses total drugs by number of interactions.
'''
import re
import sys
def print_drug(name, num):
print "Test", name, num
outstr = '\t'.join([name, str(num)])
sys.stdout.write(outstr + '\n')
def parse_chem(filename):
try:
handle = open(filename, 'rU')
ex... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/file_manipulation/compress_dsig_file.py",
"copies": "1",
"size": "1404",
"license": "mit",
"hash": 579136021452841900,
"line_mean": 23.224137931,
"line_max": 53,
"alpha_frac": 0.5092592593,
"autogenerated": false,
"ratio": 3.5816326... |
__author__ = 'ddeconti'
import FileHandler
import numpy
import sys
from bokeh.plotting import figure, output_file, show, VBox, HBox
from rdkit import DataStructs
from sklearn.cluster import DBSCAN
from sklearn.decomposition.pca import PCA
def train_pca(pains_fps, num_components=3):
'''
Dimensional reductio... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/clustering/dbscan_PAINS_pca.py",
"copies": "1",
"size": "1174",
"license": "mit",
"hash": -727271860407655800,
"line_mean": 23.9787234043,
"line_max": 74,
"alpha_frac": 0.6669505963,
"autogenerated": false,
"ratio": 3.15591397849462... |
__author__ = 'ddeconti'
import FileHandler
import numpy
import sys
from bokeh.plotting import figure, output_file, show, VBox, HBox
from rdkit import DataStructs
from sklearn.cluster import KMeans
from sklearn.decomposition.pca import PCA
from sklearn.metrics import silhouette_score
def train_pca(pains_fps, num_co... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/clustering/kmeans_clustering_of_pca_reduction.py",
"copies": "1",
"size": "4434",
"license": "mit",
"hash": -641481312068564,
"line_mean": 30.6714285714,
"line_max": 74,
"alpha_frac": 0.5906630582,
"autogenerated": false,
"ratio": 3... |
__author__ = 'ddeconti'
import FileHandler
import pandas
import random
import sys
from bokeh.palettes import Blues9
from bokeh.charts import HeatMap, output_file, show
from rdkit.Chem.Fingerprints import FingerprintMols
from rdkit.Chem import AllChem, DataStructs, SDMolSupplier, Fingerprints
def randomly_pick_from... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/classifier/heatmap.py",
"copies": "1",
"size": "2166",
"license": "mit",
"hash": -7639049572899019000,
"line_mean": 23.6136363636,
"line_max": 74,
"alpha_frac": 0.6108033241,
"autogenerated": false,
"ratio": 2.911290322580645,
"co... |
__author__ = 'ddeconti'
import random
import re
import sys
import time
import wikipedia
from bs4 import BeautifulSoup
'''
Scraping Wikipedia for SMILES for drugbank csv from Aqeel.
Deprecated...
'''
def scrape_for_smiles(name):
'''
Scrapes wikipedia for smiles string of given drug name
:param name: nam... | {
"repo_name": "dkdeconti/PAINS-train",
"path": "training_methods/file_manipulation/scrape_wikipedia_for_smiles.py",
"copies": "1",
"size": "3272",
"license": "mit",
"hash": 1241002158242353700,
"line_mean": 28.2142857143,
"line_max": 79,
"alpha_frac": 0.5861858191,
"autogenerated": false,
"ratio"... |
__author__ = 'ddurando'
"""
POX component - arpnat
The aim of this component is to address the problem of
ARP poisoning in SDN networks
"""
from pox.core import core
import pox.openflow.libopenflow_01 as of
from pox.lib.packet.ethernet import ethernet, ETHER_BROADCAST
from pox.lib.revent import *
from pox.lib.packet.... | {
"repo_name": "ddurando/pox.carp",
"path": "ext/mr_arpnat.py",
"copies": "2",
"size": "10608",
"license": "apache-2.0",
"hash": -5639258446158064000,
"line_mean": 38.4349442379,
"line_max": 167,
"alpha_frac": 0.5266779789,
"autogenerated": false,
"ratio": 3.7750889679715303,
"config_test": fals... |
__author__ = 'ddustin'
import certifi
import json
from threading import Thread, Condition
from urllib2 import Request, urlopen, URLError
from datetime import datetime, timedelta
class BtcPrice(Thread):
"""
A class for loading and caching the current Bitcoin exchange price.
There only needs to be one inst... | {
"repo_name": "cpacia/OpenBazaar-Server",
"path": "market/btcprice.py",
"copies": "2",
"size": "3402",
"license": "mit",
"hash": -2331751910465916000,
"line_mean": 31.4,
"line_max": 116,
"alpha_frac": 0.6058201058,
"autogenerated": false,
"ratio": 4.412451361867705,
"config_test": false,
"has... |
__author__ = 'ddustin'
import json
from threading import Thread, Condition
from urllib2 import Request, urlopen, URLError
from datetime import datetime, timedelta
class BtcPrice(Thread):
"""
A class for loading and caching the current Bitcoin exchange price.
There only needs to be one instance of the cla... | {
"repo_name": "tomgalloway/OpenBazaar-Server",
"path": "market/btcprice.py",
"copies": "2",
"size": "3363",
"license": "mit",
"hash": -2898122283335376400,
"line_mean": 31.3365384615,
"line_max": 116,
"alpha_frac": 0.6036277134,
"autogenerated": false,
"ratio": 4.430830039525691,
"config_test":... |
__author__ = 'ddustin'
import time
from twisted.trial import unittest
from market.btcprice import BtcPrice
class MarketProtocolTest(unittest.TestCase):
def test_BtcPrice(self):
btcPrice = BtcPrice()
btcPrice.start()
time.sleep(0.01)
rate = BtcPrice.instance().get("USD")
s... | {
"repo_name": "saltduck/OpenBazaar-Server",
"path": "market/tests/test_btcprice.py",
"copies": "6",
"size": "1644",
"license": "mit",
"hash": 1016538267848418700,
"line_mean": 27.8421052632,
"line_max": 56,
"alpha_frac": 0.6161800487,
"autogenerated": false,
"ratio": 3.4465408805031448,
"config... |
__author__ = 'Deathnerd'
import os
class Base():
"""Base Config"""
# General App
ENV = os.environ['CODENINJA_SERVER_ENV']
SECRET_KEY = os.environ['CODENINJA_SECRET_KEY']
APP_DIR = os.path.abspath(os.path.dirname(__file__))
PROJECT_ROOT = os.path.abspath(os.path.join(APP_DIR, os.pardir))
# SQLAlchemy
SQLALCHE... | {
"repo_name": "Deathnerd/iamacodeninja",
"path": "codeninja/settings.py",
"copies": "1",
"size": "1527",
"license": "mit",
"hash": -1301975894223493400,
"line_mean": 20.8285714286,
"line_max": 107,
"alpha_frac": 0.6810740013,
"autogenerated": false,
"ratio": 2.7464028776978417,
"config_test": f... |
__author__ = 'deathowl'
from datetime import datetime, timedelta
from notification.tasks import send_notifications
from openduty.escalation_helper import get_escalation_for_service
from django.utils import timezone
from notification.models import ScheduledNotification
from django.conf import settings
class Notifica... | {
"repo_name": "ustream/openduty",
"path": "notification/helper.py",
"copies": "1",
"size": "4337",
"license": "mit",
"hash": 340565767379853950,
"line_mean": 43.7113402062,
"line_max": 193,
"alpha_frac": 0.63707632,
"autogenerated": false,
"ratio": 4.4757481940144475,
"config_test": false,
"h... |
__author__ = 'deathowl'
from django.contrib.auth.models import User, Group
from rest_framework import serializers
from .models import Incident, SchedulePolicy, SchedulePolicyRule
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'username', 'e... | {
"repo_name": "ustream/openduty",
"path": "openduty/serializers.py",
"copies": "1",
"size": "1671",
"license": "mit",
"hash": 6162830010275109000,
"line_mean": 27.8103448276,
"line_max": 89,
"alpha_frac": 0.7175344105,
"autogenerated": false,
"ratio": 4.34025974025974,
"config_test": false,
"... |
__author__ = 'deathowl'
from django.http import HttpResponseRedirect
from django.template.response import TemplateResponse
from django.contrib.auth.decorators import login_required
from .models import Calendar, User, SchedulePolicy, SchedulePolicyRule
from django.http import Http404
from django.views.decorators.http ... | {
"repo_name": "ustream/openduty",
"path": "openduty/escalation.py",
"copies": "1",
"size": "3593",
"license": "mit",
"hash": -5912935396754181000,
"line_mean": 32.8962264151,
"line_max": 109,
"alpha_frac": 0.6462566101,
"autogenerated": false,
"ratio": 4.302994011976048,
"config_test": false,
... |
__author__ = 'deathowl'
from django.template.response import TemplateResponse
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.contrib import messages
from django.conf import settings
from .models import EventLog, Service
... | {
"repo_name": "ustream/openduty",
"path": "openduty/event_log.py",
"copies": "1",
"size": "1734",
"license": "mit",
"hash": -5969423230256968000,
"line_mean": 34.4081632653,
"line_max": 103,
"alpha_frac": 0.6770472895,
"autogenerated": false,
"ratio": 3.827814569536424,
"config_test": false,
... |
__author__ = 'deathowl'
from .models import User, SchedulePolicyRule, Service
from datetime import datetime, timedelta
from django.utils import timezone
from schedule.periods import Day
from datetime import timedelta
def get_current_events_users(calendar):
now = timezone.make_aware(datetime.now(), timezone.get_cu... | {
"repo_name": "ustream/openduty",
"path": "openduty/escalation_helper.py",
"copies": "1",
"size": "2229",
"license": "mit",
"hash": 3584086175892779000,
"line_mean": 37.4310344828,
"line_max": 103,
"alpha_frac": 0.6083445491,
"autogenerated": false,
"ratio": 3.9803571428571427,
"config_test": f... |
__author__ = 'deathowl'
from openduty import escalation_helper
from urllib import quote
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponseRedirect
from django.template.response import TemplateResponse
from django.contrib.auth.decorators impor... | {
"repo_name": "ustream/openduty",
"path": "openduty/schedules.py",
"copies": "1",
"size": "4463",
"license": "mit",
"hash": 8142238887594357000,
"line_mean": 36.1916666667,
"line_max": 110,
"alpha_frac": 0.6381357831,
"autogenerated": false,
"ratio": 4.214353163361662,
"config_test": false,
"... |
__author__ = 'deathowl'
from time import sleep, time
import datetime
from openduty.serializers import NoneSerializer
from openduty.models import Incident
from rest_framework.response import Response
from rest_framework import status
from rest_framework import viewsets
from .celery import add
from random import randint... | {
"repo_name": "ustream/openduty",
"path": "openduty/healthcheck.py",
"copies": "1",
"size": "1429",
"license": "mit",
"hash": 4214993582234910000,
"line_mean": 32.2325581395,
"line_max": 83,
"alpha_frac": 0.6655003499,
"autogenerated": false,
"ratio": 4.317220543806647,
"config_test": false,
... |
__author__ = 'deathowl'
import logging
from sleekxmpp import ClientXMPP
from sleekxmpp.xmlstream import resolver, cert
import ssl
class SendClient(ClientXMPP):
def verify_gtalk_cert(self, raw_cert):
hosts = resolver.get_SRV(self.boundjid.server, 5222,
self.dns_service,
... | {
"repo_name": "ustream/openduty",
"path": "notification/notifier/xmppclient.py",
"copies": "1",
"size": "1555",
"license": "mit",
"hash": 77150815012363540,
"line_mean": 32.1063829787,
"line_max": 86,
"alpha_frac": 0.5665594855,
"autogenerated": false,
"ratio": 3.926767676767677,
"config_test":... |
__author__ = 'deathowl'
import uuid
import hmac
from hashlib import sha1
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from django.contrib.auth.models import User
from uuidfield import UUIDField
from django.core.excep... | {
"repo_name": "ustream/openduty",
"path": "openduty/models.py",
"copies": "1",
"size": "7875",
"license": "mit",
"hash": 8096037636218187000,
"line_mean": 31.012195122,
"line_max": 141,
"alpha_frac": 0.6322539683,
"autogenerated": false,
"ratio": 3.9493480441323974,
"config_test": false,
"has... |
__author__ = 'Debanjan Mahata'
from twython import TwythonStreamer
from TwitterAuthentication import keyList
from time import sleep
from random import randint
import sys,codecs
# from pymongo import MongoClient
# #connecting to MongoDB database
# mongoObj = MongoClient()
# #setting the MongoDB database
# db = mongoOb... | {
"repo_name": "dxmahata/TwitterSentimentAnalysis",
"path": "TwitterDataCollect/StreamingTweetCollection.py",
"copies": "1",
"size": "1271",
"license": "mit",
"hash": -5928706288796709000,
"line_mean": 22.537037037,
"line_max": 110,
"alpha_frac": 0.6624704957,
"autogenerated": false,
"ratio": 3.68... |
__author__ = 'Debanjan Mahata'
import time
from twython import Twython, TwythonError
from pymongo import MongoClient
import TwitterAuthentication as t_auth
def collect_tweets(path_name):
emotion_sentiment_mapping = {"joy":"positive","sadness":"negative","anger":"negative","fear":"negative","disgust":"negative"... | {
"repo_name": "dxmahata/TwitterSentimentAnalysis",
"path": "TwitterDataCollect/collectEmotionLabeledTweets.py",
"copies": "1",
"size": "2078",
"license": "mit",
"hash": 9055417963577953000,
"line_mean": 27.8611111111,
"line_max": 129,
"alpha_frac": 0.6198267565,
"autogenerated": false,
"ratio": 3... |
__author__ = 'Debanjan Mahata'
import time
from twython import Twython, TwythonError
from pymongo import MongoClient
import TwitterAuthentication as t_auth
def collect_tweets(path_name):
try:
#connecting to MongoDB database
mongoObj = MongoClient()
#setting the MongoDB database
... | {
"repo_name": "dxmahata/TwitterSentimentAnalysis",
"path": "TwitterDataCollect/collectSentimentLabeledTweets.py",
"copies": "1",
"size": "1741",
"license": "mit",
"hash": 6342942335825776000,
"line_mean": 27.5409836066,
"line_max": 124,
"alpha_frac": 0.6341183228,
"autogenerated": false,
"ratio":... |
__author__ = 'Deedasmi'
import re
# User defined variables. And pi.
udv = {'pi': '3.1415926535'}
# User defined functions. And test function
udf = {'test': (('x', 'y'), "x+2/y")}
# Set of operators
OPERATORS = {"+", "-", "*", "/", "^", "%"}
# Set of all allowed symbols
ALLOWED_SYMBOLS = {"+", "-", "*", "/", "^", "%", ... | {
"repo_name": "Deedasmi/PyCalc",
"path": "pycalc/calc.py",
"copies": "1",
"size": "12456",
"license": "mit",
"hash": 3044726596956056600,
"line_mean": 35.4210526316,
"line_max": 116,
"alpha_frac": 0.5539499037,
"autogenerated": false,
"ratio": 4.09064039408867,
"config_test": false,
"has_no_k... |
__author__ = 'deevarvar'
import random
import unittest
import sys
import os
from subprocess import call
print os.getcwd()
current_path = os.path.dirname(os.path.realpath(__file__))
lib_path = current_path + "/../../utlib"
make_path = current_path + "/../../"
print 'lib path is ' + lib_path + ', make path is ' + make_p... | {
"repo_name": "deevarvar/myLab",
"path": "book/tlpi_zhiye/ch3/ut/ch3_ut.py",
"copies": "1",
"size": "1747",
"license": "mit",
"hash": 303608291389019300,
"line_mean": 25.8923076923,
"line_max": 102,
"alpha_frac": 0.6182026331,
"autogenerated": false,
"ratio": 3.425490196078431,
"config_test": t... |
__author__ = 'deevarvar'
"""
some idea from baidu's interview
1. this file is used to generate the some file template
three column
column1 column2 column3
chars chars(or empty) digits
try to use shell or python to finish
"""
import random
import string
def gen_seperator():
va... | {
"repo_name": "deevarvar/myLab",
"path": "interview/gen_file.py",
"copies": "1",
"size": "1140",
"license": "mit",
"hash": 8005731846400504000,
"line_mean": 23.2765957447,
"line_max": 108,
"alpha_frac": 0.6271929825,
"autogenerated": false,
"ratio": 3.229461756373938,
"config_test": false,
"h... |
__author__ = 'degorenko'
import rst2pdf
import docutils
def generate_rst(json_data):
f = open("report.rst", "w")
from email.Utils import formatdate
cur_time = formatdate(timeval=None, localtime=True)
write_headers(f, '{0} {1}{2}'.format("Dependency checker ", cur_time, "\n"), True)
write_parame... | {
"repo_name": "degorenko/dep_checker",
"path": "dep_checker/reporter/report.py",
"copies": "1",
"size": "3857",
"license": "apache-2.0",
"hash": -8420278302341125000,
"line_mean": 37.58,
"line_max": 94,
"alpha_frac": 0.5014259787,
"autogenerated": false,
"ratio": 3.708653846153846,
"config_test... |
__author__ = 'dejawa'
from docker import Client
import dockermanager.configure as conf
import psutil
import json
class MinionController:
conn = Client(base_url=conf.host+':'+conf.port)
#docker mongo db image create/start/stop/replset/sharding
def getAllContainers(self):
return self.conn.containers(... | {
"repo_name": "hoonkim/Lesser",
"path": "dockermanager/controller.py",
"copies": "1",
"size": "4602",
"license": "mit",
"hash": 3732284722979614700,
"line_mean": 29.4768211921,
"line_max": 80,
"alpha_frac": 0.5395480226,
"autogenerated": false,
"ratio": 3.8222591362126246,
"config_test": false,... |
__author__ = 'deksan'
import logging
import urllib
import feedparser
from flexget import plugin, validator
from flexget.entry import Entry
from flexget.event import event
from flexget.plugins.api_tvrage import lookup_series
log = logging.getLogger('newznab')
class Newznab(object):
"""
Newznab search plugi... | {
"repo_name": "v17al/Flexget",
"path": "flexget/plugins/search_newznab.py",
"copies": "1",
"size": "3959",
"license": "mit",
"hash": 6076613967725724000,
"line_mean": 33.4260869565,
"line_max": 115,
"alpha_frac": 0.5657994443,
"autogenerated": false,
"ratio": 3.9043392504930967,
"config_test": ... |
__author__ = 'delandtj'
from JumpScale import j
import os
import os.path
import subprocess
import sys
import time
command_name = sys.argv[0]
vsctl = "/usr/bin/ovs-vsctl"
ofctl = "/usr/bin/ovs-ofctl"
ip = "/sbin/ip"
ethtool = "/sbin/ethtool"
PHYSMTU = 2000
# TODO : errorhandling
def send_to_syslog(msg):
pass
... | {
"repo_name": "Jumpscale/jumpscale_core8",
"path": "lib/JumpScale/sal/openvswitch/VXNet/utils.py",
"copies": "1",
"size": "11295",
"license": "apache-2.0",
"hash": -8441063652891443000,
"line_mean": 33.8611111111,
"line_max": 112,
"alpha_frac": 0.6052235502,
"autogenerated": false,
"ratio": 3.127... |
__author__ = 'delandtj'
from vxlan import *
from netaddr import *
def rebuildVXLan():
nl = NetLayout()
layout = nl.load()
if __name__ == "__main__":
print('Getting Config')
a = NetLayout()
layout = a.load()
layout = a.nicdetail
pprint_dict(layout)
ip_layout = add_ips_to(layout)
# ... | {
"repo_name": "Jumpscale/jumpscale6_core",
"path": "lib/JumpScale/lib/ovsnetconfig/VXNet/tests.py",
"copies": "1",
"size": "1336",
"license": "bsd-2-clause",
"hash": 9030069150539202000,
"line_mean": 22.4385964912,
"line_max": 57,
"alpha_frac": 0.5950598802,
"autogenerated": false,
"ratio": 2.917... |
__author__ = 'delandtj'
from vxlan import *
from netaddr import *
def rebuildVXLan():
nl = NetLayout()
layout = nl.load()
if __name__ == "__main__":
print('Getting Config')
a = NetLayout()
layout = a.load()
layout = a.nicdetail
pprint_dict(layout)
ip_layout = add_ips_to(layout)
#... | {
"repo_name": "Jumpscale/jumpscale_core8",
"path": "lib/JumpScale/sal/openvswitch/VXNet/tests.py",
"copies": "1",
"size": "1331",
"license": "apache-2.0",
"hash": 4956388046200989000,
"line_mean": 22.350877193,
"line_max": 52,
"alpha_frac": 0.5972952667,
"autogenerated": false,
"ratio": 2.9317180... |
__author__ = 'delandtj'
from netaddr import *
from netclasses import *
from systemlist import *
command_name = sys.argv[0]
class NetLayout:
def __init__(self):
self.interfaces = get_all_ifaces()
self.nicdetail = {}
self.bridges = {}
def load(self):
self.nicdetail = get_nic_p... | {
"repo_name": "Jumpscale/jumpscale6_core",
"path": "lib/JumpScale/lib/ovsnetconfig/VXNet/vxlan.py",
"copies": "1",
"size": "3426",
"license": "bsd-2-clause",
"hash": 2163112171545138200,
"line_mean": 28.7913043478,
"line_max": 95,
"alpha_frac": 0.5528312901,
"autogenerated": false,
"ratio": 3.902... |
__author__ = 'delandtj'
from netaddr import *
from VXNet.netclasses import *
from VXNet.systemlist import *
command_name = sys.argv[0]
class NetLayout:
def __init__(self):
self.interfaces = get_all_ifaces()
self.nicdetail = {}
self.bridges = {}
def load(self):
self.nicdeta... | {
"repo_name": "Jumpscale/jumpscale_core8",
"path": "lib/JumpScale/sal/openvswitch/VXNet/vxlan.py",
"copies": "1",
"size": "3483",
"license": "apache-2.0",
"hash": 547517932346788000,
"line_mean": 28.7692307692,
"line_max": 84,
"alpha_frac": 0.5455067471,
"autogenerated": false,
"ratio": 3.9267192... |
__author__ = 'delandtj'
from utils import *
import fcntl
import time
import re
from netaddr import *
from utils import *
def acquire_lock(path):
"""
little tool to do EAGAIN until lockfile released
:param path:
:return: path
"""
lock_file = open(path, 'w')
while True:
send_to_syslog(... | {
"repo_name": "Jumpscale/jumpscale6_core",
"path": "lib/JumpScale/lib/ovsnetconfig/VXNet/systemlist.py",
"copies": "1",
"size": "9345",
"license": "bsd-2-clause",
"hash": -6103297761821517000,
"line_mean": 29.0482315113,
"line_max": 114,
"alpha_frac": 0.5472445158,
"autogenerated": false,
"ratio"... |
__author__ = 'delandtj'
from utils import *
class VXlan(object):
def __init__(self,oid,backend='vxbackend'):
def bytes(num):
return num >> 8, num & 0xFF
self.multicastaddr = '239.0.%s.%s' % bytes(oid.oid)
self.id = oid
self.backend = backend
self.name = 'vx-' +... | {
"repo_name": "Jumpscale/jumpscale6_core",
"path": "lib/JumpScale/lib/ovsnetconfig/VXNet/netclasses.py",
"copies": "1",
"size": "2587",
"license": "bsd-2-clause",
"hash": -6823635308117742000,
"line_mean": 25.1313131313,
"line_max": 77,
"alpha_frac": 0.5929648241,
"autogenerated": false,
"ratio":... |
__author__ = 'delandtj'
from VXNet.utils import *
import fcntl
import re
from netaddr import *
def acquire_lock(path):
"""
little tool to do EAGAIN until lockfile released
:param path:
:return: path
"""
lock_file = open(path, 'w')
while True:
send_to_syslog("attempting to acqu... | {
"repo_name": "Jumpscale/jumpscale_core8",
"path": "lib/JumpScale/sal/openvswitch/VXNet/systemlist.py",
"copies": "1",
"size": "9763",
"license": "apache-2.0",
"hash": -8516178205446831000,
"line_mean": 28.5848484848,
"line_max": 114,
"alpha_frac": 0.5375396907,
"autogenerated": false,
"ratio": 3... |
__author__ = 'delandtj'
from VXNet.utils import *
class VXlan:
def __init__(self, oid, backend='vxbackend'):
def bytes(num):
return num >> 8, num & 0xFF
self.multicastaddr = '239.0.%s.%s' % bytes(oid.oid)
self.id = oid
self.backend = backend
self.name = 'vx-' ... | {
"repo_name": "Jumpscale/jumpscale_core8",
"path": "lib/JumpScale/sal/openvswitch/VXNet/netclasses.py",
"copies": "1",
"size": "2582",
"license": "apache-2.0",
"hash": -8023947589560889000,
"line_mean": 20.5166666667,
"line_max": 78,
"alpha_frac": 0.5836560806,
"autogenerated": false,
"ratio": 3.... |
__author__ = 'delandtj'
import os
import os.path
import subprocess
import sys
import syslog
import time
command_name = sys.argv[0]
vsctl = "/usr/bin/ovs-vsctl"
ofctl = "/usr/bin/ovs-ofctl"
ip = "/sbin/ip"
ethtool = "/sbin/ethtool"
PHYSMTU = 2000
# TODO : errorhandling
def send_to_syslog(msg):
pass
#print ms... | {
"repo_name": "Jumpscale/jumpscale6_core",
"path": "lib/JumpScale/lib/ovsnetconfig/VXNet/utils.py",
"copies": "1",
"size": "8985",
"license": "bsd-2-clause",
"hash": 1908044100854457000,
"line_mean": 33.2938931298,
"line_max": 166,
"alpha_frac": 0.6208124652,
"autogenerated": false,
"ratio": 3.04... |
from __future__ import absolute_import, unicode_literals
from django import forms
from django.forms.formsets import BaseFormSet
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, ButtonHolder, Submit, Fieldset, HTML, MultiField, Div, Field
from django.contrib.auth import get_user_model
... | {
"repo_name": "ajay2611/mmb",
"path": "mmb_repo/bands/forms.py",
"copies": "1",
"size": "4801",
"license": "bsd-3-clause",
"hash": 2665529842853038600,
"line_mean": 40.0341880342,
"line_max": 125,
"alpha_frac": 0.6084149136,
"autogenerated": false,
"ratio": 3.884304207119741,
"config_test": fal... |
__author__ = "Dell-Ray Sackett"
__version__ = "0.1"
import pickle
from Crypto.PublicKey import RSA
from Crypto.Hash import SHA256
from Crypto.Cipher import AES
from Crypto import Random
import base64
class Message:
"""
This is a class to hold an encrypted message. It is specifically
designed to be pickel... | {
"repo_name": "lospheris/steganographer",
"path": "message.py",
"copies": "1",
"size": "8337",
"license": "mit",
"hash": 5174927510728330000,
"line_mean": 33.5933609959,
"line_max": 104,
"alpha_frac": 0.6280436608,
"autogenerated": false,
"ratio": 4.494339622641509,
"config_test": false,
"has... |
__author__ = 'demi'
# By Ashwath from forums
# Given a list of lists representing a n * n matrix as input,
# define a procedure that returns True if the input is an identity matrix
# and False otherwise.
# An IDENTITY matrix is a square matrix in which all the elements
# on the principal/main diagonal are 1 and all ... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson03/is_identity_matrix.py",
"copies": "1",
"size": "1735",
"license": "mit",
"hash": -6356846708647035000,
"line_mean": 19.6666666667,
"line_max": 74,
"alpha_frac": 0.5187319885,
"autogenerated": false,
"ratio": 2.935... |
__author__ = 'demi'
import string
# Write a procedure, rotate which takes as its input a string of lower case
# letters, a-z, and spaces, and an integer n, and returns the string constructed
# by shifting each of the letters n steps, and leaving the spaces unchanged.
# Note that 'a' follows 'z'. You can use an additio... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson05/Rotate.py",
"copies": "1",
"size": "1167",
"license": "mit",
"hash": -4900166669832249000,
"line_mean": 26.1627906977,
"line_max": 80,
"alpha_frac": 0.618680377,
"autogenerated": false,
"ratio": 3.2416666666666667... |
__author__ = 'demi'
# 1 Gold Star
# The built-in <string>.split() procedure works
# okay, but fails to find all the words on a page
# because it only uses whitespace to split the
# string. To do better, we should also use punctuation
# marks to split the page into words.
# Define a procedure, split_string, that tak... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson04/split_string.py",
"copies": "1",
"size": "1487",
"license": "mit",
"hash": -1974656770260861700,
"line_mean": 32.0666666667,
"line_max": 81,
"alpha_frac": 0.6213853396,
"autogenerated": false,
"ratio": 3.540476190... |
__author__ = 'demi'
# 2 Gold Stars
# One way search engines rank pages
# is to count the number of times a
# searcher clicks on a returned link.
# This indicates that the person doing
# the query thought this was a useful
# link for the query, so it should be
# higher in the rankings next time.
# (In Unit 6, we wil... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson04/Counting clicks.py",
"copies": "1",
"size": "4532",
"license": "mit",
"hash": 8789291507669038000,
"line_mean": 29.6283783784,
"line_max": 87,
"alpha_frac": 0.6206972639,
"autogenerated": false,
"ratio": 3.2769342... |
__author__ = 'demi'
# 6. In video 28. Update, it was suggested that some of the duplicate code in
# lookup and update could be avoided by a better design. We can do this by
# defining a procedure that finds the entry corresponding to a given key, and
# using that in both lookup and update.
# Here are the original p... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson05/Refactoring.py",
"copies": "1",
"size": "2359",
"license": "mit",
"hash": 1393976746018527000,
"line_mean": 33.6911764706,
"line_max": 81,
"alpha_frac": 0.7108944468,
"autogenerated": false,
"ratio": 3.46402349486... |
__author__ = 'demi'
# A list is symmetric if the first row is the same as the first column,
# the second row is the same as the second column and so on. Write a
# procedure, symmetric, which takes a list as input, and returns the
# boolean True if the list is symmetric and False if it is not.
def symmetric(lists):
... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson03/symmetric.py",
"copies": "1",
"size": "1473",
"license": "mit",
"hash": 2356242675527159000,
"line_mean": 25.3214285714,
"line_max": 82,
"alpha_frac": 0.4976238968,
"autogenerated": false,
"ratio": 3.5408653846153... |
__author__ = 'demi'
# By Dimitris_GR from forums
# Modify Problem Set 31's (Optional) Symmetric Square to return True
# if the given square is antisymmetric and False otherwise.
# An nxn square is called antisymmetric if A[i][j]=-A[j][i]
# for each i=0,1,...,n-1 and for each j=0,1,...,n-1.
def antisymmetric(A):
... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson03/antisymmetric.py",
"copies": "1",
"size": "1066",
"license": "mit",
"hash": 8649133717669489000,
"line_mean": 20.7755102041,
"line_max": 68,
"alpha_frac": 0.4240150094,
"autogenerated": false,
"ratio": 3.144542772... |
__author__ = 'demi'
# Define a procedure,
#
# hashtable_add(htable,key,value)
#
# that adds the key to the hashtable (in
# the correct bucket), with the correct
# value and returns the new hashtable.
#
# (Note that the video question and answer
# do not return the hashtable, but your code
# should do this to pas... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson05/Adding Keywords.py",
"copies": "1",
"size": "1225",
"license": "mit",
"hash": -2600142782262828000,
"line_mean": 25.6304347826,
"line_max": 72,
"alpha_frac": 0.6530612245,
"autogenerated": false,
"ratio": 2.790432... |
__author__ = 'demi'
# Define a procedure,
# hashtable_lookup(htable,key)
# that takes two inputs, a hashtable
# and a key (string),
# and returns the value associated
# with that key.
def hashtable_lookup(htable, key):
bucket = hashtable_get_bucket(htable, key)
index_item = None
for item in bucket:
... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson05/Lookup.py",
"copies": "1",
"size": "1166",
"license": "mit",
"hash": -797689363073214300,
"line_mean": 20.2,
"line_max": 75,
"alpha_frac": 0.614922813,
"autogenerated": false,
"ratio": 2.9370277078085643,
"confi... |
__author__ = 'demi'
# Define a procedure,
# hashtable_update(htable,key,value)
# that updates the value associated with key. If key is already in the
# table, change the value to the new value. Otherwise, add a new entry
# for the key and value.
# Hint: Use hashtable_lookup as a starting point.
# Make sure that yo... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson05/Update.py",
"copies": "1",
"size": "1718",
"license": "mit",
"hash": -48380783061770296,
"line_mean": 25.4307692308,
"line_max": 75,
"alpha_frac": 0.6094295693,
"autogenerated": false,
"ratio": 3.008756567425569,
... |
__author__ = 'demi'
# define a procedure that takes in a string of numbers from 1-9 and
# outputs a list with the following parameters:
# Every number in the string should be inserted into the list.
# If a number x in the string is less than or equal
# to the preceding number y, the number x should be inserted
# into... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson03/numbers_in_lists.py",
"copies": "1",
"size": "1607",
"license": "mit",
"hash": 8659992919514006000,
"line_mean": 27.6964285714,
"line_max": 67,
"alpha_frac": 0.5948973242,
"autogenerated": false,
"ratio": 3.313402... |
__author__ = 'demi'
# Dictionaries of Dictionaries (of Dictionaries)
# The next several questions concern the data structure below for keeping
# track of Udacity's courses (where all of the values are strings):
# { <hexamester>, { <class>: { <property>: <value>, ... },
# ... }... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson05/Involved.py",
"copies": "1",
"size": "3674",
"license": "mit",
"hash": -3867942097067552000,
"line_mean": 34.6699029126,
"line_max": 80,
"alpha_frac": 0.5038105607,
"autogenerated": false,
"ratio": 4.0418041804180... |
__author__ = 'demi'
# Double Gold Star
# Khayyam Triangle
# The French mathematician, Blaise Pascal, who built a mechanical computer in
# the 17th century, studied a pattern of numbers now commonly known in parts of
# the world as Pascal's Triangle (it was also previously studied by many Indian,
# Chinese, and Pers... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson06/Khayyam Triangle.py",
"copies": "1",
"size": "1635",
"license": "mit",
"hash": -3550361104564382000,
"line_mean": 24.9682539683,
"line_max": 82,
"alpha_frac": 0.5431192661,
"autogenerated": false,
"ratio": 3.20588... |
__author__ = 'demi'
#Feeling Lucky
#In Unit 6, we implemented a page ranking algorithm, but didn't finish the final
#step of using it to improve our search results. For this question, you will use
#the page rankings to produce the best output for a given query.
#Define a procedure, lucky_search, that takes as input... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson06/Feeling Lucky.py",
"copies": "1",
"size": "5297",
"license": "mit",
"hash": -6536172430794465000,
"line_mean": 20.8884297521,
"line_max": 89,
"alpha_frac": 0.6237492921,
"autogenerated": false,
"ratio": 2.77475117... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.