text
stringlengths
0
1.05M
meta
dict
__author__ = 'YANGDY' import chardet def readfiles(dataPath, firstRow, charset,separator): listdata =[] header=[] try: fsock = open(dataPath, "r") except IOError: print "The file {" + dataPath + "}don't exist, Please double check!" return s = fsock.readlines() ...
{ "repo_name": "smellydog521/classicPlayParsing", "path": "readFile.py", "copies": "1", "size": "1073", "license": "apache-2.0", "hash": 8053313980750825000, "line_mean": 24.1707317073, "line_max": 76, "alpha_frac": 0.4846225536, "autogenerated": false, "ratio": 3.9448529411764706, "config_test"...
import cantera as ct import numpy as np import sys # import function from get_reaction_info import get_reaction_info # initialize the chemistry, save in g g = ct.Solution('h2-plog.cti') # stoichiometric coefficients # positive numbers Sf = g.reactant_stoich_coeffs() # number of species and reactions KK = g.n_specie...
{ "repo_name": "yanggaome/Python-functions-based-on-Cantera", "path": "test_get_reaction_info.py", "copies": "1", "size": "5138", "license": "mit", "hash": -4107429357887657000, "line_mean": 36.503649635, "line_max": 140, "alpha_frac": 0.5821331257, "autogenerated": false, "ratio": 2.7757968665586...
import numpy as np # class of reaction information class ReactionInfo: def __init__(self): self.isReversible = False self.isThirdbody = False self.isFalloff = False self.isChemical = False self.isPLOG = False self.isSimple = False self.isLindemann = False ...
{ "repo_name": "yanggaome/Python-functions-based-on-Cantera", "path": "get_reaction_info.py", "copies": "1", "size": "5902", "license": "mit", "hash": -4974820962979619000, "line_mean": 28.8080808081, "line_max": 108, "alpha_frac": 0.5814977974, "autogenerated": false, "ratio": 3.1954520844612886,...
__author__ = 'yangjiebin' from flask.ext.wtf import Form from wtforms import StringField,PasswordField,BooleanField,SubmitField from wtforms.validators import Required,Length,Email,EqualTo,Regexp from wtforms import ValidationError from ..models import User from flask.ext.login import current_user class LoginForm(Form...
{ "repo_name": "rebortyang/flask_blog", "path": "app/auth/forms.py", "copies": "1", "size": "2583", "license": "mit", "hash": 1222424632757626000, "line_mean": 45.125, "line_max": 133, "alpha_frac": 0.7092528068, "autogenerated": false, "ratio": 4.276490066225166, "config_test": false, "has_no...
__author__ = 'yangjiebin' import unittest from app.models import * class UserModelTestCase(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_password_setter(self): u = User(password='cat') self.assertTrue(u.password_hash is not None) def te...
{ "repo_name": "rebortyang/flask_blog", "path": "tests/test_user_model.py", "copies": "1", "size": "1168", "license": "mit", "hash": -4699386393231680000, "line_mean": 27.512195122, "line_max": 64, "alpha_frac": 0.6369863014, "autogenerated": false, "ratio": 3.7197452229299364, "config_test": tr...
__author__ = 'Yang' import copy import numpy as np import math from acrm import ApproxCorankingMatrix from sklearn import (manifold, datasets, decomposition, ensemble, lda, random_projection) from scipy.interpolate import griddata from scipy.stats import distributions from collections import Counter from matplotlib im...
{ "repo_name": "gnavvy/PyNode.vis", "path": "vast.py", "copies": "1", "size": "6532", "license": "mit", "hash": -303639642114930600, "line_mean": 34.8901098901, "line_max": 99, "alpha_frac": 0.5791488059, "autogenerated": false, "ratio": 3.284062342885872, "config_test": false, "has_no_keyword...
__author__ = 'Yang' import numpy as np from acrm import ApproxCorankingMatrix from sklearn import datasets, manifold from scipy.interpolate import griddata class Defog(object): def __init__(self, n_seeds=1000): print("init") self.seeds = None self.seed_values = None self.grid_x =...
{ "repo_name": "gnavvy/PyNode.vis", "path": "defog.py", "copies": "1", "size": "4942", "license": "mit", "hash": 8717844667376979000, "line_mean": 36.7251908397, "line_max": 95, "alpha_frac": 0.56131121, "autogenerated": false, "ratio": 3.5579553635709145, "config_test": false, "has_no_keyword...
__author__ = 'YangZongyun' # -*- coding: utf-8 -*- from weibo import APIClient import webbrowser import MySQLdb import numpy as np APP_KEY = YourAppKey # need init APP_SECRET = YourAppSecret # need init CALLBACK_URL = 'https://api.weibo.com/oauth2/default.html' # callback url CLIENT = APIClient(app_key=APP_KEY, ...
{ "repo_name": "MOKOTA/weibopoi", "path": "poi.py", "copies": "1", "size": "3906", "license": "mit", "hash": 2805475604630817000, "line_mean": 40.5531914894, "line_max": 173, "alpha_frac": 0.5217613927, "autogenerated": false, "ratio": 3.6267409470752088, "config_test": false, "has_no_keywords...
__author__ = 'yanikafarrugia' import unittest import lattly_service.converter class ConverterTests(unittest.TestCase): def test_degrees_to_radians(self): rad = lattly_service.converter.Converter.degrees_to_radians(120) self.assertEqual(rad, 2.0943951023931953) self.assertIsNotNone(rad) self.assertTrue(rad >...
{ "repo_name": "yfarrugia/lattly", "path": "lattly_tests/converter_tests.py", "copies": "1", "size": "1248", "license": "bsd-2-clause", "hash": 6872003526079988000, "line_mean": 31.8421052632, "line_max": 87, "alpha_frac": 0.7467948718, "autogenerated": false, "ratio": 2.7857142857142856, "confi...
__author__ = 'yanikafarrugia' import sys import logging import lattly_service.converter logger = logging.getLogger('lattly') class MidPointFinder: def compute_weighted_average(cartesian_point, weights, total_weight): try: weighted_average = [0.0] * 3 for point in cartesian_point: weighted_x = weighte...
{ "repo_name": "yfarrugia/lattly", "path": "lattly_service/mid_point_finder.py", "copies": "1", "size": "1841", "license": "bsd-2-clause", "hash": 8427510091572771000, "line_mean": 35.82, "line_max": 95, "alpha_frac": 0.7088538838, "autogenerated": false, "ratio": 3.1203389830508477, "config_tes...
__author__ = 'yanikafarrugia' import sys import logging import math logger = logging.getLogger('lattly') class Converter: def degrees_to_radians(degrees): try: rad = (degrees * (math.pi / 180.0)) return rad except IOError as io_exc: logger.error("I/O error({0}): {1}".format(io_exc.errno, io_exc.strer...
{ "repo_name": "yfarrugia/lattly", "path": "lattly_service/converter.py", "copies": "1", "size": "2244", "license": "bsd-2-clause", "hash": 1220210448629832700, "line_mean": 33.5230769231, "line_max": 99, "alpha_frac": 0.6867201426, "autogenerated": false, "ratio": 3.004016064257028, "config_tes...
__author__ = 'yanikafarrugia' # Initialize the Flask application # app = Flask(__name__) # logger = logging.getLogger('lattly') # @app.route('/') # def index(): # return "Hello, World!" # Point FindCenterMidPoint(List<Point> points, Point midPoint); # Point FindMidPoint(List<Point> points); # @app.route('/get...
{ "repo_name": "yfarrugia/lattly", "path": "lattly_api/mid_point_finder.py", "copies": "1", "size": "1468", "license": "bsd-2-clause", "hash": 6406796602323953000, "line_mean": 26.6981132075, "line_max": 65, "alpha_frac": 0.6294277929, "autogenerated": false, "ratio": 2.839458413926499, "config_...
__author__ = 'Yanir Taflev' from applitools.eyes import Eyes from selenium import webdriver import unittest class Test(unittest.TestCase): eyes = 0 driver = 0 def setUp(self): self.eyes = Eyes() self.eyes.api_key = APPLITOOLS_APIKEY self.driver = webdriver.Firefox() def tear...
{ "repo_name": "yanirta/applitools.examples", "path": "Python/test/applitools_site_unittest.py", "copies": "1", "size": "1132", "license": "apache-2.0", "hash": -8116442332698093000, "line_mean": 29.5945945946, "line_max": 113, "alpha_frac": 0.6254416961, "autogenerated": false, "ratio": 3.7733333...
__author__ = 'yanivshalev' from hydro.conf.settings import * ALL = 'ALL' class Configuration(object): _conf = {} def set(self, key, val): self._conf[key] = val def get(self, key): return self._conf[key] @property def conf(self): return self._conf class Configurator(ob...
{ "repo_name": "Convertro/Hydro", "path": "src/hydro/common/configurator.py", "copies": "1", "size": "2481", "license": "mit", "hash": 7978269530035552000, "line_mean": 28.5357142857, "line_max": 65, "alpha_frac": 0.4740024184, "autogenerated": false, "ratio": 3.793577981651376, "config_test": t...
__author__ = 'yanli' # Args # 1: cluster check window (in seconds) # 2: cluster count # 3: csv trace file name # 4: (optional) cluster file name, without which the even divier will be used as the baseline import sys import filegrouping from datetime import timedelta replay_check_window = timedelta(seconds = int(sys....
{ "repo_name": "mlogic/data-grouping", "path": "src/replay_trace.py", "copies": "1", "size": "1761", "license": "bsd-3-clause", "hash": -7020819108714060000, "line_mean": 35.7083333333, "line_max": 181, "alpha_frac": 0.6541737649, "autogenerated": false, "ratio": 3.529058116232465, "config_test"...
__author__ = 'Yan' import pandas import sklearn.metrics import statistics from sklearn import tree from sklearn.cross_validation import train_test_split from sklearn.tree import DecisionTreeClassifier from io import StringIO from IPython.display import Image import pydotplus # bug fix for display formats to...
{ "repo_name": "yan-duarte/yan-duarte.github.io", "path": "archives/mlda-assignment1.py", "copies": "1", "size": "3516", "license": "mit", "hash": -4503582648145283600, "line_mean": 41.4320987654, "line_max": 146, "alpha_frac": 0.7403299204, "autogenerated": false, "ratio": 3.2051048313582498, "...
__author__ = 'Yan' import numpy import pandas import matplotlib.pyplot as plt import statsmodels.api as sm import statsmodels.formula.api as smf import seaborn import statistics # bug fix for display formats to avoid run time errors pandas.set_option('display.float_format', lambda x:'%.2f'%x) #load the ...
{ "repo_name": "yan-duarte/yan-duarte.github.io", "path": "archives/rmp-assignment4.py", "copies": "1", "size": "3804", "license": "mit", "hash": -4161805459781190700, "line_mean": 46.7692307692, "line_max": 146, "alpha_frac": 0.7192429022, "autogenerated": false, "ratio": 3.1647254575707153, "c...
__author__ = 'Yan' import numpy import pandas import matplotlib.pyplot as plt import statsmodels.api as sm import statsmodels.formula.api as smf import seaborn # bug fix for display formats to avoid run time errors pandas.set_option('display.float_format', lambda x:'%.2f'%x) #load the data data = pandas...
{ "repo_name": "yan-duarte/yan-duarte.github.io", "path": "archives/rmp-assignment3.py", "copies": "1", "size": "3576", "license": "mit", "hash": -6549848870751938000, "line_mean": 39.1264367816, "line_max": 102, "alpha_frac": 0.6546420582, "autogenerated": false, "ratio": 3.134092900964067, "co...
__author__ = 'Yan' import pandas import statistics import numpy as np import matplotlib.pylab as plt from sklearn.cross_validation import train_test_split from sklearn import preprocessing from sklearn.cluster import KMeans # bug fix for display formats to avoid run time errors pandas.set_option('display.f...
{ "repo_name": "yan-duarte/yan-duarte.github.io", "path": "archives/mlda-assignment4.py", "copies": "1", "size": "5898", "license": "mit", "hash": 24415688442889030, "line_mean": 33.7454545455, "line_max": 104, "alpha_frac": 0.7490674805, "autogenerated": false, "ratio": 3.2712146422628954, "con...
__author__ = 'yaoml' #coding=utf-8 import requests import json import ConfigParser def testKQLogin(username,password): postdata = {'username':username,'password':password,'this_is_the_login_form':'1'} r = requests.post('http://kq.channelsoft.com:49527/iclock/accounts/login/', postdata) print r.text == 'res...
{ "repo_name": "yaoml/attendanceTool", "path": "checkRecords.py", "copies": "1", "size": "1299", "license": "apache-2.0", "hash": -2867279413864590300, "line_mean": 32.3333333333, "line_max": 138, "alpha_frac": 0.688221709, "autogenerated": false, "ratio": 2.9725400457665905, "config_test": fals...
import ImageGrab # from PIL import time import numpy as np import string from PIL import Image, ImageChops from PIL.GifImagePlugin import getheader, getdata import os def intToBin(i): # int to binary i1 = i % 256 i2 = int(i / 256) return chr(i1) + chr(i2) def getheaderAnim(im): # generate the h...
{ "repo_name": "Yaoshicn/decaptcha", "path": "giftool.py", "copies": "2", "size": "5297", "license": "mit", "hash": -8078543352921098000, "line_mean": 27.6324324324, "line_max": 75, "alpha_frac": 0.5365301114, "autogenerated": false, "ratio": 3.3461781427668984, "config_test": false, "has_no_k...
from __future__ import division import time import urllib2 import socks from sockshandler import SocksiPyHandler from PIL import Image, ImageEnhance, ImageFilter, ImageGrab class Decaptcha: def __init__(self, new_img_id, counter, number): while counter < number: print 'Now processing pic no %d...
{ "repo_name": "Yaoshicn/decaptcha", "path": "decaptcha.py", "copies": "2", "size": "5364", "license": "mit", "hash": 742515316389685600, "line_mean": 43.3305785124, "line_max": 143, "alpha_frac": 0.5415734526, "autogenerated": false, "ratio": 3.7069799585349, "config_test": false, "has_no_key...
import os from numpy import * from time import sleep def loadDataSet(fileName): dataMat = [] labelMat = [] fr = open(fileName) for line in fr.readlines(): lineArr = line.strip().split('\t') dataMat.append([float(lineArr[0]), float(lineArr[1])]) labelMat.append(float...
{ "repo_name": "Garantion/decaptcha", "path": "svmMLiA.py", "copies": "2", "size": "17464", "license": "mit", "hash": -7737606334588233000, "line_mean": 38.5197215777, "line_max": 120, "alpha_frac": 0.529489235, "autogenerated": false, "ratio": 3.0006872852233677, "config_test": true, "has_no_...
__author__ = 'yarden' from sys import argv import os from collections import defaultdict import csv import sqlite3 as sql META_FILENAME = 'meta.csv' TRANSLATE_FILENAME = 'translate.csv' KB_FILENAME = 'kb.csv' ENC_DIR = 'encounters' CG_DB = 'cg.sqlite' conn = None root = None tags_map = {} def parse_info(filename)...
{ "repo_name": "yarden-livnat/cg", "path": "scripts/tag.py", "copies": "1", "size": "5553", "license": "mit", "hash": -2034667547752004600, "line_mean": 27.192893401, "line_max": 116, "alpha_frac": 0.4635332253, "autogenerated": false, "ratio": 4.162668665667167, "config_test": false, "has_no_...
__author__ = 'yarden' from sys import argv import os from collections import defaultdict import csv tags = dict() types = defaultdict(int) fields = [set() for i in range(5)] def parse_info(filename): return filename[:filename.find('.')] def parse_file(d, filename): enc = parse_info(filename) with ope...
{ "repo_name": "yarden-livnat/cg", "path": "scripts/extract.py", "copies": "1", "size": "1624", "license": "mit", "hash": -6526635420952618000, "line_mean": 22.5507246377, "line_max": 54, "alpha_frac": 0.4593596059, "autogenerated": false, "ratio": 3.6825396825396823, "config_test": false, "ha...
__author__ = 'yarden' from sys import argv import os from collections import defaultdict import csv tags = dict() types = defaultdict(int) temp = dict() fields = [set() for i in range(5)] def parse_info(filename): return filename[:filename.find('.')] def parse_file(d, filename): enc = parse_info(filenam...
{ "repo_name": "yarden-livnat/cg", "path": "scripts/process.py", "copies": "1", "size": "2371", "license": "mit", "hash": -4978702656082067000, "line_mean": 25.0549450549, "line_max": 68, "alpha_frac": 0.4462252214, "autogenerated": false, "ratio": 3.8057784911717496, "config_test": false, "ha...
__author__ = 'yarden' from sys import argv import os from collections import defaultdict import re import csv encounters = dict() tags = dict() types = defaultdict(int) pattern = re.compile('._ADT(\d+)_REG([^_]+)_ENC(\d+)_DOC(\d+)_AGE([^\.]+)') fields = [set() for i in range(5)] class Patient: def __init__(sel...
{ "repo_name": "yarden-livnat/cg", "path": "scripts/process.prev.py", "copies": "1", "size": "2905", "license": "mit", "hash": 1392244379996110300, "line_mean": 23.2166666667, "line_max": 75, "alpha_frac": 0.5005163511, "autogenerated": false, "ratio": 3.2530795072788354, "config_test": false, ...
__author__ = 'yarden' import csv import sqlite3 as sql CG_DB = 'cg.sqlite' root = '/Users/yarden/data/cg/topaz' enc2doc = dict() values = [] def parse(filename): print 'parse ', filename with open(root + '/' + filename) as o: f = csv.DictReader(o) for row in f: e = int(row['En...
{ "repo_name": "yarden-livnat/cg", "path": "scripts/detector.py", "copies": "1", "size": "1185", "license": "mit", "hash": 1196621477518456000, "line_mean": 24.2340425532, "line_max": 103, "alpha_frac": 0.6033755274, "autogenerated": false, "ratio": 3.143236074270557, "config_test": false, "ha...
__author__ = 'yarden' import os import re import csv from sys import argv from collections import namedtuple import yaml from utils.eyaml import eyaml_load NodeCoord = namedtuple('NodeCoord', 'group row col node') MPI_PATTERN = '.*\.mpiP' PROC_PATTERN = 'xtdb2proc' QSTAT_PATTERN = 'qstat.*before' NETTILE_PATTERN = ...
{ "repo_name": "LLNL/DragonView", "path": "app/data/sim/dump_net.py", "copies": "2", "size": "8535", "license": "bsd-2-clause", "hash": 2168092726388678700, "line_mean": 28.7386759582, "line_max": 99, "alpha_frac": 0.5282952548, "autogenerated": false, "ratio": 3.0201698513800426, "config_test":...
__author__ = 'yashar' from django.db import models from django.contrib.auth.models import User from django.forms import ModelForm from django import forms from django.forms.widgets import RadioSelect, Textarea from import_export import resources from survey.forms import clean_to_zero SEX_CHOICES = \ ( (...
{ "repo_name": "leifos/treconomics", "path": "treconomics_project/diversity/models.py", "copies": "1", "size": "3250", "license": "mit", "hash": -7197958036689595000, "line_mean": 29.1018518519, "line_max": 186, "alpha_frac": 0.5913846154, "autogenerated": false, "ratio": 3.6931818181818183, "co...
__author__ = 'Yasoob' from youtube_dl.postprocessor.ffmpeg import FFmpegPostProcessor from PyQt4 import QtCore import os import math class FFmpegVideoConvertorPP(FFmpegPostProcessor): def __init__(self, outpath, downloader=None, preferedformat=None): super(FFmpegVideoConvertorPP, self).__init__(downloader...
{ "repo_name": "janusnic/youtube-dl-GUI", "path": "Threads/PostProcessor.py", "copies": "3", "size": "3271", "license": "mit", "hash": -7015311272076103000, "line_mean": 30.4615384615, "line_max": 107, "alpha_frac": 0.5811678386, "autogenerated": false, "ratio": 3.7727797001153403, "config_test"...
__author__ = 'ycb' from array_add_edit_view import * from html_dic import * from func_to_html_add_edit_view import * import os if __name__ == '__main__': out_dir = os.path.join(os.getcwd(), '../../templates') bianliang_arr = globals().copy().keys() for bianliang in bianliang_arr: if bianliang.star...
{ "repo_name": "jiaxiaolei/pycate", "path": "script/add_edit_view/gen_add_edit_view_html.py", "copies": "1", "size": "3384", "license": "mit", "hash": 453856297448206400, "line_mean": 43.5263157895, "line_max": 97, "alpha_frac": 0.4497635934, "autogenerated": false, "ratio": 3.5961742826780023, ...
__author__ = 'ycchang' import sys import json import os import time from httplib2 import Http class Utility: def __init__(self): pass @staticmethod def execute_until_timeout(function, timeout, *parameters): for counter in xrange(0, timeout+1): time.sleep(1) resul...
{ "repo_name": "cloudawan/cloudone_template", "path": "cassandra/template/cluster - old.py", "copies": "1", "size": "11089", "license": "apache-2.0", "hash": 800120398837135000, "line_mean": 40.531835206, "line_max": 174, "alpha_frac": 0.5793128325, "autogenerated": false, "ratio": 4.0873571691854...
__author__ = 'ycchang' import sys import json import os import time import copy from httplib2 import Http class Utility: def __init__(self): pass @staticmethod def execute_until_timeout(function, timeout, *parameters): for counter in xrange(0, timeout+1): time.sleep(1) ...
{ "repo_name": "cloudawan/cloudawan_install", "path": "kubernetes1.2/roles/master/files/third_party_service_template/rabbitmq/template/cluster.py", "copies": "2", "size": "20350", "license": "apache-2.0", "hash": -1487233895492684800, "line_mean": 46.546728972, "line_max": 193, "alpha_frac": 0.6047665...
## https://github.com/annaeg/square-with-gravity import ugfx import pyb import buttons # IMU is the Inertial Measurement Unit combines accelerometer and gyroscope. # This uses the https://github.com/emfcamp/Mk3-Firmware/blob/master/lib/imu.py from imu import IMU SCREEN_WIDTH = 320 SCREEN_HEIGHT = 240 # More delay w...
{ "repo_name": "annaeg/square-with-gravity", "path": "square-with-gravity/main.py", "copies": "1", "size": "8705", "license": "mit", "hash": 8921495870153347000, "line_mean": 34.2429149798, "line_max": 137, "alpha_frac": 0.5684089604, "autogenerated": false, "ratio": 3.159709618874773, "config_t...
__author__ = 'Yeob' # Import flask dependencies from flask import Blueprint, request, render_template, \ flash, g, session, redirect, url_for # Import password / encryption helper tools from werkzeug import check_password_hash, generate_password_hash # Import the database object from the main app mo...
{ "repo_name": "ckc6842/my-hot-spot", "path": "LargeApp/app/mod_auth/controllers.py", "copies": "1", "size": "1247", "license": "mit", "hash": 1540079000400510700, "line_mean": 28.023255814, "line_max": 75, "alpha_frac": 0.6776263031, "autogenerated": false, "ratio": 3.7223880597014927, "config_...
__author__ = 'Yeob' # Import the database object (db) from the main application module # We will define this inside /app/__init__.py in the next sections. from app import db # Define a base model for other database tables to inherit class Base(db.Model): __abstract__ = True id = db.Column(db.Inte...
{ "repo_name": "ckc6842/my-hot-spot", "path": "LargeApp/app/mod_auth/models.py", "copies": "1", "size": "1358", "license": "mit", "hash": 7045509686354335000, "line_mean": 32.1463414634, "line_max": 80, "alpha_frac": 0.6134020619, "autogenerated": false, "ratio": 3.8579545454545454, "config_test...
__author__ = 'yeray' # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the relevant file with open(path.join(here, 'DESCRIPTION.rs...
{ "repo_name": "enanablancaynumeros/mullpy", "path": "setup.py", "copies": "1", "size": "3367", "license": "mit", "hash": 325473625047620860, "line_mean": 34.4526315789, "line_max": 79, "alpha_frac": 0.6560736561, "autogenerated": false, "ratio": 4.10609756097561, "config_test": false, "has_no...
__author__ = 'yetone' import inspect import argparse from script_manager.compat import text_type, getargspec from script_manager.compat.typing import Optional, Union, Tuple, List, _GenericAlias from script_manager.utils import parse_docstring ACTION = str ACTION_STORE = 'store' # type: ACTION ACTION_APPEND = 'appen...
{ "repo_name": "yetone/script-manager", "path": "script_manager/command.py", "copies": "1", "size": "3388", "license": "mit", "hash": 2989264838294768000, "line_mean": 28.982300885, "line_max": 89, "alpha_frac": 0.5661157025, "autogenerated": false, "ratio": 4.1066666666666665, "config_test": fa...
__author__ = 'yetone' import sys import argparse from script_manager.command import Command from script_manager.utils import parse_docstring class Manager(object): def __init__(self, description=None): self._command_map = {} self.docstring = parse_docstring(description) self.arg_parser = ...
{ "repo_name": "yetone/script-manager", "path": "script_manager/__init__.py", "copies": "1", "size": "1283", "license": "mit", "hash": -3662748962049385500, "line_mean": 26.2978723404, "line_max": 69, "alpha_frac": 0.5837879969, "autogenerated": false, "ratio": 4.073015873015873, "config_test": ...
__author__ = 'yezhihua' #!/usr/bin/env python # -*- coding: utf-8 -*- import os import MySQLdb import ConfigParser configfile = os.path.abspath(os.path.dirname(__name__)) + '/config.ini' ''' class Singleton: """ http://www.mindviewinc.com/Books/Python3Patterns/Index.php """ def __init__(self, klass): s...
{ "repo_name": "deevarvar/myLab", "path": "baidu_code/cinema_monitor/database.py", "copies": "1", "size": "1621", "license": "mit", "hash": 7000462819858988000, "line_mean": 26.0333333333, "line_max": 134, "alpha_frac": 0.5879086983, "autogenerated": false, "ratio": 3.7093821510297484, "config_t...
__author__ = 'yfrank' from pdb import InterfaceSelector from pdb import get_sequences from Bio.PDB import PDBParser from utils import ispdbid from utils import isecodid from utils import handleError from pdb import MotifSelector from pdb import ConnectorPDB from pdb import select_structure from pdb import is_single_d...
{ "repo_name": "yotamfr/prot2vec", "path": "src/python/models.py", "copies": "1", "size": "13080", "license": "mit", "hash": 5601298558125772000, "line_mean": 24.0574712644, "line_max": 120, "alpha_frac": 0.5395259939, "autogenerated": false, "ratio": 3.465818759936407, "config_test": false, "...
__author__ = 'yicong' import csv import bpy import bmesh D = bpy.data C = bpy.context O = bpy.ops def delete_all(): for obj in D.objects: obj.select = True if O.object.delete() == {'FINISHED'}: return 0 else: return -1 def set_unit_metric(): '''METRIC, DEGREE display as ...
{ "repo_name": "Yc-Chen/Blender_OpenCV", "path": "read_and_proctex.py", "copies": "1", "size": "2147", "license": "mit", "hash": 4644077808190999000, "line_mean": 26.5256410256, "line_max": 148, "alpha_frac": 0.6436888682, "autogenerated": false, "ratio": 2.9573002754820936, "config_test": false...
__author__ = 'yicong' import cv2 import numpy as np import csv import os import sys COIN_RADIUS = 0.02 imgfn = sys.argv[1] img = cv2.imread(imgfn, 0) # img = cv2.flip(img, 1) def bpfilter(img, lf, hf): imgblur1 = cv2.GaussianBlur(img, (lf, lf), -1) imgblur2 = cv2.GaussianBlur(img, (hf, hf), -1) imgdiff...
{ "repo_name": "Yc-Chen/Blender_OpenCV", "path": "imgproc.py", "copies": "1", "size": "1073", "license": "mit", "hash": -2843093078324439000, "line_mean": 28, "line_max": 106, "alpha_frac": 0.6458527493, "autogenerated": false, "ratio": 2.542654028436019, "config_test": false, "has_no_keywords...
__author__ = 'Yifan Peng' from distutils.core import setup setup( name = 'bllipbioc', version = '1.0.dev1', description = 'Parses the BioC file using bllip parser.', author = 'Yifan Peng', author_email = 'yifan.peng@nih.gov', keywords = ['bioc'], license = 'BSD 3-clause license', url = ...
{ "repo_name": "yfpeng/pengyifan-bllip", "path": "setup.py", "copies": "1", "size": "1358", "license": "bsd-3-clause", "hash": -673246009353260500, "line_mean": 36.75, "line_max": 79, "alpha_frac": 0.5861561119, "autogenerated": false, "ratio": 4.140243902439025, "config_test": false, "has_no_...
__author__ = 'Yifei' def z_array(s): """ Z-algorithm used in BM-Search :param s: the string from which to extract :return: a list of the length of prefix-substring """ assert len(s) > 1 n = len(s) z = [0] * n z[0] = n l, r = 0, 0 for i in range(1, n): if i > r: ...
{ "repo_name": "BHFaction/SanBot", "path": "src/pySanbot/util/boyer_moore_search.py", "copies": "1", "size": "6491", "license": "mit", "hash": -1796923376506159000, "line_mean": 28.371040724, "line_max": 84, "alpha_frac": 0.5216453551, "autogenerated": false, "ratio": 3.276627965673902, "config_...
__author__ = 'Yifu Huang' import sys sys.path.append("..") from azureStorage import * from azureCloudService import * from azureVirtualMachines import * from azure.servicemanagement import * class AzureImpl(): """ Azure cloud service management For logic: besides resources created by this program itself,...
{ "repo_name": "mshubian/BAK_open-hackathon", "path": "open-hackathon/src/hackathon/azureautodeploy/azureImpl.py", "copies": "1", "size": "17305", "license": "apache-2.0", "hash": 4423930129574189600, "line_mean": 54.1114649682, "line_max": 118, "alpha_frac": 0.5492632187, "autogenerated": false, ...
__author__ = 'Yifu Huang' import sys sys.path.append("..") from azureUtil import * from hackathon.database.models import * from hackathon.log import * class AzureStorage: """ Azure storage is used for azure virtual machines to store their disks Note that the number of azure storage account of user may hav...
{ "repo_name": "mshubian/BAK_open-hackathon", "path": "open-hackathon/src/hackathon/azureautodeploy/azureStorage.py", "copies": "1", "size": "4067", "license": "apache-2.0", "hash": 8691141884308024000, "line_mean": 46.8588235294, "line_max": 118, "alpha_frac": 0.5719203344, "autogenerated": false, ...
__author__ = 'Yifu Huang' import sys sys.path.append("..") from azureUtil import * from hackathon.log import * from hackathon.database.models import * class AzureCloudService: """ Azure cloud service is used as DNS for azure virtual machines Note that the public ports of virtual machines on the same clou...
{ "repo_name": "mshubian/BAK_open-hackathon", "path": "open-hackathon/src/hackathon/azureautodeploy/azureCloudService.py", "copies": "1", "size": "3544", "license": "apache-2.0", "hash": -3398081697934699500, "line_mean": 45.038961039, "line_max": 118, "alpha_frac": 0.6001693002, "autogenerated": fa...
__author__ = 'Yifu Huang' import sys sys.path.append("..") from azureImpl import * from hackathon.functions import * from hackathon.enum import * def set_expr_status(e_id, status): expr = db_adapter.get_object(Experiment, e_id) expr.status = status db_adapter.commit() if __name__ == "__main__": ar...
{ "repo_name": "mshubian/BAK_open-hackathon", "path": "open-hackathon/src/hackathon/azureautodeploy/azureCreateAsync.py", "copies": "1", "size": "1106", "license": "apache-2.0", "hash": 6518970970021836000, "line_mean": 28.1315789474, "line_max": 69, "alpha_frac": 0.6446654611, "autogenerated": fals...
# import libraries import numpy import matplotlib.pyplot from Bandit import Bandit def play_three_armed_bandit(mean_1, mean_2, mean_3, epsilon, number_of_play): bandits = [Bandit(mean_1), Bandit(mean_2), Bandit(mean_3)] data = numpy.empty(number_of_play) for play in range(number_of_play): # epsilon-greedy is a...
{ "repo_name": "GitYiheng/reinforcement_learning_test", "path": "test00_previous_files/three_armed_bandit.py", "copies": "1", "size": "4984", "license": "mit", "hash": 8232834269773194000, "line_mean": 41.9655172414, "line_max": 110, "alpha_frac": 0.7363563403, "autogenerated": false, "ratio": 3.1...
__author__ = 'yilinhe' from DBConnector import createSqlString, executeQueries def getMatch(match): ''' return a dictionary of match result: {matchId:match_id, winner:team100, team_100:{p1:champ1 ... p5:champ5}, team_200:{p1:champ1 ... p5:champ5} } ''' # Store the participants info relates to this...
{ "repo_name": "yilinhe/MOBA-TeamCompDecoding", "path": "lol-data-collection/MatchStore.py", "copies": "1", "size": "1624", "license": "mit", "hash": -4094455225543152000, "line_mean": 28, "line_max": 111, "alpha_frac": 0.6336206897, "autogenerated": false, "ratio": 3.4775160599571735, "config_t...
__author__ = 'yilinhe' import time from riotwatcher import RiotWatcher from MatchStore import storeMatchInfo, getMatch from PlayerInfoCollector import getPlayerIds, getPlayerMatchHistory, getPlayerFamilarity, loadPlayerIdsFromFile from DBConnector import getMatchFromDB f = open('configuration.txt') api_key = f.read()...
{ "repo_name": "yilinhe/MOBA-TeamCompDecoding", "path": "lol-data-collection/GameCollector.py", "copies": "1", "size": "2097", "license": "mit", "hash": -1698899774805248500, "line_mean": 35.1724137931, "line_max": 119, "alpha_frac": 0.606103958, "autogenerated": false, "ratio": 3.9491525423728815...
__author__ = "Yinchong Yang" __copyright__ = "Siemens AG, 2017" __licencse__ = "MIT" __version__ = "0.1" """ MIT License Copyright (c) 2017 Siemens AG Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Soft...
{ "repo_name": "Tuyki/TT_RNN", "path": "Datasets/Datasets.py", "copies": "1", "size": "5213", "license": "mit", "hash": 2629420330205101000, "line_mean": 34.462585034, "line_max": 103, "alpha_frac": 0.6268943027, "autogenerated": false, "ratio": 3.3872644574398962, "config_test": false, "has_n...
__author__ = 'yinjun' class Queue: # initialize your data structure here. def __init__(self): self.s1 = [] self.s2 = [] self.length = 0 # @param x, an integer # @return nothing def push(self, x): self.length +=1 self.s1.append(x) ...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/211-240/232-implement-queue-using-stacks/solution.py", "copies": "1", "size": "1045", "license": "apache-2.0", "hash": -4549283301385547000, "line_mean": 17.6785714286, "line_max": 42, "alpha_frac": 0.4708133971, "autogenerated": false, ...
__author__ = 'yinjun' class Solution: def jump(self, A): if A==None or A == []: return 0 n = len(A) steps = [0 for i in range(n)] start = 0 end = 0 jumps = 0 while end < n-1: jumps += 1 farthest = end for ...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/04/jump-game-ii.py", "copies": "1", "size": "1087", "license": "apache-2.0", "hash": 966219457367453400, "line_mean": 19.9038461538, "line_max": 62, "alpha_frac": 0.3909843606, "autogenerated": false, "ratio": 3.283987915407855, ...
__author__ = 'yinjun' class Solution: """ Get all distinct N-Queen solutions @param n: The number of queens @return: All distinct solutions """ def solveNQueens(self, n): # write your code here self.results=[] self.solve(n, []) return self.results def solve(...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/07/n-queens.py", "copies": "1", "size": "1627", "license": "apache-2.0", "hash": 724484755947615900, "line_mean": 23.6515151515, "line_max": 61, "alpha_frac": 0.3859864782, "autogenerated": false, "ratio": 4.494475138121547, "co...
__author__ = 'yinjun' class Solution: """ Get all distinct N-Queen solutions @param n: The number of queens @return: All distinct solutions """ def totalNQueens(self, n): # write your code here self.results=0 self.solve(n, []) return self.results def solve(s...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/031-060/051-n-queens-ii/solution.py", "copies": "1", "size": "1255", "license": "apache-2.0", "hash": -5692043262232838000, "line_mean": 24.612244898, "line_max": 61, "alpha_frac": 0.3832669323, "autogenerated": false, "ratio": 4.648148...
__author__ = 'yinjun' class Solution: # @return a string def minWindow(self, S, T): #print S, T lS = len(S) lT = len(T) if lT > lS: return "" c = self.countTZan(T) self.szan = {} end = c if end > lS: end = lS s...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/061-090/076-minimum-window-substring/solution.py", "copies": "1", "size": "1949", "license": "apache-2.0", "hash": -3513234084328816600, "line_mean": 19.7446808511, "line_max": 55, "alpha_frac": 0.361723961, "autogenerated": false, "rat...
__author__ = 'yinjun' class Solution: """ @param A : a list of integers @param target : an integer to be searched @return : a list of length 2, [index1, index2] """ def searchRange(self, A, target): # write your code here length = len(A) start = 0 end = length -...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/031-060/032-search-for-a-range/range.py", "copies": "1", "size": "1339", "license": "apache-2.0", "hash": -1782259824901111300, "line_mean": 22.1034482759, "line_max": 51, "alpha_frac": 0.4398805078, "autogenerated": false, "ratio": 3.7...
__author__ = 'yinjun' class Solution: """ @param A : a list of integers @param target : an integer to be searched @return : an integer """ def search(self, A, target): # write your code here length = len(A) if length == 0: return -1 start = 0 ...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/02/search-in-rotated-sorted-array.py", "copies": "1", "size": "1032", "license": "apache-2.0", "hash": -3805745715569354000, "line_mean": 21.9555555556, "line_max": 58, "alpha_frac": 0.4118217054, "autogenerated": false, "ratio": ...
__author__ = 'yinjun' class Solution: """ @param A: An integer array. @param B: An integer array. @return: a double whose format is *.5 or *.0 """ def findMedianSortedArrays(self, A, B): # write your code here lenA = len(A) lenB = len(B) l = lenA + lenB ...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/001-030/002-median-of-two-sorted-arrays/median.py", "copies": "1", "size": "1573", "license": "apache-2.0", "hash": 4630040704985550000, "line_mean": 26.6140350877, "line_max": 112, "alpha_frac": 0.5219326128, "autogenerated": false, "r...
__author__ = 'yinjun' class Solution: """ @param A: An integer array. @param k: A positive integer (k <= length(A)) @param target: Integer @return a list of lists of integer """ def kSumII(self, A, k, target): # write your code here A.sort() self.results=[] ...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/07/k-sum-ii.py", "copies": "1", "size": "1227", "license": "apache-2.0", "hash": -5099827566841763000, "line_mean": 24.0408163265, "line_max": 60, "alpha_frac": 0.3903830481, "autogenerated": false, "ratio": 3.996742671009772, "...
__author__ = 'yinjun' class Solution: # @param A a list of integers # @return nothing, sort in place def sortColors(self, A): # p0 = 0 # p1 = self.count(A, 0) # p2 = p1 + self.count(A, 1) p0 = self.count(A, 0) p = [0, p0, p0 + self.count(A, 1)] l = len(A) ...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/061-090/075-sort-colors/solution.py", "copies": "1", "size": "1164", "license": "apache-2.0", "hash": 644234732746157700, "line_mean": 21.4038461538, "line_max": 61, "alpha_frac": 0.3694158076, "autogenerated": false, "ratio": 3.3837209...
__author__ = 'yinjun' class Solution: # @param num, a list of integer # @return a list of integer def nextPermutation(self, target): self.target = target self.find = False self.result = [] length = len(target) if length <= 1: return target else:...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/031-060/031-next-permutation/nextpermutation.py", "copies": "1", "size": "1153", "license": "apache-2.0", "hash": -8597167078437154000, "line_mean": 21.1730769231, "line_max": 51, "alpha_frac": 0.4761491761, "autogenerated": false, "rat...
__author__ = 'yinjun' class Solution: # @param s, a string # @return a list of lists of string def partition(self, s): # write your code here n = len(s) if n == 0: return [] if n == 1: return [[n]] self.partition_init(s) self.parti...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/07/palindrome-partitioning.py", "copies": "1", "size": "1475", "license": "apache-2.0", "hash": 8814302771913705000, "line_mean": 21.3636363636, "line_max": 101, "alpha_frac": 0.4522033898, "autogenerated": false, "ratio": 3.29241...
__author__ = 'yinjun' class Solution: # @param s, a string # @return an integer def minCut(self, s): # write your code here if s == None or s =="": return 0 l = len(s) r = self.getAllPalindrome(s, l) f = [0 for i in range(l+1)] for i in range(l...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/04/palindrome-partitioning-ii.py", "copies": "2", "size": "1027", "license": "apache-2.0", "hash": 8248344565909904000, "line_mean": 20.3958333333, "line_max": 91, "alpha_frac": 0.4420642648, "autogenerated": false, "ratio": 3.112...
__author__ = 'yinjun' class Solution: # @param start, a string # @param end, a string # @param dict, a set of string # @return an integer def ladderLength(self, start, end, dict): # write your code here ###fuck fuck fuck if start == "nanny" and end =="aloud": ret...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/07/word-ladder.py", "copies": "1", "size": "3297", "license": "apache-2.0", "hash": -7426805351432559000, "line_mean": 23.7969924812, "line_max": 85, "alpha_frac": 0.4027904155, "autogenerated": false, "ratio": 4.07540173053152, ...
__author__ = 'yinjun' class VersionControl: @classmethod def isBadVersion(cls, id): return False #class VersionControl: # @classmethod # def isBadVersion(cls, id) # # Run unit tests to check whether verison `id` is a bad version # # return true if unit tests passed else false. # Yo...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/02/first-bad-version.py", "copies": "1", "size": "1130", "license": "apache-2.0", "hash": -424004776145602560, "line_mean": 24.1333333333, "line_max": 78, "alpha_frac": 0.5407079646, "autogenerated": false, "ratio": 4.312977099236...
__author__ = 'yinjun' # Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class BSTIterator: # @param root, a binary search tree's root node def __init__(self, root): stack = [] dict ...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/151-180/173-binary-search-tree-iterator/solution.py", "copies": "1", "size": "1980", "license": "apache-2.0", "hash": 1129313986016841300, "line_mean": 26.9014084507, "line_max": 65, "alpha_frac": 0.4777777778, "autogenerated": false, "...
__author__ = 'yinjun' # Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @return a tree node def recoverTree(self, root): d = self.depth(root)...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/091-120/099-recover-binary-search-tree/solution.py", "copies": "1", "size": "3399", "license": "apache-2.0", "hash": -3392071288945607700, "line_mean": 25.3488372093, "line_max": 146, "alpha_frac": 0.4919093851, "autogenerated": false, ...
__author__ = 'yinjun' # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: # @param {TreeNode} root # @return {integer[]} def postorderTraversal(self, root): stack = [] dict ...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/03/binary-tree-postorder-travesal.py", "copies": "1", "size": "1383", "license": "apache-2.0", "hash": -4541358986846288000, "line_mean": 23.7142857143, "line_max": 87, "alpha_frac": 0.4844540853, "autogenerated": false, "ratio": ...
__author__ = 'yinjun' # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param {TreeNode} root # @return {integer[]} def postorderTraversal(self, root): stack = [] ...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/121-150/145-binary-tree-postorder-traversal/solution.py", "copies": "1", "size": "1410", "license": "apache-2.0", "hash": -337247661422070400, "line_mean": 23.7543859649, "line_max": 87, "alpha_frac": 0.475177305, "autogenerated": false, ...
__author__ = 'yinjun' # Definition for a Directed graph node # class DirectedGraphNode: # def __init__(self, x): # self.label = x # self.neighbors = [] class Solution: """ @param graph: A list of Directed graph node @return: A list of integer """ def topSort(self, graph): ...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/07/topological-sorting.py", "copies": "1", "size": "1918", "license": "apache-2.0", "hash": 6497023798589986000, "line_mean": 18.9791666667, "line_max": 47, "alpha_frac": 0.4947862357, "autogenerated": false, "ratio": 3.5716945996...
__author__ = 'yinjun' # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a ListNode # @param m, an integer # @param n, an integer # @return a ListNode def reverseBetween(self, head, m,...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/091-120/095-reverse-linked-list-ii/solution.py", "copies": "1", "size": "2026", "license": "apache-2.0", "hash": -7601219732802764000, "line_mean": 17.9439252336, "line_max": 55, "alpha_frac": 0.4407699901, "autogenerated": false, "rati...
__author__ = 'yinjun' # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None ...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/06/convert-sorted-list-to-binary-search-tree.py", "copies": "1", "size": "1085", "license": "apache-2.0", "hash": -877573501074643700, "line_mean": 23.6590909091, "line_max": 60, "alpha_frac": 0.5142857143, "autogenerated": false, ...
__author__ = 'yinjun' import os import imp import time class SimpleLeetLoader: def loadDirs(self): os.chdir(os.path.dirname(os.path.abspath(__file__))) #print os.path.dirname(os.path.abspath(__file__)) #print os.getcwd() dirs = os.listdir(os.getcwd()) code = {} fo...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/run.py", "copies": "1", "size": "2419", "license": "apache-2.0", "hash": 1372786291216010000, "line_mean": 26.5, "line_max": 76, "alpha_frac": 0.4105002067, "autogenerated": false, "ratio": 4.28141592920354, "config_test": false, "h...
__author__ = 'yinjun' import unittest import os import imp class TestSolutionFuncs(unittest.TestCase): def setUp(self): path = os.getcwd() + '/solution.py' so = imp.load_source('solution', path) self.s = so.Solution() # common = os.path.dirname(os.path.dirname(os.getcwd())) + '/c...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/151-180/168-excel-sheet-column-title/test.py", "copies": "1", "size": "1174", "license": "apache-2.0", "hash": 1790970824549588200, "line_mean": 25.0888888889, "line_max": 88, "alpha_frac": 0.6192504259, "autogenerated": false, "ratio":...
__author__ = 'yinjun' class Solution: """ @param A: An integer array. @param k: a positive integer (k <= length(A)) @param target: integer @return an integer """ def kSum(self, A, k, target): # write your code here self.result = [] cur = [] A.sort() ...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/05/ksum.py", "copies": "1", "size": "2866", "license": "apache-2.0", "hash": 475462229075276600, "line_mean": 27.9595959596, "line_max": 121, "alpha_frac": 0.394277739, "autogenerated": false, "ratio": 3.105092091007584, "config...
__author__ = 'yinjun' class Solution: """ @param nums: The rotated sorted array @return: nothing """ def recoverRotatedSortedArray(self, nums): # write your code here length = len(nums) minPos = self.findMin(nums, length) #print minPos, nums[minPos] if minP...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/02/recover-rotated-sorted-array.py", "copies": "1", "size": "1624", "license": "apache-2.0", "hash": -8611206806480620000, "line_mean": 22.2, "line_max": 71, "alpha_frac": 0.4642857143, "autogenerated": false, "ratio": 3.390396659...
__author__ = 'yinjun' """ Definition of ListNode class ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next """ class Solution: """ @param head: The first node of linked list. @param x: an integer @return: a ListNode """ def partition(self, ...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/06/partition-list.py", "copies": "1", "size": "1317", "license": "apache-2.0", "hash": 1861621437646046200, "line_mean": 20.5901639344, "line_max": 56, "alpha_frac": 0.4039483675, "autogenerated": false, "ratio": 3.658333333333333...
__author__ = 'yinjun' """ Definition of TreeNode: class TreeNode: def __init__(self, val): this.val = val this.left, this.right = None, None """ class Solution: """ @param root: The root of the binary search tree. @param value: Remove the node with given value. @return: The root of ...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/03/remove-node-in-binary-search-tree.py", "copies": "1", "size": "2034", "license": "apache-2.0", "hash": 3311081851591152600, "line_mean": 21.3516483516, "line_max": 62, "alpha_frac": 0.5073746313, "autogenerated": false, "ratio"...
__author__ = 'yinjun' """ Definition of TreeNode: class TreeNode: def __init__(self, val): this.val = val this.left, this.right = None, None Example of iterate a tree: iterator = Solution(root) while iterator.hasNext(): node = iterator.next() do something for node """ class Solution: #...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/03/binary-search-tree-iterator.py", "copies": "1", "size": "2031", "license": "apache-2.0", "hash": -4089421949239902000, "line_mean": 25.0384615385, "line_max": 70, "alpha_frac": 0.5022156573, "autogenerated": false, "ratio": 3.9...
__author__ = 'yinjun' """ Definition of TreeNode: class TreeNode: def __init__(self, val): this.val = val this.left, this.right = None, None """ class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: """ @param ro...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/03/binary-tree-inorder-travesal.py", "copies": "1", "size": "1825", "license": "apache-2.0", "hash": -3312740210622172700, "line_mean": 23.3466666667, "line_max": 65, "alpha_frac": 0.4717808219, "autogenerated": false, "ratio": 3....
__author__ = 'yinjun' """ Definition of TreeNode: class TreeNode: def __init__(self, val): this.val = val this.left, this.right = None, None """ # example # int pre[] = {7, 10, 4, 3, 1, 2, 8, 11}; # int in[] = {4, 10, 3, 1, 7, 11, 8, 2}; class Solution: """ @param preorder : A list of int...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/03/construct-binary-tree-from-preorder-and-inorder-traversal.py", "copies": "1", "size": "1086", "license": "apache-2.0", "hash": 2766350670019911000, "line_mean": 24.2790697674, "line_max": 74, "alpha_frac": 0.5515653775, "autogene...
__author__ = 'yinjun' """ Definition of TreeNode: class TreeNode: def __init__(self, val): this.val = val this.left, this.right = None, None """ class Solution: """ @param preorder : A list of integers that preorder traversal of a tree @param inorder : A list of integers that inorder ...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/091-120/solution.py", "copies": "1", "size": "1441", "license": "apache-2.0", "hash": -4616760258602606000, "line_mean": 28.4285714286, "line_max": 106, "alpha_frac": 0.5954198473, "autogenerated": false, "ratio": 3.4806763285024154, ...
__author__ = 'yinjun' ''' ''' class ListNode: def __init__(self, x): self.val = x self.next = None def toList(self): v = [self.val] c = self.next while c!=None: v.append(c.val) c = c.next def __str__(self): self.toLit() retu...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/common/listnode.py", "copies": "1", "size": "1124", "license": "apache-2.0", "hash": -3747055708155854300, "line_mean": 17.4426229508, "line_max": 44, "alpha_frac": 0.4190391459, "autogenerated": false, "ratio": 3.73421926910299, "con...
__author__ = 'yinjun' """ Definition of TreeNode: class TreeNode: def __init__(self, val): this.val = val this.left, this.right = None, None """ class Solution: """ @param root: The root of binary tree. @return: True if the binary tree is BST, or false """ def isValidBST(self...
{ "repo_name": "shootsoft/practice", "path": "LeetCode/python/091-120/098-validate-binary-search-tree/solution.py", "copies": "2", "size": "1620", "license": "apache-2.0", "hash": 4669972247571896000, "line_mean": 32.0612244898, "line_max": 111, "alpha_frac": 0.5833333333, "autogenerated": false, ...
__author__ = 'yinjun' """ Definition of TreeNode: class TreeNode: def __init__(self, val): this.val = val this.left, this.right = None, None """ class Solution: """ @param root: The root of binary tree. @return: A list of list of integer include the zig zag level order t...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/03/binary-tree-zigzag-level-order-traversal.py", "copies": "2", "size": "1120", "license": "apache-2.0", "hash": 4120611876891264000, "line_mean": 18.6666666667, "line_max": 67, "alpha_frac": 0.4276785714, "autogenerated": false, ...
__author__ = 'yinjun' ''' Point object ''' class Point: ### # Init object ### def __init__(self, x, y): self.x = x self.y = y self.distance = None ''' Obtain approximate distance ''' def getDistance(self): if self.distance == None: self.dis...
{ "repo_name": "shootsoft/practice", "path": "companyA/KPoint.py", "copies": "1", "size": "5236", "license": "apache-2.0", "hash": -1916101715160356900, "line_mean": 23.4719626168, "line_max": 142, "alpha_frac": 0.4745989305, "autogenerated": false, "ratio": 4.132596685082873, "config_test": fal...
__author__ = 'yinjun' """ @see http://blog.csdn.net/u011095253/article/details/9248073 @see http://www.jiuzhang.com/solutions/interleaving-string/ """ class Solution: """ @params s1, s2, s3: Three strings as description. @return: return True if s3 is formed by the interleaving of s1 and s2 or ...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/05/interleaving-string.py", "copies": "1", "size": "1179", "license": "apache-2.0", "hash": -6591409453400733000, "line_mean": 27.0952380952, "line_max": 80, "alpha_frac": 0.4826123834, "autogenerated": false, "ratio": 2.691780821...
__author__ = 'yinjun' ''' @see http://www.cnblogs.com/lishiblog/p/4183806.html @see http://www.jiuzhang.com/solutions/backpack/ ''' class Solution: # @param m: An integer m denotes the size of a backpack # @param A: Given n items with size A[i] # @return: The maximum size def backPack(self, m, A): ...
{ "repo_name": "shootsoft/practice", "path": "lintcode/NineChapters/05/backpack.py", "copies": "1", "size": "1217", "license": "apache-2.0", "hash": -6847385652687949000, "line_mean": 37.03125, "line_max": 459, "alpha_frac": 0.580115037, "autogenerated": false, "ratio": 2.448692152917505, "confi...
__author__ = 'Yin' from carbon import getModeCarbonFootprint, carbonFootprintForMode from common import Inside_polygon,berkeley_area,getConfirmationModeQuery from get_database import get_section_db,get_profile_db # Note that all the points here are returned in (lng, lat) format, which is the # GeoJSON format. def car...
{ "repo_name": "sdsingh/e-mission-server", "path": "CFC_WebApp/main/visualize.py", "copies": "1", "size": "2459", "license": "bsd-3-clause", "hash": 5952661239416880000, "line_mean": 40.6779661017, "line_max": 134, "alpha_frac": 0.6059373729, "autogenerated": false, "ratio": 3.512857142857143, "...
__author__ = 'Yin' from pymongo import MongoClient from common import Is_date, Is_place, get_mode_share_by_distance, berkeley_area from tripManager import travel_time from get_database import get_section_db,get_profile_db # from commute import get_morning_commute_sections from dateutil import parser def get_Alluser_mo...
{ "repo_name": "sdsingh/e-mission-server", "path": "CFC_WebApp/main/modeshare.py", "copies": "1", "size": "1225", "license": "bsd-3-clause", "hash": -4568252594557710300, "line_mean": 46.1153846154, "line_max": 144, "alpha_frac": 0.6220408163, "autogenerated": false, "ratio": 3.0472636815920398, ...
__author__ = 'Yin' from pymongo import MongoClient from home import detect_home, detect_home_from_db from home_2 import detect_home_2, detect_home_from_db_2 from tripManager import calDistance from common import Is_weekday, get_static_pnts, most_common_2, calculate_appearance_rate, Is_date, Is_place_2 from dateutil imp...
{ "repo_name": "sdsingh/e-mission-server", "path": "CFC_WebApp/main/work_place_2.py", "copies": "1", "size": "2877", "license": "bsd-3-clause", "hash": 5704842702332006000, "line_mean": 38.4109589041, "line_max": 109, "alpha_frac": 0.5780326729, "autogenerated": false, "ratio": 3.3375870069605567,...
__author__ = 'Yin' from pymongo import MongoClient from home import detect_home,detect_home_from_db from tripManager import calDistance from common import Is_weekday, get_static_pnts, most_common, calculate_appearance_rate, Is_date,Is_place from dateutil import parser from get_database import get_section_db, get_profil...
{ "repo_name": "sdsingh/e-mission-server", "path": "CFC_WebApp/main/work_place.py", "copies": "1", "size": "4320", "license": "bsd-3-clause", "hash": 393963934305706300, "line_mean": 46.4725274725, "line_max": 111, "alpha_frac": 0.6564814815, "autogenerated": false, "ratio": 3.4698795180722892, ...
__author__ = 'Yin' from pymongo import MongoClient from home import detect_home from work_place import detect_daily_work_office from get_database import get_section_db from common import Is_date, Is_place from tripManager import travel_time from dateutil import parser from common import parse_time ####################...
{ "repo_name": "sdsingh/e-mission-server", "path": "CFC_WebApp/main/commute.py", "copies": "1", "size": "4992", "license": "bsd-3-clause", "hash": 5799135587416603000, "line_mean": 47.9411764706, "line_max": 173, "alpha_frac": 0.5328525641, "autogenerated": false, "ratio": 3.9745222929936306, "c...
__author__ = 'Yin' from pymongo import MongoClient from work_place import detect_daily_work_office from common import Is_date, get_first_daily_point, Is_place, get_last_daily_point, parse_time from get_database import get_section_db, get_profile_db,get_worktime_db from dateutil import parser from pytz import timezone ...
{ "repo_name": "sdsingh/e-mission-server", "path": "CFC_WebApp/main/work_time.py", "copies": "1", "size": "4189", "license": "bsd-3-clause", "hash": -7532045805935860000, "line_mean": 38.1495327103, "line_max": 130, "alpha_frac": 0.5867748866, "autogenerated": false, "ratio": 3.1144981412639403, ...
__author__ = 'Yin' import logging from home import detect_home from zipcode import get_userZipcode from work_place import detect_work_office, detect_daily_work_office from get_database import get_section_db,get_profile_db from pygeocoder import Geocoder logging.basicConfig(format='%(asctime)s:%(levelname)s:%(message)s'...
{ "repo_name": "sdsingh/e-mission-server", "path": "CFC_WebApp/main/Profile.py", "copies": "1", "size": "1830", "license": "bsd-3-clause", "hash": -973345043615560000, "line_mean": 43.6341463415, "line_max": 106, "alpha_frac": 0.618579235, "autogenerated": false, "ratio": 3.2795698924731185, "co...
__author__ = 'Yin' # Standard imports from dateutil import parser # Our imports from emission.core.common import Is_date, Is_place, get_mode_share_by_distance, berkeley_area, travel_time from emission.core.get_database import get_section_db,get_profile_db def get_Alluser_mode_share_by_distance(flag,start,end): # ...
{ "repo_name": "yw374cornell/e-mission-server", "path": "emission/net/api/modeshare.py", "copies": "2", "size": "1181", "license": "bsd-3-clause", "hash": -5558111820309041000, "line_mean": 44.4230769231, "line_max": 144, "alpha_frac": 0.6096528366, "autogenerated": false, "ratio": 2.9823232323232...