text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'demi'
#Finishing the page ranking algorithm.
def compute_ranks(graph):
d = 0.8 # damping factor
numloops = 10
ranks = {}
npages = len(graph)
for page in graph:
ranks[page] = 1.0 / npages
for i in range(0, numloops):
newranks = {}
for page in graph:
... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson06/Finishing Urank.py",
"copies": "1",
"size": "4692",
"license": "mit",
"hash": 8061965079611727000,
"line_mean": 19.4890829694,
"line_max": 89,
"alpha_frac": 0.6148763853,
"autogenerated": false,
"ratio": 2.6613726... |
__author__ = 'demi'
# Memoization is a way to make code run faster by saving
# previously computed results. Instead of needing to recompute the value of an
# expression, a memoized computation first looks for the value in a cache of
# pre-computed values.
# Define a procedure, cached_execution(cache, proc, proc_inp... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson05/Memoization.py",
"copies": "1",
"size": "1916",
"license": "mit",
"hash": -8748342581801935000,
"line_mean": 33.2142857143,
"line_max": 79,
"alpha_frac": 0.7004175365,
"autogenerated": false,
"ratio": 3.832,
"co... |
__author__ = 'demi'
# Modify the crawl_web procedure so that instead of just returning the
# index, it returns an index and a graph. The graph should be a
# Dictionary where the key:value entries are:
# url: [list of pages url links to]
def crawl_web(seed): # returns index, graph of outlinks
tocrawl = [seed]
... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson06/Implementing Urank.py",
"copies": "1",
"size": "4261",
"license": "mit",
"hash": -5788446812684716000,
"line_mean": 19.4855769231,
"line_max": 89,
"alpha_frac": 0.6280215912,
"autogenerated": false,
"ratio": 2.607... |
__author__ = 'demi'
# One Gold Star
# Question 1-star: Stirling and Bell Numbers
# The number of ways of splitting n items in k non-empty sets is called
# the Stirling number, S(n,k), of the second kind. For example, the group
# of people Dave, Sarah, Peter and Andy could be split into two groups in
# the following ... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Challenging Practice Problems/Stirling and Bell.py",
"copies": "1",
"size": "2547",
"license": "mit",
"hash": 8536943927500074000,
"line_mean": 20.7692307692,
"line_max": 73,
"alpha_frac": 0.588535532,
"autogenerated": false... |
__author__ = 'demi'
# Question 5: Date Converter
# Write a procedure date_converter which takes two inputs. The first is
# a dictionary and the second a string. The string is a valid date in
# the format month/day/year. The procedure should return
# the date written in the form <day> <name of month> <year>.
# For ex... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Cumulative Practice Problems/Date Converter.py",
"copies": "1",
"size": "1315",
"license": "mit",
"hash": -4356717933915748000,
"line_mean": 28.8863636364,
"line_max": 71,
"alpha_frac": 0.6547528517,
"autogenerated": false,
... |
__author__ = 'demi'
# Question 7: Find and Replace
# For this question you need to define two procedures:
# make_converter(match, replacement)
# Takes as input two strings and returns a converter. It doesn't have
# to make a specific type of thing. It can
# return anything you would find useful in apply... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Cumulative Practice Problems/Find and Replace.py",
"copies": "1",
"size": "1288",
"license": "mit",
"hash": 697854384534577000,
"line_mean": 31.2,
"line_max": 74,
"alpha_frac": 0.7065217391,
"autogenerated": false,
"ratio"... |
__author__ = 'demi'
# Question 9: Deep Reverse
# Define a procedure, deep_reverse, that takes as input a list,
# and returns a new list that is the deep reverse of the input list.
# This means it reverses all the elements in the list, and if any
# of those elements are lists themselves, reverses all the elements
# in... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Cumulative Practice Problems/Deep Reverse.py",
"copies": "1",
"size": "1466",
"license": "mit",
"hash": -8925999895285623000,
"line_mean": 25.6545454545,
"line_max": 68,
"alpha_frac": 0.5402455662,
"autogenerated": false,
... |
__author__ = 'demi'
# Rabbits Multiplying
# A (slightly) more realistic model of rabbit multiplication than the Fibonacci
# model, would assume that rabbits eventually die. For this question, some
# rabbits die from month 6 onwards.
#
# Thus, we can model the number of rabbits as:
#
# rabbits(1) = 1 # There is one ... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson06/Rabbits Multiplying.py",
"copies": "1",
"size": "1613",
"license": "mit",
"hash": 7079236464327326000,
"line_mean": 26.8103448276,
"line_max": 79,
"alpha_frac": 0.6249225046,
"autogenerated": false,
"ratio": 2.992... |
__author__ = 'demi'
# Single Gold Star
# Family Trees
# In the lecture, we showed a recursive definition for your ancestors. For this
# question, your goal is to define a procedure that finds someone's ancestors,
# given a Dictionary that provides the parent relationships.
# Here's an example of an input Dictionar... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson06/Family Trees.py",
"copies": "1",
"size": "2087",
"license": "mit",
"hash": -5819783552943610000,
"line_mean": 38.3773584906,
"line_max": 86,
"alpha_frac": 0.6602779109,
"autogenerated": false,
"ratio": 3.105654761... |
__author__ = 'demi'
# The current index includes a url in the list of urls
# for a keyword multiple times if the keyword appears
# on that page more than once.
# It might be better to only include the same url
# once in the url list for a keyword, even if it appears
# many times.
# Modify add_to_index so that a giv... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson04/Improving the Index.py",
"copies": "1",
"size": "3117",
"license": "mit",
"hash": -2485578707613509000,
"line_mean": 28.9807692308,
"line_max": 80,
"alpha_frac": 0.6025024062,
"autogenerated": false,
"ratio": 3.22... |
__author__ = 'demi'
#
# This question explores a different way (from the previous question)
# to limit the pages that it can crawl.
#
#######
# THREE GOLD STARS #
# Yes, we really mean it! This is really tough (but doable) unless
# you have some previous experience before this course.
# Modify the crawl_web proced... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson03/max_depth.py",
"copies": "1",
"size": "5993",
"license": "mit",
"hash": -5735248165166022000,
"line_mean": 37.9220779221,
"line_max": 79,
"alpha_frac": 0.601368263,
"autogenerated": false,
"ratio": 3.1642027455121... |
__author__ = 'demi'
# THREE GOLD STARS
# Question 3-star: Elementary Cellular Automaton
# Please see the video for additional explanation.
# A one-dimensional cellular automata takes in a string, which in our
# case, consists of the characters '.' and 'x', and changes it according
# to some predetermined rules. The... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Challenging Practice Problems/Elementary Cellular Automaton.py",
"copies": "1",
"size": "5056",
"license": "mit",
"hash": 1025203493057566800,
"line_mean": 36.4518518519,
"line_max": 74,
"alpha_frac": 0.4994066456,
"autogene... |
__author__ = 'demi'
# Triple Gold Star
# Only A Little Lucky
# The Feeling Lucky question (from the regular homework) assumed it was enough
# to find the best-ranked page for a given query. For most queries, though, we
# don't just want the best page (according to the page ranking algorithm), we
# want a list of ma... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson06/Only a Little Lucky.py",
"copies": "1",
"size": "7433",
"license": "mit",
"hash": -2953047044619158500,
"line_mean": 23.5313531353,
"line_max": 89,
"alpha_frac": 0.6391766447,
"autogenerated": false,
"ratio": 2.94... |
__author__ = 'demi'
# Write a procedure, convert_seconds, which takes as input a non-negative
# number of seconds and returns a string of the form
# '<integer> hours, <integer> minutes, <number> seconds' but
# where if <integer> is 1 for the number of hours or minutes,
# then it should be hour/minute. Further, <numbe... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson04/Converting Seconds.py",
"copies": "1",
"size": "1662",
"license": "mit",
"hash": -4056722186968291300,
"line_mean": 25.3968253968,
"line_max": 73,
"alpha_frac": 0.5734055355,
"autogenerated": false,
"ratio": 3.513... |
__author__ = 'demi'
# Write a procedure download_time which takes as inputs a file size, the
# units that file size is given in, bandwidth and the units for
# bandwidth (excluding per second) and returns the time taken to download
# the file.
# Your answer should be a string in the form
# "<number> hours, <number> mi... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson04/Download Calculator.py",
"copies": "1",
"size": "3124",
"license": "mit",
"hash": 200906764860253400,
"line_mean": 25.7008547009,
"line_max": 73,
"alpha_frac": 0.5611395647,
"autogenerated": false,
"ratio": 3.1365... |
__author__ = 'demi'
# THREE GOLD STARS
# Sudoku [http://en.wikipedia.org/wiki/Sudoku]
# is a logic puzzle where a game
# is defined by a partially filled
# 9 x 9 square of digits where each square
# contains one of the digits 1,2,3,4,5,6,7,8,9.
# For this question we will generalize
# and simplify the game.
# Define... | {
"repo_name": "dmitry-izmerov/Udacity-Intro-to-computer-science",
"path": "Lesson03/sudoku.py",
"copies": "1",
"size": "2729",
"license": "mit",
"hash": 6922848631838889000,
"line_mean": 21.0161290323,
"line_max": 59,
"alpha_frac": 0.5272993771,
"autogenerated": false,
"ratio": 3.122425629290618,... |
from aliyunsdkcore import client
from aliyunsdkcms.request.v20170301 import QueryMetricListRequest
from aliyunsdkecs.request.v20140526 import DescribeInstancesRequest
import time
import json
import shutil
import sys
from multiprocessing import Process
from multiprocessing import cpu_count,Pool
reload(sys)
sys.set... | {
"repo_name": "dengxiangyu768/dengxytools",
"path": "promethues/monitor_traffic.py",
"copies": "1",
"size": "3876",
"license": "apache-2.0",
"hash": 3990517754242985000,
"line_mean": 40.2340425532,
"line_max": 134,
"alpha_frac": 0.689628483,
"autogenerated": false,
"ratio": 3.1848808545603946,
... |
__author__ = 'dengzhihong'
from numpy import *
import numpy as np
from sklearn.decomposition import *
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from sklearn.cluster import KMeans
from sklearn.neighbors import KNeighborsClassifier
import pylab
import matplotlib.cm as cm
import matp... | {
"repo_name": "dzh123xt/DigitRecognition",
"path": "src/Methods/TestMethods.py",
"copies": "1",
"size": "23664",
"license": "mit",
"hash": 3214576971996793300,
"line_mean": 38.3106312292,
"line_max": 140,
"alpha_frac": 0.53469405,
"autogenerated": false,
"ratio": 3.4385353095030515,
"config_tes... |
__author__ = 'dengzhihong'
from src.Cluster.base import *
import numpy as np
from src.Methods.math_methods import *
from src.Methods.process_data import *
from src.Methods.draw_diagram import *
class KMeans(ClusterBase):
@staticmethod
def clusterAssignment(data, Mean):
D = data.shape[1]
K = Me... | {
"repo_name": "dzh123xt/pythonML",
"path": "src/Cluster/kmeans.py",
"copies": "1",
"size": "1929",
"license": "mit",
"hash": -4313603193568317400,
"line_mean": 28.6923076923,
"line_max": 64,
"alpha_frac": 0.5064800415,
"autogenerated": false,
"ratio": 3.639622641509434,
"config_test": false,
... |
__author__ = 'dengzhihong'
from src.Regression.base import *
from scipy import optimize
from numpy import *
class RR(RegressionBase):
@staticmethod
def run(sampx, sampy, K):
y = RegressionBase.strlistToFloatvector(sampy)
fai_matrix_trans = transpose(RegressionBase.constructFaiMartix(sampx, K))... | {
"repo_name": "dzh123xt/pythonML",
"path": "src/Regression/rr.py",
"copies": "1",
"size": "1511",
"license": "mit",
"hash": 1648903748403743200,
"line_mean": 35.8780487805,
"line_max": 122,
"alpha_frac": 0.5129053607,
"autogenerated": false,
"ratio": 3.4263038548752833,
"config_test": false,
... |
__author__ = 'dengzhihong'
from src.Regression.base import *
from scipy import optimize
class LASSO(RegressionBase):
@staticmethod
def run(sampx, sampy, K):
y = RegressionBase.strlistToFloatvector(sampy)
fai_matrix = RegressionBase.constructFaiMartix(sampx, K)
product_fai = np.dot(fai_... | {
"repo_name": "dzh123xt/pythonML",
"path": "src/Regression/lasso.py",
"copies": "1",
"size": "1462",
"license": "mit",
"hash": 4171919664997881300,
"line_mean": 39.6388888889,
"line_max": 139,
"alpha_frac": 0.5451436389,
"autogenerated": false,
"ratio": 3.1508620689655173,
"config_test": false,... |
__author__ = 'dengzhihong'
from src.Regression.base import *
class BR(RegressionBase):
@staticmethod
def getPredictionVariance(star_scalar_x, Sigma, theta, K):
Fai = np.mat(RegressionBase.getFaiList(star_scalar_x, K))
return float(np.dot(np.dot(Fai,Sigma),theta))
@staticmethod
def ge... | {
"repo_name": "dzh123xt/pythonML",
"path": "src/Regression/br.py",
"copies": "1",
"size": "1182",
"license": "mit",
"hash": -3971948756549478400,
"line_mean": 34.8484848485,
"line_max": 102,
"alpha_frac": 0.6429780034,
"autogenerated": false,
"ratio": 3.143617021276596,
"config_test": false,
... |
__author__ = 'dengzhihong'
from src.Regression.ls import *
from src.Regression.rls import *
from src.Regression.rr import *
from src.Regression.br import *
from src.Regression.lasso import *
import numpy as np
from src.Methods.draw_diagram import *
import random
def testWithRegression(sampx, sampy, polyx, polyy, K, M... | {
"repo_name": "dzh123xt/pythonML",
"path": "src/Methods/regression_methods.py",
"copies": "1",
"size": "4750",
"license": "mit",
"hash": 1238776215997315300,
"line_mean": 34.447761194,
"line_max": 128,
"alpha_frac": 0.6210526316,
"autogenerated": false,
"ratio": 3.2072923700202565,
"config_test... |
__author__ = 'dengzhihong'
import matplotlib.pyplot as plt
from src.Methods.process_data import *
from src.Regression.br import *
def showDiagram(x, y, title="", MethodName=""):
ax = plt.figure().add_subplot(111)
ax.set_title(title + ' Algorithm: '+ MethodName, fontsize = 18)
plt.axis([-20,20,-20,20])
... | {
"repo_name": "dzh123xt/pythonML",
"path": "src/Methods/draw_diagram.py",
"copies": "1",
"size": "3966",
"license": "mit",
"hash": -3467962224327320600,
"line_mean": 39.0707070707,
"line_max": 106,
"alpha_frac": 0.6129601614,
"autogenerated": false,
"ratio": 2.8843636363636365,
"config_test": f... |
__author__ = 'dengzhihong'
import numpy as np
from src.Cluster.base import *
from src.Methods.math_methods import *
from src.Methods.draw_diagram import *
from src.Methods.process_data import *
import random
class EM(ClusterBase):
@staticmethod
def E_Step(X, Mean, Cov, Pai):
K = Mean.shape[0]
... | {
"repo_name": "dzh123xt/pythonML",
"path": "src/Cluster/em.py",
"copies": "1",
"size": "5685",
"license": "mit",
"hash": -6593262899877286000,
"line_mean": 28.158974359,
"line_max": 96,
"alpha_frac": 0.4335971856,
"autogenerated": false,
"ratio": 3.2747695852534564,
"config_test": false,
"has... |
__author__ = 'dengzhihong'
import numpy as np
class RegressionBase(object):
# This method get a list of data in string form and turn them into float vector
@staticmethod
def strlistToFloatvector(strlist):
floatvector = []
for i in range(0, len(strlist)):
floatvector.append(flo... | {
"repo_name": "dzh123xt/pythonML",
"path": "src/Regression/base.py",
"copies": "1",
"size": "2214",
"license": "mit",
"hash": -422624193242089400,
"line_mean": 32.5606060606,
"line_max": 92,
"alpha_frac": 0.6377597109,
"autogenerated": false,
"ratio": 3.739864864864865,
"config_test": false,
... |
__author__ = 'dengzhihong'
from src.Methods.TestMethods import *
def testWithChallenge(train_vectors, train_labels, test_vectors, test_labels, trainset, PCA_K, C, GAMMA, method):
TrainVectors = array(toFloatList(train_vectors)).reshape(4000, 784)
TrainLabel = array(toFloatList(train_labels))
TestVectors ... | {
"repo_name": "dzh123xt/DigitRecognition",
"path": "src/Methods/ChallengeTest.py",
"copies": "1",
"size": "2811",
"license": "mit",
"hash": 5843190010953209000,
"line_mean": 31.6860465116,
"line_max": 113,
"alpha_frac": 0.5862682319,
"autogenerated": false,
"ratio": 3.617760617760618,
"config_t... |
import os.path as op
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_equal
import pytest
from mne import io, Epochs, read_events, pick_types
from mne.utils import requires_sklearn
from mne.decoding import compute_ems, EMS
data_dir = op.join(op.dirname(__file__), '..', '..', 'io', 'test... | {
"repo_name": "drammock/mne-python",
"path": "mne/decoding/tests/test_ems.py",
"copies": "4",
"size": "3154",
"license": "bsd-3-clause",
"hash": 2193042298242847200,
"line_mean": 36.5476190476,
"line_max": 78,
"alpha_frac": 0.6490171211,
"autogenerated": false,
"ratio": 3.0095419847328246,
"con... |
import os.path as op
from nose.tools import assert_equal, assert_raises
from mne import io, Epochs, read_events, pick_types
from mne.utils import requires_sklearn
from mne.decoding import compute_ems
data_dir = op.join(op.dirname(__file__), '..', '..', 'io', 'tests', 'data')
curdir = op.join(op.dirname(__file__))
... | {
"repo_name": "Odingod/mne-python",
"path": "mne/decoding/tests/test_ems.py",
"copies": "19",
"size": "1969",
"license": "bsd-3-clause",
"hash": -4770249439056926000,
"line_mean": 34.1607142857,
"line_max": 77,
"alpha_frac": 0.6480446927,
"autogenerated": false,
"ratio": 2.952023988005997,
"con... |
import os.path as op
from nose.tools import assert_equal, assert_raises
from mne import io, Epochs, read_events, pick_types
from mne.utils import _TempDir, requires_sklearn
from mne.decoding import compute_ems
tempdir = _TempDir()
data_dir = op.join(op.dirname(__file__), '..', '..', 'io', 'tests', 'data')
curdir =... | {
"repo_name": "jaeilepp/eggie",
"path": "mne/decoding/tests/test_ems.py",
"copies": "2",
"size": "2006",
"license": "bsd-2-clause",
"hash": 3233105237989224400,
"line_mean": 33.5862068966,
"line_max": 77,
"alpha_frac": 0.646560319,
"autogenerated": false,
"ratio": 2.9630723781388477,
"config_te... |
from copy import deepcopy
import numpy as np
from mne.report import Report
from mne.preprocessing import ICA, create_ecg_epochs, create_eog_epochs
from mne import pick_types
from mne.utils import logger
from mne.defaults import _handle_default
from .viz import _prepare_filter_plot, _render_components_table
from .ut... | {
"repo_name": "dengemann/meeg-preprocessing",
"path": "meeg_preprocessing/preprocessing.py",
"copies": "1",
"size": "14982",
"license": "bsd-2-clause",
"hash": -1507489948678972400,
"line_mean": 40.5013850416,
"line_max": 79,
"alpha_frac": 0.5762915499,
"autogenerated": false,
"ratio": 3.58592628... |
from copy import deepcopy
import numpy as np
from mne.report import Report
from mne.preprocessing import ICA, create_ecg_epochs, create_eog_epochs
from mne import pick_types
from .viz import _prepare_filter_plot
def check_apply_filter(raw, subject, filter_params=None,
notch_filter_params=No... | {
"repo_name": "cmoutard/meeg-preprocessing",
"path": "meeg_preprocessing/preprocessing.py",
"copies": "1",
"size": "12345",
"license": "bsd-2-clause",
"hash": 5954098116188855000,
"line_mean": 40.0132890365,
"line_max": 79,
"alpha_frac": 0.5566626164,
"autogenerated": false,
"ratio": 3.6632047477... |
from .utils import get_data_picks
def _prepare_filter_plot(raw, figsize):
"""Aux function"""
import matplotlib.pyplot as plt
picks_list = get_data_picks(raw)
n_rows = len(picks_list)
fig, axes = plt.subplots(1, n_rows, sharey=True, sharex=True,
figsize=(6 * n_rows, 6... | {
"repo_name": "cmoutard/meeg-preprocessing",
"path": "meeg_preprocessing/viz.py",
"copies": "1",
"size": "2805",
"license": "bsd-2-clause",
"hash": -8180266110916603000,
"line_mean": 30.1666666667,
"line_max": 79,
"alpha_frac": 0.5308377897,
"autogenerated": false,
"ratio": 3.6907894736842106,
... |
import itertools as itt
import os.path as op
import re
import numpy as np
import scipy.io as scio
from scipy import linalg
from mne import (EpochsArray, EvokedArray, pick_info,
rename_channels)
from mne.io.bti.bti import _get_bti_info, read_raw_bti
from mne.io import _loc_to_coil_trans
from mne.util... | {
"repo_name": "RPGOne/Skynet",
"path": "mne-hcp-master/hcp/io/read.py",
"copies": "3",
"size": "23686",
"license": "bsd-3-clause",
"hash": 9217707194220262000,
"line_mean": 24.9714912281,
"line_max": 79,
"alpha_frac": 0.5468631259,
"autogenerated": false,
"ratio": 3.280155103171306,
"config_tes... |
import numpy as np
from nose.tools import assert_equal
import mne
import os
import os.path as op
import subprocess
import json
import warnings
from nose.tools import (assert_true, assert_equals, assert_not_equals,
assert_raises)
from mne.utils import _TempDir
from mne import io
from mne imp... | {
"repo_name": "dengemann/meeg-preprocessing",
"path": "meeg_preprocessing/tests/test_utils.py",
"copies": "1",
"size": "7036",
"license": "bsd-2-clause",
"hash": -2216791777537629200,
"line_mean": 32.345971564,
"line_max": 79,
"alpha_frac": 0.6050312678,
"autogenerated": false,
"ratio": 3.1298932... |
import numpy as np
import mne
from mne.io import set_bipolar_reference
from mne.io.bti.bti import (
_convert_coil_trans, _coil_trans_to_loc, _get_bti_dev_t,
_loc_to_coil_trans)
from mne.transforms import Transform
from mne.utils import logger
from .io import read_info
from .io.read import _hcp_pick_info
from ... | {
"repo_name": "RPGOne/Skynet",
"path": "mne-hcp-master/hcp/preprocessing.py",
"copies": "3",
"size": "8494",
"license": "bsd-3-clause",
"hash": -4397618080943197700,
"line_mean": 32.4409448819,
"line_max": 78,
"alpha_frac": 0.5990110666,
"autogenerated": false,
"ratio": 3.5128205128205128,
"con... |
import os.path as op
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
from nose.tools import assert_equal, assert_true
from numpy.testing import assert_array_equal
import mne
from meeg_preprocessing.preprocessing import (check_apply_filter, compute_ica,
_prepa... | {
"repo_name": "cmoutard/meeg-preprocessing",
"path": "meeg_preprocessing/tests/test_preprocessing.py",
"copies": "1",
"size": "3693",
"license": "bsd-2-clause",
"hash": 8498376648605337000,
"line_mean": 34.1714285714,
"line_max": 78,
"alpha_frac": 0.5786623341,
"autogenerated": false,
"ratio": 3.... |
"""
=========================================
Load and process previously saved records
=========================================
In this example previously downloaded records will be loaded.
We explore how to access and print single records.
Subsequently, we will explore filtering and combining records.
A last secti... | {
"repo_name": "PyMed/PyMed",
"path": "examples/load_and_work_with_records.py",
"copies": "1",
"size": "2862",
"license": "bsd-3-clause",
"hash": -7188274343648773000,
"line_mean": 31.1573033708,
"line_max": 79,
"alpha_frac": 0.6565338924,
"autogenerated": false,
"ratio": 3.8313253012048194,
"co... |
import numpy as np
from scipy.linalg import eigh
from ..filter import filter_data
from ..cov import _regularized_covariance
from . import TransformerMixin, BaseEstimator
from ..time_frequency import psd_array_welch
from ..utils import _time_mask, fill_doc, _validate_type, _check_option
from ..io.pick import _get_chann... | {
"repo_name": "larsoner/mne-python",
"path": "mne/decoding/ssd.py",
"copies": "4",
"size": "11726",
"license": "bsd-3-clause",
"hash": -6750656417355844000,
"line_mean": 39.8153310105,
"line_max": 79,
"alpha_frac": 0.5909168516,
"autogenerated": false,
"ratio": 3.909879839786382,
"config_test":... |
import numpy as np
import pytest
from numpy.testing import (assert_array_almost_equal, assert_array_equal)
from mne import io
from mne.time_frequency import psd_array_welch
from mne.decoding.ssd import SSD
from mne.utils import requires_sklearn
from mne.filter import filter_data
from mne import create_info
from mne.de... | {
"repo_name": "kambysese/mne-python",
"path": "mne/decoding/tests/test_ssd.py",
"copies": "8",
"size": "12817",
"license": "bsd-3-clause",
"hash": -7216064647460166000,
"line_mean": 38.5586419753,
"line_max": 76,
"alpha_frac": 0.6232347663,
"autogenerated": false,
"ratio": 3.0516666666666667,
"... |
import numpy as np
from ..filter import filter_data
from ..cov import _regularized_covariance
from . import TransformerMixin, BaseEstimator
from ..time_frequency import psd_array_welch
from ..utils import _time_mask, fill_doc, _validate_type, _check_option
from ..io.pick import _get_channel_types, _picks_to_idx
@fi... | {
"repo_name": "pravsripad/mne-python",
"path": "mne/decoding/ssd.py",
"copies": "8",
"size": "12181",
"license": "bsd-3-clause",
"hash": -355547508855911900,
"line_mean": 40.3911564626,
"line_max": 79,
"alpha_frac": 0.5886268387,
"autogenerated": false,
"ratio": 3.9229529335912314,
"config_test... |
class Bunch(dict):
""" Dict that exposes keys as attributes """
def __init__(self, *args, **kwargs):
dict.__init__(self, *args, **kwargs)
self.__dict__ = self
PMD = Bunch()
PMD.PT_ARTICLE = 'journal article'
PMD.DEF_FIELDS = ['TI', 'AU', 'DP', 'AB', 'JT', 'TA', 'PT', 'MH', 'PMID']... | {
"repo_name": "PyMed/PyMed",
"path": "pymed/constants.py",
"copies": "1",
"size": "3365",
"license": "bsd-3-clause",
"hash": 6841277360898987000,
"line_mean": 36.4,
"line_max": 78,
"alpha_frac": 0.5001485884,
"autogenerated": false,
"ratio": 3.1273234200743496,
"config_test": false,
"has_no_k... |
__author__ = 'denisbalyko'
def checkio(labyrinth):
queue, answer = [], ""
xn, yn = 1, 1 #start_position
start_value = 10 #(any greater than 0 and 1)
queue.append([xn, yn])
labyrinth[xn][yn] = start_value
"""Create path"""
while queue:
xn, yn = queue.pop(0)
... | {
"repo_name": "denisbalyko/checkio-solution",
"path": "Open Labyrinth.py",
"copies": "1",
"size": "2066",
"license": "mit",
"hash": -5097396239516195000,
"line_mean": 36.5818181818,
"line_max": 94,
"alpha_frac": 0.3814133591,
"autogenerated": false,
"ratio": 2.029469548133595,
"config_test": fa... |
from collections import Counter
import numpy as np
from .mixin import TransformerMixin, EstimatorMixin
from .base import _set_cv
from ..io.pick import _picks_to_idx
from ..parallel import parallel_func
from ..utils import logger, verbose
from .. import pick_types, pick_info
class EMS(TransformerMixin, EstimatorMix... | {
"repo_name": "cjayb/mne-python",
"path": "mne/decoding/ems.py",
"copies": "2",
"size": "7930",
"license": "bsd-3-clause",
"hash": -4423936390918831000,
"line_mean": 35.2100456621,
"line_max": 79,
"alpha_frac": 0.619924338,
"autogenerated": false,
"ratio": 3.900639449090015,
"config_test": fals... |
from collections import Counter
import numpy as np
from .mixin import TransformerMixin, EstimatorMixin
from .base import _set_cv
from ..utils import logger, verbose
from ..parallel import parallel_func
from .. import pick_types, pick_info
class EMS(TransformerMixin, EstimatorMixin):
"""Transformer to compute e... | {
"repo_name": "teonlamont/mne-python",
"path": "mne/decoding/ems.py",
"copies": "4",
"size": "8295",
"license": "bsd-3-clause",
"hash": 3823947811729582600,
"line_mean": 36.197309417,
"line_max": 79,
"alpha_frac": 0.6233875829,
"autogenerated": false,
"ratio": 3.935009487666034,
"config_test": ... |
import numpy as np
from .mixin import TransformerMixin, EstimatorMixin
from .base import _set_cv
from ..utils import logger, verbose
from ..fixes import Counter
from ..parallel import parallel_func
from .. import pick_types, pick_info
class EMS(TransformerMixin, EstimatorMixin):
"""Transformer to compute event-... | {
"repo_name": "alexandrebarachant/mne-python",
"path": "mne/decoding/ems.py",
"copies": "1",
"size": "8137",
"license": "bsd-3-clause",
"hash": 6649807584610984000,
"line_mean": 36.3256880734,
"line_max": 79,
"alpha_frac": 0.625414772,
"autogenerated": false,
"ratio": 3.9385285575992257,
"confi... |
from itertools import product
import os
import os.path as op
from unittest import SkipTest
import pytest
import numpy as np
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_allclose, assert_equal)
from scipy import stats
import matplotlib.pyplot as plt
from ... | {
"repo_name": "adykstra/mne-python",
"path": "mne/preprocessing/tests/test_ica.py",
"copies": "1",
"size": "42637",
"license": "bsd-3-clause",
"hash": 7685854663471898000,
"line_mean": 39.0723684211,
"line_max": 79,
"alpha_frac": 0.6005582006,
"autogenerated": false,
"ratio": 3.2389091461561836,
... |
import numpy as np
from ..utils import logger, verbose
from ..fixes import Counter
from ..parallel import parallel_func
from .. import pick_types, pick_info
@verbose
def compute_ems(epochs, conditions=None, picks=None, n_jobs=1, verbose=None):
"""Compute event-matched spatial filter on epochs
This version ... | {
"repo_name": "ARudiuk/mne-python",
"path": "mne/decoding/ems.py",
"copies": "3",
"size": "4695",
"license": "bsd-3-clause",
"hash": -6935707497395011000,
"line_mean": 35.6796875,
"line_max": 79,
"alpha_frac": 0.6319488818,
"autogenerated": false,
"ratio": 3.7590072057646116,
"config_test": fal... |
__author__ = 'denis_makogon'
from gigaspace.common import remote
exceptions = remote.cinderclient.client.exceptions
class BaseCinderActions(remote.RemoteServices):
"""
Base Cinder actions class
"""
def __init__(self):
super(BaseCinderActions, self).__init__()
def create_volume(self, siz... | {
"repo_name": "denismakogon/gigaspace-test-task",
"path": "gigaspace/cinder_workflow/base.py",
"copies": "1",
"size": "1460",
"license": "apache-2.0",
"hash": 5868636643810426000,
"line_mean": 25.5454545455,
"line_max": 62,
"alpha_frac": 0.5705479452,
"autogenerated": false,
"ratio": 4.5482866043... |
__author__ = 'denis_makogon'
import argparse
import six
def args(*args, **kwargs):
"""
Decorates commandline arguments for actions
:param args: sub-category commandline arguments
:param kwargs: sub-category commandline arguments
:return: decorator: object attribute setter
:rtype: callable
... | {
"repo_name": "denismakogon/gigaspace-test-task",
"path": "gigaspace/cmd/common.py",
"copies": "1",
"size": "3647",
"license": "apache-2.0",
"hash": -1406792483494136000,
"line_mean": 31.2743362832,
"line_max": 79,
"alpha_frac": 0.5889772416,
"autogenerated": false,
"ratio": 4.3108747044917255,
... |
__author__ = 'denis_makogon'
import proboscis
from proboscis import asserts
from proboscis import decorators
from gigaspace.cinder_workflow import base as cinder_workflow
from gigaspace.nova_workflow import base as nova_workflow
from gigaspace.common import cfg
from gigaspace.common import utils
GROUP_WORKFLOW = 'g... | {
"repo_name": "denismakogon/gigaspace-test-task",
"path": "gigaspace/tests/functional/test_workflow.py",
"copies": "1",
"size": "8918",
"license": "apache-2.0",
"hash": 2692308321273690000,
"line_mean": 35.4,
"line_max": 78,
"alpha_frac": 0.5808477237,
"autogenerated": false,
"ratio": 4.119168591... |
__author__ = "denis_makogon"
import sys
from oslo_config import cfg
from gigaspace.cmd import common
from gigaspace.common import cfg as config
from gigaspace.common import utils
from gigaspace.cinder_workflow import (
base as cinder_workflow)
from gigaspace.nova_workflow import (
base as nova_workflow)
CON... | {
"repo_name": "denismakogon/gigaspace-test-task",
"path": "gigaspace/cmd/gigaspace_tool.py",
"copies": "1",
"size": "5523",
"license": "apache-2.0",
"hash": -129697867108429280,
"line_mean": 31.1104651163,
"line_max": 75,
"alpha_frac": 0.577403585,
"autogenerated": false,
"ratio": 4.0730088495575... |
__author__ = 'denis_makogon'
import uuid
from cinderclient import client as novaclient
from novaclient import client as cinderclient
cinder_exceptions = cinderclient.exceptions
nova_exceptions = novaclient.exceptions
class FakeServer(object):
def __init__(self, id, name, image_id, flavor_ref,
... | {
"repo_name": "denismakogon/gigaspace-test-task",
"path": "gigaspace/tests/fakes/openstack.py",
"copies": "1",
"size": "7078",
"license": "apache-2.0",
"hash": -7405878629647948000,
"line_mean": 29.1191489362,
"line_max": 75,
"alpha_frac": 0.5528397853,
"autogenerated": false,
"ratio": 4.00113058... |
__author__ = 'Denis'
def merge_two_lists(list_one, list_two):
"""
Function merge two lists in a list. Then return the sorted list.
Input lists don't change.
:rtype: list
:return: sorted list
"""
# Copy lists by value
temp_list_one = list_one[:]
temp_list_two = list_two[:]
me... | {
"repo_name": "VDenis/hh_school",
"path": "median.py",
"copies": "1",
"size": "2273",
"license": "mit",
"hash": 8724024646603064000,
"line_mean": 23.1808510638,
"line_max": 109,
"alpha_frac": 0.5908490981,
"autogenerated": false,
"ratio": 3.443939393939394,
"config_test": false,
"has_no_keywo... |
__author__ = 'Deniz'
import argparse, re, os
def main():
parser = argparse.ArgumentParser(description='Attempt to generate X number'
' of random summoners.')
parser.add_argument('-in', metavar='i', type=str)
args = parser.parse_args()
inputLocation = ... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/WebPasrer.py",
"copies": "1",
"size": "3187",
"license": "mit",
"hash": -451471648545641000,
"line_mean": 38.85,
"line_max": 101,
"alpha_frac": 0.5961719485,
"autogenerated": false,
"ratio": 3.6464530892448512,
"con... |
__author__ = 'Deniz'
from bs4 import BeautifulSoup
from splinter import Browser
import argparse, os, re, time
mmr_filepath_Dict = {}
def main():
global mmr_filepath_Dict
BASE_URL = "http://na.op.gg/"
parser = argparse.ArgumentParser(description='Attempt to search op.gg with the summoner names in every fi... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/Scrape_mmr_opgg.py",
"copies": "1",
"size": "5728",
"license": "mit",
"hash": 8366531034229682000,
"line_mean": 34.5838509317,
"line_max": 119,
"alpha_frac": 0.59375,
"autogenerated": false,
"ratio": 3.492682926829268... |
__author__ = 'Deniz'
from bs4 import BeautifulSoup
from splinter import Browser
import argparse, os, re, time, sys
mmr_filepath_Dict = {}
def main():
global mmr_filepath_Dict
BASE_URL = "http://na.op.gg/ranking/ladder/"
parser = argparse.ArgumentParser(description='Attempt to scrape op.gg rankings to get... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/Scrape_opgg_summoner_rankings.py",
"copies": "1",
"size": "6740",
"license": "mit",
"hash": -4446037052760742400,
"line_mean": 33.3928571429,
"line_max": 118,
"alpha_frac": 0.5910979228,
"autogenerated": false,
"ratio... |
__author__ = 'Deniz'
from RiotWatcher.riotwatcher import RiotWatcher
from RiotWatcher.riotwatcher import LoLException
import re, argparse
from operator import itemgetter
# Setup RiotWatcher object with api key
f = open('apikey.txt', 'r')
api = RiotWatcher(f.read())
allChampionsUsed = []
f = open('loChampionPairs', ... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/Get_Most_Used_Champion.py",
"copies": "1",
"size": "5563",
"license": "mit",
"hash": -878080424210730400,
"line_mean": 37.9090909091,
"line_max": 728,
"alpha_frac": 0.6433579004,
"autogenerated": false,
"ratio": 3.193... |
__author__ = 'Deniz'
from RiotWatcher.riotwatcher import RiotWatcher
from RiotWatcher.riotwatcher import LoLException
import re, argparse
from random import randint
import subprocess
# Setup RiotWatcher object with api key
f = open('apikey.txt', 'r')
api = RiotWatcher(f.read())
# A global counter used by Generate_Su... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/DEPRECATED/Generate_Summoners.py",
"copies": "1",
"size": "4717",
"license": "mit",
"hash": -6228846367567909000,
"line_mean": 30.6644295302,
"line_max": 85,
"alpha_frac": 0.6217935128,
"autogenerated": false,
"ratio"... |
__author__ = 'Deniz'
from RiotWatcher.riotwatcher import RiotWatcher
from RiotWatcher.riotwatcher import LoLException
import re, argparse, os
# Setup RiotWatcher object with api key
f = open('apikey.txt', 'r')
api_key = f.read()
api = RiotWatcher(f.read())
match_history_data = []
match_data = []
def main():
glo... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/Get_Summoner_MatchHistory.py",
"copies": "1",
"size": "2290",
"license": "mit",
"hash": -4645159424516854000,
"line_mean": 32.2028985507,
"line_max": 148,
"alpha_frac": 0.6401746725,
"autogenerated": false,
"ratio": 3... |
__author__ = 'Deniz'
from RiotWatcher.riotwatcher import RiotWatcher
from RiotWatcher.riotwatcher import LoLException
import re, argparse, os, time
import urllib2
# Setup RiotWatcher object with api key
f = open('apikey.txt', 'r')
api_key = f.read()
api = RiotWatcher(f.read())
match_history_data = []
match_ids = []
... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/Get_Summoner_MatchData.py",
"copies": "1",
"size": "4196",
"license": "mit",
"hash": 903568000999268500,
"line_mean": 33.6859504132,
"line_max": 137,
"alpha_frac": 0.6620591039,
"autogenerated": false,
"ratio": 3.3301... |
__author__ = 'Deniz'
from RiotWatcher.riotwatcher import RiotWatcher
from RiotWatcher.riotwatcher import LoLException
import re, argparse, os, time
# Setup RiotWatcher object with api key
f = open('apikey.txt', 'r')
api_key = f.read()
api = RiotWatcher(f.read())
match_history_data = []
def main():
global match_... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/Get_Summoner_MatchHistory_Modified.py",
"copies": "1",
"size": "2320",
"license": "mit",
"hash": 3600259230790982700,
"line_mean": 31.6901408451,
"line_max": 152,
"alpha_frac": 0.6288793103,
"autogenerated": false,
"r... |
__author__ = 'Deniz'
from RiotWatcher.riotwatcher import RiotWatcher
from RiotWatcher.riotwatcher import LoLException
import re, argparse, time
from operator import itemgetter
# Setup RiotWatcher object with api key
f = open('apikey.txt', 'r')
api = RiotWatcher(f.read())
allChampionsUsed = []
f = open('loChampionPa... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/Get_Most_Used_Champion_Modified.py",
"copies": "1",
"size": "5665",
"license": "mit",
"hash": -4577323289710996000,
"line_mean": 40.3576642336,
"line_max": 732,
"alpha_frac": 0.6833186231,
"autogenerated": false,
"rat... |
__author__ = 'Deniz'
from RiotWatcher.riotwatcher import RiotWatcher
from RiotWatcher.riotwatcher import LoLException
import re, argparse, time
# Setup RiotWatcher object with api key
f = open('apikey.txt', 'r')
api = RiotWatcher(f.read())
numSummonersWritten = 0
summonerDict = {}
def main():
# Command line pa... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/Get_Summoner_Ids.py",
"copies": "1",
"size": "5219",
"license": "mit",
"hash": 6514884125351027000,
"line_mean": 33.5695364238,
"line_max": 111,
"alpha_frac": 0.5767388389,
"autogenerated": false,
"ratio": 3.535907859... |
__author__ = 'Deniz'
from RiotWatcher.riotwatcher import RiotWatcher
from RiotWatcher.riotwatcher import LoLException
import re
# Setup RiotWatcher object with api key
f = open('apikey.txt', 'r')
api = RiotWatcher(f.read())
list_of_champion_ids = []
def main():
# Check if we have API calls remaining
if(api.... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/Get_Champions.py",
"copies": "1",
"size": "1983",
"license": "mit",
"hash": 4040895551298573300,
"line_mean": 26.1780821918,
"line_max": 79,
"alpha_frac": 0.6147251639,
"autogenerated": false,
"ratio": 2.9909502262443... |
__author__ = 'Deniz'
import argparse, csv, os, re
from collections import OrderedDict
summoner_match_history_arryOfDicts = []
def main():
global summoner_match_history
parser = argparse.ArgumentParser(description='Parse input directory and write summoner data to CSV file.')
parser.add_argument('-in', me... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/CSV_Data_Formatter.py",
"copies": "1",
"size": "5088",
"license": "mit",
"hash": -1056203335726594200,
"line_mean": 32.701986755,
"line_max": 118,
"alpha_frac": 0.5998427673,
"autogenerated": false,
"ratio": 3.6709956... |
__author__ = 'Deniz'
import argparse
# Declare an empty list of summoners
lo_summoners = []
def main():
# Command line parsing
global outputLocation
parser = argparse.ArgumentParser(description='Attempt to generate X number'
' of random summoners.')
... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/Scrub_Useless_Summoners.py",
"copies": "1",
"size": "1533",
"license": "mit",
"hash": 851370026436835300,
"line_mean": 24.1475409836,
"line_max": 97,
"alpha_frac": 0.5688193085,
"autogenerated": false,
"ratio": 3.6939... |
__author__ = 'Deniz'
import argparse, os, os.path, sys
input_dir0_filenames = []
input_dir1_filenames = []
unlike_filenames = []
def main():
global input_dir0_filenames
global input_dir1_filenames
global unlike_filenames
parser = argparse.ArgumentParser(description="Given dir0 and dir1 locations, sea... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/Find_Like_Filenames.py",
"copies": "1",
"size": "4168",
"license": "mit",
"hash": 4475653152394823700,
"line_mean": 37.9626168224,
"line_max": 112,
"alpha_frac": 0.5616602687,
"autogenerated": false,
"ratio": 4.098328... |
__author__ = 'Deniz'
import os.path
import shutil
def main():
source0 = os.curdir + "\_outControl_0to15\\"
source1 = os.curdir + "\_outControl_16to30\\"
dest = os.curdir + "\_outControl\\"
sourcefiles = {os.path.splitext(x)[0] for x in os.listdir(source0) if os.path.splitext(x)[1] == '.txt'}
sour... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/Duplicate_File_Finder.py",
"copies": "1",
"size": "1259",
"license": "mit",
"hash": -8627436113358236000,
"line_mean": 38.375,
"line_max": 108,
"alpha_frac": 0.6298649722,
"autogenerated": false,
"ratio": 3.1009852216... |
__author__ = 'Deniz'
import re, argparse
# Declare an empty list of summoners
lo_summoners = []
lo_ids = []
no_dups_lo_summoners = []
def main():
# Command line parsing
global inputLocation
parser = argparse.ArgumentParser(description='Attempt to generate X number'
... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "Summoner_Data_Retrieval/DEPRECATED/Check_Duplicate_Summoners.py",
"copies": "1",
"size": "2112",
"license": "mit",
"hash": -4079504935165581000,
"line_mean": 25.4125,
"line_max": 80,
"alpha_frac": 0.5662878788,
"autogenerated": false,
"ratio... |
__author__ = 'Deniz'
import re, argparse
def main():
parser = argparse.ArgumentParser(description='Attempt to generate X number'
' of random summoners.')
parser.add_argument('-in', metavar='i', type=str)
args = parser.parse_args()
inputLocation = va... | {
"repo_name": "Murkantilism/LoL_API_Research",
"path": "WinLossPredictionModel/CalcWinLossELO.py",
"copies": "1",
"size": "1240",
"license": "mit",
"hash": 8893454287152562000,
"line_mean": 24.3265306122,
"line_max": 81,
"alpha_frac": 0.5862903226,
"autogenerated": false,
"ratio": 3.5632183908045... |
__author__='Dennis Hafemann, https://github.com/dennishafemann/python-TerminalColors'
# Severals
ESCAPE_SEQUENCE="\033[%sm"
# Styles
RESET = 0
BOLD = 1
UNDERLINE = 4
BLINK = 5
REVERSE_VIDEO = 7
# Colors
BLACK = 30
RED = 31
GREEN = 32
YELLOW = 33
BLUE = 34
MAGENTA = 35
CYAN = 36
WHITE = 37
def _createColoredString(*... | {
"repo_name": "danoan/image-processing",
"path": "ext/TerminalColors/__init__.py",
"copies": "1",
"size": "1442",
"license": "mit",
"hash": 388734929736581600,
"line_mean": 19.6142857143,
"line_max": 109,
"alpha_frac": 0.6151178918,
"autogenerated": false,
"ratio": 3.4170616113744074,
"config_t... |
"A metamorphosis client for python"
import socket
import struct
import sys
import time
import threading
from zkclient import ZKClient, zookeeper, watchmethod
from urlparse import urlparse
from threading import Timer
_DEAD_RETRY = 5 # number of seconds before retrying a dead server.
_SOCKET_TIMEOUT = 10 # number of ... | {
"repo_name": "272029252/Metamorphosis",
"path": "contrib/python/meta-python/metaq/producer.py",
"copies": "13",
"size": "18962",
"license": "apache-2.0",
"hash": -4381477689598403600,
"line_mean": 37.3846153846,
"line_max": 139,
"alpha_frac": 0.5562704356,
"autogenerated": false,
"ratio": 3.9886... |
__author__ = 'dennis.lutter'
from functools import partial
import logging
from cachecontrol import CacheControl
import requests
from models import model_from_item
from models import TYPE_MAP
BASE_URL = "https://api-v2launch.trakt.tv"
logger = logging.getLogger("easytrakt")
class Client(object):
def __init__(... | {
"repo_name": "lad1337/easytrakt",
"path": "easytrakt/__init__.py",
"copies": "1",
"size": "1463",
"license": "unlicense",
"hash": 1210142257291646500,
"line_mean": 27.1346153846,
"line_max": 72,
"alpha_frac": 0.5789473684,
"autogenerated": false,
"ratio": 3.8,
"config_test": false,
"has_no_k... |
__author__ = 'dennis.lutter'
import models
from attrdict import AttrDict
from dateutil.parser import parse as date_parser
def attrdict(client, data, parent):
return AttrDict(data)
def images(client, images, parent, expected=()):
if expected and not all(type_ in images for type_ in expected):
raise... | {
"repo_name": "lad1337/easytrakt",
"path": "easytrakt/generator.py",
"copies": "1",
"size": "1128",
"license": "unlicense",
"hash": -4717426986297931000,
"line_mean": 26.512195122,
"line_max": 67,
"alpha_frac": 0.6312056738,
"autogenerated": false,
"ratio": 3.76,
"config_test": false,
"has_no... |
__author__ = 'Dennis'
from copy import deepcopy
import csv
from world import World
from log import Log
class SimulationSetting(object):
def __init__(self):
self.condition = ""
self.initial_triggers = []
self.trigger_additions = {}
self.trigger_removals = {}
self.entities... | {
"repo_name": "Luciden/easl",
"path": "easl/simulation_suite.py",
"copies": "1",
"size": "7634",
"license": "mit",
"hash": -570171954082711200,
"line_mean": 33.5429864253,
"line_max": 127,
"alpha_frac": 0.5759758973,
"autogenerated": false,
"ratio": 4.541344437834622,
"config_test": false,
"h... |
__author__ = 'Dennis'
from mechanism import Mechanism
from easl import *
from easl.visualize import *
import random
class NewSimpleVisual(Visual):
@staticmethod
def visualize(self):
trees = {}
for action in self.motor_signals_and_domains:
trees[action] = {}
for value i... | {
"repo_name": "Luciden/easl",
"path": "easl/mechanisms/operant_conditioning.py",
"copies": "1",
"size": "5827",
"license": "mit",
"hash": -7030115209243571000,
"line_mean": 30.1604278075,
"line_max": 114,
"alpha_frac": 0.5927578514,
"autogenerated": false,
"ratio": 4.243991260014567,
"config_te... |
__author__ = 'Dennis'
import itertools
class Mechanism(object):
""" Abstract class for a (learning) mechanism to be used in the simulator.
All mechanisms have a set of motor signals that can be sent, with the
respective domains.
Attributes
----------
log : Log
all_variables_and_domains ... | {
"repo_name": "Luciden/easl",
"path": "easl/mechanisms/mechanism.py",
"copies": "1",
"size": "3534",
"license": "mit",
"hash": -5411551331783718000,
"line_mean": 29.4655172414,
"line_max": 115,
"alpha_frac": 0.6066779853,
"autogenerated": false,
"ratio": 4.490470139771284,
"config_test": false,... |
__author__ = 'Dennis'
from controller import Controller
from easl.visualize import *
import random
class LearningRule(object):
@staticmethod
def update_counts(counts, action, has_reward):
"""
Describes how the counts/probability changes given that an action was
contiguous ... | {
"repo_name": "Luciden/easl",
"path": "easl/controller/simple_controller.py",
"copies": "1",
"size": "7956",
"license": "mit",
"hash": -3741950987237589000,
"line_mean": 30.2186234818,
"line_max": 91,
"alpha_frac": 0.554927099,
"autogenerated": false,
"ratio": 4.764071856287425,
"config_test": ... |
__author__ = 'Dennis'
from copy import copy
class Entity(object):
"""
The basic component in the simulation.
An Entity can perform actions and be acted on itself, and it can observe
It can observe other Entities.
An Entity is a self-contained unit and should not have any references
... | {
"repo_name": "Luciden/easl",
"path": "easl/entity.py",
"copies": "1",
"size": "9968",
"license": "mit",
"hash": 3993041888301522400,
"line_mean": 31.6756756757,
"line_max": 119,
"alpha_frac": 0.5733346709,
"autogenerated": false,
"ratio": 4.6820103334899015,
"config_test": false,
"has_no_key... |
__author__ = 'Dennis'
from copy import deepcopy
import itertools
class Table(object):
"""
Given a set of variables and respective domains, this data structure provides
read/write access to a value assigned to each full combination of all variables.
For N variables, each with K values, thi... | {
"repo_name": "Luciden/easl",
"path": "easl/utils/probability.py",
"copies": "1",
"size": "13224",
"license": "mit",
"hash": -101876953644176930,
"line_mean": 28.0545454545,
"line_max": 114,
"alpha_frac": 0.5106624319,
"autogenerated": false,
"ratio": 4.653061224489796,
"config_test": false,
... |
__author__ = 'Dennis'
from log import Log
from visualize import *
class Sensor(object):
def __init__(self):
"""
Attributes
----------
observations
Reference to the observations list of the Entity with this Sensor.
signals : {name: [value]}
... | {
"repo_name": "Luciden/easl",
"path": "easl/world.py",
"copies": "1",
"size": "9362",
"license": "mit",
"hash": 2998502860909007000,
"line_mean": 33.1954887218,
"line_max": 99,
"alpha_frac": 0.5702841273,
"autogenerated": false,
"ratio": 4.818322182192486,
"config_test": false,
"has_no_keywor... |
__author__ = 'Dennis'
from visualizer import *
import easl
import sys
import pygame
import math
class PyGameVisualizer(Visualizer):
BG_COLOR = (0, 0, 0)
FG_COLOR = (255, 255, 255)
OBJ_COLOR = (196, 0, 0)
def __init__(self):
super(PyGameVisualizer, self).__init__()
... | {
"repo_name": "Luciden/easl",
"path": "easl/visualize/pygame_visualizer.py",
"copies": "1",
"size": "19586",
"license": "mit",
"hash": 4669480660601376000,
"line_mean": 33.9376146789,
"line_max": 125,
"alpha_frac": 0.5014295926,
"autogenerated": false,
"ratio": 4.055912197142265,
"config_test":... |
__author__ = 'Dennis'
import random
from copy import copy, deepcopy
from easl.controller import Controller
from easl.utils import stat
from easl.visualize import *
class WorkingMemory(object):
"""
"The working memory module holds a collection of time-labeled
predicates describing the r... | {
"repo_name": "Luciden/easl",
"path": "easl/controller/operant_controller.py",
"copies": "1",
"size": "33427",
"license": "mit",
"hash": 894906099631784100,
"line_mean": 34.732967033,
"line_max": 131,
"alpha_frac": 0.5625392647,
"autogenerated": false,
"ratio": 4.319291898178059,
"config_test":... |
__author__ = 'Dennis'
class Visual(object):
@staticmethod
def visualize(self):
"""
Parameters
----------
self : object
Any object that will be visualized.
Returns
-------
visualization : Visualization
"""
rais... | {
"repo_name": "Luciden/easl",
"path": "easl/visualize/visualizer.py",
"copies": "1",
"size": "3856",
"license": "mit",
"hash": 2551656781319968300,
"line_mean": 19.6629213483,
"line_max": 64,
"alpha_frac": 0.5114107884,
"autogenerated": false,
"ratio": 4.124064171122995,
"config_test": false,
... |
from aiorchestra.core import context
from aiorchestra.tests import base
class TestDeployments(base.BaseAIOrchestraTestCase):
def setUp(self):
super(TestDeployments, self).setUp()
def tearDown(self):
super(TestDeployments, self).tearDown()
@base.with_template('simple_node_template.yaml... | {
"repo_name": "aiorchestra/aiorchestra",
"path": "aiorchestra/tests/test_deployments.py",
"copies": "1",
"size": "3229",
"license": "apache-2.0",
"hash": -534115506029501250,
"line_mean": 36.9882352941,
"line_max": 78,
"alpha_frac": 0.6611954165,
"autogenerated": false,
"ratio": 3.776608187134503... |
from aiorchestra.core import utils
COMPUTE_ACTIVE = 'ACTIVE'
COMPUTE_BUILD = 'BUILD'
COMPUTE_SHUTOFF = 'SHUTOFF'
SERVER_TASK_STATE_POWERING_ON = 'powering-on'
async def create(context, novaclient, glanceclient, name_or_id, flavor,
image, ssh_keyname=None, nics=None, use_existing=False,
... | {
"repo_name": "aiorchestra/aiorchestra-openstack-plugin",
"path": "openstack_plugin/compute/instances.py",
"copies": "1",
"size": "6397",
"license": "apache-2.0",
"hash": 7243501706962119000,
"line_mean": 32.6684210526,
"line_max": 78,
"alpha_frac": 0.6038768173,
"autogenerated": false,
"ratio": ... |
from aiorchestra.core import utils
from openstack_plugin.common import clients
from openstack_plugin.networking import floating_ip
@utils.operation
async def floatingip_create(node, inputs):
node.context.logger.info(
'[{0}] - Attempting to create floating IP.'
.format(node.name))
existing_fl... | {
"repo_name": "aiorchestra/aiorchestra-openstack-plugin",
"path": "openstack_plugin/tasks/floating_ip.py",
"copies": "1",
"size": "4686",
"license": "apache-2.0",
"hash": -1976084973717016600,
"line_mean": 35.8976377953,
"line_max": 78,
"alpha_frac": 0.6188647034,
"autogenerated": false,
"ratio":... |
from aiorchestra.core import utils
from openstack_plugin.common import clients
from openstack_plugin.networking import network
@utils.operation
async def network_create(node, inputs):
node.context.logger.info(
'[{0}] - Attempting to create network.'.format(node.name))
neutron = clients.openstack.neu... | {
"repo_name": "aiorchestra/aiorchestra-openstack-plugin",
"path": "openstack_plugin/tasks/net.py",
"copies": "1",
"size": "4238",
"license": "apache-2.0",
"hash": -1598847362826648800,
"line_mean": 33.4552845528,
"line_max": 78,
"alpha_frac": 0.6222274658,
"autogenerated": false,
"ratio": 3.81458... |
from aiorchestra.core import utils
from openstack_plugin.common import clients
from openstack_plugin.networking import port
@utils.operation
async def port_create(node, inputs):
if 'link_id' not in node.runtime_properties:
raise Exception('Unable to create port for node "{0}". '
... | {
"repo_name": "aiorchestra/aiorchestra-openstack-plugin",
"path": "openstack_plugin/tasks/port.py",
"copies": "1",
"size": "6908",
"license": "apache-2.0",
"hash": -2659259300388528600,
"line_mean": 36.956043956,
"line_max": 78,
"alpha_frac": 0.5972785177,
"autogenerated": false,
"ratio": 3.75434... |
from aiorchestra.core import utils
from openstack_plugin.common import clients
from openstack_plugin.networking import router
@utils.operation
async def router_create(node, inputs):
node.context.logger.info('[{0}] - Attempting to create router.'
.format(node.name))
neutron = cli... | {
"repo_name": "aiorchestra/aiorchestra-openstack-plugin",
"path": "openstack_plugin/tasks/router.py",
"copies": "1",
"size": "3614",
"license": "apache-2.0",
"hash": -7964261575703325000,
"line_mean": 37.4468085106,
"line_max": 78,
"alpha_frac": 0.6427780852,
"autogenerated": false,
"ratio": 3.95... |
from aiorchestra.core import utils
from openstack_plugin.common import clients
from openstack_plugin.networking import security_group_and_rules
@utils.operation
async def security_group_create(node, inputs):
neutron = clients.openstack.neutron(node)
sg_name = node.properties.get('security_group_name')
s... | {
"repo_name": "aiorchestra/aiorchestra-openstack-plugin",
"path": "openstack_plugin/tasks/security_group.py",
"copies": "1",
"size": "3853",
"license": "apache-2.0",
"hash": 8881628741872361000,
"line_mean": 37.53,
"line_max": 78,
"alpha_frac": 0.6636387231,
"autogenerated": false,
"ratio": 3.876... |
from aiorchestra.core import utils
from openstack_plugin.common import clients
from openstack_plugin.networking import subnet
# https://wiki.openstack.org/wiki/Neutron/APIv2-specification#Create_Subnet
@utils.operation
async def subnet_create(node, inputs):
if 'link_id' not in node.runtime_properties:
r... | {
"repo_name": "aiorchestra/aiorchestra-openstack-plugin",
"path": "openstack_plugin/tasks/subnet.py",
"copies": "1",
"size": "4862",
"license": "apache-2.0",
"hash": 6501643038868763000,
"line_mean": 35.5563909774,
"line_max": 79,
"alpha_frac": 0.5909090909,
"autogenerated": false,
"ratio": 3.975... |
from aiorchestra.core import utils
from openstack_plugin.common import clients
def collect_member_net_attribute(members, attr):
attrs = []
for member in members:
interfaces = member.get('member_interfaces')
for interface in interfaces:
for fixed_ip in interface.fixed_ips:
... | {
"repo_name": "aiorchestra/aiorchestra-openstack-plugin",
"path": "openstack_plugin/tasks/lbaas.py",
"copies": "1",
"size": "6374",
"license": "apache-2.0",
"hash": 3449830167012078000,
"line_mean": 39.0880503145,
"line_max": 78,
"alpha_frac": 0.5855036084,
"autogenerated": false,
"ratio": 4.1989... |
from aiorchestra.core import utils
async def create(context, name_or_id, neutronclient,
external_gateway_info=None,
use_existing=False):
"""
Creates router
:param context:
:param name_or_id:
:param neutronclient:
:param external_gateway_info:
:param use_e... | {
"repo_name": "aiorchestra/aiorchestra-openstack-plugin",
"path": "openstack_plugin/networking/router.py",
"copies": "1",
"size": "2645",
"license": "apache-2.0",
"hash": 7120134587429198000,
"line_mean": 30.1176470588,
"line_max": 78,
"alpha_frac": 0.5871455577,
"autogenerated": false,
"ratio": ... |
from aiorchestra.core import utils
async def create(context, name_or_id,
neutronclient,
network_id,
subnet_id=None,
ip_addresses=None,
admin_state_up=True,
security_groups=None,
use_existing=False):... | {
"repo_name": "aiorchestra/aiorchestra-openstack-plugin",
"path": "openstack_plugin/networking/port.py",
"copies": "1",
"size": "3188",
"license": "apache-2.0",
"hash": -7231048548089948000,
"line_mean": 29.9514563107,
"line_max": 78,
"alpha_frac": 0.5677540778,
"autogenerated": false,
"ratio": 4... |
from aiorchestra.core import utils
async def create(context,
name_or_id,
neutronclient,
is_external=False,
admin_state_up=True,
use_existing=False):
"""
Creates network for OpenStack using Neutron API
:param context: Orc... | {
"repo_name": "aiorchestra/aiorchestra-openstack-plugin",
"path": "openstack_plugin/networking/network.py",
"copies": "1",
"size": "3374",
"license": "apache-2.0",
"hash": 7273226558076974000,
"line_mean": 35.6739130435,
"line_max": 78,
"alpha_frac": 0.5981031417,
"autogenerated": false,
"ratio":... |
from aiorchestra.core import utils
async def create(context,
name_or_id,
neutronclient,
network_id,
ip_version,
cidr,
allocation_pools,
dns_nameservers,
dhcp_enabled=True,
... | {
"repo_name": "aiorchestra/aiorchestra-openstack-plugin",
"path": "openstack_plugin/networking/subnet.py",
"copies": "1",
"size": "3681",
"license": "apache-2.0",
"hash": 3680811571247947000,
"line_mean": 31.2894736842,
"line_max": 78,
"alpha_frac": 0.5479489269,
"autogenerated": false,
"ratio": ... |
from aiorchestra.tests import base as aiorchestra
from openstack_plugin.tests.integration import base
from openstack_plugin.tests.integration import config
class TestComplex(base.BaseAIOrchestraOpenStackTestCase):
def setUp(self):
super(TestComplex, self).setUp()
def tearDown(self):
super(... | {
"repo_name": "aiorchestra/aiorchestra-openstack-plugin",
"path": "openstack_plugin/tests/integration/test_complex.py",
"copies": "1",
"size": "3102",
"license": "apache-2.0",
"hash": -8617472114487124000,
"line_mean": 36.8292682927,
"line_max": 78,
"alpha_frac": 0.6292714378,
"autogenerated": fals... |
from glanceclient.v2 import client as glanceclient
from keystoneauth1 import loading
from keystoneauth1 import session
from keystoneclient import client as keystoneclient
from novaclient import client as novaclient
from neutronclient.v2_0 import client as neutronclient
class OpenStackClients(object):
__keyston... | {
"repo_name": "aiorchestra/aiorchestra-openstack-plugin",
"path": "openstack_plugin/common/clients.py",
"copies": "1",
"size": "2375",
"license": "apache-2.0",
"hash": -3476055939082463700,
"line_mean": 33.9264705882,
"line_max": 78,
"alpha_frac": 0.6568421053,
"autogenerated": false,
"ratio": 4.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.