text stringlengths 0 1.05M | meta dict |
|---|---|
import math
class Heap:
class Node:
def __init__(self, data=None, key=None):
_data = data
_key = key
def __init__(self):
self._heap = []
self._size = 0
self._isHeap = True
def _boundsCheck(func):
def wrapper(self, *args):
if self._size == 0:
... | {
"repo_name": "JDNdeveloper/Interview-Practice-Python",
"path": "src/Heap.py",
"copies": "1",
"size": "3268",
"license": "mit",
"hash": 8600484854471156000,
"line_mean": 22.3428571429,
"line_max": 63,
"alpha_frac": 0.5492656059,
"autogenerated": false,
"ratio": 3.611049723756906,
"config_test":... |
import sys
from collections import Counter
from heapq import heappush, heappop, heapify
from GraphADT import Graph
def BFS(graph, root):
distance = {}
parent = {}
for node in graph.nodes:
distance[node] = sys.maxsize
parent[node] = None
queue = []
distance[root] = 0
queue.append(root)
... | {
"repo_name": "JDNdeveloper/Interview-Practice-Python",
"path": "src/GraphSearch.py",
"copies": "1",
"size": "4623",
"license": "mit",
"hash": -4953303596000252000,
"line_mean": 27.3619631902,
"line_max": 78,
"alpha_frac": 0.5595933377,
"autogenerated": false,
"ratio": 2.980657640232108,
"confi... |
import socket
import json
import threading
import os
delim = '.,.'
def encode( data ):
return bytes( json.dumps( data ) + delim, 'utf-8' )
def decode( data ):
stringBuffer = data.decode( 'utf-8' )[:-3]
return [ json.loads( x ) for x in stringBuffer.split( delim ) ]
def smartDecode( D_BUFFER, data ):
st... | {
"repo_name": "JDNdeveloper/EZ-TCP-Messenger",
"path": "src-python3/ezTCPlib.py",
"copies": "1",
"size": "3217",
"license": "mit",
"hash": 3844883894023407600,
"line_mean": 25.5867768595,
"line_max": 67,
"alpha_frac": 0.531240286,
"autogenerated": false,
"ratio": 3.5274122807017543,
"config_tes... |
import socket
import json
import threading
import os
delim = '.,.'
def encode( data ):
return json.dumps( data ) + delim
def decode( data ):
stringBuffer = data[:-3]
return [ json.loads( x ) for x in stringBuffer.split( delim ) ]
def smartDecode( D_BUFFER, data ):
stringBuffer = D_BUFFER.decode( 'utf-8... | {
"repo_name": "JDNdeveloper/EZ-TCP-Messenger",
"path": "src-python2/ezTCPlib.py",
"copies": "1",
"size": "3172",
"license": "mit",
"hash": -4862807244125563000,
"line_mean": 25.2148760331,
"line_max": 67,
"alpha_frac": 0.5334174023,
"autogenerated": false,
"ratio": 3.5680539932508437,
"config_t... |
__author__ = 'Jay Modi'
import json
from django.conf import settings
from django.views.decorators.csrf import ensure_csrf_cookie, csrf_exempt
from django.contrib.auth.models import User, AnonymousUser
from django.db import transaction
from django.contrib.auth.decorators import login_required
from django.views.decorat... | {
"repo_name": "mjrulesamrat/django-edx-courseware",
"path": "django-edx-courseware/views.py",
"copies": "1",
"size": "5302",
"license": "mit",
"hash": -408843036703795260,
"line_mean": 37.4275362319,
"line_max": 109,
"alpha_frac": 0.6416446624,
"autogenerated": false,
"ratio": 4.360197368421052,
... |
__author__ = 'Jay Modi'
import logging
import json
from xmodule.modulestore.django import modulestore
# ORA imports
from openassessment.workflow.models import AssessmentWorkflow
from student.models import CourseAccessRole
from django.core.mail import EmailMessage
from openedx.core.djangoapps.content.course_overviews.... | {
"repo_name": "mjrulesamrat/django-edx-courseware",
"path": "django-edx-courseware/tasks.py",
"copies": "1",
"size": "4644",
"license": "mit",
"hash": 188258391137596800,
"line_mean": 44.5294117647,
"line_max": 117,
"alpha_frac": 0.5079672696,
"autogenerated": false,
"ratio": 4.998923573735199,
... |
__author__ = 'jay'
import requests
import csv
import random
def get_slugs():
url = "https://dataclips.heroku.com/empnpduodrmkvhdsvhhlfhjqkzto.json"
rows = requests.get(url).json()["values"]
slugs = [row[0] for row in rows]
return slugs
def get_awards(slug):
url = "https://impactstory.org/profile... | {
"repo_name": "Impactstory/total-impact-webapp",
"path": "scripts/all_profiles.py",
"copies": "2",
"size": "1340",
"license": "mit",
"hash": -2554983344496212500,
"line_mean": 19.6153846154,
"line_max": 74,
"alpha_frac": 0.5858208955,
"autogenerated": false,
"ratio": 3.1235431235431235,
"config... |
__author__ = 'jay'
from pathlib import Path
import os
import json
import requests
data_dir = Path(__file__, "../../data").resolve()
usernames_path = Path(data_dir, "github_usernames.json")
users_path = Path(data_dir, "github_users.json")
users_url_template = "https://api.github.com/users/%s"
class RateLimitExceptio... | {
"repo_name": "total-impact/software",
"path": "scripts/github_users.py",
"copies": "3",
"size": "2346",
"license": "mit",
"hash": -8253431630091124000,
"line_mean": 24.2258064516,
"line_max": 94,
"alpha_frac": 0.6167945439,
"autogenerated": false,
"ratio": 3.455081001472754,
"config_test": fal... |
__author__ = 'Jayson Stemmler'
__created__ = "5/14/15 3:37 PM"
import numpy as np
import sys
from math import atan2
class ProgressBar(object):
"""Prints a status bar for longer loop operations
Currently does not work. I will update
when it actually works properly.
"""
def __init__(self, **kwarg... | {
"repo_name": "jstemmler/toolbox",
"path": "toolbox/tools.py",
"copies": "1",
"size": "2405",
"license": "mit",
"hash": 7808815810100147000,
"line_mean": 23.05,
"line_max": 76,
"alpha_frac": 0.5438669439,
"autogenerated": false,
"ratio": 3.3035714285714284,
"config_test": false,
"has_no_keywo... |
__author__ = 'Jayson Stemmler'
__created__ = "6/2/15 12:25 PM"
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import pandas as pd
from ..tools import percentile
# Seaborn really shouldn't be in the package...
# import seaborn as sns
# sns.set_style('darkgrid')
def filled_series(data, points=(... | {
"repo_name": "jstemmler/toolbox",
"path": "toolbox/plotting/series.py",
"copies": "1",
"size": "2033",
"license": "mit",
"hash": 8104737088021788000,
"line_mean": 30.765625,
"line_max": 80,
"alpha_frac": 0.5602557796,
"autogenerated": false,
"ratio": 3.1765625,
"config_test": false,
"has_no_... |
__author__ = 'Jayson Stemmler'
__created__ = "6/5/15 7:49 AM"
"""
This set of tools is really just specific to doing some of the
analysis for the Low CCN project, such as grouping and classifying
events based on CCN data.
In addition, there are a couple of plots that are specific to the
Low CCN st... | {
"repo_name": "jstemmler/toolbox",
"path": "toolbox/low_ccn_tools.py",
"copies": "1",
"size": "6414",
"license": "mit",
"hash": -596026334654955500,
"line_mean": 31.07,
"line_max": 92,
"alpha_frac": 0.5709385719,
"autogenerated": false,
"ratio": 3.5397350993377485,
"config_test": false,
"has_... |
__author__ = 'Jayson Stemmler'
__created__ = "6/5/15 7:52 AM"
"""
EQUATIONS
"""
def qsatw(t, p):
"""saturated vapor pressure with respect to water.
use functions given in Unified Model Documentation No. 29
Calculation of saturated specific humidity and large scale cloud.
RNB Smith et al. 1990
... | {
"repo_name": "jstemmler/toolbox",
"path": "toolbox/equations.py",
"copies": "1",
"size": "2542",
"license": "mit",
"hash": -5172421759137593000,
"line_mean": 20.0165289256,
"line_max": 69,
"alpha_frac": 0.5334382376,
"autogenerated": false,
"ratio": 2.5394605394605394,
"config_test": false,
... |
__author__ = 'Jayson Stemmler'
__created__ = "6/9/15 11:20 AM"
import numpy as np
from netCDF4 import Dataset, num2date
def pick_ecmwf_point(f, v, at=None, LAT=None, LON=None):
at_times = np.array(at, ndmin=1)
vout = np.zeros_like(at_times, dtype=float) * np.nan
def shiftlon(l):
if 0 <= l <= 180... | {
"repo_name": "jstemmler/toolbox",
"path": "toolbox/fileIO/ECMWF.py",
"copies": "1",
"size": "1905",
"license": "mit",
"hash": -8535256250098444000,
"line_mean": 29.7258064516,
"line_max": 85,
"alpha_frac": 0.4677165354,
"autogenerated": false,
"ratio": 3.383658969804618,
"config_test": false,
... |
__author__ = "Jayson Stemmler"
import os
import glob
import warnings
import numpy as np
import pandas as pd
import tables
from netCDF4 import Dataset, num2date
# from ..tools import ProgressBar
class VariableError(Exception):
"""Generic Variable Error exception class"""
pass
class VariableWarning(Warning... | {
"repo_name": "jstemmler/toolbox",
"path": "toolbox/fileIO/netCDF.py",
"copies": "1",
"size": "12935",
"license": "mit",
"hash": -7036048541311524000,
"line_mean": 34.6336088154,
"line_max": 109,
"alpha_frac": 0.5595670661,
"autogenerated": false,
"ratio": 4.510111576011157,
"config_test": fals... |
__author__ = 'Jay (XP016283)'
'''
Instead of the avetest/bin/ave-test/download-rom bash
This script is used for run the ave based mtbf, ui, endurance and performance test.
'''
import os
import util_test
import subprocess
from termcolor import colored
import sys
sys.path.append(util_test.ENVCFG_PATH)
import shutil
#im... | {
"repo_name": "MarcusChang/Repo-FoxRUN",
"path": "FoxRUN/fabric-task-runner/test-exec-task/ave-test/download_rom.py",
"copies": "1",
"size": "3091",
"license": "mpl-2.0",
"hash": 8822234365059164000,
"line_mean": 38.1265822785,
"line_max": 187,
"alpha_frac": 0.6512455516,
"autogenerated": false,
... |
__author__ = 'jbjohnso'
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2014 Lenovo Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/license... | {
"repo_name": "jjohnson42/confluent",
"path": "confluent_client/confluent/termhandler.py",
"copies": "6",
"size": "2063",
"license": "apache-2.0",
"hash": -4260418052777237500,
"line_mean": 30.7538461538,
"line_max": 74,
"alpha_frac": 0.6277266117,
"autogenerated": false,
"ratio": 4.2623966942148... |
__author__ = 'jbosley2'
__author__ = 'Josh Allen Bosley'
import sql_settings as SQLS
import sql_selects as SELECT
import sql_inserts as INSERT
import sql_updates as UPDATE
import sql_admin as ADMIN
import urllib2
def internet_on():
try:
response=urllib2.urlopen('http://10.1.0.83',timeout=1)
... | {
"repo_name": "LSSUHDTeam/ReservationServer",
"path": "request_handler.py",
"copies": "1",
"size": "3841",
"license": "mit",
"hash": 1114926726789195500,
"line_mean": 24.8601398601,
"line_max": 73,
"alpha_frac": 0.4550898204,
"autogenerated": false,
"ratio": 4.175,
"config_test": false,
"has_... |
__author__ = 'jbosley2'
import settings
import SocketServer
import request_handler
# Query information
recognized_queries = ['u', 'i', 's', 'g', 'a'] # update, insert, select, generate
recent_queries = []
max_stored_queries = 25
class TCPConnectionHandler(SocketServer.BaseRequestHandler):
def ha... | {
"repo_name": "LSSUHDTeam/SalesServer",
"path": "server.py",
"copies": "1",
"size": "1335",
"license": "mit",
"hash": 2578298426251226600,
"line_mean": 23.2264150943,
"line_max": 84,
"alpha_frac": 0.6389513109,
"autogenerated": false,
"ratio": 3.9732142857142856,
"config_test": false,
"has_no... |
__author__ = 'jbosley2'
import datetime
import settings as SQLS
# Range of dates
def select_receipts_by_descriptor(range, switch):
info = []
first_date = range.split("|")[0]
second_date = range.split("|")[1]
query = ""
if switch == "1":
query = ("SELECT * FROM receipts "
... | {
"repo_name": "LSSUHDTeam/SalesServer",
"path": "sql_selects.py",
"copies": "1",
"size": "6232",
"license": "mit",
"hash": -3941365203667727400,
"line_mean": 26.0720720721,
"line_max": 116,
"alpha_frac": 0.4845956354,
"autogenerated": false,
"ratio": 3.7838494231936854,
"config_test": false,
... |
__author__ = 'jbosley2'
import MySQLdb
import datetime
# ================== [ SQL SERVER SETTINGS ] =================
settings = []
with open('server_settings.txt') as fp:
for line in fp:
line = line.split("=")
settings.append(line[1].strip('\n'))
fp.close()
HOST = settings[0]
PORT ... | {
"repo_name": "LSSUHDTeam/SalesServer",
"path": "settings.py",
"copies": "1",
"size": "1197",
"license": "mit",
"hash": -8661639710653687000,
"line_mean": 19.4107142857,
"line_max": 71,
"alpha_frac": 0.5538847118,
"autogenerated": false,
"ratio": 3.3342618384401113,
"config_test": false,
"has... |
__author__ = 'jbosley2'
import settings as SQLS
def new_receipt(data):
info = []
cells = data.split("|")
# Create Receipt
SQLS.db_update(
"INSERT INTO receipts "
"(dateCreated, seller, firstName, lastName, itemsSold, totalPrice,"
" description, deptCode, transact... | {
"repo_name": "LSSUHDTeam/SalesServer",
"path": "sql_inserts.py",
"copies": "1",
"size": "2523",
"license": "mit",
"hash": 8513848413138615000,
"line_mean": 28.0595238095,
"line_max": 120,
"alpha_frac": 0.5247720967,
"autogenerated": false,
"ratio": 3.494459833795014,
"config_test": false,
"h... |
__author__ = 'jbosley2'
import settings as SQLS
def update_receipt_by_id(request):
info = []
cells = request[2].split("|")
original_data = SQLS.db_fetch("SELECT * FROM receipts WHERE receiptId = %s;" % cells[0])[0]
# Add quantities to inventory of items originally on receipt
for el ... | {
"repo_name": "LSSUHDTeam/SalesServer",
"path": "sql_updates.py",
"copies": "1",
"size": "4336",
"license": "mit",
"hash": -6572545484050393000,
"line_mean": 32.688,
"line_max": 114,
"alpha_frac": 0.5306734317,
"autogenerated": false,
"ratio": 3.763888888888889,
"config_test": false,
"has_no_... |
__author__ = 'jbosley2'
import sql_selects as SELECT
import sql_inserts as INSERT
import sql_updates as UPDATE
def request_handler(request):
info = []
# ===================[ SELECT QUERIES ]===================
if request[0] == 's':
# Select All Receipts
if request[1] == 'a... | {
"repo_name": "LSSUHDTeam/SalesServer",
"path": "request_handler.py",
"copies": "1",
"size": "2357",
"license": "mit",
"hash": 3665225597056200000,
"line_mean": 23.9010989011,
"line_max": 79,
"alpha_frac": 0.4946966483,
"autogenerated": false,
"ratio": 3.659937888198758,
"config_test": false,
... |
__author__ = 'jbosley2'
import sql_settings as SQLS
import routines as ROUTINES
import sql_inserts as INSERTS
def update_delivery_set_delivered(request):
SQLS.db_update("UPDATE reservations SET deliveredBy = '%s', timeDelivered = '%s' WHERE resId = %s;" %
(request[3], request[4], requ... | {
"repo_name": "joshbosley/ReservationServer",
"path": "sql_updates.py",
"copies": "2",
"size": "8691",
"license": "mit",
"hash": -3441027028360505300,
"line_mean": 32.6334661355,
"line_max": 116,
"alpha_frac": 0.5586238638,
"autogenerated": false,
"ratio": 4.122865275142315,
"config_test": fals... |
__author__ = 'jbosley2'
import sql_settings as SQLS
import routines as ROUTINES
def insert_new_delivery_location(data):
SQLS.db_update("INSERT INTO rooms (roomName) VALUES ('%s');" % data)
SQLS.output_update_to_screen("Created new delivery destination . . . . . ")
return "1"
def insert_... | {
"repo_name": "joshbosley/ReservationServer",
"path": "sql_inserts.py",
"copies": "2",
"size": "6523",
"license": "mit",
"hash": -4646862859738800000,
"line_mean": 34.25,
"line_max": 114,
"alpha_frac": 0.6092288824,
"autogenerated": false,
"ratio": 3.7858386535113175,
"config_test": false,
"h... |
__author__ = 'jbosley2'
import sql_settings as SQLS
import sql_selects as SELECT
import sql_inserts as INSERT
def admin_check_login(request):
user_id = SQLS.db_fetch("SELECT username FROM userAccess WHERE username = '%s';" % request[2])
if len(user_id) > 0:
user_id = user_id[0][0]
pa... | {
"repo_name": "joshbosley/ReservationServer",
"path": "sql_admin.py",
"copies": "2",
"size": "6774",
"license": "mit",
"hash": 1080006158493995500,
"line_mean": 29.6542056075,
"line_max": 120,
"alpha_frac": 0.5081192796,
"autogenerated": false,
"ratio": 3.848863636363636,
"config_test": false,
... |
__author__ = 'jbosley2'
import sql_settings as SQLS
def select_future_deliveries():
info = []
info_get = SQLS.db_fetch(
"select * from reservations where DATE(resStart) = CURDATE() AND deliveredBy = 'NA' ORDER BY resStart;")
try:
for el in info_get:
for ell in e... | {
"repo_name": "joshbosley/ReservationServer",
"path": "sql_selects.py",
"copies": "1",
"size": "4860",
"license": "mit",
"hash": 4234208056842360300,
"line_mean": 23.5789473684,
"line_max": 123,
"alpha_frac": 0.5082304527,
"autogenerated": false,
"ratio": 3.726993865030675,
"config_test": false... |
__author__ = 'jbowman'
# https://pythonspot.com/objects-and-classes/
class User:
name = ""
def __init__(self, name):
self.name = name
def sayHello(self):
print('Hello, my name is ' + self.name)
def sayGoodbye(self):
print(self.name + ': Goodybe!')
james = User('James')
davi... | {
"repo_name": "deo1/deo1",
"path": "Legacy/PythonTutorial/13ObjectsClasses.py",
"copies": "1",
"size": "1196",
"license": "mit",
"hash": 3030089210530339300,
"line_mean": 17.9841269841,
"line_max": 49,
"alpha_frac": 0.5752508361,
"autogenerated": false,
"ratio": 3.1473684210526316,
"config_test... |
__author__ = 'jbowman'
# https://pythonspot.com/poylmorphism/
class Bear(object):
def sound(self):
print("Groarrr")
class Dog(object):
def sound(self):
print("Ruffff")
def makeSound(animalType):
animalType.sound()
bearObj = Bear()
dogObj = Dog()
makeSound(bearObj)
makeSound(dogObj)
cl... | {
"repo_name": "deo1/deo1",
"path": "Legacy/PythonTutorial/17Polymorphism.py",
"copies": "1",
"size": "1509",
"license": "mit",
"hash": 49404665924634250,
"line_mean": 19.12,
"line_max": 80,
"alpha_frac": 0.6156394964,
"autogenerated": false,
"ratio": 3.1835443037974684,
"config_test": false,
... |
#A simple program used to make a color-changing orb
#Requires the Panda3D game engine to run
import direct.directbase.DirectStart
from panda3d.core import AmbientLight,DirectionalLight
from panda3d.core import NodePath,TextNode
from panda3d.core import Camera,Vec3,Vec4
from direct.gui.OnscreenText import OnscreenText... | {
"repo_name": "jbrodin/glowswitch-test",
"path": "glowswitch-test.py",
"copies": "1",
"size": "3010",
"license": "mit",
"hash": -4604273806460519400,
"line_mean": 45.3076923077,
"line_max": 173,
"alpha_frac": 0.6700996678,
"autogenerated": false,
"ratio": 3.2968236582694415,
"config_test": fals... |
__author__ = 'jbt'
import pdb
import time
# motion data is included for localhost testing purposes, since the iOS simulator doesn't produce it.
#uniques = {
# 'motion': { 'attitude_pitch': 0.733424593851337,
# 'attitude_x': -0.2209912033994121,
# 'attitude_yaw': 0.08644265799832047,
# ... | {
"repo_name": "HumanDynamics/openPDS",
"path": "openpds/connectors/opensense/getfunfdata.py",
"copies": "3",
"size": "7137",
"license": "mit",
"hash": 228758566633298270,
"line_mean": 24.8586956522,
"line_max": 108,
"alpha_frac": 0.5217878661,
"autogenerated": false,
"ratio": 3.220667870036101,
... |
__author__ = 'jbt'
import time
import math
#import pdb
newmotiondata = []
def update(x, y, z, count, variancesum, avg, sums):
count+=1
magnitude = math.sqrt(x**2+y**2+z**2)
newavg = (count-1)*avg/count + magnitude/count
deltaavg = newavg - avg
variancesum += (magnitude-newavg)*(magnitude-newavg) ... | {
"repo_name": "eschloss/FluFuture",
"path": "openpds/connectors/opensense/getmotiondata.py",
"copies": "3",
"size": "2276",
"license": "mit",
"hash": -6853901554696977000,
"line_mean": 26.0952380952,
"line_max": 117,
"alpha_frac": 0.6054481547,
"autogenerated": false,
"ratio": 3.5507020280811235,... |
__author__ = 'jc60'
"""
A number chain is created by continuously adding the square of the digits in
a number to form a new number until it has been seen before.
For example,
44 -> 32 -> 13 -> 10 -> 1 -> 1
85 -> 89 -> 145 -> 42 -> 20 -> 4 -> 16 -> 37 -> 58 -> 89
Therefore any chain that arrives at 1 or 89 will becom... | {
"repo_name": "jakubczaplicki/projecteuler",
"path": "problem092.py",
"copies": "1",
"size": "1042",
"license": "mit",
"hash": 7738394405005846000,
"line_mean": 23.8095238095,
"line_max": 76,
"alpha_frac": 0.6257197697,
"autogenerated": false,
"ratio": 3.020289855072464,
"config_test": false,
... |
__author__ = 'jcadam'
import json
import http.client
from argparse import ArgumentParser
def decode_response(resp):
return json.loads(resp.read().decode('utf-8'))
def parse_args():
# We need the CouchDB admin credentials
# These can be provided as command line arguments or via prompt
parser = ... | {
"repo_name": "rhinoman/wikifeat",
"path": "scripts/db_update/common.py",
"copies": "1",
"size": "1998",
"license": "bsd-3-clause",
"hash": -7420002658386326000,
"line_mean": 28.8208955224,
"line_max": 82,
"alpha_frac": 0.6511511512,
"autogenerated": false,
"ratio": 3.776937618147448,
"config_t... |
__author__ = 'jcastro'
from player import Player
class Tournament(object):
players = {}
games = {}
@classmethod
def parser(cls, game, string):
split = string.split(';')
player = cls.find_player(split)
player.add_game(game, split)
@classmethod
def find_player(cls, spl... | {
"repo_name": "jcastrojob/kata_tucan",
"path": "tournament.py",
"copies": "1",
"size": "2824",
"license": "apache-2.0",
"hash": 7213492749092095000,
"line_mean": 30.3777777778,
"line_max": 80,
"alpha_frac": 0.5173512748,
"autogenerated": false,
"ratio": 4.27231467473525,
"config_test": false,
... |
__author__ = 'jcastro'
from tournament import Tournament
import abc
class Game(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def calculate_score(self, score):
"""Returns final score for player"""
class Basketball(Game):
point_position = {
'G': [2, 3, 1],
'F': [... | {
"repo_name": "jcastrojob/kata_tucan",
"path": "main.py",
"copies": "1",
"size": "1738",
"license": "apache-2.0",
"hash": 8572080306230914000,
"line_mean": 27.5081967213,
"line_max": 76,
"alpha_frac": 0.66283084,
"autogenerated": false,
"ratio": 2.767515923566879,
"config_test": false,
"has_n... |
__author__ = 'jcavalie'
import Levenshtein
def alignChars( source, target, ErrStats = None, ErrStats_lock = None ):
"""
alignChars takes a pair of words from parallel corpora that have been word aligned.
Errors introduced by the noisy channel (OCR) are revealed by finding the sequence of edit operations ... | {
"repo_name": "jcavalieri8619/OCRerror_correct",
"path": "CharacterAligner.py",
"copies": "1",
"size": "3323",
"license": "mit",
"hash": -8800505869418218000,
"line_mean": 32.23,
"line_max": 109,
"alpha_frac": 0.6337646705,
"autogenerated": false,
"ratio": 3.955952380952381,
"config_test": fals... |
__author__ = 'jcavalie'
def determineErrWindows( alignedChars, ErrStats, ErrStats_lock ):
'''
@param alignedSource:
@type alignedSource: list
@param alignedTarget:
@type alignedTarget: list
@return:
@rtype: tuple
'''
OBSERVED = 0
HIDDEN = 1
win_start = 0
win_stop = 0... | {
"repo_name": "jcavalieri8619/OCRerror_correct",
"path": "locateErrorWindows.py",
"copies": "1",
"size": "2775",
"license": "mit",
"hash": 2958728893294801000,
"line_mean": 27.3265306122,
"line_max": 117,
"alpha_frac": 0.5668468468,
"autogenerated": false,
"ratio": 3.790983606557377,
"config_te... |
__author__ = 'jcavalie'
def subgroups( my_list ):
for each_tuple in (lambda p, f = lambda n, g:
{ (x,) + y for x in range( 1, n ) for y in g( n - x, g ) } | { (n,) }:
f( p, f ))( len( my_list ) ):
yield list( my_list[ sum( each_tuple[ :index ] ):sum( each_tuple[ :index ] ) +... | {
"repo_name": "jcavalieri8619/OCRerror_correct",
"path": "substringMappingStructures.py",
"copies": "1",
"size": "3640",
"license": "mit",
"hash": 3507468693579054000,
"line_mean": 32.1,
"line_max": 116,
"alpha_frac": 0.5673076923,
"autogenerated": false,
"ratio": 4.0625,
"config_test": false,
... |
__author__ = 'jchugh'
from multiprocessing import Process
from ConfigParser import NoOptionError
from simple_kafka import kafka_client
from simple_oauth.oauth import Oauth
from simple_oauth.oauth_request import Request
from simple_oauth.oauth_token import Token
from twitter import TwitterStream
from config import confi... | {
"repo_name": "joychugh/learning-kafka",
"path": "main.py",
"copies": "1",
"size": "3725",
"license": "mit",
"hash": -8468503631386869000,
"line_mean": 32.8636363636,
"line_max": 110,
"alpha_frac": 0.5863087248,
"autogenerated": false,
"ratio": 4.06215921483097,
"config_test": true,
"has_no_k... |
__author__ = 'jchugh'
from pyspark import SparkContext
from pyspark.streaming import StreamingContext, dstream
from pyspark.streaming.kafka import KafkaUtils
from config import config
from simple_spark_example.utils import extract_hashtags
import simple_kafka
try:
import simplejson as json
except ImportError:
i... | {
"repo_name": "joychugh/learning-kafka",
"path": "simple_spark_example/spark_example.py",
"copies": "1",
"size": "2819",
"license": "mit",
"hash": 4619226677147802000,
"line_mean": 31.7790697674,
"line_max": 98,
"alpha_frac": 0.6598084427,
"autogenerated": false,
"ratio": 3.463144963144963,
"co... |
__author__ = 'jchugh'
from simple_oauth.oauth_token import Token
"""
A class representing a request
"""
class Request(object):
def __init__(self, url, method, token=None, query_params=None, payload=None, headers=None, is_streaming=False):
"""
Initialize the request object
:param url: targe... | {
"repo_name": "joychugh/learning-kafka",
"path": "simple_oauth/oauth_request.py",
"copies": "1",
"size": "2960",
"license": "mit",
"hash": -6647768953452871000,
"line_mean": 29.8333333333,
"line_max": 115,
"alpha_frac": 0.5925675676,
"autogenerated": false,
"ratio": 4.668769716088328,
"config_t... |
__author__ = 'jchugh'
import uritools
import base64
import hmac
from hashlib import sha1
import urlparse
def rfc3986_encode(input_string):
"""
Encodes the input string according to RFC3986 standards
:param input_string: string to encode
:type input_string: str
:return: encoded string
:rtype: st... | {
"repo_name": "joychugh/learning-kafka",
"path": "simple_oauth/oauth_utils.py",
"copies": "1",
"size": "1845",
"license": "mit",
"hash": -7131494030869074000,
"line_mean": 28.2857142857,
"line_max": 98,
"alpha_frac": 0.664498645,
"autogenerated": false,
"ratio": 3.7122736418511066,
"config_test... |
__author__ = 'jchugh'
import uuid
import time
from requests.models import Response
import requests
import copy
import oauth_utils
from simple_oauth.oauth_request import Request
from oauth_token import Token
"""
A library to help with oAuth1 requests
"""
class Oauth(object):
"""
oAuth1 provides easy to use en... | {
"repo_name": "joychugh/learning-kafka",
"path": "simple_oauth/oauth.py",
"copies": "1",
"size": "10790",
"license": "mit",
"hash": -7262872245787523000,
"line_mean": 39.5676691729,
"line_max": 120,
"alpha_frac": 0.5645968489,
"autogenerated": false,
"ratio": 4.5412457912457915,
"config_test": ... |
__author__ = 'jchugh'
from simple_oauth.oauth_request import Request
class TwitterStream(object):
"""
A class representing twitter client to get streaming tweets
"""
def __init__(self, oauth, json_parser):
"""
Initialize the twitter streaming client with the Oauth instance
:par... | {
"repo_name": "joychugh/learning-kafka",
"path": "twitter.py",
"copies": "1",
"size": "1995",
"license": "mit",
"hash": 6393870072083001000,
"line_mean": 29.2272727273,
"line_max": 77,
"alpha_frac": 0.569924812,
"autogenerated": false,
"ratio": 4.375,
"config_test": false,
"has_no_keywords": ... |
__author__ = 'jcl5m1'
import numpy as np
import cv2
from itertools import *
from random import *
from math import *
import collections
from ImageUtilities import *
class TrainingRegion:
p1 = (0,0)
p2 = (0,0)
center = (0,0)
def __init__(self):
self.set((0, 0), (0, 0))
def set_p2(self, p2)... | {
"repo_name": "jcl5m1/CVToolsPython",
"path": "VisualDecisionForest/TrainingRegion.py",
"copies": "1",
"size": "2148",
"license": "apache-2.0",
"hash": -5862110903898044000,
"line_mean": 25.1951219512,
"line_max": 83,
"alpha_frac": 0.5041899441,
"autogenerated": false,
"ratio": 2.6004842615012107... |
__author__ = 'jcl5m'
import cv2
import numpy as np
import math
import os
import argparse
import sys
sys.path.append('../common/')
import transformations
def pinhole_from_cylindrical_dewarp(src_img, dst_img, src_center, dst_fov):
src_h, src_w, src_depth = src_img.shape
dst_h, dst_w, dst_depth = dst_img.shape
... | {
"repo_name": "jcl5m1/CVToolsPython",
"path": "RicohTheta/matcher.py",
"copies": "1",
"size": "4684",
"license": "apache-2.0",
"hash": 2023327562100806400,
"line_mean": 28.6455696203,
"line_max": 101,
"alpha_frac": 0.5947907771,
"autogenerated": false,
"ratio": 2.5008008542445275,
"config_test"... |
__author__ = 'jcl5m'
import numpy as np
import random
import math
import matplotlib
matplotlib.use('Qt4Agg')
#matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from matplotlib import animation
import math
import sys
sys.path.append('../common/')
import transformations as xform
import geometery as geo
from homogra... | {
"repo_name": "jcl5m1/CVToolsPython",
"path": "RandomDotCorrespondence/RandomDotCorrespondence.py",
"copies": "1",
"size": "10561",
"license": "apache-2.0",
"hash": -6679734187175650000,
"line_mean": 31.9034267913,
"line_max": 123,
"alpha_frac": 0.5990909952,
"autogenerated": false,
"ratio": 3.23... |
__author__ = 'jcl5m'
import cv2
import numpy as np
import math
import os
import argparse
def pinhole_dewarp_LUT(src_img, dst_img, src_center, dst_fov, src_f):
src_h, src_w, src_depth = src_img.shape
dst_h, dst_w, dst_depth = dst_img.shape
lut = []
for r in range(dst_h):
for c in range(dst_w)... | {
"repo_name": "jcl5m1/CVToolsPython",
"path": "FisheyeDewarper/fisheyedewarp.py",
"copies": "1",
"size": "6087",
"license": "apache-2.0",
"hash": -4445055849095218000,
"line_mean": 31.0421052632,
"line_max": 92,
"alpha_frac": 0.5794315755,
"autogenerated": false,
"ratio": 2.966374269005848,
"co... |
__author__ = 'jcorbett'
from mongoengine import *
from .componentReference import ComponentReference
from .projectReference import ProjectReference
from .featureReference import FeatureReference
from .recurringNote import RecurringNote
from .step import Step
class Testcase(Document):
meta = {'collection': 'testc... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqaweb/model/testcase.py",
"copies": "1",
"size": "1241",
"license": "apache-2.0",
"hash": 7413247867465693000,
"line_mean": 34.4571428571,
"line_max": 67,
"alpha_frac": 0.7566478646,
"autogenerated": false,
"ratio": 4.630597014925373,
"config_te... |
__author__ = 'jcorbett'
from mongoengine import *
import datetime
from .types import AllTypes
TestrunListDashboardTypeName = "TestrunListDashboard"
class TestrunFinder(EmbeddedDocument):
name = StringField(required=True)
query = StringField(required=True)
class InnerGroup(EmbeddedDocument):
name = S... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqaweb/model/dashboards/testrunListDashboard.py",
"copies": "1",
"size": "1502",
"license": "apache-2.0",
"hash": 3855713430289035300,
"line_mean": 29.04,
"line_max": 125,
"alpha_frac": 0.7403462051,
"autogenerated": false,
"ratio": 4.1150684931506... |
__author__ = 'jcorbett'
from .reporting import import_start, import_end
import slickqa
import os
import glob
import traceback
import yaml
import sys
import bson
def import_features(slick, path, onstart=import_start, onend=import_end, delete=False):
""" Import any features from the path specified.
:param sli... | {
"repo_name": "slickqa/slick-import",
"path": "slickimport/features.py",
"copies": "1",
"size": "3926",
"license": "apache-2.0",
"hash": 1691714099773337900,
"line_mean": 44.6511627907,
"line_max": 126,
"alpha_frac": 0.6158940397,
"autogenerated": false,
"ratio": 4.018423746161719,
"config_test... |
__author__ = 'jcorbett'
from .reporting import import_start, import_end
import slickqa
import os
import glob
import traceback
import yaml
import sys
def import_components(slick, path, onstart=import_start, onend=import_end, delete=False):
""" Import any components from the path specified.
:param slick: The ... | {
"repo_name": "slickqa/slick-import",
"path": "slickimport/components.py",
"copies": "1",
"size": "2343",
"license": "apache-2.0",
"hash": 5317419399435434000,
"line_mean": 38.7118644068,
"line_max": 111,
"alpha_frac": 0.6355100299,
"autogenerated": false,
"ratio": 3.9444444444444446,
"config_t... |
__author__ = 'jcorbett'
from .reporting import import_start, import_end
import slickqa
import os
import glob
import traceback
import yaml
import sys
def import_projects(slick, path, onstart=import_start, onend=import_end, delete=False):
""" Import any projects from the path specified.
:param slick: The conn... | {
"repo_name": "slickqa/slick-import",
"path": "slickimport/projects.py",
"copies": "1",
"size": "2097",
"license": "apache-2.0",
"hash": -928523638060920400,
"line_mean": 35.1551724138,
"line_max": 96,
"alpha_frac": 0.6175488794,
"autogenerated": false,
"ratio": 3.905027932960894,
"config_test"... |
__author__ = 'jcorbett'
from slickqaweb.app import app
from slickqaweb.model.systemConfiguration import load_system_configuration_type, SystemConfigurationTypes, BaseSystemConfiguration
from slickqaweb.model.serialize import deserialize_that
from slickqaweb.model.query import queryFor
from flask import request
from .s... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqaweb/api/systemConfiguration.py",
"copies": "1",
"size": "4428",
"license": "apache-2.0",
"hash": 6776001540349723000,
"line_mean": 46.1063829787,
"line_max": 145,
"alpha_frac": 0.7486449864,
"autogenerated": false,
"ratio": 4.066115702479339,
... |
__author__ = 'jcorbett'
from slickqaweb.app import app
from slickqaweb.model.userAccount import UserAccount
from .standardResponses import JsonResponse, read_request
from slickqaweb.model.query import queryFor
from flask import Response
from .apidocs import add_resource, accepts, returns, argument_doc, standard_query_... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqaweb/api/user.py",
"copies": "1",
"size": "1886",
"license": "apache-2.0",
"hash": -1048082960750906900,
"line_mean": 35.2692307692,
"line_max": 148,
"alpha_frac": 0.7407211029,
"autogenerated": false,
"ratio": 3.81010101010101,
"config_test": ... |
__author__ = 'jcorbett'
from slickqaweb.model.testcase import Testcase
from slickqaweb.model.testcaseReference import TestcaseReference
from slickqaweb.model.project import Project
from slickqaweb.model.projectReference import ProjectReference
from slickqaweb.model.componentReference import ComponentReference
from sli... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqaweb/model/dereference.py",
"copies": "1",
"size": "6521",
"license": "apache-2.0",
"hash": 6046518376726017000,
"line_mean": 41.9013157895,
"line_max": 120,
"alpha_frac": 0.7248888207,
"autogenerated": false,
"ratio": 4.174775928297055,
"confi... |
__author__ = 'jcorbett'
from .standardResponses import JsonResponse, read_request
from slickqaweb.model.slickLogEvent import SlickLogEvent
from slickqaweb.app import app
from slickqaweb.model.query import queryFor
from slickqaweb.model.serialize import deserialize_that
from .apidocs import add_resource, accepts, retur... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqaweb/api/slicklogevents.py",
"copies": "1",
"size": "1193",
"license": "apache-2.0",
"hash": -365544782038394900,
"line_mean": 37.4838709677,
"line_max": 107,
"alpha_frac": 0.7359597653,
"autogenerated": false,
"ratio": 3.2955801104972378,
"con... |
__author__ = 'jcorbett'
import glob
import os
import datetime
# this little gem will import every .py file in this directory
# the advantage is that we can just import slickqaweb.model.dashboards and all the
# types will be added to types.allTypes
dashboard_types_path = os.path.dirname(__file__)
dashboard_types_path... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqaweb/model/dashboards/__init__.py",
"copies": "1",
"size": "1352",
"license": "apache-2.0",
"hash": 2776231551275398000,
"line_mean": 30.4418604651,
"line_max": 89,
"alpha_frac": 0.7359467456,
"autogenerated": false,
"ratio": 3.683923705722071,
... |
__author__ = 'jcorbett'
import glob
import os
# this little gem will import every .py file in this directory
# the advantage is that we can just import slickqaweb.model.systemConfiguration and all the
# types will be added to types.allTypes
compile_steps_path = os.path.dirname(__file__)
compile_steps_path_length = l... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqaweb/model/systemConfiguration/__init__.py",
"copies": "1",
"size": "1147",
"license": "apache-2.0",
"hash": 3244456938903246000,
"line_mean": 27.675,
"line_max": 95,
"alpha_frac": 0.7349607672,
"autogenerated": false,
"ratio": 3.760655737704918,... |
__author__ = 'jcorbett'
import logging
from ujson import dumps
from .app import app
from .model.serialize import serialize_this
from .model.slickLogEvent import SlickLogEvent, EventTypes
from kombu import producers
import sys
event_topic_mapping = {
}
class SlickEventError(Exception):
pass
class Event(objec... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqaweb/events.py",
"copies": "1",
"size": "4747",
"license": "apache-2.0",
"hash": -7596177010312095000,
"line_mean": 35.2366412214,
"line_max": 180,
"alpha_frac": 0.5974299558,
"autogenerated": false,
"ratio": 3.945968412302577,
"config_test": f... |
__author__ = 'jcorbett'
import mongoengine
import bson
import datetime
import types
import inspect
import logging
def serializable(func):
func.__serialize__ = True
return func
plain_types = ((str,), int, int, float, float, type(None))
document_types = (mongoengine.EmbeddedDocument, mongoengine.Document)
epoc... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqaweb/model/serialize.py",
"copies": "1",
"size": "5012",
"license": "apache-2.0",
"hash": -8750072586135874000,
"line_mean": 39.7479674797,
"line_max": 126,
"alpha_frac": 0.602952913,
"autogenerated": false,
"ratio": 4.365853658536586,
"config_... |
__author__ = 'jcorbett'
import os
import re
import sys
import subprocess
import json
import xml.etree.ElementTree as ET
from flask import Response
from slickqaweb.app import app
if os.path.exists(os.path.join(os.path.dirname(__file__), '..', '..', 'slickqawebtest')):
xml_filename_pattern = re.compile('XML: (.*... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqaweb/api/unittest.py",
"copies": "1",
"size": "2054",
"license": "apache-2.0",
"hash": 5547503260334347000,
"line_mean": 33.813559322,
"line_max": 136,
"alpha_frac": 0.5462512171,
"autogenerated": false,
"ratio": 4.157894736842105,
"config_test... |
__author__ = 'jcorbett'
import types
import re
import sys
import logging
import pprint
from flask import request
def is_not_provided(obj, attr_name):
if not hasattr(obj, attr_name):
return True
if getattr(obj, attr_name) is None:
return True
if isinstance(getattr(obj, attr_name), (str,))... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqaweb/utils.py",
"copies": "1",
"size": "1737",
"license": "apache-2.0",
"hash": 9027123957858966000,
"line_mean": 30.5818181818,
"line_max": 105,
"alpha_frac": 0.6367299942,
"autogenerated": false,
"ratio": 3.574074074074074,
"config_test": fal... |
__author__ = 'jcorbett'
import unittest
class Dummy(unittest.TestCase):
def nop(self):
pass
_t = Dummy('nop')
# doing it this way (instead of dynamically like nose.tools does) gives us code completion
assert_false = _t.assertFalse
assert_true = _t.assertTrue
assert_raises = _t.assertRaises
assert_equal ... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqawebtest/asserts.py",
"copies": "1",
"size": "1401",
"license": "apache-2.0",
"hash": 2629960560292930600,
"line_mean": 30.8409090909,
"line_max": 90,
"alpha_frac": 0.7773019272,
"autogenerated": false,
"ratio": 3.4254278728606358,
"config_test... |
__author__ = 'jcorbett'
from mongoengine import *
from .types import AllTypes
from .subscriptionInfo import SubscriptionInfo
EmailSubscriptionSystemConfigurationType = "email-subscription"
# this is the default class name, kept for compatibility reasons
EmailSubscriptionSystemConfigurationClassName = "org.tcrun.sl... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqaweb/model/systemConfiguration/emailSubscription.py",
"copies": "1",
"size": "1443",
"license": "apache-2.0",
"hash": 8692832080145306000,
"line_mean": 36.9736842105,
"line_max": 155,
"alpha_frac": 0.7823977824,
"autogenerated": false,
"ratio": 5... |
__author__ = 'jcorbett'
from slickqaweb.app import app
from .standardResponses import JsonResponse
from mongoengine import *
from flask import request
import re
import types
#------------- For documenting other API endpoints ---------------------------
resources = []
def standard_query_parameters(f):
if not ha... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqaweb/api/apidocs.py",
"copies": "1",
"size": "13173",
"license": "apache-2.0",
"hash": 8642785155971280000,
"line_mean": 36.3172804533,
"line_max": 138,
"alpha_frac": 0.6352387459,
"autogenerated": false,
"ratio": 4.268632534024627,
"config_tes... |
__author__ = 'jcorbett'
#################################################################################
# I know this file is a mess, it's an example of experiment driven coding.
# over time I will start putting in unit tests and cleaning this up and making
# it more orderly
########################################... | {
"repo_name": "slickqa/slickqaweb",
"path": "slickqaweb/model/query.py",
"copies": "1",
"size": "6521",
"license": "apache-2.0",
"hash": 561065489533474400,
"line_mean": 34.4402173913,
"line_max": 184,
"alpha_frac": 0.6264376629,
"autogenerated": false,
"ratio": 3.5021482277121376,
"config_test... |
__author__ = 'jcrossler'
import numpy
import json
from procyon.starsystemmaker import math_helpers
from procyon.starsystemmaker.name_library import *
try:
from django.core.cache import cache
from django.forms.models import model_to_dict
except ImportError:
# Probably Django not loaded, include for testing... | {
"repo_name": "jaycrossler/procyon",
"path": "procyon/generators/story_helpers.py",
"copies": "1",
"size": "25300",
"license": "mit",
"hash": 4319144785619524000,
"line_mean": 36.7064083458,
"line_max": 184,
"alpha_frac": 0.5686956522,
"autogenerated": false,
"ratio": 4.039597636915216,
"config... |
__author__ = 'JCU Robo Club (IEEE Student Branch)'
import numpy as np
import cv2 as cv
import tkinter as tk
from PIL import Image, ImageTk # sudo pip3 install pillow
class App:
def __init__(self, tkroot):
# cam
self.root = tkroot
self.cam = cv.VideoCapture(0)
ret, self.first = se... | {
"repo_name": "jcuroboclub/Robot-Tracker",
"path": "main.py",
"copies": "1",
"size": "7181",
"license": "mit",
"hash": -7398139000298249000,
"line_mean": 41,
"line_max": 79,
"alpha_frac": 0.5387828993,
"autogenerated": false,
"ratio": 3.3415542112610517,
"config_test": true,
"has_no_keywords"... |
__author__ = 'jdaniel'
from abc import ABCMeta
from abc import abstractmethod
class Algorithm(object):
__metaclass__ = ABCMeta
def __init__(self):
"""
Algorithm base class which defines the API for connecting
algorithms into the framework.
:return: None
"""
se... | {
"repo_name": "jldaniel/Gaia",
"path": "GaiaSolve/algorithm.py",
"copies": "1",
"size": "3442",
"license": "mit",
"hash": 7311319004629025000,
"line_mean": 29.4690265487,
"line_max": 99,
"alpha_frac": 0.6115630447,
"autogenerated": false,
"ratio": 4.368020304568528,
"config_test": false,
"has... |
__author__ = 'jdaniel'
from abc import ABCMeta
from abc import abstractmethod
# TODO: Document Model class methods
class Model(object):
__metaclass__ = ABCMeta
def __init__(self):
"""
:return:
"""
self._host = None
self._design_values = None
self._objective_v... | {
"repo_name": "jldaniel/Gaia",
"path": "GaiaSolve/model.py",
"copies": "1",
"size": "3254",
"license": "mit",
"hash": -743521047306111500,
"line_mean": 15.0344827586,
"line_max": 51,
"alpha_frac": 0.4757221881,
"autogenerated": false,
"ratio": 4.544692737430168,
"config_test": false,
"has_no_... |
__author__ = 'jdaniel'
from algorithm_base import *
import random
import scipy
import numpy as np
class Spheres(AlgorithmBase):
def __init__(self, objective_function):
super(Spheres, self).__init__(objective_function)
"""
Serial implementation for the local models algorithm PSOV
us... | {
"repo_name": "jldaniel/Gaia",
"path": "Algorithms/spheres.py",
"copies": "1",
"size": "1485",
"license": "mit",
"hash": -1866800274682306600,
"line_mean": 25.5178571429,
"line_max": 88,
"alpha_frac": 0.597979798,
"autogenerated": false,
"ratio": 4.183098591549296,
"config_test": false,
"has_... |
__author__ = 'jdaniel'
from algorithm_base import *
import random
class Islands(AlgorithmBase):
def __init__(self, objective_function):
super(Islands, self).__init__(objective_function)
"""
Serial implementation fo the Islands PMOGA using NSGA-2
:param objective_function: <functio... | {
"repo_name": "jldaniel/Gaia",
"path": "Algorithms/islands.py",
"copies": "1",
"size": "4738",
"license": "mit",
"hash": -6754653203777419000,
"line_mean": 32.1328671329,
"line_max": 99,
"alpha_frac": 0.6000422119,
"autogenerated": false,
"ratio": 4.1164205039096435,
"config_test": false,
"ha... |
__author__ = 'jdaniel'
from algorithm_base import *
import random
class Serial(AlgorithmBase):
def __init__(self, objective_function):
super(Serial, self).__init__(objective_function)
"""
Serial implementation of the NSGA-2 MOGA.
:param objective_function: <function> Objective fu... | {
"repo_name": "jldaniel/Gaia",
"path": "Algorithms/serial.py",
"copies": "1",
"size": "3961",
"license": "mit",
"hash": 912665445685358000,
"line_mean": 30.4365079365,
"line_max": 104,
"alpha_frac": 0.5657662207,
"autogenerated": false,
"ratio": 4.343201754385965,
"config_test": false,
"has_n... |
__author__ = 'jdaniel'
from Algorithms import serial
from GaiaSolve.algorithm import Algorithm
class SERIAL(Algorithm):
def __init__(self):
"""
Wrapped version of the serial NSGA-2 algorithm
:return: None
"""
super(SERIAL, self).__init__()
def run(self):
"""
... | {
"repo_name": "jldaniel/Gaia",
"path": "GaiaSolve/Algorithms/_serial.py",
"copies": "1",
"size": "1949",
"license": "mit",
"hash": 8890000045541127000,
"line_mean": 28.5303030303,
"line_max": 74,
"alpha_frac": 0.5767060031,
"autogenerated": false,
"ratio": 3.898,
"config_test": false,
"has_no... |
__author__ = 'jdaniel'
from AthenaOpt.configuration import Configuration
from AthenaOpt.configuration import encode_configuration
from os import urandom
import json
algorithm = 'SERIAL'
models = ['ZDT1', 'ZDT2', 'ZDT3', 'ZDT4', 'ZDT6']
pop_size = [16, 32, 64, 128, 256, 512, 1024]
conv_tol = 1e-4
crossover_index = 15
... | {
"repo_name": "jldaniel/Athena",
"path": "Util/generate_zdt_serial_batch.py",
"copies": "1",
"size": "1946",
"license": "mit",
"hash": 569011356872405060,
"line_mean": 33.75,
"line_max": 103,
"alpha_frac": 0.6274409044,
"autogenerated": false,
"ratio": 3.518987341772152,
"config_test": true,
... |
__author__ = 'jdaniel'
from GaiaPre import *
from GaiaSolve import *
from GaiaPost import *
import os
import subprocess
def test_serial_zdt1():
# Create in input file
input_file = "test_serial_zdt1.in"
fp = open(input_file, 'w')
# Write the input file parameters
cwd = os.getcwd()
model_dir =... | {
"repo_name": "jldaniel/Gaia",
"path": "Tests/integration_test.py",
"copies": "1",
"size": "1060",
"license": "mit",
"hash": -1065525873486737000,
"line_mean": 24.8780487805,
"line_max": 94,
"alpha_frac": 0.5962264151,
"autogenerated": false,
"ratio": 2.7604166666666665,
"config_test": false,
... |
__author__ = 'jdaniel'
from GaiaSolve.common import ModelInfo
from GaiaSolve.common import GaiaException
class Host(object):
def __init__(self):
self.model = None
self.algorithm = None
def set_model(self, model):
self.model = model
self.model.set_host(self)
def set_algor... | {
"repo_name": "jldaniel/Gaia",
"path": "GaiaSolve/host.py",
"copies": "1",
"size": "3913",
"license": "mit",
"hash": -6565756027790445000,
"line_mean": 28.8778625954,
"line_max": 100,
"alpha_frac": 0.605417838,
"autogenerated": false,
"ratio": 4.619834710743802,
"config_test": false,
"has_no_... |
__author__ = 'jdaniel'
from GaiaSolve.model import Model
import SpherePacking.sphere_packing
from math import pi
class PACKING(Model):
def __init__(self):
super(PACKING, self).__init__()
self.radii = [0.25]*5 + [0.15]*5
# spheres assumed to be Aluminum
masses = []
for rad... | {
"repo_name": "jldaniel/Gaia",
"path": "Models/packing.py",
"copies": "1",
"size": "1558",
"license": "mit",
"hash": -6713081719124869000,
"line_mean": 24.5409836066,
"line_max": 85,
"alpha_frac": 0.4993581515,
"autogenerated": false,
"ratio": 3.2526096033402925,
"config_test": false,
"has_no... |
__author__ = 'jdaniel'
from GaiaSolve.model import Model
from math import cos, atan2, pi
class TNK(Model):
def __init__(self):
super(TNK, self).__init__()
def evaluate(self):
x1 = self.x[0]
x2 = self.x[1]
f1 = x1
f2 = x2
g1 = x1**2 + x2**2 - 1.0 - 0.1*cos(16*... | {
"repo_name": "jldaniel/Gaia",
"path": "Models/tnk.py",
"copies": "1",
"size": "1056",
"license": "mit",
"hash": 2669985891027318000,
"line_mean": 20.5510204082,
"line_max": 60,
"alpha_frac": 0.5369318182,
"autogenerated": false,
"ratio": 3,
"config_test": false,
"has_no_keywords": false,
"... |
__author__ = 'jdaniel'
from GaiaSolve.model import Model
from math import cos, pi
from operator import mul
from functools import reduce
class DTLZ1(Model):
def __init__(self):
super(DTLZ1, self).__init__()
def evaluate(self):
g = 100 * (len(self.x[2:]) +
sum((xi-0.5)**2 -... | {
"repo_name": "jldaniel/Gaia",
"path": "Models/dtlz1.py",
"copies": "1",
"size": "1240",
"license": "mit",
"hash": -378960902088921600,
"line_mean": 23.82,
"line_max": 107,
"alpha_frac": 0.5532258065,
"autogenerated": false,
"ratio": 3.2124352331606216,
"config_test": false,
"has_no_keywords"... |
__author__ = 'jdaniel'
from GaiaSolve.model import Model
from math import cos, pi, sqrt
class ZDT4(Model):
def __init__(self):
super(ZDT4, self).__init__()
def evaluate(self):
g = 1.0 + 10.0*(len(self.x) - 1) + \
sum(xi**2 - 10.0*cos(4.0*pi*xi) for xi in self.x[1:])
f1 =... | {
"repo_name": "jldaniel/Gaia",
"path": "Models/zdt4.py",
"copies": "1",
"size": "1091",
"license": "mit",
"hash": -5284500744023897000,
"line_mean": 21.2857142857,
"line_max": 65,
"alpha_frac": 0.5398716774,
"autogenerated": false,
"ratio": 3.1350574712643677,
"config_test": false,
"has_no_ke... |
__author__ = 'jdaniel'
from GaiaSolve.model import Model
from math import sin, cos, pi
from operator import mul
from functools import reduce
class DTLZ2(Model):
def __init__(self):
super(DTLZ2, self).__init__()
def evaluate(self):
xc = self.x[:2]
xm = self.x[2:]
g = sum((xi-... | {
"repo_name": "jldaniel/Gaia",
"path": "Models/dtlz2.py",
"copies": "1",
"size": "1265",
"license": "mit",
"hash": 2204860261290330600,
"line_mean": 23.3461538462,
"line_max": 78,
"alpha_frac": 0.557312253,
"autogenerated": false,
"ratio": 3.1944444444444446,
"config_test": false,
"has_no_key... |
__author__ = 'jdaniel'
from GaiaSolve.model import Model
from math import sin, cos, pi
from operator import mul
from functools import reduce
class DTLZ3(Model):
def __init__(self):
super(DTLZ3, self).__init__()
def evaluate(self):
xc = self.x[:2]
xm = self.x[2:]
g = 100*(len... | {
"repo_name": "jldaniel/Gaia",
"path": "Models/dtlz3.py",
"copies": "1",
"size": "1301",
"license": "mit",
"hash": -171775671935802050,
"line_mean": 24.0384615385,
"line_max": 79,
"alpha_frac": 0.5557263643,
"autogenerated": false,
"ratio": 3.142512077294686,
"config_test": false,
"has_no_key... |
__author__ = 'jdaniel'
from GaiaSolve.model import Model
from math import sin, pi, exp
class ZDT6(Model):
def __init__(self):
super(ZDT6, self).__init__()
def evaluate(self):
g = 1.0 + 9.0*(sum(self.x[1:]) / (len(self.x) - 1))**0.25
f1 = 1 - exp(-4*self.x[0])*sin(6.0*pi*self.x[0])**... | {
"repo_name": "jldaniel/Gaia",
"path": "Models/zdt6.py",
"copies": "1",
"size": "1066",
"license": "mit",
"hash": -7788677549348956000,
"line_mean": 21.2291666667,
"line_max": 65,
"alpha_frac": 0.5459662289,
"autogenerated": false,
"ratio": 3.126099706744868,
"config_test": false,
"has_no_key... |
__author__ = 'jdaniel'
from GaiaSolve.model import Model
from math import sqrt, sin, pi
class ZDT3(Model):
def __init__(self):
super(ZDT3, self).__init__()
def evaluate(self):
g = 1.0 + 9.0*sum(self.x[1:])/(len(self.x) - 1)
f1 = self.x[0]
f2 = g*(1.0 - sqrt(f1/g) - f1/g * si... | {
"repo_name": "jldaniel/Gaia",
"path": "Models/zdt3.py",
"copies": "1",
"size": "1248",
"license": "mit",
"hash": -5113116123723817000,
"line_mean": 20.9122807018,
"line_max": 58,
"alpha_frac": 0.5633012821,
"autogenerated": false,
"ratio": 3.310344827586207,
"config_test": false,
"has_no_key... |
__author__ = 'jdaniel'
from GaiaSolve.model import Model
class ZDT2(Model):
def __init__(self):
super(ZDT2, self).__init__()
def evaluate(self):
g = 1.0 + 9.0*sum(self.x[1:])/(len(self.x) - 1)
f1 = self.x[0]
f2 = g*(1.0 - (f1/g)**2)
self.obj = [f1, f2]
self.eq... | {
"repo_name": "jldaniel/Gaia",
"path": "Models/zdt2.py",
"copies": "1",
"size": "1190",
"license": "mit",
"hash": -4647307001790049000,
"line_mean": 20.6545454545,
"line_max": 55,
"alpha_frac": 0.5579831933,
"autogenerated": false,
"ratio": 3.3903133903133904,
"config_test": false,
"has_no_ke... |
__author__ = 'jdaniel'
from math import sqrt
from GaiaSolve.model import Model
class ZDT1(Model):
def __init__(self):
super(ZDT1, self).__init__()
def evaluate(self):
g = 1.0 + 9.0*sum(self.x[1:])/(len(self.x) - 1)
f1 = self.x[0]
f2 = g * (1.0 - sqrt(f1/g))
self.obj... | {
"repo_name": "jldaniel/Gaia",
"path": "Models/zdt1.py",
"copies": "1",
"size": "1216",
"license": "mit",
"hash": 6069418842455887000,
"line_mean": 19.2666666667,
"line_max": 55,
"alpha_frac": 0.5600328947,
"autogenerated": false,
"ratio": 3.3966480446927374,
"config_test": false,
"has_no_key... |
__author__ = 'jdaniel'
from sphere_packing import evaluate
from sphere_packing import plot_system
import numpy as np
from math import pi
import scipy
def run_single():
positions = -5 + np.random.rand(30)*10
radii = [0.25]*5 + [0.15]*5
masses = []
for rad in radii:
masses.append(2700*(4/3)*pi*... | {
"repo_name": "jldaniel/Gaia",
"path": "Models/SpherePacking/test.py",
"copies": "1",
"size": "1269",
"license": "mit",
"hash": 4671191144880467000,
"line_mean": 22.5,
"line_max": 73,
"alpha_frac": 0.5445232467,
"autogenerated": false,
"ratio": 2.729032258064516,
"config_test": false,
"has_no... |
__author__ = 'jdaniel'
import argparse
from distutils.core import setup, Command
import shutil
from setuptools import find_packages
import os
import sys
__version__ = "1.0.0"
GAIA_DIR = os.getenv("HOME") + "/Gaia_v" + __version__
#GAIA_DIR = "/my/custom/install/location" + "/Gaia_" + __version__
class Color(object)... | {
"repo_name": "jldaniel/Gaia",
"path": "setup.py",
"copies": "1",
"size": "4535",
"license": "mit",
"hash": 4688844783641274000,
"line_mean": 31.6258992806,
"line_max": 102,
"alpha_frac": 0.6511576626,
"autogenerated": false,
"ratio": 2.8848600508905853,
"config_test": false,
"has_no_keywords... |
__author__ = 'jdaniel'
import argparse
import datetime
import json
import imp
import inspect
import os
import random
class GaiaPre(object):
def __init__(self):
"""
Pre-processing program to create a case file from a key/value pair input file to be
used for configuration a GaiaSolve optimi... | {
"repo_name": "jldaniel/Gaia",
"path": "GaiaPre/gaia_pre.py",
"copies": "1",
"size": "19192",
"license": "mit",
"hash": -2633362095567339000,
"line_mean": 38.9002079002,
"line_max": 115,
"alpha_frac": 0.5655481451,
"autogenerated": false,
"ratio": 4.005008347245409,
"config_test": false,
"has... |
__author__ = 'jdaniel'
import argparse
import datetime
import json
import os
import inspect
import imp
import time
from GaiaSolve.common import GaiaException
from GaiaSolve.host import Host
# For testing
import matplotlib.pyplot as plt
class GaiaSolve(object):
def __init__(self):
"""
Primary pr... | {
"repo_name": "jldaniel/Gaia",
"path": "GaiaSolve/gaia_solve.py",
"copies": "1",
"size": "14357",
"license": "mit",
"hash": -3395502556651760600,
"line_mean": 32.3109048724,
"line_max": 102,
"alpha_frac": 0.5515079752,
"autogenerated": false,
"ratio": 4.126760563380282,
"config_test": false,
... |
__author__ = 'jdaniel'
import copy
import random
import itertools
import operator
import math
import struct
import os
import sys
import json
from collections import defaultdict
class AlgorithmBase(object):
def __init__(self, objective_function):
"""
Base Algorithm class which contains utility fun... | {
"repo_name": "jldaniel/Gaia",
"path": "Algorithms/algorithm_base.py",
"copies": "1",
"size": "29920",
"license": "mit",
"hash": 7913749298799210000,
"line_mean": 31.1030042918,
"line_max": 120,
"alpha_frac": 0.5657085561,
"autogenerated": false,
"ratio": 3.9389152185360716,
"config_test": fals... |
__author__ = 'jdaniel'
import numpy as np
def evaluate(positions, radii, masses):
"""
Evaluate the system to get the interference and inertia
:param positions:
:param radii:
:param masses:
:return:
"""
X = positions[:]
nobj = len(positions)/3
X.shape = (3, nobj)
R = radii
... | {
"repo_name": "jldaniel/Gaia",
"path": "Models/SpherePacking/sphere_packing.py",
"copies": "1",
"size": "3105",
"license": "mit",
"hash": 3092533540678577700,
"line_mean": 22.5227272727,
"line_max": 77,
"alpha_frac": 0.5220611916,
"autogenerated": false,
"ratio": 2.782258064516129,
"config_test... |
__author__ = 'jdaniel'
# Local Imports
from common import WintermuteException
from history import History
from individual import Individual
from surrogate import Surrogate
from random import Random
class Algorithm(object):
"""
Runs the wintermute algorithm
"""
def __init__(self, model, options):
... | {
"repo_name": "jldaniel/Wintermute",
"path": "algorithm.py",
"copies": "1",
"size": "5552",
"license": "apache-2.0",
"hash": -5996552410750635000,
"line_mean": 32.245508982,
"line_max": 115,
"alpha_frac": 0.6240994236,
"autogenerated": false,
"ratio": 4.769759450171821,
"config_test": false,
... |
__author__ = 'jdaniel'
class GaiaException(Exception):
def __init__(self, message):
Exception.__init__(self, message)
class ModelInfo():
def __init__(self):
"""
Internal data holder class for storing information about the model. This information
is passed to the manager for d... | {
"repo_name": "jldaniel/Gaia",
"path": "GaiaSolve/common.py",
"copies": "1",
"size": "2983",
"license": "mit",
"hash": 25460900509934300,
"line_mean": 31.4239130435,
"line_max": 96,
"alpha_frac": 0.6255447536,
"autogenerated": false,
"ratio": 4.069577080491133,
"config_test": false,
"has_no_k... |
__author__ = 'jdaniel'
class MasterSlave(object):
def __init__(self, objective_function):
self._objective_function = objective_function
self._variables = []
self._equality_constraints = []
self._inequality_constraints = []
self._objectives = []
# Optimization Optio... | {
"repo_name": "jldaniel/Gaia",
"path": "Algorithms/primary.py",
"copies": "1",
"size": "1484",
"license": "mit",
"hash": 7508602284449850000,
"line_mean": 18.2727272727,
"line_max": 53,
"alpha_frac": 0.539083558,
"autogenerated": false,
"ratio": 3.9468085106382977,
"config_test": false,
"has_... |
__author__ = 'jdaniel'
from GaiaSolve.model import Model
from math import sin, cos, pi
class POLONI(Model):
def __init__(self):
"""
Poloni's multiobjective function on a two attribute *individual*. From:
C. Poloni, "Hybrid GA for multi objective aerodynamic shape optimization",
... | {
"repo_name": "jldaniel/Gaia",
"path": "Models/poloni.py",
"copies": "1",
"size": "1493",
"license": "mit",
"hash": -5980938592834492000,
"line_mean": 24.7586206897,
"line_max": 82,
"alpha_frac": 0.5465505693,
"autogenerated": false,
"ratio": 2.9741035856573705,
"config_test": false,
"has_no_... |
__author__ = 'jdaniel'
import datetime
class WintermuteException(Exception):
"""
Custom exception for the Wintermute optimization framework
"""
def __init__(self, message):
"""
Initialize the custom Wintermute exception
:param message: The message explaining what went wrong
... | {
"repo_name": "jldaniel/Wintermute",
"path": "common.py",
"copies": "1",
"size": "2007",
"license": "apache-2.0",
"hash": -7590630145164854000,
"line_mean": 26.1351351351,
"line_max": 111,
"alpha_frac": 0.5565520678,
"autogenerated": false,
"ratio": 4.12962962962963,
"config_test": false,
"ha... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.