text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'Daniel'
from PySide.QtCore import *
from PySide.QtGui import *
from urllib.request import urlopen
import sys
class Form(QDialog):
rates = {}
def __init__(self, parent=None):
super(Form, self).__init__(parent)
date = self.getdata()
rates = sorted(self.rates.keys())
... | {
"repo_name": "daniellowtw/Learning",
"path": "Python GUI and QT/Introduction/curreny_converter.py",
"copies": "1",
"size": "2817",
"license": "cc0-1.0",
"hash": -1857496831854491400,
"line_mean": 33.3536585366,
"line_max": 86,
"alpha_frac": 0.5505857295,
"autogenerated": false,
"ratio": 4.191964... |
__author__ = 'Daniel'
from PySide.QtCore import *
from PySide.QtGui import *
from urllib.request import urlopen
import sys
class Form(QDialog):
def __init__(self, parent=None):
super(Form, self).__init__(parent)
principle_label = QLabel("Principle:")
rate_label = QLabel("Rate:")
y... | {
"repo_name": "daniellowtw/Learning",
"path": "Python GUI and QT/Introduction/interest.py",
"copies": "1",
"size": "2002",
"license": "cc0-1.0",
"hash": 3217860228984165400,
"line_mean": 36.7924528302,
"line_max": 93,
"alpha_frac": 0.6283716284,
"autogenerated": false,
"ratio": 3.3366666666666664... |
__author__ = 'Daniel'
from PySide.QtCore import *
import operator
class MyHistoryTableModel(QAbstractTableModel):
def __init__(self, datain, headerdata, parent=None, *args):
"""
:param datain:lists[]
:param headerdata:str[]
:param parent: Defaults None
:param args:
... | {
"repo_name": "daniellowtw/MentalMaths",
"path": "GUI/models.py",
"copies": "1",
"size": "1341",
"license": "mit",
"hash": -5822403598079444000,
"line_mean": 30.1860465116,
"line_max": 78,
"alpha_frac": 0.610738255,
"autogenerated": false,
"ratio": 4.027027027027027,
"config_test": false,
"ha... |
__author__ = 'Daniel'
from random import randint, randrange
from question import *
from time import clock
from UserData import *
class UnknownCommandException(Exception):
def __init__(self, msg):
self._msg = msg
class NoQuestionException(Exception):
pass
class Game:
"""
Represents a game ... | {
"repo_name": "daniellowtw/MentalMaths",
"path": "Game.py",
"copies": "1",
"size": "4672",
"license": "mit",
"hash": -1984995407290216000,
"line_mean": 31.6713286713,
"line_max": 110,
"alpha_frac": 0.6059503425,
"autogenerated": false,
"ratio": 3.9829497016197783,
"config_test": false,
"has_n... |
__author__ = 'daniel'
from sqlalchemy import Integer, Column, String, ForeignKey, Text, DateTime,Boolean
from sqlalchemy.orm import relationship, deferred
from lib.base import Base
from models.racer import Racer
from PyQt4 import QtCore
class Trial(Base):
__tablename__ = "trials"
discriminator = Column('t... | {
"repo_name": "dmayer/time_trial",
"path": "time_trial_gui/models/trial.py",
"copies": "1",
"size": "2388",
"license": "mit",
"hash": -8633667052414398000,
"line_mean": 24.1368421053,
"line_max": 93,
"alpha_frac": 0.6293969849,
"autogenerated": false,
"ratio": 3.6236722306525038,
"config_test":... |
__author__ = 'Daniel'
from test import *
from findandreplacedialog import *
from PySide.QtCore import *
from PySide.QtGui import *
import sys
class ControlMainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(ControlMainWindow, self).__init__(parent)
self.ui = Ui_MainWindow()
... | {
"repo_name": "daniellowtw/Learning",
"path": "Python GUI and QT/Qt Designer/testmain.py",
"copies": "1",
"size": "1153",
"license": "cc0-1.0",
"hash": 2876156663214979000,
"line_mean": 26.4523809524,
"line_max": 59,
"alpha_frac": 0.6366001735,
"autogenerated": false,
"ratio": 3.614420062695925,
... |
__author__ = 'daniel'
import logging
from PyQt4 import QtGui
from gui.data_source_model import DataSourceModel
from gui.plotter_widget import PlotterWidget
from lib.timing_data import TimingData
from lib.plot import Plot
class PlotterTab(QtGui.QWidget):
def __init__(self, parent = None):
super(Plotte... | {
"repo_name": "dmayer/time_trial",
"path": "time_trial_gui/gui/plotter_tab.py",
"copies": "1",
"size": "3007",
"license": "mit",
"hash": 5148493041827399000,
"line_mean": 33.5632183908,
"line_max": 93,
"alpha_frac": 0.6704356501,
"autogenerated": false,
"ratio": 3.452353616532721,
"config_test"... |
__author__ = 'daniel'
import logging
import requests
from bs4 import BeautifulSoup
from Transaction import Buy, Dividend, Sell, Split
def _get_fund_price(name):
url = 'https://www.di.se/fonder/%s/' % name
logging.info("Getting price for {}: {}".format(name, url))
response = requests.get(url)
if res... | {
"repo_name": "dahuuhad/Stocks",
"path": "stock.py",
"copies": "1",
"size": "5838",
"license": "apache-2.0",
"hash": -6233075179217019000,
"line_mean": 40.7,
"line_max": 98,
"alpha_frac": 0.574169236,
"autogenerated": false,
"ratio": 3.9714285714285715,
"config_test": false,
"has_no_keywords"... |
__author__ = 'Daniel'
import pandas
from cassandra.cluster import Cluster
from cassandra.query import BatchStatement
def loadDataIntoDatabase(stockId, dbSession):
"save data to databaes"
query = dbSession.prepare("insert into stockdata (stock_id, time, open_price, high_price, low_price, close_price, volumne, ... | {
"repo_name": "SoySauceClub/BriskyProcess",
"path": "playground/Cassandra/DataLoader.py",
"copies": "1",
"size": "1236",
"license": "apache-2.0",
"hash": 4196252790686091300,
"line_mean": 37.625,
"line_max": 170,
"alpha_frac": 0.7071197411,
"autogenerated": false,
"ratio": 3.3136729222520107,
"... |
__author__ = 'Daniel'
import platform
from PySide.QtCore import *
from PySide.QtGui import *
import GUI.ui_mainwindow
from GUI.component import *
from Game import Game
from GUI.models import MyHistoryTableModel
from UserData import config
from utility import is_debug_mode, __version__
class MainWindow(QMainWindow, G... | {
"repo_name": "daniellowtw/MentalMaths",
"path": "GUI/main.py",
"copies": "1",
"size": "2742",
"license": "mit",
"hash": 8040755267604540000,
"line_mean": 31.6428571429,
"line_max": 91,
"alpha_frac": 0.5991976659,
"autogenerated": false,
"ratio": 3.934002869440459,
"config_test": false,
"has_... |
__author__ = 'Daniel'
import re
class TokenizeABC:
def __init__(self,abc):
self._abc = abc
def tokenize_header(self,header):
header = header.split("\n")
for i,h in enumerate(header):
header[i] = h[2:]
return header
def tokenize_body(self,body):
return... | {
"repo_name": "fatisar/guitar-gyro",
"path": "src/utils/TokenizeABC.py",
"copies": "1",
"size": "1034",
"license": "bsd-3-clause",
"hash": -8991544807225574000,
"line_mean": 30.3333333333,
"line_max": 141,
"alpha_frac": 0.5899419729,
"autogenerated": false,
"ratio": 3.7194244604316546,
"config_... |
__author__ = 'Daniel'
import sys
from PySide.QtCore import *
from PySide.QtGui import *
import GUI.ui_menu
import GUI.ui_startwidget
import GUI.ui_gamedialog
import GUI.ui_historywidget
class MenuWidget(QWidget, GUI.ui_menu.Ui_Menu):
def __init__(self):
super(MenuWidget, self).__init__()
self.setu... | {
"repo_name": "daniellowtw/MentalMaths",
"path": "GUI/component.py",
"copies": "1",
"size": "3365",
"license": "mit",
"hash": -5541070931071500000,
"line_mean": 31.3653846154,
"line_max": 93,
"alpha_frac": 0.6350668648,
"autogenerated": false,
"ratio": 3.637837837837838,
"config_test": false,
... |
__author__ = 'Daniel'
class LazyDataStore(object):
"""
data.__dict__
hasattr(data, 'foo')
hasattr will trigger __getattr__ if not present
"""
def __init__(self):
self.existing_attr = 5
def __getattr__(self, name):
"""
This method is called when the attribute is N... | {
"repo_name": "idf/commons-util-py",
"path": "commons_util/fundamentals/dynamic_class.py",
"copies": "1",
"size": "1715",
"license": "apache-2.0",
"hash": 8868576759079808000,
"line_mean": 28.0677966102,
"line_max": 80,
"alpha_frac": 0.5743440233,
"autogenerated": false,
"ratio": 4.43152454780361... |
__author__ = 'Daniel'
class Stack:
def __init__(self):
self.items = []
def push(self, item):
self.items.append(item)
def is_empty(self):
return self.items == []
def size(self):
return len(self.items)
def pop(self):
return self.items.pop()
def peek(s... | {
"repo_name": "DanielFabian/DataStructuresAndAlgorithms",
"path": "Python/stack.py",
"copies": "1",
"size": "2424",
"license": "apache-2.0",
"hash": -8038622576193381000,
"line_mean": 21.2385321101,
"line_max": 85,
"alpha_frac": 0.475660066,
"autogenerated": false,
"ratio": 3.769828926905132,
"... |
__author__ = 'Daniel'
# Responsible for generating UI in terminal
import os
from UIController import AbstractController
from utility import *
from question import Operation
from UserData import config
class InterruptInputException(Exception):
def __init__(self, msg):
self.msg = msg
class TerminalContr... | {
"repo_name": "daniellowtw/MentalMaths",
"path": "TerminalController.py",
"copies": "1",
"size": "7745",
"license": "mit",
"hash": -463979837707339460,
"line_mean": 44.5588235294,
"line_max": 113,
"alpha_frac": 0.5842479019,
"autogenerated": false,
"ratio": 4.11968085106383,
"config_test": fals... |
__author__ = 'Daniel'
# want to create using class
# goal is to have option for dropout, etc.
import numpy as np
from sklearn.metrics import log_loss
class ann_2:
"""
An artificial neural network (2 layer) object
"""
def __init__(self, features, hl1_size, hl2_size, classes,
epochs=10... | {
"repo_name": "dgea005/MLLearning",
"path": "ann/neuralnet.py",
"copies": "1",
"size": "11707",
"license": "mit",
"hash": -6721559817137364000,
"line_mean": 40.5177304965,
"line_max": 123,
"alpha_frac": 0.5609464423,
"autogenerated": false,
"ratio": 3.179521998913634,
"config_test": false,
"h... |
__author__ = 'Daniel'
# PhraseGraph is a graph-representation of a currently-being-proccessed phrase
# Input is a single, pre-computed phrase of notes
# PhraseGraph builds a graph of all the possible combinations of finger-positions for the set of notes
from NoteMap import NoteMap
from LeftHand import LeftHand
lhan... | {
"repo_name": "fatisar/guitar-gyro",
"path": "src/utils/PhraseGraph.py",
"copies": "1",
"size": "3783",
"license": "bsd-3-clause",
"hash": -4958319502079536000,
"line_mean": 32.7857142857,
"line_max": 135,
"alpha_frac": 0.5580227333,
"autogenerated": false,
"ratio": 3.5190697674418603,
"config_... |
__author__ = 'Daniel Puschmann'
from virtualisation.aggregation.genericaggregation import GenericAggregator
from virtualisation.misc.jsonobject import JSONObject
from virtualisation.misc.log import Log
from virtualisation.aggregation.paa.paacontrol import PaaControl
class PaaAggregator(GenericAggregator):
def __in... | {
"repo_name": "CityPulse/CP_Resourcemanagement",
"path": "virtualisation/aggregation/paa/paaaggregator.py",
"copies": "1",
"size": "1325",
"license": "mit",
"hash": 8105223370992445000,
"line_mean": 36.8857142857,
"line_max": 75,
"alpha_frac": 0.601509434,
"autogenerated": false,
"ratio": 4.47635... |
__author__ = 'Daniel Puschmann'
from virtualisation.events.genericeventwrapper import GenericEventWrapper
from virtualisation.events.eventdescription import EventDescription
from virtualisation.misc.jsonobject import JSONObject
"""
private String ceID = UUID.randomUUID().toString();
private String ceType = "";
... | {
"repo_name": "CityPulse/CP_Resourcemanagement",
"path": "wrapper_dev/aarhus_traffic/aarhustrafficeventwrapper.py",
"copies": "1",
"size": "2630",
"license": "mit",
"hash": -2114672280528803600,
"line_mean": 37.1304347826,
"line_max": 114,
"alpha_frac": 0.7148288973,
"autogenerated": false,
"rati... |
__author__ = 'Daniel Puschmann'
from virtualisation.aggregation.genericaggregation import GenericAggregator
from virtualisation.aggregation.dft.dftcontrol import DftControl
from virtualisation.misc.jsonobject import JSONObject
from virtualisation.misc.log import Log
class DftAggregator(GenericAggregator):
def __... | {
"repo_name": "CityPulse/CP_Resourcemanagement",
"path": "virtualisation/aggregation/dft/dftaggregator.py",
"copies": "1",
"size": "1388",
"license": "mit",
"hash": 1551611465630846700,
"line_mean": 36.5405405405,
"line_max": 76,
"alpha_frac": 0.6102305476,
"autogenerated": false,
"ratio": 4.3239... |
__author__ = 'Daniel Sanchez Quiros'
from GitUtils import *
from PathUtils import *
from ImageUtils import *
def test1(repodir, repoout, inpath, outpath):
cloneRepo(repodir,repoout)
print "getting files"
files = getFilesFromPath(inpath)
print "building image"
ImgUtils.reduceAndSave2Png(outpath, *... | {
"repo_name": "danimanimal/GitVid",
"path": "src/DoIt.py",
"copies": "1",
"size": "1271",
"license": "mit",
"hash": 623110138732735400,
"line_mean": 27.2444444444,
"line_max": 132,
"alpha_frac": 0.6774193548,
"autogenerated": false,
"ratio": 3.070048309178744,
"config_test": false,
"has_no_ke... |
__author__ = 'Daniel Sanchez Quiros'
import hashlib
import cv2
import numpy as np
import math
import os.path as op
import os
from itertools import repeat
import subprocess
import png
class ImgUtils:
hexmin, hexmax = 0, int("ffffffff", 16)
rgbmin, rgbmax = 0, 255
def __init__(self, file):
self.fi... | {
"repo_name": "danimanimal/GitVid",
"path": "src/ImageUtils.py",
"copies": "1",
"size": "4837",
"license": "mit",
"hash": 9146731679963581000,
"line_mean": 30.614379085,
"line_max": 159,
"alpha_frac": 0.6233202398,
"autogenerated": false,
"ratio": 3.4207920792079207,
"config_test": false,
"ha... |
__author__ = 'Daniel Sanchez Quiros'
import os
from cStringIO import StringIO
import subprocess
def redirect_output(f):
def ret(*args):
old_stout = os.sys.stdout
myStdout = StringIO()
os.sys.stdout = myStdout
error = f(*args)
stringret = myStdout.getvalue()
myStdout... | {
"repo_name": "danimanimal/GitVid",
"path": "src/GitUtils.py",
"copies": "1",
"size": "1562",
"license": "mit",
"hash": 4924536412456714000,
"line_mean": 26.9107142857,
"line_max": 81,
"alpha_frac": 0.6395646607,
"autogenerated": false,
"ratio": 3.3956521739130436,
"config_test": false,
"has_... |
__author__ = 'Daniel Sanchez Quiros'
import os.path as osp
import os
def getFilesFromPath(path, *args):
if osp.exists(path):
os.chdir(path)
ret = []
content = os.listdir(path)
ret.extend(map(lambda x: osp.join(path,x),filter(lambda x: osp.isfile(x), content)))
content = ... | {
"repo_name": "danimanimal/GitVid",
"path": "src/PathUtils.py",
"copies": "1",
"size": "1061",
"license": "mit",
"hash": 3258317772794642400,
"line_mean": 22.5777777778,
"line_max": 92,
"alpha_frac": 0.6182846371,
"autogenerated": false,
"ratio": 3.3364779874213837,
"config_test": false,
"has... |
__author__ = 'Daniil Leksin'
# -*- coding: utf-8 -*-
from googleapiclient.errors import HttpError
from oauth2client.client import AccessTokenRefreshError
from c_warning import show_warning
from c_gawrapper.c_api import GoogleAnalyticApi
def check_the_data(info_obj=None):
return True
def make_report(credential... | {
"repo_name": "DaniilLeksin/gc",
"path": "c_gawrapper/c_wrapper.py",
"copies": "1",
"size": "2147",
"license": "apache-2.0",
"hash": 8869938000949228000,
"line_mean": 39.5094339623,
"line_max": 115,
"alpha_frac": 0.6199347927,
"autogenerated": false,
"ratio": 4.043314500941619,
"config_test": f... |
__author__ = 'Daniil Leksin'
# -*- coding: utf-8 -*-
import sys
import json
import pprint
from googleapiclient.errors import HttpError
from oauth2client.client import AccessTokenRefreshError
from c_gawrapper.c_api import GoogleAnalyticApi
def main(argv):
# TODO: check the valid input data
# TODO: handle I... | {
"repo_name": "DaniilLeksin/gc",
"path": "cGAwrapper.py",
"copies": "1",
"size": "1692",
"license": "apache-2.0",
"hash": 7522279961953859000,
"line_mean": 33.5306122449,
"line_max": 113,
"alpha_frac": 0.6607565012,
"autogenerated": false,
"ratio": 4.057553956834532,
"config_test": false,
"ha... |
__author__ = 'Daniil Leksin'
# -*- coding: utf-8 -*-
def on_change_value(event, dict_credentials, dict_params, dict_api_properties):
"""
:param event:
:param dict_credentials:
:param dict_api_properties:
:return:
"""
current_property = event.GetProperty().GetName()
new_property_value ... | {
"repo_name": "DaniilLeksin/gc",
"path": "c_gawrapper/c_properties.py",
"copies": "1",
"size": "1644",
"license": "apache-2.0",
"hash": -5253905766664349000,
"line_mean": 39.1219512195,
"line_max": 88,
"alpha_frac": 0.6289537713,
"autogenerated": false,
"ratio": 3.914285714285714,
"config_test"... |
__author__ = 'Daniil Leksin'
# -*- coding: utf-8 -*-
###########################################################################
##
##
##
##
###########################################################################
global user_metrics
global session_metrics
dict_credentials = {
"installed": {
"client_id... | {
"repo_name": "DaniilLeksin/gc",
"path": "m_gawrapper/m_dicts.py",
"copies": "1",
"size": "62132",
"license": "apache-2.0",
"hash": -5560640459287790000,
"line_mean": 34.4432401597,
"line_max": 174,
"alpha_frac": 0.5907101011,
"autogenerated": false,
"ratio": 3.6285697599719677,
"config_test": ... |
__author__ = 'Daniil Leksin'
# -*- coding: utf-8 -*-
# ##########################################################################
##
##
##
##
###########################################################################
import sys
import datetime
import wx
_ = wx.GetTranslation
import wx.propgrid as grid
from m_gawr... | {
"repo_name": "DaniilLeksin/gc",
"path": "ui_gawrapper/ui_properties.py",
"copies": "1",
"size": "16111",
"license": "apache-2.0",
"hash": 9005729983777780000,
"line_mean": 47.5090361446,
"line_max": 120,
"alpha_frac": 0.6566283763,
"autogenerated": false,
"ratio": 4.4885730211817165,
"config_t... |
__author__ = 'Daniil Leksin'
# -*- coding: utf-8 -*-
###########################################################################
##
##
##
##
###########################################################################
import wx
import wx.html
from ui_gawrapper.ui_browser import Browser
from ui_gawrapper.ui_response i... | {
"repo_name": "DaniilLeksin/gc",
"path": "ui_gawrapper/ui_wrapper.py",
"copies": "1",
"size": "5653",
"license": "apache-2.0",
"hash": 8158354156452454000,
"line_mean": 34.5534591195,
"line_max": 123,
"alpha_frac": 0.5784539183,
"autogenerated": false,
"ratio": 3.487353485502776,
"config_test":... |
__author__ = 'Daniil Leksin'
# -*- coding: utf-8 -*-
# ##########################################################################
##
##
##
##
###########################################################################
import wx
_ = wx.GetTranslation
import wx.propgrid as grid
#######################################... | {
"repo_name": "DaniilLeksin/gc",
"path": "ui_gawrapper/ui_response.py",
"copies": "1",
"size": "8327",
"license": "apache-2.0",
"hash": -6188704758296320000,
"line_mean": 74.7,
"line_max": 169,
"alpha_frac": 0.6382850967,
"autogenerated": false,
"ratio": 4.169754631947922,
"config_test": false,... |
__author__ = 'Daniil Leksin'
import wx
import wx.html2
class Browser(wx.Panel):
def __init__(self, parent, frame=None):
wx.Panel.__init__(self, parent, -1)
self.current = 'https://developers.google.com/analytics//'
self.frame = frame
if frame:
self.titleBase = frame.Ge... | {
"repo_name": "DaniilLeksin/gc",
"path": "ui_gawrapper/ui_browser.py",
"copies": "1",
"size": "3343",
"license": "apache-2.0",
"hash": -3674067132449909000,
"line_mean": 36.1444444444,
"line_max": 118,
"alpha_frac": 0.6201017051,
"autogenerated": false,
"ratio": 3.030825022665458,
"config_test"... |
__author__ = 'Daniil Nikulin'
__copyright__ = "Copyright 2017,VK File Bot"
__license__ = "Apache License 2.0"
__version__ = "1.0"
__maintainer__ = "Daniil Nikulin"
__email__ = "danil.nikulin@gmail.com"
__status__ = "Production"
from telebot import types
from config import emoji
commands = { # command description use... | {
"repo_name": "ddci/vkfilebot",
"path": "config/config.py",
"copies": "1",
"size": "3566",
"license": "apache-2.0",
"hash": 3598530778816045000,
"line_mean": 51.375,
"line_max": 127,
"alpha_frac": 0.610845839,
"autogenerated": false,
"ratio": 1.986449864498645,
"config_test": false,
"has_no_k... |
__author__ = 'Daniil Nikulin'
__copyright__ = "Copyright 2017,VK File Bot"
__license__ = "Apache License 2.0"
__version__ = "1.0"
__maintainer__ = "Daniil Nikulin"
__email__ = "danil.nikulin@gmail.com"
__status__ = "Production"
# ---------
# Imports
# ---------
import os
import telebot
import constants
fro... | {
"repo_name": "ddci/vkfilebot",
"path": "main.py",
"copies": "1",
"size": "1071",
"license": "apache-2.0",
"hash": 5406285853073919000,
"line_mean": 26.9459459459,
"line_max": 113,
"alpha_frac": 0.629318394,
"autogenerated": false,
"ratio": 2.803664921465969,
"config_test": false,
"has_no_key... |
__author__ = 'Dani'
import re
class Deal(object):
# Negotiation status
INTENDED = "Intended"
CONCLUDED = "Concluded"
FAILED = "Failed"
# Implementation status
IN_OPERATION = "In operation (production)"
STARTUP_PHASE = "Startup phase (no production)"
PROJECT_NOT_STARTED = "Project not ... | {
"repo_name": "landportal/landbook-importers",
"path": "LandMatrix_Importer/es/weso/landmatrix/entities/deal.py",
"copies": "1",
"size": "2377",
"license": "mit",
"hash": 3716478101710389000,
"line_mean": 33.4492753623,
"line_max": 148,
"alpha_frac": 0.6760622634,
"autogenerated": false,
"ratio":... |
__author__ = 'Dani'
from ..entities.deal import Deal
import re
class DealsBuilder(object):
def __init__(self):
pass
@staticmethod
def turn_node_into_deal_object(info_node):
"""
It receives a node (Element of ElementTree) and returns a deal object containing the needed data
... | {
"repo_name": "landportal/landbook-importers",
"path": "LandMatrix_Importer/es/weso/landmatrix/translator/deals_builder.py",
"copies": "1",
"size": "6727",
"license": "mit",
"hash": -6652325931910377000,
"line_mean": 34.219895288,
"line_max": 115,
"alpha_frac": 0.6276200387,
"autogenerated": false,... |
__author__ = 'Dani'
from ..entities.deal import Deal
class DealsBuilder(object):
def __init__(self):
pass
@staticmethod
def turn_node_into_deal_object(info_node):
"""
It receives a node (Element of ElementTree) and returns a deal object containing the needed data
"""
... | {
"repo_name": "weso/landportal-importers",
"path": "LandMatrixExtractor/es/weso/landmatrix/translator/deals_builder.py",
"copies": "1",
"size": "5362",
"license": "unlicense",
"hash": 1197367024005783600,
"line_mean": 30.3567251462,
"line_max": 115,
"alpha_frac": 0.6083550914,
"autogenerated": fals... |
__author__ = 'Dani'
from es.weso.oecdextractor.translator.path_object_pair import PathObjectPair
import json
import os
import codecs
class JsonLoader(object):
def __init__(self, log, config):
self._log = log
self._config = config
def run(self):
"""
It must return as many js... | {
"repo_name": "weso/landportal-importers",
"path": "OECD_Importer/es/weso/oecdextractor/translator/json_loader.py",
"copies": "2",
"size": "1064",
"license": "unlicense",
"hash": 8301913604565635000,
"line_mean": 27,
"line_max": 110,
"alpha_frac": 0.5845864662,
"autogenerated": false,
"ratio": 3.... |
__author__ = 'Dani'
from es.weso.util.excell_utils import is_empty_cell, content_starts_in_second_column
from es.weso.translator.parser.parsed_entities import ParsedDate
class DatesParser(object):
def __init__(self, sheet):
self.sheet = sheet
self.row = None
self.dates = []
def run(s... | {
"repo_name": "weso/landportal-importers",
"path": "IpfriExtractor/es/weso/translator/parser/dates_parser.py",
"copies": "2",
"size": "2597",
"license": "unlicense",
"hash": -2040164765738665000,
"line_mean": 38.9538461538,
"line_max": 120,
"alpha_frac": 0.5506353485,
"autogenerated": false,
"rat... |
__author__ = 'Dani'
from es.weso.util.excell_utils import is_empty_cell, content_starts_in_second_column
from es.weso.translator.parser.parsed_entities import ParsedIndicator
class IndicatorsParser(object):
def __init__(self, sheet):
self.sheet = sheet
self.row = None # Complete when running
... | {
"repo_name": "landportal/landbook-importers",
"path": "old-importers/IpfriExtractor/es/weso/translator/parser/indicators_parser.py",
"copies": "2",
"size": "2855",
"license": "mit",
"hash": 860681951718048300,
"line_mean": 39.7857142857,
"line_max": 120,
"alpha_frac": 0.5859894921,
"autogenerated"... |
__author__ = 'Dani'
from lpentities.year_interval import YearInterval
from lpentities.interval import Interval
def get_model_object_time_from_parsed_string(original_time):
str_time = str(original_time).replace(" ", "") # we could already receive a str, but we need to ensure it
if "-" in str_time:
re... | {
"repo_name": "landportal/landbook-importers",
"path": "old-importers/IpfriExtractor/es/weso/translator/object_builder/dates_builder.py",
"copies": "2",
"size": "1407",
"license": "mit",
"hash": -1075512433132458900,
"line_mean": 30.2888888889,
"line_max": 117,
"alpha_frac": 0.6609808102,
"autogene... |
__author__ = 'Dani'
import requests
class CountriesXmlExtractor(object):
def __init__(self, log, config, reconciler):
self._log = log
self._config = config
self._reconciler = reconciler
self._query_pattern = self._config.get("API", "request_pattern")
self._replace_by_is... | {
"repo_name": "weso/landportal-importers",
"path": "FAOGender_Importer/es/weso/faogenderextractor/extractor/xml_management/countries_xml_extractor.py",
"copies": "2",
"size": "1254",
"license": "unlicense",
"hash": -9043915704906011000,
"line_mean": 27.5,
"line_max": 109,
"alpha_frac": 0.6108452951,
... |
__author__ = 'Dani'
class KeyDicts(object):
#INDICATOR KEYS
TOTAL_DEALS = "N1"
HECTARES_TOTAL_DEALS = "HA1"
CONCLUDED_DEALS = "N2"
HECTARES_CONTRACT_DEALS = "HA2"
INTENDED_DEALS = "N3"
HECTARES_INTENDED_DEALS = "HA3"
FAILED_DEALS = "N4"
HECTARES_FAILED_DEALS = "HA4"
IN_PRO... | {
"repo_name": "landportal/landbook-importers",
"path": "LandMatrix_Importer/es/weso/landmatrix/translator/keys_dicts.py",
"copies": "1",
"size": "1835",
"license": "mit",
"hash": 2972909535001847300,
"line_mean": 25.2142857143,
"line_max": 61,
"alpha_frac": 0.6517711172,
"autogenerated": false,
"... |
__author__ = 'Dani'
class KeyMapper(object):
SIGI_KEY = "S"
SIGI_RANK_KEY = "SR"
FAMILY_CODE_KEY = "FC"
FAMILY_CODE_RANK_KEY = "FCR"
CIVIL_KEY = "C"
CIVIL_RANK_KEY = "CR"
ENTITLEMENTS_KEY = "E"
ENTITLEMENTS_RANK_KEY = "ER"
LAND_KEY = "L"
INHERITANCE_GENERAL_KEY = "IG"
IN... | {
"repo_name": "landportal/landbook-importers",
"path": "old-importers/OECD_Importer/es/weso/oecdextractor/translator/indicator_key_mapper.py",
"copies": "2",
"size": "4120",
"license": "mit",
"hash": -2225165671274550000,
"line_mean": 39,
"line_max": 105,
"alpha_frac": 0.6165048544,
"autogenerated"... |
__author__ = 'Dani'
from .interval import Interval
class MonthInterval(Interval):
def __init__(self, year, month):
self._year = year
self._month = month
arg_for_super = self.get_time_string() # We do not have to call the method two times
super(MonthInterval, self).__init__(Inte... | {
"repo_name": "landportal/landbook-importers",
"path": "LandPortalEntities/lpentities/month_interval.py",
"copies": "2",
"size": "1389",
"license": "mit",
"hash": 154360859136430660,
"line_mean": 27.3673469388,
"line_max": 93,
"alpha_frac": 0.5190784737,
"autogenerated": false,
"ratio": 4.0852941... |
__author__ = 'Dani'
try:
import xml.etree.cElementTree as ETree
except:
import xml.etree.ElementTree as ETree
from ..entities.xml_register import XmlRegister
class XmlContentParser(object):
#
# year=year,
# month=month,
# bornages=self._look_for_field(tree, self.BORNAG... | {
"repo_name": "landportal/landbook-importers",
"path": "old-importers/FoncierImporter/es/weso/foncier/importer/xml_management/xml_content_parser.py",
"copies": "2",
"size": "1900",
"license": "mit",
"hash": -7309660090854521000,
"line_mean": 34.1851851852,
"line_max": 98,
"alpha_frac": 0.5663157895,
... |
__author__ = 'Dani'
try:
import xml.etree.cElementTree as ETree
except:
import xml.etree.ElementTree as ETree
from ...entities.xml_entities import XmlRegister, IndicatorData
from lpentities.year_interval import YearInterval
from lpentities.interval import Interval
from ..keys_dict import KeysDict
from datet... | {
"repo_name": "landportal/landbook-importers",
"path": "old-importers/FAOGender_Importer/es/weso/faogenderextractor/extractor/xml_management/xml_content_parser.py",
"copies": "2",
"size": "9000",
"license": "mit",
"hash": 75948351298875070,
"line_mean": 35.8852459016,
"line_max": 116,
"alpha_frac": 0... |
__author__ = 'Daniyar'
import itertools
from localsys.storage import db
import math
class score_model:
def check_closest_competitor(self, usrid, your_score):
value_risk = 0.0
value_cost = 0.0
value_risk_cost_contender = 2.0
value_cost_risk_contender = 1.0
prev_value_risk = ... | {
"repo_name": "mapto/sprks",
"path": "models/score.py",
"copies": "1",
"size": "10424",
"license": "mit",
"hash": -3461555122772116500,
"line_mean": 43.547008547,
"line_max": 169,
"alpha_frac": 0.5090176516,
"autogenerated": false,
"ratio": 3.57598627787307,
"config_test": false,
"has_no_keyw... |
__author__ = 'Daniyar'
import numpy
class company:
employee_types = ['executives', 'desk', 'road'] # 'desk' == 'white-collar', 'road' == 'blue-collar'
location_types = ['office', 'public', 'home']
device_types = ['desktop', 'laptop', 'phone']
employees_count = 2 * pow(10, 5)
max_incident_cost = ... | {
"repo_name": "mapto/sprks",
"path": "models/company.py",
"copies": "1",
"size": "2117",
"license": "mit",
"hash": 3479118479493015000,
"line_mean": 36.1403508772,
"line_max": 135,
"alpha_frac": 0.6381672178,
"autogenerated": false,
"ratio": 3.8007181328545783,
"config_test": false,
"has_no_k... |
__author__ = 'dankle'
import subprocess
import datetime
from localq.Status import Status
class Job:
""" A command line job to run with a specified number of cores
"""
def __init__(self, job_id, cmd, num_cores=1, stdout=None, stderr=None, priority_method="fifo",
rundir=".", name=None, use_... | {
"repo_name": "johandahlberg/localq",
"path": "localq/Job.py",
"copies": "1",
"size": "4840",
"license": "mit",
"hash": -3762102176296180000,
"line_mean": 34.8518518519,
"line_max": 106,
"alpha_frac": 0.5169421488,
"autogenerated": false,
"ratio": 4.253075571177504,
"config_test": false,
"has... |
__author__ = 'dan'
from usedMsgs import continueMsg1A , continueMsg1B , continueMsg2 , inputRequest
from askForVars import askForVars
from verifyGo import verifyGo
from math import fmod
def verifyData( dirList , varList , allData ) :
done = False # verification loop not done
printBeg ... | {
"repo_name": "djsegal/ahab_legacy_",
"path": "pythonToMatlab/toMatlabAids/verifyData.py",
"copies": "1",
"size": "4270",
"license": "apache-2.0",
"hash": 6784421264613680000,
"line_mean": 22.7277777778,
"line_max": 82,
"alpha_frac": 0.3613583138,
"autogenerated": false,
"ratio": 5.11377245508982... |
__author__ = 'dan'
from usedMsgs import preDirMsg
from math import fmod
def displayDirs( allData ) :
curDirMsg = preDirMsg + ' '
for ( i , curFolder ) in enumerate( allData ) :
# ------------------------------
# start index at 1 because
# humans are using this number
... | {
"repo_name": "djsegal/ahab_legacy_",
"path": "pythonToMatlab/toMatlabAids/displayDirs.py",
"copies": "1",
"size": "1204",
"license": "apache-2.0",
"hash": -2020366529422209000,
"line_mean": 21.7358490566,
"line_max": 51,
"alpha_frac": 0.3504983389,
"autogenerated": false,
"ratio": 4.362318840579... |
__author__ = 'Dan'
import json
import web
from models.policies import policies_model
from localsys.environment import context
from localsys.storage import db
class history_rest:
def GET(self):
web.header('Content-Type', 'application/json')
#get policy history (used in table display on a Profil... | {
"repo_name": "mapto/sprks",
"path": "controllers/policy_history.py",
"copies": "1",
"size": "1786",
"license": "mit",
"hash": -5691688441002371000,
"line_mean": 29.8103448276,
"line_max": 104,
"alpha_frac": 0.5951847704,
"autogenerated": false,
"ratio": 4.163170163170163,
"config_test": false,... |
__author__ = 'dan'
import networkx as nx
from datetime import datetime
import numpy as np
import pandas as pd
import itertools
import scipy.stats as stats
import os
import mlalgorithms.transfer_entropy
nets = [('small','fluorescence_iNet1_Size100_CC01inh.txt.desc.csv')]
out_dir = '/Users/dan/dev/datasci/kaggle/connec... | {
"repo_name": "ecodan/kaggle-connectomix",
"path": "cnct_gte.py",
"copies": "1",
"size": "1564",
"license": "apache-2.0",
"hash": 2388798853302309400,
"line_mean": 30.9387755102,
"line_max": 92,
"alpha_frac": 0.6042199488,
"autogenerated": false,
"ratio": 3.0076923076923077,
"config_test": fals... |
__author__ = 'dan'
import networkx as nx
from datetime import datetime
import numpy as np
import pandas as pd
import itertools
import scipy.stats as stats
import os
nets = [('small','fluorescence_iNet1_Size100_CC01inh.txt.diff.csv')]
out_dir = '/Users/dan/dev/datasci/kaggle/connectomix/out/'
#nets = {'valid':'fluores... | {
"repo_name": "ecodan/kaggle-connectomix",
"path": "cnct_pearson.py",
"copies": "1",
"size": "1717",
"license": "apache-2.0",
"hash": -6174207283983943000,
"line_mean": 32.0384615385,
"line_max": 92,
"alpha_frac": 0.5835760047,
"autogenerated": false,
"ratio": 3.071556350626118,
"config_test": ... |
__author__ = 'dan'
"""
Obsolete, but used for comparison.
"""
from collections import deque, defaultdict
import time
from redis import Redis
from colored_bitcoins.util import hashEncode
r = Redis(db=2)
def genesis(tx):
outputs = r.hgetall(tx)
total = sum(map(int, [outputs[k] for k in outputs if ":v"... | {
"repo_name": "Danstahr/colored-bitcoins-project",
"path": "colored_bitcoins/processor.py",
"copies": "1",
"size": "2734",
"license": "mit",
"hash": -5796308567659321000,
"line_mean": 27.4791666667,
"line_max": 87,
"alpha_frac": 0.5877834674,
"autogenerated": false,
"ratio": 3.1174458380843784,
... |
__author__ = 'dan'
'''
Step 1 in pipeline
Input: flourescence files
Output:
1) diff'd time series (delta between each two time frames)
2) descretized time series (deltas converted to binary with threshold N)
'''
import pandas as pd
import numpy as np
import os
from datetime import datetime
# nets = [('small','flu... | {
"repo_name": "ecodan/kaggle-connectomix",
"path": "cnct_munge.py",
"copies": "1",
"size": "2441",
"license": "apache-2.0",
"hash": 2677448739148627000,
"line_mean": 34.3913043478,
"line_max": 123,
"alpha_frac": 0.5944285129,
"autogenerated": false,
"ratio": 2.965978128797084,
"config_test": fa... |
__author__ = 'dan'
'''
Step 2 in pipeline
This is the first approach I took. Basically it counts single occurances of potential connectivity
between neurons in the current time frame and up to N frames back.
Input: the descretized file
Output: a graphml file with info about each directed edge
'''
import networkx a... | {
"repo_name": "ecodan/kaggle-connectomix",
"path": "cnct_graph.py",
"copies": "1",
"size": "5773",
"license": "apache-2.0",
"hash": 8339368895633037000,
"line_mean": 35.0875,
"line_max": 101,
"alpha_frac": 0.5257231942,
"autogenerated": false,
"ratio": 3.463107378524295,
"config_test": false,
... |
__author__ = 'dan'
'''
Step 2 in pipeline
This is the second approach. Basically it counts complex potential connectivity
between neurons in the current time frame and up to 3 frames back and tracks that in a 2**4 matrix
(flattened to a 4 bit binary number). For example, in I -> J if I fired current and n-2 frames ... | {
"repo_name": "ecodan/kaggle-connectomix",
"path": "cnct_graph2.py",
"copies": "1",
"size": "5050",
"license": "apache-2.0",
"hash": -4022575771481922600,
"line_mean": 35.8686131387,
"line_max": 122,
"alpha_frac": 0.5594059406,
"autogenerated": false,
"ratio": 3.2664941785252264,
"config_test":... |
__author__ = 'danny'
from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
class UserCreationEmailForm(UserCreationForm):
email = forms.EmailInput()
class Meta:
model = User
fields... | {
"repo_name": "daatrujillopu/Sfotipy",
"path": "userprofiles/forms.py",
"copies": "1",
"size": "1125",
"license": "mit",
"hash": -8312996375755603000,
"line_mean": 31.1714285714,
"line_max": 78,
"alpha_frac": 0.6764444444,
"autogenerated": false,
"ratio": 4.1208791208791204,
"config_test": fals... |
__author__ = 'danoday'
import string
from nltk.corpus import stopwords
from nltk.tokenize import WordPunctTokenizer
from nltk.collocations import BigramCollocationFinder
from nltk.metrics import BigramAssocMeasures
"""
# this extracted unigrams and bigrams but created too large of a sample file with bigrams
def ext... | {
"repo_name": "danzek/email-formality-detection",
"path": "features/bagofwords.py",
"copies": "1",
"size": "1422",
"license": "mit",
"hash": -4837631634303933000,
"line_mean": 34.575,
"line_max": 115,
"alpha_frac": 0.7004219409,
"autogenerated": false,
"ratio": 3.4347826086956523,
"config_test"... |
__author__ = 'Dante'
import sys
import os
from optparse import OptionParser
import numpy
import openbabel as ob
from pybel import Outputfile
from pybel import readfile
def get_Molfiles(molFileLocation, startCompFile):
'''Grab all molfiles from a folder and separate them from the cofactors.
Arguments: ... | {
"repo_name": "tyo-lab-nu/SimScripts",
"path": "SimIndex.py",
"copies": "1",
"size": "4635",
"license": "mit",
"hash": -7708693258381587000,
"line_mean": 27.1509433962,
"line_max": 123,
"alpha_frac": 0.6714131607,
"autogenerated": false,
"ratio": 3.0058365758754864,
"config_test": false,
"has... |
import xml.etree.ElementTree as ET
import sys
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
# A class for parsing PDML files from Wireshark
class PDMLParse:
def __init__(self,filename):
self.filename=filename
def get_root(self):
tree=ET... | {
"repo_name": "Trellis-Logic/pyusb_pcap_replay",
"path": "scripts/pdml_parse.py",
"copies": "1",
"size": "4876",
"license": "bsd-2-clause",
"hash": 5690656827328366000,
"line_mean": 43.1481481481,
"line_max": 136,
"alpha_frac": 0.5549630845,
"autogenerated": false,
"ratio": 4.273444347063979,
"... |
__author__ = 'Danyang'
def memoize(func):
"""
the function must not modify or rely on external state
the function should be stateless.
usage: @memoize as function annotation
:param func: the function, whose result you would like to cached based on input arguments
"""
cache = {}
def re... | {
"repo_name": "idf/FaceReader",
"path": "util/commons_util/decorators/algorithms.py",
"copies": "2",
"size": "1173",
"license": "mit",
"hash": -2477212203891147300,
"line_mean": 25.0888888889,
"line_max": 93,
"alpha_frac": 0.6035805627,
"autogenerated": false,
"ratio": 4.144876325088339,
"confi... |
__author__ = 'Danyang'
from cross_validation import CrossValidator
import os
import re
class TotalVerifier(CrossValidator):
def verify(self):
RAW_FOLDER = "data"
INPUT_FOLDER = "auto"
OUTPUT_FOLDER = "auto-tagged-model-all"
os.system("java -cp ../lib/ner/stanford-ner.jar edu.stanfo... | {
"repo_name": "idf/RecipeIngredients",
"path": "ner/recipe/all_verfication.py",
"copies": "1",
"size": "1042",
"license": "apache-2.0",
"hash": -4156152102768195600,
"line_mean": 36.2142857143,
"line_max": 123,
"alpha_frac": 0.6218809981,
"autogenerated": false,
"ratio": 3.1011904761904763,
"co... |
__author__ = 'Danyang'
import logging
import sys
class Solution(object):
@property
def logger(self):
lgr = logging.getLogger(__name__)
lgr.setLevel(logging.CRITICAL)
if not lgr.handlers:
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBUG)
... | {
"repo_name": "algorhythms/HackerRankAlgorithms",
"path": "Count Luck.py",
"copies": "1",
"size": "3238",
"license": "apache-2.0",
"hash": 7425214293827431000,
"line_mean": 28.4363636364,
"line_max": 77,
"alpha_frac": 0.4107473749,
"autogenerated": false,
"ratio": 3.778296382730455,
"config_tes... |
__author__ = 'Danyang'
class Solution:
def addBinary_builtin(self, a, b):
"""
Built-in function
:param a: string
:param b: string
:return: string
"""
a = int(a, 2)
b = int(b, 2)
return bin(a+b)[2:]
def addBinary(self, a, b):
... | {
"repo_name": "ee08b397/LeetCode-4",
"path": "067 Add Binary.py",
"copies": "3",
"size": "1525",
"license": "mit",
"hash": 7767312968250361000,
"line_mean": 24.2931034483,
"line_max": 55,
"alpha_frac": 0.3226229508,
"autogenerated": false,
"ratio": 4.066666666666666,
"config_test": false,
"ha... |
__author__ = 'Danyang'
class Solution:
def evalRPN(self, tokens):
"""
stack
basic in bytecode operation
basic in compiler technique
:param tokens:
:return:
"""
ops = ["+", "-", "*", "/"]
def arith(a, b, op):
if (op=="+")... | {
"repo_name": "ee08b397/LeetCode-4",
"path": "150 Evaluate Reverse Polish Notation.py",
"copies": "2",
"size": "1467",
"license": "mit",
"hash": -5044113127129926000,
"line_mean": 27.38,
"line_max": 93,
"alpha_frac": 0.3810497614,
"autogenerated": false,
"ratio": 4.086350974930362,
"config_test... |
__author__ = 'Danyang'
class Solution:
def solve(self, cipher, lst):
"""
dp
"""
N, K= cipher
N = int(N)
K = int(K)
N = len(lst)
dp = [[1<<32 for _ in xrange(N+1)] for _ in xrange(N+1)]
for i in xrange(N):
dp[i][i] = 1
... | {
"repo_name": "algorhythms/GoogleApacCodeJamRoundB",
"path": "C/main2.py",
"copies": "2",
"size": "1350",
"license": "mit",
"hash": -8708761391686430000,
"line_mean": 25.5510204082,
"line_max": 92,
"alpha_frac": 0.382962963,
"autogenerated": false,
"ratio": 3.0821917808219177,
"config_test": fa... |
__author__ = 'Danyang'
class Solution:
smallest = 1<<32
def dfs(self, seq, K):
if self.smallest==0:
return
length = len(seq)
self.smallest = min(self.smallest, length)
if length<3:
return
for i in xrange(length-2):
if s... | {
"repo_name": "ee08b397/GoogleApacCodeJamRoundB",
"path": "C/main.py",
"copies": "2",
"size": "1389",
"license": "mit",
"hash": 6678039202124685000,
"line_mean": 21.15,
"line_max": 69,
"alpha_frac": 0.4103671706,
"autogenerated": false,
"ratio": 3.5891472868217056,
"config_test": false,
"has_... |
__author__ = 'Danyang'
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# ascending
def insertionSortList_TLE(self, head):
"""
Time Limit Exceded
"""
comparator = lambda x, ... | {
"repo_name": "ee08b397/LeetCode-4",
"path": "147 Insertion Sort List.py",
"copies": "3",
"size": "3323",
"license": "mit",
"hash": 7524987850643847000,
"line_mean": 28.2090909091,
"line_max": 119,
"alpha_frac": 0.5167017755,
"autogenerated": false,
"ratio": 4.102469135802469,
"config_test": fa... |
__author__ = 'Danyang'
def sum_sum(n):
return (n**3+3*n**2+2*n)/6
class Solution:
def solve(self, cipher):
"""
Large Problem Set Not solved
"""
B, L, N= cipher
B = int(B)
L = int(L)
N = int(N)
lowest_level = 0
# 1 is 250, 3... | {
"repo_name": "algorhythms/GoogleApacCodeJamRoundB",
"path": "B/main.py",
"copies": "2",
"size": "1773",
"license": "mit",
"hash": -2764430957644004000,
"line_mean": 21.9594594595,
"line_max": 78,
"alpha_frac": 0.4139875917,
"autogenerated": false,
"ratio": 3.3389830508474576,
"config_test": fa... |
__author__ = 'Danyang'
import logging
import sys
class Solution(object):
@property
def logger(self):
lgr = logging.getLogger(__name__)
lgr.setLevel(logging.CRITICAL)
if not lgr.handlers:
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBU... | {
"repo_name": "ee08b397/HackerRankAlgorithms",
"path": "Count Luck.py",
"copies": "1",
"size": "3300",
"license": "apache-2.0",
"hash": -5842274116500028000,
"line_mean": 28.0181818182,
"line_max": 77,
"alpha_frac": 0.403030303,
"autogenerated": false,
"ratio": 3.891509433962264,
"config_test":... |
__author__ = 'Danyang'
class Solution(object):
def evalRPN(self, tokens):
"""
stack
basic in bytecode operation
basic in compiler technique
:param tokens:
:return:
"""
ops = ["+", "-", "*", "/"]
def arith(a, b, op):
... | {
"repo_name": "algorhythms/LeetCode",
"path": "150 Evaluate Reverse Polish Notation.py",
"copies": "1",
"size": "1493",
"license": "mit",
"hash": -447761745875300800,
"line_mean": 26.2075471698,
"line_max": 106,
"alpha_frac": 0.3837910248,
"autogenerated": false,
"ratio": 4.112947658402204,
"co... |
__author__ = 'Danyang'
class Solution:
def generateParenthesisDfs(self, result, cur, left, right):
"""
DFS
Catalan Number
:param result: result list
:param cur: currently processing string
:param left: number of left parenthesis remaining
:param r... | {
"repo_name": "algorhythms/GoogleApacCodeJamRoundB",
"path": "D/main.py",
"copies": "2",
"size": "2234",
"license": "mit",
"hash": -847702129362540400,
"line_mean": 21.7659574468,
"line_max": 94,
"alpha_frac": 0.4923903312,
"autogenerated": false,
"ratio": 3.885217391304348,
"config_test": fals... |
# Loads one of the Zemax sample files "Cooke Triplet".
# Performs an exercise from the Short Course, optimising the lens.
from __future__ import print_function
from zemaxclient import Connection
from libzmx import *
import surface
# Establish a connection to the running Zemax application
z = Connection()
# Load a le... | {
"repo_name": "dariussullivan/libzmx",
"path": "examples/cooke_triplet.py",
"copies": "1",
"size": "2760",
"license": "bsd-3-clause",
"hash": -4454346693875920400,
"line_mean": 33.0740740741,
"line_max": 78,
"alpha_frac": 0.7173913043,
"autogenerated": false,
"ratio": 3.1399317406143346,
"confi... |
# These unit tests require the Zemax application to be running.
# Run the tests with the command:
# $ python -m libzmx.tests
from __future__ import print_function
import zemaxclient
from zemaxclient import Connection, SurfaceLabelError
from libzmx import (SurfaceSequence, return_to_coordinate_frame,
... | {
"repo_name": "dariussullivan/libzmx",
"path": "tests.py",
"copies": "1",
"size": "38825",
"license": "bsd-3-clause",
"hash": 7288405261197799000,
"line_mean": 32.6730268864,
"line_max": 86,
"alpha_frac": 0.60128783,
"autogenerated": false,
"ratio": 3.711759082217973,
"config_test": true,
"ha... |
__author__ = 'dark00ps'
# USER INPUT
# The simplest use of the input function assigns a string to a variable.
print('Please enter your first name::::\n', end='')
inputFirstName = input()
print('\nAnd your last name::::\n')
inputLastName = input()
print('\nMy full name is::::', inputFirstName, inputLastName, '\n')
# ... | {
"repo_name": "panherz/MyPyCode",
"path": "UserInput.py",
"copies": "1",
"size": "2333",
"license": "apache-2.0",
"hash": -1752450161902282500,
"line_mean": 40.6785714286,
"line_max": 124,
"alpha_frac": 0.7183883412,
"autogenerated": false,
"ratio": 3.6003086419753085,
"config_test": false,
"... |
__author__ = 'darkoa'
import io, os
from django.core.management.base import BaseCommand
from workflows.models import *
class Command(BaseCommand):
"""
This command generates TextFlows user documentation. In particular it generates a ReStructuredText file which can be processed with Spyhx and transformed to... | {
"repo_name": "xflows/textflows",
"path": "workflows/management/commands/generate_tf_user_doc.py",
"copies": "1",
"size": "8277",
"license": "mit",
"hash": 7079680889217982000,
"line_mean": 35.9508928571,
"line_max": 170,
"alpha_frac": 0.5213241513,
"autogenerated": false,
"ratio": 3.601827676240... |
__author__ = 'DarkStar1'
import fileinput, glob, os, re, shutil, sys, urllib
from bs4 import BeautifulSoup
def encodeImgSrc(file, encodedFiles):
#Wanted to use the lxml lib but for some reason it was only finding 1 result within the test file.
soup = BeautifulSoup(file.read(), "html5lib")
for img in soup.... | {
"repo_name": "magenta-aps/htmlthumbnail",
"path": "src/main/resources/alfresco/extension/scripts/python/pdfToHtml.py",
"copies": "1",
"size": "2234",
"license": "apache-2.0",
"hash": -7951289694446587000,
"line_mean": 36.8813559322,
"line_max": 111,
"alpha_frac": 0.7041181737,
"autogenerated": fal... |
__author__ = 'DarkStar1'
import fileinput, glob, os, re, shutil, sys, urllib
#holds a map of the png file and it's base64 encoding in the form of {"xx.png":"hsbudbud..."}
encodedFiles = {}
base64Prefix = "data:image/png;base64,"
#The excel file to convert
SOURCE_FILE = os.path.basename(sys.argv[2])
# change to the s... | {
"repo_name": "magenta-aps/htmlthumbnail",
"path": "src/main/resources/alfresco/extension/scripts/python/excel2html.py",
"copies": "1",
"size": "2123",
"license": "apache-2.0",
"hash": -2972254246506837500,
"line_mean": 38.3333333333,
"line_max": 96,
"alpha_frac": 0.6481394253,
"autogenerated": fal... |
__author__ = 'Darwin Monroy'
from binascii import hexlify, unhexlify
class BaseCodec(object):
@staticmethod
def encode(data, alphabet, bs=1, pc='='):
"""
Encodes the given phrase using the alphabet.
:param data: value to encode
:param alphabet: alphabet to use in the encodin... | {
"repo_name": "dmonroy/dmonroy.codec",
"path": "dmonroy/codec/base.py",
"copies": "1",
"size": "2136",
"license": "mit",
"hash": 1495946535606036500,
"line_mean": 23.5517241379,
"line_max": 63,
"alpha_frac": 0.4911048689,
"autogenerated": false,
"ratio": 4.14757281553398,
"config_test": false,
... |
__author__ = 'dasDachs'
__version__ = '0.1'
"""
The main part of the app. The center is the app factory that returns the Flask
app with all the setting needed to run in your environment.
"""
from flask import Flask
from flask_migrate import Migrate
from flask_restful import Api
from flask_sqlalchemy import SQLAlchemy
... | {
"repo_name": "dasdachs/flask-blog",
"path": "backend/app/__init__.py",
"copies": "1",
"size": "1372",
"license": "mit",
"hash": 3202192684446380000,
"line_mean": 25.3846153846,
"line_max": 78,
"alpha_frac": 0.7004373178,
"autogenerated": false,
"ratio": 3.8217270194986073,
"config_test": true,... |
__author__ = 'dash'
import os
import numpy as np
from PIL import Image
# from keras.preprocessing.sequence import pad_sequences
from collections import Counter
import cPickle
import random
class BucketData(object):
def __init__(self):
self.max_width = 0
self.max_label_len = 0
self.data_li... | {
"repo_name": "dashayushman/air-script",
"path": "src/data_util/bucketdata.py",
"copies": "1",
"size": "4424",
"license": "mit",
"hash": -5169069644023132000,
"line_mean": 37.8070175439,
"line_max": 87,
"alpha_frac": 0.5495027125,
"autogenerated": false,
"ratio": 3.533546325878594,
"config_test... |
__author__ = 'dat'
'''
generate descriptors from a protein in pdb format and a directory of ligands in mol2 format
'''
import os
import glob
import sys
import csv
import logging
from optparse import OptionParser
from rfscore.config import logger
from rfscore.credo import contacts
from rfscore.ob import get_molecule
d... | {
"repo_name": "mrknight/Py_ML-scoring",
"path": "bin/generate.desc.dir.py",
"copies": "1",
"size": "5026",
"license": "mit",
"hash": 7966719107200612000,
"line_mean": 34.3943661972,
"line_max": 117,
"alpha_frac": 0.5527258257,
"autogenerated": false,
"ratio": 4.259322033898305,
"config_test": f... |
__author__ = 'dat'
'''
generate descriptors from a protein in pdb format and a directory of ligands in mol2 format
'''
import os
import re
import sys
import csv
import logging
from math import log10
from operator import itemgetter
from optparse import OptionParser
from rfscore.config import config, logger
from rfscore... | {
"repo_name": "mrknight/Py_ML-scoring",
"path": "bin/generate.desc.py",
"copies": "1",
"size": "5132",
"license": "mit",
"hash": 944375666518962800,
"line_mean": 32.7631578947,
"line_max": 117,
"alpha_frac": 0.597817615,
"autogenerated": false,
"ratio": 3.870286576168929,
"config_test": false,
... |
__author__ = 'dat'
import os
import re
import sys
import csv
import logging
from libRMSD import *
from operator import itemgetter
from optparse import OptionParser
#from config import config, logger
#from credo import contacts
#from ob import get_molecule
from rfscore.config import config, logger
from rfscore.credo... | {
"repo_name": "mrknight/Py_ML-scoring",
"path": "bin/generate.CASF.poses.py",
"copies": "1",
"size": "8388",
"license": "mit",
"hash": 9171349089458772000,
"line_mean": 34.0962343096,
"line_max": 118,
"alpha_frac": 0.5577014783,
"autogenerated": false,
"ratio": 3.8389016018306634,
"config_test"... |
__author__ = 'dat'
import subprocess
import os
import csv
TMP_FILE = '/home/dat/rmsd.tmp'
def calcRMSD(refLigand, calcLigand):
f = open(TMP_FILE, "w")
run_cmd = "rms_analysis " + refLigand + " " + calcLigand
subprocess.call(run_cmd.split(), stdout=f)
def parseRMSDoutput(outputFile = TMP_FILE):
... | {
"repo_name": "mrknight/Py_ML-scoring",
"path": "bin/libRMSD.py",
"copies": "1",
"size": "1273",
"license": "mit",
"hash": 6409745624911895000,
"line_mean": 28.6046511628,
"line_max": 104,
"alpha_frac": 0.6276512176,
"autogenerated": false,
"ratio": 2.9742990654205608,
"config_test": false,
"... |
__author__ = 'davburge'
import collections
import Tkinter as tk
shipClass = None
shipMods = None
damageType = None
resistType = None
focusSkill = None
focusLevel = None
classSkill = None
classLevel = None
subSkill_1 = None
subSkill_2 = None
subSkill_3 = None
subskill_1Level = None
subskill_2Lev... | {
"repo_name": "dburgess560/sscalc",
"path": "ss_inputs.py",
"copies": "1",
"size": "5513",
"license": "apache-2.0",
"hash": 8886802175397620000,
"line_mean": 21.9782608696,
"line_max": 46,
"alpha_frac": 0.5405405405,
"autogenerated": false,
"ratio": 3.6389438943894388,
"config_test": false,
"... |
__author__ = 'davburge'
import collections
ships = {
'lfi': "Light Fighter",
'hfi': "Heavy Fighter",
'sfr': "Support Freighter",
'ifr': "Industrial Freighter",
'cap': "Capital Ship",
'all': "All",
}
skill_tree = {
'combat_focus': {
'name': "Combat Focus",
'... | {
"repo_name": "dburgess560/sscalc",
"path": "ss_constants.py",
"copies": "1",
"size": "3857",
"license": "apache-2.0",
"hash": -1578861088436656000,
"line_mean": 28.3858267717,
"line_max": 111,
"alpha_frac": 0.5040186674,
"autogenerated": false,
"ratio": 3.40423654015887,
"config_test": false,
... |
__author__ = 'davburge'
import re
percentRegex = re.compile('(^[-+]?[0]?[.]{1}[\d]*|^[-+]?[123456789]{1,}[\d]*[.]?[\d]*|^[-+0]{1}|^[-+]?[0]?)\Z')
# Floats with +- signs, no leading 0 unless +-0.### or 0.###
bankRegex = re.compile('(^[123456789]{1,}[\d]*)\Z')
# Only ints, no leading 0
decimalRegex = re.compile('... | {
"repo_name": "dburgess560/sscalc",
"path": "ss_validators.py",
"copies": "1",
"size": "1725",
"license": "apache-2.0",
"hash": 1952602333283602000,
"line_mean": 36.3333333333,
"line_max": 111,
"alpha_frac": 0.5779710145,
"autogenerated": false,
"ratio": 3.218283582089552,
"config_test": false,... |
__author__ = 'davburge'
import ss_constants
import ss_inputs
import ss_math
import ss_validators
import Tkinter as tk
from Tkconstants import *
class Application(tk.Frame):
def __init__(self, master=None):
'''Main frame of the application'''
tk.Frame.__init__(self, master)
s... | {
"repo_name": "dburgess560/sscalc",
"path": "ss_gui.py",
"copies": "1",
"size": "27774",
"license": "apache-2.0",
"hash": -4543361302779968000,
"line_mean": 45.2380952381,
"line_max": 120,
"alpha_frac": 0.5681212645,
"autogenerated": false,
"ratio": 3.7634146341463413,
"config_test": true,
"h... |
__author__ = 'davburge'
import ss_constants
import ss_inputs
import ss_skills
def calculate():
atBonus = getATBonus()
for stat in ss_constants.statNames.keys():
if stat in ss_constants.calculatedStats:
baseAmount = getBaseAmount(stat)
if baseAmount != 0:
... | {
"repo_name": "dburgess560/sscalc",
"path": "ss_math.py",
"copies": "1",
"size": "8519",
"license": "apache-2.0",
"hash": 9121442646172817000,
"line_mean": 35.047826087,
"line_max": 125,
"alpha_frac": 0.5810541143,
"autogenerated": false,
"ratio": 3.334246575342466,
"config_test": false,
"has... |
__author__ = 'davburge'
#Stealth?
#Crits
#Recoil?
#Firing Energy?
#Shadow Ambush (Seer)
stats = [
'shieldBank',
'shieldCharge',
'energyBank',
'energyCharge',
'hull',
'speed',
'damage',
'RoF',
'range',
'vis',
'multifire',
'docking',
'firingEnergy... | {
"repo_name": "dburgess560/sscalc",
"path": "ss_skills.py",
"copies": "1",
"size": "8340",
"license": "apache-2.0",
"hash": 49329021847712900,
"line_mean": 16.0562770563,
"line_max": 101,
"alpha_frac": 0.5220623501,
"autogenerated": false,
"ratio": 2.6808100289296046,
"config_test": false,
"h... |
from __future__ import division
import numpy as np
def boundary_separation(array, idx):
"""
Computes the distance between boundary points in the 4, partitioned
closed sets on S1.
:param array: list of each sub-array for the non-empty quadrants (tuple)
:param idx: index of the current array (int)
... | {
"repo_name": "brainsqueeze/Image_correction",
"path": "src/workers/optimization_utils.py",
"copies": "1",
"size": "4137",
"license": "mit",
"hash": -201138871256458800,
"line_mean": 31.0697674419,
"line_max": 107,
"alpha_frac": 0.5806139715,
"autogenerated": false,
"ratio": 3.2574803149606297,
... |
import cv2
from skimage import io
from skimage.transform import probabilistic_hough_line
import matplotlib.pyplot as plt
import os
import warnings
import random
import numpy as np
warnings.filterwarnings('ignore', category=RuntimeWarning)
class CorrectImage(object):
def __init__(self):
self.path = ""
... | {
"repo_name": "brainsqueeze/Image_correction",
"path": "src/workers/correct.py",
"copies": "1",
"size": "4955",
"license": "mit",
"hash": -6673365139962833000,
"line_mean": 31.8145695364,
"line_max": 105,
"alpha_frac": 0.550554995,
"autogenerated": false,
"ratio": 3.847049689440994,
"config_tes... |
__author__="daveshepard"
__date__ ="$Jun 10, 2011 4:11:10 PM$"
import MySQLdb
import threading
import time
import simplejson
import logging
host = "localhost"
username = "root"
password = "GIS4ucla"
database = "hcnow"
TWITTER_TABLE = "tweets"
#connection = None
def get_connection():
connection = MySQLdb.conne... | {
"repo_name": "shepdl/stream-daemon",
"path": "database.py",
"copies": "1",
"size": "7889",
"license": "mit",
"hash": 8849506309473328000,
"line_mean": 42.3461538462,
"line_max": 146,
"alpha_frac": 0.4794016986,
"autogenerated": false,
"ratio": 4.022947475777665,
"config_test": false,
"has_no... |
__author__ = 'David Anderson'
"""
Flask-Flywheel
--------------
Adds Flywheel support to your Flask application.
"""
import codecs
import os
import re
from setuptools import setup, find_packages
def find_version(*file_paths):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(he... | {
"repo_name": "oggthemiffed/Flask-Spring",
"path": "setup.py",
"copies": "1",
"size": "1631",
"license": "mit",
"hash": -1570287149767743500,
"line_mean": 29.7924528302,
"line_max": 93,
"alpha_frac": 0.6088289393,
"autogenerated": false,
"ratio": 3.8649289099526065,
"config_test": false,
"has... |
"""
Converts UseCaseMaker XML file to ASCIIDOC source
Copyright (c) David Avsajanishvili, 2009
"""
import ucm_xmls
from pyxmls import *
import getopt, os, re, codecs
TOP_COMMENT = \
r"""// ''''''''''''''''''''''''''''''''''''''''''''''''''
// THIS FILE IS GENERATED AUTOMATICALLY - DON'T EDIT!
// '''''''''''''''''''... | {
"repo_name": "avsd/ucm2asciidoc",
"path": "ucm2asciidoc/xmls2asciidoc.py",
"copies": "1",
"size": "8090",
"license": "bsd-3-clause",
"hash": 3537896486285629400,
"line_mean": 26.8006872852,
"line_max": 94,
"alpha_frac": 0.4896168109,
"autogenerated": false,
"ratio": 3.6739327883742052,
"config... |
"""
Helper package to make Python scripts with
command-line options, converting database table contents
to ASCIIDOC table.
Connects to database specified in the Conneciton string
and prints containment of the table
in ASCIIDOC format.
Requires Python 2.6 and cx_Oracle
to be installed on the workstation
"... | {
"repo_name": "avsd/sql2asciidoc",
"path": "sql2asciidoc/oracle2asciidoc.py",
"copies": "1",
"size": "4986",
"license": "bsd-3-clause",
"hash": -8306055356921918000,
"line_mean": 24.6631016043,
"line_max": 77,
"alpha_frac": 0.5038106699,
"autogenerated": false,
"ratio": 4.110469909315746,
"conf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.