text stringlengths 0 1.05M | meta dict |
|---|---|
"""
Script to find the regions of a membrane
"""
import argparse
import numpy as np
from sgenlib import parsing
def _find_intersect(dens1, dens2, z):
for d1, d2, z in zip(dens1, dens2, z):
if d1 < d2 :
return z
return z[-1]
if __name__ == '__main__' :
parser = argparse.ArgumentPa... | {
"repo_name": "SGenheden/Scripts",
"path": "Membrane/find_regions.py",
"copies": "1",
"size": "2019",
"license": "mit",
"hash": 4127026679865715700,
"line_mean": 37.8269230769,
"line_max": 96,
"alpha_frac": 0.6215948489,
"autogenerated": false,
"ratio": 2.750681198910082,
"config_test": false,
... |
"""
Strip water and displace bilayer
"""
import argparse
import numpy as np
from sgenlib import pdb
def _calc_dimensions(struct, sel, verbose) :
sorti = np.argsort(struct.xyz[sel, 2])
midi = int(0.5 * len(sel))
low_len = np.floor(struct.xyz[sel, 2][sorti[:midi]].mean())
upp_len = np.ceil(struct.bo... | {
"repo_name": "SGenheden/Scripts",
"path": "Membrane/make_clean_bilayer.py",
"copies": "1",
"size": "2730",
"license": "mit",
"hash": 4087815220199106600,
"line_mean": 33.5569620253,
"line_max": 99,
"alpha_frac": 0.5901098901,
"autogenerated": false,
"ratio": 3.1164383561643834,
"config_test": ... |
"""
This module contain classes and routines
to analyse GPCR simulations
"""
import os
import sys
import struct
from ConfigParser import SafeConfigParser
import numpy as np
from scipy.spatial.distance import cdist
from scipy.ndimage.measurements import center_of_mass
import MDAnalysis.lib.distances as distances
from... | {
"repo_name": "SGenheden/Scripts",
"path": "Projects/Gpcr/gpcr_lib.py",
"copies": "1",
"size": "40605",
"license": "mit",
"hash": -5287064890405865000,
"line_mean": 32.5024752475,
"line_max": 142,
"alpha_frac": 0.6448466938,
"autogenerated": false,
"ratio": 3.1367323290845888,
"config_test": fa... |
"""
Program to analyze hydrogen bonds
"""
import argparse
import cPickle
#import recsql
import numpy as np
"""
Head: O13, O14, O2-O6
Backbone: O22, O32, OF, O2F, O4S, O1S, NF
Sterol: OH2
Ergosterol: O3
"""
class Counts(object):
def __init__(self, kind):
self.heads = 0
self.backbones = 0
s... | {
"repo_name": "SGenheden/Scripts",
"path": "Projects/Yeast/anal_hbonds.py",
"copies": "1",
"size": "3295",
"license": "mit",
"hash": -174528035716622530,
"line_mean": 29.2293577982,
"line_max": 101,
"alpha_frac": 0.537784522,
"autogenerated": false,
"ratio": 3.1591562799616493,
"config_test": f... |
"""
Program to analyze hydrogen bonds
"""
import argparse
import cPickle
#import recsql
import numpy as np
"""
Head: O13, O14, O2-O6
Backbone: O22, O32, OF, O2F, O4S, O1S, NF
Sterol: OH2
Ergosterol: O3
"""
class Counts(object):
def __init__(self, kind):
self.heads = 0
self.backbones = 0
... | {
"repo_name": "SGenheden/Scripts",
"path": "Projects/Yeast/anal_hbonds_hac.py",
"copies": "1",
"size": "4178",
"license": "mit",
"hash": -4757217806449784000,
"line_mean": 31.3875968992,
"line_max": 101,
"alpha_frac": 0.5416467209,
"autogenerated": false,
"ratio": 3.0608058608058606,
"config_te... |
"""
Program to extend the structure of a lipid such that
the acyl chains are longer. Assumes Slipid/Charmm names
Adds the new atoms to idealized coordinates, assuming sp3 hybridization
Uses in membrane engineering project
Examples
--------
extend_chain.py -f mem.gro -a 20 -r DOPC DOPC DOPC -n 16 8 4 -w AOPC BOPC LOP... | {
"repo_name": "SGenheden/Scripts",
"path": "Membrane/extend_chain.py",
"copies": "1",
"size": "6572",
"license": "mit",
"hash": 4513960617909817300,
"line_mean": 35.9213483146,
"line_max": 107,
"alpha_frac": 0.6136640292,
"autogenerated": false,
"ratio": 3.3242286292362166,
"config_test": false... |
"""
Program to replace double bond in acyl chain with single bond
Uses in membrane engineering project
saturate_chain.py -f extended.gro -r AOPC BOPC LOPC
replaces the unsaturated sn-1 chain in AOPC BOPC and LOPC with saturated chains
"""
import argparse
import numpy as np
from sgenlib import geo
from sgenlib ... | {
"repo_name": "SGenheden/Scripts",
"path": "Membrane/saturate_chain.py",
"copies": "1",
"size": "2646",
"license": "mit",
"hash": -2806836860283149000,
"line_mean": 38.4925373134,
"line_max": 109,
"alpha_frac": 0.619425548,
"autogenerated": false,
"ratio": 2.97972972972973,
"config_test": false... |
"""
Routines for binning data, histogramming and such
"""
import numpy as np
def make_bins(data,nbins,boundaries=None) :
"""
Make bin edges for histogramming
Parameters
----------
data : numpy array
the data to be histogrammed
nbins : int
the number of bins to create
bound... | {
"repo_name": "SGenheden/Scripts",
"path": "sgenlib/binning.py",
"copies": "1",
"size": "2626",
"license": "mit",
"hash": 2730276403692847000,
"line_mean": 25.26,
"line_max": 89,
"alpha_frac": 0.6180502666,
"autogenerated": false,
"ratio": 3.978787878787879,
"config_test": false,
"has_no_keyw... |
"""
Script to calculate lifetime of specific contacts from state files
"""
import os
import sys
import argparse
import numpy as np
import pycontacts
import gpcr_lib
def _make_groups(sites, nmol, mol):
# Load the protein template to obtain residue information
template = gpcr_lib.load_template(mol)
residu... | {
"repo_name": "SGenheden/Scripts",
"path": "Projects/Gpcr/gpcr_anal_reslistcontacts.py",
"copies": "1",
"size": "3651",
"license": "mit",
"hash": 2191448767766414300,
"line_mean": 34.7941176471,
"line_max": 142,
"alpha_frac": 0.6370857299,
"autogenerated": false,
"ratio": 3.3221110100090994,
"c... |
"""
Script to calculate the release free energy. The WRelease function is taken
from the offical APR code in september 2017.
"""
import sys
import numpy as np
def WRelease(kr,r0,kt,t0,kb,b0,T):
"""
Do the analytical "release" of guest to standard concentration
"""
### SETUP
# Example: print WR... | {
"repo_name": "SGenheden/Scripts",
"path": "Projects/Apr/calc_release.py",
"copies": "1",
"size": "2356",
"license": "mit",
"hash": 1380031775196958000,
"line_mean": 37.6229508197,
"line_max": 79,
"alpha_frac": 0.5721561969,
"autogenerated": false,
"ratio": 2.552546045503792,
"config_test": fal... |
"""
Script to count hydrogen bonds
"""
import argparse
import MDAnalysis
from MDAnalysis.analysis import hbonds
class HydrogenBondAnalysis_lipids(hbonds.HydrogenBondAnalysis):
DEFAULT_DONORS = {
'CHARMM27': tuple(set([
'O2F', 'O4S', 'O1S', 'O2', 'O3', 'O4', 'O5', 'O6', 'NF', 'OH2']))}
DEF... | {
"repo_name": "SGenheden/Scripts",
"path": "Projects/Yeast/md_mem_hbonds.py",
"copies": "1",
"size": "1305",
"license": "mit",
"hash": -2046963110927489500,
"line_mean": 36.2857142857,
"line_max": 112,
"alpha_frac": 0.6329501916,
"autogenerated": false,
"ratio": 2.9794520547945207,
"config_test... |
"""
This is a program to analyse error of order parameters and populate a spreadsheet
"""
import argparse
import os
from collections import namedtuple
import numpy as np
import croc
import sheetslib
OrderParam = namedtuple("OrderParam",["resname","resid","value"])
def _average_group(paramlist, residues, hasexp) :
... | {
"repo_name": "SGenheden/Scripts",
"path": "Projects/Orderparam/analyse_errors.py",
"copies": "1",
"size": "3388",
"license": "mit",
"hash": 1239470159260120600,
"line_mean": 36.6444444444,
"line_max": 108,
"alpha_frac": 0.6012396694,
"autogenerated": false,
"ratio": 3.193213949104618,
"config_... |
"""
This script uses the encore library
"""
import copy
import argparse
import numpy as np
import MDAnalysis as md
import encore
from encore.similarity import harmonic_ensemble_similarity, bootstrap_coordinates
class MyEnsemble(encore.Ensemble) :
def get_coordinates(self, subset_selection_string=None, firsthalf=... | {
"repo_name": "SGenheden/Scripts",
"path": "Projects/Orderparam/calc_heshalf.py",
"copies": "1",
"size": "2936",
"license": "mit",
"hash": -7909806688936527000,
"line_mean": 37.6315789474,
"line_max": 126,
"alpha_frac": 0.6488419619,
"autogenerated": false,
"ratio": 3.764102564102564,
"config_t... |
"""
This script uses the prody library
"""
import argparse
from prody import *
def _calc_proj(trajectory, modes, filename, v1, v2):
projection = calcProjection(trajectory, modes)
with open(filename, "w") as f :
f.write("#%.3f %.3f\n"%(v1,v2))
for snap in projection :
f.write("%.3... | {
"repo_name": "SGenheden/Scripts",
"path": "Projects/Orderparam/calc_pcaproj.py",
"copies": "1",
"size": "1384",
"license": "mit",
"hash": -4292938857335513600,
"line_mean": 29.0869565217,
"line_max": 100,
"alpha_frac": 0.6524566474,
"autogenerated": false,
"ratio": 3.1743119266055047,
"config_... |
__author__ = "Samuel Jackson"
__date__ = "December 2, 2014"
__license__ = "MIT"
import json
import requests
import re
from constants import *
class RequestHandler(object):
""" Handles retrieving resources from the specified end-points."""
def __init__(self):
headers={
"content-type": "app... | {
"repo_name": "samueljackson92/CSAlumni-client",
"path": "csa_client/request_handler.py",
"copies": "1",
"size": "2296",
"license": "mit",
"hash": 1964432375103752700,
"line_mean": 33.7878787879,
"line_max": 80,
"alpha_frac": 0.6040940767,
"autogenerated": false,
"ratio": 4.291588785046729,
"co... |
__author__ = "Samuel Jackson"
__date__ = "December 2, 2014"
__license__ = "MIT"
import requests
import json
from constants import *
from request_handler import RequestHandler
class OAuth2ResourceOwner(RequestHandler):
""" Handles retrieving resources from the specified end-points.
This extension adds functi... | {
"repo_name": "samueljackson92/CSAlumni-client",
"path": "csa_client/oauth.py",
"copies": "1",
"size": "4438",
"license": "mit",
"hash": 440052744298728060,
"line_mean": 35.6776859504,
"line_max": 88,
"alpha_frac": 0.6518702118,
"autogenerated": false,
"ratio": 4.482828282828283,
"config_test":... |
__author__ = "Samuel Jackson"
__date__ = "November 26, 2014"
__license__ = "MIT"
from oauth import OAuth2ResourceOwner
from token_cache import TokenCache
from constants import *
class CsaAPI(object):
""" Access the REST resources on the CSA application.
:param username: CSA application username
:param pa... | {
"repo_name": "samueljackson92/CSAlumni-client",
"path": "csa_client/api.py",
"copies": "1",
"size": "4371",
"license": "mit",
"hash": -4005605352373065000,
"line_mean": 33.4173228346,
"line_max": 83,
"alpha_frac": 0.5220773278,
"autogenerated": false,
"ratio": 4.520165460186143,
"config_test":... |
__author__ = "Samuel Jackson"
__date__ = "November 26, 2014"
__license__ = "MIT"
import os
import json
import responses
from csa_client.request_handler import RequestHandler
from csa_client.api import CsaAPI
from csa_client import constants
FIXTURES_FOLDER = "fixtures"
def load_fixture(file_name):
"""Load a tex... | {
"repo_name": "samueljackson92/CSAlumni-client",
"path": "tests/test_helpers.py",
"copies": "1",
"size": "1740",
"license": "mit",
"hash": 1965878071667885800,
"line_mean": 31.2222222222,
"line_max": 80,
"alpha_frac": 0.5873563218,
"autogenerated": false,
"ratio": 3.782608695652174,
"config_tes... |
__author__ = "Samuel Jackson"
__date__ = "November 26, 2014"
__license__ = "MIT"
import os
# protocal used by the api
PROTOCOL = 'https://'
# domain of the endpoints
DOMAIN = 'localhost'
# port of the endpoints
PORT = '3001'
# Content type that the application communicates in
CONTENT_TYPE = 'json'
# Whether to verify... | {
"repo_name": "samueljackson92/CSAlumni-client",
"path": "csa_client/constants.py",
"copies": "1",
"size": "1048",
"license": "mit",
"hash": -8120330302868795000,
"line_mean": 23.9523809524,
"line_max": 72,
"alpha_frac": 0.643129771,
"autogenerated": false,
"ratio": 3.1566265060240966,
"config_... |
__author__ = 'Samuel Marks <samuelmarks@gmail.com>'
__maintainer__ = "Marshall Humble <humblejm@gmail.com>"
__version__ = '0.2.0'
from urllib.parse import urlparse
from socketserver import ThreadingTCPServer
from http.server import SimpleHTTPRequestHandler
from webbrowser import open_new_tab
from json import dumps
... | {
"repo_name": "marshallhumble/python-linkedin",
"path": "examples/http_api.py",
"copies": "1",
"size": "2791",
"license": "mit",
"hash": -2435406615864365000,
"line_mean": 35.7236842105,
"line_max": 128,
"alpha_frac": 0.6485130777,
"autogenerated": false,
"ratio": 3.691798941798942,
"config_tes... |
__author__ = 'Samuel Marks <samuelmarks@gmail.com>'
__maintainer__ = "Marshall Humble <humblejm@gmail.com>"
__version__ = '0.2.0'
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
from socketserver import ThreadingTCPServer
from http.server import SimpleHTTPRequestHandle... | {
"repo_name": "DEKHTIARJonathan/python3-linkedin",
"path": "examples/http_api.py",
"copies": "1",
"size": "4068",
"license": "mit",
"hash": 7811520356850902000,
"line_mean": 31.8064516129,
"line_max": 79,
"alpha_frac": 0.5747295969,
"autogenerated": false,
"ratio": 4.019762845849803,
"config_te... |
__author__ = 'Samuel Marks <samuelmarks@gmail.com>'
__version__ = '0.1.0'
from SocketServer import ThreadingTCPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
from webbrowser import open_new_tab
from json import dumps
from urlparse import urlparse
from os import environ
from types import NoneType
from li... | {
"repo_name": "alisterion/python-linkedin",
"path": "examples/http_api.py",
"copies": "1",
"size": "2680",
"license": "mit",
"hash": 4429553215421937700,
"line_mean": 36.2222222222,
"line_max": 110,
"alpha_frac": 0.6537313433,
"autogenerated": false,
"ratio": 3.7960339943342776,
"config_test": ... |
__author__ = 'Samuel Marks <samuelmarks@gmail.com>'
__version__ = '0.1.0'
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
from socketserver import ThreadingTCPServer
from http.server import SimpleHTTPRequestHandler
from webbrowser import open_new_tab
from json import ... | {
"repo_name": "Reachpodofficial/python-linkedin",
"path": "examples/http_api.py",
"copies": "7",
"size": "2800",
"license": "mit",
"hash": 422964525734663550,
"line_mean": 35.3636363636,
"line_max": 131,
"alpha_frac": 0.6514285714,
"autogenerated": false,
"ratio": 3.7583892617449663,
"config_te... |
__author__ = 'Samuel'
def check(value):
if value % 1 != 0:
return False;
if value % 2 != 0:
return False;
if value % 3 != 0:
return False;
if value % 4 != 0:
return False;
if value % 5 != 0:
return False;
if value % 6 != 0:
return False;
if va... | {
"repo_name": "kidk/Euler",
"path": "5.py",
"copies": "1",
"size": "1034",
"license": "bsd-3-clause",
"hash": -7038186338487244000,
"line_mean": 18.9038461538,
"line_max": 23,
"alpha_frac": 0.4700193424,
"autogenerated": false,
"ratio": 3.6666666666666665,
"config_test": false,
"has_no_keywor... |
__author__ = 'samvarankashyap'
"""
The working copy of the application is running at the following urls :
cloudcomputing1-970.appspot.com
cloudcomputing1-970.appspot.com/upload for upload functionality
"""
from bottle import Bottle
from bottle import route, request, response, template, HTTPResponse
import os
import MyS... | {
"repo_name": "samvarankashyap/googlecloudutility3",
"path": "main.py",
"copies": "1",
"size": "15417",
"license": "apache-2.0",
"hash": -2975176870430278700,
"line_mean": 41.2383561644,
"line_max": 360,
"alpha_frac": 0.6180190699,
"autogenerated": false,
"ratio": 3.6207139502113668,
"config_te... |
_author__ = 'samvarankashyap'
import argparse
import httplib2
import os
import sys
import json
import time
import datetime
import io
import hashlib
import pdb
#Google apliclient (Google App Engine specific) libraries.
from apiclient import discovery
from oauth2client import file
from oauth2client import c... | {
"repo_name": "samvarankashyap/googlecloudutility2",
"path": "test/assignment2.py",
"copies": "2",
"size": "5137",
"license": "apache-2.0",
"hash": -3883764792370945000,
"line_mean": 36.3358208955,
"line_max": 142,
"alpha_frac": 0.6959314775,
"autogenerated": false,
"ratio": 3.77443056576047,
"... |
__author__ = "Samvid Mistry"
from abc import abstractmethod
from PySide.QtCore import Signal
from MComponents.MShape import MShape
class MTwoStateShape(MShape):
"""
An abstract class representing any MShape which can have binary state, which is checked and unchecked.
Examples of this can be a checkbox,... | {
"repo_name": "samvidmistry/PyMaterial",
"path": "MComponents/MTwoStateShape.py",
"copies": "2",
"size": "1886",
"license": "mit",
"hash": 6248983156840507000,
"line_mean": 28.9365079365,
"line_max": 106,
"alpha_frac": 0.6500530223,
"autogenerated": false,
"ratio": 4.823529411764706,
"config_te... |
__author__ = "Samvid Mistry"
from enum import IntEnum
from PySide.QtGui import *
from PySide.QtCore import *
from MComponents.MShape import MShape
class MButton(MShape):
def __init__(self):
MShape.__init__(self)
self.__text = QLabel()
self.__text.setText("Button")
self.__text.s... | {
"repo_name": "samvidmistry/PyMaterial",
"path": "MComponents/MButton.py",
"copies": "1",
"size": "5748",
"license": "mit",
"hash": 3073938801153636000,
"line_mean": 31.4745762712,
"line_max": 106,
"alpha_frac": 0.610125261,
"autogenerated": false,
"ratio": 3.7324675324675325,
"config_test": fa... |
__author__ = "Samvid Mistry"
from MComponents.MTwoStateShape import MTwoStateShape
from PySide.QtGui import *
from PySide.QtCore import *
from MComponents.MShape import MShape
from MUtilities import MColors
# TODO: Change according to the new MFade
class CheckboxBorder(MShape):
def __init__(self):
MSha... | {
"repo_name": "samvidmistry/PyMaterial",
"path": "MComponents/MCheckbox.py",
"copies": "1",
"size": "3537",
"license": "mit",
"hash": 8236072867203013000,
"line_mean": 31.75,
"line_max": 89,
"alpha_frac": 0.5911789652,
"autogenerated": false,
"ratio": 3.5835866261398177,
"config_test": false,
... |
__author__ = 'Samvid Mistry'
from PySide.QtCore import *
from PySide.QtGui import *
from MAnimations.MScale import MScale
from MAnimations.MFade import MFade
from MComponents.MShape import MShape
from MUtilities import MColors
from MUtilities.MRipple import MRipple
from MComponents.MRadioButton import MRadioButton
... | {
"repo_name": "samvidmistry/PyMaterial",
"path": "MComponents/MTestComponent.py",
"copies": "2",
"size": "1795",
"license": "mit",
"hash": -490072933402130940,
"line_mean": 31.6363636364,
"line_max": 116,
"alpha_frac": 0.6367688022,
"autogenerated": false,
"ratio": 3.41254752851711,
"config_tes... |
__author__ = 'sanbilp'
from pyNN import *
class NeuralNet(Model):
def init(self, numpy_rng, theano_rng=None, l_rate=None, optimization = "sgd", n_input=400, n_hidden=200, n_output=10, W=None, bhid=None, bvis=None, W_prime = None, input=None, output=None, hidden_activation = "sigmoid", output_activation = "identi... | {
"repo_name": "apsarath/pyNN",
"path": "model/nnet/NeuralNet.py",
"copies": "1",
"size": "3763",
"license": "apache-2.0",
"hash": 3970330015460911600,
"line_mean": 36.2673267327,
"line_max": 299,
"alpha_frac": 0.5819824608,
"autogenerated": false,
"ratio": 3.2807323452484742,
"config_test": fal... |
__author__ = 'sanbilp'
from pyNN import *
'''
Vanilla Elman Recurrent Network.
When sepemb = True, there will be a separate embedding matrix and separate W_in matrix. When sepemb = False, W_in acts as the embedding matrix.
learnh0 = True means the model learn h0 (initial hidden state). Else it is set to zero vector.... | {
"repo_name": "apsarath/pyNN",
"path": "model/recurrent/ElmanNet.py",
"copies": "1",
"size": "5952",
"license": "apache-2.0",
"hash": 4266591491353631000,
"line_mean": 42.1376811594,
"line_max": 161,
"alpha_frac": 0.5601478495,
"autogenerated": false,
"ratio": 2.8642925890279116,
"config_test":... |
__author__ = 'sanbilp'
import codecs
import operator
from nltk.tokenize import WordPunctTokenizer
"""
Given a list of words, this function converts it into a single string which can be written to the file.
"""
def listtostring(alist):
newline = ""
for word in alist:
newline+=word+" "
newline = ne... | {
"repo_name": "apsarath/pyNN",
"path": "dataprocessor/TextProcessor.py",
"copies": "1",
"size": "2002",
"license": "apache-2.0",
"hash": -5696483551389406000,
"line_mean": 24.6666666667,
"line_max": 119,
"alpha_frac": 0.5944055944,
"autogenerated": false,
"ratio": 3.575,
"config_test": false,
... |
__author__ = 'sanbilp'
import codecs
from TextProcessor import listtostring
"""
Given a file with sequence of words and inverse vocabulary,
this function converts words to ids.
"""
def converter(src, tgt, ivc, srt, end):
file = open(tgt,"w")
tfile = codecs.open(src,"r","utf-8")
for line in tfile:
... | {
"repo_name": "apsarath/pyNN",
"path": "dataprocessor/DataConverter.py",
"copies": "1",
"size": "2104",
"license": "apache-2.0",
"hash": -4887900183723471000,
"line_mean": 23.183908046,
"line_max": 113,
"alpha_frac": 0.5403992395,
"autogenerated": false,
"ratio": 3.4491803278688526,
"config_tes... |
__author__ = 'sanbilp'
import numpy
from pyNN.util.NNUtil import create_folder
def GenerateSeqMat(src, folder, batch_size, dtype):
create_folder(folder)
ipfile = open(folder+"ip.txt","w")
file = open(src,"r")
slength = len(file.readline().strip().split())
file.close()
mat = numpy.zeros((ba... | {
"repo_name": "apsarath/pyNN",
"path": "dataprocessor/GenerateSeqMat.py",
"copies": "1",
"size": "1622",
"license": "apache-2.0",
"hash": -6621440643411831000,
"line_mean": 31.44,
"line_max": 84,
"alpha_frac": 0.6134401973,
"autogenerated": false,
"ratio": 3.1992110453648914,
"config_test": fal... |
__author__ = 'sanbilp'
import pickle
from pyNN.optimization.optimization import *
from pyNN.util.Initializer import *
class Model(object):
''' Base class for all Neural Network Models
'''
def init(self, numpy_rng, theano_rng, optimization, l_rate, op_folder):
print "in model"
self.nump... | {
"repo_name": "apsarath/pyNN",
"path": "model/Model.py",
"copies": "1",
"size": "1603",
"license": "apache-2.0",
"hash": 920645675774747900,
"line_mean": 26.6379310345,
"line_max": 75,
"alpha_frac": 0.6250779788,
"autogenerated": false,
"ratio": 3.4106382978723406,
"config_test": false,
"has_... |
__author__ = 'sanbilp'
from pyNN import *
'''
GRU Recurrent Network.
When sepemb = True, there will be a separate embedding matrix and separate W_in matrix. When sepemb = False, W_in acts as the embedding matrix.
learnh0 = True means the model learn h0 (initial hidden state). Else it is set to zero vector.
'''
clas... | {
"repo_name": "apsarath/pyNN",
"path": "model/recurrent/GRUNet.py",
"copies": "1",
"size": "7078",
"license": "apache-2.0",
"hash": -7947688216612669000,
"line_mean": 41.903030303,
"line_max": 158,
"alpha_frac": 0.5638598474,
"autogenerated": false,
"ratio": 2.8098451766574035,
"config_test": f... |
__author__ = 'sanbilp'
from pyNN import *
'''
LSTM Recurrent Network.
When sepemb = True, there will be a separate embedding matrix and separate W_in matrix. When sepemb = False, W_in acts as the embedding matrix.
learnh0 = True means the model learn h0 (initial hidden state). Else it is set to zero vector.
'''
cla... | {
"repo_name": "apsarath/pyNN",
"path": "model/recurrent/LSTMNet.py",
"copies": "1",
"size": "7455",
"license": "apache-2.0",
"hash": 1289060305973483500,
"line_mean": 44.4634146341,
"line_max": 160,
"alpha_frac": 0.5649899396,
"autogenerated": false,
"ratio": 2.803685596088755,
"config_test": f... |
__author__ = 'sandeep'
import os
import re
from setuptools import setup
def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
init_py = open(os.path.join(package, '__init__.py')).read()
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).grou... | {
"repo_name": "Sandeep4/olacabs",
"path": "setup.py",
"copies": "1",
"size": "1863",
"license": "mit",
"hash": -7334854007325310000,
"line_mean": 27.6769230769,
"line_max": 75,
"alpha_frac": 0.5947396672,
"autogenerated": false,
"ratio": 3.7636363636363637,
"config_test": false,
"has_no_keywo... |
__author__ = 'sandeep'
import requests
import ujson as json
from .constants import RR_URL
from .errors import HTTPError
class RoadRunnrClient(object):
def __init__(self, client_id, client_secret, server_url=None, timeout=10):
"""
:param client_id: RoadRunnr client id.
:param client_secret:... | {
"repo_name": "Sandeep4/roadrunnr",
"path": "roadrunnr/client.py",
"copies": "1",
"size": "3174",
"license": "mit",
"hash": -8958832308923169000,
"line_mean": 35.9069767442,
"line_max": 97,
"alpha_frac": 0.6175173283,
"autogenerated": false,
"ratio": 3.5783540022547915,
"config_test": false,
... |
__author__ = 'sandeep'
import signal
import time
import sys
import multiprocessing
import inspect
import traceback
import logging
LOGGER = logging.getLogger(__name__)
class ServiceManager(object):
def __init__(self, worker_cls, num_workers=2):
if not (inspect.isclass(worker_cls) and issubclass(worker_c... | {
"repo_name": "ofpiyush/hedwig-py",
"path": "hedwig/core/service.py",
"copies": "1",
"size": "1899",
"license": "mit",
"hash": 4115716367560023600,
"line_mean": 30.65,
"line_max": 97,
"alpha_frac": 0.5597682991,
"autogenerated": false,
"ratio": 4.521428571428571,
"config_test": false,
"has_no... |
__author__ = 'Sander Marechal'
#### Taken from:
# http://web.archive.org/web/20131017130434/http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
############## Example Use ########################
#
# import sys, time
# from daemon import Daemon
#
# class MyDaemon(Daemon):
# def run(self... | {
"repo_name": "thorwhalen/ut",
"path": "others/deamon_marechal.py",
"copies": "1",
"size": "4675",
"license": "mit",
"hash": -4539409620576777000,
"line_mean": 27.8580246914,
"line_max": 119,
"alpha_frac": 0.4862032086,
"autogenerated": false,
"ratio": 3.8958333333333335,
"config_test": false,
... |
__author__ = 'Sander'
def readFile(filename):
all_lines = []
with open(filename) as f:
all_lines = f.readlines()
out = []
for line in all_lines:
if len(out) >= 6:
break
if line.startswith("#") or line.strip() == '':
continue
elements = line.strip... | {
"repo_name": "karulont/combopt",
"path": "project8/parser.py",
"copies": "1",
"size": "2078",
"license": "mit",
"hash": -2295665897934837500,
"line_mean": 27.4657534247,
"line_max": 90,
"alpha_frac": 0.5024061598,
"autogenerated": false,
"ratio": 3.3408360128617365,
"config_test": false,
"ha... |
from __future__ import division
import numbers
import warnings
import numpy as np
from scipy import sparse
from .. import get_config as _get_config
from ..base import BaseEstimator, TransformerMixin
from ..externals import six
from ..utils import check_array
from ..utils import deprecated
from ..utils.fixes import ... | {
"repo_name": "vortex-ape/scikit-learn",
"path": "sklearn/preprocessing/_encoders.py",
"copies": "2",
"size": "31906",
"license": "bsd-3-clause",
"hash": -717256527334295800,
"line_mean": 37.6739393939,
"line_max": 79,
"alpha_frac": 0.5634990284,
"autogenerated": false,
"ratio": 4.359338707473698... |
import numpy as np
from scipy import sparse
import numbers
from ..base import BaseEstimator, TransformerMixin
from ..utils import check_array, is_scalar_nan
from ..utils.validation import check_is_fitted
from ..utils.validation import _deprecate_positional_args
from ..utils._mask import _get_mask
from ..utils._encod... | {
"repo_name": "anntzer/scikit-learn",
"path": "sklearn/preprocessing/_encoders.py",
"copies": "2",
"size": "34494",
"license": "bsd-3-clause",
"hash": -861278413436618000,
"line_mean": 38.2858769932,
"line_max": 79,
"alpha_frac": 0.5504015307,
"autogenerated": false,
"ratio": 4.3469439193446755,
... |
import numpy as np
from scipy import sparse
from ..base import BaseEstimator, TransformerMixin
from ..utils import check_array
from ..utils.fixes import _argmax
from ..utils.validation import check_is_fitted
from .label import _encode, _encode_check_unknown
__all__ = [
'OneHotEncoder',
'OrdinalEncoder'
]
... | {
"repo_name": "chrsrds/scikit-learn",
"path": "sklearn/preprocessing/_encoders.py",
"copies": "2",
"size": "25284",
"license": "bsd-3-clause",
"hash": 2370569161701880000,
"line_mean": 37.2496217852,
"line_max": 79,
"alpha_frac": 0.5633034055,
"autogenerated": false,
"ratio": 4.293987771739131,
... |
import numpy as np
from scipy import sparse
from ..base import BaseEstimator, TransformerMixin
from ..utils import check_array
from ..utils.validation import check_is_fitted
from ..utils.validation import _deprecate_positional_args
from ..utils._encode import _encode, _check_unknown, _unique
__all__ = [
'OneHo... | {
"repo_name": "bnaul/scikit-learn",
"path": "sklearn/preprocessing/_encoders.py",
"copies": "2",
"size": "27854",
"license": "bsd-3-clause",
"hash": -8290472920303230000,
"line_mean": 36.84375,
"line_max": 79,
"alpha_frac": 0.5584317668,
"autogenerated": false,
"ratio": 4.308275328692962,
"conf... |
import warnings
import numpy as np
from scipy import sparse
import numbers
from ..base import BaseEstimator, TransformerMixin
from ..utils import check_array, is_scalar_nan
from ..utils.validation import check_is_fitted
from ..utils._mask import _get_mask
from ..utils._encode import _encode, _check_unknown, _unique
... | {
"repo_name": "kevin-intel/scikit-learn",
"path": "sklearn/preprocessing/_encoders.py",
"copies": "3",
"size": "35686",
"license": "bsd-3-clause",
"hash": 4102244305285552600,
"line_mean": 38.65,
"line_max": 79,
"alpha_frac": 0.5459997198,
"autogenerated": false,
"ratio": 4.368343738523687,
"co... |
import warnings
import numpy as np
from ..base import BaseEstimator, RegressorMixin, clone
from ..utils.validation import check_is_fitted
from ..utils import check_array, _safe_indexing
from ..preprocessing import FunctionTransformer
from ..exceptions import NotFittedError
__all__ = ['TransformedTargetRegressor']
... | {
"repo_name": "kevin-intel/scikit-learn",
"path": "sklearn/compose/_target.py",
"copies": "2",
"size": "9661",
"license": "bsd-3-clause",
"hash": 4436840979320122000,
"line_mean": 36.1576923077,
"line_max": 79,
"alpha_frac": 0.6096677363,
"autogenerated": false,
"ratio": 4.342022471910112,
"con... |
import warnings
import numpy as np
from ..base import BaseEstimator, RegressorMixin, clone
from ..utils.validation import check_is_fitted
from ..utils import check_array, safe_indexing
from ..preprocessing import FunctionTransformer
__all__ = ['TransformedTargetRegressor']
class TransformedTargetRegressor(BaseEst... | {
"repo_name": "BiaDarkia/scikit-learn",
"path": "sklearn/compose/_target.py",
"copies": "1",
"size": "8766",
"license": "bsd-3-clause",
"hash": -7348104344949637000,
"line_mean": 37.96,
"line_max": 79,
"alpha_frac": 0.6123659594,
"autogenerated": false,
"ratio": 4.324617661568821,
"config_test"... |
import numpy as np
from .fixes import bincount
def compute_class_weight(class_weight, classes, y_ind):
"""Estimate class weights for unbalanced datasets.
Parameters
----------
class_weight : dict, 'auto' or None
If 'auto', class weights will be given inverse proportional
to the freq... | {
"repo_name": "JT5D/scikit-learn",
"path": "sklearn/utils/class_weight.py",
"copies": "8",
"size": "2061",
"license": "bsd-3-clause",
"hash": -631137991615425900,
"line_mean": 35.1578947368,
"line_max": 74,
"alpha_frac": 0.6050460941,
"autogenerated": false,
"ratio": 3.986460348162476,
"config_... |
import numpy as np
def compute_class_weight(class_weight, classes, y):
"""Estimate class weights for unbalanced datasets.
Parameters
----------
class_weight : dict, 'auto' or None
If 'auto', class weights will be given inverse proportional
to the frequency of the class in the data.
... | {
"repo_name": "maxlikely/scikit-learn",
"path": "sklearn/utils/class_weight.py",
"copies": "2",
"size": "2009",
"license": "bsd-3-clause",
"hash": -3664061381625138700,
"line_mean": 36.2037037037,
"line_max": 74,
"alpha_frac": 0.5928322549,
"autogenerated": false,
"ratio": 3.978217821782178,
"c... |
import warnings
import numpy as np
from uplift.preprocessing import LabelEncoder
def compute_class_weight(class_weight, classes, y):
"""Estimate class weights for unbalanced datasets.
Parameters
----------
class_weight : dict, 'balanced' or None
If 'balanced', class weights will be given by
... | {
"repo_name": "psarka/uplift",
"path": "uplift/validation/class_weight.py",
"copies": "1",
"size": "7259",
"license": "bsd-3-clause",
"hash": -4094148922476486000,
"line_mean": 39.5530726257,
"line_max": 78,
"alpha_frac": 0.5700509712,
"autogenerated": false,
"ratio": 4.3003554502369665,
"confi... |
import numpy as np
from ..externals import six
from ..utils.fixes import in1d
from .fixes import bincount
def compute_class_weight(class_weight, classes, y):
"""Estimate class weights for unbalanced datasets.
Parameters
----------
class_weight : dict, 'auto' or None
If 'auto', class weights... | {
"repo_name": "icdishb/scikit-learn",
"path": "sklearn/utils/class_weight.py",
"copies": "20",
"size": "6468",
"license": "bsd-3-clause",
"hash": -1827069941101857800,
"line_mean": 37.9638554217,
"line_max": 78,
"alpha_frac": 0.5800865801,
"autogenerated": false,
"ratio": 4.312,
"config_test": ... |
import numpy as np
from ..externals import six
def compute_class_weight(class_weight, classes, y):
"""Estimate class weights for unbalanced datasets.
Parameters
----------
class_weight : dict, 'balanced' or None
If 'balanced', class weights will be given by
``n_samples / (n_classes *... | {
"repo_name": "nhejazi/scikit-learn",
"path": "sklearn/utils/class_weight.py",
"copies": "42",
"size": "7126",
"license": "bsd-3-clause",
"hash": -1326179295326180400,
"line_mean": 39.0337078652,
"line_max": 78,
"alpha_frac": 0.5756385069,
"autogenerated": false,
"ratio": 4.246722288438617,
"co... |
import numpy as np
from sklearn.externals import six
from .fixes import in1d, bincount
def compute_class_weight(class_weight, classes, y):
"""Estimate class weights for unbalanced datasets.
Parameters
----------
class_weight : dict, 'auto' or None
If 'auto', class weights will be given inver... | {
"repo_name": "danbob123/gplearn",
"path": "gplearn/skutils/class_weight.py",
"copies": "2",
"size": "6454",
"license": "bsd-3-clause",
"hash": -662721095075759400,
"line_mean": 38.3536585366,
"line_max": 78,
"alpha_frac": 0.5804152464,
"autogenerated": false,
"ratio": 4.317056856187291,
"confi... |
import numpy as np
from .validation import _deprecate_positional_args
@_deprecate_positional_args
def compute_class_weight(class_weight, *, classes, y):
"""Estimate class weights for unbalanced datasets.
Parameters
----------
class_weight : dict, 'balanced' or None
If 'balanced', class weig... | {
"repo_name": "anntzer/scikit-learn",
"path": "sklearn/utils/class_weight.py",
"copies": "9",
"size": "7200",
"license": "bsd-3-clause",
"hash": 7493242555076406000,
"line_mean": 38.7790055249,
"line_max": 78,
"alpha_frac": 0.5788888889,
"autogenerated": false,
"ratio": 4.235294117647059,
"conf... |
import numpy as np
def compute_class_weight(class_weight, classes, y):
"""Estimate class weights for unbalanced datasets.
Parameters
----------
class_weight : dict, 'auto' or None
If 'auto', class weights will be given inverse proportional
to the frequency of the class in the data.
... | {
"repo_name": "thilbern/scikit-learn",
"path": "sklearn/utils/class_weight.py",
"copies": "26",
"size": "2233",
"license": "bsd-3-clause",
"hash": -2928937689783732700,
"line_mean": 35.606557377,
"line_max": 78,
"alpha_frac": 0.6108374384,
"autogenerated": false,
"ratio": 4.030685920577618,
"co... |
import numpy as np
def compute_class_weight(class_weight, *, classes, y):
"""Estimate class weights for unbalanced datasets.
Parameters
----------
class_weight : dict, 'balanced' or None
If 'balanced', class weights will be given by
``n_samples / (n_classes * np.bincount(y))``.
... | {
"repo_name": "kevin-intel/scikit-learn",
"path": "sklearn/utils/class_weight.py",
"copies": "3",
"size": "7092",
"license": "bsd-3-clause",
"hash": 7061235938106004000,
"line_mean": 39.0677966102,
"line_max": 78,
"alpha_frac": 0.5751551043,
"autogenerated": false,
"ratio": 4.236559139784946,
"... |
import numpy as np
def compute_class_weight(class_weight, classes, y):
"""Estimate class weights for unbalanced datasets.
Parameters
----------
class_weight : dict, 'balanced' or None
If 'balanced', class weights will be given by
``n_samples / (n_classes * np.bincount(y))``.
... | {
"repo_name": "chrsrds/scikit-learn",
"path": "sklearn/utils/class_weight.py",
"copies": "11",
"size": "7060",
"license": "bsd-3-clause",
"hash": 2895862037844205000,
"line_mean": 38.8870056497,
"line_max": 78,
"alpha_frac": 0.5745042493,
"autogenerated": false,
"ratio": 4.242788461538462,
"con... |
import warnings
import numpy as np
from ..externals import six
from ..utils.fixes import in1d
from .fixes import bincount
def compute_class_weight(class_weight, classes, y):
"""Estimate class weights for unbalanced datasets.
Parameters
----------
class_weight : dict, 'balanced' or None
If '... | {
"repo_name": "lbishal/scikit-learn",
"path": "sklearn/utils/class_weight.py",
"copies": "32",
"size": "7264",
"license": "bsd-3-clause",
"hash": -2425850126474701000,
"line_mean": 38.9120879121,
"line_max": 78,
"alpha_frac": 0.5740638767,
"autogenerated": false,
"ratio": 4.295683027794205,
"co... |
import warnings
import numpy as np
from .fixes import bincount
from ..externals import six
from ..utils.fixes import in1d
def compute_class_weight(class_weight, classes, y):
"""Estimate class weights for unbalanced datasets.
Parameters
----------
class_weight : dict, 'balanced' or None
If ... | {
"repo_name": "DailyActie/Surrogate-Model",
"path": "01-codes/scikit-learn-master/sklearn/utils/class_weight.py",
"copies": "1",
"size": "7412",
"license": "mit",
"hash": 6155366060387732000,
"line_mean": 38.8494623656,
"line_max": 78,
"alpha_frac": 0.5729897464,
"autogenerated": false,
"ratio": ... |
__authors__ = ['Andrew Taylor']
class TextWriter():
font_5x7 = {
" ": (0x00, 0x00, 0x00, 0x00, 0x00),
"\"": (0x00, 0x07, 0x00, 0x07, 0x00), # "
"#": (0x14, 0x7F, 0x14, 0x7F, 0x14), # #
"$": (0x24, 0x2A, 0x7F, 0x2A, 0x12), # $
"%": (0x23, 0x13, 0x08, 0x64, 0x62), # %
"&": ( 0x36, 0x49, 0x55, 0x22, 0x50), # &
"... | {
"repo_name": "joel-wright/DDRPi",
"path": "lib/text.py",
"copies": "1",
"size": "5672",
"license": "mit",
"hash": 753081475562830800,
"line_mean": 35.5935483871,
"line_max": 112,
"alpha_frac": 0.5550070522,
"autogenerated": false,
"ratio": 1.753865182436611,
"config_test": false,
"has_no_key... |
__authors__ = ['Andrew Taylor']
# For the timing features
import pygame
import os
import yaml
import logging
class PluginPlaylistModel(object):
logger = logging.getLogger(__name__)
# Contains a list of plugins that are active
# This could be a playlist for the evening, which
# repeats in a loop - w... | {
"repo_name": "fraz3alpha/DDRPi",
"path": "software/controller/lib/playlist.py",
"copies": "2",
"size": "8238",
"license": "mit",
"hash": 2120510004764720000,
"line_mean": 33.7594936709,
"line_max": 114,
"alpha_frac": 0.5922554018,
"autogenerated": false,
"ratio": 4.188103711235384,
"config_tes... |
__authors__ = ['Andrew Taylor']
from lib.floorcanvas import FloorCanvas
from lib.controllers import ControllerInput
import pygame
import math
import logging
class Menu(object):
logger = logging.getLogger(__name__)
def __init__(self):
self.init_menu()
pass
def init_menu(self):
s... | {
"repo_name": "fraz3alpha/led-disco-dancefloor",
"path": "software/controller/lib/menu.py",
"copies": "2",
"size": "11937",
"license": "mit",
"hash": 6711344884069408000,
"line_mean": 43.5410447761,
"line_max": 136,
"alpha_frac": 0.5655524839,
"autogenerated": false,
"ratio": 4.321868211440985,
... |
__authors__ = ['Andrew Taylor']
from lib.text import TextWriter
import logging
import math
import colorsys
class FloorCanvas(object):
logger = logging.getLogger(__name__)
# The floor canvas is a large array which we can draw on to
# It provides a number of methods that you would expect for
# a can... | {
"repo_name": "fraz3alpha/DDRPi",
"path": "software/controller/lib/floorcanvas.py",
"copies": "2",
"size": "12706",
"license": "mit",
"hash": 5427413876114021000,
"line_mean": 38.8307210031,
"line_max": 103,
"alpha_frac": 0.5167637337,
"autogenerated": false,
"ratio": 3.470636438131658,
"config... |
__authors__ = ['Andrew Taylor']
import logging
import pygame
import random
import time
from datetime import datetime
from DDRPi import DDRPiPlugin
class GavannaPlugin(DDRPiPlugin):
pulse_rate = 2000
pulse_increasing = 1
pulse_last_ratio = 0
def post_invalidate(self):
self.changed = 1
def configure(self, co... | {
"repo_name": "joel-wright/DDRPi",
"path": "plugins/gavanna_plugin.py",
"copies": "1",
"size": "3204",
"license": "mit",
"hash": -2293812079469728800,
"line_mean": 22.2173913043,
"line_max": 98,
"alpha_frac": 0.6588639201,
"autogenerated": false,
"ratio": 2.6501240694789083,
"config_test": fals... |
__authors__ = ['Andrew Taylor']
import random
import time
import pygame
from DDRPi import DDRPiPlugin
class ScrollingTextPlugin(DDRPiPlugin):
start_tick = -1
# ms per pixel of scrolling
scroll_speed = 100
def configure(self, config, image_surface):
"""
This is an example of an end user module - need to ma... | {
"repo_name": "joel-wright/DDRPi",
"path": "plugins/scrolling_text_plugin.py",
"copies": "1",
"size": "2450",
"license": "mit",
"hash": 3835681144421689300,
"line_mean": 23.5,
"line_max": 96,
"alpha_frac": 0.6759183673,
"autogenerated": false,
"ratio": 3.058676654182272,
"config_test": false,
... |
__authors__ = ['Andrew Taylor']
import random
import time
import pygame
# Python comes with some color conversion methods.
import colorsys
# For Math things, what else
import math
from DDRPi import DDRPiPlugin
# Video available here:
# http://www.youtube.com/watch?v=ySJlUu2926A&feature=youtu.be
class BlobsPlugin(DD... | {
"repo_name": "joel-wright/DDRPi",
"path": "plugins/blobs_plugin.py",
"copies": "1",
"size": "3663",
"license": "mit",
"hash": -1484562770322114600,
"line_mean": 26.75,
"line_max": 97,
"alpha_frac": 0.6688506689,
"autogenerated": false,
"ratio": 2.7792109256449167,
"config_test": false,
"has_... |
__authors__ = ['Andrew Taylor']
import random
import time
import pygame
# Python comes with some color conversion methods.
import colorsys
# For Math things, what else
import math
from VisualisationPlugin import VisualisationPlugin
import logging
# Video available here:
# http://www.youtube.com/watch?v=ySJlUu2926A&... | {
"repo_name": "fraz3alpha/led-disco-dancefloor",
"path": "software/controller/visualisation_plugins/speeding_blobs.py",
"copies": "2",
"size": "9470",
"license": "mit",
"hash": 689740518612015200,
"line_mean": 34.6015037594,
"line_max": 124,
"alpha_frac": 0.5281942978,
"autogenerated": false,
"ra... |
__authors__ = ['Andrew Taylor']
class TextWriter():
font_5x7 = {
" ": (0x00, 0x00, 0x00, 0x00, 0x00),
"\"": (0x00, 0x07, 0x00, 0x07, 0x00), # "
"#": (0x14, 0x7F, 0x14, 0x7F, 0x14), # #
"$": (0x24, 0x2A, 0x7F, 0x2A, 0x12), # $
"%": (0x23, 0x13, 0x08, 0x64, 0x62), # %
"&": ( 0x36, 0x4... | {
"repo_name": "fraz3alpha/led-disco-dancefloor",
"path": "software/controller/lib/text.py",
"copies": "2",
"size": "6876",
"license": "mit",
"hash": 3330924510462351400,
"line_mean": 41.1840490798,
"line_max": 108,
"alpha_frac": 0.4918557301,
"autogenerated": false,
"ratio": 2.103395533802386,
... |
__author__ = 'sandrofsousa'
from csv import reader
from math import sin, cos, sqrt, atan2, radians
from igraph import *
import statistics as sts
from tqdm import tqdm
def get_stops_coordinates():
"""
Function to read GTFS file as input and get latitude and longitude from stops using a simple parsing,
out... | {
"repo_name": "sandrofsousa/PTN",
"path": "gtfs_recursive.py",
"copies": "1",
"size": "12723",
"license": "mit",
"hash": -6110948239796615000,
"line_mean": 47.3764258555,
"line_max": 120,
"alpha_frac": 0.5948282638,
"autogenerated": false,
"ratio": 3.744261330194232,
"config_test": false,
"ha... |
__author__ = 'sandrofsousa'
from igraph import *
from random import choice
from tqdm import tqdm
loops = False
def attack_node_targeted(file_input, rho, interactions):
"""
Function to perform deterministic targeted attacks on network based on a node importance (degree).
Removes the target (max degree on ... | {
"repo_name": "sandrofsousa/PTN",
"path": "attacks.py",
"copies": "1",
"size": "12886",
"license": "mit",
"hash": -3166337694752865300,
"line_mean": 45.8581818182,
"line_max": 118,
"alpha_frac": 0.5671271147,
"autogenerated": false,
"ratio": 4.057304785894207,
"config_test": false,
"has_no_ke... |
import sys
import MySQLdb
import datetime
from time import time
from swift.common.utils import cache_from_env, get_logger, \
split_path, config_true_value, register_swift_info
from swift.common.swob import Response, Request
from swift.common.swob import HTTPBadRequest, HTTPForbidden, HTTPNotFound, \
HTTPUnautho... | {
"repo_name": "hbhdytf/mac2",
"path": "build/lib.linux-x86_64-2.7/swift/common/middleware/mac.py",
"copies": "1",
"size": "33405",
"license": "apache-2.0",
"hash": -4298157545643351600,
"line_mean": 44.0202156334,
"line_max": 227,
"alpha_frac": 0.539649753,
"autogenerated": false,
"ratio": 3.9896... |
__author__ = 'Sanket K'
__dependencies__ = ['colorama']
import platform, sys, os, time
current_platform = platform.system().lower()
if current_platform == 'windows':
import winsound as ws
else:
sys.exit('Sorry, not supported for your platform yet')
from colorama import init
init(autoreset=True)
from coloram... | {
"repo_name": "hckrtst/learnpython",
"path": "ControlFlow/morse.py",
"copies": "1",
"size": "3161",
"license": "mit",
"hash": -7394066876715087000,
"line_mean": 19.7960526316,
"line_max": 66,
"alpha_frac": 0.4283454603,
"autogenerated": false,
"ratio": 3.439608269858542,
"config_test": false,
... |
author = 'Sanket'
modified = 'Akshay'
"""
Edit1: I have refactored the code, removed unwanted methods, updated the variable names
- Akshay
Edit 2: I have also added K-Fold cross validation on the data set!!
"""
#########################################################
import sys
reload(sys)
sys.setdefaultencoding('ut... | {
"repo_name": "akshaykamath/ReviewPredictionYelp",
"path": "SVM_KFold_CrossValidation.py",
"copies": "1",
"size": "2696",
"license": "mit",
"hash": -8537439009154445000,
"line_mean": 30.7176470588,
"line_max": 99,
"alpha_frac": 0.6635756677,
"autogenerated": false,
"ratio": 3.723756906077348,
"... |
__author__ = 'Santiago Ruiz'
__copyright__ = "Copyright 2014, SoftTelecom"
import getopt
import pycurl
import cStringIO
from subprocess import call
import sys
import time
import logging
def config_logger(log_level=logging.DEBUG):
logging.basicConfig(format='%(levelname)s %(asctime)s: %(message)s',
... | {
"repo_name": "MobileCloudNetworking/dssaas",
"path": "dss-side-scripts/aaa_apache.py",
"copies": "1",
"size": "2609",
"license": "apache-2.0",
"hash": 3719575751922137000,
"line_mean": 31.625,
"line_max": 111,
"alpha_frac": 0.5262552702,
"autogenerated": false,
"ratio": 3.905688622754491,
"con... |
__author__ = 'Santiago Ruiz'
__copyright__ = "Copyright 2014, SoftTelecom"
import urllib
import pycurl
from StringIO import StringIO
class Storage:
def __init__(self):
self.contents = ''
self.line = 0
def store(self, buf):
self.line = self.line + 1
self.contents = "%s%i: %s" %... | {
"repo_name": "MobileCloudNetworking/dssaas",
"path": "dss-side-scripts/SLAmgr.py",
"copies": "1",
"size": "21969",
"license": "apache-2.0",
"hash": -3426301055388644000,
"line_mean": 60.8845070423,
"line_max": 209,
"alpha_frac": 0.3635577405,
"autogenerated": false,
"ratio": 5.103135888501742,
... |
__author__ = 'Santi'
'''
Packet sniffer in python using the pcapy python library
Project website
http://oss.coresecurity.com/projects/pcapy.html
'''
import socket
from struct import *
import pcapy
import sys
from time import gmtime, strftime, sleep
import web
import threading
global results
def threaded(fn):
... | {
"repo_name": "MobileCloudNetworking/dssaas",
"path": "dss-side-scripts/traffic.py",
"copies": "1",
"size": "12397",
"license": "apache-2.0",
"hash": -1604303783010894300,
"line_mean": 36.9143730887,
"line_max": 141,
"alpha_frac": 0.4725336775,
"autogenerated": false,
"ratio": 4.079302402105956,
... |
__author__ = 'sanyi'
import fcntl
import os
import time
import subprocess
from .exceptions import *
IPSET_COMMAND = 'ipset'
IPSET_TIMEOUT = 2
def _process_error_message(msg):
if "Kernel error received: Operation not permitted" in msg:
raise IpsetNoRights(msg)
elif "The set with the given name does n... | {
"repo_name": "sanyi/ipsetpy",
"path": "ipsetpy/wrapper.py",
"copies": "1",
"size": "7165",
"license": "mit",
"hash": 4099818062799525400,
"line_mean": 30.703539823,
"line_max": 119,
"alpha_frac": 0.629448709,
"autogenerated": false,
"ratio": 3.872972972972973,
"config_test": false,
"has_no_k... |
__author__ = 'sanyi'
import re
from .wrapper import *
# tested against ipset v6.20.1, protocol version: 6
IPSET_RE_LIST_TERSE = re.compile("Name:\s(.*?)\sType:\s(.*?)\sRevision:\s(.*?)\sHeader:\s(.*?)\sSize in memory:\s(.*?)"
"\sReferences:\s(.*?)\s", re.DOTALL)
IPSET_LIST_HEADER = ... | {
"repo_name": "alexliyu/CDMSYSTEM",
"path": "utils/ipsetpy/helpers.py",
"copies": "2",
"size": "2380",
"license": "mit",
"hash": -8295255123618068000,
"line_mean": 28.7625,
"line_max": 119,
"alpha_frac": 0.5193277311,
"autogenerated": false,
"ratio": 3.9932885906040267,
"config_test": false,
... |
__author__ = "Sapan Bhatia"
__copyright__ = "Copyright (C) 2017 Open Networking Lab"
__version__ = "1.0"
import ply.lex as lex
import ply.yacc as yacc
from helpers import LexHelper, LU
class FOLParsingError(Exception):
def __init__(self, message, error_range):
super(FOLParsingError, self).__init__(messa... | {
"repo_name": "sb98052/plyprotobuf",
"path": "plyxproto/logicparser.py",
"copies": "1",
"size": "3947",
"license": "apache-2.0",
"hash": 6818890363378525000,
"line_mean": 25.1390728477,
"line_max": 173,
"alpha_frac": 0.4469217127,
"autogenerated": false,
"ratio": 2.921539600296077,
"config_test... |
__author__ = 'Saqib Razaq'
from datetime import date, datetime, timedelta
import tkMessageBox
import sqlite3
import lpoWeb
__version__ = '0.0.1'
class LpoDB():
def __init__(self, **kwargs):
self.filename = kwargs.get('filename', 'lpo.db')
self.table = kwargs.get('table', 'Weather')
se... | {
"repo_name": "s-razaq/Exploring-Lake-Pend-Oreille",
"path": "lpoDB.py",
"copies": "1",
"size": "6051",
"license": "mit",
"hash": -4774284949283504000,
"line_mean": 38.8092105263,
"line_max": 110,
"alpha_frac": 0.4909932243,
"autogenerated": false,
"ratio": 4.5156716417910445,
"config_test": fa... |
__author__ = 'Saqib Razaq'
from urllib2 import urlopen
__version__ = '0.0.1'
BASE_URL = 'http://lpo.dt.navy.mil/data/DM/'
def get_data_for_date(date):
"""
Returns an generator object of data for the specified date.
Output data is formatted as a dict.
:param date:
:return:
"""
# use cor... | {
"repo_name": "s-razaq/Exploring-Lake-Pend-Oreille",
"path": "lpoWeb.py",
"copies": "1",
"size": "3278",
"license": "mit",
"hash": 6535693127630048000,
"line_mean": 31.137254902,
"line_max": 101,
"alpha_frac": 0.5881635143,
"autogenerated": false,
"ratio": 3.911694510739857,
"config_test": fals... |
import time
import array
import pyupm_ldt0028 as ldt0028
NUMBER_OF_SECONDS = 10
SAMPLES_PER_SECOND = 50
THRESHOLD = 100
# Create the LDT0-028 Piezo Vibration Sensor object using AIO pin 0
sensor = ldt0028.LDT0028(0)
# Read the signal every 20 milliseconds for 10 seconds
print 'For the next', NUMBER_OF_SECONDS, 'sec... | {
"repo_name": "GSmurf/upm",
"path": "examples/python/ldt0028.py",
"copies": "18",
"size": "2732",
"license": "mit",
"hash": 7978118701615136000,
"line_mean": 40.3939393939,
"line_max": 80,
"alpha_frac": 0.7338945827,
"autogenerated": false,
"ratio": 3.672043010752688,
"config_test": false,
"h... |
from sklearn.metrics.cluster import normalized_mutual_info_score
import networkx as nx
from scipy import sparse
from numpy import *
from scipy.sparse import identity
import collections
import time
def tomat(*Z):
"""Converts the list of arrays in *Z to matrices"""
Out = []
for iter in Z:
iter = mat... | {
"repo_name": "LichAmnesia/MBSCM",
"path": "data/matlab_to_python/Algorithm.py",
"copies": "1",
"size": "7885",
"license": "mit",
"hash": -2872371627777601000,
"line_mean": 21.0868347339,
"line_max": 179,
"alpha_frac": 0.5562460368,
"autogenerated": false,
"ratio": 2.662052667116813,
"config_te... |
__author__ = 'sarangis'
class ModulePass:
def __init__(self):
pass
def run_on_module(self, node):
raise NotImplementedError("Derived passes class should implement run_on_module")
class FunctionPass:
def __init__(self):
pass
def run_on_function(self, node):
raise NotIm... | {
"repo_name": "ssarangi/spiderjit",
"path": "src/optimizer/pass_support.py",
"copies": "1",
"size": "3304",
"license": "mit",
"hash": -4264028025226461000,
"line_mean": 21.9513888889,
"line_max": 90,
"alpha_frac": 0.6334745763,
"autogenerated": false,
"ratio": 4.290909090909091,
"config_test": ... |
__author__ = 'sarangis'
# Code from http://typeandflow.blogspot.com/2011/06/python-decorator-with-optional-keyword.html
# Very well explained
class U:
def __init__(self, *args):
self.types = args
def __str__(self):
return ",".join(self.types)
__repr__ = __str__
def verify(func=None, **op... | {
"repo_name": "ssarangi/spiderjit",
"path": "src/ir/validator.py",
"copies": "1",
"size": "2205",
"license": "mit",
"hash": 4629964875821966000,
"line_mean": 34.0158730159,
"line_max": 133,
"alpha_frac": 0.5142857143,
"autogenerated": false,
"ratio": 4.436619718309859,
"config_test": false,
"... |
__author__ = 'sarangis'
from src.ir.utils import *
from src.ir.constants import *
from src.ir.validator import verify, Validator
from src.ir.exceptions import InvalidTypeException, NoBBTerminatorException
class InstructionList(list):
def __init__(self, name_generator):
list.__init__(self)
self.__n... | {
"repo_name": "ssarangi/spiderjit",
"path": "src/ir/instructions.py",
"copies": "1",
"size": "19009",
"license": "mit",
"hash": 7996223714605792000,
"line_mean": 25.8110014104,
"line_max": 136,
"alpha_frac": 0.57867326,
"autogenerated": false,
"ratio": 3.7851453604141776,
"config_test": false,
... |
__author__ = 'sarangis'
from src.optimizer.pass_support import *
from src.ir.module import *
from src.ir.function import *
class PrintFunctionsPass(ModulePass):
def __init__(self):
ModulePass.__init__(self)
@verify(node=Module)
def run_on_module(self, node):
print()
print("Functio... | {
"repo_name": "ssarangi/spiderjit",
"path": "src/optimizer/basicpass.py",
"copies": "1",
"size": "3193",
"license": "mit",
"hash": -7049876498987137000,
"line_mean": 27.7747747748,
"line_max": 111,
"alpha_frac": 0.5427497651,
"autogenerated": false,
"ratio": 3.87030303030303,
"config_test": fal... |
from pyNN import *
import time
class Autoencoder(Model):
def init(self, numpy_rng, theano_rng=None, l_rate=None, optimization = "sgd", tied = False, n_visible=400, n_hidden=200,W=None, bhid=None, bvis=None, W_prime = None, input=None, hidden_activation = "sigmoid", output_activation = "identity", loss_fn = "squa... | {
"repo_name": "apsarath/pyNN",
"path": "model/autoencoder/AutoEncoder.py",
"copies": "1",
"size": "6447",
"license": "apache-2.0",
"hash": 1484957578824418600,
"line_mean": 36.4825581395,
"line_max": 327,
"alpha_frac": 0.5812005584,
"autogenerated": false,
"ratio": 3.3352302121055355,
"config_t... |
__author__ = 'Sarath'
# Author : Sarath Chandar
from pyNN import *
import time
from pyNN.optimization.optimization import *
from pyNN.util.Initializer import *
import pickle
class DocNADE(object):
def init(self, numpy_rng, theano_rng=None, l_rate=None, optimization = "sgd", tied = False, n_visible=400, n_hidd... | {
"repo_name": "apsarath/pyNN",
"path": "model/autoregressive/DocNADE.py",
"copies": "1",
"size": "5118",
"license": "apache-2.0",
"hash": -2904148885690675000,
"line_mean": 34.0547945205,
"line_max": 145,
"alpha_frac": 0.582063306,
"autogenerated": false,
"ratio": 3.0775706554419724,
"config_te... |
__author__ = 'Sarath'
from pyNN import *
import time
from pyNN.optimization.optimization import *
from pyNN.util.Initializer import *
import pickle
class CorrNet(object):
def init(self, numpy_rng, theano_rng=None, l_rate=0.01, optimization="sgd", tied=False, n_visible_left=None, n_visible_right=None, n_hidden=No... | {
"repo_name": "apsarath/pyNN",
"path": "model/crl/corrnet.py",
"copies": "1",
"size": "17236",
"license": "apache-2.0",
"hash": 7122878432842385000,
"line_mean": 44.3578947368,
"line_max": 504,
"alpha_frac": 0.6026340218,
"autogenerated": false,
"ratio": 3.0916591928251123,
"config_test": false... |
__author__ = 'Sarath'
from pyNN import *
import time
from pyNN.optimization.optimization import *
from pyNN.util.Initializer import *
import pickle
class DeepCorrNet1(object):
def init(self, numpy_rng, theano_rng=None, l_rate=0.01, optimization="sgd", tied=False, n_visible_left=None, n_visible_right=None, n_hidd... | {
"repo_name": "apsarath/pyNN",
"path": "model/crl/deepcorrnet1.py",
"copies": "1",
"size": "19074",
"license": "apache-2.0",
"hash": 9006668478793170000,
"line_mean": 50,
"line_max": 714,
"alpha_frac": 0.6313306071,
"autogenerated": false,
"ratio": 2.9308543331284573,
"config_test": false,
"h... |
__author__ = 'Sarath'
from pyNN import *
import time
from pyNN.optimization.optimization import *
from pyNN.util.Initializer import *
import pickle
class DeepCorrNet2(object):
def init(self, numpy_rng, theano_rng=None, l_rate=0.01, optimization="sgd", tied=False, n_visible_left=None, n_visible_right=None, n_hidd... | {
"repo_name": "apsarath/pyNN",
"path": "model/crl/deepcorrnet2.py",
"copies": "1",
"size": "24479",
"license": "apache-2.0",
"hash": 2388175134865771500,
"line_mean": 54.3823529412,
"line_max": 928,
"alpha_frac": 0.6403447853,
"autogenerated": false,
"ratio": 2.856692729606722,
"config_test": f... |
__author__ = 'Sarath'
from pyNN import *
import time
from pyNN.optimization.optimization import *
from pyNN.util.Initializer import *
import pickle
class MAE(object):
def init(self, numpy_rng, theano_rng=None, l_rate=0.01, optimization="sgd", tied=False, n_visible_left=None, n_visible_right=None, n_hidden=None, ... | {
"repo_name": "apsarath/pyNN",
"path": "model/crl/mae.py",
"copies": "1",
"size": "14544",
"license": "apache-2.0",
"hash": -6097118126829531000,
"line_mean": 45.4664536741,
"line_max": 492,
"alpha_frac": 0.6192931793,
"autogenerated": false,
"ratio": 3.0984235193864507,
"config_test": false,
... |
__author__ = 'Sarath'
import os
import numpy
from os import listdir
from os.path import isfile, join
import sys
import theano
import theano.tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
from scipy import sparse
def create_folder(folder):
if not os.path.exists(folder):
os.makedirs(folde... | {
"repo_name": "apsarath/pyNN",
"path": "util/NNUtil.py",
"copies": "1",
"size": "5283",
"license": "apache-2.0",
"hash": 7723030625640647000,
"line_mean": 24.7707317073,
"line_max": 116,
"alpha_frac": 0.6318379708,
"autogenerated": false,
"ratio": 2.823623730625334,
"config_test": false,
"has... |
__author__ = 'sarikaya'
import os
import csv
import json
def parseFile(file):
with open(file, 'rb') as f:
r = [{k: v for k,v in row.items()} for row in csv.DictReader(f)]
for row in r:
# playerName, playerID = row['Player'].split('\\')
# row['bbref_id'] = pla... | {
"repo_name": "yelper/nba-age",
"path": "parse_players.py",
"copies": "1",
"size": "1163",
"license": "mit",
"hash": 5009196708648840000,
"line_mean": 24.4318181818,
"line_max": 80,
"alpha_frac": 0.4625967326,
"autogenerated": false,
"ratio": 3.4924924924924925,
"config_test": false,
"has_no_... |
from __future__ import unicode_literals
import os
import os.path as op
from time import sleep
import subprocess
from getpass import getuser
from nose import SkipTest
from nose.tools import assert_equal
from nose.tools import assert_raises
from nose.tools import assert_in
from clusterlib.scheduler import queued_or_ru... | {
"repo_name": "clusterlib/clusterlib",
"path": "clusterlib/tests/test_scheduler.py",
"copies": "2",
"size": "7208",
"license": "bsd-3-clause",
"hash": -4034528288257128000,
"line_mean": 35.404040404,
"line_max": 77,
"alpha_frac": 0.5940621532,
"autogenerated": false,
"ratio": 3.8137566137566137,
... |
from nose.tools import assert_equal
from nose.tools import assert_raises
from ..scheduler import queued_or_running_jobs
from ..scheduler import submit
def test_smoke_test():
# XXX : need a better way to test those functions
queued_or_running_jobs()
def test_submit():
assert_equal(
submit(job_c... | {
"repo_name": "lesteve/clusterlib",
"path": "clusterlib/tests/test_scheduler.py",
"copies": "1",
"size": "1571",
"license": "bsd-3-clause",
"hash": 2770711061270002000,
"line_mean": 33.9111111111,
"line_max": 74,
"alpha_frac": 0.5996180777,
"autogenerated": false,
"ratio": 3.110891089108911,
"c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.