text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'Nicholas C Pandolfi'
import os
import sys
from .lrcompiler import construct, load, build, BUFFERSIZE
from .lrtools import ClosedError, checkdate
class dopen(object):
def __init__(self, file):
object.__init__(self)
self.filename = file
self.dirname = file[:file.index('.')] + '... | {
"repo_name": "nickpandolfi/linereader",
"path": "linereader/d_reader.py",
"copies": "2",
"size": "3528",
"license": "mit",
"hash": 6606069586080870000,
"line_mean": 28.1570247934,
"line_max": 91,
"alpha_frac": 0.5515873016,
"autogenerated": false,
"ratio": 4.116686114352392,
"config_test": fal... |
__author__ = 'Nicholas C Pandolfi'
import os
import sys
from multiprocessing import Process
from .lrtools import addspace, removespace, checkdate
from itertools import islice
BUFFERSIZE = 1024 ** 2
class NotCompiledError(Exception):
'''
This error is called when the user tried to load
from a '.lrdict' fi... | {
"repo_name": "nickpandolfi/linereader",
"path": "build/lib/linereader/lrcompiler.py",
"copies": "2",
"size": "4674",
"license": "mit",
"hash": -9072057949675483000,
"line_mean": 29.75,
"line_max": 110,
"alpha_frac": 0.622593068,
"autogenerated": false,
"ratio": 3.9744897959183674,
"config_test... |
from util.BasicWriter import BasicWriter
from util.Report import Report
class ReportWriter(BasicWriter):
def __init__(self):
BasicWriter.__init__(self)
self.headerNames = ["Row Names"]
def write(self, report):
headerNames = self.headerNames
headerNames.extend(report.return... | {
"repo_name": "bionomicron/Redirector",
"path": "util/ReportWriter.py",
"copies": "1",
"size": "1312",
"license": "mit",
"hash": -7253528374878632000,
"line_mean": 30.2619047619,
"line_max": 54,
"alpha_frac": 0.6478658537,
"autogenerated": false,
"ratio": 3.6750700280112043,
"config_test": fals... |
from Gnuplot import Gnuplot, Data
from core.util.Cache import SecondOrderCache
class Plot:
def __init__(self):
self.verbose = True
self.origin = (0,0)
self.data2 = []
self.data3 = []
self.g = Gnuplot()
self.g('set data style points')
self.g('set key... | {
"repo_name": "bionomicron/Redirector",
"path": "util/Plot.py",
"copies": "1",
"size": "4884",
"license": "mit",
"hash": -4645396110549206000,
"line_mean": 27.0689655172,
"line_max": 100,
"alpha_frac": 0.4942669943,
"autogenerated": false,
"ratio": 3.481111903064861,
"config_test": false,
"ha... |
__author__ = 'Nick Apperley'
# -*- coding: utf-8 -*-
#
# Establishes an OpenVPN connection using an OVPN file. Based on a Hacking Lab Python script
# (http://media.hacking-lab.com/largefiles/livecd/z_openvpn_config/backtrack/vpn-with-python.py). Requires Python 3
# and the pexpect library (module).
import pexpect
fro... | {
"repo_name": "napperley/OpenVPN_Tunneler",
"path": "openvpn.py",
"copies": "1",
"size": "1290",
"license": "apache-2.0",
"hash": 1096113971518603600,
"line_mean": 31.25,
"line_max": 115,
"alpha_frac": 0.696124031,
"autogenerated": false,
"ratio": 4.0062111801242235,
"config_test": false,
"ha... |
__author__ = 'Nick Apperley'
import json
import os
import shutil
import stat
model_file = ''
connections = None
def load_connections(username):
"""
Loads all connections from the model (JSON file) for the specified user into memory.
:type username: str
:param username: Name of the user.
"""
... | {
"repo_name": "napperley/OpenVPN_Tunneler",
"path": "connections_model.py",
"copies": "1",
"size": "2943",
"license": "apache-2.0",
"hash": -7510119819134371000,
"line_mean": 27.8529411765,
"line_max": 88,
"alpha_frac": 0.6360856269,
"autogenerated": false,
"ratio": 3.382758620689655,
"config_t... |
__author__ = 'Nick Apperley'
import os
import connections_model
import colour
import PyQt5.QtCore as QtCore
from PyQt5.QtGui import QRegExpValidator
from PyQt5.QtWidgets import QDialog, QFileDialog, QWidget, QDialogButtonBox
from PyQt5 import uic
class AddConnectionDialog(QDialog):
# Custom event.
connection... | {
"repo_name": "napperley/OpenVPN_Tunneler",
"path": "gui/add_connection_dialog.py",
"copies": "1",
"size": "4383",
"license": "apache-2.0",
"hash": -2841478200067416600,
"line_mean": 37.7876106195,
"line_max": 116,
"alpha_frac": 0.626739676,
"autogenerated": false,
"ratio": 3.631317315658658,
"... |
__author__ = 'Nick Apperley'
import os
import connections_model
import colour
import PyQt5.QtCore as QtCore
from PyQt5.QtGui import QValidator, QRegExpValidator
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QFileDialog, QWidget
from PyQt5 import uic
class EditConnectionDialog(QDialog):
# Custom event.
... | {
"repo_name": "napperley/OpenVPN_Tunneler",
"path": "gui/edit_connection_dialog.py",
"copies": "1",
"size": "4508",
"license": "apache-2.0",
"hash": 3141367196704559600,
"line_mean": 38.8938053097,
"line_max": 116,
"alpha_frac": 0.6381987578,
"autogenerated": false,
"ratio": 3.7011494252873565,
... |
__author__ = 'Nick Apperley'
import os
import connections_model
import openvpn
from gui.add_connection_dialog import AddConnectionDialog
from gui.edit_connection_dialog import EditConnectionDialog
from gui.connect_dialog import ConnectDialog
from PyQt5.QtWidgets import QMainWindow, QAction, QApplication, QTableWidgetI... | {
"repo_name": "napperley/OpenVPN_Tunneler",
"path": "gui/main_window.py",
"copies": "1",
"size": "6469",
"license": "apache-2.0",
"hash": 4012730521595193300,
"line_mean": 38.6871165644,
"line_max": 117,
"alpha_frac": 0.645540269,
"autogenerated": false,
"ratio": 4.030529595015576,
"config_test... |
__author__ = 'nickbortolotti'
import logging
import endpoints
from protorpc import messages
from protorpc import message_types
from protorpc import remote
#Funcionalidad de Mensajes
class Mensaje(messages.Message):
message = messages.StringField(1)
class ColeccionMensajes(messages.Message):
items = messages.... | {
"repo_name": "nbortolotti/Scalable-Service",
"path": "main.py",
"copies": "1",
"size": "1224",
"license": "apache-2.0",
"hash": 479741607039703740,
"line_mean": 31.2368421053,
"line_max": 88,
"alpha_frac": 0.693627451,
"autogenerated": false,
"ratio": 3.2815013404825737,
"config_test": false,
... |
__author__ = 'Nick Flanders'
import markov_chain, chord_prog
# Correct any errors in the chord progression
def cad64_5_1(prog):
"""
Return a chord progression with I chords following the V after a Cad64
:param prog: [Listof [Listof Number]]
:return: [Listof [Listof Number]]
"""
for index in ran... | {
"repo_name": "nflanders9/bach-in-a-box",
"path": "progression_fixers.py",
"copies": "1",
"size": "1480",
"license": "mit",
"hash": -888103741483385200,
"line_mean": 30.4893617021,
"line_max": 90,
"alpha_frac": 0.5959459459,
"autogenerated": false,
"ratio": 3.0641821946169774,
"config_test": fa... |
__author__ = 'Nick Flanders'
import progression_fixers
import midi
import midi_dicts
frequencies = midi_dicts.frequencies
def give_key(prog, key):
lookup = ["A", "B", "C", "D", "E", "F", "G"]
key = key.upper()
shift = ord(key) - 65
new_prog = []
for chord in prog:
new_chord = []
fo... | {
"repo_name": "nflanders9/bach-in-a-box",
"path": "midi_out.py",
"copies": "1",
"size": "1702",
"license": "mit",
"hash": 207593942107050240,
"line_mean": 32.3921568627,
"line_max": 82,
"alpha_frac": 0.6116333725,
"autogenerated": false,
"ratio": 3.4523326572008113,
"config_test": false,
"has... |
__author__ = 'Nick Flanders'
frequencies = dict(A_0 = 9,
A_1 = 21,
A_2 = 33,
A_3 = 45,
A_4 = 57,
A_5 = 69,
A_6 = 81,
A_7 = 93,
A_8 = 105,
A_9 = 117,
Ab_0 = 8,
Ab_1 = 20,
Ab_2 = 32,
Ab_3 = 44,
Ab_4 = 56,
Ab_5 = 68,
Ab_6 = 80,
Ab_7 = 92,
Ab_8 = 104,... | {
"repo_name": "nflanders9/bach-in-a-box",
"path": "midi_dicts.py",
"copies": "1",
"size": "2721",
"license": "mit",
"hash": -4824458095833912000,
"line_mean": 13.868852459,
"line_max": 28,
"alpha_frac": 0.3303932378,
"autogenerated": false,
"ratio": 2.0185459940652817,
"config_test": false,
"... |
__author__ = 'Nick Hirakawa'
from tokenizer import *
from stemmer import *
from stopword import *
class TextProcessor:
def __init__(self, filename, stop_file):
self.file = filename
self.lines = self.readlines()
self.buffer = ''
self.tokenizer = Tokenizer()
self.stemmer = ... | {
"repo_name": "nh0815/TextProcessor",
"path": "src/proc.py",
"copies": "1",
"size": "1424",
"license": "mit",
"hash": 700474292846359600,
"line_mean": 25.3888888889,
"line_max": 61,
"alpha_frac": 0.5723314607,
"autogenerated": false,
"ratio": 3.859078590785908,
"config_test": false,
"has_no_k... |
__author__ = 'Nick Hirakawa'
import re
from collections import OrderedDict
class CorpusParser:
def __init__(self, filename):
self.filename = filename
self.regex = re.compile('^#\s*\d+')
self.corpus = OrderedDict()
def parse(self):
with open(self.filename) as f:
s = ''.join(f.readlines())
blobs = s.s... | {
"repo_name": "nh0815/PySearch",
"path": "engine/parse.py",
"copies": "1",
"size": "1062",
"license": "mit",
"hash": 6015645930819352000,
"line_mean": 19.0566037736,
"line_max": 69,
"alpha_frac": 0.615819209,
"autogenerated": false,
"ratio": 2.765625,
"config_test": false,
"has_no_keywords": ... |
__author__ = 'Nick Hirakawa'
from invdx import build_data_structures
from rank import *
from collections import OrderedDict
import operator
from db import cursor
class QueryProcessor:
def __init__(self, idx, dlt, ft):
#self.index, self.ft, self.dlt = build_data_structures(corpus)
self.idx_file = idx
self.dlt... | {
"repo_name": "nh0815/PySearch",
"path": "engine/query.py",
"copies": "1",
"size": "3638",
"license": "mit",
"hash": -5277608323337638000,
"line_mean": 30.094017094,
"line_max": 115,
"alpha_frac": 0.6366135239,
"autogenerated": false,
"ratio": 3.0090984284532674,
"config_test": false,
"has_no... |
__author__ = 'Nick Hirakawa'
from invdx import build_data_structures
from rank import *
from collections import OrderedDict
import operator
class QueryProcessor:
def __init__(self, queries, idx, dlt, ft, score_function='BM25'):
self.queries = queries
#self.index, self.ft, self.dlt = build_data_structures(corpu... | {
"repo_name": "nh0815/QueryLikelihood",
"path": "src/query.py",
"copies": "1",
"size": "4047",
"license": "mit",
"hash": -4388954000468258300,
"line_mean": 31.9024390244,
"line_max": 121,
"alpha_frac": 0.6261428218,
"autogenerated": false,
"ratio": 3.036009002250563,
"config_test": false,
"ha... |
__author__ = 'Nick Hirakawa'
from parse import *
from query import *
import operator
import os
import subprocess
def main():
qp = QueryParser(filename='../text/queries.txt')
cp = CorpusParser(filename='../text/corpus.txt')
qp.parse()
print 'parsing queries'
queries = qp.get_queries()
print 'parsing corpus'
c... | {
"repo_name": "nh0815/QueryLikelihood",
"path": "src/main.py",
"copies": "1",
"size": "1428",
"license": "mit",
"hash": 1198305304344669000,
"line_mean": 24.5,
"line_max": 104,
"alpha_frac": 0.6365546218,
"autogenerated": false,
"ratio": 2.9083503054989817,
"config_test": false,
"has_no_keywo... |
__author__ = "Nick Isaacs"
import ConfigParser
import os
import logging.handlers
import logging
import sys
RELATIVE_CONFIG_PATH = "../../config/gnip.cfg"
class Envirionment(object):
def __init__(self):
# Just for reference, not all that clean right now
self.config_file_name = None
self.co... | {
"repo_name": "gnip/sample-python-connector",
"path": "src/utils/Envirionment.py",
"copies": "1",
"size": "4625",
"license": "mit",
"hash": 3413853321163285500,
"line_mean": 39.9292035398,
"line_max": 115,
"alpha_frac": 0.5926486486,
"autogenerated": false,
"ratio": 3.7449392712550607,
"config_... |
__author__ = "Nick Isaacs"
import multiprocessing
import logging
from multiprocessing import queues
from pymongo import MongoClient
from src.processor.BaseProcessor import BaseProcessor
MONGO_COLLECTION = "tweets"
class MongoProcessor(BaseProcessor):
def __init__(self, _upstream, _enviroinment):
BaseProc... | {
"repo_name": "gnip/sample-python-connector",
"path": "src/processor/MongoProcessor.py",
"copies": "1",
"size": "1810",
"license": "mit",
"hash": -6884802520862299000,
"line_mean": 28.6885245902,
"line_max": 82,
"alpha_frac": 0.617679558,
"autogenerated": false,
"ratio": 3.89247311827957,
"conf... |
__author__ = "Nick Isaacs"
import multiprocessing
import logging
import random
from multiprocessing import queues
from pymongo import MongoClient
from src.processor.BaseProcessor import BaseProcessor
MONGO_COLLECTIONS = {"lncs":"lncs_combined_gnip","dietssds":"dietssds_decanted_gnip"}
class MongoProcessor(BaseProces... | {
"repo_name": "faaez/sample-python-connector",
"path": "src/processor/MongoProcessor.py",
"copies": "1",
"size": "2238",
"license": "mit",
"hash": 7491574523641418000,
"line_mean": 31.9117647059,
"line_max": 102,
"alpha_frac": 0.6112600536,
"autogenerated": false,
"ratio": 3.8854166666666665,
"... |
__author__ = 'Nicklas Boerjesson'
from smb.SMBConnection import SMBConnection
def windowfy(_value):
"""
Turn backslashes into forward slashes
:param _value: A string value
"""
return _value.replace("/", "\\")
def split_smb_path(_path):
"""
Parse the Service name from a full path
:pa... | {
"repo_name": "OptimalBPM/optimal_file_sync",
"path": "service/lib/smbutils.py",
"copies": "1",
"size": "1618",
"license": "apache-2.0",
"hash": -224246038693653820,
"line_mean": 29.5283018868,
"line_max": 105,
"alpha_frac": 0.6625463535,
"autogenerated": false,
"ratio": 3.8615751789976134,
"co... |
__author__ = 'nickmab'
"""A module containing handy custom exceptions used elsewhere in nickmab.async_util"""
class ProducerException(Exception):
"""Exception for wrapping an exception caught in a thread or subproc running a generator
Attributes:
caught_exception (Exception): The exception that this ... | {
"repo_name": "nickmab/async_util",
"path": "nickmab/async_util/_exceptions.py",
"copies": "1",
"size": "2011",
"license": "mit",
"hash": -730358836218865400,
"line_mean": 43.6888888889,
"line_max": 101,
"alpha_frac": 0.6862257583,
"autogenerated": false,
"ratio": 4.965432098765432,
"config_tes... |
__author__ = 'nickmab'
import nickmab.async_util.threads as thr
from _utils import expect_specific_err as _expect_specific_err
"""To be run by executing py.test in the parent dir"""
def _gen():
yield 1
def test_funcwrap_no_args():
f = lambda: 1
fw = thr.FuncWrap(f)
fw.run()
assert fw.result == 1... | {
"repo_name": "nickmab/async_util",
"path": "tests/test_threads.py",
"copies": "1",
"size": "3646",
"license": "mit",
"hash": -7765045801763607000,
"line_mean": 30.7043478261,
"line_max": 107,
"alpha_frac": 0.6226001097,
"autogenerated": false,
"ratio": 3.1842794759825326,
"config_test": true,
... |
__author__ = 'nickmab'
import types
from . import _utils
from _utils import validate_type as _validate_type
from _utils import is_coroutine as _is_coroutine
import multiprocessing as mp
"""Contains boilerplate code for working with common subprocess-related tasks."""
def generate_and_consume(producer_gen, consumer_f... | {
"repo_name": "nickmab/async_util",
"path": "nickmab/async_util/subprocs.py",
"copies": "1",
"size": "11761",
"license": "mit",
"hash": -2407982617611913000,
"line_mean": 43.2142857143,
"line_max": 110,
"alpha_frac": 0.5967179662,
"autogenerated": false,
"ratio": 4.6339637509850276,
"config_tes... |
__author__ = 'nickmab'
import types
import threadpool
from threading import Thread, Lock
from Queue import Queue
from . import _utils
from _utils import validate_type as _validate_type
from _utils import is_coroutine as _is_coroutine
from _exceptions import ConsumerException, ProducerException
"""Contains convenience... | {
"repo_name": "nickmab/async_util",
"path": "nickmab/async_util/threads.py",
"copies": "1",
"size": "16217",
"license": "mit",
"hash": -9040703572258311000,
"line_mean": 44.5533707865,
"line_max": 122,
"alpha_frac": 0.6092988839,
"autogenerated": false,
"ratio": 4.561744022503516,
"config_test"... |
__author__ = 'nickmab'
"""Module for doing web requests with the help of nickmab.async_util.threads module."""
import types
import urllib2
import json
from . import threads as thr
from _utils import validate_type as _validate_type
class JSONQueryPool(object):
"""Run JSON web requests in a ThreadPool, collect and... | {
"repo_name": "nickmab/async_util",
"path": "nickmab/async_util/web.py",
"copies": "1",
"size": "5521",
"license": "mit",
"hash": -586095350672642400,
"line_mean": 39.8962962963,
"line_max": 104,
"alpha_frac": 0.6102155407,
"autogenerated": false,
"ratio": 4.343823760818253,
"config_test": fals... |
__author__ = 'nick'
from sklearn.feature_extraction.text import TfidfVectorizer
from pymongo import MongoClient
import operator
import re
"""
This class is used to create the target models
Libraries:
- PyMongo http://api.mongodb.org/python/current/
- scikit-learn http://scikit-learn.org/stable/
... | {
"repo_name": "Rickyfox/SPR",
"path": "SPR_Rec/DocumentProcessor.py",
"copies": "1",
"size": "5104",
"license": "apache-2.0",
"hash": -8792492908226087000,
"line_mean": 33.0333333333,
"line_max": 106,
"alpha_frac": 0.5617163009,
"autogenerated": false,
"ratio": 3.869598180439727,
"config_test":... |
__author__ = 'nick'
import os.path
import textract
import urllib2
import cookielib
import time
from bs4 import BeautifulSoup
from pymongo import MongoClient
"""
Class to gather documents for the corpus
Libraries:
- Textract http://textract.readthedocs.org/en/latest/index.html
- BeautifulSoup4 http:/... | {
"repo_name": "Rickyfox/SPR",
"path": "SPR_Crawl/crawl.py",
"copies": "1",
"size": "9627",
"license": "apache-2.0",
"hash": 8723768330055578000,
"line_mean": 32.543554007,
"line_max": 124,
"alpha_frac": 0.5542744365,
"autogenerated": false,
"ratio": 4.122912205567451,
"config_test": false,
"h... |
__author__ = 'nick'
#!python
# -*- coding: utf-8 -*-
import requests
import argparse
class Connect():
"""
Abstact class / Make a connection object to haystack server using requests module
A class must be made for different type of server. See NiagaraAXConnection(HaystackConnection)
"""
def __in... | {
"repo_name": "Smart-Green/needle",
"path": "pyhaystack/mango/MangoClient.py",
"copies": "1",
"size": "2914",
"license": "apache-2.0",
"hash": -2704581485428757500,
"line_mean": 35.425,
"line_max": 107,
"alpha_frac": 0.5909402883,
"autogenerated": false,
"ratio": 4.342771982116244,
"config_test... |
"""Collection of auth functions for the bot"""
class AdminAuth(object):
def __init__(self, password):
self.password = password
self.auth_pool = set()
def authenticate(self, password):
return bool(self.password) and password == self.password
def is_admin(self, username):
re... | {
"repo_name": "nickraptis/fidibot",
"path": "src/auth.py",
"copies": "1",
"size": "1230",
"license": "bsd-2-clause",
"hash": -5712633010480928000,
"line_mean": 28.2857142857,
"line_max": 64,
"alpha_frac": 0.6430894309,
"autogenerated": false,
"ratio": 3.84375,
"config_test": false,
"has_no_ke... |
"""Collection of introspection functions for the bot"""
import inspect
# General introspection functions #
###################################
def get_full_help(doc_lines):
"""Join the doctype to produce full help string."""
full = []
for line in doc_lines:
full.append(line)
return "\n".join(... | {
"repo_name": "nickraptis/fidibot",
"path": "src/introspect.py",
"copies": "1",
"size": "4322",
"license": "bsd-2-clause",
"hash": 1233385626705330000,
"line_mean": 26.7051282051,
"line_max": 75,
"alpha_frac": 0.568718186,
"autogenerated": false,
"ratio": 3.9870848708487086,
"config_test": fals... |
"""
Base classes for fidibot modules.
Terminology
-----------
A Module class acts as a dispatcher and state keeper for the module.
It is basically a factory for Context objects.
Add in it whatever you wish to keep between events.
A Context on the other hand is the actual workhorse of the module.
It is stateless and a... | {
"repo_name": "nickraptis/fidibot",
"path": "src/modules/basemodule.py",
"copies": "1",
"size": "8615",
"license": "bsd-2-clause",
"hash": 5277934026576437000,
"line_mean": 31.5094339623,
"line_max": 81,
"alpha_frac": 0.6008125363,
"autogenerated": false,
"ratio": 4.560614081524617,
"config_tes... |
"""
Module for Basic Commands to the fidibot
Apart for holding a base set of commands for the bot, this module also
serves as an example of how to build a module for fidibot.
"""
# As such, be sure to spend extra care while developing,
# so it is always clean and understandable ;)
from basemodule import BaseModule, B... | {
"repo_name": "nickraptis/fidibot",
"path": "src/modules/basiccmds.py",
"copies": "1",
"size": "5135",
"license": "bsd-2-clause",
"hash": 2468902843146927000,
"line_mean": 37.9015151515,
"line_max": 119,
"alpha_frac": 0.5904576436,
"autogenerated": false,
"ratio": 3.965250965250965,
"config_tes... |
"""
Modules package for fidibot.
Interesting attributes
----------------------
active: A list of module names to import. Add modules here to activate them.
Base classes
------------
Base classes live in the 'basemodule' file.
"""
# define modules to get functionality from
system_mods = ["ignore", "basiccmds", "updat... | {
"repo_name": "nickraptis/fidibot",
"path": "src/modules/__init__.py",
"copies": "1",
"size": "1556",
"license": "bsd-2-clause",
"hash": 3288163481938901500,
"line_mean": 34.3636363636,
"line_max": 83,
"alpha_frac": 0.6137532134,
"autogenerated": false,
"ratio": 4.127320954907161,
"config_test"... |
"""Module to hold logging functions"""
import logging
import re, sys
import irc.events
from logging.handlers import TimedRotatingFileHandler as TRHandler
colors = """
\x1f| # Underline
\x02| # Bold
\x12| # Reverse
\x0f| # Normal
\x16| # Itali... | {
"repo_name": "nickraptis/fidibot",
"path": "src/logsetup.py",
"copies": "1",
"size": "6702",
"license": "bsd-2-clause",
"hash": -6541811168432935000,
"line_mean": 33.725388601,
"line_max": 81,
"alpha_frac": 0.5713219934,
"autogenerated": false,
"ratio": 4.015578190533254,
"config_test": false,... |
__author__ = 'Nick'
from urllib2 import *
from re import *
from robotparser import *
from urlparse import *
from time import sleep
from HTMLParser import HTMLParser
from argparse import ArgumentParser
class LinkParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.links = []
d... | {
"repo_name": "nh0815/PyCrawler",
"path": "src/PyCrawler.py",
"copies": "1",
"size": "3587",
"license": "mit",
"hash": 7807056704016803000,
"line_mean": 25.5923076923,
"line_max": 108,
"alpha_frac": 0.6342347365,
"autogenerated": false,
"ratio": 3.092241379310345,
"config_test": false,
"has_n... |
import arcpy, sys
def FieldExists(featureclass, fieldname):
fieldList = arcpy.ListFields(featureclass, fieldname)
fieldCount = len(fieldList)
if (fieldCount == 1):
return True
else:
return False
## Declare variables
fc = r"C:\GIS\CCVA\Risk.gdb\AQ_MajorRoadsRC"
fields = ['RD_CHAR', ... | {
"repo_name": "ronn4031/ccva",
"path": "update_buffer_field.py",
"copies": "2",
"size": "1578",
"license": "mit",
"hash": 5253589382247002000,
"line_mean": 26.6842105263,
"line_max": 91,
"alpha_frac": 0.6134347275,
"autogenerated": false,
"ratio": 3.1185770750988144,
"config_test": false,
"ha... |
from __future__ import division
import arcpy
import math
import csv
import os
import sys
######
## Define functions necessary for the script
######
def calculate_estimate(inList):
"""
Sum values from the rows of a table.
:param inList: 2d "array" containing values from a row in a table to be summed.
... | {
"repo_name": "nronnei/ccva",
"path": "advanced_MOE_tracker.py",
"copies": "2",
"size": "12326",
"license": "mit",
"hash": 7953618946130441000,
"line_mean": 29.4345679012,
"line_max": 131,
"alpha_frac": 0.5812915788,
"autogenerated": false,
"ratio": 3.4643057897695333,
"config_test": false,
"... |
__author__ = 'nickv'
class Convertor:
def __init__(self):
pass
@staticmethod
def headline(rst_file, wiki_headline, level=2):
"""
:param rst_file:
:param wiki_headline:
:param level:
:type rst_file: FileIO
:type wiki_headline: string
:type l... | {
"repo_name": "nickvergessen/wiki2rst-convertor",
"path": "wiki2rst/convertor.py",
"copies": "1",
"size": "2153",
"license": "mit",
"hash": -8446239143687539000,
"line_mean": 24.630952381,
"line_max": 78,
"alpha_frac": 0.4765443567,
"autogenerated": false,
"ratio": 3.7838312829525482,
"config_t... |
__author__ = 'Nicky'
from pymongo import MongoClient
import json
client = MongoClient('localhost', 27017)
db = client.museums
out_file = open("data/related_museums.js","w")
data = []
allHashtags = []
for museum in db.museum_locations.find():
collectedHashtags = []
relatedMuseums = []
name = museum['id']
... | {
"repo_name": "mvjacobs/TheSocialMuseum",
"path": "RelatedMuseums.py",
"copies": "1",
"size": "1597",
"license": "mit",
"hash": 3239654422989598000,
"line_mean": 37.0238095238,
"line_max": 108,
"alpha_frac": 0.598622417,
"autogenerated": false,
"ratio": 3.7313084112149535,
"config_test": false,... |
from __future__ import absolute_import, division, print_function
import os
import time
import gpi
import numpy as np
# bart
import bart
import bart.python.cfl as cfl
class ExternalNode(gpi.NodeAPI):
"""Read arrays that were written as cfl+hdr files
OUTPUT: Numpy array read from file
WIDGETS:
I... | {
"repo_name": "nckz/bart",
"path": "gpi/ReadCFL_GPI.py",
"copies": "1",
"size": "2759",
"license": "bsd-3-clause",
"hash": -7249336743587654000,
"line_mean": 28.3510638298,
"line_max": 102,
"alpha_frac": 0.5723088075,
"autogenerated": false,
"ratio": 3.6112565445026177,
"config_test": false,
... |
from __future__ import absolute_import, division, print_function
import os
# gpi, future
import gpi
from bart.gpi.borg import IFilePath, OFilePath, Command
# bart
import bart
base_path = bart.__path__[0] # library base for executables
import bart.python.cfl as cfl
class ExternalNode(gpi.NodeAPI):
'''Usage: sca... | {
"repo_name": "nckz/bart",
"path": "gpi/Scale_GPI.py",
"copies": "1",
"size": "1383",
"license": "bsd-3-clause",
"hash": 4315123282321598500,
"line_mean": 22.8448275862,
"line_max": 70,
"alpha_frac": 0.6015907448,
"autogenerated": false,
"ratio": 3.50126582278481,
"config_test": false,
"has_n... |
from __future__ import absolute_import, division, print_function
import os
# gpi
import gpi
from bart.gpi.borg import IFilePath, OFilePath, Command
# bart
import bart
base_path = bart.__path__[0] # library base for executables
import bart.python.cfl as cfl
class ExternalNode(gpi.NodeAPI):
'''Usage: ./caldir ca... | {
"repo_name": "nckz/bart",
"path": "gpi/CalDir_GPI.py",
"copies": "1",
"size": "1613",
"license": "bsd-3-clause",
"hash": 9146150061578868000,
"line_mean": 25.8833333333,
"line_max": 75,
"alpha_frac": 0.6249225046,
"autogenerated": false,
"ratio": 3.6004464285714284,
"config_test": false,
"ha... |
from __future__ import absolute_import, division, print_function
import os, re
# gpi
import gpi
from bart.gpi.borg import IFilePath, OFilePath, Command
# bart
import bart
base_path = bart.__path__[0] # library base for executables
import bart.python.cfl as cfl
class ExternalNode(gpi.NodeAPI):
'''Usage: ./nufft... | {
"repo_name": "nckz/bart",
"path": "gpi/NuFFT_GPI.py",
"copies": "1",
"size": "2728",
"license": "bsd-3-clause",
"hash": 6045097853393413000,
"line_mean": 28.978021978,
"line_max": 135,
"alpha_frac": 0.5608504399,
"autogenerated": false,
"ratio": 3.5753604193971165,
"config_test": false,
"has... |
import numpy as np
import gpi
# This is a template node, with stubs for initUI() (input/output ports,
# widgets), validate(), and compute().
# Documentation for the node API can be found online:
# http://docs.gpilab.com/NodeAPI
class ExternalNode(gpi.NodeAPI):
"""FOVShift uses the coordinates and input shift arg... | {
"repo_name": "gpilab/bni-nodes",
"path": "gridding/GPI/FOVShift_GPI.py",
"copies": "1",
"size": "5149",
"license": "bsd-3-clause",
"hash": -7364136212829642000,
"line_mean": 41.9083333333,
"line_max": 111,
"alpha_frac": 0.5292289765,
"autogenerated": false,
"ratio": 3.5315500685871055,
"config... |
__author__ = 'nicococo'
import numpy as np
from numba import autojit
class SvddPrimalSGD(object):
""" Primal subgradient descent solver for the support vector data description (SVDD).
Author: Nico Goernitz, TU Berlin, 2015
"""
PRECISION = 10**-3 # important: effects the threshold, support vector... | {
"repo_name": "nicococo/ClusterSvdd",
"path": "ClusterSVDD/svdd_primal_sgd.py",
"copies": "1",
"size": "4493",
"license": "mit",
"hash": 8169443169081441000,
"line_mean": 30.4195804196,
"line_max": 92,
"alpha_frac": 0.5417315825,
"autogenerated": false,
"ratio": 3.1507713884992987,
"config_test... |
__author__ = 'nicococo'
import numpy as np
from numba import jit
class SvddPrimalSGD(object):
""" Primal subgradient descent solver for the support vector data description (SVDD).
Author: Nico Goernitz, TU Berlin, 2015
"""
PRECISION = 10**-3 # important: effects the threshold, support vectors an... | {
"repo_name": "nicococo/tilitools",
"path": "tilitools/svdd_primal_sgd.py",
"copies": "1",
"size": "4511",
"license": "mit",
"hash": 7678967164899721000,
"line_mean": 30.7676056338,
"line_max": 107,
"alpha_frac": 0.5433385059,
"autogenerated": false,
"ratio": 3.1545454545454548,
"config_test": ... |
__author__ = 'nicococo'
import numpy as np
class ClusterSvdd:
""" Implementation of the cluster support vector data description (ClusterSVDD).
Author: Nico Goernitz, TU Berlin, 2015
"""
def __init__(self, svdds, nu=-1.0):
self.clusters = len(svdds)
self.svdds = svdds
self.... | {
"repo_name": "nicococo/tilitools",
"path": "tilitools/cluster_svdd.py",
"copies": "1",
"size": "2768",
"license": "mit",
"hash": -3955551596854659600,
"line_mean": 38.5428571429,
"line_max": 98,
"alpha_frac": 0.5661127168,
"autogenerated": false,
"ratio": 3.6710875331564985,
"config_test": fal... |
__author__ = 'Nico Goernitz'
import matplotlib.pyplot as plt
import sklearn.metrics as metrics
import numpy as np
from ClusterSVDD.svdd_dual_qp import SvddDualQP
from ClusterSVDD.svdd_primal_sgd import SvddPrimalSGD
from ClusterSVDD.cluster_svdd import ClusterSvdd
def generate_data(datapoints, outlier_frac=0.1, di... | {
"repo_name": "nicococo/ClusterSvdd",
"path": "scripts/test_anom.py",
"copies": "1",
"size": "5537",
"license": "mit",
"hash": -4094170487100355000,
"line_mean": 37.1862068966,
"line_max": 157,
"alpha_frac": 0.5445186924,
"autogenerated": false,
"ratio": 2.880853277835588,
"config_test": true,
... |
import numpy
import sys
import theano
import theano.tensor as T
import pickle
import os
import numpy as np
def gauss_newton_product(cost, p, v, s): # this computes the product Gv = J'HJv (G is the Gauss-Newton matrix)
Jv = T.Rop(s, p, v)
HJv = T.grad(T.sum(T.grad(cost, s)*Jv), s, consider_constant=[Jv], discon... | {
"repo_name": "iankuoli/final_rnn",
"path": "hf.py",
"copies": "1",
"size": "16560",
"license": "bsd-3-clause",
"hash": -6133363318107701000,
"line_mean": 36.2972972973,
"line_max": 247,
"alpha_frac": 0.614794686,
"autogenerated": false,
"ratio": 3.396923076923077,
"config_test": false,
"has_... |
import numpy as np
import sys
import theano
import theano.tensor as tt
import pickle
import os
def gauss_newton_product(cost, params, vars, obj):
# this computes the product Gv = J'HJv (G is the Gauss-Newton matrix)
Jv = tt.Rop(obj, params, vars)
HJv = tt.grad(tt.sum(tt.grad(cost, obj) * Jv), obj,
... | {
"repo_name": "rakeshvar/theano-hf",
"path": "hf.py",
"copies": "1",
"size": "16142",
"license": "bsd-3-clause",
"hash": -4225047333177082000,
"line_mean": 38.0847457627,
"line_max": 101,
"alpha_frac": 0.5389047206,
"autogenerated": false,
"ratio": 4.119959162838183,
"config_test": false,
"ha... |
import numpy, sys
import theano
import theano.tensor as T
import cPickle
import os
def gauss_newton_product(cost, p, v, s): # this computes the product Gv = J'HJv (G is the Gauss-Newton matrix)
Jv = T.Rop(s, p, v)
HJv = T.grad(T.sum(T.grad(cost, s)*Jv), s, consider_constant=[Jv], disconnected_inputs='ignore')... | {
"repo_name": "Snazz2001/theano-hf",
"path": "hf.py",
"copies": "5",
"size": "13414",
"license": "bsd-3-clause",
"hash": 604585541733244500,
"line_mean": 38.3372434018,
"line_max": 247,
"alpha_frac": 0.6479797227,
"autogenerated": false,
"ratio": 3.487779511180447,
"config_test": false,
"has_... |
import numpy, sys
import theano
import theano.tensor as T
import pickle
import os
from rllab.misc.ext import compile_function
import collections
def gauss_newton_product(cost, p, v, s): # this computes the product Gv = J'HJv (G is the Gauss-Newton matrix)
if not isinstance(s, (list, tuple)):
s = [s]
... | {
"repo_name": "brain-research/mirage-rl-qprop",
"path": "rllab/optimizers/hf.py",
"copies": "2",
"size": "15714",
"license": "mit",
"hash": -3016536816422476300,
"line_mean": 43.0168067227,
"line_max": 138,
"alpha_frac": 0.575283187,
"autogenerated": false,
"ratio": 3.893458870168484,
"config_t... |
import numpy, sys
import theano
import theano.tensor as T
import cPickle
import os
import pdb
import copy
def sgd_optimizer(p,inputs,costs,train_set,updates_old=None,monitor=None,consider_constant=[],lr=0.001,
num_epochs=300,save=False,output_folder=None,iteration=0):
'''SGD optimizer with a sim... | {
"repo_name": "alexanderchurchill/nadesid",
"path": "optimizers.py",
"copies": "1",
"size": "13142",
"license": "apache-2.0",
"hash": 5201537457284414000,
"line_mean": 38.3473053892,
"line_max": 247,
"alpha_frac": 0.6446507381,
"autogenerated": false,
"ratio": 3.496142591114658,
"config_test": ... |
import numpy, sys
import theano
import theano.tensor as T
import cPickle
import os
import pdb
def gauss_newton_product(cost, p, v, s): # this computes the product Gv = J'HJv (G is the Gauss-Newton matrix)
Jv = T.Rop(s, p, v)
HJv = T.grad(T.sum(T.grad(cost, s)*Jv), s, consider_constant=[Jv], disconnected_inputs=... | {
"repo_name": "daleloogn/singerID-ICASSP-MLP",
"path": "hf.py",
"copies": "1",
"size": "11867",
"license": "apache-2.0",
"hash": 4321717185353851400,
"line_mean": 38.5566666667,
"line_max": 134,
"alpha_frac": 0.6367236875,
"autogenerated": false,
"ratio": 3.441705336426914,
"config_test": false... |
from __future__ import print_function
import glob
import os
from constants import *
import sys
import numpy
try:
import pylab
except ImportError:
print ("pylab isn't available. If you use its functionality, it will crash.")
print("It can be installed with 'pip install -q Pillow'")
from midi.utils impo... | {
"repo_name": "feynmanliang/bachbot",
"path": "scripts/rnnrbm/rnnrbm.py",
"copies": "1",
"size": "11775",
"license": "mit",
"hash": 3584420868050102000,
"line_mean": 38.9152542373,
"line_max": 81,
"alpha_frac": 0.6076433121,
"autogenerated": false,
"ratio": 3.7098298676748582,
"config_test": tr... |
import glob
import os
import sys
import numpy
try:
import pylab
except ImportError:
print (
"pylab isn't available. If you use its functionality, it will crash."
)
print "It can be installed with 'pip install -q Pillow'"
from midi.utils import midiread, midiwrite
import theano
import theano.t... | {
"repo_name": "xuezhisd/DeepLearningTutorials",
"path": "code/rnnrbm.py",
"copies": "34",
"size": "11626",
"license": "bsd-3-clause",
"hash": 7037874531537982000,
"line_mean": 37.6245847176,
"line_max": 79,
"alpha_frac": 0.6050232238,
"autogenerated": false,
"ratio": 3.741873189571934,
"config_... |
import glob
import os
import sys
import numpy
try:
import pylab
except ImportError:
print "pylab isn't available, if you use their fonctionality, it will crash"
print "It can be installed with 'pip install -q Pillow'"
from midi.utils import midiread, midiwrite
import theano
import theano.tensor as T
from... | {
"repo_name": "xiawei0000/Kinectforactiondetect",
"path": "TheanoDL/rnnrbm.py",
"copies": "1",
"size": "11088",
"license": "mit",
"hash": -719790139631658100,
"line_mean": 38.1802120141,
"line_max": 80,
"alpha_frac": 0.6345598846,
"autogenerated": false,
"ratio": 3.583710407239819,
"config_test... |
from .MidiOutFile import MidiOutFile
from .MidiInFile import MidiInFile
from .MidiOutStream import MidiOutStream
import numpy
class midiread(MidiOutStream):
def __init__(self, filename, r=(21, 109), dt=0.2):
self.notes = []
self._tempo = 500000
self.beat = 0
self.time = 0.0
midi_in = MidiInF... | {
"repo_name": "JonathanRaiman/Dali",
"path": "data/score_informed_transcription/midi/utils.py",
"copies": "2",
"size": "2374",
"license": "mit",
"hash": -6755128126261802000,
"line_mean": 26.6046511628,
"line_max": 90,
"alpha_frac": 0.6331086773,
"autogenerated": false,
"ratio": 2.75725900116144,... |
__author__ = 'Nicolas'
import inspect
def command(command_string):
"""
Decorator for commands (command_string is the command itself)
"""
def decorator(func):
func.command_string = command_string
return func
return decorator
class CmdLine(object):
"""
A class to easily cre... | {
"repo_name": "musashin/ezTorrent",
"path": "commandline.py",
"copies": "1",
"size": "3291",
"license": "mit",
"hash": -8039876969409998000,
"line_mean": 25.7642276423,
"line_max": 107,
"alpha_frac": 0.5019750836,
"autogenerated": false,
"ratio": 4.219230769230769,
"config_test": false,
"has_... |
__author__ = 'Nicolas'
import subprocess
import os.path
import platform
import tkFileDialog, Tkinter
import localisation
from os import listdir
from os.path import isdir, join
import server_prop
import conf
__worlds_directories = {('Windows', '7'): r'%appdata%\.minecraft\saves'}
def start_server(exe_path):
subproc... | {
"repo_name": "musashin/PyMine",
"path": "mineserv.py",
"copies": "1",
"size": "1452",
"license": "mit",
"hash": 6517932041363887000,
"line_mean": 33.5952380952,
"line_max": 124,
"alpha_frac": 0.6701101928,
"autogenerated": false,
"ratio": 3.4004683840749412,
"config_test": false,
"has_no_key... |
__author__ = 'nicolas'
import Bus
import datetime
import Message
import DiscreteBit
from xml.etree.ElementTree import Element, SubElement, Comment, ElementTree
from _version import __version__
def serialize(stream, objectToSerialize, serializeState = False):
#TODO: add try
generated_on = str(datetime.datet... | {
"repo_name": "musashin/Py429",
"path": "ARINC429/XMLSerializer.py",
"copies": "2",
"size": "1086",
"license": "mit",
"hash": -960572367029183900,
"line_mean": 30.0285714286,
"line_max": 118,
"alpha_frac": 0.7044198895,
"autogenerated": false,
"ratio": 3.62,
"config_test": true,
"has_no_keywo... |
__author__ = 'Nicolas'
import re
class ServerProp:
def __init__(self, fully_qualified_path):
self.path = fully_qualified_path
self.lines = list()
def load(self):
line_format = re.compile("""
^(?P<property>[\w\-]*) #property
... | {
"repo_name": "musashin/PyMine",
"path": "server_prop.py",
"copies": "1",
"size": "2158",
"license": "mit",
"hash": -2372485812996570000,
"line_mean": 39.7169811321,
"line_max": 95,
"alpha_frac": 0.4462465246,
"autogenerated": false,
"ratio": 4.223091976516634,
"config_test": true,
"has_no_ke... |
__author__ = 'Nicole'
import tweepy
from tweepy import Stream
import json
import indicoio
import time
from googleapiclient.discovery import build
# Tokens and keys
consumer_key = "nEcXxJ8rQ7UyDrPYzzDTFScLl"
consumer_secret = "60GrqyEeVwLLP5fLnx6OUtAixrAGpinZ1eBcujwCi4xKRutSPz"
access_token = "23385479-1AuhkNFfVDuzScT... | {
"repo_name": "minicole/elpolitico",
"path": "elpolitico/elpolitico/twitter_import/twitter_import.py",
"copies": "1",
"size": "3976",
"license": "mit",
"hash": -1340032485464301300,
"line_mean": 30.0703125,
"line_max": 93,
"alpha_frac": 0.6587022133,
"autogenerated": false,
"ratio": 3.40410958904... |
__author__ = ['niels', 'lorenzo']
import os
global socket
_GRAPH_ID = 'default-graph'
_GRAPH_INSTANCE_ID = 'Graph-instance'
_VOCS = {
'astronomy': 'http://ontology.projectchronos.eu/astronomy/',
'solarsystem': 'http://ontology.projectchronos.eu/solarsystem/',
'engineering': 'http://ontology.projectchron... | {
"repo_name": "Mec-iS/chronostriples-backup",
"path": "config/config.py",
"copies": "1",
"size": "1866",
"license": "apache-2.0",
"hash": -7624993966046488000,
"line_mean": 32.9272727273,
"line_max": 102,
"alpha_frac": 0.6339764202,
"autogenerated": false,
"ratio": 3.1414141414141414,
"config_t... |
__author__ = ['niels', 'lorenzo']
import os
global socket
_VOC_GRAPH_ID = 'vocabularies-graph'
_WEBRES_GRAPH_ID = 'webresources-graph'
_CONCEPTS_GRAPH_ID = 'concepts-graph'
_GRAPH_INSTANCE_ID = 'Graph-instance'
_VOCS = {
'astronomy': 'http://ontology.projectchronos.eu/astronomy/',
'solarsystem': 'http://ont... | {
"repo_name": "SpaceAppsXploration/rdfendpoints",
"path": "config/config.py",
"copies": "1",
"size": "2418",
"license": "apache-2.0",
"hash": 7422431446772641000,
"line_mean": 31.6891891892,
"line_max": 102,
"alpha_frac": 0.6302729529,
"autogenerated": false,
"ratio": 3.080254777070064,
"config... |
__author__ = ['niels', 'lorenzo']
import os
_GRAPH_ID = 'default-graph'
_GRAPH_INSTANCE_ID = 'Graph-instance'
_VOCS = {
'astronomy': 'http://ontology.projectchronos.eu/astronomy/',
'solarsystem': 'http://ontology.projectchronos.eu/solarsystem/',
'engineering': 'http://ontology.projectchronos.eu/engineeri... | {
"repo_name": "pincopallino93/rdfendpoints",
"path": "config/config.py",
"copies": "1",
"size": "1792",
"license": "apache-2.0",
"hash": -4085575062820581000,
"line_mean": 39.7272727273,
"line_max": 109,
"alpha_frac": 0.640625,
"autogenerated": false,
"ratio": 3.1716814159292035,
"config_test":... |
__author__ = 'Niels van Schooten'
__email__ = 'nielsvanschooten@gmail.com'
from DataParser import DataRowParser
import json
class DataInputManager:
"""
The data input manager, this class is responsible for the collection and the passthrough of the data to the
Dataparser. This will collect the dat... | {
"repo_name": "HeadhunterXamd/project56",
"path": "project/PythonDataCollector/InputManager.py",
"copies": "1",
"size": "1727",
"license": "mit",
"hash": 5000896699776279000,
"line_mean": 31.5849056604,
"line_max": 119,
"alpha_frac": 0.6050955414,
"autogenerated": false,
"ratio": 4.36111111111111... |
__author__ = 'Niels van Schooten'
__email__ = 'nielsvanschooten@gmail.com'
import dbManager
import json
class DataRowParser:
"""
This class parses the row of data and buffers it all
"""
def __init__(self, mapping: list):
self.collection = {}
self.mapping = mapping
# disab... | {
"repo_name": "HeadhunterXamd/project56",
"path": "project/PythonDataCollector/DataParser.py",
"copies": "1",
"size": "1847",
"license": "mit",
"hash": -7798777096661553000,
"line_mean": 33.8490566038,
"line_max": 84,
"alpha_frac": 0.5538711424,
"autogenerated": false,
"ratio": 4.560493827160494,... |
__author__ = 'Niels van Schooten'
__email__ = 'nielsvanschooten@gmail.com'
import _mssql
import json
class DatabaseManager:
"""
The database manager, this manager manages the connection between the system and the database.
You can use this manager to push a query, send a dataset and change the da... | {
"repo_name": "HeadhunterXamd/project56",
"path": "project/PythonDataCollector/dbManager.py",
"copies": "1",
"size": "2359",
"license": "mit",
"hash": 4704573981513943000,
"line_mean": 38.3166666667,
"line_max": 114,
"alpha_frac": 0.6261127596,
"autogenerated": false,
"ratio": 4.671287128712871,
... |
__author__ = 'nietaki'
import math
straight_line_radius = 100000000000
class TrackPiece(object):
def __init__(self, json_piece, json_lanes):
self.json_piece = json_piece # the source json representation
self.lanes = json_lanes
self.is_straight = 'length' in json_piece
# defaults... | {
"repo_name": "nietaki/HWO-2014---the-What-What-What",
"path": "python/TrackPiece.py",
"copies": "1",
"size": "1629",
"license": "apache-2.0",
"hash": 2186521375865488400,
"line_mean": 28.6363636364,
"line_max": 70,
"alpha_frac": 0.5758133824,
"autogenerated": false,
"ratio": 3.8329411764705883,
... |
__author__ = 'nietaki'
import physics
def csv_row(car):
row = dict()
row["tick"] = car.tick
row["car_id"] = car.name
row["map_id"] = car.track.track_id
row["car_turbo_multiplier"] = physics.cur_turbo_multiplier
row["throttle"] = car.throttle
row["can_switch"] = int(car.track.track_pieces_de... | {
"repo_name": "nietaki/HWO-2014---the-What-What-What",
"path": "python/csv_handler.py",
"copies": "1",
"size": "1631",
"license": "apache-2.0",
"hash": 5296162588902729000,
"line_mean": 33,
"line_max": 106,
"alpha_frac": 0.5665236052,
"autogenerated": false,
"ratio": 3.3698347107438016,
"config... |
__author__ = 'nietaki'
from BaseBot import BaseBot
class KeimolaBreaker(BaseBot):
def on_car_positions(self, data, tick):
if self.my_car().velocity < 0.0001:
self.throttle(0.5)
elif self.my_car().track_piece_index == 36:
self.throttle(1.0)
elif self.my_car().track_... | {
"repo_name": "nietaki/HWO-2014---the-What-What-What",
"path": "python/investigation.py",
"copies": "1",
"size": "3723",
"license": "apache-2.0",
"hash": -3402106327951552000,
"line_mean": 32.5405405405,
"line_max": 95,
"alpha_frac": 0.6024711254,
"autogenerated": false,
"ratio": 3.53897338403041... |
__author__ = 'nietaki'
import math
import warnings
from TrackPiece import TrackPiece, straight_line_radius
class Track(object):
def __init__(self, track):
self.track = track
self.track_id = self.track['id']
self.track_pieces_deprecated = self.track['pieces']
self.lanes = self.trac... | {
"repo_name": "nietaki/HWO-2014---the-What-What-What",
"path": "python/Track.py",
"copies": "1",
"size": "6199",
"license": "apache-2.0",
"hash": -733849556293820500,
"line_mean": 37.0306748466,
"line_max": 125,
"alpha_frac": 0.5960638813,
"autogenerated": false,
"ratio": 3.6315172817809023,
"c... |
__author__ = 'nightfade'
import socket
from rpc.tcp_connection import TcpConnection
from rpc.rpc_channel import RpcChannel
import logger
class TcpClient(TcpConnection):
def __init__(self, ip, port, service_factory, stub_factory):
TcpConnection.__init__(self, None, (ip, port))
self.logger = logge... | {
"repo_name": "nightfade/protobuf-RPC",
"path": "rpc/tcp_client.py",
"copies": "1",
"size": "1842",
"license": "mit",
"hash": 6980001716266213000,
"line_mean": 29.1967213115,
"line_max": 99,
"alpha_frac": 0.6357220413,
"autogenerated": false,
"ratio": 3.9191489361702128,
"config_test": false,
... |
__author__ = 'nightfade'
import socket
import asyncore
import logger
class TcpConnection(asyncore.dispatcher):
DEFAULT_RECV_BUFFER = 4096
ST_INIT = 0
ST_ESTABLISHED = 1
ST_DISCONNECTED = 2
def __init__(self, sock, peername):
asyncore.dispatcher.__init__(self, sock)
self.logger =... | {
"repo_name": "nightfade/protobuf-RPC",
"path": "rpc/tcp_connection.py",
"copies": "1",
"size": "2465",
"license": "mit",
"hash": -5405324310954787000,
"line_mean": 25.2234042553,
"line_max": 73,
"alpha_frac": 0.6182555781,
"autogenerated": false,
"ratio": 3.8157894736842106,
"config_test": fal... |
__author__ = 'nightfade'
import socket
import asyncore
from rpc.tcp_connection import TcpConnection
from rpc.rpc_channel import RpcChannel
import logger
class TcpServer(asyncore.dispatcher):
def __init__(self, ip, port, service_factory):
asyncore.dispatcher.__init__(self)
self.logger = logger.g... | {
"repo_name": "nightfade/protobuf-RPC",
"path": "rpc/tcp_server.py",
"copies": "1",
"size": "1332",
"license": "mit",
"hash": 2352159136783972000,
"line_mean": 27.3404255319,
"line_max": 77,
"alpha_frac": 0.6141141141,
"autogenerated": false,
"ratio": 3.8057142857142856,
"config_test": false,
... |
__author__ = "Niharika Dutta and Abhimanyu Dogra"
import pygame
from client.utility.client_constants import *
from client.utility.utilities import DirectionHandler, Node
class Heuristic:
"""
Heuristic class handles data about the heuristics for the AStar algorithm.
"""
def __init__(self, source, de... | {
"repo_name": "abhimanyudogra/TARS",
"path": "client/brain/astar.py",
"copies": "1",
"size": "5869",
"license": "mit",
"hash": 6603119050779772000,
"line_mean": 40.6241134752,
"line_max": 122,
"alpha_frac": 0.5692622253,
"autogenerated": false,
"ratio": 3.80609597924773,
"config_test": false,
... |
__author__ = "Niharika Dutta and Abhimanyu Dogra"
import pygame
from client.utility.client_constants import *
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
RED = (255, 0, 0)
BLACK = (0, 0, 0)
DARK_GREEN = (0, 90, 0)
YELLOW = (255, 255, 0)
DARK_BLUE = (0, 0, 75)
class Highlights:
"""
Highli... | {
"repo_name": "abhimanyudogra/TARS",
"path": "client/radar/radar.py",
"copies": "1",
"size": "6641",
"license": "mit",
"hash": -3433830308750142000,
"line_mean": 31.3951219512,
"line_max": 116,
"alpha_frac": 0.5749134167,
"autogenerated": false,
"ratio": 3.658953168044077,
"config_test": true,
... |
__author__ = "Niharika Dutta and Abhimanyu Dogra"
import socket
import sys
from server_constants import *
class ServerSocket:
"""
Manages the server side socket network and sending/receiving of messages through it.
"""
def __init__(self):
self.counter = 0
self.conn, self.addr = None... | {
"repo_name": "abhimanyudogra/TARS",
"path": "server/server_socket.py",
"copies": "1",
"size": "2222",
"license": "mit",
"hash": 791372703106076800,
"line_mean": 33.1846153846,
"line_max": 92,
"alpha_frac": 0.5490549055,
"autogenerated": false,
"ratio": 4.04,
"config_test": false,
"has_no_key... |
__author__ = "Niharika Dutta and Abhimanyu Dogra"
try:
import RPi.GPIO as GPIO
except RuntimeError:
print("Error importing RPi.GPIO! This must be run as root using sudo")
import time
class GPIOHandler:
"""
GPIOHandler class interacts with GPIO library for operating the hardware.
"""
def __... | {
"repo_name": "abhimanyudogra/TARS",
"path": "server/gpio_handler.py",
"copies": "1",
"size": "3707",
"license": "mit",
"hash": -3104496947209717000,
"line_mean": 29.3852459016,
"line_max": 92,
"alpha_frac": 0.5673050985,
"autogenerated": false,
"ratio": 3.3187108325872874,
"config_test": false... |
__author__ = 'Nihar'
__project__ = 'QuantAnalysis'
import talib
import os
import numpy as np
# DEFINE THRESHOLD FOR SUCCESS
success = 75
# HARD CODE PARAMETERS
right = 0.03
veryright = 0.05
delta = 30
upperbound = 80
lowerbound = 20
class LongTerm:
def analysis(self, filename):
# READ PRICES FILE
... | {
"repo_name": "niharparikh/Projects",
"path": "QuantAnalysis/src/Trend.py",
"copies": "1",
"size": "3527",
"license": "apache-2.0",
"hash": -721320033665736100,
"line_mean": 37.347826087,
"line_max": 304,
"alpha_frac": 0.5032605614,
"autogenerated": false,
"ratio": 3.5698380566801617,
"config_t... |
__author__ = 'Nihar'
__project__ = 'QuantAnalysis'
import talib
import os
import numpy as np
# DEFINE THRESHOLD FOR SUCCESS
success = 75
# HARD CODE PARAMETERS
right = 0.03
veryright = 0.06
delta = 10
# upperbound = 70
# lowerbound = 30
ind_duration = 5
metric_wait = 15
metric_duration = 5
# percent = 0
class initi... | {
"repo_name": "niharparikh/Projects",
"path": "QuantAnalysis/src/Combined.py",
"copies": "1",
"size": "5296",
"license": "apache-2.0",
"hash": 2361242426764361700,
"line_mean": 36.5602836879,
"line_max": 244,
"alpha_frac": 0.5158610272,
"autogenerated": false,
"ratio": 3.3455464308275427,
"conf... |
__author__ = "Nii Mante"
__license__ = "MIT"
__email__ = "nmante88@gmail.com"
__status__ = "Development"
"""
This module contains methods to find exact duplicate images
"""
import sys
import hashlib
class ExactDuplicate:
def __init__(self, filenames):
self.filenames = filenames
self.image_dic... | {
"repo_name": "nmante/image_deduplication",
"path": "dedup/exact_duplicate.py",
"copies": "1",
"size": "1304",
"license": "mit",
"hash": -532863213523493060,
"line_mean": 27.9777777778,
"line_max": 75,
"alpha_frac": 0.5797546012,
"autogenerated": false,
"ratio": 4.1265822784810124,
"config_test... |
__author__ = "Nii Mante"
__license__ = "MIT"
__email__ = "nmante88@gmail.com"
__status__ = "Development"
"""
This module contains methods to find near duplicate images.
"""
import sys
from PIL import Image
import os
# Simhash algorithm https://github.com/liangsun/simhash
from simhash import Simhash, SimhashInd... | {
"repo_name": "nmante/image_deduplication",
"path": "dedup/near_duplicate.py",
"copies": "1",
"size": "10024",
"license": "mit",
"hash": -461213772685363300,
"line_mean": 38.4645669291,
"line_max": 150,
"alpha_frac": 0.5561652035,
"autogenerated": false,
"ratio": 4.429518338488732,
"config_test... |
__author__ = 'nikaashpuri'
from django.http import HttpResponse
from django.shortcuts import render, HttpResponseRedirect, render_to_response
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.views.generic.list import ListView
from django.utils import timezone
import ... | {
"repo_name": "nikaashpuri/aquabrim_project",
"path": "machine/views.py",
"copies": "1",
"size": "26576",
"license": "mit",
"hash": 722072284884548400,
"line_mean": 31.1743341404,
"line_max": 124,
"alpha_frac": 0.6155177604,
"autogenerated": false,
"ratio": 3.565812424527036,
"config_test": fal... |
__author__ = 'nikaashpuri'
import socket
import sys
import os
sys.path.append('/public_html/aquabrim_project')
from views import collect_data_from_device_using_tcp
from aquabrim_project.settings import BASE_DIR
from views import TCP_SERVER_IP, TCP_SERVER_PORT
# Create a TCP/IP socket
sock = socket.socket(socket.AF_IN... | {
"repo_name": "shubham1810/aquabrim_project",
"path": "machine/tcp_ip_server.py",
"copies": "1",
"size": "2442",
"license": "mit",
"hash": 2337729306361196000,
"line_mean": 33.8857142857,
"line_max": 91,
"alpha_frac": 0.6298116298,
"autogenerated": false,
"ratio": 3.7282442748091604,
"config_te... |
__author__ = 'nikhilalmeida'
from argparse import ArgumentParser
import json
import sys
import codecs
import ast
import itertools
import collections
ARGS = {}
parser = ArgumentParser(description='JSON utilities.')
parser.add_argument("command", help='The command to be performed. List of commands are:\n1. intersect. \... | {
"repo_name": "nikhilalmeida/json-util",
"path": "json_util/util.py",
"copies": "1",
"size": "10861",
"license": "mit",
"hash": -5273141783759075000,
"line_mean": 38.0683453237,
"line_max": 119,
"alpha_frac": 0.5629315901,
"autogenerated": false,
"ratio": 3.5148867313915857,
"config_test": fals... |
__author__ = "Nikhil Bharadwaj Gosala"
__version__ = 'Python 2.7'
import os
from PIL import Image, ExifTags
def preprocessImages(image_path, wm_path):
"Open the images and resize the watermark to the required size"
is_landscape = False
is_potrait = False
wm = {}
#Open the images
try:
... | {
"repo_name": "nikhilnb/AutoWatermark",
"path": "auto_watermark_multiple_27.py",
"copies": "1",
"size": "4825",
"license": "mit",
"hash": 2725393416231813600,
"line_mean": 36.4031007752,
"line_max": 144,
"alpha_frac": 0.5852849741,
"autogenerated": false,
"ratio": 3.362369337979094,
"config_tes... |
__author__ = "Nikhil Bharadwaj Gosala"
__version__ = "Python 3.5"
import os
from PIL import Image, ExifTags
def preprocessImages(image_path, wm_path):
"Open the images and resize the watermark to the required size"
is_landscape = False
is_potrait = False
wm = {}
#Open the images
try:
... | {
"repo_name": "nikhilnb/AutoWatermark",
"path": "auto_watermark_multiple.py",
"copies": "1",
"size": "4792",
"license": "mit",
"hash": -6246286315521706000,
"line_mean": 35.8615384615,
"line_max": 144,
"alpha_frac": 0.5830550918,
"autogenerated": false,
"ratio": 3.3722730471498945,
"config_test... |
__author__ = 'Nikhil Bharadwaj'
__license__ = 'MIT License'
__version__ = 'Python 3.5'
import os
from PIL import Image, ExifTags
def preprocessImages(image_path, wm_path):
"Open the images and resize the watermark to the required size"
is_landscape = False
is_potrait = False
#Open the images
... | {
"repo_name": "nikhilnb/AutoWatermark",
"path": "auto_watermark.py",
"copies": "1",
"size": "3803",
"license": "mit",
"hash": 3776796979974133000,
"line_mean": 34.212962963,
"line_max": 124,
"alpha_frac": 0.6134630555,
"autogenerated": false,
"ratio": 3.498620055197792,
"config_test": false,
... |
__author__ = 'Nikhil'
import os
import requests
import csv
import re
movie_list = []
yearlisttmp = list(range(1990, 2050))
yearlist = [str(x) for x in yearlisttmp]
regexYear = re.compile('\d{4}')
# Function to get the rating from omdbapi : Start
def getRatings(title,year):
payload = {'t': title, 'y': year, 'r': '... | {
"repo_name": "nikhilgeo/Movie-Oracle",
"path": "launchpad.py",
"copies": "1",
"size": "3653",
"license": "unlicense",
"hash": -8754337677956747000,
"line_mean": 39.5888888889,
"line_max": 107,
"alpha_frac": 0.5387352861,
"autogenerated": false,
"ratio": 3.7776628748707344,
"config_test": false... |
__author__ = 'nikita_kartashov'
from os import path
from collections import Counter
from utils.pyutils import snd
from Tokenizer.python.python import clean_tokens
KEYWORD_PATH = '../python_keywords.txt'
def relative_path(path_part):
return path.join(path.dirname(__file__), path_part)
def python_keywords():
... | {
"repo_name": "sayon/ignoreme",
"path": "lexers/python_lexer/python_freq.py",
"copies": "1",
"size": "1121",
"license": "mit",
"hash": 7152857081403743000,
"line_mean": 27.05,
"line_max": 93,
"alpha_frac": 0.7127564674,
"autogenerated": false,
"ratio": 3.5814696485623,
"config_test": false,
"... |
__author__ = 'nikita_kartashov'
from subprocess import call
from sys import argv
from os import path, remove, walk
from logging import info, basicConfig
from utils.pyutils import last
from unwrap import unwrap
GIT_STRING_TEMPLATE = ['git', 'clone']
REPO_PATH = path.join(path.dirname(__file__), 'repos')
def relat... | {
"repo_name": "sayon/ignoreme",
"path": "dataset/download.py",
"copies": "1",
"size": "1875",
"license": "mit",
"hash": -5144624064165702000,
"line_mean": 25.4225352113,
"line_max": 81,
"alpha_frac": 0.6346666667,
"autogenerated": false,
"ratio": 3.7575150300601203,
"config_test": false,
"has... |
__author__ = 'Nikita'
from lexems_automats.sintaksis import *
def is_add(char):
return char == '+'
def is_min(char):
return char == '-'
def is_mul(char):
return char == '*'
def is_div(char):
return char == '/'
def Is_let(chars):
last_char = chars[-1]
if chars[:2] == ':=':
if n... | {
"repo_name": "prettyGoo/computing_translator",
"path": "lexems_automats/math_operations.py",
"copies": "1",
"size": "1872",
"license": "mit",
"hash": -1216609039478514200,
"line_mean": 23.3116883117,
"line_max": 96,
"alpha_frac": 0.5384615385,
"autogenerated": false,
"ratio": 3.140939597315436,
... |
__author__ = 'Nikita'
import lexems_automats.key_words
from lexems_automats.base import is_digit, is_hex_digit, is_letter
from value_detector import get_detected_value
def Is_id_or_kw(scanner_params):
file, _, _, base_position, offset = scanner_params
local_lexeme = ''
local_offset = 0
char = fil... | {
"repo_name": "prettyGoo/computing_translator",
"path": "lexems_automats/indetificators.py",
"copies": "1",
"size": "1201",
"license": "mit",
"hash": 1182439414218919200,
"line_mean": 28.2926829268,
"line_max": 85,
"alpha_frac": 0.5495420483,
"autogenerated": false,
"ratio": 3.7767295597484276,
... |
__author__ = 'Nikita'
import re
from lexems_automats.base import is_digit, is_bin_digit, is_oct_digit, is_hex_digit
from lexems_automats.base import is_letter
from lexems_automats.sintaksis import *
from value_detector import get_detected_value
def Is_bin_int(scaner_params):
file, _, _, base_position, _ = sca... | {
"repo_name": "prettyGoo/computing_translator",
"path": "lexems_automats/numbers.py",
"copies": "1",
"size": "11788",
"license": "mit",
"hash": -6314540573188316000,
"line_mean": 36.5445859873,
"line_max": 143,
"alpha_frac": 0.505174754,
"autogenerated": false,
"ratio": 3.884019769357496,
"conf... |
__author__ = 'Nikita'
import sys
error_counter = 0
def print_lexeme(output_file, row, lexeme, value, error_message):
global error_counter
if lexeme:
if lexeme == 'Real':
max_float = 1.701411733e+38
if float(value) <= max_float:
output_file.write('{}\tlex:{}\t... | {
"repo_name": "prettyGoo/computing_translator",
"path": "lexems_printer.py",
"copies": "1",
"size": "2189",
"license": "mit",
"hash": 4443064798705324000,
"line_mean": 36.7586206897,
"line_max": 116,
"alpha_frac": 0.4792142531,
"autogenerated": false,
"ratio": 3.618181818181818,
"config_test": ... |
__author__ = 'Nikita'
def is_kw_write(chars):
return chars == 'write', 'Write'
def is_kw_read(chars):
return chars == 'read', 'Read'
def is_kw_beg(chars):
return chars == 'begin', 'Beg'
def is_kw_end(chars):
return chars == 'end', 'End'
def is_kw_mod(chars):
return chars == 'mod', 'Mod'
... | {
"repo_name": "prettyGoo/computing_translator",
"path": "lexems_automats/key_words.py",
"copies": "1",
"size": "1261",
"license": "mit",
"hash": 6309598491015598000,
"line_mean": 13.8352941176,
"line_max": 36,
"alpha_frac": 0.5749405234,
"autogenerated": false,
"ratio": 2.7775330396475773,
"con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.