text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'Andres'
import pygame
from pygame.locals import *
pygame.init()
question = {
"YES": K_y,
"NO": K_n
}
arrow_keys = {
"UP": K_UP,
"DOWN": K_DOWN,
"LEFT": K_LEFT,
"RIGHT": K_RIGHT
}
system = {
"QUEUE": K_q,
"MUTE": K_m,
"=": K_EQUALS,
"K+": K_KP_PLUS,
"-": K_MI... | {
"repo_name": "mrnoodles/AI-Pygame",
"path": "keyboard.py",
"copies": "1",
"size": "3135",
"license": "cc0-1.0",
"hash": 4838398875690717000,
"line_mean": 19.3571428571,
"line_max": 90,
"alpha_frac": 0.5636363636,
"autogenerated": false,
"ratio": 3.3209745762711864,
"config_test": false,
"has... |
__author__ = 'AndrewAnnex'
from ctypes import CDLL, POINTER, c_bool, c_int, c_double, c_char, c_char_p, c_void_p
import os
sitePath = os.path.dirname(__file__)
sitePath = os.path.join(sitePath, 'spice.so')
libspice = CDLL(sitePath)
import SpiceyPy.support_types as stypes
# ###########################################... | {
"repo_name": "johnnycakes79/SpiceyPy",
"path": "SpiceyPy/libspice.py",
"copies": "1",
"size": "52181",
"license": "mit",
"hash": 5319636619395495000,
"line_mean": 65.472611465,
"line_max": 289,
"alpha_frac": 0.6189992526,
"autogenerated": false,
"ratio": 2.440759623930025,
"config_test": false... |
__author__ = 'AndrewAnnex'
import os
from six.moves import urllib
standardKernelList = ['pck00010.tpc', 'de421.bsp', 'gm_de431.tpc',
'naif0011.tls']
cwd = os.path.realpath(os.path.dirname(__file__))
def getKernel(url):
kernelName = url.split('/')[-1]
print('Downloading: {0}'.format(ker... | {
"repo_name": "johnnycakes79/SpiceyPy",
"path": "test/gettestkernels.py",
"copies": "3",
"size": "2464",
"license": "mit",
"hash": -8391637550945294000,
"line_mean": 36.9076923077,
"line_max": 110,
"alpha_frac": 0.6655844156,
"autogenerated": false,
"ratio": 2.997566909975669,
"config_test": tr... |
__author__ = 'AndrewAnnex'
# wrapper.py, a weak wrapper for libspice.py,
# here is where all the wrapper functions are located.
import ctypes
import SpiceyPy.support_types as stypes
from SpiceyPy.libspice import libspice
import functools
import numpy
##################################################################... | {
"repo_name": "johnnycakes79/SpiceyPy",
"path": "SpiceyPy/wrapper.py",
"copies": "1",
"size": "421663",
"license": "mit",
"hash": 561253660711987600,
"line_mean": 30.3644748587,
"line_max": 82,
"alpha_frac": 0.6689678724,
"autogenerated": false,
"ratio": 3.185247016165584,
"config_test": false,... |
__author__ = 'Andrew Ben'
class Message():
__messageId = -1
__subject = ''
__body = ''
__sender = ''
__recipients = []
__replyOptions = []
__callbackUrl = ''
def __init__(self):
pass
@property
def messageId(self):
return self.__messageId
@messageId.setter... | {
"repo_name": "onsetinc/onpage_hub_api_client_py",
"path": "onpage_hub_api_client/Message.py",
"copies": "1",
"size": "1490",
"license": "mit",
"hash": -6011084843042528000,
"line_mean": 17.1707317073,
"line_max": 35,
"alpha_frac": 0.5758389262,
"autogenerated": false,
"ratio": 4.257142857142857,... |
__author__ = "Andrew Hankinson (andrew.hankinson@mail.mcgill.ca)"
__version__ = "1.5"
__date__ = "2011"
__copyright__ = "Creative Commons Attribution"
__license__ = """The MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and assoc... | {
"repo_name": "WoLpH/pybagit",
"path": "pybagit/exceptions.py",
"copies": "1",
"size": "1960",
"license": "mit",
"hash": 7487800217309598000,
"line_mean": 31.131147541,
"line_max": 93,
"alpha_frac": 0.6591836735,
"autogenerated": false,
"ratio": 4.666666666666667,
"config_test": false,
"has_n... |
__author__ = 'Andrew Hawker <andrew.r.hawker@gmail.com>'
import calendar
import collections
import datetime
import functools
import logging
import re
import threading
import time
LOG = logging.getLogger(__name__)
DAY_NAME = dict((v.lower(),k) for k,v in enumerate(calendar.day_name)) #(ex: Monday, Tuesday, etc)
... | {
"repo_name": "geometalab/OSMTagFinder",
"path": "OSMTagFinder/utilities/crython.py",
"copies": "1",
"size": "8408",
"license": "mit",
"hash": -7479666036155662000,
"line_mean": 43.2526315789,
"line_max": 116,
"alpha_frac": 0.5309229305,
"autogenerated": false,
"ratio": 3.681260945709282,
"conf... |
__author__ = 'Andrew Hawker <andrew.r.hawker@gmail.com>'
import calendar
import functools
import logging
import re
import datetime
import threading
import collections
import multiprocessing
import time
LOG = logging.getLogger(__name__)
DAY_NAME = dict((v.lower(),k) for k,v in enumerate(calendar.day_name)) #(ex:... | {
"repo_name": "Answeror/yacron",
"path": "yacron/crython/crython.py",
"copies": "1",
"size": "9429",
"license": "mit",
"hash": -4224911497168276500,
"line_mean": 44.3317307692,
"line_max": 124,
"alpha_frac": 0.5290062573,
"autogenerated": false,
"ratio": 3.706367924528302,
"config_test": false,... |
#__all__ = ['Ugraph', 'GraphMatcher', 'DFS', 'GenError', 'GraphError', 'Disconnected', 'NotUndirected']
import sys
import copy
from operator import itemgetter
class GenError(Exception):
"""
An exception class containing string for error reporting.
"""
def __init__(self, err_msg):
self.er... | {
"repo_name": "smsaladi/moltemplate",
"path": "moltemplate/nbody_graph_search.py",
"copies": "2",
"size": "36992",
"license": "bsd-3-clause",
"hash": 4530047178893124600,
"line_mean": 37.1360824742,
"line_max": 128,
"alpha_frac": 0.5618512111,
"autogenerated": false,
"ratio": 3.9207207207207206,
... |
espt_delim_atom_fields = set(["pos", "type", "v", "f",
"bond",
"temp", "gamma",
"q",
"quat", "omega", "torque",
"rinertia", "fix", "unfix", "ext_force",
... | {
"repo_name": "smsaladi/moltemplate",
"path": "moltemplate/ettree_styles.py",
"copies": "2",
"size": "3070",
"license": "bsd-3-clause",
"hash": 8515121000895741000,
"line_mean": 25.2393162393,
"line_max": 78,
"alpha_frac": 0.4892508143,
"autogenerated": false,
"ratio": 3.7995049504950495,
"conf... |
try:
from .nbody_graph_search import Ugraph
except (ImportError, SystemError, ValueError):
# not installed as a package
from nbody_graph_search import Ugraph
# This file defines how 3-body angle interactions are generated by moltemplate
# by default. It can be overridden by supplying your own custom fi... | {
"repo_name": "smsaladi/moltemplate",
"path": "moltemplate/nbody_Angles.py",
"copies": "2",
"size": "2608",
"license": "bsd-3-clause",
"hash": -375113655826202900,
"line_mean": 41.064516129,
"line_max": 79,
"alpha_frac": 0.6844325153,
"autogenerated": false,
"ratio": 3.6475524475524477,
"config... |
try:
from .nbody_graph_search import Ugraph
except (ImportError, SystemError, ValueError):
# not installed as a package
from nbody_graph_search import Ugraph
# This file defines how dihedral interactions are generated by moltemplate.sh
# by default. It can be overridden by supplying your own custom file... | {
"repo_name": "smsaladi/moltemplate",
"path": "moltemplate/nbody_Dihedrals.py",
"copies": "2",
"size": "2673",
"license": "bsd-3-clause",
"hash": 8700546616481787000,
"line_mean": 41.4285714286,
"line_max": 79,
"alpha_frac": 0.6711560045,
"autogenerated": false,
"ratio": 3.5783132530120483,
"co... |
try:
from .nbody_graph_search import Ugraph
except (ImportError, SystemError, ValueError):
# not installed as a package
from nbody_graph_search import Ugraph
# This file defines how improper interactions are generated by moltemplate.sh
# by default. It can be overridden by supplying your own custom file
... | {
"repo_name": "smsaladi/moltemplate",
"path": "moltemplate/nbody_Impropers.py",
"copies": "2",
"size": "3141",
"license": "bsd-3-clause",
"hash": 1330578588708679700,
"line_mean": 43.8714285714,
"line_max": 86,
"alpha_frac": 0.6701687361,
"autogenerated": false,
"ratio": 3.6565774155995343,
"co... |
import random, math
from collections import deque
from array import array
#try:
# from StringIO import StringIO
#except ImportError:
# from io import StringIO
try:
from .ttree_lex import InputError, ErrorLeader, OSrcLoc
except (ImportError, SystemError, ValueError):
# not installed as a package
fro... | {
"repo_name": "jewettaij/moltemplate",
"path": "moltemplate/ttree_matrix_stack.py",
"copies": "2",
"size": "45848",
"license": "mit",
"hash": -8679125560011440000,
"line_mean": 43.5126213592,
"line_max": 125,
"alpha_frac": 0.4497251789,
"autogenerated": false,
"ratio": 3.3677097105920377,
"conf... |
__author__ = "andrew.kelleher@buzzfeed.com (Andrew Kelleher)"
try:
from setuptools import setup, find_packages
except ImportError:
import distribute_setup
distribute_setup.use_setuptools()
from setuptools import setup, find_packages
setup(
name='caliendo',
version='2.1.10',
packages=find_packages(... | {
"repo_name": "buzzfeed/caliendo",
"path": "setup.py",
"copies": "1",
"size": "1090",
"license": "mit",
"hash": 518202945162082050,
"line_mean": 35.3333333333,
"line_max": 134,
"alpha_frac": 0.7009174312,
"autogenerated": false,
"ratio": 3.892857142857143,
"config_test": true,
"has_no_keyword... |
__author__ = "andrew.kelleher@buzzfeed.com (Andrew Kelleher)"
try:
from setuptools import setup, find_packages
except ImportError:
import distribute_setup
distribute_setup.use_setuptools()
from setuptools import setup, find_packages
setup(
name='phonon',
version='2.0',
packages=find_packag... | {
"repo_name": "buzzfeed/phonon",
"path": "setup.py",
"copies": "1",
"size": "1090",
"license": "mit",
"hash": 8174148387518866000,
"line_mean": 30.1428571429,
"line_max": 97,
"alpha_frac": 0.6486238532,
"autogenerated": false,
"ratio": 3.5737704918032787,
"config_test": false,
"has_no_keyword... |
from __future__ import print_function, division
from decimal import Decimal
import numpy as np
from obspy import UTCDateTime
from PyQt5 import QtWidgets, QtGui, QtCore
import pyqtgraph as pg
from CustomFunctions import getTimeFromFileName
# Custom axis labels for the archive widget
class TimeAxisItemArchive(pg.AxisIt... | {
"repo_name": "AndrewReynen/Lazylyst",
"path": "lazylyst/TemporalWidgets.py",
"copies": "1",
"size": "22412",
"license": "mit",
"hash": -9117689433098825000,
"line_mean": 42.019193858,
"line_max": 132,
"alpha_frac": 0.6252900232,
"autogenerated": false,
"ratio": 3.6206785137318254,
"config_test... |
from __future__ import print_function, division
import time
import numpy as np
from PyQt5 import QtGui,QtCore,QtWidgets
import pyqtgraph as pg
# Scatter Item class, but allow double click signal
class CustScatter(pg.ScatterPlotItem):
doubleClicked=QtCore.Signal(object)
def __init__(self, *args, **kwargs)... | {
"repo_name": "AndrewReynen/Lazylyst",
"path": "lazylyst/MapWidgets.py",
"copies": "1",
"size": "13437",
"license": "mit",
"hash": 8888782491449667000,
"line_mean": 39.7212121212,
"line_max": 116,
"alpha_frac": 0.629902508,
"autogenerated": false,
"ratio": 3.8424363740348872,
"config_test": fal... |
from __future__ import print_function
from future.utils import iteritems
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtCore import Qt
from lazylyst.UI.Configuration import Ui_ConfDialog
from Actions import Action, ActionSetupDialog
# Configuration dialog
class ConfDialog(QtWidgets.QDialog, Ui_ConfDialog):
... | {
"repo_name": "AndrewReynen/Lazylyst",
"path": "lazylyst/ConfigurationDialog.py",
"copies": "1",
"size": "12963",
"license": "mit",
"hash": -7470182811746006000,
"line_mean": 43.8581314879,
"line_max": 118,
"alpha_frac": 0.6436010183,
"autogenerated": false,
"ratio": 4.1816129032258065,
"config... |
from __future__ import print_function,division
import os
import sys
import ctypes as C
if sys.version_info[0]==2:
from scandir import scandir
else:
from os import scandir
import numpy as np
from obspy.core.stream import read
from obspy.core.stream import Stream as EmptyStream
from obspy.core.ut... | {
"repo_name": "AndrewReynen/Lazylyst",
"path": "lazylyst/Archive.py",
"copies": "1",
"size": "14263",
"license": "mit",
"hash": 1765866074117298200,
"line_mean": 39.2283236994,
"line_max": 120,
"alpha_frac": 0.6234312557,
"autogenerated": false,
"ratio": 3.841368165903582,
"config_test": false,... |
from __future__ import print_function, division
import numpy as np
from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5.QtCore import Qt
# Widget which return key presses, however double click replaces backspace
class MixListWidget(QtWidgets.QListWidget):
# Return signal if key was pressed whi... | {
"repo_name": "AndrewReynen/Lazylyst",
"path": "lazylyst/CustomWidgets.py",
"copies": "1",
"size": "16059",
"license": "mit",
"hash": 560402469127446200,
"line_mean": 39.7116883117,
"line_max": 106,
"alpha_frac": 0.6123046267,
"autogenerated": false,
"ratio": 4.172252533125487,
"config_test": f... |
from __future__ import print_function
from copy import deepcopy
from future.utils import iteritems
from PyQt5 import QtWidgets,QtGui,QtCore
from PyQt5.QtCore import Qt
import pyproj
from CustomFunctions import dict2Text, text2Dict
from lazylyst.UI.CustomPen import Ui_customPenDialog
from lazylyst.UI.BasePen... | {
"repo_name": "AndrewReynen/Lazylyst",
"path": "lazylyst/Preferences.py",
"copies": "1",
"size": "31987",
"license": "mit",
"hash": -2165522249647261200,
"line_mean": 44.5633187773,
"line_max": 129,
"alpha_frac": 0.588145184,
"autogenerated": false,
"ratio": 4.258687258687258,
"config_test": fa... |
from __future__ import print_function
import importlib
import sys
from future.utils import iteritems
from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5.QtCore import Qt
from lazylyst.UI.ActionSetup import Ui_actionDialog
from CustomFunctions import dict2Text, text2Dict
# Default Actions
def defaultAct... | {
"repo_name": "AndrewReynen/Lazylyst",
"path": "lazylyst/Actions.py",
"copies": "1",
"size": "29771",
"license": "mit",
"hash": 7297683107285135000,
"line_mean": 51.738267148,
"line_max": 123,
"alpha_frac": 0.6063283061,
"autogenerated": false,
"ratio": 4.446751306945481,
"config_test": false,
... |
from __future__ import print_function
import os
from PyQt5 import QtWidgets
from PyQt5.QtCore import Qt
from lazylyst.UI.ChangeSource import Ui_CsDialog
# Saved sources class, for reading in old (or adding new) archive/pick/station information
class SaveSource(object):
def __init__(self,tag=None,archDi... | {
"repo_name": "AndrewReynen/Lazylyst",
"path": "lazylyst/SaveSource.py",
"copies": "1",
"size": "7419",
"license": "mit",
"hash": 3205362230666555000,
"line_mean": 44.38125,
"line_max": 99,
"alpha_frac": 0.6138293571,
"autogenerated": false,
"ratio": 4.308362369337979,
"config_test": false,
"... |
from future.utils import iteritems
import numpy as np
from obspy import UTCDateTime
# Convert a string into easy to read text, assumes no lists
def dict2Text(aDict):
# Get all values first as strings
keys=np.array([key for key,val in iteritems(aDict)])
vals=np.array([str(val) for key,val in ite... | {
"repo_name": "AndrewReynen/Lazylyst",
"path": "lazylyst/CustomFunctions.py",
"copies": "1",
"size": "1913",
"license": "mit",
"hash": -2578040678240619500,
"line_mean": 32.1964285714,
"line_max": 79,
"alpha_frac": 0.5927861997,
"autogenerated": false,
"ratio": 3.8031809145129225,
"config_test"... |
from obspy import read_inventory
import numpy as np
import pyproj
# Convert a station xml file to a numpy array, containing only [StaCode,Lon,Lat,Ele]
def staXml2Loc(staXml):
# Loop through just to extract the station codes and locations...
# ...with format [Net.Sta.Loc,Lon(deg),Lat(deg),Ele(m)], lon/... | {
"repo_name": "AndrewReynen/Lazylyst",
"path": "lazylyst/StationMeta.py",
"copies": "1",
"size": "3829",
"license": "mit",
"hash": -3695801528710851000,
"line_mean": 44.7195121951,
"line_max": 97,
"alpha_frac": 0.5972838861,
"autogenerated": false,
"ratio": 3.443345323741007,
"config_test": fal... |
import random, os, sys;
from boxm2_scene_adaptor import *;
from vil_adaptor import *;
from vpgl_adaptor import *;
from bbas_adaptor import *;
from helpers import *;
from glob import glob
from optparse import OptionParser
#######################################################
# handle inputs ... | {
"repo_name": "mirestrepo/voxels-at-lems",
"path": "boxm2/boxm2_refine_model.py",
"copies": "1",
"size": "2339",
"license": "bsd-2-clause",
"hash": -2912833699774768000,
"line_mean": 28.6075949367,
"line_max": 183,
"alpha_frac": 0.6075245832,
"autogenerated": false,
"ratio": 3.480654761904762,
... |
__author__ = 'Andrew'
import math
import urllib2
import os
import time
from xml.dom import minidom as DOM
def calculate_distance(origin, destination):
lat1, lon1 = origin
lat2, lon2 = destination
radius = 6371 # km
latitude = math.radians(lat2 - lat1)
longitude = math.radians(lon2 - lon1)
a ... | {
"repo_name": "Codeusa/SpeedTest-Faker",
"path": "functions.py",
"copies": "1",
"size": "3095",
"license": "unlicense",
"hash": 1472288470539278000,
"line_mean": 27.3944954128,
"line_max": 144,
"alpha_frac": 0.5786752827,
"autogenerated": false,
"ratio": 3.688915375446961,
"config_test": true,
... |
__author__ = 'Andrew'
import threading
from random import choice
from twython import Twython
#terrible array of words below
arrayFirstWord = ['the bottle', 'a drainpipe', 'small blue bits', 'a crow caws', 'a dog shakes', 'ferris wheels',
'monkey bars',
'stained table cloths', 'three... | {
"repo_name": "Codeusa/QTHaikus",
"path": "qttweets.py",
"copies": "1",
"size": "4946",
"license": "mit",
"hash": -3990717856427407400,
"line_mean": 52.7608695652,
"line_max": 120,
"alpha_frac": 0.5327537404,
"autogenerated": false,
"ratio": 3.348679756262695,
"config_test": false,
"has_no_ke... |
__author__ = 'Andrew'
import time
import urllib.request
from functions import stdout
import workerpool
class DownloadJob(workerpool.Job):
"Job for downloading a given URL."
def __init__(self, url, poster_id):
self.url = url # The url we'll need to download when the job runs
self.poster_id = ... | {
"repo_name": "Codeusa/Shrinkwrap-worker",
"path": "shrinkwrap-worker/example.py",
"copies": "1",
"size": "1097",
"license": "mit",
"hash": 3660011270642280400,
"line_mean": 31.2647058824,
"line_max": 99,
"alpha_frac": 0.6517775752,
"autogenerated": false,
"ratio": 3.4825396825396826,
"config_t... |
__author__ = 'andrew'
from .core import APIConnection
import uuid
class SteamIngameStore(object):
def __init__(self, appid, debug=False):
self.appid = appid
self.interface = 'ISteamMicroTxnSandbox' if debug else 'ISteamMicroTxn'
def get_user_microtxh_info(self, steamid):
return APIC... | {
"repo_name": "smiley/steamapi",
"path": "steamapi/store.py",
"copies": "1",
"size": "1682",
"license": "mit",
"hash": 6177731816466648000,
"line_mean": 37.2272727273,
"line_max": 105,
"alpha_frac": 0.548156956,
"autogenerated": false,
"ratio": 3.68859649122807,
"config_test": false,
"has_no_... |
__author__ = 'Andrew'
class Card:
RANKS = ('2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A')
SUITS = ('hearts', 'diamonds', 'spades', 'clubs')
def __init__(self, card_data):
self.suit = card_data['suit'].lower()
self.rank = card_data['rank']
self.value = Card.RANKS... | {
"repo_name": "Medvezhopok/poker-player-pythonpokerteam",
"path": "handtype/card.py",
"copies": "1",
"size": "1026",
"license": "mit",
"hash": -4996505157707097000,
"line_mean": 24.0487804878,
"line_max": 78,
"alpha_frac": 0.5068226121,
"autogenerated": false,
"ratio": 3.1666666666666665,
"conf... |
import sys
import re
import os
import nltk
import operator
from random import randint
from nltk.util import ngrams
from ngramFunctions import *
from XMLParser import *
from frequencyFunctions import *
from lxml import etree
def features(sentence):
words = sentence.lower().split()
return dict(('contai... | {
"repo_name": "sainzad/stackOverflowCodeIdentifier",
"path": "XMLAnalyze.py",
"copies": "1",
"size": "12120",
"license": "mit",
"hash": -7472677183187494000,
"line_mean": 38.5418060201,
"line_max": 535,
"alpha_frac": 0.6214521452,
"autogenerated": false,
"ratio": 3.3196384552177487,
"config_tes... |
__author__ = 'andrews'
from enum import IntEnum
from time import sleep
import threading
import re
import logging
from libpebble2.services.voice import *
from .base import PebbleCommand
logger = logging.getLogger("pebble_tool.commands.transcription_server")
mapping = {
'connectivity': TranscriptionResult.FailNo... | {
"repo_name": "gregoiresage/pebble-tool",
"path": "pebble_tool/commands/transcription_server.py",
"copies": "2",
"size": "3278",
"license": "mit",
"hash": -3093568538927724500,
"line_mean": 35.021978022,
"line_max": 114,
"alpha_frac": 0.6278218426,
"autogenerated": false,
"ratio": 4.1493670886075... |
__author__ = "Andrew Szymanski"
__version__ = "0.1.0"
""" Forms playground
"""
#from django.views.decorators.http import require_safe
import urllib
import urllib2
from django.template import Context, loader
from django.http import HttpResponse
from django.shortcuts import render,render_to_response, get_object_or_4... | {
"repo_name": "andrew-szymanski/gae_django",
"path": "votuition/views.py",
"copies": "1",
"size": "6681",
"license": "bsd-3-clause",
"hash": -8754530612247372000,
"line_mean": 34.9247311828,
"line_max": 95,
"alpha_frac": 0.5430324802,
"autogenerated": false,
"ratio": 3.9462492616656824,
"config... |
__author__ = 'Andrew Taylor'
class Filter(object):
def __init__(self, config=None):
self.config = config
"""
Method to override to modify the value of the RGB data.
Default here is no modification
"""
def modify(self, rgb):
return rgb
class ClearFilter(Filter):
"""
T... | {
"repo_name": "fraz3alpha/led-disco-dancefloor",
"path": "software/controller/lib/filters.py",
"copies": "2",
"size": "1121",
"license": "mit",
"hash": -8013783010417579000,
"line_mean": 21,
"line_max": 74,
"alpha_frac": 0.5628902765,
"autogenerated": false,
"ratio": 3.933333333333333,
"config_... |
__author__ = 'Andrey Alekov'
import logging
import serial
logger = logging.getLogger()
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s: %(message)s', datefmt='%Y-%m-%d %I:%M:%S')
LF = serial.to_bytes([10])
CR = serial.to_bytes([13])
CRTLZ = serial.to_bytes([26])
CRLF = serial.to_bytes([13, 1... | {
"repo_name": "andrey-alekov/gsmmodem_tools",
"path": "modem.py",
"copies": "1",
"size": "3049",
"license": "mit",
"hash": 7251914292525586000,
"line_mean": 31.4468085106,
"line_max": 118,
"alpha_frac": 0.5211544769,
"autogenerated": false,
"ratio": 3.612559241706161,
"config_test": false,
"h... |
__author__ = 'Andrey Alekov'
class PDU(object):
"""
Simple PDU format with hardcoded params.
"""
def __init__(self, destination, text, smsc=None):
if smsc is not None:
self.sca = PDU.encode_sca(smsc)
else:
self.sca = "00" # use SIM card SMSC
... | {
"repo_name": "andrey-alekov/gsmmodem_tools",
"path": "pdu.py",
"copies": "1",
"size": "1872",
"license": "mit",
"hash": 9155705729512226000,
"line_mean": 33.0545454545,
"line_max": 98,
"alpha_frac": 0.4823717949,
"autogenerated": false,
"ratio": 3.499065420560748,
"config_test": false,
"has_... |
__author__ = "Andrey Nikishaev"
__copyright__ = "Copyright 2010, http://creotiv.in.ua"
__license__ = "GPL"
__version__ = "0.3"
__maintainer__ = "Andrey Nikishaev"
__email__ = "creotiv@gmail.com"
__status__ = "Production"
"""
Simple local cache.
It saves local data in singleton dictionary with convenient interface
Exa... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/577492_Simple_local_cache_cache/recipe-577492.py",
"copies": "1",
"size": "2724",
"license": "mit",
"hash": -843309161157631200,
"line_mean": 25.9702970297,
"line_max": 70,
"alpha_frac": 0.516886931,
"autogenerated": false,
"ratio": 3.8638... |
__author__ = "Andrey Nikishaev"
__email__ = "creotiv@gmail.com"
import gevent
from gevent import core
from gevent.hub import getcurrent
from gevent.event import Event
from gevent.pool import Pool
import functools
def wrap(method, *args, **kargs):
if method is None:
return None
if args or kargs:
... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/577491_Observer_Design_Pattern_pythgevent_coroutine/recipe-577491.py",
"copies": "1",
"size": "2950",
"license": "mit",
"hash": 2258783868037346000,
"line_mean": 23.7899159664,
"line_max": 90,
"alpha_frac": 0.5420338983,
"autogenerated": fal... |
__author__ = "Andrey Nikishaev"
__email__ = "creotiv@gmail.com"
import pymongo
from gevent.queue import PriorityQueue
import os
import time
class MongoPoolException(Exception):
pass
class MongoPoolCantConnect(MongoPoolException):
pass
class MongoPoolAutoReconnect(MongoPoolException):
pass
class GP... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/577490_MongoDB_Pool_gevent_pymongo/recipe-577490.py",
"copies": "1",
"size": "3544",
"license": "mit",
"hash": 8713911834384328000,
"line_mean": 28.781512605,
"line_max": 89,
"alpha_frac": 0.5555869074,
"autogenerated": false,
"ratio": 4.2... |
__author__ = "Andrey Nikishaev"
__email__ = "creotiv@gmail.com"
import pymongo, sys
from gevent.queue import Queue
class GeventMongoPool(object):
"""
Rewrited connection pool for working with global connections.
"""
# Non thread-locals
__slots__ = ["sockets", "socket_factory"]
sock = None
... | {
"repo_name": "sunlightlabs/regulations-scraper",
"path": "regscrape/regs_common/gevent_mongo.py",
"copies": "1",
"size": "2536",
"license": "bsd-3-clause",
"hash": -6041757762231657000,
"line_mean": 28.1494252874,
"line_max": 70,
"alpha_frac": 0.565851735,
"autogenerated": false,
"ratio": 4.0641... |
__author__ = 'andrey'
def print_stats(items):
if items is None or len(items) < 1:
return
print("\n%-50s (%02d)" % (items[0].__class__.__name__ + "s", len(items)))
for t in set(i.type for i in items):
print("\ttype: %-35s (%02d)" % (t, len([1 for i in items if i.type == t])))
def print_... | {
"repo_name": "G-Node/nix-demo",
"path": "utils/notebook.py",
"copies": "1",
"size": "1496",
"license": "bsd-3-clause",
"hash": -1552903788730305500,
"line_mean": 33,
"line_max": 84,
"alpha_frac": 0.4872994652,
"autogenerated": false,
"ratio": 3.33184855233853,
"config_test": false,
"has_no_k... |
__author__ = 'andrey'
def print_stats(items):
print("\n%-50s (%02d)" % (items[0].__class__.__name__ + "s", len(items)))
for t in set(i.type for i in items):
print("\ttype: %-35s (%02d)" % (t, len([1 for i in items if i.type == t])))
def print_metadata_table(section):
import matplotlib.pyplot as... | {
"repo_name": "stoewer/nix-demo",
"path": "utils/notebook.py",
"copies": "1",
"size": "1440",
"license": "bsd-3-clause",
"hash": -9128905016720810000,
"line_mean": 34.1219512195,
"line_max": 84,
"alpha_frac": 0.4854166667,
"autogenerated": false,
"ratio": 3.3179723502304146,
"config_test": fals... |
__author__ = 'andro'
import os
def populate():
python_cat = add_cat('Python')
add_page(cat=python_cat,
title="Official Python Tutorial",
url="http://docs.python.org/2/tutorial")
add_page(cat=python_cat,
title="How to Think like a Computer Scientist",
url="http://www.greent... | {
"repo_name": "andromajid/learndjango",
"path": "populate_rango.py",
"copies": "1",
"size": "1757",
"license": "mit",
"hash": 3909432771792062000,
"line_mean": 28.3,
"line_max": 81,
"alpha_frac": 0.6180990324,
"autogenerated": false,
"ratio": 3.321361058601134,
"config_test": false,
"has_no_k... |
__author__ = "Andrzej Krawczyk - Pep8 test"
import os
import sys
import json
class Punkt(object):
def __init__(self, x, z, some_data):
self.x = x
self.z = z
self.some_data = some_data
def title(self):
return "%s" % self.some_data
def some_data_processor(a, b, y=10, c=20, e... | {
"repo_name": "andrzejkrawczyk/python-course",
"path": "part_1/zadania/data_processing/pep8.py",
"copies": "1",
"size": "1304",
"license": "apache-2.0",
"hash": 6024403231699775000,
"line_mean": 21.8771929825,
"line_max": 139,
"alpha_frac": 0.5705521472,
"autogenerated": false,
"ratio": 2.5369649... |
__author__ = 'Andrzej Skrodzki 292510'
from pymongo import MongoClient
from pymongo.errors import ConnectionFailure
from pymongo.collection import *
import datetime
def main():
client = None
try:
client = MongoClient('mongodb://as292510:test1234@ds027699.mongolab.com:27699/zbd2013')
except Connec... | {
"repo_name": "endrjuskr/studies",
"path": "ZBD/zbd-mongo/mongo-connector.py",
"copies": "1",
"size": "2622",
"license": "apache-2.0",
"hash": 201290562687020580,
"line_mean": 20.6694214876,
"line_max": 95,
"alpha_frac": 0.5751334859,
"autogenerated": false,
"ratio": 3.32319391634981,
"config_t... |
__author__ = 'Andrzej Skrodzki - as292510'
# module: tokrules.py
# This module just contains the lexing rules
from .LatteExceptions import LexerException
import lattepar
# Reserved words
reserved = (
'IF',
'ELSE',
'WHILE',
'RETURN',
'INT',
'STRING',
'BOOLEAN',
'VOID',
'TRUE',
... | {
"repo_name": "endrjuskr/studies",
"path": "MRJP/LatteCompilerPython/src/tokrules.py",
"copies": "1",
"size": "1882",
"license": "apache-2.0",
"hash": -3907634433791170000,
"line_mean": 17.4607843137,
"line_max": 105,
"alpha_frac": 0.5281615303,
"autogenerated": false,
"ratio": 2.4730617608409986... |
__author__ = 'Andrzej Skrodzki - as292510'
__all__ = ["Arg", "InitItem", "ItemBase", "NoInitItem", "Field", "exception_list_par"]
from .BaseNode import *
from .LatteTypes import *
from ..LatteExceptions import *
exception_list_par = []
class Arg(BaseNode):
def __init__(self, type, ident, no_line, pos):
... | {
"repo_name": "endrjuskr/studies",
"path": "MRJP/LatteCompilerPython/src/LatteParsers/LatteParameters.py",
"copies": "1",
"size": "3414",
"license": "apache-2.0",
"hash": -3673788752082578000,
"line_mean": 34.9473684211,
"line_max": 114,
"alpha_frac": 0.5849443468,
"autogenerated": false,
"ratio"... |
__author__ = 'Andrzej Skrodzki - as292510'
__all__ = ["Block", "FnDef", "Program", "PredefinedFun", "ClassDef", "exception_list_fn"]
from ..LatteExceptions import *
from .LatteTypes import *
from .BaseNode import *
from ..Env import *
exception_list_fn = []
class Block(BaseNode):
def __init__(self, stmt_list):
... | {
"repo_name": "endrjuskr/studies",
"path": "MRJP/LatteCompilerPython/src/LatteParsers/LatteTopDefinitions.py",
"copies": "1",
"size": "11660",
"license": "apache-2.0",
"hash": -790421273450863000,
"line_mean": 32.6051873199,
"line_max": 117,
"alpha_frac": 0.5638078902,
"autogenerated": false,
"ra... |
__author__ = 'Andrzej Skrodzki - as292510'
__all__ = ["EAdd", "EAnd", "EApp", "ELitBoolean", "ELitInt", "EMul", "ENeg", "ENot", "EOr", "ERel", "EString", "EVar",
"ExprBase", "OneArgExpr", "TwoArgExpr", "ZeroArgExpr", "EArrayInit", "EArrayApp", "EObjectInit",
"ELitNull", "EObjectField", "exception... | {
"repo_name": "endrjuskr/studies",
"path": "MRJP/LatteCompilerPython/src/LatteParsers/LatteExpressions.py",
"copies": "1",
"size": "29197",
"license": "apache-2.0",
"hash": -4655824964755099000,
"line_mean": 34.1771084337,
"line_max": 126,
"alpha_frac": 0.5269376991,
"autogenerated": false,
"rati... |
__author__ = 'Andrzej Skrodzki - as292510'
__all__ = ["Env", "exception_list_env"]
from .LatteExceptions import *
from .LatteParsers.LatteTypes import *
exception_list_env = []
class Env:
def __init__(self, orig=None, reset_declarations=True, class_name="MyClass"):
self.predefined_fun = ["readInt", "re... | {
"repo_name": "endrjuskr/studies",
"path": "MRJP/LatteCompilerPython/src/Env.py",
"copies": "1",
"size": "8572",
"license": "apache-2.0",
"hash": -775690222400845000,
"line_mean": 33.9918367347,
"line_max": 116,
"alpha_frac": 0.5632291181,
"autogenerated": false,
"ratio": 3.704407951598963,
"co... |
__author__ = 'Andrzej Skrodzki - as292510'
__all__ = ["FunType", "Type", "ArrayType"]
from operator import eq
class Type(object):
def __init__(self, type):
self.type = type
self.dict = {}
self.fill_matches()
def __eq__(self, other):
return self.type == other.type
def __... | {
"repo_name": "endrjuskr/studies",
"path": "MRJP/LatteCompilerPython/src/LatteParsers/LatteTypes.py",
"copies": "1",
"size": "2309",
"license": "apache-2.0",
"hash": 3527560722335099000,
"line_mean": 22.5612244898,
"line_max": 115,
"alpha_frac": 0.5612819402,
"autogenerated": false,
"ratio": 3.52... |
__author__ = 'Andrzej Skrodzki - as292510'
__all__ = ["LatteBaseException", "DuplicateDeclarationException", "LexerException", "NotDeclaredException",
"ReturnException", "SyntaxException", "TypeException"]
class LatteBaseException(Exception):
def __init__(self, no_line, pos):
self.no_line = no... | {
"repo_name": "endrjuskr/studies",
"path": "MRJP/LatteCompilerPython/src/LatteExceptions.py",
"copies": "1",
"size": "3229",
"license": "apache-2.0",
"hash": -6371515293186403000,
"line_mean": 36.1264367816,
"line_max": 113,
"alpha_frac": 0.6048312171,
"autogenerated": false,
"ratio": 3.694508009... |
__author__ = 'Andrzej Skrodzki - as292510'
__all__ = ["VarAssStmt", "BStmt", "CondElseStmt", "CondStmt", "DeclStmt", "DecrStmt",
"EmptyStmt", "IncrStmt", "RetStmt", "SExpStmt", "StmtBase", "VRetStmt", "WhileStmt", "ForStmt",
"exception_list_stmt"]
from .LatteTypes import *
from ..LatteException... | {
"repo_name": "endrjuskr/studies",
"path": "MRJP/LatteCompilerPython/src/LatteParsers/LatteStatements.py",
"copies": "1",
"size": "15839",
"license": "apache-2.0",
"hash": -7189344972357896000,
"line_mean": 34.276169265,
"line_max": 123,
"alpha_frac": 0.5668918492,
"autogenerated": false,
"ratio"... |
__author__ = 'Andrzej Skrodzki - as292510'
import sys
import subprocess
import lattepar
import lattelex
from .Env import *
from .LatteParsers.LatteStatements import exception_list_stmt
from .LatteParsers.LatteExpressions import exception_list_expr
from .LatteParsers.LatteParameters import exception_list_par
from .Lat... | {
"repo_name": "endrjuskr/studies",
"path": "MRJP/LatteCompilerPython/src/lattemain.py",
"copies": "1",
"size": "3112",
"license": "apache-2.0",
"hash": 3789727451107061000,
"line_mean": 31.4166666667,
"line_max": 101,
"alpha_frac": 0.5857969152,
"autogenerated": false,
"ratio": 3.1950718685831623... |
__author__ = 'Andrzej Taramina'
__documentation__ = 'http://sourceforge.net/p/raspberry-gpio-python/wiki/Examples/'
RPI_REVISION = 1
VERSION = 1
BOARD = 0
BCM = 1
IN = 0
OUT = 1
INPUT = 0
OUTPUT = 1
SPI = 2
I2C = 3
HARD_PWM = 4
SERIAL = 5
UNKNOWN = -1
PUD_DOWN = 0
PUD_UP = 1
PUD_OFF = -1
LOW = 0
HIGH = 1
FALLING... | {
"repo_name": "jpnos26/thermostat_V3",
"path": "FakeRPi/GPIO.py",
"copies": "5",
"size": "4609",
"license": "mit",
"hash": 3225785750709278000,
"line_mean": 27.6273291925,
"line_max": 398,
"alpha_frac": 0.6747667607,
"autogenerated": false,
"ratio": 3.6813099041533546,
"config_test": false,
"... |
__author__ = 'andy'
import unittest
from pyevent import mixin
@mixin
class TestClass:
pass
class PyeventTest(unittest.TestCase):
def setUp (self):
self.cls = TestClass()
def tearDown (self):
del self.cls
def test_mixin_build_trigger (self):
self.assertIsNotNone(self.cls.tr... | {
"repo_name": "andy9775/pyevent",
"path": "tests/test_mixin.py",
"copies": "1",
"size": "2258",
"license": "mit",
"hash": -3951987648470067700,
"line_mean": 26.8765432099,
"line_max": 71,
"alpha_frac": 0.5806023029,
"autogenerated": false,
"ratio": 4.068468468468469,
"config_test": true,
"has... |
__author__ = 'andy'
import unittest
from pyevent import Pyevent
class PyeventTest(unittest.TestCase):
def setUp (self):
self.binderTwo = Pyevent()
def tearDown (self):
del self.binderTwo
def test_bind (self):
def test ():
pass
self.binderTwo.bind('test_bind'... | {
"repo_name": "andy9775/pyevent",
"path": "tests/test_basic.py",
"copies": "1",
"size": "1665",
"license": "mit",
"hash": 2107717137101963300,
"line_mean": 26.75,
"line_max": 75,
"alpha_frac": 0.6054054054,
"autogenerated": false,
"ratio": 4.002403846153846,
"config_test": true,
"has_no_keywo... |
__author__ = 'Andy'
from whirlybird.protocols import pilot_input_pb2
class InputDriverBase(object):
def __init__(self, transport):
self.transport = transport
def _to_integer(self, value):
return int(value * 255 + 255)
def emit(self,
left_stick_x,
left_stick_y,
... | {
"repo_name": "levisaya/whirlybird",
"path": "whirlybird/client/input_drivers/input_driver_base.py",
"copies": "1",
"size": "1271",
"license": "mit",
"hash": 43094343627514580,
"line_mean": 38.71875,
"line_max": 92,
"alpha_frac": 0.4657749803,
"autogenerated": false,
"ratio": 3.8283132530120483,
... |
__author__ = 'Andy'
import asyncio
import time
from whirlybird.protocols.pilot_input_pb2 import PilotInput
from threading import Event
from whirlybird.server.devices.Bmp085 import Bmp085
from whirlybird.server.devices.lsm303_accelerometer import Lsm303Accelerometer
from whirlybird.server.devices.lsm303_magnetometer im... | {
"repo_name": "levisaya/whirlybird",
"path": "whirlybird/server/position_contoller.py",
"copies": "1",
"size": "2827",
"license": "mit",
"hash": 1010636740543063300,
"line_mean": 35.2564102564,
"line_max": 103,
"alpha_frac": 0.6466218606,
"autogenerated": false,
"ratio": 3.498762376237624,
"con... |
__author__ = 'andy'
class Pyevent(object):
"""
An eventing system based on the javascript microevent framework. It
follows a publish subscribe pattern to call certain methods that are
linked to events when those events are triggered.
"""
def __init__ (self):
# <String, Array<Function>... | {
"repo_name": "andy9775/pyevent",
"path": "pyevent/pyevent.py",
"copies": "1",
"size": "2472",
"license": "mit",
"hash": -2291512083205859300,
"line_mean": 32.4054054054,
"line_max": 77,
"alpha_frac": 0.5865695793,
"autogenerated": false,
"ratio": 4.527472527472527,
"config_test": false,
"has... |
# -------------- I-Format ----------------
# o----------------------------------------o
# | opcode | rs | rt | OFFSET |
# |--------|---------|----------|----------|
# | 6 bits | 5 bits | 5 bits | 16 bits |
# o----------------------------------------o
# ================================== OPCODES ... | {
"repo_name": "andrewoconnell89/CS472_Project3",
"path": "src/Pipeline/MIPSDisassembler.py",
"copies": "1",
"size": "8270",
"license": "mit",
"hash": -6306062042930677000,
"line_mean": 32.4817813765,
"line_max": 106,
"alpha_frac": 0.4548972189,
"autogenerated": false,
"ratio": 2.8100577641862046,... |
from Pipeline.MIPSDisassembler import Disassembler # This is from Project 1
class Pipeline(object):
def __init__(self, startProgramCount, InstructionCache):
"""Initalizes the 5 Stages of the Pipeline. (IF, ID, EX, MEM, WB)
"""
#Main Memory, Registers. Must be initialized
self.Ma... | {
"repo_name": "andrewoconnell89/CS472_Project3",
"path": "src/Pipeline/Pipeline.py",
"copies": "1",
"size": "18121",
"license": "mit",
"hash": 3898411328623428000,
"line_mean": 39.7213483146,
"line_max": 128,
"alpha_frac": 0.5360631312,
"autogenerated": false,
"ratio": 2.9657937806873975,
"conf... |
__author__ = 'Aneil Mallavarapu (http://github.com/aneilbaboo)'
from datetime import datetime
import dateutil.parser
from errors import InvalidTypeException
def default_timestamp_parser(s):
try:
if dateutil.parser.parse(s):
return True
else:
return False
except:
... | {
"repo_name": "blarghmatey/BigQuery-Python",
"path": "bigquery/schema_builder.py",
"copies": "2",
"size": "3332",
"license": "apache-2.0",
"hash": -3138682770774737400,
"line_mean": 27.724137931,
"line_max": 79,
"alpha_frac": 0.6107442977,
"autogenerated": false,
"ratio": 4,
"config_test": fals... |
__author__ = 'angad'
import networkx as nx
from scipy.spatial.distance import cosine
class CompareFeature(object):
def __init__(self, graph1, graph2):
self._value = (self._compute(graph1)==self._compute(graph2))
def _compute(self, graph):
# Should return a comparable for a graph such as int o... | {
"repo_name": "angadgill/ML-Graph-Isomorphism",
"path": "scripts/model/features.py",
"copies": "1",
"size": "1558",
"license": "mit",
"hash": -8736428881603080000,
"line_mean": 24.9666666667,
"line_max": 79,
"alpha_frac": 0.6604621309,
"autogenerated": false,
"ratio": 3.885286783042394,
"config... |
__author__ = 'angad'
'''
This implements and tests a naive neural network model to determine if two graphs are isomorphic
Input to the neural network are the features used in the naive_model
'''
import networkx as nx
import random
import numpy as np
from scripts.model import features
from scripts.model import graph_... | {
"repo_name": "angadgill/ML-Graph-Isomorphism",
"path": "scripts/model/naive_nn_model.py",
"copies": "1",
"size": "2372",
"license": "mit",
"hash": 1511981350170778400,
"line_mean": 29.4102564103,
"line_max": 105,
"alpha_frac": 0.7276559865,
"autogenerated": false,
"ratio": 3.209742895805142,
"... |
__author__ = 'angad'
'''
This implements and tests a neural network model to determine if two graphs are isomorphic
Input to the neural network is a pair of adjecency matrices
'''
import networkx as nx
import random
import numpy as np
from scripts.model import features
from scripts.model import graph_pair_class
from... | {
"repo_name": "angadgill/ML-Graph-Isomorphism",
"path": "scripts/model/nn_model.py",
"copies": "1",
"size": "2683",
"license": "mit",
"hash": 2453957407553526000,
"line_mean": 30.5647058824,
"line_max": 105,
"alpha_frac": 0.7223257548,
"autogenerated": false,
"ratio": 3.1343457943925235,
"confi... |
__author__ = 'Angus Bishop'
def get_setup_drinks():
setup_pos = {}
setup_type = {}
with open('data/setup.txt', 'r') as setupfile:
for line in setupfile:
if line[0] != '#' and line != '':
pos = 0
dtype = ''
name = ''
separa... | {
"repo_name": "angusgbishop/biast",
"path": "setup.py",
"copies": "1",
"size": "1320",
"license": "apache-2.0",
"hash": 3611726216168131000,
"line_mean": 33.7631578947,
"line_max": 100,
"alpha_frac": 0.4325757576,
"autogenerated": false,
"ratio": 4.125,
"config_test": false,
"has_no_keywords"... |
__author__ = 'AniaF'
import os
import django
# set the DJANGO_SETTINGS_MODULE environment variable to "mips.settings"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mips.settings")
# setup
django.setup()
# import proper classes to play with
# from mips.models import Mip, Subspecies, SampleSubspecies, Samples, Pa... | {
"repo_name": "aniafijarczyk/django-mips",
"path": "mips/example/examples2.py",
"copies": "2",
"size": "5789",
"license": "mit",
"hash": 4379072583444558300,
"line_mean": 24.3903508772,
"line_max": 132,
"alpha_frac": 0.6861288651,
"autogenerated": false,
"ratio": 3.0277196652719667,
"config_tes... |
__author__ = 'anicca'
# core
import math
import sys
from itertools import izip
# 3rd party
from PIL import Image, ImageChops
import argh
def dhash(image, hash_size=8):
# Grayscale and shrink the image in one step.
image = image.convert('L').resize(
(hash_size + 1, hash_size),
Image.ANTIALIAS... | {
"repo_name": "metaperl/clickmob",
"path": "src/dhash.py",
"copies": "2",
"size": "2158",
"license": "mit",
"hash": 5644511999859032000,
"line_mean": 25.975,
"line_max": 86,
"alpha_frac": 0.6051899907,
"autogenerated": false,
"ratio": 3.1320754716981134,
"config_test": false,
"has_no_keywords... |
__author__ = 'anicca'
from decimal import *
def moneyfmt(value, places=2, curr='', sep=',', dp='.',
pos='', neg='-', trailneg=''):
"""Convert Decimal to a money formatted string.
places: required number of places after the decimal point
curr: optional currency symbol before the sign (may... | {
"repo_name": "metaperl/revadbu",
"path": "src/money_format.py",
"copies": "2",
"size": "1707",
"license": "mit",
"hash": -5843319051278197000,
"line_mean": 31.8461538462,
"line_max": 73,
"alpha_frac": 0.5565319274,
"autogenerated": false,
"ratio": 3.6165254237288136,
"config_test": false,
"h... |
__author__ = 'anicca'
import cv2
import numpy as np
def drawMatches(img1, kp1, img2, kp2, matches):
"""
My own implementation of cv2.drawMatches as OpenCV 2.4.9
does not have this function available but it's supported in
OpenCV 3.0.0
This function takes in two images with their associated
k... | {
"repo_name": "metaperl/clickmob",
"path": "src/match_image.py",
"copies": "1",
"size": "3394",
"license": "mit",
"hash": 1427637793357803800,
"line_mean": 29.3125,
"line_max": 81,
"alpha_frac": 0.6402474956,
"autogenerated": false,
"ratio": 3.311219512195122,
"config_test": false,
"has_no_ke... |
__author__ = 'anicca'
import cv2
def showk(img, kpts):
for k in kpts:
print 'key'
x, y = k.pt
x = int(x)
y = int(y)
cv2.rectangle(img,(x,y), (x+2,y+2),(0,0,255),2)
cv2.imshow("Result",img)
cv2.waitKey(0);
def similarity_test(img1_filename, img2_filename):
im... | {
"repo_name": "metaperl/clickmob",
"path": "src/match_image3.py",
"copies": "1",
"size": "1329",
"license": "mit",
"hash": -1264154570818625300,
"line_mean": 25.6,
"line_max": 87,
"alpha_frac": 0.6245297216,
"autogenerated": false,
"ratio": 2.940265486725664,
"config_test": false,
"has_no_key... |
__author__ = 'anicca'
import cv2
from PIL import Image
def avhash(im):
if not isinstance(im, Image.Image):
im = Image.open(im)
im = im.resize((8, 8), Image.ANTIALIAS).convert('L')
avg = reduce(lambda x, y: x + y, im.getdata()) / 64.
return reduce(lambda x, (y, z): x | (z << y),
... | {
"repo_name": "metaperl/clickmob",
"path": "src/match_image4.py",
"copies": "1",
"size": "1119",
"license": "mit",
"hash": 3007250596278954500,
"line_mean": 23.8666666667,
"line_max": 78,
"alpha_frac": 0.5710455764,
"autogenerated": false,
"ratio": 3.178977272727273,
"config_test": false,
"ha... |
__author__ = 'aniket'
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('paka.jpg',0)
ret1,th1 = cv2.threshold(img,127,255,cv2.THRESH_BINARY)
ret2,th2 = cv2.threshold(img,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
blur = cv2.GaussianBlur(img,(5,5),0)
ret3,th3 = cv2.threshold(blur,0,2... | {
"repo_name": "eyantrainternship/eYSIP_2015_Depth_Mapping_Kinect",
"path": "Resources/Examples/PycharmProjects/Image Processing/Image4.py",
"copies": "2",
"size": "1087",
"license": "cc0-1.0",
"hash": 779948892138572800,
"line_mean": 35.2666666667,
"line_max": 112,
"alpha_frac": 0.6734130635,
"auto... |
__author__ = 'Animesh'
import sys
import numpy as np
from copy import copy, deepcopy
class Normalizer:
def __init__(self, features):
self.max_val = [0] * 13
self.min_val = [1000] * 13
self.mean = [1] * 13
self.std_dev = [1] * 13 #standard deviation
self.real_fatures = [0, 3... | {
"repo_name": "animeshramesh/pyCardio",
"path": "prediction_models/normalize.py",
"copies": "1",
"size": "3401",
"license": "apache-2.0",
"hash": -4078582976400119000,
"line_mean": 35.1808510638,
"line_max": 122,
"alpha_frac": 0.5210232285,
"autogenerated": false,
"ratio": 3.470408163265306,
"c... |
__author__ = 'Animesh'
from utils import parser
import model
def load_model():
min_temp = parser.parse_csv("datasets/min_temp.csv")
cloud_cover = parser.parse_csv("datasets/cloud_cover.csv")
precipitation = parser.parse_csv("datasets/precipitation.csv")
vp = parser.parse_csv("datasets/vp.csv")
gr... | {
"repo_name": "animeshramesh/ML-analytics",
"path": "utils/load_model.py",
"copies": "1",
"size": "1087",
"license": "apache-2.0",
"hash": 6737161581124043000,
"line_mean": 36.4827586207,
"line_max": 66,
"alpha_frac": 0.6375344986,
"autogenerated": false,
"ratio": 3.3549382716049383,
"config_te... |
__author__ = 'Animesh'
import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style
style.use("ggplot")
from sklearn import svm
from normalize import Normalizer
input, data, features, results = ([] for i in range(4))
path = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', '... | {
"repo_name": "animeshramesh/pyCardio",
"path": "prediction_models/svm.py",
"copies": "1",
"size": "1486",
"license": "apache-2.0",
"hash": -4735753314796164000,
"line_mean": 26.5185185185,
"line_max": 129,
"alpha_frac": 0.6897711978,
"autogenerated": false,
"ratio": 2.9779559118236474,
"config... |
__author__ = 'Animesh'
# Imports
from utils import load_model
from pybrain.datasets import SupervisedDataSet
from pybrain.supervised.trainers import BackpropTrainer
from pybrain.tools.shortcuts import buildNetwork
import numpy as np
import math as pymath
from utils import math
import matplotlib.pyplot as plt
epochs ... | {
"repo_name": "animeshramesh/ML-analytics",
"path": "nn.py",
"copies": "1",
"size": "1500",
"license": "apache-2.0",
"hash": 4455366850721329700,
"line_mean": 26.2909090909,
"line_max": 76,
"alpha_frac": 0.716,
"autogenerated": false,
"ratio": 3.1779661016949152,
"config_test": false,
"has_no... |
__author__ = 'Animesh'
class Model:
def __init__(self):
self.min_temp = []
self.max_temp = []
self.avg_temp = []
self.cloud_cover = []
self.vapour_pressure = []
self.precipitation = []
def set_min_temp(self, min_temp):
self.min_temp = min_temp
def... | {
"repo_name": "animeshramesh/ML-analytics",
"path": "model.py",
"copies": "1",
"size": "1085",
"license": "apache-2.0",
"hash": -5581000765229196000,
"line_mean": 21.625,
"line_max": 51,
"alpha_frac": 0.5935483871,
"autogenerated": false,
"ratio": 3.3384615384615386,
"config_test": false,
"ha... |
__author__ = 'Anindya Guha (aguha@colgate.edu)'
from numpy import *
import networkx as nx
from networkx.algorithms.approximation import *
import matplotlib.pyplot as plt
from scipy.stats import rv_discrete
def is_infected(edge_weight, percentage_infected, timestep):
prob = 1 - (1 - edge_weight*percentage_i... | {
"repo_name": "anindyabd/ebola_eradication",
"path": "contact_network.py",
"copies": "1",
"size": "4331",
"license": "mit",
"hash": 4926152763366409000,
"line_mean": 37.6696428571,
"line_max": 319,
"alpha_frac": 0.6241052875,
"autogenerated": false,
"ratio": 2.5810488676996424,
"config_test": f... |
__author__ = 'ANI'
try :
import requests
from bs4 import BeautifulSoup
import sqlite3
import time
# This import statement is to disable urllib3 'insecure platform warning' exception.
import requests.packages.urllib3
requests.packages.urllib3.disable_warnings()
except :
print "Error in ... | {
"repo_name": "njanirudh/book-shelf-python",
"path": "book-shelf.py",
"copies": "1",
"size": "7371",
"license": "mit",
"hash": -9070863007492723000,
"line_mean": 31.047826087,
"line_max": 131,
"alpha_frac": 0.5234025234,
"autogenerated": false,
"ratio": 4.052226498075866,
"config_test": false,
... |
__author__="Anjali Gopal Reddy"
""" This is a nilearn based machine learning pipeline. Nilearn comes with code to simplify the use of scikit-learn when dealing with neuroimaging data. I have focussed on funcitonal MRI data
The following steps were applied before using the machine learning tool
1. Data loading and prep... | {
"repo_name": "anjaligr05/epilepsy_preprocessing",
"path": "pipeline_ml_anjali.py",
"copies": "1",
"size": "1997",
"license": "mit",
"hash": 339043345237210500,
"line_mean": 32.8474576271,
"line_max": 191,
"alpha_frac": 0.7255883826,
"autogenerated": false,
"ratio": 3.3847457627118644,
"config_... |
__author__ = 'ankesh'
from .models import BenchmarkLogs, MachineInfo, RtAverage, RtBldg391, RtM35, RtMoss, RtSphflake, RtStar, RtWorld
from django.db.models import Sum, Avg, get_model
def avgVGRvsProcessorFamily():
"""
Returns the aggregated data for Average VGR vs processor Family plot in the form of a dicti... | {
"repo_name": "ankeshanand/benchmark",
"path": "plots/data.py",
"copies": "1",
"size": "12630",
"license": "bsd-2-clause",
"hash": -5899356648686078000,
"line_mean": 43.9501779359,
"line_max": 117,
"alpha_frac": 0.6005542359,
"autogenerated": false,
"ratio": 4.021012416427889,
"config_test": fa... |
__author__ = 'ankit'
import os
from flask import Flask,request, redirect, Response
from flask_wtf.csrf import CsrfProtect
from backend import set
from slashcommands import ndreminder,widgetview,echo
from radio import mirchi,gaana
import requests
import json
import re
from bs4 import BeautifulSoup
from pyflock import F... | {
"repo_name": "ankit96/flockathon",
"path": "app.py",
"copies": "1",
"size": "2356",
"license": "mit",
"hash": -845193386968879700,
"line_mean": 28.0864197531,
"line_max": 166,
"alpha_frac": 0.6735993209,
"autogenerated": false,
"ratio": 3.0797385620915034,
"config_test": false,
"has_no_keywo... |
__author__ = 'ankit'
import os
from flask import Flask,request, redirect, Response
from moodle import main
from setuser import set,delete
import requests
import json
import re
from bs4 import BeautifulSoup
app = Flask(__name__)
@app.route('/moodle', methods=['post'])
def moodler():
text = request.values.get('t... | {
"repo_name": "ankit96/moodler",
"path": "app.py",
"copies": "1",
"size": "1870",
"license": "mit",
"hash": -1336090018442889200,
"line_mean": 29.1612903226,
"line_max": 132,
"alpha_frac": 0.643315508,
"autogenerated": false,
"ratio": 3.0505709624796085,
"config_test": false,
"has_no_keywords... |
__author__ = 'ank'
from chr_sep_human import human_loop as p_loop
from chr_sep_human import human_afterloop as p_afterloop
import os, errno
from pickle import load, dump
from kivy.clock import Clock
from mock import MagicMock, Mock
def safe_mkdir(path):
try:
os.mkdir(path)
except OSError as exc:
... | {
"repo_name": "chiffa/Chromosome_counter",
"path": "core_app_methods.py",
"copies": "1",
"size": "4048",
"license": "bsd-3-clause",
"hash": -8761346151646621000,
"line_mean": 35.8,
"line_max": 110,
"alpha_frac": 0.6277173913,
"autogenerated": false,
"ratio": 3.207606973058637,
"config_test": fa... |
__author__ = 'ank'
import numpy as np
import matplotlib.pyplot as plt
import PIL
from time import time
import mdp
from itertools import product
from skimage.segmentation import random_walker, mark_boundaries
# TODO: try using the data for the edge detection by assigning a null label to all the edge detectors, so that... | {
"repo_name": "chiffa/Chromosome_counter",
"path": "chr_sep_mouse.py",
"copies": "1",
"size": "3723",
"license": "bsd-3-clause",
"hash": -2138556363142463500,
"line_mean": 30.8205128205,
"line_max": 161,
"alpha_frac": 0.5976363148,
"autogenerated": false,
"ratio": 2.839816933638444,
"config_tes... |
__author__ = 'ank'
import numpy as np
import matplotlib.pyplot as plt
import PIL
import mdp
from itertools import product
from pickle import load, dump
from os import path
from time import time
from skimage.segmentation import random_walker, mark_boundaries
from skimage.morphology import convex_hull_image, label, dila... | {
"repo_name": "chiffa/Chromosome_counter",
"path": "chr_sep_human.py",
"copies": "1",
"size": "10016",
"license": "bsd-3-clause",
"hash": -4696142811031459000,
"line_mean": 30.9012738854,
"line_max": 135,
"alpha_frac": 0.6007388179,
"autogenerated": false,
"ratio": 2.9346615880457074,
"config_t... |
"""
Entry-point for generating synthetic text images, as described in:
@InProceedings{Gupta16,
author = "Gupta, A. and Vedaldi, A. and Zisserman, A.",
title = "Synthetic Data for Text Localisation in Natural Images",
booktitle = "IEEE Conference on Computer Vision and Pattern Recogni... | {
"repo_name": "ankush-me/SynthText",
"path": "gen.py",
"copies": "1",
"size": "4535",
"license": "apache-2.0",
"hash": -4000557173590476300,
"line_mean": 31.4,
"line_max": 117,
"alpha_frac": 0.6363836825,
"autogenerated": false,
"ratio": 3.16911250873515,
"config_test": false,
"has_no_keyword... |
"""
Main script for synthetic text rendering.
"""
from __future__ import division
import copy
import cv2
import h5py
from PIL import Image
import numpy as np
#import mayavi.mlab as mym
import matplotlib.pyplot as plt
import os.path as osp
import scipy.ndimage as sim
import scipy.spatial.distance as ssd
import synth... | {
"repo_name": "ankush-me/SynthText",
"path": "synthgen.py",
"copies": "1",
"size": "24099",
"license": "apache-2.0",
"hash": 6343746443363677000,
"line_mean": 33.9260869565,
"line_max": 121,
"alpha_frac": 0.5314328395,
"autogenerated": false,
"ratio": 3.3368872888396566,
"config_test": false,
... |
"""
Visualize the generated localization synthetic
data stored in h5 data-bases
"""
from __future__ import division
import os
import os.path as osp
import numpy as np
import matplotlib.pyplot as plt
import h5py
from common import *
def viz_textbb(text_im, charBB_list, wordBB, alpha=1.0):
"""
text_im : ima... | {
"repo_name": "ankush-me/SynthText",
"path": "visualize_results.py",
"copies": "1",
"size": "2152",
"license": "apache-2.0",
"hash": 2337062751092615700,
"line_mean": 27.6933333333,
"line_max": 86,
"alpha_frac": 0.5506505576,
"autogenerated": false,
"ratio": 2.984743411927878,
"config_test": fa... |
__author__ = 'anna'
from PetersScheme.Vertex import Vertex_DooSabin
from PetersScheme.Shape import Shape_DooSabin
def DooSabin(vertices, faces, alpha, iter):
vertices_refined = []
faces_refined = []
vertices_children = [ [] for _ in range(len(vertices))]#[None]*len(vertices)
edges = []
#get list... | {
"repo_name": "BGCECSE2015/CADO",
"path": "PYTHON/NURBSReconstruction/DooSabin/DooSabin.py",
"copies": "1",
"size": "10258",
"license": "bsd-3-clause",
"hash": 4447109340203719700,
"line_mean": 48.3221153846,
"line_max": 194,
"alpha_frac": 0.5923181907,
"autogenerated": false,
"ratio": 3.75750915... |
__author__ = 'anna'
import numpy as np
from DooSabin import DooSabin
from PetersScheme.Shape import Shape_DooSabin
from PetersScheme.Vertex import Vertex_DooSabin
def dooSabin_ABC(verts, faces):
quads = [None]*faces.shape[0]
listOfVertices = []
for i in range(len(verts)):
listOfVertices.appen... | {
"repo_name": "BGCECSE2015/CADO",
"path": "PYTHON/NURBSReconstruction/DooSabin/DualCont_to_ABC.py",
"copies": "1",
"size": "2290",
"license": "bsd-3-clause",
"hash": 7281524152789436000,
"line_mean": 39.9107142857,
"line_max": 97,
"alpha_frac": 0.6113537118,
"autogenerated": false,
"ratio": 2.570... |
__author__ = 'Annouk'
import os
import numpy as np
import matplotlib.pyplot as plt
def read_points(csv_file_name):
points = np.loadtxt(csv_file_name, delimiter = ',')
return points
def plot_clusters(centroids, clusters):
# we assume centroids is a list of points and clusters is a dictionary of arrays
... | {
"repo_name": "anamariad/ML",
"path": "Clusterization/clusterization/utils.py",
"copies": "1",
"size": "1884",
"license": "apache-2.0",
"hash": 7350578124336779000,
"line_mean": 29.4032258065,
"line_max": 97,
"alpha_frac": 0.6677282378,
"autogenerated": false,
"ratio": 3.3824057450628366,
"conf... |
__author__ = 'annyz'
import logging
import os
import sys
import time
import psutil
import json
from hydra.lib import util
from hydra.lib.hdaemon import HDaemonRepSrv
from hydra.lib.childmgr import ChildManager
from pprint import pformat
from kafka import KafkaConsumer
from pykafka import KafkaClient
l = util.createlo... | {
"repo_name": "kratos7/hydra",
"path": "src/main/python/hydra/kafkatest/kafka_sub.py",
"copies": "4",
"size": "6720",
"license": "apache-2.0",
"hash": 1869743067006366700,
"line_mean": 40.226993865,
"line_max": 109,
"alpha_frac": 0.5604166667,
"autogenerated": false,
"ratio": 3.5,
"config_test"... |
# pylint: disable=C0301,C0111,C0103,C0325
# pylint: disable=R1702,R0912,R0902,R0913,R0914,R0915
import sys
import math
import random
from operator import itemgetter
# class Unseen: provides lexical rules for unseen words
#
class Unseen:
# list of part of speech tags for unseen words
def __init__(self, file... | {
"repo_name": "anoopsarkar/nlp-class-hw",
"path": "cgw/pcfg_parse_gen.py",
"copies": "1",
"size": "26604",
"license": "apache-2.0",
"hash": -7348520376482699000,
"line_mean": 42.2585365854,
"line_max": 119,
"alpha_frac": 0.5511201323,
"autogenerated": false,
"ratio": 3.8240620957309184,
"config... |
__author__ = 'anson'
import requests
from monitor_default_format import split_token
url = "http://192.168.136.254"
send_event_state = {
'ok': ['normal'],
'non-ok': ['abnormal', 'failure']
}
class api_setting():
""" Use Paramiko to execute shell command through ssh"""
def __init__(self):
self... | {
"repo_name": "AnsonShie/system_monitor",
"path": "lib_monitor/event_handler_default.py",
"copies": "1",
"size": "2112",
"license": "apache-2.0",
"hash": -2485106894122458600,
"line_mean": 31.5076923077,
"line_max": 108,
"alpha_frac": 0.6098484848,
"autogenerated": false,
"ratio": 3.3470681458003... |
"""Class representing audio/* type MIME documents.
"""
import sndhdr
from cStringIO import StringIO
from email import Errors
from email import Encoders
from email.MIMENonMultipart import MIMENonMultipart
_sndhdr_MIMEmap = {'au' : 'basic',
'wav' :'x-wav',
'aiff':'x-aiff',
... | {
"repo_name": "neopoly/rubyfox-server",
"path": "lib/rubyfox/server/data/lib/Lib/email/MIMEAudio.py",
"copies": "11",
"size": "2598",
"license": "mit",
"hash": 4058878368506360000,
"line_mean": 34.5890410959,
"line_max": 77,
"alpha_frac": 0.6458814473,
"autogenerated": false,
"ratio": 4.040435458... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.