text stringlengths 0 1.05M | meta dict |
|---|---|
import matplotlib as mpl
mpl.use('agg')
import neurokernel.LPU.utils.visualizer as vis
import networkx as nx
# Temporary fix for bug in networkx 1.8:
nx.readwrite.gexf.GEXF.convert_bool = {'false':False, 'False':False,
'true':True, 'True':True}
#starts up the visualizer code
V ... | {
"repo_name": "cerrno/neurokernel",
"path": "examples/testLPU/visualize_testLPU.py",
"copies": "1",
"size": "1818",
"license": "bsd-3-clause",
"hash": -5919871173636297000,
"line_mean": 24.9714285714,
"line_max": 71,
"alpha_frac": 0.6287128713,
"autogenerated": false,
"ratio": 2.7883435582822087,... |
import re
from .tlds import tlds
__all__ = ['AbsUrl', 'RelUrl', 'UrlException', 'UrlParseException']
class UrlException(Exception):
pass
class UrlParseException(Exception):
pass
class AbsUrl():
regex = re.compile( "^([a-zA-Z][a-zA-Z0-9+-\.]+)://" + #scheme
"(?:(?:" +
"(?:(" +
"(?:[a-zA-Z0-9... | {
"repo_name": "amol9/mutils",
"path": "redlib/net/urls.py",
"copies": "2",
"size": "4233",
"license": "mit",
"hash": -6798766798204427000,
"line_mean": 19.6487804878,
"line_max": 102,
"alpha_frac": 0.5979210961,
"autogenerated": false,
"ratio": 2.7013401403956605,
"config_test": false,
"has_n... |
__author__ = 'amryf'
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ctypes import *
import time
from .ic_grabber_dll import IC_GrabberDLL
from .ic_exception import IC_Exception
from .ic_property import IC_Property
from . import ic_structures as structs
from IPython import embed
GrabberHandlePtr = POINTER(struc... | {
"repo_name": "amryfitra/icpy3",
"path": "icpy3/ic_camera.py",
"copies": "1",
"size": "15862",
"license": "mit",
"hash": -5741563388565190000,
"line_mean": 31.7051546392,
"line_max": 105,
"alpha_frac": 0.5535871895,
"autogenerated": false,
"ratio": 3.8668941979522184,
"config_test": false,
"h... |
__author__ = 'amryf'
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .ic_grabber_dll import IC_GrabberDLL
from .ic_camera import IC_Camera
from .ic_exception import IC_Exception
from IPython import embed
class IC_ImagingControl(object):
def init_library(self):
"""
Initialise the IC Imaging C... | {
"repo_name": "amryfitra/icpy3",
"path": "icpy3/ic_imaging_control.py",
"copies": "1",
"size": "1381",
"license": "mit",
"hash": 8231136200852709000,
"line_mean": 28.3829787234,
"line_max": 101,
"alpha_frac": 0.6249094859,
"autogenerated": false,
"ratio": 3.8254847645429364,
"config_test": fals... |
__author__ = 'amryf'
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ctypes import *
from .ic_grabber_dll import IC_GrabberDLL
from .ic_exception import IC_Exception
class IC_Property(object):
@property
def available(self):
"""
"""
# returns boolean value
iav = self._avai... | {
"repo_name": "amryfitra/icpy3",
"path": "icpy3/ic_property.py",
"copies": "1",
"size": "5730",
"license": "mit",
"hash": 3459619793558446000,
"line_mean": 29,
"line_max": 99,
"alpha_frac": 0.4385689354,
"autogenerated": false,
"ratio": 4.137184115523466,
"config_test": false,
"has_no_keyword... |
__author__ = 'amw'
import numpy as np
from sklearn.gaussian_process import GaussianProcess
class GaussianProcessInterpolator:
def __init__(self, observations):
self.observations = observations
self.gaussian_process = GaussianProcess(corr='cubic', theta0=1e-2, thetaL=1e-4, thetaU=1e-1, random_sta... | {
"repo_name": "ClockworkOrigins/m2etis",
"path": "configurator/configurator/interpolation/GaussianProcessInterpolator.py",
"copies": "1",
"size": "1116",
"license": "apache-2.0",
"hash": -540534466864054400,
"line_mean": 28.3684210526,
"line_max": 118,
"alpha_frac": 0.6944444444,
"autogenerated": f... |
__author__ = 'Amy'
import os,zipfile
from .utils import makeDir
from library.core.utils import compress_dir,unzip
no_zip_res = {
'mongodb-2.4.5':[
"data/",
"logs/",
],
"mysql-5.1":[
'data/',
],
"openssl-1.9.8":[
'certs/',
],
'nginx-1.5.12':[
'conf/... | {
"repo_name": "ptphp/PtServer",
"path": "library/core/dist_zip.py",
"copies": "1",
"size": "2005",
"license": "bsd-3-clause",
"hash": 8255496568933224000,
"line_mean": 24.3797468354,
"line_max": 90,
"alpha_frac": 0.5845386534,
"autogenerated": false,
"ratio": 3.024132730015083,
"config_test": f... |
__author__ = 'Anand Madhavan'
# TODO(Anand) Remove this from pants proper when a code adjoinment mechanism exists
# or ok if/when thriftstore is open sourced as well
import os
import re
import subprocess
from collections import defaultdict
from twitter.common import log
from twitter.common.collections import Ordere... | {
"repo_name": "foursquare/commons-old",
"path": "src/python/twitter/pants/tasks/thriftstore_dml_gen.py",
"copies": "1",
"size": "5285",
"license": "apache-2.0",
"hash": -6438109501552313000,
"line_mean": 35.198630137,
"line_max": 116,
"alpha_frac": 0.6467360454,
"autogenerated": false,
"ratio": 3... |
__author__ = 'Anand'
######################################################
# Muon - simulates n product electron from muon
# decays and counts the # of spark events with a
# given # of sparks. Each instance of the Muon
# class contains the following member variables:
#
# muon_energy - the initial energy of the incide... | {
"repo_name": "adyavanapalli/Muon-Mass",
"path": "rand_deg/Muon_Rand.py",
"copies": "1",
"size": "5283",
"license": "mit",
"hash": -8764700675439529000,
"line_mean": 30.6407185629,
"line_max": 107,
"alpha_frac": 0.5371947757,
"autogenerated": false,
"ratio": 3.1149764150943398,
"config_test": f... |
__author__ = 'Anand'
# PYTHON VERSION 3.4.3 #
######################################################
# Muon - simulates n product electron from muon
# decays and counts the # of spark events with a
# given # of sparks. Each instance of the Muon
# class contains the following member variables:
#
# muon_energy - the in... | {
"repo_name": "adyavanapalli/Muon-Mass",
"path": "final_data/Muon.py",
"copies": "1",
"size": "5350",
"license": "mit",
"hash": -7055505224381448000,
"line_mean": 30.4764705882,
"line_max": 107,
"alpha_frac": 0.5407476636,
"autogenerated": false,
"ratio": 3.101449275362319,
"config_test": false... |
__author__ = 'Anand'
"""
This class will act like the game administrator. It should be connected by the person handling the
tournament. This 'player' will manage the current tournament, game, number of players, etc...
"""
__author__ = 'Paul Council'
import time
from ClientPackage.GameMasterClient import *
from Availab... | {
"repo_name": "PaulieC/sprint3-Council",
"path": "ClientPackage/EasyGameController.py",
"copies": "1",
"size": "2661",
"license": "apache-2.0",
"hash": -903276169993125400,
"line_mean": 25.8787878788,
"line_max": 98,
"alpha_frac": 0.7534761368,
"autogenerated": false,
"ratio": 3.249084249084249,
... |
__author__ = 'Anand Patil, anand.prabhakar.patil@gmail.com'
from pymc import *
def find_generations(stochastics):
"""
A generation is the set of stochastic variables that only has parents in
previous generations.
"""
generations = []
# Find root generation
generations.append(set())
a... | {
"repo_name": "matthew-brett/pymc",
"path": "pymc/sandbox/graphical_utils.py",
"copies": "1",
"size": "3112",
"license": "mit",
"hash": -1992872839540568600,
"line_mean": 29.213592233,
"line_max": 86,
"alpha_frac": 0.6452442159,
"autogenerated": false,
"ratio": 3.7314148681055155,
"config_test"... |
__author__ = 'Anand Patil, anand.prabhakar.patil@gmail.com'
from pymc.NormalApproximation import *
import pymc as pm
import numpy as np
class EM(MAP):
"""
N = EM(input, sampler, db='ram', eps=.001, diff_order = 5)
Normal approximation to the posterior of a model via the EM algorithm.
Useful methods:... | {
"repo_name": "matthew-brett/pymc",
"path": "pymc/sandbox/EM.py",
"copies": "1",
"size": "5716",
"license": "mit",
"hash": -2909140508251264000,
"line_mean": 37.8843537415,
"line_max": 128,
"alpha_frac": 0.616340098,
"autogenerated": false,
"ratio": 3.9017064846416383,
"config_test": false,
"... |
__author__ = 'Anand Patil, anand.prabhakar.patil@gmail.com'
"""
Dirichlet process classes:
- DPRealization: A Dirichlet process realization. Based on stick-breaking representation,
but step methods should use other representations.
Attributes:
- atoms: A list containing the atom locations.
Methods:
... | {
"repo_name": "matthew-brett/pymc",
"path": "pymc/sandbox/DP/DP.py",
"copies": "1",
"size": "11854",
"license": "mit",
"hash": 6247141589990228000,
"line_mean": 27.912195122,
"line_max": 123,
"alpha_frac": 0.561329509,
"autogenerated": false,
"ratio": 3.7751592356687897,
"config_test": false,
... |
from fast_givens import fg
import pymc as pm
import numpy as np
from ortho_basis import OrthogonalBasis
__all__ = ['fast_givens', 'GivensStepper']
def fast_givens(o,i,j,t):
"Givens rotates the matrix o."
if i==j:
raise ValueError, 'i must be different from j.'
oc = o.copy('F')
fg(o,oc,i+1,j+1... | {
"repo_name": "apatil/covariance-prior",
"path": "cov_prior/givens_step.py",
"copies": "1",
"size": "1366",
"license": "mit",
"hash": 5670105406355458000,
"line_mean": 26.34,
"line_max": 63,
"alpha_frac": 0.541727672,
"autogenerated": false,
"ratio": 3.1474654377880182,
"config_test": false,
... |
import pymc as pm
import numpy as np
__all__ = ['OrthogonalBasis','check_orthogonality','covariance']
def check_orthogonality(value, tol=1e-10):
"""
Returns 0 if the matrix is orthogonal (up to tolerance),
-inf if it is not. You can use this in potentials.
"""
if np.abs(np.dot(value,value.T) - n... | {
"repo_name": "apatil/covariance-prior",
"path": "cov_prior/ortho_basis.py",
"copies": "1",
"size": "1564",
"license": "mit",
"hash": -5487920617320456000,
"line_mean": 33.0217391304,
"line_max": 154,
"alpha_frac": 0.6061381074,
"autogenerated": false,
"ratio": 3.2857142857142856,
"config_test"... |
import matplotlib.pyplot as pl
import numpy as np
def symmetric(sorted_streams, stream_bounds):
"""Symmetric baseline"""
lb, ub = np.min(stream_bounds[:,0,:],axis=0), np.max(stream_bounds[:,1,:],axis=0)
return .5*(lb+ub)
def pos_only(sorted_streams, stream_bounds):
"""Lumps will only be positive"""
... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/576633_Stacked_graphs_using_matplotlib/recipe-576633.py",
"copies": "1",
"size": "4165",
"license": "mit",
"hash": 3249772835440081000,
"line_mean": 37.2110091743,
"line_max": 129,
"alpha_frac": 0.6040816327,
"autogenerated": false,
"ratio... |
import json
import io
import os
import re
from hl7apy.parser import parse_message
from hl7apy.exceptions import UnsupportedVersion
#receives the name of the file and reads the messages in the file
def readMessageFile(filename):
#read the file
message = open(filename, 'r').read()
print("Step 1: File read su... | {
"repo_name": "AnaniSkywalker/HL7_Parser",
"path": "Hl7_Parser.py",
"copies": "1",
"size": "3239",
"license": "mit",
"hash": -6582345172317627000,
"line_mean": 34.2065217391,
"line_max": 83,
"alpha_frac": 0.6236492745,
"autogenerated": false,
"ratio": 4.0538172715894865,
"config_test": false,
... |
import os, io
def get_file_path(filename):
return os.path.abspath(os.path.join(os.getcwd(), filename))
def read_file(file):
return io.IOBase.readable(file)
def main():
fileName = input("Please Enter the name of your file: ".upper())
file = get_file_path(fileName)
if fileName == "alt1.csv".lower... | {
"repo_name": "FourthCohortAwesome/NightThree",
"path": "NightThree.py",
"copies": "1",
"size": "1662",
"license": "mit",
"hash": 976967313248532600,
"line_mean": 30.9615384615,
"line_max": 68,
"alpha_frac": 0.5024067389,
"autogenerated": false,
"ratio": 3.4625,
"config_test": false,
"has_no_... |
import os, sys, glob, pdb, scipy, scipy.misc
import numpy as N
import cv2 as cv2
import random
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib as mpl
import pylab
import pickle as pickle
from dataset import *
# For color_mask_img function
from mpl_toolkits.axes_grid1 import make_axes_loca... | {
"repo_name": "wkiri/DEMUD",
"path": "demud/dataset_navcam.py",
"copies": "1",
"size": "25050",
"license": "apache-2.0",
"hash": 1680935877172980700,
"line_mean": 35.7841409692,
"line_max": 148,
"alpha_frac": 0.6268263473,
"autogenerated": false,
"ratio": 3.230590662883673,
"config_test": false... |
__author__ = 'anass'
from flask import Flask, make_response, jsonify, request
import json
from JSONtoObject import wrap
from JSONtoObject.wrapper import Wrapper
from database import Database
from utils import path_to_property, dict_to_json
from default import id_tag, SLASH
from message import BAD_REQUEST, NOT_FOUND
fr... | {
"repo_name": "lahlali/JSONMock.py",
"path": "jsonmock/server.py",
"copies": "2",
"size": "3277",
"license": "mit",
"hash": 7507502070611609000,
"line_mean": 22.4071428571,
"line_max": 71,
"alpha_frac": 0.6368629844,
"autogenerated": false,
"ratio": 3.420668058455115,
"config_test": false,
"h... |
__author__ = "Anatolij Zubow, Piotr Gawlowicz"
__copyright__ = "Copyright (c) 2015, Technische Universitat Berlin"
__version__ = "0.1.0"
__email__ = "{zubow, gawlowicz}@tkn.tu-berlin.de"
class UniFlexException(Exception):
'''
Base class for all exceptions.
'''
message = 'An unknown exception'
def... | {
"repo_name": "uniflex/uniflex",
"path": "uniflex/core/exceptions.py",
"copies": "1",
"size": "1353",
"license": "mit",
"hash": 356736939890069060,
"line_mean": 27.1875,
"line_max": 78,
"alpha_frac": 0.6711012565,
"autogenerated": false,
"ratio": 3.727272727272727,
"config_test": false,
"has_... |
__author__ = 'anderson'
# -*- coding: utf-8 -*-
from threading import Thread, Condition
from datetime import datetime
from santos.exceptions import TaskException
import logging
log = logging.getLogger(__name__)
class ThreadSchedule:
__jobs = [] # jobs que serão executados
def pause_job(self, job_name):
... | {
"repo_name": "anderson89marques/Santos",
"path": "santos/santos.py",
"copies": "1",
"size": "9252",
"license": "mit",
"hash": -8460936553679018000,
"line_mean": 37.6455696203,
"line_max": 139,
"alpha_frac": 0.5692290893,
"autogenerated": false,
"ratio": 3.474203338391502,
"config_test": false,... |
__author__ = 'andersonpaac'
import numpy as np
filename="/Users/andersonpaac/Downloads/question_2.csv" #PLEASE INSERT FULL PATH TO FILENAME HERE
timestamp=[]
acc_data=[]
gyro_data=[]
mag_data=[]
light_data=[]
running = []
threshold=1.4
timediff=1000
ooind=10
def parser():
fd = open(filename)
data = fd.rea... | {
"repo_name": "andersonpaac/AndroidStepCounter",
"path": "postprocessor_step_calc.py",
"copies": "1",
"size": "2568",
"license": "mit",
"hash": -7363705221920111000,
"line_mean": 20.9487179487,
"line_max": 104,
"alpha_frac": 0.5385514019,
"autogenerated": false,
"ratio": 3.0318772136953953,
"co... |
__author__ = "Andrea Biancini, geduldig"
__date__ = "January 3, 2014"
__license__ = "MIT"
from .constants import *
import base64
import requests
OAUTH2_SUBDOMAIN = 'api'
OAUTH2_ENDPOINT = 'oauth2/token'
class BearerAuth(requests.auth.AuthBase):
"""Request bearer access token for oAuth2 authentication.
:... | {
"repo_name": "mpvoss/RickAndMortyWeatherTweets",
"path": "env/lib/python3.5/site-packages/TwitterAPI/BearerAuth.py",
"copies": "1",
"size": "2166",
"license": "mit",
"hash": 2968697241083509000,
"line_mean": 33.935483871,
"line_max": 85,
"alpha_frac": 0.5747922438,
"autogenerated": false,
"ratio... |
__author__ = "Andrea Biancini, Jonas Geduldig"
__date__ = "January 3, 2014"
__license__ = "MIT"
import base64
from .constants import *
import requests
class BearerAuth(requests.auth.AuthBase):
"""Request bearer access token for oAuth2 authentication.
:param consumer_key: Twitter application consumer key
... | {
"repo_name": "Innova4D/twitter-stream-expression",
"path": "TwitterAPI/BearerAuth.py",
"copies": "1",
"size": "2181",
"license": "mit",
"hash": -4202436073291924000,
"line_mean": 34.7540983607,
"line_max": 85,
"alpha_frac": 0.5570839065,
"autogenerated": false,
"ratio": 4.243190661478599,
"con... |
__author__ = "Andrea Biancini, Jonas Geduldig"
__date__ = "January 3, 2014"
__license__ = "MIT"
from .constants import *
import base64
import requests
OAUTH2_SUBDOMAIN = 'api'
OAUTH2_ENDPOINT = 'oauth2/token'
class BearerAuth(requests.auth.AuthBase):
"""Request bearer access token for oAuth2 authentication.
... | {
"repo_name": "rosudrag/Freemium-winner",
"path": "VirtualEnvironment/Lib/site-packages/TwitterAPI/BearerAuth.py",
"copies": "2",
"size": "2172",
"license": "mit",
"hash": 597086162918719700,
"line_mean": 34.0322580645,
"line_max": 85,
"alpha_frac": 0.5755064457,
"autogenerated": false,
"ratio": ... |
__author__ = "Andrea Biancini"
__date__ = "October 2, 2013"
from backend import TwitterApiCall, BackendChooser, BackendError
class DownloadTweetsStream(TwitterApiCall):
def __init__(self, engine_config, language, auth_type):
super(DownloadTweetsStream, self).__init__(engine_config, language, auth_type)
sel... | {
"repo_name": "biancini/TwitterAnalyzer",
"path": "TwitterDownloader/TwitterEngine/stream.py",
"copies": "1",
"size": "1034",
"license": "apache-2.0",
"hash": 3757926393761762300,
"line_mean": 31.3125,
"line_max": 82,
"alpha_frac": 0.6808510638,
"autogenerated": false,
"ratio": 3.640845070422535,... |
__author__ = "Andrea Biancini"
__date__ = "October 2, 2013"
import json
import time
import threading
import logging
from backend import TwitterApiCall, BackendChooser, BackendError
from lastcallbackend import LastcallBackendChooser
class DownloadTweetsREST(TwitterApiCall):
bulk = True
logger = None
def __i... | {
"repo_name": "biancini/TwitterAnalyzer",
"path": "TwitterDownloader/TwitterEngine/rest.py",
"copies": "1",
"size": "10319",
"license": "apache-2.0",
"hash": -2028924356896617000,
"line_mean": 35.5921985816,
"line_max": 133,
"alpha_frac": 0.639887586,
"autogenerated": false,
"ratio": 3.4709048099... |
__author__ = "Andrea Biancini"
__date__ = "October 2, 2013"
import logging
class BackendChooser(object):
@staticmethod
def GetBackend(engine_config):
# from mysqlbackend import MySQLBackend
# backend = MySQLBackend()
from elasticsearchbackend import ElasticSearchBackend
backend = ElasticSearchBack... | {
"repo_name": "biancini/TwitterAnalyzer",
"path": "TwitterDownloader/TwitterEngine/lastcallbackend/lastcallbackend.py",
"copies": "1",
"size": "1131",
"license": "apache-2.0",
"hash": -9219222756119823000,
"line_mean": 23.5869565217,
"line_max": 72,
"alpha_frac": 0.7391688771,
"autogenerated": fals... |
__author__ = "Andrea Biancini"
__date__ = "October 2, 2013"
import logging
class BackendChooser(object):
@staticmethod
def GetBackend(logger):
# from mysqlbackend import MySQLBackend
# backend = MySQLBackend(logger)
from elasticsearchbackend import ElasticSearchBackend
backend = ElasticSearchBacke... | {
"repo_name": "biancini/TwitterAnalyzer",
"path": "TwitterDownloader/TwitterEngine/backend/backend.py",
"copies": "1",
"size": "1352",
"license": "apache-2.0",
"hash": -283629175175723970,
"line_mean": 22.3103448276,
"line_max": 72,
"alpha_frac": 0.7389053254,
"autogenerated": false,
"ratio": 4.3... |
__author__ = "Andrea Biancini"
__date__ = "October 2, 2013"
import MySQLdb
import threading
from backend import Backend, LastcallBackendError
from ..secrets import dbhost, dbuser, dbpass, dbname
def synchronized(func):
func.__lock__ = threading.Lock()
def synced_func(*args, **kws):
with func.__lock__:
... | {
"repo_name": "biancini/TwitterAnalyzer",
"path": "TwitterDownloader/TwitterEngine/lastcallbackend/mysqlbackend.py",
"copies": "1",
"size": "3363",
"license": "apache-2.0",
"hash": 980189935953313500,
"line_mean": 36.3777777778,
"line_max": 156,
"alpha_frac": 0.6146297948,
"autogenerated": false,
... |
__author__ = "Andrea Biancini"
__date__ = "October 2, 2013"
import MySQLdb
from backend import Backend, BackendError
from ..secrets import dbhost, dbuser, dbpass, dbname
class MySQLBackend(Backend):
con = None
cur = None
def __init__(self, engine_config):
Backend.__init__(self, engine_config)
try:
... | {
"repo_name": "biancini/TwitterAnalyzer",
"path": "TwitterDownloader/TwitterEngine/backend/mysqlbackend.py",
"copies": "1",
"size": "5792",
"license": "apache-2.0",
"hash": 808818195329621000,
"line_mean": 33.2721893491,
"line_max": 167,
"alpha_frac": 0.5816643646,
"autogenerated": false,
"ratio"... |
__author__ = "Andrea Biancini"
__date__ = "October 2, 2013"
import os
from PIL import Image, ImageDraw, ImageFont
# from backend import TwitterApiCall,MySQLBackend
from backend import ElasticSearchBackend
class DrawMap():
color = (255, 0, 0)
lower_left = [41.0, -5.5]
top_right = [51.6, 10.0]
def __init__... | {
"repo_name": "biancini/TwitterAnalyzer",
"path": "AnalysisTools/TwitterEngine/drawmap.py",
"copies": "1",
"size": "2613",
"license": "apache-2.0",
"hash": -358184455512217100,
"line_mean": 29.0344827586,
"line_max": 99,
"alpha_frac": 0.5935706085,
"autogenerated": false,
"ratio": 3.1033254156769... |
__author__ = "Andrea Biancini"
__date__ = "October 2, 2013"
import pprint
import sys
import json
import logging
import os
root_path = os.path.abspath(os.path.join(__file__, '..', '..'))
lib_path = os.path.join(root_path, 'lib')
sys.path.insert(0, lib_path)
from datetime import datetime
from TwitterAPI import Twitter... | {
"repo_name": "biancini/TwitterAnalyzer",
"path": "TwitterDownloader/TwitterEngine/backend/twitterapi.py",
"copies": "1",
"size": "6089",
"license": "apache-2.0",
"hash": -3997585497951330000,
"line_mean": 32.0923913043,
"line_max": 110,
"alpha_frac": 0.635408113,
"autogenerated": false,
"ratio":... |
__author__ = "Andrea Biancini"
__date__ = "October 2, 2013"
import requests
import json
from datetime import datetime
from backend import Backend, BackendError
from ..secrets import es_server
class ElasticSearchBackend(Backend):
def GetUSAKmls(self):
print("Retrieving all USA states")
try:
start = 0... | {
"repo_name": "biancini/TwitterAnalyzer",
"path": "AnalysisTools/TwitterEngine/backend/elasticsearchbackend.py",
"copies": "1",
"size": "7354",
"license": "apache-2.0",
"hash": -192580703727061920,
"line_mean": 33.6886792453,
"line_max": 112,
"alpha_frac": 0.5380745173,
"autogenerated": false,
"r... |
__author__ = "Andrea Biancini"
__date__ = "October 2, 2013"
import threading
import sqlite3
from ..secrets import sqlite_db_path
from backend import Backend, LastcallBackendError
def synchronized(func):
func.__lock__ = threading.Lock()
def synced_func(*args, **kws):
with func.__lock__:
return func(*ar... | {
"repo_name": "biancini/TwitterAnalyzer",
"path": "TwitterDownloader/TwitterEngine/lastcallbackend/sqllitebackend.py",
"copies": "1",
"size": "4394",
"license": "apache-2.0",
"hash": -9119506546307594000,
"line_mean": 35.3140495868,
"line_max": 203,
"alpha_frac": 0.630860264,
"autogenerated": false... |
__author__ = "Andrea Fioraldi"
__copyright__ = "Copyright 2017, Andrea Fioraldi"
__license__ = "MIT"
__email__ = "andreafioraldi@gmail.com"
import idaapi
import subprocess
import idc
import os
import threading
pwd = os.path.dirname(__file__)
def startView(buf):
view = subprocess.Popen(
[os.path.join(pwd,... | {
"repo_name": "andreafioraldi/IdaGrabStrings",
"path": "IdaGrabStrings.py",
"copies": "1",
"size": "2383",
"license": "mit",
"hash": -3822972179079327000,
"line_mean": 27.7108433735,
"line_max": 109,
"alpha_frac": 0.6374318086,
"autogenerated": false,
"ratio": 3.2643835616438355,
"config_test":... |
__author__ = "Andrea Gavana <andrea.gavana@gmail.com>"
__date__ = "31 March 2009"
import wx
import auibook
from aui_constants import *
_ = wx.GetTranslation
#-----------------------------------------------------------------------------
# AuiMDIParentFrame
#----------------------------------------------------------... | {
"repo_name": "nyov/dmide",
"path": "core/agw/aui/tabmdi.py",
"copies": "1",
"size": "17529",
"license": "bsd-3-clause",
"hash": -5952654894197622000,
"line_mean": 25.3198198198,
"line_max": 97,
"alpha_frac": 0.5881681784,
"autogenerated": false,
"ratio": 4.020412844036697,
"config_test": false... |
__author__ = "Andrea Gavana <andrea.gavana@gmail.com>"
__date__ = "31 March 2009"
import wx
import auibook
from aui_constants import *
_ = wx.GetTranslation
#-----------------------------------------------------------------------------
# AuiMDIParentFrame
#---------------------------------------------... | {
"repo_name": "ktan2020/legacy-automation",
"path": "win/Lib/site-packages/wx-3.0-msw/wx/tools/Editra/src/extern/aui/tabmdi.py",
"copies": "2",
"size": "18715",
"license": "mit",
"hash": 7571448684468398000,
"line_mean": 26.1006006006,
"line_max": 97,
"alpha_frac": 0.550895004,
"autogenerated": fal... |
__author__ = 'Andrea'
from functions import encode
get_bin = lambda x: x >= 0 and str(bin(x))[2:] or "-" + str(bin(x))[3:]
class Pitch(object):
step = None
alter = None
def __init__(self, pitch): # pitch contructor
if pitch is not None:
self.step = pitch.find('step')
sel... | {
"repo_name": "AndreaDellera/Tesi",
"path": "music-rnn/modules/classes.py",
"copies": "1",
"size": "1214",
"license": "apache-2.0",
"hash": -8366686274255318000,
"line_mean": 25.9777777778,
"line_max": 71,
"alpha_frac": 0.6021416804,
"autogenerated": false,
"ratio": 3.7353846153846155,
"config_... |
__author__ = 'Andrea'
import xml.etree.ElementTree as ET
import glob
from modules.functions import create_binary_dataset, create_int_dataset
from modules.myBackProp import myBackpropTrainer
from modules.classes import Note
from modules.functions import create_network, train_network, binary_to_int_note
from pybrain.str... | {
"repo_name": "AndreaDellera/Tesi",
"path": "music-rnn/train_rnn.py",
"copies": "1",
"size": "2985",
"license": "apache-2.0",
"hash": -6692384231381265000,
"line_mean": 32.5393258427,
"line_max": 119,
"alpha_frac": 0.642881072,
"autogenerated": false,
"ratio": 3.5663082437275984,
"config_test":... |
__author__ = 'Andrea'
import xml.etree.ElementTree as ET
import glob
from pybrain.tools.xml.networkreader import NetworkReader
from modules.classes import Note
from modules.buildXML import create_music_xml
from modules.functions import decode, binary_to_int_note, int_to_binary_note
import random
def main():
divi... | {
"repo_name": "AndreaDellera/Tesi",
"path": "music-rnn/use_rnn.py",
"copies": "1",
"size": "2958",
"license": "apache-2.0",
"hash": 7579350858764074000,
"line_mean": 33,
"line_max": 119,
"alpha_frac": 0.4847870183,
"autogenerated": false,
"ratio": 3.297658862876254,
"config_test": false,
"has... |
__author__ = 'Andrea'
import xml.etree.ElementTree as ET
def indent(elem, level=0):
i = "\n" + level * " "
if len(elem):
if not elem.text or not elem.text.strip():
elem.text = i + " "
if not elem.tail or not elem.tail.strip():
elem.tail = i
for elem in elem:
... | {
"repo_name": "AndreaDellera/Tesi",
"path": "music-rnn/modules/buildXML.py",
"copies": "1",
"size": "5299",
"license": "apache-2.0",
"hash": -8131470667182445000,
"line_mean": 35.7986111111,
"line_max": 125,
"alpha_frac": 0.4614078128,
"autogenerated": false,
"ratio": 3.3474415666456094,
"confi... |
__author__ = 'Andrean'
from models import BaseModel
from models.contractor import Contractor
from bson.objectid import ObjectId
import defs
import schedule
import datetime
import time
class DataItem(BaseModel, defs.StoppableThread):
StorageName = 'data_items'
def __init__(self, item):
BaseModel.__i... | {
"repo_name": "Andrean/lemon.apple",
"path": "agent/models/data_item.py",
"copies": "1",
"size": "1935",
"license": "mit",
"hash": 8324499501989275000,
"line_mean": 25.5068493151,
"line_max": 96,
"alpha_frac": 0.5684754522,
"autogenerated": false,
"ratio": 3.824110671936759,
"config_test": fals... |
__author__ = 'Andrean'
from modules.base import BaseServerModule
import core
import uuid
import bson.objectid
import models.components
import defs.cmd
import datetime
class Manager(BaseServerModule):
def __init__(self, _core):
super().__init__(_core, 'Manager')
self._storage = None
self.... | {
"repo_name": "Andrean/lemon.apple",
"path": "server/modules/manager.py",
"copies": "1",
"size": "1487",
"license": "mit",
"hash": -5484495433502313000,
"line_mean": 26.0545454545,
"line_max": 58,
"alpha_frac": 0.6583725622,
"autogenerated": false,
"ratio": 4.285302593659942,
"config_test": fal... |
__author__ = 'Andrean'
from modules.base import BaseServerModule
import logging
# module variables
Instance = None
class Core(object):
'''
Core class. It keeps all working instances of Lemon server
'''
Config = {}
# core components
modules = {}
def __init__(self, config=None):
se... | {
"repo_name": "Andrean/lemon.apple",
"path": "server/core.py",
"copies": "1",
"size": "1302",
"license": "mit",
"hash": 5122647046047314000,
"line_mean": 25.04,
"line_max": 72,
"alpha_frac": 0.6152073733,
"autogenerated": false,
"ratio": 4.325581395348837,
"config_test": false,
"has_no_keywor... |
__author__ = 'Andrean'
from modules.base import BaseServerModule
import router
######################################################################
# Server
# Run all registered Listeners
######################################################################
class Server(BaseServerModule):
def __init__(self... | {
"repo_name": "Andrean/lemon.apple",
"path": "server/modules/server.py",
"copies": "1",
"size": "3737",
"license": "mit",
"hash": 7150717911953201000,
"line_mean": 32.9818181818,
"line_max": 81,
"alpha_frac": 0.5726518598,
"autogenerated": false,
"ratio": 4.386150234741784,
"config_test": false... |
__author__ = 'Andrean'
from modules import BaseAgentModule
import bson.json_util
import datetime
import json
import threading
import traceback
import time
import commands
import os
import sys
import schedule
import subprocess
import defs.cmd
import queue
import core
import defs
import defs.scheduler
import hashlib
CO... | {
"repo_name": "Andrean/lemon.apple",
"path": "agent/modules/managers.py",
"copies": "1",
"size": "2014",
"license": "mit",
"hash": -1856222869657222100,
"line_mean": 27.3661971831,
"line_max": 88,
"alpha_frac": 0.6027805362,
"autogenerated": false,
"ratio": 4.436123348017621,
"config_test": fal... |
__author__ = 'Andrean'
from modules import BaseAgentModule
import http.client
import defs.errors
from queue import Queue, Empty, Full
import threading
import re
import time
import json
import bson.json_util
ClientLock = threading.Lock()
def ParseBody(response):
# get content type. If not found use default "text/... | {
"repo_name": "Andrean/lemon.apple",
"path": "agent/modules/client.py",
"copies": "1",
"size": "5795",
"license": "mit",
"hash": -8900827460323041000,
"line_mean": 36.6298701299,
"line_max": 120,
"alpha_frac": 0.5972389991,
"autogenerated": false,
"ratio": 4.2299270072992705,
"config_test": fal... |
__author__ = 'Andrean'
from modules import BaseAgentModule
import os
import socket
import shelve
import uuid
class Storage(BaseAgentModule):
Name = "Storage"
def __init__(self, core):
super().__init__(core)
def start(self):
self._logger.info('Load Database on {0}'.format(self._config['d... | {
"repo_name": "Andrean/lemon.apple",
"path": "agent/modules/storage.py",
"copies": "1",
"size": "1281",
"license": "mit",
"hash": 4856130358764286000,
"line_mean": 30.243902439,
"line_max": 98,
"alpha_frac": 0.5807962529,
"autogenerated": false,
"ratio": 3.578212290502793,
"config_test": false,... |
__author__ = 'Andrean'
from threading import Thread, Event
class IntervalTimer(Thread):
"""Call a function after a specified number of seconds:
t = Timer(30.0, f, args=None, kwargs=None)
t.start()
t.cancel() # stop the timer's action if it's still waiting
"""
de... | {
"repo_name": "Andrean/lemon.apple",
"path": "agent/defs/scheduler.py",
"copies": "1",
"size": "1068",
"license": "mit",
"hash": -8381013808918403000,
"line_mean": 29.5428571429,
"line_max": 81,
"alpha_frac": 0.5664794007,
"autogenerated": false,
"ratio": 4.254980079681275,
"config_test": false... |
__author__ = 'Andrean'
from types import *
def binary_search(arr, x, comparator=None, strict=True, low=0, high=None):
"""
:param arr: sorted list of elements
:param x: searched element or compare forEach function, which returns 1, 0, -1
:param strict: if True don't look for strict comparison. Return... | {
"repo_name": "Andrean/lemon.apple",
"path": "agent/defs/search.py",
"copies": "2",
"size": "1092",
"license": "mit",
"hash": 2459837236213403000,
"line_mean": 27.0256410256,
"line_max": 107,
"alpha_frac": 0.5512820513,
"autogenerated": false,
"ratio": 3.9565217391304346,
"config_test": false,
... |
__author__ = 'Andrean'
import controllers.web as webController
#####################################################################################
# Routes for routing request from WEB-Server as web-interface
#####################################################################################
ROUTES = [
[ ... | {
"repo_name": "Andrean/lemon.apple",
"path": "server/routes/web_interface.py",
"copies": "1",
"size": "1900",
"license": "mit",
"hash": 7973573752059263000,
"line_mean": 72.0769230769,
"line_max": 98,
"alpha_frac": 0.4384210526,
"autogenerated": false,
"ratio": 3.125,
"config_test": false,
"h... |
__author__ = 'Andrean'
import copy
import bson
import bson.objectid
import bson.dbref
import core
class BaseModel(object):
Schema = None
Collection = None
Instances = None
virtual = None
_index_objectId = None
def __init__(self, item=None):
self.virtual = {}
self._dbref = {}
... | {
"repo_name": "Andrean/lemon.apple",
"path": "server/models/base.py",
"copies": "1",
"size": "9436",
"license": "mit",
"hash": -5046275190196652000,
"line_mean": 29.2467948718,
"line_max": 97,
"alpha_frac": 0.5162144977,
"autogenerated": false,
"ratio": 4.177069499778663,
"config_test": false,
... |
__author__ = 'Andrean'
import core
from bson.objectid import ObjectId
class BaseModel(object):
"""
Base class for classes that use Storage for save themselfs
"""
StorageName = "base"
Instances = {}
Core = core.Core
def __init__(self, item=None):
self._item = dict(id=ObjectId())
... | {
"repo_name": "Andrean/lemon.apple",
"path": "agent/models/__init__.py",
"copies": "1",
"size": "1225",
"license": "mit",
"hash": 8618749887143154000,
"line_mean": 23.0392156863,
"line_max": 91,
"alpha_frac": 0.587755102,
"autogenerated": false,
"ratio": 3.746177370030581,
"config_test": false,... |
__author__ = 'Andrean'
import core
import datetime
from defs.cmd import CommandStatusEnum as CmdStatus
import defs.request
@defs.request.prepare_agent_request
def get(req, res):
manager = core.Instance.Manager
agent = manager.agents.findByAgentId(req.agent_id)
if agent is None:
# agent not found.... | {
"repo_name": "Andrean/lemon.apple",
"path": "server/controllers/agent_controllers/commands.py",
"copies": "1",
"size": "1306",
"license": "mit",
"hash": -8379827172997960000,
"line_mean": 31.65,
"line_max": 75,
"alpha_frac": 0.6546707504,
"autogenerated": false,
"ratio": 3.5392953929539295,
"c... |
__author__ = 'Andrean'
import core
import defs.errors
import datetime
############################################################################
# GET data REQUEST
#
# query params:
# data_item : data_items object_id string.
# from : datetime string, returns data from that timestamp
# ... | {
"repo_name": "Andrean/lemon.apple",
"path": "server/controllers/web_controllers/data/chunk.py",
"copies": "1",
"size": "4444",
"license": "mit",
"hash": -3822373151258991600,
"line_mean": 40.1481481481,
"line_max": 109,
"alpha_frac": 0.5661566157,
"autogenerated": false,
"ratio": 3.4745895230648... |
__author__ = 'Andrean'
import core
import defs.errors
def get(req, res):
entities_id_list = req.query.get('entity_id')
names = req.query.get('name')
populate = req.query.get('populate',[])
manager = core.Instance.Manager
if entities_id_list is not None:
entities_id = [x.id for x in manage... | {
"repo_name": "Andrean/lemon.apple",
"path": "server/controllers/web_controllers/data/items.py",
"copies": "1",
"size": "1815",
"license": "mit",
"hash": -2798767439631429600,
"line_mean": 32.6111111111,
"line_max": 115,
"alpha_frac": 0.5878787879,
"autogenerated": false,
"ratio": 3.4903846153846... |
__author__ = 'Andrean'
import core
import defs.errors
def get(req, res):
names = req.query.get('name')
short = req.query.get('short', ["0"])[0]
contractors = []
manager = core.Instance.Manager
if names is not None:
contractors.extend(manager.contractors.list_instances({'name': { '$in': na... | {
"repo_name": "Andrean/lemon.apple",
"path": "server/controllers/web_controllers/contractors.py",
"copies": "1",
"size": "1520",
"license": "mit",
"hash": -5668473774393873000,
"line_mean": 30.6875,
"line_max": 89,
"alpha_frac": 0.6203947368,
"autogenerated": false,
"ratio": 3.7438423645320196,
... |
__author__ = 'Andrean'
import core
def select_properties(obj, properties):
if properties is None:
return obj
if type(obj) is list:
return [select_properties(x, properties) for x in obj]
if type(obj) is dict:
new_obj = {}
for p in properties:
if p in obj:
... | {
"repo_name": "Andrean/lemon.apple",
"path": "server/controllers/web_controllers/agents.py",
"copies": "1",
"size": "1417",
"license": "mit",
"hash": 6515910810929958000,
"line_mean": 27.34,
"line_max": 89,
"alpha_frac": 0.5455187015,
"autogenerated": false,
"ratio": 3.9035812672176307,
"config... |
__author__ = 'Andrean'
import core
################################################################
#
#
# """
# Entities management controllers:
# add: add new entity to database
# remove: remove entity from database
# get: get list of entities by filter
# filter:
# ... | {
"repo_name": "Andrean/lemon.apple",
"path": "server/controllers/web_controllers/entitiies.py",
"copies": "1",
"size": "4339",
"license": "mit",
"hash": -3356265618147779000,
"line_mean": 32.3846153846,
"line_max": 85,
"alpha_frac": 0.5561189214,
"autogenerated": false,
"ratio": 4.2373046875,
"... |
__author__ = 'Andrean'
import datetime
import defs.cmd
import uuid
import hashlib
from defs.search import binary_search
from bson.objectid import ObjectId
from bson.binary import Binary
from models.base import BaseModel, BaseSchema
def SetupSchema():
AgentSchema.setup()
EntitySchema.setup()
DataItemSchem... | {
"repo_name": "Andrean/lemon.apple",
"path": "server/models/components.py",
"copies": "1",
"size": "20639",
"license": "mit",
"hash": 300086939539760830,
"line_mean": 31.4512578616,
"line_max": 111,
"alpha_frac": 0.5086002229,
"autogenerated": false,
"ratio": 4.1711802748585285,
"config_test": ... |
__author__ = 'Andrean'
import defs.cmd
import threading
import traceback
import sys
import logging
import time
from commands.routes import Routes
class CommandManager(threading.Thread):
def __init__(self):
super().__init__()
self.mutex = threading.Lock()
self._stop_event = threading.Even... | {
"repo_name": "Andrean/lemon.apple",
"path": "agent/commands/__init__.py",
"copies": "1",
"size": "3483",
"license": "mit",
"hash": 2135814522165558000,
"line_mean": 29.2869565217,
"line_max": 121,
"alpha_frac": 0.5661785817,
"autogenerated": false,
"ratio": 4.146428571428571,
"config_test": fa... |
__author__ = 'Andrean'
import enum
from datetime import datetime
from uuid import uuid4
import copy
class BaseCommands(enum.Enum):
get_info = "_.get_info"
class CommandStatusEnum(enum.IntEnum):
error = -1
present = 0
submit = 1
pending = 2
completed = 3
class Command(object):
def __i... | {
"repo_name": "Andrean/lemon.apple",
"path": "agent/defs/cmd.py",
"copies": "1",
"size": "2126",
"license": "mit",
"hash": 8942529644034486000,
"line_mean": 23.7325581395,
"line_max": 78,
"alpha_frac": 0.5432737535,
"autogenerated": false,
"ratio": 3.736379613356766,
"config_test": false,
"ha... |
__author__ = 'Andrean'
import logging
from modules import BaseAgentModule
class Core(object):
'''
Core class. It keeps all working instances of Lemon agent
Core is Singleton
'''
Instance = None
Config = {}
# core components
modules = {}
def __new__(cls, *args, **kwargs):
... | {
"repo_name": "Andrean/lemon.apple",
"path": "agent/core.py",
"copies": "1",
"size": "1457",
"license": "mit",
"hash": -7054676136920901000,
"line_mean": 25.5090909091,
"line_max": 73,
"alpha_frac": 0.5998627316,
"autogenerated": false,
"ratio": 4.162857142857143,
"config_test": false,
"has_n... |
__author__ = 'Andrean'
import logging
from urllib.parse import urlsplit
from urllib.parse import parse_qs
import json
import types
import re
import traceback
import sys
import pymongo.errors
import bson.json_util
import defs.errors as errors
import controllers.base as BaseController
import routes.web_interface as we... | {
"repo_name": "Andrean/lemon.apple",
"path": "server/router.py",
"copies": "1",
"size": "5187",
"license": "mit",
"hash": -7815196142279639000,
"line_mean": 35.7943262411,
"line_max": 116,
"alpha_frac": 0.5984191247,
"autogenerated": false,
"ratio": 4.065047021943574,
"config_test": false,
"h... |
__author__ = 'Andrean'
import os
import yaml
import logging.config
class Config(object):
'''
Class keeps all configuration of lemon server
Has methods for loading configuration
'''
Storage = {}
Server = {}
Manager = {}
root = {}
def __init__(self, file = None):
self.fi... | {
"repo_name": "Andrean/lemon.apple",
"path": "server/config.py",
"copies": "1",
"size": "1037",
"license": "mit",
"hash": 5385112532223675000,
"line_mean": 27.0540540541,
"line_max": 79,
"alpha_frac": 0.5911282546,
"autogenerated": false,
"ratio": 3.9884615384615385,
"config_test": true,
"has... |
__author__ = 'Andrean'
import pymongo
import pymongo.errors
from modules.base import BaseServerModule
class Storage(BaseServerModule):
def __init__(self, _core):
super().__init__(_core, 'Storage')
self._logger.info("Created")
self._client = None
self._connection = None
def st... | {
"repo_name": "Andrean/lemon.apple",
"path": "server/modules/storage.py",
"copies": "1",
"size": "1663",
"license": "mit",
"hash": -8601493709911638000,
"line_mean": 30.9807692308,
"line_max": 82,
"alpha_frac": 0.5814792544,
"autogenerated": false,
"ratio": 4.387862796833773,
"config_test": fal... |
__author__ = 'Andrean'
import yaml
import logging
import logging.config
import os
class Config(object):
'''
Class keeps all configuration of lemon agent
Has methods for loading configuration
'''
Storage = {}
Client = {}
Manager = {}
root = {}
def __init__(self, file = None):
... | {
"repo_name": "Andrean/lemon.apple",
"path": "agent/config.py",
"copies": "1",
"size": "1053",
"license": "mit",
"hash": 8271679026193397000,
"line_mean": 26,
"line_max": 79,
"alpha_frac": 0.5935422602,
"autogenerated": false,
"ratio": 3.9886363636363638,
"config_test": true,
"has_no_keywords... |
__author__ = 'Andrean'
from models import BaseModel
import os
import subprocess
import hashlib
import json
import bson.json_util
import traceback
import sys
class Contractor(BaseModel):
StorageName = 'contractors'
Directory = './contractors'
def __init__(self, item=None):
super().__init__(item... | {
"repo_name": "Andrean/lemon.apple",
"path": "agent/models/contractor.py",
"copies": "1",
"size": "3151",
"license": "mit",
"hash": -5193423621334552000,
"line_mean": 25.2583333333,
"line_max": 120,
"alpha_frac": 0.5483973342,
"autogenerated": false,
"ratio": 4.055341055341056,
"config_test": f... |
import random
import os
import numpy as np
import math
import imp
try:
imp.find_module('PIL')
found = True
except ImportError:
found = False
if found:
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
else:
import Image
import ImageDraw
import ImageFont
de... | {
"repo_name": "knightwu/easy_word_cloud",
"path": "easywordcloud/layout_cloud.py",
"copies": "1",
"size": "10818",
"license": "mit",
"hash": 5978409888694708000,
"line_mean": 32.80625,
"line_max": 124,
"alpha_frac": 0.6112035496,
"autogenerated": false,
"ratio": 3.468419365181148,
"config_test"... |
import os
import re
from .layout_cloud import *
STOPWORDS = set([x.strip() for x in open(os.path.join(os.path.dirname(__file__),
'stopwords')).read().split('\n')])
def process_text(text, max_features=200, stopwords=None):
"""Splits a long text into words, el... | {
"repo_name": "knightwu/easy_word_cloud",
"path": "easywordcloud/__init__.py",
"copies": "1",
"size": "1886",
"license": "mit",
"hash": 3344796932879659000,
"line_mean": 25.5633802817,
"line_max": 88,
"alpha_frac": 0.5572640509,
"autogenerated": false,
"ratio": 3.6339113680154145,
"config_test"... |
from random import Random
import os
import re
import sys
import numpy as np
from operator import itemgetter
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
from .query_integral_image import query_integral_image
item1 = itemgetter(1)
FONT_PATH = os.environ.get("FONT_PATH", "/usr/share/fonts... | {
"repo_name": "Nespa32/sm_project",
"path": "wordcloud_gen/wordcloud_package/wordcloud/wordcloud.py",
"copies": "1",
"size": "14076",
"license": "mit",
"hash": 1665463907156999000,
"line_mean": 33.4156479218,
"line_max": 96,
"alpha_frac": 0.5522875817,
"autogenerated": false,
"ratio": 4.274521712... |
import random
import os
import sys
import re
import numpy as np
from operator import itemgetter
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
from query_integral_image import query_integral_image
item1 = itemgetter(1)
FONT_PATH = "/usr/share/fonts/truetype/droid/DroidSansMono.ttf"
STOPWO... | {
"repo_name": "0x0all/word_cloud",
"path": "wordcloud/__init__.py",
"copies": "1",
"size": "7470",
"license": "mit",
"hash": -4406113394378494000,
"line_mean": 32.2,
"line_max": 80,
"alpha_frac": 0.577643909,
"autogenerated": false,
"ratio": 3.8825363825363826,
"config_test": false,
"has_no_k... |
import random
import os
import sys
import re
import numpy as np
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
from query_integral_image import query_integral_image
FONT_PATH = "/Library/Fonts/Krungthep.ttf"
STOPWORDS = set([x.strip() for x in open(os.path.join(os.path.dirname(__file__),
... | {
"repo_name": "OculusCam/word_cloud-master",
"path": "wordcloud/__init__.py",
"copies": "1",
"size": "7275",
"license": "mit",
"hash": -4389913618703979000,
"line_mean": 32.5253456221,
"line_max": 80,
"alpha_frac": 0.5802061856,
"autogenerated": false,
"ratio": 3.835002635740643,
"config_test":... |
import random,os
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import numpy as np
from query_integral_image import query_integral_image
# FONT_PATH = "C:/Python33/Lib/site-packages/matplotlib/mpl-data/fonts/ttf/vera.ttf"
FONT_PATH = "C:/Python35/Lib/site-packages/pytagcloud-0.3.5-py3.3.e... | {
"repo_name": "socialsensor/community-evolution-analysis",
"path": "python/wordcloud.py",
"copies": "1",
"size": "6355",
"license": "apache-2.0",
"hash": 1853670372998237200,
"line_mean": 35.9476744186,
"line_max": 101,
"alpha_frac": 0.6177812746,
"autogenerated": false,
"ratio": 3.83756038647343... |
import random
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import os
import numpy as np
from query_integral_image import query_integral_image
FONT_PATH = "/usr/share/fonts/truetype/droid/DroidSansMono.ttf"
#Colors = [[[79,84,75],[0,0,95],[208,42,95],[207,18,97]]]
def make_wordcloud(wo... | {
"repo_name": "A-Malone/twitter-reader",
"path": "wordcloud.py",
"copies": "1",
"size": "6650",
"license": "mit",
"hash": -8772611126088052000,
"line_mean": 34.9459459459,
"line_max": 109,
"alpha_frac": 0.589924812,
"autogenerated": false,
"ratio": 3.9748953974895396,
"config_test": false,
"h... |
import random
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import numpy as np
from query_integral_image import query_integral_image
FONT_PATH = "/usr/share/fonts/truetype/droid/DroidSansMono.ttf"
def make_wordcloud(words, counts, fname, font_path=None, width=400, height=200,
... | {
"repo_name": "wikiteams/github-gender-studies",
"path": "sources/gender_checker/deprecated/wordcloud.py",
"copies": "1",
"size": "6536",
"license": "mit",
"hash": 4197254167002440700,
"line_mean": 34.5217391304,
"line_max": 79,
"alpha_frac": 0.5904222766,
"autogenerated": false,
"ratio": 4.01720... |
from __future__ import division
import warnings
from random import Random
import os
import re
import sys
import colorsys
import numpy as np
from operator import itemgetter
from PIL import Image
from PIL import ImageColor
from PIL import ImageDraw
from PIL import ImageFont
from .query_integral_image import query_int... | {
"repo_name": "Fuzzwah/word_cloud",
"path": "wordcloud/wordcloud.py",
"copies": "1",
"size": "24003",
"license": "mit",
"hash": -2489741705355119600,
"line_mean": 35.3131618759,
"line_max": 83,
"alpha_frac": 0.5633462484,
"autogenerated": false,
"ratio": 4.318639798488665,
"config_test": false,... |
from __future__ import division
import warnings
from random import Random
import os
import re
import sys
import colorsys
import numpy as np
import csv
from operator import itemgetter
from PIL import Image
from PIL import ImageColor
from PIL import ImageDraw
from PIL import ImageFont
from .query_integral_image impor... | {
"repo_name": "mohammadKhalifa/word_cloud",
"path": "wordcloud/wordcloud.py",
"copies": "1",
"size": "24776",
"license": "mit",
"hash": 1474414987696064800,
"line_mean": 35.4889543446,
"line_max": 83,
"alpha_frac": 0.5644171779,
"autogenerated": false,
"ratio": 4.3246639902251705,
"config_test"... |
import warnings
from random import Random
import os
import re
import sys
import colorsys
import numpy as np
from operator import itemgetter
from PIL import Image
from PIL import ImageColor
from PIL import ImageDraw
from PIL import ImageFont
from .query_integral_image import query_integral_image
item1 = itemgetter(1... | {
"repo_name": "gfarrenkopf/debateScraper",
"path": "wordcloud/wordcloud.py",
"copies": "1",
"size": "19566",
"license": "apache-2.0",
"hash": 8954719847517168000,
"line_mean": 34.9669117647,
"line_max": 95,
"alpha_frac": 0.5607686804,
"autogenerated": false,
"ratio": 4.259033521985198,
"config_... |
import warnings
from random import Random
import os
import re
import sys
import numpy as np
from operator import itemgetter
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
from .query_integral_image import query_integral_image
item1 = itemgetter(1)
FONT_PATH = os.environ.get("FONT_PATH", "... | {
"repo_name": "staticor/word_cloud",
"path": "wordcloud/wordcloud.py",
"copies": "1",
"size": "15751",
"license": "mit",
"hash": 2479185870301739500,
"line_mean": 33.3159041394,
"line_max": 97,
"alpha_frac": 0.5474573043,
"autogenerated": false,
"ratio": 4.340314136125654,
"config_test": false,... |
import warnings
from random import Random
import os
import re
import sys
import colorsys
import numpy as np
from operator import itemgetter
from PIL import Image
from PIL import ImageColor
from PIL import ImageDraw
from PIL import ImageFont
from .query_integral_image import query_integral_image
item1 = itemgetter(1... | {
"repo_name": "wbuntine/topic-models",
"path": "HCA/scripts/wordcloud.py",
"copies": "1",
"size": "19288",
"license": "mpl-2.0",
"hash": -1363906104636043000,
"line_mean": 35.6692015209,
"line_max": 110,
"alpha_frac": 0.56268146,
"autogenerated": false,
"ratio": 4.196692776327241,
"config_test"... |
__author__ = 'Andreas Krohn (andreas.krohn@haw-hamburg.de)'
import logging
import pycares
import select
import traceback
class PycaDns(object):
"""
>>> w = PycaDns()
>>> w.ptr('8.8.8.8')
>>> w.query_a('heise.de')
>>> w.query_aaaa('heise.de')
>>> w.query_a('time1.google.com')
>>> w.query_a... | {
"repo_name": "hamburger1984/pycadns",
"path": "src/pycadns.py",
"copies": "1",
"size": "5232",
"license": "mit",
"hash": 3015746169699168000,
"line_mean": 32.3248407643,
"line_max": 76,
"alpha_frac": 0.5303899083,
"autogenerated": false,
"ratio": 3.4694960212201593,
"config_test": false,
"ha... |
__author__ = 'Andreas M. Wahl'
import logging
from pymongo import MongoClient
import yaml
import configurator.util.util as util
import subprocess
logging.basicConfig(level=logging.WARN)
LOG = logging.getLogger(__name__)
class PersistenceManager:
def __init__(self, config):
"""
:param config: di... | {
"repo_name": "ClockworkOrigins/m2etis",
"path": "configurator/configurator/persistence/PersistenceManager.py",
"copies": "1",
"size": "5140",
"license": "apache-2.0",
"hash": 6067373990857754000,
"line_mean": 38.8527131783,
"line_max": 209,
"alpha_frac": 0.6278210117,
"autogenerated": false,
"ra... |
__author__ = 'Andreas M. Wahl'
import matplotlib.pyplot as plt
import configurator.util.util as util
from matplotlib import cm
from mpl_toolkits.mplot3d import *
import numpy as np
class Plotter:
def __init__(self, persistence=None):
self.persistence = persistence
def plot2d_from_memory(self, result... | {
"repo_name": "ClockworkOrigins/m2etis",
"path": "configurator/configurator/visualization/Plotter.py",
"copies": "1",
"size": "6177",
"license": "apache-2.0",
"hash": 5376084422401489000,
"line_mean": 41.8958333333,
"line_max": 138,
"alpha_frac": 0.5918730775,
"autogenerated": false,
"ratio": 3.7... |
__author__ = 'andreasveit'
__version__ = '1.1'
# Interface for accessing the COCO-Text dataset.
# COCO-Text is a large dataset designed for text detection and recognition.
# This is a Python API that assists in loading, parsing and visualizing the
# annotations. The format of the COCO-Text annotations is also d... | {
"repo_name": "NehaTelhan/CompVisionFinalProj",
"path": "coco_text.py",
"copies": "1",
"size": "9765",
"license": "mit",
"hash": 7490864213190402000,
"line_mean": 41.9864864865,
"line_max": 150,
"alpha_frac": 0.5853558628,
"autogenerated": false,
"ratio": 3.675197591268348,
"config_test": false... |
__author__ = 'andreasveit'
__version__ = '1.3'
# Interface for evaluating with the COCO-Text dataset.
# COCO-Text is a large dataset designed for text detection and recognition.
# This is a Python API that assists in evaluating text detection and recognition results
# on COCO-Text. The format of the COCO-Text... | {
"repo_name": "NehaTelhan/CompVisionFinalProj",
"path": "coco_evaluation.py",
"copies": "1",
"size": "13162",
"license": "mit",
"hash": 8150403622984231000,
"line_mean": 35.3920454545,
"line_max": 174,
"alpha_frac": 0.6511168515,
"autogenerated": false,
"ratio": 2.884505807582731,
"config_test"... |
__author__ = 'Andrei'
import numpy as np
from chiffatools.linalg_routines import rm_nans
from scipy.stats import t, norm
from scipy.spatial.distance import pdist, squareform
from matplotlib import pyplot as plt
import os
drug_c_array = np.array([0]+[2**_i for _i in range(0, 9)])*0.5**8
def safe_dir_create(path):
... | {
"repo_name": "chiffa/Pharmacosensitivity_growth_assays",
"path": "src/supporting_functions.py",
"copies": "1",
"size": "10773",
"license": "bsd-3-clause",
"hash": 4521170662711522300,
"line_mean": 30.6852941176,
"line_max": 128,
"alpha_frac": 0.6231319038,
"autogenerated": false,
"ratio": 3.1592... |
class TekUsbtmc:
USBTMC_USR_WAVEFORM_NAME = ['USER1', 'USER2', 'USER3', 'USER4']
def __init__(self, device="/dev/usbtmc0"):
self.usbtmc = open(device, mode = "r+", buffering=0)
self.device = device
self.id = self.get_id()
print('Connected to: %s' % self.id)
def... | {
"repo_name": "duke-87/tekusbtmc",
"path": "tekusbtmc.py",
"copies": "1",
"size": "3784",
"license": "mit",
"hash": -6909145907106680000,
"line_mean": 31.6206896552,
"line_max": 105,
"alpha_frac": 0.5103065539,
"autogenerated": false,
"ratio": 3.8890030832476876,
"config_test": false,
"has_no... |
__author__ = 'Andrej Frank'
__version__ = '1.0.0'
import sys
from PyQt5 import QtWidgets, uic
from threading import Thread
from time import sleep
import libraries.icon_rc as icon_rc
class Frontend(QtWidgets.QMainWindow):
def __init__(self):
QtWidgets.QMainWindow.__init__(self)
# PyQt Designer La... | {
"repo_name": "vibe-x/robotic",
"path": "modules/Frontend.py",
"copies": "1",
"size": "3502",
"license": "apache-2.0",
"hash": 4691362124590617000,
"line_mean": 31.4166666667,
"line_max": 93,
"alpha_frac": 0.6183947444,
"autogenerated": false,
"ratio": 3.7403846153846154,
"config_test": false,
... |
__author__ = "Andre Merzky, Mark Santcroos"
__copyright__ = "Copyright 2015, The SAGA Project"
__license__ = "MIT"
'''This examples shows how to use the saga.Filesystem API
with the Globus Online file adaptor.
If something doesn't work as expected, try to set
SAGA_VERBOSE=3 in your environment before yo... | {
"repo_name": "luis-rr/saga-python",
"path": "examples/files/go_file_copy.py",
"copies": "2",
"size": "2066",
"license": "mit",
"hash": -1590165464214849300,
"line_mean": 31.7936507937,
"line_max": 77,
"alpha_frac": 0.6214908035,
"autogenerated": false,
"ratio": 3.3758169934640523,
"config_test... |
__author__ = "Andre Merzky, Ole Weidner, Mark Santcroos"
__copyright__ = "Copyright 2012-2015, The SAGA Project"
__license__ = "MIT"
""" PBSPro job adaptor implementation
"""
import threading
import saga.url as surl
import saga.utils.pty_shell as sups
import saga.adaptors.base
import saga.adaptors.... | {
"repo_name": "telamonian/saga-python",
"path": "src/saga/adaptors/pbspro/pbsprojob.py",
"copies": "1",
"size": "48804",
"license": "mit",
"hash": 1279092145485413400,
"line_mean": 36.2549618321,
"line_max": 192,
"alpha_frac": 0.4738546021,
"autogenerated": false,
"ratio": 3.941209723007349,
"c... |
__author__ = "Andre Merzky, Ole Weidner"
__copyright__ = "Copyright 2012-2013, The SAGA Project"
__license__ = "MIT"
# -*- coding: utf-8 -*-
#
# SAGA documentation build configuration file, created by
# sphinx-quickstart on Mon Dec 3 21:55:42 2012.
#
# This file is execfile()d with the current directory set to ... | {
"repo_name": "mehdisadeghi/saga-python",
"path": "docs/source/conf.py",
"copies": "2",
"size": "8775",
"license": "mit",
"hash": 3204425639367200000,
"line_mean": 31.1428571429,
"line_max": 215,
"alpha_frac": 0.704957265,
"autogenerated": false,
"ratio": 3.666945256999582,
"config_test": true,... |
__author__ = 'Andre'
import codecs
import time
import logging
import sys
import os
from bs4 import BeautifulSoup
import progressbar as pb
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '../..'))
from text.corpus import Corpus
from text.document import Document
from text.sentence import Sentence
class AIM... | {
"repo_name": "AndreLamurias/IBEnt",
"path": "src/reader/aimed_corpus.py",
"copies": "1",
"size": "6527",
"license": "mit",
"hash": 873119241827266700,
"line_mean": 44.6503496503,
"line_max": 133,
"alpha_frac": 0.543741382,
"autogenerated": false,
"ratio": 3.7212086659064996,
"config_test": fal... |
__author__ = 'andre'
from cv.cv import CVUtil
from ocr.functions import call_tesseract
from patterns import Validator, file_get_contents, clean_dir
from os import listdir
from os.path import isfile, join, splitext
import argparse
import json
def main():
parser = argparse.ArgumentParser(description='Computer Visua... | {
"repo_name": "ocr-doacao/cvocr",
"path": "cvocr.py",
"copies": "1",
"size": "1248",
"license": "apache-2.0",
"hash": 4022691744927606000,
"line_mean": 32.7567567568,
"line_max": 115,
"alpha_frac": 0.6426282051,
"autogenerated": false,
"ratio": 3.565714285714286,
"config_test": false,
"has_no... |
__author__ = 'andre'
from datetime import datetime
def bin_search(lst, value):
if len(lst) == 0:
return 0
if value > lst[len(lst)-1][0]:
return len(lst)
l = 0
r = len(lst)
m = r/2
while r-l > 1:
if lst[m][0] > value:
r = m
else:
l = m
... | {
"repo_name": "andredalton/bcc",
"path": "2015/MAC0327/Desafios 1/p18.py",
"copies": "2",
"size": "1198",
"license": "apache-2.0",
"hash": -2750056946407635000,
"line_mean": 22.4901960784,
"line_max": 80,
"alpha_frac": 0.4716193656,
"autogenerated": false,
"ratio": 3.0100502512562812,
"config_t... |
__author__ = 'andre'
import cv2
import numpy as np
from matplotlib.pyplot import imshow, show
def adaptive_threshold(image_gray, blur=True, verbose=False):
if verbose:
print "Thresholding"
if blur:
img = cv2.medianBlur(image_gray, 3)
img = cv2.fastNlMeansDenoising(img, None, 10, 7, 21)... | {
"repo_name": "ocr-doacao/cvocr",
"path": "cv/util.py",
"copies": "1",
"size": "2423",
"license": "apache-2.0",
"hash": 7112405968890914000,
"line_mean": 32.2054794521,
"line_max": 100,
"alpha_frac": 0.6050350805,
"autogenerated": false,
"ratio": 3.2611036339165547,
"config_test": false,
"has... |
import random
import math
list = ["Hola", "no", "estoy", "aqui", "Javi", "assca"]
# Inplace shuffle
def shuffle(list):
for index in range(0, len(list)):
new_index = random.randint(0, len(list) - 1)
var = list[index]
list[index] = list[new_index]
list[new_index] = var
return list
# Stract form list shuffle
... | {
"repo_name": "asix7/RandomScripts",
"path": "shuffle.py",
"copies": "1",
"size": "1165",
"license": "mit",
"hash": -7808118374284280000,
"line_mean": 20.1818181818,
"line_max": 69,
"alpha_frac": 0.6763948498,
"autogenerated": false,
"ratio": 2.7411764705882353,
"config_test": false,
"has_no_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.