text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'nik'
import os
import bayes_classifier
import sys
def get_train_files(max_number_per_lang, resource_folder):
train_files = []
subdirs = [x[0] for x in os.walk(resource_folder)]
for subdir in subdirs:
files = os.walk(subdir).next()[2]
if len(files) > max_number_per_lang:
... | {
"repo_name": "antonnik/code-classifier",
"path": "naive_bayes/classifier_trainer.py",
"copies": "1",
"size": "1067",
"license": "apache-2.0",
"hash": -6477892898496549000,
"line_mean": 34.6,
"line_max": 114,
"alpha_frac": 0.6026241799,
"autogenerated": false,
"ratio": 3.2333333333333334,
"conf... |
__author__ = "Nikolaos Kyriazis"
__copyright__ = "Copyright 2015 Nikolaos Kyriazis"
__license__ = "APACHE"
__version__ = "2.0"
import datetime
import json
from itertools import izip
from urllib import urlencode
from urllib2 import Request, urlopen
import numpy as np
def json_get_url(req):
""" Issue a get reques... | {
"repo_name": "nkyriazis/PyEngage",
"path": "lib/engage_api.py",
"copies": "1",
"size": "10433",
"license": "apache-2.0",
"hash": 7906511167587476000,
"line_mean": 36.394265233,
"line_max": 120,
"alpha_frac": 0.613438129,
"autogenerated": false,
"ratio": 4.125345986555951,
"config_test": false,... |
import sys
import os
if len(sys.argv) < 2:
print "I can haz argument?"
exit()
extension_templates = {
"html": "<!-- %s -->\n\n%s",
"kit": "<!-- %s -->\n\n%s",
"php": "<!-- %s -->\n\n%s",
"css": "/* %s */\n\n%s",
"scss": "/* %s */\n\n%s",
"less": "/* %s */\n\n%s",
"js": "/* %s */\n... | {
"repo_name": "lucijanblagonic/interface-inventory",
"path": "create.py",
"copies": "1",
"size": "1172",
"license": "mit",
"hash": 907463852679904800,
"line_mean": 25.0666666667,
"line_max": 75,
"alpha_frac": 0.5554607509,
"autogenerated": false,
"ratio": 2.8866995073891624,
"config_test": fals... |
__author__ = 'Nikolay Arefyev'
from math import ceil
import numpy as np
from .parallel import parallel_map
def argmaxk_rows_basic(arr, k=10, sort=False):
"""
Reference non-optimized implementation.
"""
if sort:
return np.argsort(arr, axis=1)[:, :-k - 1:-1]
else:
return np.argpar... | {
"repo_name": "nlpub/hyperstar",
"path": "batch_sim/argmaxk.py",
"copies": "2",
"size": "2891",
"license": "mit",
"hash": 7340146653793153000,
"line_mean": 41.5147058824,
"line_max": 129,
"alpha_frac": 0.6620546524,
"autogenerated": false,
"ratio": 3.389214536928488,
"config_test": false,
"ha... |
__author__ = 'Nikolay Arefyev'
import numpy as np
import psutil
from .argmaxk import argmaxk_rows
def nn_vec_basic(arr1, arr2, topn, sort=True, return_sims=False, nthreads=8):
"""
For each row in arr1 (m1 x d) find topn most similar rows from arr2 (m2 x d). Similarity is defined as dot product.
Please n... | {
"repo_name": "nlpub/hyperstar",
"path": "batch_sim/nn_vec.py",
"copies": "2",
"size": "3517",
"license": "mit",
"hash": 9105423971938537000,
"line_mean": 52.2878787879,
"line_max": 122,
"alpha_frac": 0.6627807791,
"autogenerated": false,
"ratio": 3.063588850174216,
"config_test": false,
"has... |
__author__ = 'Nikolay Arefyev'
import sys
import threading
from itertools import count
def foreach(f, l, threads=3, return_=False):
"""
Apply f to each element of l, in parallel. Return list [f(v) for v in l], the order of results f(v) is the same as
the order of inputs v in l.
"""
if threads > ... | {
"repo_name": "nlpub/hyperstar",
"path": "batch_sim/parallel.py",
"copies": "2",
"size": "2048",
"license": "mit",
"hash": -1432994294818937900,
"line_mean": 27.8450704225,
"line_max": 118,
"alpha_frac": 0.4165039062,
"autogenerated": false,
"ratio": 4.520971302428256,
"config_test": false,
"... |
__author__ = 'Nikolay Burlutskiy'
from Features import features as features
from itertools import combinations
BASIC = ['U_QUESTIONS', 'U_ANSWERS', 'NUM_OF_A_ACCEPTED_BY_OTHERS',
'U_REPUTATION', 'U_UPVOTES', 'U_DOWNVOTES', 'U_VIEWS', 'Q_VIEWS']
AGE = ['DAYS_ON_SITE']
TAG1 = ['TAG_POPULARITY_AV', 'NUM_POP_TAG... | {
"repo_name": "Nik0l/UTemPro",
"path": "FeatureSelector.py",
"copies": "1",
"size": "7508",
"license": "mit",
"hash": 5399152084090456000,
"line_mean": 47.7532467532,
"line_max": 117,
"alpha_frac": 0.5518114012,
"autogenerated": false,
"ratio": 2.7391462969719083,
"config_test": false,
"has_n... |
from __future__ import division
import numpy as np
from scipy.sparse import issparse
from scipy.special import digamma
from ..externals.six import moves
from ..metrics.cluster.supervised import mutual_info_score
from ..neighbors import NearestNeighbors
from ..preprocessing import scale
from ..utils import check_rando... | {
"repo_name": "DailyActie/Surrogate-Model",
"path": "01-codes/scikit-learn-master/sklearn/feature_selection/mutual_info_.py",
"copies": "1",
"size": "16104",
"license": "mit",
"hash": 5879149595540377000,
"line_mean": 35.7671232877,
"line_max": 82,
"alpha_frac": 0.642945852,
"autogenerated": false,... |
import numpy as np
from scipy.sparse import issparse
from scipy.special import digamma
from ..metrics.cluster import mutual_info_score
from ..neighbors import NearestNeighbors, KDTree
from ..preprocessing import scale
from ..utils import check_random_state
from ..utils.fixes import _astype_copy_false
from ..utils.val... | {
"repo_name": "xuewei4d/scikit-learn",
"path": "sklearn/feature_selection/_mutual_info.py",
"copies": "10",
"size": "16753",
"license": "bsd-3-clause",
"hash": 6450680558956235000,
"line_mean": 36.3118040089,
"line_max": 79,
"alpha_frac": 0.6418551901,
"autogenerated": false,
"ratio": 3.915167095... |
import numpy as np
from scipy.sparse import issparse
from scipy.special import digamma
from ..metrics.cluster import mutual_info_score
from ..neighbors import NearestNeighbors
from ..preprocessing import scale
from ..utils import check_random_state
from ..utils.fixes import _astype_copy_false
from ..utils.validation ... | {
"repo_name": "huzq/scikit-learn",
"path": "sklearn/feature_selection/_mutual_info.py",
"copies": "1",
"size": "16788",
"license": "bsd-3-clause",
"hash": 7343114533855061000,
"line_mean": 36.1415929204,
"line_max": 79,
"alpha_frac": 0.642363593,
"autogenerated": false,
"ratio": 3.933458294283036... |
import numpy as np
from scipy.sparse import issparse
from scipy.special import digamma
from ..metrics.cluster.supervised import mutual_info_score
from ..neighbors import NearestNeighbors
from ..preprocessing import scale
from ..utils import check_random_state
from ..utils.fixes import _astype_copy_false
from ..utils.... | {
"repo_name": "chrsrds/scikit-learn",
"path": "sklearn/feature_selection/mutual_info_.py",
"copies": "5",
"size": "17110",
"license": "bsd-3-clause",
"hash": -4625143264831579000,
"line_mean": 36.9379157428,
"line_max": 83,
"alpha_frac": 0.6446522501,
"autogenerated": false,
"ratio": 3.9670762810... |
__author__ = "nikolojedison & auxchar"
#Code copied from 2015_Lopez_Jr. Some changes to fit with 2016 setup.
import wpilib
from utilities.settings import Settings
def precision_mode(controller_input, trigger, button):
"""copied from CubertPy and tweaked for 2016 use."""
if trigger == True and not button == ... | {
"repo_name": "DenfeldRobotics4009/2016_Dos_Point_Oh",
"path": "utilities/drive_control.py",
"copies": "1",
"size": "2328",
"license": "bsd-3-clause",
"hash": 4328222528480226000,
"line_mean": 38.4576271186,
"line_max": 103,
"alpha_frac": 0.6847079038,
"autogenerated": false,
"ratio": 3.867109634... |
__author__ = 'nikolojedison & auxchar'
#Code mostly copied from 2015_Lopez_Jr. Needs to be implemented.
import wpilib
def precision_mode(controller_input, button_state):
"""copied from CubertPy, b/c it worked"""
if button_state:
return controller_input * 0.5
else:
return controller_input
d... | {
"repo_name": "DenfeldRobotics4009/octobot",
"path": "utilities/drive_control.py",
"copies": "1",
"size": "1542",
"license": "bsd-3-clause",
"hash": -181284301168227420,
"line_mean": 35.7380952381,
"line_max": 98,
"alpha_frac": 0.6750972763,
"autogenerated": false,
"ratio": 3.5125284738041,
"co... |
__author__ = "nikolojedison, auxiliary-character"
def scale_reletive(v, top, bottom):
return v*(top-bottom)+bottom
def unscale_reletive(v, top, bottom):
return (v-bottom)/(top-bottom)
kMastBack = .423 #This is so the lift won't go up when the mast is back - DO NOT CHANGE IN TESTING
kMastBackLimit = .328
kMas... | {
"repo_name": "DenfeldRobotics4009/2015_Lopez_Jr",
"path": "setpoints.py",
"copies": "1",
"size": "1250",
"license": "bsd-3-clause",
"hash": -8068386003429354000,
"line_mean": 35.7647058824,
"line_max": 98,
"alpha_frac": 0.6952,
"autogenerated": false,
"ratio": 2.8216704288939054,
"config_test"... |
__author__ = "nikolojedison"
import math
import wpilib
from wpilib.command import Subsystem
from commands.manual_commands.mecanum_drive_with_joystick import MecanumDriveWithJoystick
from drive_control import *
from imu_simple import IMUSimple
class GyroDummy:
"""Makes the sim happy. Written by Aux."""
n = 0
... | {
"repo_name": "DenfeldRobotics4009/2015_Lopez_Jr",
"path": "subsystems/drivetrain.py",
"copies": "1",
"size": "1966",
"license": "bsd-3-clause",
"hash": 8621806448324115000,
"line_mean": 27.9117647059,
"line_max": 98,
"alpha_frac": 0.6057985758,
"autogenerated": false,
"ratio": 3.320945945945946,... |
__author__ = "nikolojedison"
import math
import wpilib
from wpilib.command import Subsystem
from commands.manual.mecanum_drive_with_joystick import MecanumDriveWithJoystick
from utilities.drive_control import *
class Drivetrain(Subsystem):
'''Class drivetrain uses a few Talons to run a 'bot.
'''
def __in... | {
"repo_name": "DenfeldRobotics4009/2016_Dos_Point_Oh",
"path": "subsystems/drivetrain.py",
"copies": "1",
"size": "1566",
"license": "bsd-3-clause",
"hash": 2329965566658461000,
"line_mean": 30.9591836735,
"line_max": 98,
"alpha_frac": 0.6443167305,
"autogenerated": false,
"ratio": 3.331914893617... |
__author__ = "nikolojedison"
import math
import wpilib
from wpilib.command import Subsystem
from utilities.drive_control import *
from commands.manual.octo_drive_with_joystick import OctoDriveWithJoystick
from commands.auto.gyro_reset import GyroReset
from utilities.imu_simple import IMUSimple
class GyroDummy:
"... | {
"repo_name": "DenfeldRobotics4009/octobot",
"path": "subsystems/drivetrain.py",
"copies": "1",
"size": "4239",
"license": "bsd-3-clause",
"hash": -303580138685979140,
"line_mean": 30.8721804511,
"line_max": 199,
"alpha_frac": 0.5468270819,
"autogenerated": false,
"ratio": 3.322100313479624,
"c... |
__author__ = 'nikolojedison'
import wpilib
from wpilib.command import Command
from wpilib.command import PIDSubsystem
from wpilib.buttons import Trigger
from commands.manual_commands.manual_lift import ManualLift
import setpoints
class ResetEncoder(Command):
def __init__(self, robot, lift):
super().__init_... | {
"repo_name": "DenfeldRobotics4009/2015_Lopez_Jr",
"path": "subsystems/lift.py",
"copies": "1",
"size": "2623",
"license": "bsd-3-clause",
"hash": 7284206135452017000,
"line_mean": 30.987804878,
"line_max": 103,
"alpha_frac": 0.5996950057,
"autogenerated": false,
"ratio": 3.5113788487282465,
"c... |
_author__ = 'nikolojedison'
import wpilib
from wpilib.command import PIDSubsystem
from commands.manual_commands.manual_claw import ManualClaw
import setpoints
class Claw(PIDSubsystem):
"""This is a claw. It does claw things."""
def __init__(self, robot):
super().__init__(20, 0, 0)
self.robot =... | {
"repo_name": "DenfeldRobotics4009/2015_Lopez_Jr",
"path": "subsystems/claw.py",
"copies": "1",
"size": "1247",
"license": "bsd-3-clause",
"hash": -7976253995350593000,
"line_mean": 30.9743589744,
"line_max": 98,
"alpha_frac": 0.6487570168,
"autogenerated": false,
"ratio": 3.3794037940379402,
"... |
_author__ = 'nikolojedison'
import wpilib
from wpilib.command import PIDSubsystem
import setpoints
class Mast(PIDSubsystem):
def __init__(self, robot):
super().__init__(40, 0, 0) #__init__(P, I, D)
self.robot = robot
self.mast_pot = wpilib.AnalogPotentiometer(0)
self.motor = wpilib... | {
"repo_name": "DenfeldRobotics4009/2015_Lopez_Jr",
"path": "subsystems/mast.py",
"copies": "1",
"size": "1298",
"license": "bsd-3-clause",
"hash": 4056782073996932000,
"line_mean": 28.5,
"line_max": 119,
"alpha_frac": 0.6047765794,
"autogenerated": false,
"ratio": 3.319693094629156,
"config_tes... |
__author__ = 'nikolojedison'
import wpilib
def precision_mode(controller_input, button_state):
"""copied from CubertPy, b/c it worked"""
if button_state:
return controller_input * 0.5
else:
return controller_input
def exponential_scaling(base, exponent):
if base>0:
return abs(b... | {
"repo_name": "DenfeldRobotics4009/2015_Lopez_Jr",
"path": "drive_control.py",
"copies": "2",
"size": "1837",
"license": "bsd-3-clause",
"hash": 563834455148974900,
"line_mean": 35.0196078431,
"line_max": 98,
"alpha_frac": 0.6657593903,
"autogenerated": false,
"ratio": 3.5394990366088632,
"conf... |
__author__ = 'nikolojedison'
#2/12 21:30 - a little tired due to last night, but still going. Waiting on robot.
#2/13 17:53 - waiting on robot, again. Things are working fine in programming though.
#2/13 22:00 - working on setpoints, slowly but surely.
#2/14 13:40 - waiting on more things.
#2/14 23:30 - got the mappin... | {
"repo_name": "DenfeldRobotics4009/2015_Lopez_Jr",
"path": "oi.py",
"copies": "1",
"size": "10852",
"license": "bsd-3-clause",
"hash": -5918757749478458000,
"line_mean": 48.3272727273,
"line_max": 124,
"alpha_frac": 0.6902875046,
"autogenerated": false,
"ratio": 3.2316855270994638,
"config_test... |
__author__ = 'nikolojedison'
from wpilib.command import CommandGroup
#commands everywhere
from commands.setpoint_commands.grab_tote import GrabTote
from commands.semiauto_commands.drive_straight import DriveStraight
from commands.setpoint_commands.lift_go_to_level import LiftGoToLevel
from commands.manual_commands.me... | {
"repo_name": "DenfeldRobotics4009/2015_Lopez_Jr",
"path": "commands/auto_commands/tote_autonomous.py",
"copies": "1",
"size": "1557",
"license": "bsd-3-clause",
"hash": -2667719463529760000,
"line_mean": 43.4857142857,
"line_max": 89,
"alpha_frac": 0.7206165703,
"autogenerated": false,
"ratio": ... |
__author__ = 'nikolojedison'
from wpilib.command import CommandGroup
#Woo, commands
from commands.setpoint_commands.close_claw import CloseClaw
from commands.semiauto_commands.drive_straight import DriveStraight
from commands.setpoint_commands.lift_go_to_level import LiftGoToLevel
from commands.manual_commands.mecanu... | {
"repo_name": "DenfeldRobotics4009/2015_Lopez_Jr",
"path": "commands/auto_commands/three_tote_autonomous.py",
"copies": "1",
"size": "2620",
"license": "bsd-3-clause",
"hash": -6438263314605407000,
"line_mean": 40.5873015873,
"line_max": 89,
"alpha_frac": 0.6076335878,
"autogenerated": false,
"ra... |
__author__ = 'nikolojedison'
from wpilib.command import CommandGroup
#woo, commands.
from commands.setpoint_commands.grab_tote import GrabTote
from commands.semiauto_commands.drive_straight import DriveStraight
from commands.setpoint_commands.lift_go_to_level import LiftGoToLevel
from commands.manual_commands.mecanum... | {
"repo_name": "DenfeldRobotics4009/2015_Lopez_Jr",
"path": "commands/auto_commands/can_autonomous.py",
"copies": "1",
"size": "1605",
"license": "bsd-3-clause",
"hash": -1413351555510640400,
"line_mean": 43.5833333333,
"line_max": 89,
"alpha_frac": 0.723364486,
"autogenerated": false,
"ratio": 3.... |
__author__ = 'nikolojedison'
from wpilib.command import Command
import setpoints
class LiftGoToLevelShift(Command):
"""This is the shifting stuff. Useful."""
def __init__(self, robot, level, top_shift, bottom_shift):
super().__init__()
self.robot = robot
self.setTimeout(5)
self... | {
"repo_name": "DenfeldRobotics4009/2015_Lopez_Jr",
"path": "commands/setpoint_commands/lift_go_to_level_shift.py",
"copies": "1",
"size": "1143",
"license": "bsd-3-clause",
"hash": -2130502473415244300,
"line_mean": 29.8918918919,
"line_max": 83,
"alpha_frac": 0.6272965879,
"autogenerated": false,
... |
__author__ = 'nikolojedison'
from wpilib.command import Command
from .drive_straight import DriveStraight
from commands.setpoint_commands.close_claw import CloseClaw
class Shaker(Command):
"""This is the shakergrab that is insanely useful."""
def __init__(self, robot):
super().__init__()
self... | {
"repo_name": "DenfeldRobotics4009/2015_Lopez_Jr",
"path": "commands/semiauto_commands/shaker.py",
"copies": "1",
"size": "1165",
"license": "bsd-3-clause",
"hash": -6972802800784186000,
"line_mean": 28.8717948718,
"line_max": 68,
"alpha_frac": 0.5991416309,
"autogenerated": false,
"ratio": 3.710... |
__author__ = "nikolojedison"
import math
import wpilib
from wpilib.command import Subsystem
from utilities.pov_button import POVButton
from utilities.drive_control import *
from utilities.settings import Settings
from oi import OI
from commands.manual.power_of_the_friendship import DriveWithJoystick
class Drivetra... | {
"repo_name": "DenfeldRobotics4009/2016_Freckles",
"path": "subsystems/drivetrain.py",
"copies": "1",
"size": "2590",
"license": "bsd-3-clause",
"hash": -9001872582518811000,
"line_mean": 33.0789473684,
"line_max": 119,
"alpha_frac": 0.633976834,
"autogenerated": false,
"ratio": 3.412384716732543... |
__author__ = "nikolojedison"
import wpilib
from wpilib.buttons import JoystickButton, InternalButton
from networktables import NetworkTable
from utilities.pov_button import POVButton
from utilities.drive_control import *
from utilities.settings import Settings
import utilities.settings
from macros.play_macro import ... | {
"repo_name": "DenfeldRobotics4009/2016_Freckles",
"path": "oi.py",
"copies": "1",
"size": "5611",
"license": "bsd-3-clause",
"hash": -1663521272515794200,
"line_mean": 42.8359375,
"line_max": 88,
"alpha_frac": 0.6335769025,
"autogenerated": false,
"ratio": 3.662532637075718,
"config_test": fal... |
__author__ = "nikolojedison"
import wpilib
from wpilib.command import PIDSubsystem
from commands.manual.manual_tilt import ManualTilt
from utilities.settings import Settings
class Tilt(PIDSubsystem):
"""The tilting mechanism for the shooter."""
def __init__(self, robot):
super().__init__(-25, 0, 0)
... | {
"repo_name": "DenfeldRobotics4009/2016_Freckles",
"path": "subsystems/tilt.py",
"copies": "1",
"size": "1271",
"license": "bsd-3-clause",
"hash": 7986374201695805000,
"line_mean": 27.2444444444,
"line_max": 77,
"alpha_frac": 0.6428009441,
"autogenerated": false,
"ratio": 3.4444444444444446,
"c... |
__author__ = 'nikolojedison'
#May need more libraries in the future, esp. once everything else is properly implemented.
import wpilib
from networktables import NetworkTable
from wpilib.buttons import JoystickButton, InternalButton
from commands.manual.octo_drive_with_joystick import OctoDriveWithJoystick
from utiliti... | {
"repo_name": "DenfeldRobotics4009/octobot",
"path": "oi.py",
"copies": "1",
"size": "1321",
"license": "bsd-3-clause",
"hash": 1619247173029901300,
"line_mean": 32.8717948718,
"line_max": 90,
"alpha_frac": 0.7600302801,
"autogenerated": false,
"ratio": 3.10093896713615,
"config_test": false,
... |
__author__ = 'Niko Reunanen'
from sklearn.ensemble import RandomForestRegressor as RFR
import numpy as np
class DataGenerator(object):
def __init__(self):
self.ready = False
def fit(self, x):
pass
def sample(self):
return 0.0
def stream(self, max_=None):
"""
... | {
"repo_name": "nikoreun/data-generator-engine",
"path": "dge/__init__.py",
"copies": "1",
"size": "4023",
"license": "mit",
"hash": -6699851854444167000,
"line_mean": 31.7154471545,
"line_max": 120,
"alpha_frac": 0.5945811583,
"autogenerated": false,
"ratio": 4.130390143737166,
"config_test": f... |
import sys
import csv
import os
import jinja2
CSV_FILE = 'switch-datafile.csv'
SW_TEMPLATE_FILE = 'cat3850-switch-template.j2'
def make_vlan_dict(row):
vdb = dict([(row['voice_vlan_id'], 'VOICE')])
for i in range(2,9):
vid = 'vlan_id_' + str(i)
vname = 'vlan_name_' + str(i... | {
"repo_name": "niladri-datta/cisco-gen-config",
"path": "gen-config.py",
"copies": "1",
"size": "2485",
"license": "mit",
"hash": -6838297457349288000,
"line_mean": 30.075,
"line_max": 78,
"alpha_frac": 0.676861167,
"autogenerated": false,
"ratio": 3.4134615384615383,
"config_test": false,
"h... |
__author__ = 'Nil & Jordi'
from fitness import *
import math
from random import random, randint
from random import seed
from random import normalvariate as normal
from random import choice
import numpy as np
# target = [[0, 0, 0, 1, 0, 1, 0, 1]]
# target = [[1, 1, 0, 0, 0, 0, 0, 1]]
# target = [[0, 1,... | {
"repo_name": "niladell/GA_circuit_design",
"path": "ga.py",
"copies": "1",
"size": "7575",
"license": "mit",
"hash": -5926676547845629000,
"line_mean": 25.8566176471,
"line_max": 125,
"alpha_frac": 0.5123432343,
"autogenerated": false,
"ratio": 2.968260188087774,
"config_test": false,
"has_n... |
__author__ = 'Nil & Jordi'
import numpy as np
def fitness(n, target):
'''
Fitness function that evaluates how close is a given circuit "n" to the desired output.
'''
fit = 0
j = 2
for i in n:
j += 0.5
if j < (i + 0.1): # + 0.1 used to avoid comparison errors
... | {
"repo_name": "niladell/GA_circuit_design",
"path": "fitness.py",
"copies": "1",
"size": "2016",
"license": "mit",
"hash": -4784152590782970000,
"line_mean": 27.6764705882,
"line_max": 119,
"alpha_frac": 0.5,
"autogenerated": false,
"ratio": 3.6,
"config_test": false,
"has_no_keywords": false... |
__author__ = 'Nils Schmidt'
# TODO: #54,#55: adjust doc
class Singletons:
"""
Stores all singletons.
The module `SingletonInit` shall be used to initialize them. Therefore, we prevent cyclic imports.
Singletons which have state that shall be resetted when a new simulation is started, needs to
be r... | {
"repo_name": "miniworld-project/miniworld_core",
"path": "miniworld/model/singletons/Singletons.py",
"copies": "1",
"size": "1495",
"license": "mit",
"hash": 1416254969636808700,
"line_mean": 29.5102040816,
"line_max": 102,
"alpha_frac": 0.6066889632,
"autogenerated": false,
"ratio": 4.283667621... |
import re
import numpy as np
import datetime as dt
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
import matplotlib.dates as mdates
# from scipy.interpolate import spline # Need it again in case we want to smooth the curves
# Initiate variables
voltage = []
time = []
data = []
s = []
sTime = []
# ... | {
"repo_name": "carentsen/RMUAST",
"path": "rmuast_s17_module_2/exercise_discharge_data/GraphGenerator.py",
"copies": "1",
"size": "2064",
"license": "bsd-3-clause",
"hash": -4083147594539835400,
"line_mean": 28.0704225352,
"line_max": 113,
"alpha_frac": 0.6865310078,
"autogenerated": false,
"rati... |
__author__ = 'Nino Bašić <nino.basic@fmf.uni-lj.si>'
import unittest
from zavetisce import Zavetisce2
class ZavetisceTest(unittest.TestCase):
def test_posvoji_psa(self):
z = Zavetisce2()
z.najdena('Taček', 'pes')
z.najdena('Šarki', 'pes')
z.najdena('Tom', 'mačka')
z.najde... | {
"repo_name": "nbasic/racunalnistvo-1",
"path": "dn1/zavetisce_test.py",
"copies": "1",
"size": "6190",
"license": "mit",
"hash": 1818933964525830700,
"line_mean": 35.6946107784,
"line_max": 52,
"alpha_frac": 0.5634791123,
"autogenerated": false,
"ratio": 2.565089995814148,
"config_test": true,... |
# Problem Statement - Given number of jobs and number of applicants
# And for each applicant given that wether each applicant is
# eligible to get the job or not in the form of matrix
# Return 1 if a person can get the job
def dfs(graph, applicant, visited, result,nApplicants,nJobs):
for i in range(0,nJobs):
if(... | {
"repo_name": "saru95/DSA",
"path": "Python/MBM.py",
"copies": "1",
"size": "1506",
"license": "mit",
"hash": -6853247334996127000,
"line_mean": 27.9807692308,
"line_max": 94,
"alpha_frac": 0.6792828685,
"autogenerated": false,
"ratio": 2.9587426326129664,
"config_test": false,
"has_no_keywor... |
__author__ = 'Nir'
import yql
def getNumbeoData(country, city, product):
#Define the URL to query in the Numbeo web page (by country and city)
URL = "http://www.numbeo.com/cost-of-living/city_result.jsp?country=" + country + "&city=" + city + "&displayCurrency=ILS"
#Fix the + problem
URL = URL.repl... | {
"repo_name": "NnNHackTeam/israkotz",
"path": "IsraKotzApp/collectNumbeoData.py",
"copies": "1",
"size": "1048",
"license": "mit",
"hash": -5720192529041449000,
"line_mean": 33.9333333333,
"line_max": 136,
"alpha_frac": 0.6374045802,
"autogenerated": false,
"ratio": 3.264797507788162,
"config_t... |
__author__ = 'Nishanth'
import datetime
import sys
import pytz
import requests
import re
import json
import socket
import time
import threading
from googleapiclient.discovery import build
from oauth2client.client import GoogleCredentials
from juliabox.cloud import JBPluginCloud
from juliabox.db import JBPluginDB
fro... | {
"repo_name": "tanmaykm/JuliaBox",
"path": "engine/src/juliabox/plugins/compute_gce/impl_gce.py",
"copies": "3",
"size": "22593",
"license": "mit",
"hash": 411337647854751800,
"line_mean": 38.292173913,
"line_max": 131,
"alpha_frac": 0.5923073518,
"autogenerated": false,
"ratio": 3.84234693877551... |
__author__ = 'Nishanth'
import os
import urllib
import io
from juliabox.cloud import JBPluginCloud
from juliabox.jbox_util import JBoxCfg
from oauth2client.client import GoogleCredentials
from googleapiclient.discovery import build
from googleapiclient.http import MediaIoBaseDownload, MediaIoBaseUpload
from googleapic... | {
"repo_name": "gsd-ufal/Juliabox",
"path": "engine/src/juliabox/plugins/bucket_gs/impl_gs.py",
"copies": "1",
"size": "3969",
"license": "mit",
"hash": -738900676468960800,
"line_mean": 34.4375,
"line_max": 92,
"alpha_frac": 0.5605946082,
"autogenerated": false,
"ratio": 4.134375,
"config_test"... |
__author__ = 'Nishanth'
import os
import urllib
import io
from juliabox.cloud import JBPluginCloud
from juliabox.jbox_util import JBoxCfg, retry_on_errors
from oauth2client.client import GoogleCredentials
from googleapiclient.discovery import build
from googleapiclient.http import MediaIoBaseDownload, MediaIoBaseUploa... | {
"repo_name": "JuliaLang/JuliaBox",
"path": "engine/src/juliabox/plugins/bucket_gs/impl_gs.py",
"copies": "3",
"size": "6735",
"license": "mit",
"hash": 1662430539198104800,
"line_mean": 34.8244680851,
"line_max": 92,
"alpha_frac": 0.526800297,
"autogenerated": false,
"ratio": 4.1806331471135945,... |
__author__ = 'Nishanth'
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
import time
from juliabox.cloud import JBPluginCloud
from juliabox.db import JBPluginDB
from juliabox.jbox_util import JBoxCfg
class JBoxSMTP(JBPluginCloud):
provides = [JBPluginCloud.JBP_SEND... | {
"repo_name": "tanmaykm/JuliaBox",
"path": "engine/src/juliabox/plugins/sendmail_smtp/impl_smtp.py",
"copies": "3",
"size": "3424",
"license": "mit",
"hash": 4855621328742138000,
"line_mean": 30.4128440367,
"line_max": 99,
"alpha_frac": 0.5960864486,
"autogenerated": false,
"ratio": 3.39009900990... |
__author__ = "Nishanth"
import threading
import datetime
import time
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
from juliabox.cloud import JBPluginCloud
from oauth2client.client import GoogleCredentials
from juliabox.jbox_util import JBoxCfg, retry_on_errors
class Googl... | {
"repo_name": "tanmaykm/JuliaBox",
"path": "engine/src/juliabox/plugins/google_monitoring_v2/google_monitoring_v2.py",
"copies": "3",
"size": "8340",
"license": "mit",
"hash": 6651101405748632000,
"line_mean": 40.2871287129,
"line_max": 108,
"alpha_frac": 0.5483213429,
"autogenerated": false,
"ra... |
__author__ = 'Nishanth'
import threading
import datetime
import time
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
from juliabox.cloud import JBPluginCloud
from oauth2client.client import GoogleCredentials
from juliabox.jbox_util import JBoxCfg, retry_on_errors
class Googl... | {
"repo_name": "tanmaykm/JuliaBox",
"path": "engine/src/juliabox/plugins/google_monitoring_v3/google_monitoring_v3.py",
"copies": "3",
"size": "9054",
"license": "mit",
"hash": 6456017432491484000,
"line_mean": 41.308411215,
"line_max": 145,
"alpha_frac": 0.5203225094,
"autogenerated": false,
"rat... |
__author__ = 'Nishanth'
import threading
import MySQLdb
import decimal
import copy
from juliabox.db import JBPluginDB, JBoxDBItemNotFound
from juliabox.jbox_util import JBoxCfg, LoggerMixin
class JBoxMySQLTable(LoggerMixin):
OP = {
'eq': (' = %%(%s)s', lambda x: x),
'ne': (' != %%(%s)s', lambda ... | {
"repo_name": "gsd-ufal/Juliabox",
"path": "engine/src/juliabox/plugins/db_cloudsql/impl_cloudsql.py",
"copies": "1",
"size": "7629",
"license": "mit",
"hash": 2534459388444389000,
"line_mean": 29.1541501976,
"line_max": 75,
"alpha_frac": 0.5210381439,
"autogenerated": false,
"ratio": 3.710603112... |
__author__ = 'Nishanth'
from juliabox.cloud import JBPluginCloud
from juliabox.jbox_util import JBoxCfg, retry_on_errors
from googleapiclient.discovery import build
from oauth2client.client import GoogleCredentials
import threading
class JBoxGCD(JBPluginCloud):
provides = [JBPluginCloud.JBP_DNS, JBPluginCloud.JB... | {
"repo_name": "tanmaykm/JuliaBox",
"path": "engine/src/juliabox/plugins/dns_gcd/impl_gcd.py",
"copies": "3",
"size": "2592",
"license": "mit",
"hash": 4894450957600686000,
"line_mean": 35,
"line_max": 80,
"alpha_frac": 0.5497685185,
"autogenerated": false,
"ratio": 3.817378497790869,
"config_te... |
__author__ = 'NishantNath'
# !/usr/bin/env python
'''
Using : Python 2.7+ (backward compatibility exists for Python 3.x if separate environment created)
Required files : hdf5_getters.py
Required packages : numpy, pandas, matplotlib, sklearn
Steps:
1.
# Uses Manifold PCA to find the most important features
'''
impor... | {
"repo_name": "nishantnath/MusicPredictiveAnalysis_EE660_USCFall2015",
"path": "Code/Machine_Learning_Algos/10k_Tests/ml_classification_manifold_pca.py",
"copies": "1",
"size": "1899",
"license": "mit",
"hash": 6832495889569086000,
"line_mean": 40.2826086957,
"line_max": 666,
"alpha_frac": 0.65402843... |
__author__ = 'nishara','Manuel'
from sqlalchemy import *
from sqlalchemy.engine import reflection
from tabulate import tabulate
from colorama import *
import os
import logging
class QueryEvaluator:
# The typical usage of create_engine() is once per particular database URL, held globally for the
# lifetime of ... | {
"repo_name": "saltzm/yadi",
"path": "yadi/sql_engine/query_evaluator.py",
"copies": "1",
"size": "4463",
"license": "bsd-3-clause",
"hash": -5882511341593446000,
"line_mean": 40.3240740741,
"line_max": 116,
"alpha_frac": 0.6083352005,
"autogenerated": false,
"ratio": 4.068368277119417,
"config... |
import os
import sys
import re
import sublime
import subprocess
import cssbeautifier
class ScssFormatter:
def __init__(self, formatter):
self.formatter = formatter
self.opts = formatter.settings.get('codeformatter_scss_options')
def format(self, text):
text = text.decode("utf-8")
... | {
"repo_name": "RevanProdigalKnight/sublimetext-codeformatter",
"path": "codeformatter/scssformatter.py",
"copies": "1",
"size": "1995",
"license": "mit",
"hash": -5628196058235972000,
"line_mean": 26.7083333333,
"line_max": 99,
"alpha_frac": 0.6015037594,
"autogenerated": false,
"ratio": 4.006024... |
import re
import scssbeautifier
class ScssFormatter:
def __init__(self, formatter):
self.formatter = formatter
self.opts = formatter.settings.get('codeformatter_scss_options')
def format(self, text):
text = text.decode('utf-8')
stderr = ''
stdout = ''
option... | {
"repo_name": "crlang/sublime-text---front-end-config",
"path": "Data/Packages/CodeFormatter/codeformatter/scssformatter.py",
"copies": "2",
"size": "2665",
"license": "mit",
"hash": 4668122433123801000,
"line_mean": 31.9012345679,
"line_max": 93,
"alpha_frac": 0.5876172608,
"autogenerated": false,... |
__author__ = 'Nispand'
import random
import memcache
import hashlib
import time
import MySQLdb
from random_query_generator import setquery
def connect_to_database():
cnx= {
'host': 'nisudb.crsevmpdcmrk.us-west-2.rds.amazonaws.com',
'username': 'nispand',
'password': 'nispand1492',
'... | {
"repo_name": "Nispand1492/amazon_cloud_project",
"path": "memcache_code.py",
"copies": "1",
"size": "2878",
"license": "apache-2.0",
"hash": 7799921833302424000,
"line_mean": 28.0707070707,
"line_max": 105,
"alpha_frac": 0.628561501,
"autogenerated": false,
"ratio": 3.2593431483578708,
"config... |
__author__ = 'Nispand'
import random
import time
def get_lang():
Lang = ["English","Spanish"]
id = random.randint(0,1)
print type(Lang[id])
return Lang[id]
def get_segment_id():
seg_id = random.randint(1,103214)
#print seg_id
return seg_id
def get_contract_id():
contract_id = random.r... | {
"repo_name": "Nispand1492/amazon_cloud_project",
"path": "random_query_generator.py",
"copies": "1",
"size": "2489",
"license": "apache-2.0",
"hash": 1872702380855279000,
"line_mean": 24.9270833333,
"line_max": 147,
"alpha_frac": 0.5817597429,
"autogenerated": false,
"ratio": 3.150632911392405,
... |
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest2 as unittest
from nose.plugins.attrib import attr
from mock import patch, MagicMock
import os
from jnpr.junos import Device
from jnpr.junos.facts.swver import facts_software_version as software_version, version_info
from jnpr.jun... | {
"repo_name": "fugitifduck/py-junos-eznc",
"path": "tests/unit/facts/test_swver.py",
"copies": "1",
"size": "6496",
"license": "apache-2.0",
"hash": 5615834103321331000,
"line_mean": 36.9883040936,
"line_max": 91,
"alpha_frac": 0.6020628079,
"autogenerated": false,
"ratio": 3.3075356415478616,
... |
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest
from mock import patch
from nose.plugins.attrib import attr
from jnpr.junos import Device
from jnpr.junos.ofacts.personality import facts_personality as personality
@attr('unit')
class TestPersonality(unittest.TestCase):
@... | {
"repo_name": "spidercensus/py-junos-eznc",
"path": "tests/unit/ofacts/test_personality.py",
"copies": "3",
"size": "2818",
"license": "apache-2.0",
"hash": -172175017764743140,
"line_mean": 33.3658536585,
"line_max": 78,
"alpha_frac": 0.6288147622,
"autogenerated": false,
"ratio": 3.378896882494... |
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest
from nose.plugins.attrib import attr
from jnpr.junos.jxml import NAME, INSERT, remove_namespaces
@attr('unit')
class Test_JXML(unittest.TestCase):
def test_name(self):
op = NAME('test')
self.assertEqual(op['... | {
"repo_name": "shermdog/py-junos-eznc",
"path": "tests/unit/test_jxml.py",
"copies": "4",
"size": "1051",
"license": "apache-2.0",
"hash": 1549614133024519200,
"line_mean": 29.0285714286,
"line_max": 72,
"alpha_frac": 0.5385347288,
"autogenerated": false,
"ratio": 3.821818181818182,
"config_tes... |
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest
from nose.plugins.attrib import attr
from mock import patch, MagicMock
from lxml import etree
import os
from jnpr.junos import Device
from jnpr.junos.ofacts.chassis import facts_chassis as chassis
from jnpr.junos.exception import... | {
"repo_name": "pklimai/py-junos-eznc",
"path": "tests/unit/ofacts/test_chassis.py",
"copies": "3",
"size": "2746",
"license": "apache-2.0",
"hash": -6170455480294070000,
"line_mean": 37.1388888889,
"line_max": 79,
"alpha_frac": 0.6529497451,
"autogenerated": false,
"ratio": 3.6908602150537635,
... |
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest
from nose.plugins.attrib import attr
from mock import patch, MagicMock
import os
from jnpr.junos import Device
from jnpr.junos.facts.routing_engines import facts_routing_engines as routing_engines
from ncclient.manager import Ma... | {
"repo_name": "fostasha/pynet_test",
"path": "py-junos-eznc/tests/unit/facts/test_routing_engines.py",
"copies": "2",
"size": "4218",
"license": "apache-2.0",
"hash": -4485490821928797700,
"line_mean": 36.3274336283,
"line_max": 85,
"alpha_frac": 0.6083451873,
"autogenerated": false,
"ratio": 3.7... |
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest
from nose.plugins.attrib import attr
from mock import patch
import os
from jnpr.junos import Device
from jnpr.junos.facts.routing_engines import facts_routing_engines as routing_engines
from ncclient.manager import Manager, make... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "tests/unit/facts/test_routing_engines.py",
"copies": "1",
"size": "2078",
"license": "apache-2.0",
"hash": 2056248151419391500,
"line_mean": 32.5161290323,
"line_max": 85,
"alpha_frac": 0.6203079885,
"autogenerated": false,
"ratio": 3.697508896797153... |
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest
from nose.plugins.attrib import attr
from jnpr.junos.device import Device
from jnpr.junos.rpcmeta import _RpcMetaExec
from mock import patch
from lxml import etree
@attr('unit')
class Test_RpcMetaExec(unittest.TestCase):
... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "tests/unit/test_rpcmeta.py",
"copies": "1",
"size": "2480",
"license": "apache-2.0",
"hash": 4483589652727999500,
"line_mean": 35.4705882353,
"line_max": 71,
"alpha_frac": 0.6173387097,
"autogenerated": false,
"ratio": 3.401920438957476,
"config_te... |
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest
from nose.plugins.attrib import attr
from jnpr.junos import Device
from jnpr.junos.utils.config import Config
from jnpr.junos.exception import RpcError, LockError,\
UnlockError, CommitError
from mock import MagicMock, patch
... | {
"repo_name": "dgjnpr/py-junos-eznc",
"path": "tests/unit/utils/test_config.py",
"copies": "1",
"size": "8287",
"license": "apache-2.0",
"hash": 3710522023664106500,
"line_mean": 38.0896226415,
"line_max": 79,
"alpha_frac": 0.6358151321,
"autogenerated": false,
"ratio": 3.692959001782531,
"conf... |
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest
from nose.plugins.attrib import attr
import os
import sys
from cStringIO import StringIO
from contextlib import contextmanager
from jnpr.junos import Device
from jnpr.junos.exception import RpcError, SwRollbackError
from jnpr.ju... | {
"repo_name": "JamesNickerson/py-junos-eznc",
"path": "tests/unit/utils/test_sw.py",
"copies": "1",
"size": "12873",
"license": "apache-2.0",
"hash": -114989922801233010,
"line_mean": 39.6088328076,
"line_max": 158,
"alpha_frac": 0.6241746291,
"autogenerated": false,
"ratio": 3.3672508501177085,
... |
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest
import sys
from nose.plugins.attrib import attr
from jnpr.junos import Device
from jnpr.junos.utils.config import Config
from jnpr.junos.exception import RpcError, LockError,\
UnlockError, CommitError, RpcTimeoutError, Config... | {
"repo_name": "spidercensus/py-junos-eznc",
"path": "tests/unit/utils/test_config.py",
"copies": "1",
"size": "27228",
"license": "apache-2.0",
"hash": -7626173609308908000,
"line_mean": 39.5178571429,
"line_max": 131,
"alpha_frac": 0.5991258998,
"autogenerated": false,
"ratio": 3.832230823363828... |
__author__ = 'nitin'
from abc import abstractmethod, ABCMeta
import time
from uuid import uuid4
from sqlalchemy.engine import create_engine
from sqlalchemy.sql.expression import select, and_, desc
from sqlalchemy.sql.schema import Table, MetaData
from config import DATBASE_URL
from binascii import a2b_hex, b2a_hex
de... | {
"repo_name": "nitinmanchanda/demeter-ui",
"path": "app/DBService.py",
"copies": "1",
"size": "5544",
"license": "mit",
"hash": -4272894118293915600,
"line_mean": 35.7152317881,
"line_max": 144,
"alpha_frac": 0.595959596,
"autogenerated": false,
"ratio": 3.8823529411764706,
"config_test": false... |
__author__ = 'nitin'
from datetime import datetime
from flask import render_template, session, redirect, url_for
from .import main
from .forms import NameForm
from .. import db
from ..models import User
import urllib2, json, operator
from webargs.core import Arg
from webargs.flaskparser import parser
from flask import... | {
"repo_name": "nitinmanchanda/demeter-ui",
"path": "app/main/views.py",
"copies": "1",
"size": "9762",
"license": "mit",
"hash": -645179349407631500,
"line_mean": 33.3732394366,
"line_max": 157,
"alpha_frac": 0.6280475312,
"autogenerated": false,
"ratio": 3.515304285199856,
"config_test": false... |
__author__ = 'Nitin Pasumarthy'
import psycopg2
from itertools import islice
import math
import os
from multiprocessing.pool import ThreadPool
import thread
import RatingsDAO
import Globals
import MetaDataDAO
MAX_LINES_COUNT_READ = 100000 # Maximum number of lines to read into memory.
LINE_SIZE = 21 # Length of e... | {
"repo_name": "Nithanaroy/DistributedDataPartitioning",
"path": "Assignment.py",
"copies": "1",
"size": "24057",
"license": "mit",
"hash": 3882788732794102000,
"line_mean": 41.2070175439,
"line_max": 278,
"alpha_frac": 0.6788876419,
"autogenerated": false,
"ratio": 3.9251101321585904,
"config_t... |
__author__ = 'nitinpasumarthy'
import Utils
class Tagger:
def __init__(self, hmm_model, sentence):
"""
Constructor for tagger class
:param hmm_model: Model trained on HMM with A and B lists
:param sentence: sentence to tag, with one word on each line
:return: tagger object... | {
"repo_name": "Nithanaroy/Parts-of-Speech-Tagger",
"path": "Tagger.py",
"copies": "1",
"size": "3378",
"license": "mit",
"hash": 1365142999788614000,
"line_mean": 39.2142857143,
"line_max": 118,
"alpha_frac": 0.5695677916,
"autogenerated": false,
"ratio": 3.608974358974359,
"config_test": false... |
__author__ = 'nitinpasumarthy'
import Utils
START_STATE_SYMBOL = 'A' # Beware of the assumption that it should be only 1 character
class Train:
def __init__(self, in_file):
self.input = in_file
self.start_state_symbol = START_STATE_SYMBOL
self.a = {}
self.b = {}
self.s... | {
"repo_name": "Nithanaroy/Parts-of-Speech-Tagger",
"path": "Train.py",
"copies": "1",
"size": "3141",
"license": "mit",
"hash": -8523688012153517000,
"line_mean": 33.1413043478,
"line_max": 89,
"alpha_frac": 0.5536453359,
"autogenerated": false,
"ratio": 3.573378839590444,
"config_test": false,... |
__author__ = 'nitinpasumarthy'
SENTENCE_SEPARATOR = '###/###'
WORD_TAG_SEPARATOR = '/'
DEBUG = True
def get_sentence(filepath):
"""
iteratively returns sentences from the input file
:return: {o: original sentence, 'c': cleaned sentence}
"""
import os
abs_filepath = os.path.abspath(filepath)
... | {
"repo_name": "Nithanaroy/Parts-of-Speech-Tagger",
"path": "Utils.py",
"copies": "1",
"size": "1469",
"license": "mit",
"hash": -1300531610132055600,
"line_mean": 26.2037037037,
"line_max": 95,
"alpha_frac": 0.6160653506,
"autogenerated": false,
"ratio": 3.8155844155844156,
"config_test": false... |
__author__ = 'nitishmehta'
from flask import Flask, request, session, g, redirect, url_for, \
abort, render_template, flash
import urllib2
import json
from flask.ext.pymongo import PyMongo
from pymongo import MongoClient
from User import *
app = Flask(__name__)
# You need to have a Mongo DB instance running on you... | {
"repo_name": "nmehta91/UCLA_VC",
"path": "webapp.py",
"copies": "1",
"size": "1983",
"license": "mit",
"hash": 2301628277762645200,
"line_mean": 32.6101694915,
"line_max": 373,
"alpha_frac": 0.6359051942,
"autogenerated": false,
"ratio": 3.3610169491525426,
"config_test": false,
"has_no_keyw... |
import pandas as pd # importing package, will be using "pd" to refer it
import urllib
import sqlite3 as sql
import pandas.io.sql as pd_sql
#This part downloads file from urls without any manual intervention
##Downloading Crime.csv file from url to working directory
#testfile=urllib.URLopener()
#testfile.retrieve("ht... | {
"repo_name": "krishnaaswani29/DenverCrimeVsPopulation",
"path": "DenverCrime.py",
"copies": "1",
"size": "11344",
"license": "mit",
"hash": -945709685830649000,
"line_mean": 35.71197411,
"line_max": 164,
"alpha_frac": 0.6707510578,
"autogenerated": false,
"ratio": 3.0876428960261295,
"config_t... |
__author__ = 'nlelab'
from bokeh.plotting import figure, output_file, show
from bokeh.models import DatetimeTickFormatter
import os
import MySQLdb
from datetime import datetime, timedelta
import json
import config as cfg
from math import pi
print os.getcwd()
db = MySQLdb.connect(host=cfg.mysql['host'], # your host, us... | {
"repo_name": "mirkolai/polarization_of_emotional_engagement_in_social_media",
"path": "020 - graph - time distribution tweet.py",
"copies": "1",
"size": "2314",
"license": "mit",
"hash": 8862951633814741000,
"line_mean": 28.6794871795,
"line_max": 103,
"alpha_frac": 0.5751944685,
"autogenerated": ... |
__author__ = 'nlelab'
import csv
import igraph
import MySQLdb
import MySQLdb.cursors
import config as cfg
import random
# Network-Centric Community Detection Algorithms
#Modularity Maximisation
#fastdegreedy
db = MySQLdb.connect(host=cfg.mysql['host'], # your host, usually localhost
user=cfg.mysql['user'... | {
"repo_name": "mirkolai/polarization_of_emotional_engagement_in_social_media",
"path": "031 - analysis - community detection igraph - fastgreedy.py",
"copies": "1",
"size": "3510",
"license": "mit",
"hash": -1722469507142959600,
"line_mean": 34.1,
"line_max": 124,
"alpha_frac": 0.6367521368,
"autog... |
__author__ = 'nlelab'
import csv
import igraph
import MySQLdb
import MySQLdb.cursors
import config as cfg
import random
# Network-Centric Community Detection Algorithms
#Modularity Maximisation
#infomap
db = MySQLdb.connect(host=cfg.mysql['host'], # your host, usually localhost
user=cfg.mysql['user'], # ... | {
"repo_name": "mirkolai/polarization_of_emotional_engagement_in_social_media",
"path": "032 - analysis - community detection igraph - infomap.py",
"copies": "1",
"size": "2742",
"license": "mit",
"hash": -8117792650592483000,
"line_mean": 30.5172413793,
"line_max": 124,
"alpha_frac": 0.6250911743,
... |
__author__ = 'nlelab'
import csv
import networkx as nx
import matplotlib.pyplot as plt
import MySQLdb
import config as cfg
import community # --> http://perso.crans.org/aynaud/communities/
db = MySQLdb.connect(host=cfg.mysql['host'], # your host, usually localhost
user=cfg.mysql['user'], # your username
... | {
"repo_name": "mirkolai/polarization_of_emotional_engagement_in_social_media",
"path": "030 - analysis - community detection.py",
"copies": "1",
"size": "5729",
"license": "mit",
"hash": 8555591874360377000,
"line_mean": 31.9252873563,
"line_max": 111,
"alpha_frac": 0.6673066853,
"autogenerated": f... |
__author__ = 'nlelab'
import os
import MySQLdb
import time
import json
import config as cfg
print os.getcwd()
db = MySQLdb.connect(host=cfg.mysql['host'], # your host, usually localhost
user=cfg.mysql['user'], # your username
passwd=cfg.mysql['passwd'], # your password
db=cfg.mys... | {
"repo_name": "mirkolai/polarization_of_emotional_engagement_in_social_media",
"path": "012 - analysis script - extract retweet relation.py",
"copies": "1",
"size": "1154",
"license": "mit",
"hash": 3503250723517821000,
"line_mean": 32.9705882353,
"line_max": 146,
"alpha_frac": 0.6057192374,
"autog... |
__author__ = 'nlivni'
import django
from django.conf.urls import patterns, url
from models import Story
from panews.views import StoryDetailView, StoryListView, StoryTemplateCreate, StoryDelete, StoryUpdate, CategoryListView, StoryCustom, StorySuccessView
django.setup()
urlpatterns = patterns('',
# url(r'^$', 'pan... | {
"repo_name": "nlivni/passiveaggressivenews_project",
"path": "passiveaggressivenews/panews/urls.py",
"copies": "1",
"size": "2000",
"license": "bsd-2-clause",
"hash": -2445572586114212400,
"line_mean": 33.5,
"line_max": 151,
"alpha_frac": 0.5905,
"autogenerated": false,
"ratio": 3.60360360360360... |
__author__ = 'nlivni'
from django.forms import ModelForm
from panews.models import Story
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Reset, Submit, Button, Field
from crispy_forms.bootstrap import FormActions
from django.core.mail import EmailMessage
# from panews.views import SI... | {
"repo_name": "nlivni/passiveaggressivenews_project",
"path": "passiveaggressivenews/panews/forms.py",
"copies": "1",
"size": "5790",
"license": "bsd-2-clause",
"hash": -543544974419842940,
"line_mean": 28.6923076923,
"line_max": 128,
"alpha_frac": 0.4811744387,
"autogenerated": false,
"ratio": 4... |
__author__, nl = "LaughDonor", []
time = length = late = 0
def returnIndex(array, number):
if not array:
return None
if len(array) == 1:
return 0 if number > array[0] else None
return binarySearch(array, number, 0, len(array) - 1)
def binarySearch(array, number, si, ei):
if si == ei:
... | {
"repo_name": "LaughDonor/hackerrank",
"path": "Python2/task-scheduling.py",
"copies": "1",
"size": "1250",
"license": "apache-2.0",
"hash": -4597873008938321000,
"line_mean": 30.275,
"line_max": 70,
"alpha_frac": 0.5856,
"autogenerated": false,
"ratio": 3.6443148688046647,
"config_test": false... |
__author__ = 'nmearl'
from collections import OrderedDict
import numpy as np
class Parameters(object):
def __init__(self, input_file):
self.odict = OrderedDict()
self._read_input(input_file)
if "ferr_frac" not in self.odict.keys():
self.add("ferr_frac", 0.0, 0.0, 1.0, False)... | {
"repo_name": "nmearl/pynamic",
"path": "pynamic/parameters.py",
"copies": "1",
"size": "4402",
"license": "mit",
"hash": 4156207233651586600,
"line_mean": 34.7967479675,
"line_max": 80,
"alpha_frac": 0.4911403907,
"autogenerated": false,
"ratio": 3.692953020134228,
"config_test": false,
"has... |
__author__ = 'nmearl'
from pynamic import photometry, optimizers
import numpy as np
class Optimizer(object):
def __init__(self, params, photo_data_file='', rv_data_file='', rv_body=0,
chain_file=''):
self.params = params
self.photo_data = np.loadtxt(photo_data_file,
... | {
"repo_name": "nmearl/pynamic",
"path": "pynamic/optimizer.py",
"copies": "1",
"size": "3394",
"license": "mit",
"hash": -1282750209486713600,
"line_mean": 34.3645833333,
"line_max": 80,
"alpha_frac": 0.5220978197,
"autogenerated": false,
"ratio": 3.226235741444867,
"config_test": false,
"has... |
__author__ = 'nmearl'
import ctypes
import numpy as np
from numpy.ctypeslib import ndpointer
import sys
from multiprocessing import Pool
import os
path = os.path.dirname(os.path.realpath(__file__)).split('/')[:-1]
path = '/'.join(map(str, path))
if sys.platform == 'darwin':
# print("It seems you're on mac, loadi... | {
"repo_name": "nmearl/pynamic",
"path": "pynamic/photometry.py",
"copies": "1",
"size": "3407",
"license": "mit",
"hash": 4702222989840605000,
"line_mean": 30.2660550459,
"line_max": 80,
"alpha_frac": 0.5708834752,
"autogenerated": false,
"ratio": 3.0888485947416138,
"config_test": false,
"ha... |
__author__ = 'nmearl'
import ctypes
import numpy as np
from numpy.ctypeslib import ndpointer
import sys
from multiprocessing import Pool
import pylab
if sys.platform == 'darwin':
# print("It seems you're on mac, loading mac libraries...")
lib = ctypes.cdll.LoadLibrary('lib/photodynam-mac.so')
else:
# pri... | {
"repo_name": "nmearl/pynamic-old",
"path": "pynamic/photometry.py",
"copies": "1",
"size": "2804",
"license": "mit",
"hash": -3581750894688052700,
"line_mean": 24.0357142857,
"line_max": 69,
"alpha_frac": 0.5805991441,
"autogenerated": false,
"ratio": 2.875897435897436,
"config_test": false,
... |
__author__ = 'nmearl'
# import matplotlib
# matplotlib.use('agg')
import numpy as np
import pylab
import minimizer
import hammer
import utilfuncs
import argparse
try:
import multinest
except:
pass
def read_input(input_file):
temp_dict = {}
with open('{0}'.format(input_file), 'r') as f:
for ... | {
"repo_name": "nmearl/pynamic-old",
"path": "pynamic/main.py",
"copies": "1",
"size": "6085",
"license": "mit",
"hash": -3411301591247533000,
"line_mean": 42.4714285714,
"line_max": 120,
"alpha_frac": 0.6062448644,
"autogenerated": false,
"ratio": 3.074785245073269,
"config_test": false,
"has... |
__author__ = 'nmearl'
import numpy as np
from lmfit import minimize, report_fit
from lmfit import Parameters as lmParameters
import photometry
import utilfuncs
twopi = 2.0 * np.pi
def per_iteration(lmparams, i, resids, mod_pars, photo_data, rv_data, *args, **kws):
if i%10 == 0.0:
ncores, fname = args
... | {
"repo_name": "nmearl/pynamic-old",
"path": "pynamic/minimizer.py",
"copies": "1",
"size": "3173",
"license": "mit",
"hash": 54609004603959810,
"line_mean": 42.4794520548,
"line_max": 104,
"alpha_frac": 0.6202332178,
"autogenerated": false,
"ratio": 2.6912637828668364,
"config_test": false,
"... |
__author__ = 'nmearl'
import numpy as np
import emcee
import os
try:
import pymultinest
except:
pass
import scipy.optimize as op
def lnprior(dtheta, params):
for i in range(len(dtheta)):
if not (params[i].min <= dtheta[i] <= params[i].max):
# print(params[i].name, params[i].min, dthet... | {
"repo_name": "nmearl/pynamic",
"path": "pynamic/optimizers.py",
"copies": "1",
"size": "5447",
"license": "mit",
"hash": 3497726777880064000,
"line_mean": 32.4233128834,
"line_max": 80,
"alpha_frac": 0.5426840463,
"autogenerated": false,
"ratio": 3.0739277652370203,
"config_test": false,
"ha... |
__author__ = 'nmearl'
import numpy as np
import pylab as pl
import triangle
import os
import photometry
import time
def model(mod_pars, params, flux_x, rv_x, ncores=1):
x = np.append(flux_x, rv_x)
x = np.unique(x[np.argsort(x)])
flux_inds = np.in1d(x, flux_x, assume_unique=True)
rv_inds = np.in1d(x,... | {
"repo_name": "nmearl/pynamic-old",
"path": "pynamic/utilfuncs.py",
"copies": "1",
"size": "8326",
"license": "mit",
"hash": 6698388015897751000,
"line_mean": 33.4090909091,
"line_max": 119,
"alpha_frac": 0.5184962767,
"autogenerated": false,
"ratio": 2.793959731543624,
"config_test": false,
... |
__author__ = 'nmearl'
import os
from urllib import urlretrieve, urlopen
import numpy as np
from astropy.io import fits as pyfits
import re
def get_fits_data(kep_id, qrange=None, use_pdc=False, use_slc=False):
"""
Opens cached fits files and retrieves the time and flux data.
:param qrange: Select desired... | {
"repo_name": "nmearl/pynamic-old",
"path": "pynamic/kepler.py",
"copies": "1",
"size": "3914",
"license": "mit",
"hash": -3092571362568361000,
"line_mean": 32.1779661017,
"line_max": 119,
"alpha_frac": 0.5932549821,
"autogenerated": false,
"ratio": 2.9035608308605343,
"config_test": false,
"... |
__author__ = 'nmearl'
import os
import numpy as np
import pylab
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from matplotlib.ticker import MaxNLocator
plt.rc('font', family='serif')
plt.rc('font', serif='Times New Roman')
class Analyzer(object):
def __init__(self, optimizer):
s... | {
"repo_name": "nmearl/pynamic",
"path": "pynamic/analyzer.py",
"copies": "1",
"size": "15952",
"license": "mit",
"hash": -810935909218543200,
"line_mean": 38.1965601966,
"line_max": 80,
"alpha_frac": 0.4695336008,
"autogenerated": false,
"ratio": 3.387555744319388,
"config_test": false,
"has_... |
__author__ = 'nmearl'
import threading
import numpy as np
import datetime
class Progress(threading.Thread):
def __init__(self, optimizer, verbose=False):
threading.Thread.__init__(self)
self.optimizer = optimizer
self.verbose = verbose
self.running = True
self.maxlnp = 0.0... | {
"repo_name": "nmearl/pynamic",
"path": "pynamic/watcher.py",
"copies": "1",
"size": "3663",
"license": "mit",
"hash": -3672739404509717000,
"line_mean": 32.3090909091,
"line_max": 78,
"alpha_frac": 0.4624624625,
"autogenerated": false,
"ratio": 3.2676181980374666,
"config_test": false,
"has_... |
__author__ = 'Michael Montero <mike@resy.com>'
# ----- Imports ---------------------------------------------------------------
from .error import APIError
from .RPC import RPC
# ----- Public Classes --------------------------------------------------------
class API(object):
'''
Resy API implementation for ... | {
"repo_name": "resy/developers",
"path": "python/resy/__init__.py",
"copies": "2",
"size": "1559",
"license": "apache-2.0",
"hash": 4203727477560838700,
"line_mean": 25.8793103448,
"line_max": 79,
"alpha_frac": 0.4073123797,
"autogenerated": false,
"ratio": 4.467048710601719,
"config_test": fal... |
__author__ = 'Michael Montero <mike@resy.com>'
# ----- Imports ---------------------------------------------------------------
from .error import APIError
import json
import requests
import urllib.parse
# ----- Public Classes --------------------------------------------------------
class RPC(object):
'''
... | {
"repo_name": "resy/developers",
"path": "python/build/lib/resy/RPC.py",
"copies": "2",
"size": "1684",
"license": "apache-2.0",
"hash": 5352628716147386000,
"line_mean": 29.0714285714,
"line_max": 79,
"alpha_frac": 0.5195961995,
"autogenerated": false,
"ratio": 4.443271767810026,
"config_test"... |
__author__ = ''
from FileParsers.Parser import Parser
class CadenceViolations(Parser):
def __init__(self, file):
super(CadenceViolations, self).__init__(file)
@staticmethod
def match_line(line, *args):
import re
match_words = ""
for arg in args:
match_words +=... | {
"repo_name": "tazmanrising/ppa",
"path": "genCSV/FileParsers/Cadence/Violations.py",
"copies": "1",
"size": "1795",
"license": "mit",
"hash": 6088122416817464000,
"line_mean": 39.8181818182,
"line_max": 94,
"alpha_frac": 0.5359331476,
"autogenerated": false,
"ratio": 3.8354700854700856,
"confi... |
__author__ = ''
from FileParsers.Parser import Parser
class StaMinQor(Parser):
def __init__(self, file):
super(StaMinQor, self).__init__(file)
@staticmethod
def match_line(line, regex1):
import re
match_word = regex1.replace(" ", "[\s]*")
line_variables = '.*(%s)[\s]*([-\... | {
"repo_name": "tazmanrising/ppa",
"path": "genCSV/FileParsers/Cadence/StaMinQor.py",
"copies": "1",
"size": "1525",
"license": "mit",
"hash": 6300919061914306000,
"line_mean": 39.1315789474,
"line_max": 113,
"alpha_frac": 0.5573770492,
"autogenerated": false,
"ratio": 3.728606356968215,
"config... |
__author__ = ''
from gurobipy import *
import pandas as pd
import numpy as np
import os
from pandas import concat
from filesearcher import filesearcher
def process(frequencies_file):
stdmean = pd.read_csv('./5StopsCentroids/Output/StdAndMean.csv')
os.chdir('./7FLM/')
TS = np.genfromtxt('./Input/demand.cs... | {
"repo_name": "pablo-co/insight-jobs",
"path": "flm.py",
"copies": "1",
"size": "5339",
"license": "mit",
"hash": 983204904925820300,
"line_mean": 33.8954248366,
"line_max": 130,
"alpha_frac": 0.5669601049,
"autogenerated": false,
"ratio": 3.2240338164251208,
"config_test": false,
"has_no_key... |
__author__ = ''
import os
import const
import json
import logging as log
import sdk.const as sdkconst
from sdk.const import COMMON_CONFIG_FIELDS, \
COMMON_IDENTITY_FIELDS, NAME, VALUE
from const import CONFIG_FIELDS, IDENTITY_FIELDS
from threep.base import ThreePBase
from sdk.utils import get_key_value_label, make... | {
"repo_name": "abhiit89/practice-project-api",
"path": "impl.py",
"copies": "1",
"size": "11503",
"license": "mit",
"hash": 1014553264785716400,
"line_mean": 32.9321533923,
"line_max": 143,
"alpha_frac": 0.5581152743,
"autogenerated": false,
"ratio": 4.672217709179529,
"config_test": true,
"h... |
"""Model configuration for pascal dataset"""
import numpy as np
from config import base_model_config
def pascal_voc_vgg16_config():
"""Specify the parameters to tune below."""
mc = base_model_config('PASCAL_VOC')
mc.DEBUG_MODE = False
# Data Augmentation
#mc.LOSS_TYPE =... | {
"repo_name": "goan15910/ConvDet",
"path": "src/config/pascal_voc_vgg16_config.py",
"copies": "1",
"size": "2189",
"license": "bsd-2-clause",
"hash": -9137938388392320000,
"line_mean": 23.595505618,
"line_max": 77,
"alpha_frac": 0.4833257195,
"autogenerated": false,
"ratio": 2.842857142857143,
... |
"""Model configuration for pascal dataset"""
import numpy as np
from config import base_model_config
def pascal_voc_yolo_config():
"""Specify the parameters to tune below."""
mc = base_model_config('PASCAL_VOC')
mc.DEBUG_MODE = True
mc.SUB_BGR_MEANS = False
# Data Augm... | {
"repo_name": "goan15910/ConvDet",
"path": "src/config/pascal_voc_yolo_config.py",
"copies": "1",
"size": "1518",
"license": "bsd-2-clause",
"hash": -9170080835765637000,
"line_mean": 22.71875,
"line_max": 66,
"alpha_frac": 0.5158102767,
"autogenerated": false,
"ratio": 2.6962699822380105,
"con... |
"""Model configuration for VID dataset"""
import numpy as np
from config import base_model_config
def vid_vgg16_config():
"""Specify the parameters to tune below."""
mc = base_model_config('VID')
mc.DEBUG_MODE = False
#mc.LOSS_TYPE = 'YOLO'
mc.DATA_AUG_TYPE = 'YOLO'
... | {
"repo_name": "goan15910/ConvDet",
"path": "src/config/vid_vgg16_config.py",
"copies": "1",
"size": "2122",
"license": "bsd-2-clause",
"hash": 6703607982005695000,
"line_mean": 23.9647058824,
"line_max": 77,
"alpha_frac": 0.4740810556,
"autogenerated": false,
"ratio": 2.825565912117177,
"config... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.