text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'mdippel'
import numpy as np
import pandas as pd
from pandasutils.plots import plotutils as plotutils
def print_descriptive_statistics(df):
for col in df:
print(col)
print('-----')
print("type: %s" % str(df[col].dtype))
if df[col].dtype == np.float64 or df[col].dtype ==... | {
"repo_name": "matthewdippel/pandas-utils",
"path": "descriptives/descriptivestatistics.py",
"copies": "1",
"size": "3920",
"license": "mit",
"hash": 7998841571765946000,
"line_mean": 37.067961165,
"line_max": 91,
"alpha_frac": 0.5900510204,
"autogenerated": false,
"ratio": 3.258520365752286,
"... |
__author__ = 'mdippel'
import pandasutils.plots.plotutils as plotutil
import pandasutils.descriptives.descriptivestatistics as desc
import os
import pandas as pd
def check_make_folder(folder_fname):
if not os.path.exists(folder_fname):
os.makedirs(folder_fname)
def run_all_scripts(df, root_folder):
ch... | {
"repo_name": "matthewdippel/pandas-utils",
"path": "masterscript/runall.py",
"copies": "1",
"size": "1570",
"license": "mit",
"hash": 4401325911194661000,
"line_mean": 33.9111111111,
"line_max": 74,
"alpha_frac": 0.6656050955,
"autogenerated": false,
"ratio": 3.458149779735683,
"config_test": ... |
__author__ = 'mdowd'
import urllib
from os import listdir
#response = urllib.urlopen('http://www1.ncdc.noaa.gov/pub/data/snowmonitoring/fema/02-2008-dlysnfl.txt')
path = r"/Users/mdowd/Programming/mdviz/snowViz/test.txt"
outpath = r"/Users/mdowd/Programming/mdviz/snowViz"
cleanOutPath = r"/Users/mdowd/Programming/mdv... | {
"repo_name": "mdviz/mdviz.github.io",
"path": "snowViz/pyScripts/cleanSnow2.py",
"copies": "1",
"size": "4404",
"license": "apache-2.0",
"hash": 7735986569988545000,
"line_mean": 41.3557692308,
"line_max": 458,
"alpha_frac": 0.4993188011,
"autogenerated": false,
"ratio": 3.6487158243579123,
"c... |
__author__ = 'meatpuppet'
import logging
def admin_only(reply_string='admins only!'):
'''
decorates functions to be only executed by admins.
replies reply_string if called by none-admin, or nothing if reply_string is empty
:param reply_string:
:return:
'''
def dec(func):
def wra... | {
"repo_name": "puhoy/sleekbasebot",
"path": "sleekbasebot/decorators.py",
"copies": "1",
"size": "1850",
"license": "mit",
"hash": 515264341702116400,
"line_mean": 30.9137931034,
"line_max": 111,
"alpha_frac": 0.4983783784,
"autogenerated": false,
"ratio": 4.204545454545454,
"config_test": fals... |
__author__ = 'meatpuppet'
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import sleekxmpp
import logging
from .muc_logging.muc_logging import log
if sys.version_info < (3, 0):
reload(sys)
sys.setdefaultencoding('utf8')
else:
raw_input = input
class XmppBotBase(sleekxmpp.ClientXMPP):
"""
... | {
"repo_name": "puhoy/sleekbasebot",
"path": "sleekbasebot/sleekbasebot.py",
"copies": "1",
"size": "4397",
"license": "mit",
"hash": 2691930324471185000,
"line_mean": 33.6220472441,
"line_max": 127,
"alpha_frac": 0.5599272231,
"autogenerated": false,
"ratio": 4.370775347912525,
"config_test": f... |
__author__ = 'meatz'
from collections import defaultdict
class CacheStats():
def __init__(self, cache_type, cache_size):
self._cache_type = cache_type
self._cache_size = cache_size
self.cache_used = 0
self.evicted_objects = 0
self.deleted_objects = 0
self.cached_o... | {
"repo_name": "zdvresearch/fast15-paper-extras",
"path": "cache-simulator/cache_model_evaluation/CacheStats.py",
"copies": "1",
"size": "5492",
"license": "mit",
"hash": -917929317406990500,
"line_mean": 30.5632183908,
"line_max": 81,
"alpha_frac": 0.5393299345,
"autogenerated": false,
"ratio": 3... |
__author__ = 'meatz'
from collections import MutableMapping
import random
class RandomChoiceDict(MutableMapping):
"""
Dictionary-like object allowing efficient random selection.
"""
def __init__(self):
# Add code to initialize from existing dictionaries.
self._keys = []
self._... | {
"repo_name": "zdvresearch/fast15-paper-extras",
"path": "cache-simulator/cache_model_evaluation/RandomChoiceDict.py",
"copies": "1",
"size": "1990",
"license": "mit",
"hash": 4038777205746976000,
"line_mean": 27.4285714286,
"line_max": 63,
"alpha_frac": 0.5698492462,
"autogenerated": false,
"rat... |
__author__ = 'meatz'
import bz2
import os
import sys
import glob
import re
import time
import calendar
import json
import resource
import gzip
from collections import defaultdict
import io
from multiprocessing import Pool
"""
transform the log files into one log reader_log that is obfuscated and just contains the... | {
"repo_name": "zdvresearch/fast15-paper-extras",
"path": "mars_feedback/feedback/prepare_feedback_logs.py",
"copies": "1",
"size": "6996",
"license": "mit",
"hash": -5319383761672122000,
"line_mean": 26.6561264822,
"line_max": 223,
"alpha_frac": 0.5676100629,
"autogenerated": false,
"ratio": 3.52... |
__author__ = 'meatz'
import os
import sys
import glob
import json
import re
import traceback
import gzip
from collections import defaultdict
"""
For every filtered reader log file, a .stat.json file is created.
This class aggregates all these logs into one big stat file.
"""
stats = defaultdict(int)
def cou... | {
"repo_name": "zdvresearch/fast15-paper-extras",
"path": "mars_feedback/feedback/count_stats.py",
"copies": "1",
"size": "8884",
"license": "mit",
"hash": 5747303410657340000,
"line_mean": 48.6368715084,
"line_max": 164,
"alpha_frac": 0.4494597028,
"autogenerated": false,
"ratio": 4.7431927389215... |
__author__ = 'meatz'
import os
import sys
import glob
import json
import re
import traceback
from collections import defaultdict
"""
For every filtered reader log file, a .stat.json file is created.
This class aggregates all these logs into one big stat file.
"""
stats = dict()
stats["totals"] = dict()
sta... | {
"repo_name": "zdvresearch/fast15-paper-extras",
"path": "mars_feedback/feedback/merge_filtered_feedback_stats.py",
"copies": "1",
"size": "9276",
"license": "mit",
"hash": 4425548932440190000,
"line_mean": 46.3316326531,
"line_max": 164,
"alpha_frac": 0.4541828374,
"autogenerated": false,
"ratio... |
__author__ = 'meatz'
import os
import sys
import glob
import re
import time
import calendar
import json
import resource
import gzip
from collections import defaultdict
import datetime
"""
for a given time range, check that all reader logs exist.
Then merge them all into one big file and sort them.
"""
def get_times... | {
"repo_name": "zdvresearch/fast15-paper-extras",
"path": "mars_feedback/feedback/check_files_complete.py",
"copies": "1",
"size": "1812",
"license": "mit",
"hash": -3971339500724536000,
"line_mean": 26.0447761194,
"line_max": 79,
"alpha_frac": 0.6263796909,
"autogenerated": false,
"ratio": 3.3932... |
__author__ = 'meatz'
import os
import sys
import glob
import re
import time
import calendar
import json
import resource
import gzip
from collections import defaultdict
import io
from multiprocessing import Pool
import datetime
# add ecmwf_utils to python path
util_path = os.path.join(os.path.dirname(os.path.dirname(... | {
"repo_name": "zdvresearch/fast15-paper-extras",
"path": "mars_feedback/feedback/analyze_filtered_feedback_logs.py",
"copies": "1",
"size": "5796",
"license": "mit",
"hash": -8845264856614259000,
"line_mean": 32.5086705202,
"line_max": 139,
"alpha_frac": 0.5210489993,
"autogenerated": false,
"rat... |
__author__ = 'medabana'
from PySide import QtCore, QtGui
import numpy as np
class ImageSliceDisplayLabel(QtGui.QLabel):
""" Responsible for the Image display area. """
pictureClicked = QtCore.Signal(int, int, float)
mouseMoved = QtCore.Signal(int, int)
mouseReleased = QtCore.Signal(int, int)
def ... | {
"repo_name": "AnitaTree/DceMrReader",
"path": "ImageDisplayWindow/ImageSliceDisplayLabel.py",
"copies": "1",
"size": "7472",
"license": "mit",
"hash": 5432141319212376000,
"line_mean": 34.7511961722,
"line_max": 109,
"alpha_frac": 0.5515256959,
"autogenerated": false,
"ratio": 3.553019495958155,... |
__author__ = 'medabana'
import dicom
import logging
import os
import numpy as np
from datetime import datetime
from collections import Counter
class PatientDirectoryReader(object):
""" Responsible for reading image and series data and information. """
def __init__(self, dirNm):
""" Set up storage for ... | {
"repo_name": "AnitaTree/DceMrReader",
"path": "DicomReader/PatientDirectoryReader.py",
"copies": "1",
"size": "6493",
"license": "mit",
"hash": 4026178197229986000,
"line_mean": 40.3630573248,
"line_max": 114,
"alpha_frac": 0.5801632527,
"autogenerated": false,
"ratio": 3.904389657245941,
"con... |
__author__ = 'medabana'
import dicom
import os
from DicomReader.PatientDirectoryReader import PatientDirectoryReader
class RecursiveDirectoryReader(PatientDirectoryReader):
"""Responsible for reading image data when there is not a DICOMDIR file."""
def __init__(self, dirNm):
PatientDirectoryReader.__... | {
"repo_name": "AnitaTree/DceMrReader",
"path": "DicomReader/RecursiveDirectoryReader.py",
"copies": "1",
"size": "3642",
"license": "mit",
"hash": 506084153534870660,
"line_mean": 43.962962963,
"line_max": 104,
"alpha_frac": 0.5428336079,
"autogenerated": false,
"ratio": 4.225058004640371,
"con... |
__author__ = 'medabana'
import logging
import numpy as np
import scipy.ndimage as ndimage
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from AIFextractionParameters import AIFextractionParameters
class AIFselector():
""" Algorithms for selecting AIF voxels. """
def __init__(self, maps):
... | {
"repo_name": "AnitaTree/DceMrReader",
"path": "Analysis/AIFselector.py",
"copies": "1",
"size": "16157",
"license": "mit",
"hash": 4166418872095771000,
"line_mean": 40.1119592875,
"line_max": 164,
"alpha_frac": 0.5999876215,
"autogenerated": false,
"ratio": 3.5185104529616726,
"config_test": f... |
__author__ = 'medabana'
import logging
import numpy as np
class MapGenerator():
" Generates Maps from the dynamic series"
def __init__(self):
self.reset()
self._logger = logging.getLogger(__name__)
def baselineMap(self):
""" Generates an map of average baseline (pre-contrast) inte... | {
"repo_name": "AnitaTree/DceMrReader",
"path": "Analysis/MapGenerator.py",
"copies": "1",
"size": "4658",
"license": "mit",
"hash": -7380429289688345000,
"line_mean": 31.3541666667,
"line_max": 107,
"alpha_frac": 0.5588235294,
"autogenerated": false,
"ratio": 3.904442581726739,
"config_test": f... |
__author__ = 'medabana'
import logging
from Analysis.MapGuiSetup import MapGuiSetup
from Analysis.AIFguiSetup import AIFguiSetup
class AIFmethods():
def __init__(self, aifGui, mapGui):
""" Initialize variables.
:param aifGui: AIFGuiSetup
:param mapGui: MapGuiSetup
:return:
... | {
"repo_name": "AnitaTree/DceMrReader",
"path": "Analysis/AIFmethods.py",
"copies": "1",
"size": "2560",
"license": "mit",
"hash": -7803038873496587000,
"line_mean": 37.2089552239,
"line_max": 123,
"alpha_frac": 0.661328125,
"autogenerated": false,
"ratio": 3.8152011922503726,
"config_test": fal... |
__author__ = 'medabana'
import numpy as np
class TwoCFM():
def __init__(self):
pass
def generateCurve(self, time, aif, params):
n = time.shape[0]
fp = params[0]
tp = params[1]
ps = params[2]
te = params[3]
vp = fp * tp
ve = ps * te
ct =... | {
"repo_name": "AnitaTree/DceMrReader",
"path": "ModelFitting/TwoCFM.py",
"copies": "1",
"size": "1219",
"license": "mit",
"hash": -6188612260454047000,
"line_mean": 20.7857142857,
"line_max": 72,
"alpha_frac": 0.4257588187,
"autogenerated": false,
"ratio": 2.9515738498789346,
"config_test": fal... |
__author__ = 'medabana'
import numpy as np
class TwoCFM_pmi:
def __init__(self):
pass
def _expConvolution(self, k, time, aif):
n = time.shape[0]
dt = time[1:n] - time[0:n-1]
da = aif[1:n] - aif[0:n-1]
z = k * dt
expTerm = np.exp(-z)
expTerm0 = 1 - exp... | {
"repo_name": "AnitaTree/DceMrReader",
"path": "ModelFitting/TwoCFM_pmi.py",
"copies": "1",
"size": "3285",
"license": "mit",
"hash": 8524853678941243000,
"line_mean": 21.8194444444,
"line_max": 102,
"alpha_frac": 0.4913242009,
"autogenerated": false,
"ratio": 1.806930693069307,
"config_test": ... |
__author__ = 'medabana'
import os
import dicom
from DicomReader.PatientDirectoryReader import PatientDirectoryReader
class DicomDirFileReader(PatientDirectoryReader):
"""Responsible for reading image directories where there is a DICOMDIR file."""
def __init__(self, dirNm, dcmdirFile):
PatientDirector... | {
"repo_name": "AnitaTree/DceMrReader",
"path": "DicomReader/DicomDirFileReader.py",
"copies": "1",
"size": "1903",
"license": "mit",
"hash": 7802384115854318000,
"line_mean": 45.4146341463,
"line_max": 118,
"alpha_frac": 0.6305832895,
"autogenerated": false,
"ratio": 4.509478672985782,
"config_... |
__author__ = 'medabana'
import unittest
import numpy as np
from ModelFitting.TwoCFM import TwoCFM
class TwoCFMTest(unittest.TestCase):
def testA(self):
aif_pre = np.ones(5) * 10
aif_firstPass = np.concatenate([range(10, 51, 20), range(55, 14, -20)])
aif_tail = np.ones(15) * 14
ai... | {
"repo_name": "AnitaTree/DceMrReader",
"path": "ModelFitting/TwoCFMTest.py",
"copies": "1",
"size": "1035",
"license": "mit",
"hash": 1639635223852833000,
"line_mean": 33.5333333333,
"line_max": 87,
"alpha_frac": 0.5584541063,
"autogenerated": false,
"ratio": 2.907303370786517,
"config_test": t... |
__author__ = 'medina'
from django.forms import ModelForm
from django import forms
from .models import *
class UserForm(forms.Form):
username = forms.CharField(min_length=5)
email = forms.EmailField()
password = forms.CharField(min_length=5, widget=forms.PasswordInput())
password_confirmation = form... | {
"repo_name": "gerasp/DasTolleForum",
"path": "forum/forms.py",
"copies": "1",
"size": "1743",
"license": "mit",
"hash": -8124248709438428000,
"line_mean": 29.5789473684,
"line_max": 94,
"alpha_frac": 0.6528973035,
"autogenerated": false,
"ratio": 4.293103448275862,
"config_test": false,
"has... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm, multivariate_normal
import bayes_logistic
import warnings
warnings.filterwarnings("ignore", category=RuntimeWarning)
#Please make sure bayes_logistic library is installed prior to running this file
def main():
np.random.seed(135)
... | {
"repo_name": "probml/pyprobml",
"path": "scripts/logregLaplaceGirolamiDemo.py",
"copies": "1",
"size": "5844",
"license": "mit",
"hash": -567190514577198300,
"line_mean": 36.7032258065,
"line_max": 172,
"alpha_frac": 0.6192676249,
"autogenerated": false,
"ratio": 2.6527462551066727,
"config_te... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.transforms as tr
import warnings
warnings.filterwarnings("ignore", category=RuntimeWarning)
def range_chebyshev(a, b, steps):
"""
Create a grid point of N+1 values
"""
theta_vals = np.arange(steps+1) * np.pi / steps
x_vals = (a + b... | {
"repo_name": "probml/pyprobml",
"path": "scripts/gaussEvec.py",
"copies": "1",
"size": "2915",
"license": "mit",
"hash": 3648359695826682400,
"line_mean": 45.2380952381,
"line_max": 119,
"alpha_frac": 0.59375,
"autogenerated": false,
"ratio": 2.6593607305936073,
"config_test": false,
"has_no... |
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from scipy.stats import bernoulli as bern
import warnings
warnings.filterwarnings("ignore")
def bernoulli_mixture_pmf(data, means, K):
'''To compute the probability of x for each bernouli distribution
data = N X D matrix
... | {
"repo_name": "probml/pyprobml",
"path": "scripts/mixBerMnistEM.py",
"copies": "1",
"size": "5382",
"license": "mit",
"hash": -5152613740755029000,
"line_mean": 30.6181818182,
"line_max": 106,
"alpha_frac": 0.5971757711,
"autogenerated": false,
"ratio": 3.4084863837872073,
"config_test": false,... |
import math
import matplotlib.pyplot as plt
import numpy as np
from scipy.special import logsumexp
'''
z = Wx + µ + E
the equation above represents the latent variable model which
relates a d-dimensional data vector z to a corresponding q-dimensional
latent variables x
with q < d, for isotropic noise E ∼ N ... | {
"repo_name": "probml/pyprobml",
"path": "scripts/mixPpcaDemo.py",
"copies": "1",
"size": "10958",
"license": "mit",
"hash": 6573018909430093000,
"line_mean": 39.6183206107,
"line_max": 146,
"alpha_frac": 0.542461482,
"autogenerated": false,
"ratio": 3.2346484722634234,
"config_test": false,
... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import minimize, line_search
def aoki_vectorized(x):
"""
F(x,y) = 0.5 (x^2 - y)^2 + 0.5 (x-1)^2
"""
f = 0.5 * np.square(np.square(x[:][0]) - x[:][1]) + 0.5 * np.square(x[:][0] - 1)
return f
def aoki(x):
""... | {
"repo_name": "probml/pyprobml",
"path": "scripts/steepestDescentDemo.py",
"copies": "1",
"size": "3184",
"license": "mit",
"hash": -6899065944971027000,
"line_mean": 28.9126213592,
"line_max": 98,
"alpha_frac": 0.4676507538,
"autogenerated": false,
"ratio": 2.733047210300429,
"config_test": fa... |
"""
Figure 11.16 and 11.17 in the book "Probabilistic Machine Learning: An Introduction by Kevin P. Murphy"
Dependencies: spams(pip install spams), group-lasso(pip install group-lasso)
Illustration of group lasso:
To show the effectiveness of group lasso, in this code we demonstrate:
a)Actual Data b)Vanilla Lasso ... | {
"repo_name": "probml/pyprobml",
"path": "scripts/groupLassoDemo.py",
"copies": "1",
"size": "7327",
"license": "mit",
"hash": 132977253759736540,
"line_mean": 44.3037974684,
"line_max": 126,
"alpha_frac": 0.6913613997,
"autogenerated": false,
"ratio": 2.9346169273967107,
"config_test": false,
... |
__author__ = 'Meemaw'
def countInversion(aList):
total = 0
if len(aList) == 1:
return 0
mid = int(len(aList)/2)
firstHalf = aList[:mid]
secondHalf = aList[mid:]
leftInv = countInversion(firstHalf)
rightInv = countInversion(secondHalf)
splitInv = Merge(firstHalf,secondHalf,aList... | {
"repo_name": "Meemaw/Algorithms",
"path": "Divide and conquer/CountingInversions.py",
"copies": "1",
"size": "1139",
"license": "mit",
"hash": 5492408132204618000,
"line_mean": 29.7837837838,
"line_max": 70,
"alpha_frac": 0.6374012291,
"autogenerated": false,
"ratio": 3.6506410256410255,
"conf... |
__author__ = 'Meemaw'
import string
## Methods for encryption
## Build coding dictionary (coder) according to shift
def buildCoder(shift):
coder = {}
for char in string.ascii_lowercase:
stevilo = ord(char) - 96 + shift
if stevilo > 26:
stevilo-=26
coder[char] = chr(stev... | {
"repo_name": "Meemaw/Algorithms",
"path": "Encryption/CeasarEncryption.py",
"copies": "1",
"size": "2119",
"license": "mit",
"hash": -7584380539216040000,
"line_mean": 24.2261904762,
"line_max": 76,
"alpha_frac": 0.6073619632,
"autogenerated": false,
"ratio": 3.561344537815126,
"config_test": ... |
__author__ = 'MegabytePhreak'
from enum import Enum, unique
@unique
class RdlType(Enum):
sizedNumeric = 'sn'
unsizedNumeric = 'un'
numeric = 'n'
boolean = 'b'
string = 's'
AddressMode = 'AddressMode'
Precedence = 'Precedence'
AccessMode = 'AccessMode'
enum = 'Enum'
SignalDest ... | {
"repo_name": "MegabytePhreak/rdl",
"path": "rdlcompiler/systemrdl/properties.py",
"copies": "1",
"size": "7098",
"license": "mit",
"hash": 5632380591396920000,
"line_mean": 41.25,
"line_max": 76,
"alpha_frac": 0.4373062835,
"autogenerated": false,
"ratio": 3.615894039735099,
"config_test": fal... |
__author__ = 'megabytephreak'
from rdl_lexer import RdlLexer, RdlToken
from ply import yacc
from ply.lex import LexToken
import rdl_ast
from rdlcompiler.colorize import colorize, RED
from rdlcompiler.logger import logger
def make_list_prod(prod, tprod):
def rule(self, p):
if len(p) == 3:
p[0... | {
"repo_name": "MegabytePhreak/rdl",
"path": "rdlcompiler/systemrdl/rdl_parser.py",
"copies": "1",
"size": "10300",
"license": "mit",
"hash": -3500396409084176000,
"line_mean": 28.0960451977,
"line_max": 114,
"alpha_frac": 0.464368932,
"autogenerated": false,
"ratio": 3.317230273752013,
"config_... |
__author__ = 'megabytephreak'
import os
import tempfile
import re
from rdlcompiler.config import Config
import subprocess
from enum import Enum
class preprocess_mode(Enum):
AUTO = -1
NONE = 0
VERILOG_ONLY = 1
PERL_ONLY = 2
BOTH = 3
def perl_available():
try:
with open(os.devnull) as ... | {
"repo_name": "MegabytePhreak/rdl",
"path": "rdlcompiler/systemrdl/preprocessor.py",
"copies": "1",
"size": "3219",
"license": "mit",
"hash": 1040857309010068400,
"line_mean": 33.2553191489,
"line_max": 144,
"alpha_frac": 0.6129232681,
"autogenerated": false,
"ratio": 4.0643939393939394,
"confi... |
__author__ = 'MegabytePhreak'
import types
def _indent(level):
if level > 0:
return ' '*level
return ''
class AstNode(object):
pass
def pprint(self, level=0):
pass
def __str__(self):
return self.pprint(0)
class Subscript(AstNode):
def __init__(self, name, inde... | {
"repo_name": "MegabytePhreak/rdl",
"path": "rdlcompiler/systemrdl/rdl_ast.py",
"copies": "1",
"size": "6953",
"license": "mit",
"hash": 8497407794208796000,
"line_mean": 27.6172839506,
"line_max": 113,
"alpha_frac": 0.5261038401,
"autogenerated": false,
"ratio": 3.4957264957264957,
"config_tes... |
__author__ = 'MegabytePhreak'
import unittest
from jsonmapper.fields import *
from jsonmapper import Loadable
import jsonmapper.exceptions as exceptions
class TestFields(unittest.TestCase):
def test_IntField(self):
f = IntField()
f.validate(1)
f.validate(1.0)
f.validate(1L)
... | {
"repo_name": "MegabytePhreak/jsonmapper",
"path": "tests/fields.py",
"copies": "1",
"size": "3377",
"license": "mit",
"hash": 1567348021390070000,
"line_mean": 29.7,
"line_max": 116,
"alpha_frac": 0.6251110453,
"autogenerated": false,
"ratio": 3.807215332581736,
"config_test": true,
"has_no_... |
__author__ = 'MegabytePhreak'
import unittest
from jsonmapper import Loadable
from jsonmapper.fields import *
import jsonmapper.exceptions as exceptions
class TestLoadable(unittest.TestCase):
def test_basic(self):
class basic(Loadable):
foo = IntField(default=1, min_val=0, max_val=10)
... | {
"repo_name": "MegabytePhreak/jsonmapper",
"path": "tests/loadable.py",
"copies": "1",
"size": "1126",
"license": "mit",
"hash": 6881378891373942000,
"line_mean": 32.1470588235,
"line_max": 79,
"alpha_frac": 0.6527531083,
"autogenerated": false,
"ratio": 3.765886287625418,
"config_test": false,... |
__author__ = 'Megha'
# Script to transfer csv containing data about various models to json
# Input csv file constituting of the model data
# Output json file representing the csv data as json object
# Assumes model name to be first line
# Field names of the model on the second line
# Data seperated by __DELIM__
# Examp... | {
"repo_name": "ramcn/demo2",
"path": "fixtures/createJson.py",
"copies": "6",
"size": "2462",
"license": "mit",
"hash": -6092822756398124000,
"line_mean": 38.7258064516,
"line_max": 106,
"alpha_frac": 0.6259138911,
"autogenerated": false,
"ratio": 3.222513089005236,
"config_test": false,
"has... |
__author__ = 'mehdibenchoufi'
from constants import Constants
import numpy as np
class Data:
def get_rows(self):
return self.rows
def set_rows(self, value):
self.rows = value
def get_larger_rows(self):
return self.larger_rows
def set_larger_rows(self, value):
self.... | {
"repo_name": "benchoufi/PRJ-medtec_sigproc",
"path": "EchoImageProcessing/EchoImageProcessing/data.py",
"copies": "5",
"size": "1343",
"license": "mit",
"hash": 63535713425856780,
"line_mean": 25.3333333333,
"line_max": 65,
"alpha_frac": 0.6075949367,
"autogenerated": false,
"ratio": 3.382871536... |
__author__ = 'mehdibenchoufi'
from filereader import FileReader
from data import Data
from constants import constants
import cv2
class ScanConverter:
def get_input(self, value):
return self.input
def set_input(self, value):
self.input = value
def get_intermediate_input(self, value):
... | {
"repo_name": "ydre/kit-soft",
"path": "ImageProcessing/scanconversion/scanconverter.py",
"copies": "1",
"size": "1620",
"license": "bsd-3-clause",
"hash": 5534904766842114000,
"line_mean": 29,
"line_max": 186,
"alpha_frac": 0.6382716049,
"autogenerated": false,
"ratio": 3.4913793103448274,
"co... |
__author__ = 'mehdibenchoufi'
from filereader import FileReader
from data import Data
import constants
import sys
sys.path.append('/usr/local/lib/python2.7/site-packages')
import cv2
class ScanConverter:
def get_input(self, value):
return self.input
def set_input(self, value):
self.input = ... | {
"repo_name": "ydre/kit-soft",
"path": "ImageProcessing/soobash/scanconverter.1.py",
"copies": "1",
"size": "1675",
"license": "bsd-3-clause",
"hash": 7858614216176707000,
"line_mean": 28.9107142857,
"line_max": 186,
"alpha_frac": 0.6417910448,
"autogenerated": false,
"ratio": 3.432377049180328,
... |
__author__ = 'mehdibenchoufi'
import argparse
from filereader import FileReader
from data import Data
from constants import Constants
from filereader import FileReader
import cv2
def execution():
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--verbosity", type=str,
... | {
"repo_name": "echopen/PRJ-medtec_sigproc",
"path": "EchoImageProcessing/EchoImageProcessing/scanconverter.py",
"copies": "5",
"size": "2384",
"license": "mit",
"hash": 9168113351736562000,
"line_mean": 26.4022988506,
"line_max": 78,
"alpha_frac": 0.5918624161,
"autogenerated": false,
"ratio": 3.... |
__author__ = 'mehdibenchoufi'
import constants
import numpy as np
class Data:
def get_rows(self):
return self.rows
def set_rows(self, value):
self.rows = value
def get_larger_rows(self):
return self.larger_rows
def set_larger_rows (self, value):
self.larger_rows = ... | {
"repo_name": "ydre/kit-soft",
"path": "ImageProcessing/soobash/data.py",
"copies": "2",
"size": "1331",
"license": "bsd-3-clause",
"hash": 3576757207714888000,
"line_mean": 25.0980392157,
"line_max": 65,
"alpha_frac": 0.6033057851,
"autogenerated": false,
"ratio": 3.361111111111111,
"config_te... |
__author__ = "Mehdi Korjani"
__version__ = "1.0.0"
import pdb
import glob
import os
import numpy as np
from keras.models import load_model
from keras.models import model_from_json
from keras.callbacks import EarlyStopping
from keras.callbacks import ModelCheckpoint
import h5py
import argparse
from pydub import AudioSe... | {
"repo_name": "korjani/time_domain_speech_enhancement",
"path": "train.py",
"copies": "1",
"size": "5874",
"license": "mit",
"hash": 2741783475534754300,
"line_mean": 33.7633136095,
"line_max": 141,
"alpha_frac": 0.5614572693,
"autogenerated": false,
"ratio": 3.809338521400778,
"config_test": f... |
__author__ = "Mehdi Korjani"
__version__ = "1.0.0"
from keras.models import load_model
import simplejson
import pdb
import cPickle as pickle
import os
import h5py
import argparse
sys.path.append(os.path.abspath('utils'))
import preprocessing as frame
import wave_manipulation as manipulate
MODEL_FILE = 'model/model_... | {
"repo_name": "korjani/time_domain_speech_enhancement",
"path": "generate.py",
"copies": "1",
"size": "4931",
"license": "mit",
"hash": -6262431130343219000,
"line_mean": 33.9787234043,
"line_max": 157,
"alpha_frac": 0.6120462381,
"autogenerated": false,
"ratio": 3.183344092963202,
"config_test... |
__author__ = 'mehdi'
from django.contrib.auth.models import User
from votes.models import Votant
from django.core.exceptions import PermissionDenied
import urllib.request as req
class IntranetFilterAuthBackend(object):
def authenticate(self, username=None, password=None):
# On vérifie d'abord que le pseu... | {
"repo_name": "mbahri/vote_ensimag",
"path": "votes_ensimag/IntranetFilterAuthBackend.py",
"copies": "1",
"size": "1916",
"license": "mit",
"hash": 4958562849834212000,
"line_mean": 37.8775510204,
"line_max": 124,
"alpha_frac": 0.6334033613,
"autogenerated": false,
"ratio": 3.654510556621881,
"... |
__author__ = 'Mehmet Mert Yildiran, mert.yildiran@bil.omu.edu.tr'
from cerebrum.hearing import HearingMemoryUtil # BUILT-IN Hearing Memory operations package
from cerebrum.vision import VisionMemoryUtil # BUILT-IN Vision Memory operations package
from cerebrum.language import LanguageMemoryUtil
import itertools # Impl... | {
"repo_name": "mertyildiran/Cerebrum",
"path": "cerebrum/crossmodal/mapper.py",
"copies": "1",
"size": "4411",
"license": "mit",
"hash": 1867949426637387000,
"line_mean": 58.6081081081,
"line_max": 170,
"alpha_frac": 0.7673996826,
"autogenerated": false,
"ratio": 3.60670482420278,
"config_test"... |
__author__ = 'Mehmet Mert Yildiran, mert.yildiran@bil.omu.edu.tr'
import datetime # Supplies classes for manipulating dates and times in both simple and complex ways.
import imutils # A series of convenience functions to make basic image processing functions such as translation, rotation, resizing, skeletonization etc... | {
"repo_name": "mertyildiran/Cerebrum",
"path": "cerebrum/vision/perception.py",
"copies": "1",
"size": "10349",
"license": "mit",
"hash": 8705819167549334000,
"line_mean": 49.9802955665,
"line_max": 193,
"alpha_frac": 0.7050922794,
"autogenerated": false,
"ratio": 3.295859872611465,
"config_tes... |
__author__ = 'Mehmet Mert Yildiran, mert.yildiran@bil.omu.edu.tr'
import datetime # Supplies classes for manipulating dates and times in both simple and complex ways
import os.path # The path module suitable for the operating system Python is running on, and therefore usable for local paths
import pysrt # SubRip (.srt... | {
"repo_name": "mertyildiran/Cerebrum",
"path": "cerebrum/language/analysis.py",
"copies": "1",
"size": "3104",
"license": "mit",
"hash": 1684088427620368400,
"line_mean": 54.4285714286,
"line_max": 159,
"alpha_frac": 0.693621134,
"autogenerated": false,
"ratio": 3.5925925925925926,
"config_test... |
__author__ = 'Mehmet Mert Yildiran, mert.yildiran@bil.omu.edu.tr'
import pyaudio # Provides Python bindings for PortAudio, the cross platform audio API
import wave # Provides a convenient interface to the WAV sound format
import datetime # Supplies classes for manipulating dates and times in both simple and complex wa... | {
"repo_name": "mertyildiran/Cerebrum",
"path": "cerebrum/hearing/perception.py",
"copies": "1",
"size": "12143",
"license": "mit",
"hash": 290786703251719600,
"line_mean": 54.1954545455,
"line_max": 176,
"alpha_frac": 0.7308737544,
"autogenerated": false,
"ratio": 3.488365412237863,
"config_tes... |
__author__ = 'Mehmet Mert Yildiran, mert.yildiran@bil.omu.edu.tr'
import rethinkdb as r # Rethinkdb Python driver
# Pair class
class Pair(object):
def __init__(self, timestamp1, timestamp2, direction): # Initialize the object
self.timestamp1 = timestamp1 # Memory starting time of a sense
self.timestamp2 = timest... | {
"repo_name": "mertyildiran/Cerebrum",
"path": "cerebrum/crossmodal/utilities.py",
"copies": "1",
"size": "1485",
"license": "mit",
"hash": 2878562978183745000,
"line_mean": 29.9375,
"line_max": 95,
"alpha_frac": 0.7057239057,
"autogenerated": false,
"ratio": 3.173076923076923,
"config_test": f... |
__author__ = 'Mehmet Mert Yildiran, mert.yildiran@bil.omu.edu.tr'
import sys # Provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is always available.
from cerebrum.crossmodal import MapperUtil # BUILT-IN Crosmodal operations package... | {
"repo_name": "mertyildiran/Cerebrum",
"path": "cerebrum/neuralnet/weaver.py",
"copies": "1",
"size": "4379",
"license": "mit",
"hash": -7800333673593669000,
"line_mean": 41.1057692308,
"line_max": 170,
"alpha_frac": 0.6775519525,
"autogenerated": false,
"ratio": 3.088152327221439,
"config_test... |
__author__ = 'meinko'
# Very quick n dirty method to see resolution. Using calculation method from
# https://www.marginallyclever.com/other/samples/fk-ik-test.html
import math
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
e = 15.0 # end effector radius
f = 30.0 # base r... | {
"repo_name": "YuryBrodskiy/msp430_delta_robot",
"path": "algorithms/sandbox.py",
"copies": "1",
"size": "6035",
"license": "mit",
"hash": -1411670832592318000,
"line_mean": 31.1063829787,
"line_max": 118,
"alpha_frac": 0.5297431649,
"autogenerated": false,
"ratio": 2.409181636726547,
"config_t... |
import numpy as np
# This is the MDP approximation
# We can use the same MDP for Thompson;
# the only real purpose it serves is accurate
# policy computation given some approximate MDP,
# which only depends on the probability value being set properly,
# and the reward.
class ApproxMDP(object):
def __init__(se... | {
"repo_name": "elibol/basic-rl-algos",
"path": "mdps.py",
"copies": "1",
"size": "7888",
"license": "mit",
"hash": -4645785626706450000,
"line_mean": 33,
"line_max": 85,
"alpha_frac": 0.5687119675,
"autogenerated": false,
"ratio": 4.012207527975585,
"config_test": false,
"has_no_keywords": fa... |
import numpy as np
class EpsilonGreedyPolicy(object):
def __init__(self, num_actions, epsilon=0):
self.states = {}
self.epsilon = epsilon
self.action_len = num_actions
self.action_range = range(self.action_len)
# lazy-initialize states w/ uniform dist.
def g... | {
"repo_name": "elibol/basic-rl-algos",
"path": "policy.py",
"copies": "1",
"size": "1720",
"license": "mit",
"hash": -8942921273604614000,
"line_mean": 29.7142857143,
"line_max": 68,
"alpha_frac": 0.5372093023,
"autogenerated": false,
"ratio": 3.575883575883576,
"config_test": false,
"has_no_... |
import numpy as np
from policy import EpsilonGreedyPolicy
from mdps import *
class AgentFactory(object):
def __init__(self, agent_cls, policy_cls):
self.agent_cls = agent_cls
self.policy_cls = policy_cls
def get_agent(self, num_states, num_actions, epsilon, gamma, alpha, agent_args):
... | {
"repo_name": "elibol/basic-rl-algos",
"path": "agents.py",
"copies": "1",
"size": "10114",
"license": "mit",
"hash": -3286563659416747000,
"line_mean": 30.8050314465,
"line_max": 102,
"alpha_frac": 0.5614989124,
"autogenerated": false,
"ratio": 3.9110595514307813,
"config_test": false,
"has_... |
# 计算香农熵
from math import log
def calcShannonEnt(dataSet):
numEntries = len(dataSet)
lableCount = {}
for featVec in dataSet:
currentLable = featVec[-1]
if currentLable not in lableCount.keys():
lableCount[currentLable] = 0
lableCount[currentLable] += 1
shannonEnt = 0.... | {
"repo_name": "MelissaChan/MachineLearning",
"path": "decisionTree/trees.py",
"copies": "1",
"size": "4357",
"license": "mit",
"hash": -4708359735586332000,
"line_mean": 32.1544715447,
"line_max": 98,
"alpha_frac": 0.6347804758,
"autogenerated": false,
"ratio": 2.8351877607788594,
"config_test"... |
import matplotlib.pyplot as plt
decisionNode = dict(boxstyle="sawtooth", fc="0.8")
leafNode = dict(boxstyle="round4", fc="0.8")
arrow_args = dict(arrowstyle="<-")
def plotNode(nodeTxt, centerPt, parentPt, nodeType):
createPlot.ax1.annotate(nodeTxt, xy=parentPt, xycoords='axes fraction',
... | {
"repo_name": "MelissaChan/MachineLearning",
"path": "decisionTree/treePlotter.py",
"copies": "1",
"size": "3146",
"license": "mit",
"hash": -8516828920928256000,
"line_mean": 36.4166666667,
"line_max": 151,
"alpha_frac": 0.6263526416,
"autogenerated": false,
"ratio": 2.866788321167883,
"config... |
# 词表转换向量
# 创建词汇表
def createVocabList(dataSet):
vocabSet = set([])
for document in dataSet:
vocabSet = vocabSet | set(document)
return list(vocabSet)
# 转换为向量
def setOfWords2Vec(vocablist,inputset):
returnVec = [0] * len(vocablist)
for word in inputset:
if word in vocablist:
... | {
"repo_name": "MelissaChan/MachineLearning",
"path": "naiveBayes/bayes.py",
"copies": "1",
"size": "4473",
"license": "mit",
"hash": -3032608925586439700,
"line_mean": 33.4715447154,
"line_max": 83,
"alpha_frac": 0.6390658174,
"autogenerated": false,
"ratio": 2.708626198083067,
"config_test": t... |
from numpy import *
# 加载数据
def loadDataSet():
dataMat = []; labelMat = []
fr = open('testSet.txt')
for line in fr.readlines():
lineArr = line.strip().split()
# 设置x0为0,数据每行前个值为x1,x2,第三个值为标签
dataMat.append([1.0, float(lineArr[0]), float(lineArr[1])])
labelMat.append(int(lineA... | {
"repo_name": "MelissaChan/MachineLearning",
"path": "logRegres/logRegres.py",
"copies": "1",
"size": "5012",
"license": "mit",
"hash": -2769182229997070000,
"line_mean": 30.7361111111,
"line_max": 102,
"alpha_frac": 0.6196936543,
"autogenerated": false,
"ratio": 2.667834208990076,
"config_test... |
# -*- coding: utf-8 -*-
import os
import sys
import webbrowser
import urllib
def login():
# Get this value from your Facebook application's settings
CLIENT_ID = '215892185442408'
REDIRECT_URI = 'http://facebook.com/developers/'
# You could customize which extended permissions are being requested... | {
"repo_name": "MelissaChan/Crawler_Facebook",
"path": "JustText/Stange_Login.py",
"copies": "1",
"size": "3108",
"license": "mit",
"hash": -6900082254492529000,
"line_mean": 29.4411764706,
"line_max": 239,
"alpha_frac": 0.6204896907,
"autogenerated": false,
"ratio": 3.4412416851441243,
"config_... |
# -*- coding: utf-8 -*-
import sys
import json
import facebook
import urllib2
from Stange_Login import login
try:
ACCESS_TOKEN = 'CAACEdEose0cBAA5FCCSLfGZClI0hiw86JMzZBNDq0rLCt6jU05ELgXOLToNHmJQLslYvZCVa2KdqNFQwIjerXkaVvh51i513uZBW2k7b9uz8ZBwcLdcdV0u4QsiiMyfvqpDNUUZB5pFqznKZArOwUvM2azHCH7tD4TJsLbUS0RTJ2X5TLJMl63... | {
"repo_name": "MelissaChan/Crawler_Facebook",
"path": "JustText/Last_Try.py",
"copies": "1",
"size": "2551",
"license": "mit",
"hash": 6480866740751643000,
"line_mean": 31.253164557,
"line_max": 243,
"alpha_frac": 0.7161366313,
"autogenerated": false,
"ratio": 2.51431391905232,
"config_test": f... |
# # __author__ = MelissaChan
# # -*- coding: utf-8 -*-
# # 16-4-11 下午6:25
#
# import requests
# from lxml import etree
# import jieba
# import csv
# import pandas as pd
# import seaborn as sns
# import matplotlib.pyplot as plt
#
# result = ''
# count = 1
# user_id = 'your weibo user_id'
# cookie = {"Cookie": 'your weib... | {
"repo_name": "MelissaChan/Crawler_Facebook",
"path": "JustText/WeiBo.py",
"copies": "1",
"size": "2730",
"license": "mit",
"hash": 8800072535564963000,
"line_mean": 40.9538461538,
"line_max": 121,
"alpha_frac": 0.6393983859,
"autogenerated": false,
"ratio": 2.8724973656480506,
"config_test": f... |
import MySQLdb
def connect(id,name,gender,region,status,date,inter):
try:
conn = MySQLdb.connect(host='localhost',user='root',passwd=' ',port=3306)
cur = conn.cursor()
# cur.execute('create database if not exists PythonDB')
conn.select_db('Facebook')
# cur.execute('create ... | {
"repo_name": "MelissaChan/Crawler_Facebook",
"path": "Crawler/facebook_mysql.py",
"copies": "1",
"size": "1040",
"license": "mit",
"hash": -1491208682573411300,
"line_mean": 30.3939393939,
"line_max": 84,
"alpha_frac": 0.5781853282,
"autogenerated": false,
"ratio": 3.3419354838709676,
"config_... |
from per_data import Inf
from bs4 import BeautifulSoup
import requests
import re
class perInf(object):
def __init__(self,url):
self.url = url
self.data = Inf()
self.time = '0001.01.01'
self.cookie = {"Cookie":'datr=MJkHV_pYgvXRkVrAX8iWyzDu; js_ver=2292; locale=en_US; p... | {
"repo_name": "MelissaChan/Crawler_Facebook",
"path": "Crawler/parse.py",
"copies": "1",
"size": "3739",
"license": "mit",
"hash": -4703586660826355000,
"line_mean": 33.5544554455,
"line_max": 561,
"alpha_frac": 0.5391255918,
"autogenerated": false,
"ratio": 3.163876651982379,
"config_test": fa... |
import requests
import Queue
import time
from parse import perInf
class FbPerInfCrawler(object):
def __init__(self,root_url):
# self.crawled_queue = crawled_queue()#类
# self.crawling_queue = crawleing_queue()#类
self.crawled_queue = Queue.Queue(0)#类
self.crawling_queue = ... | {
"repo_name": "MelissaChan/Crawler_Facebook",
"path": "Crawler/fb_per_inf_crawer.py",
"copies": "2",
"size": "1571",
"license": "mit",
"hash": 8274042997313663000,
"line_mean": 26.0588235294,
"line_max": 66,
"alpha_frac": 0.535988819,
"autogenerated": false,
"ratio": 2.7786407766990293,
"config... |
import re
def SyllableCounter(word):
word = word.lower()
# exception_add are words that need extra syllables
# exception_del are words that need less syllables
exception_add = ['serious','crucial']
exception_del = ['fortunately','unfortunately']
co_one = ['cool','coach','coat','coal','coun... | {
"repo_name": "IrekRybark/pyiku",
"path": "pyiku/syllable_counter.py",
"copies": "1",
"size": "4140",
"license": "mit",
"hash": 5690371128821662000,
"line_mean": 30.6030534351,
"line_max": 168,
"alpha_frac": 0.5474752356,
"autogenerated": false,
"ratio": 3.1026986506746628,
"config_test": false... |
__author__ = 'mendrugory'
from socket import socket
import time
class Arduino(socket):
HEADER = "h"
FOOTER = "f"
STATUS = "s"
ON = "n"
OFF = "o"
SUCCESS = "S"
ERROR = "F"
WAIT_SECONDS = 1
BUFFER_RECEIVER = 1024
WRONG_HEADER_MESSAGE = "Wrong received header"
WRONG_FOOTER_M... | {
"repo_name": "mendrugory/SmartHome",
"path": "Server/app/device/arduino.py",
"copies": "1",
"size": "3119",
"license": "apache-2.0",
"hash": -4444685763503937000,
"line_mean": 27.8796296296,
"line_max": 83,
"alpha_frac": 0.5783905098,
"autogenerated": false,
"ratio": 3.860148514851485,
"config... |
__author__ = 'mendrugory'
import mongoengine
class Tweet(mongoengine.Document):
created_at = mongoengine.StringField(max_length=200)
tweet_id = mongoengine.IntField(default=-1)
tweet_text = mongoengine.StringField(max_length=500)
source = mongoengine.StringField(max_length=200)
retweet_count = mo... | {
"repo_name": "mendrugory/tweetsanalyzer",
"path": "wsgi/tweetsanalyzer/twitter_processing/models.py",
"copies": "1",
"size": "1530",
"license": "apache-2.0",
"hash": -1391657397985064200,
"line_mean": 40.3513513514,
"line_max": 63,
"alpha_frac": 0.7431372549,
"autogenerated": false,
"ratio": 3.5... |
__author__ = 'mendrugory'
import sys
import json
import tweepy
import random
import time
import tweetsanalyzer.settings as secret
from tweetsanalyzer.twitter_processing.models import Tweet
from tweetsanalyzer.twitter_processing.tweet_process import SourceProcessor
from tweetsanalyzer.twitter_processing.tweet_process ... | {
"repo_name": "mendrugory/tweetsanalyzer",
"path": "wsgi/tweetsanalyzer/twitter_processing/twitter_communication.py",
"copies": "1",
"size": "4435",
"license": "apache-2.0",
"hash": 2447486297148625400,
"line_mean": 27.9869281046,
"line_max": 92,
"alpha_frac": 0.6372040586,
"autogenerated": false,
... |
__author__ = 'mendrugory'
class TweetProcessor(object):
'''
Base class in order to process a tweet
'''
def __init__(self, model):
self.document = None
self.model = model
def run(self, tweet):
'''
The function which will be launch in the process
'''
... | {
"repo_name": "mendrugory/tweetsanalyzer",
"path": "wsgi/tweetsanalyzer/twitter_processing/tweet_process.py",
"copies": "1",
"size": "3487",
"license": "apache-2.0",
"hash": -1246287793158914800,
"line_mean": 24.6397058824,
"line_max": 86,
"alpha_frac": 0.5546314884,
"autogenerated": false,
"rati... |
__author__ = 'mendrugory'
from app import app
from flask import jsonify
from device.arduino import Arduino, ArduinoRequest
@app.route('/device/<device>/status')
def get_status(device):
arduino = get_ip_from_device(device)
arduino_request = ArduinoRequest()
arduino_request.action = ArduinoRequest.STATUS
... | {
"repo_name": "mendrugory/SmartHome",
"path": "Server/app/views.py",
"copies": "1",
"size": "1152",
"license": "apache-2.0",
"hash": -7507250059489460000,
"line_mean": 24.6,
"line_max": 50,
"alpha_frac": 0.703125,
"autogenerated": false,
"ratio": 3.1561643835616437,
"config_test": false,
"has... |
__author__ = 'mengleisun'
import numpy as np
import pandas as pd
import string
import random as rm
import sys
def time_process(argv):
normal_data = 'data/normal/'+argv[1]
ddos_data = 'data/attack/'+argv[2]
rate = 1
result_out = 'data/preprocess/'+argv[0]+'preprocessed.csv'
data_type = {}
#shoul... | {
"repo_name": "monkeyGoCrazy/cloudComputing",
"path": "app/machinelearning/MixerTime.py",
"copies": "1",
"size": "2778",
"license": "apache-2.0",
"hash": -2136662518653326600,
"line_mean": 49.5090909091,
"line_max": 127,
"alpha_frac": 0.6436285097,
"autogenerated": false,
"ratio": 2.9679487179487... |
__author__ = 'Meng'
import sys
print(sys.platform)
print(2**100)
import matplotlib.pyplot as plt
from collections import Counter
c = Counter([6, 4, 0, 0, 0, 0, 0, 1, 3, 1, 0, 3, 3, 0, 0, 0, 0, 1, 1, 0, 0, 0, 3, 2, 3, 3, 2, 5, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 2, 0, 0, 0, 2, 1, ... | {
"repo_name": "venus2247/PyS",
"path": "LearningPython5.py",
"copies": "1",
"size": "3835",
"license": "mit",
"hash": 3227014784523013600,
"line_mean": 20.0769230769,
"line_max": 313,
"alpha_frac": 0.6046936115,
"autogenerated": false,
"ratio": 2.2652096869462492,
"config_test": false,
"has_n... |
__author__ = 'mengpeng'
import eventlet
import ast
import urllib
import socket
from eventlet.green import urllib2
from pycrawler.exception import ScraperException
def parseurl(url):
data = None
if '<args>' in url:
parts = url.split('<args>')
if len(parts) != 2:
raise ScraperExcepti... | {
"repo_name": "ymero/PyCrawler",
"path": "pycrawler/scraper.py",
"copies": "1",
"size": "3151",
"license": "mit",
"hash": 3116737339824783000,
"line_mean": 26.649122807,
"line_max": 83,
"alpha_frac": 0.5791812123,
"autogenerated": false,
"ratio": 3.998730964467005,
"config_test": false,
"has_... |
__author__ = 'mengpeng'
import logging
from unittest import TestCase
from pycrawler.logger import Logger
from pycrawler.logger import LoggingConfig
class TestLogger(TestCase):
def test_register(self):
Logger.register('Test')
self.assertIn('Test-logger', LoggingConfig['loggers'])
self.asser... | {
"repo_name": "ymero/PyCrawler",
"path": "test/test_logger.py",
"copies": "1",
"size": "1248",
"license": "mit",
"hash": 4994986774725919000,
"line_mean": 28.0465116279,
"line_max": 68,
"alpha_frac": 0.6217948718,
"autogenerated": false,
"ratio": 4.230508474576271,
"config_test": true,
"has_n... |
__author__ = 'mengpeng'
import os
from bs4 import BeautifulSoup
from pycrawler.exception import HandlerException
from pycrawler.utils.tools import gethash
class Handler(object):
Dict = {}
def __init__(self, spider):
pass
@staticmethod
def register(cls):
if isinstance(cls, type):
... | {
"repo_name": "ymero/PyCrawler",
"path": "pycrawler/handler.py",
"copies": "1",
"size": "2883",
"license": "mit",
"hash": 4815046356038653000,
"line_mean": 27,
"line_max": 75,
"alpha_frac": 0.5716267777,
"autogenerated": false,
"ratio": 4.0835694050991505,
"config_test": false,
"has_no_keywor... |
__author__ = 'mengpeng'
import os
import logging
import logging.config
from pycrawler.utils.tools import datestamp
LoggingConfig = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'default': {
'format': '%(asctime)s [%(levelname)s] %(message)s',
'datefmt': ... | {
"repo_name": "ymero/PyCrawler",
"path": "pycrawler/logger.py",
"copies": "1",
"size": "2754",
"license": "mit",
"hash": 2969992458949251000,
"line_mean": 34.3205128205,
"line_max": 116,
"alpha_frac": 0.5072621641,
"autogenerated": false,
"ratio": 4.529605263157895,
"config_test": true,
"has_... |
__author__ = 'mengpeng'
import re
from pybloom import ScalableBloomFilter
from pycrawler.exception import FrontierException
from pycrawler.utils.redisugar import RediSugar
from redis.exceptions import ResponseError
class Frontier(object):
Dict = {}
def __init__(self, spider):
pass
@staticmethod
... | {
"repo_name": "ymero/PyCrawler",
"path": "pycrawler/frontier.py",
"copies": "1",
"size": "4925",
"license": "mit",
"hash": -3058828535118484500,
"line_mean": 27.6395348837,
"line_max": 93,
"alpha_frac": 0.5626395939,
"autogenerated": false,
"ratio": 4.097337770382696,
"config_test": false,
"h... |
__author__ = 'mengpeng'
import smtplib
from exception import NotifierException
class Notifier(object):
Dict = {}
def __init__(self, spider):
pass
@staticmethod
def register(cls):
if isinstance(cls, type):
Notifier.Dict[cls.__name__] = cls
return cls
el... | {
"repo_name": "ymero/PyCrawler",
"path": "pycrawler/notifier.py",
"copies": "1",
"size": "2144",
"license": "mit",
"hash": 3644234539286984000,
"line_mean": 30.0869565217,
"line_max": 106,
"alpha_frac": 0.5545708955,
"autogenerated": false,
"ratio": 4.212180746561886,
"config_test": false,
"h... |
__author__ = 'mengpeng'
import socket
from threading import Thread
class Server(Thread):
def __init__(self, host, port, newthread=False, callback=None):
super(Server, self).__init__()
self.host = host
self.port = port
self.newthread = newthread
self.callback = callback
... | {
"repo_name": "ymero/PyCrawler",
"path": "pycrawler/utils/tcpecho.py",
"copies": "1",
"size": "2011",
"license": "mit",
"hash": -7628187311987153000,
"line_mean": 24.15,
"line_max": 67,
"alpha_frac": 0.4868224764,
"autogenerated": false,
"ratio": 4.278723404255319,
"config_test": false,
"has_... |
__author__ = 'mengpeng'
import sys
import re
import time
import math
import urllib
from unidecode import unidecode
from pycrawler.handler import Handler
from pycrawler.scraper import DefaultScraper
from pycrawler.utils.tools import gethash
from pycrawler.spider import Driver
from mongojuice.document import Document
SE... | {
"repo_name": "ymero/PyCrawler",
"path": "WSJCrawler.py",
"copies": "1",
"size": "9210",
"license": "mit",
"hash": 4903303817317620000,
"line_mean": 32.8639705882,
"line_max": 85,
"alpha_frac": 0.5219326819,
"autogenerated": false,
"ratio": 3.65911799761621,
"config_test": false,
"has_no_keyw... |
"""ResNet model.
Related papers:
https://arxiv.org/pdf/1603.05027v2.pdf
https://arxiv.org/pdf/1512.03385v1.pdf
https://arxiv.org/pdf/1605.07146v1.pdf
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
import tensorflow as tf
from resnet... | {
"repo_name": "renmengye/resnet",
"path": "resnet/models/resnet_model.py",
"copies": "1",
"size": "11631",
"license": "mit",
"hash": -3404198158774645000,
"line_mean": 30.3530997305,
"line_max": 84,
"alpha_frac": 0.5784541312,
"autogenerated": false,
"ratio": 3.4585191793041927,
"config_test": ... |
__author__ = 'me'
import cv2
import math
import numpy as np
import sys
def find_edges(img):
image = img.copy()
grey = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
grey = cv2.bilateralFilter(grey, 11, 17, 17)
dst = cv2.Canny(grey, 50, 200)
return dst
def find_circles(img):
img = cv2.cvtColor(img,... | {
"repo_name": "cephasquid/starrysky",
"path": "findbits.py",
"copies": "1",
"size": "2990",
"license": "mit",
"hash": 5759849660374280000,
"line_mean": 29.824742268,
"line_max": 110,
"alpha_frac": 0.5953177258,
"autogenerated": false,
"ratio": 2.7481617647058822,
"config_test": false,
"has_no... |
__author__ = 'me'
'''
Created on Jun 5, 2012
@author: Mika'il Khan
'''
REQD_SEQUENCE_LENGTH = 10
VOWEL_LIMIT = 2
VOWELS = [(0, 0), (4, 0), (3, -1), (4, -2)]
def build_keypad():
"""Generates 2-D mesh representation of keypad."""
keypad = [(x, y) for x in range(5) for y in range(-3, 1)]
# adjust topology
... | {
"repo_name": "cokleisli/getco",
"path": "com/ts/getco/knighttoursequence.py",
"copies": "1",
"size": "2262",
"license": "mit",
"hash": -4739002334892310000,
"line_mean": 26.2530120482,
"line_max": 84,
"alpha_frac": 0.532714412,
"autogenerated": false,
"ratio": 3.181434599156118,
"config_test":... |
__author__ = 'me'
import cv2
import math
import random
import numpy as np
def create_star_background(image,density):
h,w = image.shape[:2]
base_color = 20
for i in range(0,h,4):
for j in range(0,w,4):
rand = random.random()
if rand < density:
intensity = np.... | {
"repo_name": "cephasquid/starrysky",
"path": "starrysky.py",
"copies": "1",
"size": "1118",
"license": "mit",
"hash": 8184535091031068000,
"line_mean": 27.6666666667,
"line_max": 71,
"alpha_frac": 0.5751341682,
"autogenerated": false,
"ratio": 3.088397790055249,
"config_test": false,
"has_no... |
__author__ = 'merne'
import yaml
import re
versionRe = re.compile(r'^[vV]\d+_.+')
sharedRe = re.compile(r'^shared_.+')
class migrationTemplateGenerator:
def __init__(self, oldVersionFile, newVersionFile):
self.oldVersionFile = oldVersionFile
self.newVersionFile = newVersionFile
with ope... | {
"repo_name": "michaelerne/heat-migration-template-generator",
"path": "migrationTemplateGenerator.py",
"copies": "1",
"size": "3811",
"license": "apache-2.0",
"hash": 7388726225530032000,
"line_mean": 32.1391304348,
"line_max": 98,
"alpha_frac": 0.5636315928,
"autogenerated": false,
"ratio": 4.5... |
__author__ = 'mertergun'
# depricated way of getting context
def get_user_id(line):
return line.split('\t')[0]
def get_item_id(line):
return line.split('\t')[1]
def context_timestamp(line):
return line.split('\t')[2]
def context_latitude(line):
return float(line.split('\t')[3])
def context_longi... | {
"repo_name": "rubattino/apprecsys",
"path": "script/context.py",
"copies": "1",
"size": "24765",
"license": "bsd-2-clause",
"hash": -3867998625946708000,
"line_mean": 40.3455759599,
"line_max": 139,
"alpha_frac": 0.5214213608,
"autogenerated": false,
"ratio": 3.5959053288804994,
"config_test":... |
__author__ = 'mertergun'
from math import radians, cos, sin, asin, sqrt
from collections import namedtuple
import datetime
EventRow = namedtuple("event", ["userId", "itemId","ts","city","lat","lon"])
TrainRow = namedtuple("train", ["itemId", "context"])
ContextRow = namedtuple("context", ["ts","city", "lat", "lon", "mo... | {
"repo_name": "rubattino/apprecsys",
"path": "script/utils.py",
"copies": "1",
"size": "4065",
"license": "bsd-2-clause",
"hash": -4180100052359104000,
"line_mean": 41.3541666667,
"line_max": 108,
"alpha_frac": 0.5296432964,
"autogenerated": false,
"ratio": 3.244213886671987,
"config_test": fal... |
__author__ = 'mertsalik'
import os
from urlparse import urlparse
from urllib import urlencode
from requests import get
import requests.exceptions
from StringIO import StringIO
from csv import reader as csv_reader
import logging
from PIL import Image
from falib import get_image_name
import time
import uuid
from shutil i... | {
"repo_name": "mertsalik/flashair-live-sync",
"path": "falib/CommandAPI.py",
"copies": "1",
"size": "11293",
"license": "mit",
"hash": 934539742979423200,
"line_mean": 34.290625,
"line_max": 89,
"alpha_frac": 0.5106703268,
"autogenerated": false,
"ratio": 4.237523452157599,
"config_test": false... |
__author__ = "MetaCarta"
__copyright__ = "Copyright (c) 2006-2008 MetaCarta"
__license__ = "Clear BSD"
__version__ = "$Id: OSM.py 599 2009-04-02 21:35:26Z crschmidt $"
from .format import Format
class OSM(Format):
"""OSM 0.5 writing."""
def encode(self, result):
results = ["""<?xml version="1.0" e... | {
"repo_name": "pusateri/vectorformats",
"path": "vectorformats/formats/osm.py",
"copies": "2",
"size": "3521",
"license": "mit",
"hash": 864859967405985000,
"line_mean": 38.1222222222,
"line_max": 133,
"alpha_frac": 0.5080942914,
"autogenerated": false,
"ratio": 4.40125,
"config_test": false,
... |
__author__ = "metjush"
# An example file for the decision_tree repository, using datasets from scikit-learn
# to demonstrate classification with a single tree, bagged forest and random forest.
# If you just want to see if the package works, run this file.
# Importing all requirements
import numpy as np
from ClassTre... | {
"repo_name": "metjush/decision_tree",
"path": "decision_tree/Examples.py",
"copies": "1",
"size": "1572",
"license": "mit",
"hash": -5495317941642309000,
"line_mean": 26.1034482759,
"line_max": 94,
"alpha_frac": 0.7487277354,
"autogenerated": false,
"ratio": 3.175757575757576,
"config_test": f... |
__author__ = 'metjush'
# Implementation of Classification Random Forest
# ============================================
# This Random Forest is built on the Classification Tree object implemented in ClassTree.py
#
# It uses bootstrap aggregating and feature subsetting to grow the forest
#
# The primary parameters to in... | {
"repo_name": "metjush/decision_tree",
"path": "decision_tree/ClassForest.py",
"copies": "1",
"size": "5230",
"license": "mit",
"hash": -7194516978327761000,
"line_mean": 40.1811023622,
"line_max": 118,
"alpha_frac": 0.6001912046,
"autogenerated": false,
"ratio": 3.859778597785978,
"config_test... |
__author__ = 'metjush'
# Node Class is the basic building block of the Classification Tree
# it implements decision rules and final assignment to classes
import numpy as np
class Node:
# the object is initialized by telling the node along which feature it is splitting
# what the split threshold is, what th... | {
"repo_name": "metjush/decision_tree",
"path": "decision_tree/TreeNode.py",
"copies": "1",
"size": "2896",
"license": "mit",
"hash": -7655197797424881000,
"line_mean": 39.7887323944,
"line_max": 186,
"alpha_frac": 0.6201657459,
"autogenerated": false,
"ratio": 4.328849028400598,
"config_test": ... |
__author__ = "metjush"
# This is an implementation of a simple vanilla feed-forward neural network for supervised learning.
# It is limited to one hidden layer.
# The layers can be activated with Softmax (ReLU), hyperbolic tangent or sigmoid activation functions.
# The outcome can be either a classification or a regre... | {
"repo_name": "metjush/simple_neural_net",
"path": "VanillaNet.py",
"copies": "1",
"size": "16296",
"license": "mit",
"hash": -7649771605764704000,
"line_mean": 36.4620689655,
"line_max": 138,
"alpha_frac": 0.5460235641,
"autogenerated": false,
"ratio": 3.96399902700073,
"config_test": true,
... |
__author__ = 'mFoxRU'
from PyQt4 import QtCore, QtGui, uic
import pyqtgraph as pg
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
from wavelets import wavelets_dic
class GuiApp(QtGui.QMainWindow):
spin_slide_factor = 10
def __init__(self):
# Init
super(GuiApp, se... | {
"repo_name": "mFoxRU/cwaveplay",
"path": "cwp/gui.py",
"copies": "1",
"size": "4119",
"license": "mit",
"hash": 2196215520538664400,
"line_mean": 32.4959349593,
"line_max": 77,
"alpha_frac": 0.5909201262,
"autogenerated": false,
"ratio": 3.751366120218579,
"config_test": false,
"has_no_keywo... |
__author__ = 'mFoxRU'
from time import sleep
from win32gui import (FindWindow, EnumChildWindows, GetClassName,
GetWindowText, IsWindow)
class Hook(object):
def __init__(
self,
window='MediaPlayerClassicW',
class_name='#32770',
fields=('Title... | {
"repo_name": "mFoxRU/mpc-hc-trackinfo",
"path": "mpchctrackinfo/hook.py",
"copies": "1",
"size": "2106",
"license": "mit",
"hash": -1970214993314526200,
"line_mean": 30.9090909091,
"line_max": 80,
"alpha_frac": 0.5341880342,
"autogenerated": false,
"ratio": 3.973584905660377,
"config_test": fa... |
__author__ = 'mFoxRU'
import abc
class AbstractWavelet(object):
__metaclass__ = abc.ABCMeta
name = "This is my name"
params = {
'q': { # Parameter Variable Name
'min': 0, # Minimal Variable Value (int/float)
'max': 100, # Maximal Variable Value (int/float)
... | {
"repo_name": "mFoxRU/cwaveplay",
"path": "cwp/wavelets/abstractwavelet.py",
"copies": "1",
"size": "1220",
"license": "mit",
"hash": -944055584752563700,
"line_mean": 25.5434782609,
"line_max": 79,
"alpha_frac": 0.5262295082,
"autogenerated": false,
"ratio": 3.8125,
"config_test": false,
"ha... |
__author__ = "mfreer"
__date__ = "2011-05-27 14:27"
__version__ = "59"
__all__ = ["VelocityTasLongitudinalCnrm"]
import egads.core.egads_core as egads_core
import egads.core.metadata as egads_metadata
from numpy import sqrt, tan
class VelocityTasLongitudinalCnrm(egads_core.EgadsAlgorithm):
"""
FILE ... | {
"repo_name": "eufarn7sp/egads-eufar",
"path": "egads/algorithms/thermodynamics/velocity_tas_longitudinal_cnrm.py",
"copies": "2",
"size": "3344",
"license": "bsd-3-clause",
"hash": 1670281469983378000,
"line_mean": 47.4637681159,
"line_max": 148,
"alpha_frac": 0.4237440191,
"autogenerated": false,... |
__author__ = "mfreer"
__date__ = "2011-09-15 17:09"
__version__ = "1.6"
__all__ = ["FileCore", "get_file_list"]
import glob
import logging
class FileCore(object):
"""
Abstract class which holds basic file access methods and attributes.
Designed to be subclassed by NetCDF, NASA Ames and basic text file
... | {
"repo_name": "eufarn7sp/egads-eufar",
"path": "egads/input/input_core.py",
"copies": "2",
"size": "3537",
"license": "bsd-3-clause",
"hash": -2615927682689318400,
"line_mean": 31.75,
"line_max": 118,
"alpha_frac": 0.5606446141,
"autogenerated": false,
"ratio": 3.983108108108108,
"config_test":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.