text
stringlengths
0
1.05M
meta
dict
$NetBSD$ --- site_scons/mongo/platform.py.orig 2018-01-04 23:28:55.000000000 +0000 +++ site_scons/mongo/platform.py @@ -20,8 +20,12 @@ def get_running_os_name(): running_os = os.sys.platform if running_os.startswith('linux'): running_os = 'linux' + elif running_os.startswith('dragonfly'): + ...
{ "repo_name": "nanobox-io/nanobox-pkgsrc-base", "path": "mongodb36-server/patches/patch-site__scons_mongo_platform.py", "copies": "2", "size": "1038", "license": "mit", "hash": -5301291490084620000, "line_mean": 38.9230769231, "line_max": 105, "alpha_frac": 0.6011560694, "autogenerated": false, "...
$NetBSD$ --- tools/install.py.orig 2016-08-26 15:27:23.000000000 +0000 +++ tools/install.py @@ -98,6 +98,37 @@ def npm_files(action): else: assert(0) # unhandled action type +def yarn_files(action): + target_path = 'lib/node_modules/yarn/' + + # don't install npm if the target path is a symlink, it probabl...
{ "repo_name": "nanobox-io/nanobox-pkgsrc-base", "path": "nodejs8/patches/patch-tools_install.py", "copies": "14", "size": "1899", "license": "mit", "hash": -8950076555666715000, "line_mean": 34.1666666667, "line_max": 78, "alpha_frac": 0.6477093207, "autogenerated": false, "ratio": 2.894817073170...
$NetBSD: patch-tools_gyp_pylib_gyp_generator_make.py,v 1.3 2013/12/12 11:52:37 jperkin Exp $ Add support for NetBSD and DragonFly. Ensure we use the system libtool on OSX. --- tools/gyp/pylib/gyp/generator/make.py.orig 2013-12-12 05:20:06.000000000 +0000 +++ tools/gyp/pylib/gyp/generator/make.py @@ -174,7 +174,7 @@ c...
{ "repo_name": "nanobox-io/nanobox-pkgsrc-base", "path": "nodejs7/patches/patch-tools_gyp_pylib_gyp_generator_make.py", "copies": "16", "size": "1181", "license": "mit", "hash": 3609048375879621000, "line_mean": 46.24, "line_max": 122, "alpha_frac": 0.6375952583, "autogenerated": false, "ratio": 2...
# $OpenBSD: blowfish.cL,v 1.18 2004/11/02 17:23:26 hshoexer Exp $ #/ # # Blowfish block cipher for OpenBSD # Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> # All rights reserved. # # Implementation advice by David Mazieres <dm@lcs.mit.edu>. # # Redistribution and use in source and binary forms, with or w...
{ "repo_name": "haldun/tornado-gae-auth", "path": "auth/blowfish.py", "copies": "3", "size": "22944", "license": "mit", "hash": -5005261537123454000, "line_mean": 53.3696682464, "line_max": 123, "alpha_frac": 0.6522402371, "autogenerated": false, "ratio": 1.9854620976116304, "config_test": false...
# $ProjectHeader: sexprmodule 0.2.1 Wed, 05 Apr 2000 23:33:53 -0600 nas $ # originally from: http://arctrix.com/nas/python/ # modified to understand \-escaped quotes instead of "" escaping - pj 20060809 # IPC: taken from http://code.google.com/p/mhi/source/browse/sexpr.py 11 Jul 2011 import string import StringIO fr...
{ "repo_name": "michaelpnash/sublime-ensime", "path": "sexpr_parser.py", "copies": "3", "size": "3915", "license": "mit", "hash": -8373413557972216000, "line_mean": 25.4527027027, "line_max": 82, "alpha_frac": 0.5095785441, "autogenerated": false, "ratio": 3.3808290155440415, "config_test": fals...
#!$PYTHON$ # -*- coding: utf-8 -*- from django import template from django.conf import settings from django.conf.urls.defaults import patterns, url from django.core.management import call_command from django.core.urlresolvers import reverse from django.http import HttpResponse import os import socket THISDIR = os.path...
{ "repo_name": "ojii/django-template-server", "path": "templateserver/runserver_template.py", "copies": "1", "size": "3442", "license": "bsd-3-clause", "hash": 5663601619457517000, "line_mean": 31.4811320755, "line_max": 105, "alpha_frac": 0.4962231261, "autogenerated": false, "ratio": 4.249382716...
# $ python py/tipsy.py filename [pmax] import sys import numpy as np import matplotlib matplotlib.use("agg") import matplotlib.pyplot as plt # import re import struct def read_position_tipsy(filename): # open the file fin = open(filename, "rb") size = len(fin.read()) fin.seek(0) # read header (28...
{ "repo_name": "FDPS/FDPS", "path": "sample/c++/nbody+sph/magi_data/py/tipsy.py", "copies": "3", "size": "6144", "license": "mit", "hash": 4768125086444360000, "line_mean": 26.4285714286, "line_max": 135, "alpha_frac": 0.5180664062, "autogenerated": false, "ratio": 3.0858864892014064, "config_te...
"""$ rio blocks""" import json import logging import os.path import click import cligj import rasterio from rasterio.rio import options from rasterio.rio.helpers import write_features from rasterio.warp import transform_bounds logger = logging.getLogger('rio') class _Collection(object): """For use with `ra...
{ "repo_name": "brendan-ward/rasterio", "path": "rasterio/rio/blocks.py", "copies": "1", "size": "4897", "license": "bsd-3-clause", "hash": 5315154993108301000, "line_mean": 29.2283950617, "line_max": 79, "alpha_frac": 0.5964876455, "autogenerated": false, "ratio": 4.19263698630137, "config_test...
"""$ rio calc""" from collections import OrderedDict from distutils.version import LooseVersion import click from cligj import files_inout_arg import snuggs import rasterio from rasterio.features import sieve from rasterio.fill import fillnodata from rasterio.rio import options from rasterio.rio.helpers import resol...
{ "repo_name": "brendan-ward/rasterio", "path": "rasterio/rio/calc.py", "copies": "1", "size": "5193", "license": "bsd-3-clause", "hash": -2495797137673804300, "line_mean": 34.5684931507, "line_max": 79, "alpha_frac": 0.5780858848, "autogenerated": false, "ratio": 3.7685050798258346, "config_tes...
"""$ rio merge""" import click from cligj import files_inout_arg, format_opt import rasterio from rasterio.rio import options from rasterio.rio.helpers import resolve_inout @click.command(short_help="Merge a stack of raster datasets.") @files_inout_arg @options.output_opt @format_opt @options.bounds_opt @options.r...
{ "repo_name": "brendan-ward/rasterio", "path": "rasterio/rio/merge.py", "copies": "1", "size": "2349", "license": "bsd-3-clause", "hash": 6580345550971606000, "line_mean": 31.625, "line_max": 79, "alpha_frac": 0.6479352916, "autogenerated": false, "ratio": 3.915, "config_test": false, "has_no...
"""$ rio rasterize""" import json import logging from math import ceil import os from affine import Affine import click import cligj import rasterio from rasterio.errors import CRSError from rasterio.coords import disjoint_bounds from rasterio.rio import options from rasterio.rio.helpers import resolve_inout logg...
{ "repo_name": "brendan-ward/rasterio", "path": "rasterio/rio/rasterize.py", "copies": "1", "size": "9807", "license": "bsd-3-clause", "hash": 1465439146416905500, "line_mean": 35.7303370787, "line_max": 91, "alpha_frac": 0.539614561, "autogenerated": false, "ratio": 4.455701953657428, "config_t...
"""$ rio shapes""" from __future__ import division import logging import math import os import click import cligj from rasterio.rio import options from rasterio.rio.helpers import coords, write_features from rasterio.transform import Affine from rasterio.crs import CRS logger = logging.getLogger('rio') # Commo...
{ "repo_name": "brendan-ward/rasterio", "path": "rasterio/rio/shapes.py", "copies": "1", "size": "9016", "license": "bsd-3-clause", "hash": -4466985981897910300, "line_mean": 36.1028806584, "line_max": 77, "alpha_frac": 0.5341614907, "autogenerated": false, "ratio": 4.232863849765258, "config_te...
"""$ rio stack""" import collections import logging import click from cligj import files_inout_arg, format_opt import rasterio from rasterio.compat import zip_longest from rasterio.rio import options from rasterio.rio.helpers import resolve_inout @click.command(short_help="Stack a number of bands into a multiband...
{ "repo_name": "brendan-ward/rasterio", "path": "rasterio/rio/stack.py", "copies": "1", "size": "3992", "license": "bsd-3-clause", "hash": -7245156463935429000, "line_mean": 34.0175438596, "line_max": 81, "alpha_frac": 0.5415831663, "autogenerated": false, "ratio": 4.180104712041885, "config_tes...
"""$ rio warp""" import logging from math import ceil, floor, log import warnings import click from cligj import files_inout_arg, format_opt import rasterio from rasterio.crs import CRS from rasterio.env import setenv from rasterio.errors import CRSError from rasterio.rio import options from rasterio.rio.helpers imp...
{ "repo_name": "brendan-ward/rasterio", "path": "rasterio/rio/warp.py", "copies": "1", "size": "13664", "license": "bsd-3-clause", "hash": 2402650466734781400, "line_mean": 39.5459940653, "line_max": 87, "alpha_frac": 0.5270052693, "autogenerated": false, "ratio": 4.2982069833280905, "config_tes...
# $Source: /home/CVSROOT/c2ada/AdaMain.py,v $ # $Revision: 1.1.1.1 $ $Date: 1999/02/02 12:01:51 $ # Write an Ada main procedure to wrap a C main(). import sys # text: the (generic) text of the Ada main procedure. # # --------------------------------- text = ''' with %(cmain)s; with Ada.Command_Line; with %(predef...
{ "repo_name": "mikequentel/c2ada", "path": "AdaMain.py", "copies": "1", "size": "2144", "license": "mit", "hash": 3459783803995921000, "line_mean": 23.0898876404, "line_max": 76, "alpha_frac": 0.6049440299, "autogenerated": false, "ratio": 3.1027496382054993, "config_test": false, "has_no_key...
# $Source: /home/CVSROOT/c2ada/C2ada.py,v $ # $Revision: 1.1.1.1 $ $Date: 1999/02/02 12:01:51 $ # Provide the framework for reading in a configuration script. # The configuration script contains the declaration of project-specific # information about c2ada's task. It initializes various attributes # of a single glo...
{ "repo_name": "mikequentel/c2ada", "path": "C2ada.py", "copies": "1", "size": "5918", "license": "mit", "hash": 7779880823728118000, "line_mean": 25.5381165919, "line_max": 74, "alpha_frac": 0.6336600203, "autogenerated": false, "ratio": 3.4307246376811595, "config_test": true, "has_no_keywor...
### $SPARK_HOME/bin/spark-submit movielens_analysis.py ### Data visualization of movielens dataset. from pyspark import SparkContext import matplotlib.pyplot as plt import numpy as np sc = SparkContext("local", "Movielens Analysis") sc.setLogLevel("ERROR") PATH = "/Users/c/xueshu/bigdata/machineLearningWithSpark" #...
{ "repo_name": "luseiee/machineLearningWithSpark", "path": "chapter03/movielens_analysis.py", "copies": "1", "size": "3783", "license": "mit", "hash": -4654984164280979000, "line_mean": 35.3846153846, "line_max": 78, "alpha_frac": 0.7031456516, "autogenerated": false, "ratio": 2.91, "config_test...
### $SPARK_HOME/bin/spark-submit movielens_feature.py ### Feature extraction of movielens dataset. from pyspark import SparkContext import matplotlib.pyplot as plt import numpy as np from datetime import datetime import re from scipy import sparse as sp from pyspark.mllib.feature import Normalizer sc = SparkContext("...
{ "repo_name": "luseiee/machineLearningWithSpark", "path": "chapter03/movielens_feature.py", "copies": "1", "size": "3692", "license": "mit", "hash": -2934139508151443500, "line_mean": 33.5046728972, "line_max": 72, "alpha_frac": 0.6971830986, "autogenerated": false, "ratio": 3.036184210526316, ...
"""$<ticker symbol> for a quote on a stock price""" from __future__ import print_function import logging import re from urllib import quote from bs4 import BeautifulSoup import requests logger = logging.getLogger(__name__) def stockprice(ticker): url = "https://www.google.com/finance?q={0}" soup = BeautifulS...
{ "repo_name": "shawnsi/limbo", "path": "limbo/plugins/stock.py", "copies": "2", "size": "1195", "license": "mit", "hash": 4095378867482222600, "line_mean": 31.2972972973, "line_max": 102, "alpha_frac": 0.6334728033, "autogenerated": false, "ratio": 3.2037533512064345, "config_test": false, "h...
"""$<ticker symbol> for a quote on a stock price""" from __future__ import print_function import logging import re try: from urllib import quote except ImportError: from urllib.request import quote from bs4 import BeautifulSoup import requests logger = logging.getLogger(__name__) def stockprice(ticker): ...
{ "repo_name": "uilab-github/slask", "path": "limbo/plugins/stock.py", "copies": "2", "size": "1273", "license": "mit", "hash": -8679607974672437000, "line_mean": 30.825, "line_max": 102, "alpha_frac": 0.638648861, "autogenerated": false, "ratio": 3.247448979591837, "config_test": false, "has_...
"""$<ticker symbol> for a quote on a stock price""" from __future__ import print_function import re import requests from bs4 import BeautifulSoup from urllib import quote import json def stockprice(ticker): return "not implemented, go away" # print ('tickers') # url = "http://finance.yahoo.com/webservice/...
{ "repo_name": "BobbyJohansen/BillBot", "path": "plugins/stock.py", "copies": "1", "size": "1964", "license": "mit", "hash": -633237891168741000, "line_mean": 32.8620689655, "line_max": 108, "alpha_frac": 0.5366598778, "autogenerated": false, "ratio": 3.33446519524618, "config_test": false, "h...
"""$<ticker symbol> for a quote on a stock price""" from __future__ import print_function import re import requests from bs4 import BeautifulSoup from urllib import quote def stockprice(ticker): url = "https://www.google.com/finance?q={0}" print(url.format(quote(ticker))) soup = BeautifulSoup(requests.get...
{ "repo_name": "NUKnightLab/slask", "path": "plugins/_stock.py", "copies": "3", "size": "1102", "license": "mit", "hash": 5227433619215207000, "line_mean": 32.3939393939, "line_max": 106, "alpha_frac": 0.6206896552, "autogenerated": false, "ratio": 3.2128279883381925, "config_test": false, "ha...
"""$<ticker symbol> for a quote on a stock price""" import re import requests from bs4 import BeautifulSoup from urllib import quote def stockprice(ticker): url = "https://www.google.com/finance?q={}" print url.format(quote(ticker)) soup = BeautifulSoup(requests.get(url.format(quote(ticker))).text) tr...
{ "repo_name": "kesre/slask", "path": "plugins/stock.py", "copies": "4", "size": "1053", "license": "mit", "hash": -8836745091303084000, "line_mean": 34.1, "line_max": 106, "alpha_frac": 0.6144349478, "autogenerated": false, "ratio": 3.311320754716981, "config_test": false, "has_no_keywords": ...
# $ ./triton ./src/testers/qemu-test-x86_64.py ./src/samples/ir_test_suite/qemu-test-x86_64 from __future__ import print_function from triton import * import pintool as Pintool # Get the Triton context over the pintool Triton = Pintool.getTritonContext() def sbefore(instruction): Triton.concretizeAllRegi...
{ "repo_name": "JonathanSalwan/Triton", "path": "src/testers/pin/qemu-test-x86_64.py", "copies": "1", "size": "2370", "license": "apache-2.0", "hash": 1174026272070207000, "line_mean": 25.9318181818, "line_max": 120, "alpha_frac": 0.5544303797, "autogenerated": false, "ratio": 3.356940509915014, ...
# $URL$ # $Rev$ # PyPNG documentation build configuration file, created by # sphinx-quickstart on Mon Mar 16 13:12:26 2009. # Then brutally hacked down by drj. # See http://sphinx.pocoo.org/config.html import sys, os # So that local modules get picked up, and picked up first. sys.path.insert(0, os.path.abspath('../c...
{ "repo_name": "mnaberez/pypng", "path": "man/conf.py", "copies": "1", "size": "1621", "license": "mit", "hash": 8965899757170787000, "line_mean": 24.328125, "line_max": 81, "alpha_frac": 0.6588525601, "autogenerated": false, "ratio": 3.166015625, "config_test": true, "has_no_keywords": false,...
# $URL: http://pypng.googlecode.com/svn/trunk/setup.py $ # $Rev: 186 $ # PyPNG setup.py # This is the setup.py script used by disutils. # You can install the png module into your Python distribution with: # python setup.py install # You can also do other standard disutil type things, but you can refer # to the disuti...
{ "repo_name": "evast/XNATImageViewer", "path": "src/main/scripts/viewer/X/lib/pypng-0.0.9/setup.py", "copies": "5", "size": "1577", "license": "bsd-3-clause", "hash": 7596583590326448000, "line_mean": 31.1836734694, "line_max": 72, "alpha_frac": 0.675967026, "autogenerated": false, "ratio": 3.650...
# $URL: https://pyisapie.svn.sourceforge.net/svnroot/pyisapie/Tags/1.1.0-rc4/PyISAPIe/Python/Examples/Django/Isapi.py $ # $Rev: 162 $ $Date: 2009-05-28 13:37:33 -0700 (Thu, 28 May 2009) $ # (C)2008 Phillip Sitbon <phillip@sitbon.net> # """Global ISAPI request handler. This serves up the Django site 'mysite' via ...
{ "repo_name": "babyliynfg/cross", "path": "tools/project-creator/Python2.6.6/Lib/Django/Isapi.py", "copies": "1", "size": "2281", "license": "mit", "hash": -8951016337439244000, "line_mean": 33.1230769231, "line_max": 119, "alpha_frac": 0.7049539676, "autogenerated": false, "ratio": 3.48244274809...
# $URL: https://pyisapie.svn.sourceforge.net/svnroot/pyisapie/Tags/1.1.0-rc4/PyISAPIe/Python/Examples/Django/pyisapie.py $ # $Rev: 91 $ $Date: 2008-01-10 23:53:59 -0800 (Thu, 10 Jan 2008) $ # (C)2008 Phillip Sitbon <phillip@sitbon.net> # """Custom request handler for PyISAPIe. """ from django.core.handlers.base...
{ "repo_name": "babyliynfg/cross", "path": "tools/project-creator/Python2.6.6/Lib/Django/pyisapie.py", "copies": "1", "size": "5817", "license": "mit", "hash": -2800554447685484000, "line_mean": 33.6871165644, "line_max": 122, "alpha_frac": 0.5580195977, "autogenerated": false, "ratio": 3.89618218...
"""$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/durus/connection.py $ $Id$ """ import sys from schevo.lib import optimize from cPickle import loads from heapq import heappush, heappop from schevo.store.error import ConflictError, ReadConflictError, DurusKeyError from schevo.store.logger import log from schevo.st...
{ "repo_name": "Schevo/schevo", "path": "schevo/store/connection.py", "copies": "1", "size": "16905", "license": "mit", "hash": 6348602136280125000, "line_mean": 33.8556701031, "line_max": 79, "alpha_frac": 0.5664596273, "autogenerated": false, "ratio": 4.148466257668711, "config_test": false, ...
"""$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/durus/error.py $ $Id$ """ from schevo.lib import optimize from schevo.store.utils import format_oid class DurusError(StandardError): """Durus error.""" class DurusKeyError(KeyError, DurusError): """Key not found in database.""" def __str__(self): ...
{ "repo_name": "Schevo/schevo", "path": "schevo/store/error.py", "copies": "1", "size": "1951", "license": "mit", "hash": 7480329694719760000, "line_mean": 24.0128205128, "line_max": 77, "alpha_frac": 0.6412096361, "autogenerated": false, "ratio": 3.9574036511156185, "config_test": false, "has...
"""$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/durus/serialize.py $ $Id$ """ from schevo.lib import optimize import struct from cPickle import Pickler, Unpickler, loads from cStringIO import StringIO from schevo.store.error import InvalidObjectReference from schevo.store.persistent import Persistent from schevo...
{ "repo_name": "Schevo/schevo", "path": "schevo/store/serialize.py", "copies": "1", "size": "5177", "license": "mit", "hash": 1066256198992033300, "line_mean": 30.5670731707, "line_max": 77, "alpha_frac": 0.6071083639, "autogenerated": false, "ratio": 3.846210995542348, "config_test": false, "...
"""$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/durus/storage.py $ $Id$ """ import sys from schevo.lib import optimize from schevo.store.serialize import ( unpack_record, split_oids, extract_class_name) from schevo.store.utils import p64 class Storage(object): """ This is the interface that Connec...
{ "repo_name": "Schevo/schevo", "path": "schevo/store/storage.py", "copies": "1", "size": "4294", "license": "mit", "hash": -7207973311782903000, "line_mean": 26.3503184713, "line_max": 83, "alpha_frac": 0.6059618072, "autogenerated": false, "ratio": 4.047125353440151, "config_test": false, "h...
"""$URL: svn+ssh://svn/repos/trunk/durus/persistent_dict.py $ $Id$ """ import sys from schevo.lib import optimize from copy import copy from schevo.store.persistent import PersistentData class PersistentDict(PersistentData): """ Instance attributes: data : dict """ data_is = dict __slots...
{ "repo_name": "Schevo/schevo", "path": "schevo/store/persistent_dict.py", "copies": "1", "size": "3106", "license": "mit", "hash": 3972912567789004300, "line_mean": 23.0775193798, "line_max": 73, "alpha_frac": 0.5602060528, "autogenerated": false, "ratio": 3.742168674698795, "config_test": fals...
"""$URL: svn+ssh://svn/repos/trunk/durus/persistent_list.py $ $Id$ """ import sys from schevo.lib import optimize from schevo.store.persistent import PersistentData class PersistentList(PersistentData): """ Instance attributes: data : list """ data_is = list __slots__ = [] def __ini...
{ "repo_name": "Schevo/schevo", "path": "schevo/store/persistent_list.py", "copies": "1", "size": "4002", "license": "mit", "hash": 4569390063576464000, "line_mean": 24.3291139241, "line_max": 64, "alpha_frac": 0.5404797601, "autogenerated": false, "ratio": 3.535335689045936, "config_test": fals...
#$ZEUUX: src/ss/lib/pinyin.py,v 1.2 2008/11/26 07:06:35 qingran Exp $ # -*- coding: utf-8 -*- """ the PinYinDict is generated from xyb's pinyin_zopeext.py, using: >>> f = open('tt', 'w') >>> for (k, v) in pinyin_zopeext.pinyinDict.items(): ... f.write( u"'%s':%s, \n" %(k, str(tuple(v.split(' '))) ) ) ... >>> f.cl...
{ "repo_name": "hexuotzo/khufu", "path": "pinyin.py", "copies": "1", "size": "119018", "license": "bsd-2-clause", "hash": -8219895344353602000, "line_mean": 14.4946378728, "line_max": 99, "alpha_frac": 0.2781780947, "autogenerated": false, "ratio": 1.6788488475741754, "config_test": false, "ha...
# 0000 # 0000 @NOP No Operation # 0001 # CCCC AAAA AAAA @JCN Jump Condition # 0010 # RRR0 DDDD DDDD @FIM Fetch Immediate # RRR1 @SRC Send Register Control # 0011 # RRR0 @FIN Fetch Indirect # RRR1 @JIN Jump Indirect # 0100 # AAAA AAAA AAAA @JUN Jump Unconditional # 0...
{ "repo_name": "jtauber/pycpu", "path": "i4004.py", "copies": "1", "size": "12895", "license": "mit", "hash": -5353150625355330000, "line_mean": 29.7023809524, "line_max": 103, "alpha_frac": 0.4665374176, "autogenerated": false, "ratio": 3.0717008099094807, "config_test": false, "has_no_keywor...
''' 0015. 3Sum - LeetCode https://leetcode.com/problems/3sum/''' class Solution: def threeSum(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ nums = sorted(nums) ret = [] for i in range(len(nums)-2): if nums[i] > 0: ...
{ "repo_name": "heyf/cloaked-octo-adventure", "path": "leetcode/0015-3sum.py", "copies": "1", "size": "1030", "license": "mit", "hash": 3218575320785151000, "line_mean": 28.4285714286, "line_max": 59, "alpha_frac": 0.3485436893, "autogenerated": false, "ratio": 3.6267605633802815, "config_test":...
@@ -0,0 +1,59 @@ import Simulation import Frameworks.PlayerStatsPrebuilts as Stats def GetSpread(): balanced = Simulation.Player(1) focused_stam_high = Simulation.Player(1) focused_stam_low = Simulation.Player(1) focused_stam_mid = Simulation.Player(1) specialist_stam_high = Simulation.Player(1) ...
{ "repo_name": "jedislight/Shockball", "path": "Test/AverageHitsSimulator.py", "copies": "1", "size": "2028", "license": "mit", "hash": 4129844176294368000, "line_mean": 33.3728813559, "line_max": 106, "alpha_frac": 0.6188362919, "autogenerated": false, "ratio": 2.90961262553802, "config_test": ...
@@ -0,0 +1,80 @@ # https://punkapi.com/ # http://docs.python-requests.org/en/master/ import time, re, requests, os, errno, json, sqlite3 def getDatos(url,i): directorio = 'archivitos-de-cache' ids=[] print ('Buscando datos...') ids.append(i) urls = url + str(i) request = requests.get(urls) id = request.json()[0]...
{ "repo_name": "AnhellO/DAS_Sistemas", "path": "Ago-Dic-2018/Andres Lopez/Practica 4/Practica 2 Parcial 2.py", "copies": "1", "size": "2430", "license": "mit", "hash": -2752291328423617000, "line_mean": 31.7972972973, "line_max": 146, "alpha_frac": 0.6361763494, "autogenerated": false, "ratio": 2....
__author__ = 'Libao Jin' __date__ = 'December 18, 2015' import time class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ # start_time = time.time() # n = len(nums) # i = 0 ...
{ "repo_name": "jinlibao/LeetCode-Solutions", "path": "solutions/001_Two_Sum.py", "copies": "2", "size": "2151", "license": "mit", "hash": 2515048178935872000, "line_mean": 28.0675675676, "line_max": 59, "alpha_frac": 0.3454207345, "autogenerated": false, "ratio": 3.76707530647986, "config_test"...
# 002. Add Two Numbers - LeetCode # https://leetcode.com/problems/add-two-numbers/description/ from helper.linked_list import ListNode, LinkedList, traversal # Non Empty, reversed # class Solution(object): # def addTwoNumbers(self,l1,l2): # def linkedlist_to_integer(l): # ret = 0 # ...
{ "repo_name": "heyf/cloaked-octo-adventure", "path": "leetcode/002_add-two-numbers.py", "copies": "1", "size": "2124", "license": "mit", "hash": -6848560599147613000, "line_mean": 24.9146341463, "line_max": 73, "alpha_frac": 0.4058380414, "autogenerated": false, "ratio": 3.189189189189189, "con...
# 002 - Add Two Numbers (Medium) # https://leetcode.com/problems/add-two-numbers/ # Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution(object): def addTwoNumbers(self, l1, l2): """ ...
{ "repo_name": "zubie7a/Algorithms", "path": "LeetCode/02_Medium/lc_002.py", "copies": "1", "size": "1752", "license": "mit", "hash": 8937769810065111000, "line_mean": 33.3529411765, "line_max": 77, "alpha_frac": 0.5496575342, "autogenerated": false, "ratio": 3.816993464052288, "config_test": fa...
# 003_cleaner.py ##################################################################### ################################## # Import des modules et ajout du path de travail pour import relatif import sys sys.path.insert(0 , 'C:/Users/WILLROS/Perso/Shade/scripts/LocalWC-Shade-App/apis/') from voca import AddLog , ...
{ "repo_name": "sighill/shade_app", "path": "apis/raw/006_raw/006_cleaner.py", "copies": "1", "size": "1624", "license": "mit", "hash": 3086637915699015700, "line_mean": 41.7837837838, "line_max": 147, "alpha_frac": 0.637037037, "autogenerated": false, "ratio": 3.0393996247654784, "config_test":...
# 003 - Longest Substring Without Repeating Characters (Medium) # https://leetcode.com/problems/longest-substring-without-repeating-characters/ from collections import defaultdict class Solution(object): def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int """ ...
{ "repo_name": "zubie7a/Algorithms", "path": "LeetCode/02_Medium/lc_003.py", "copies": "1", "size": "1232", "license": "mit", "hash": 3789780809355710500, "line_mean": 35.2352941176, "line_max": 79, "alpha_frac": 0.5957792208, "autogenerated": false, "ratio": 4.546125461254612, "config_test": fa...
#[0,0,5, 1,0,9, 4,7,3, # 0,0,9, 5,0,0, 8,0,6, # 1,4,0, 8,0,0, 2,0,0, # # 4,0,0, 0,0,0, 0,6,0, # 0,0,6, 7,0,2, 5,0,0, # 0,8,0, 0,0,0, 0,0,1, # # 0,0,4, 0,0,1, 0,2,8, # 5,0,2, 0,0,8, 6,0,0, # 3,9,8, 2,0,7, 1,0,0] s = [0,0,5,1,0,9,4,7,3,0,0,9,5,0,0,8,0,6,1,4,0,8,0,0,2,0,0,4,0,0,0,0,0,0,6,0,0,0,6,7,0,2,5,0,0,0,8,0,0,0,0,0,...
{ "repo_name": "oddbear/Algorithms", "path": "Sudoku/Solvers/Python3/Standard Sudoku/alg06/main.py", "copies": "1", "size": "1695", "license": "mit", "hash": -3184779239254468000, "line_mean": 33.5918367347, "line_max": 167, "alpha_frac": 0.5970501475, "autogenerated": false, "ratio": 2.0772058823...
# 005_cleaner.py ##################################################################### ################################## # Import des modules et ajout du path de travail pour import relatif import sys sys.path.insert(0 , 'C:/Users/WILLROS/Perso/Shade/scripts/LocalWC-Shade-App/apis/') from voca import AddLog , ...
{ "repo_name": "sighill/shade_app", "path": "apis/raw/005_raw/005_cleaner.py", "copies": "1", "size": "1625", "license": "mit", "hash": -8571346310990103000, "line_mean": 41.8108108108, "line_max": 148, "alpha_frac": 0.63726095, "autogenerated": false, "ratio": 3.041275797373358, "config_test": ...
# 006. ZigZag Conversion # The idea is based on Min Priority Queue. # However, in python, this turned out to be really slow. import unittest import queue class Solution(object): def convert(self, s, numRows): """ :type s: str :type numRows: int :rtype: str """ if num...
{ "repo_name": "hanlin-he/UTD", "path": "leetcode/py/006.queue.py", "copies": "1", "size": "1053", "license": "mit", "hash": -2570669376171554300, "line_mean": 25.325, "line_max": 75, "alpha_frac": 0.5327635328, "autogenerated": false, "ratio": 3.463815789473684, "config_test": true, "has_no_k...
# 01-02-04 #v1.0.2 # # Date Utils # By Fuzzyman see www.voidspace.org.uk/atlantibots/pythonutils.html # Written for the Victory Day program for Jesus Fellowship Church # www.jesus.org.uk # These are various functions for dealing with dates (including leap years and so on) # Useful especially for situations where you...
{ "repo_name": "amir-zeldes/rstWeb", "path": "modules/dateutils.py", "copies": "1", "size": "24933", "license": "mit", "hash": -1155343091978499600, "line_mean": 37.6558139535, "line_max": 150, "alpha_frac": 0.6003288814, "autogenerated": false, "ratio": 3.683409661693012, "config_test": true, ...
# 01/02/2017 import re def get_inputs(inputFile="encoded.txt"): f = open(inputFile, 'r') temp = f.readline().strip().split() key = {} for x, y in zip(temp[::2], temp[1::2]): key[y] = x return (f.read(), key) def decode(args): message, key, output = args[0], args[1], [] start, finis...
{ "repo_name": "tlgs/dailyprogrammer", "path": "Python/intermediate/i245.py", "copies": "2", "size": "1423", "license": "unlicense", "hash": -2240604543171092200, "line_mean": 32.0930232558, "line_max": 75, "alpha_frac": 0.5551651441, "autogenerated": false, "ratio": 3.388095238095238, "config_t...
# 01/05/2017 # Does not implement a very robust SBD system at this moment. # An improvement would be to follow Wikipedia's "vanilla" approach of # using a hand-compiled list of abreviations but I was unable to find a good one. # https://en.wikipedia.org/wiki/Sentence_boundary_disambiguation # # Does not group singular...
{ "repo_name": "tlseabra/dailyprogrammer", "path": "Python/hard/h312.py", "copies": "2", "size": "1883", "license": "mit", "hash": 2848616043031693000, "line_mean": 36.66, "line_max": 97, "alpha_frac": 0.6394052045, "autogenerated": false, "ratio": 3.2804878048780486, "config_test": false, "ha...
# 01.06.2007, c # last revision: 25.02.2008 from __future__ import absolute_import from sfepy import data_dir filename_mesh = data_dir + '/meshes/various_formats/small2d.mesh' material_1 = { 'name' : 'coef', 'values' : {'coef' : 1.0}, } region_1000 = { 'name' : 'Omega', 'select' : 'all', } region_1 =...
{ "repo_name": "lokik/sfepy", "path": "tests/test_periodic_bc_2d.py", "copies": "5", "size": "2902", "license": "bsd-3-clause", "hash": -7282990991255301000, "line_mean": 20.9848484848, "line_max": 72, "alpha_frac": 0.5344589938, "autogenerated": false, "ratio": 2.8065764023210833, "config_test"...
# 01.06.2007, c # last revision: 25.02.2008 filename_mesh = 'database/tests/small2d.mesh' material_1 = { 'name' : 'coef', 'mode' : 'here', 'region' : 'Omega', 'coef' : 1.0, } region_1000 = { 'name' : 'Omega', 'select' : 'all', } region_1 = { 'name' : 'Left', 'select' : 'nodes in (x < ...
{ "repo_name": "certik/sfepy", "path": "tests/test_periodic_bc_2d.py", "copies": "1", "size": "2548", "license": "bsd-3-clause", "hash": 7189296440212312000, "line_mean": 19.8852459016, "line_max": 77, "alpha_frac": 0.4839089482, "autogenerated": false, "ratio": 2.7846994535519127, "config_test"...
# 0 1 2 # 3 4 5 # 6 7 8 board = [[0,1,2],[3,4,5],[6,7,8]] def unlockPattern(board): not_reachable = {0:[2,6,8], 1:[7], 2:[0, 6,8], 3:[5], 5:[3], 6:[2,0,8], 7:[1], 8:[0,6,2]} def dfs(currentVal, board, temp, final_res): if len(temp) == 9: if temp not in final_res: final_res....
{ "repo_name": "quake0day/oj", "path": "androidunlock.py", "copies": "1", "size": "1555", "license": "mit", "hash": 905474984499131300, "line_mean": 32.8260869565, "line_max": 93, "alpha_frac": 0.4308681672, "autogenerated": false, "ratio": 3.7290167865707433, "config_test": false, "has_no_key...
# 014 - Longest Common Prefix (Easy) # https://leetcode.com/problems/longest-common-prefix/ class PrefixTree(object): def __init__(self, string=""): # Initialize empty dict of children nodes. self.children = {} self.terminal = False def insert(self, string): char = string[0] ...
{ "repo_name": "zubie7a/Algorithms", "path": "LeetCode/01_Easy/lc_014.py", "copies": "1", "size": "1939", "license": "mit", "hash": 3384986309768517600, "line_mean": 33.0175438596, "line_max": 77, "alpha_frac": 0.5667870036, "autogenerated": false, "ratio": 4.270925110132159, "config_test": fals...
"""01 create table Revision ID: 9b78889aa13e Revises: Create Date: 2016-01-20 15:12:50.987583 """ # revision identifiers, used by Alembic. revision = '9b78889aa13e' down_revision = None branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto gener...
{ "repo_name": "swaygently/clapton", "path": "clapton/db/alembic/versions/9b78889aa13e_01_create_table.py", "copies": "1", "size": "1420", "license": "apache-2.0", "hash": 6846571144626326000, "line_mean": 29.8695652174, "line_max": 63, "alpha_frac": 0.6647887324, "autogenerated": false, "ratio": ...
# 01HandParse.py vers 000 #------------------------ # Eric Shinn #------------------------ # Will accept a hand-type and return a specific hand that's useable by # subsequent scripts and routines. #------------------------ import copy, random, secrets, time deck0 = ['AS','2S','3S','4S','5S','6S','7S','8S','9S','TS','J...
{ "repo_name": "musandsmrts/poker", "path": "01HandParse.py", "copies": "1", "size": "1379", "license": "mit", "hash": 7323624697976335000, "line_mean": 33.475, "line_max": 78, "alpha_frac": 0.583031182, "autogenerated": false, "ratio": 2.7690763052208833, "config_test": false, "has_no_keyword...
# 0-1 Knapsack backtracking, recursive # By James Lao import time import sys import threading def knapsack(vw, limit): def bound(v, w, j): if j >= len(vw) or w > limit: return -1 else: while j < len(vw) and w + vw[j][1] <= limit: v, w, j = v + vw[j][0], w ...
{ "repo_name": "jameslao/Knapsack-in-Python", "path": "knapsack_bt_recursive.py", "copies": "2", "size": "1572", "license": "mit", "hash": -1363736623440270300, "line_mean": 27.0714285714, "line_max": 70, "alpha_frac": 0.4866412214, "autogenerated": false, "ratio": 2.949343339587242, "config_tes...
# 0-1 Knapsack Branch and Bound with Heapq # By James Lao. from heapq import * import time import sys def knapsack(vw, limit): def bound(v, w, j): if j >= len(vw) or w > limit: return -1 else: while j < len(vw) and w + vw[j][1] <= limit: v, w, j = v + vw[j]...
{ "repo_name": "jameslao/Algorithmic-Pearls", "path": "0-1-Knapsack/knapsack_bnb_pq.py", "copies": "2", "size": "1557", "license": "mit", "hash": 6769685474102678000, "line_mean": 31.4375, "line_max": 80, "alpha_frac": 0.4463712267, "autogenerated": false, "ratio": 2.846435100548446, "config_tes...
"""0/1 Knapsack Problem (0/1 means that items cannot be divided) Given a bag which can only hold a weight W and a list of items, each one with a weight Wi and a price Pi, which items should be put on the bag to maximize the total value of the bag? Example: Input: W = 4 i1 = (W1 = 2, P1 = 1) ...
{ "repo_name": "rcanepa/cs-fundamentals", "path": "python/dynamic_programming/knapsack.py", "copies": "1", "size": "1599", "license": "mit", "hash": -8186323048662680000, "line_mean": 23.2272727273, "line_max": 86, "alpha_frac": 0.4828017511, "autogenerated": false, "ratio": 3.069097888675624, "...
"""0-1 Knapsack Problem Given weights and values of n "non-splittable" items, put these items in a knapsack of capacity to get the maximum total value in the knapsack. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function def _knapsack01_recur(val, wt, wt_...
{ "repo_name": "bowen0701/algorithms_data_structures", "path": "alg_knapsack01.py", "copies": "1", "size": "4159", "license": "bsd-2-clause", "hash": 7049605746672697000, "line_mean": 25.3227848101, "line_max": 77, "alpha_frac": 0.5210387112, "autogenerated": false, "ratio": 2.79502688172043, "c...
# 01 - Saving The Universe Again t = int(input()) def laser_strength(instructions): strength = 1 energy = 0 for i in range(0, len(instructions)): char = instructions[i] if (char == "S"): energy += strength elif (char == "C"): strength *= 2 return energ...
{ "repo_name": "Zubieta/CPP", "path": "Google_Code_Jam/2018/Qualifier_Round/Saving_The_Universe_Again.py", "copies": "3", "size": "1925", "license": "mit", "hash": -7416631262157481000, "line_mean": 34.6481481481, "line_max": 74, "alpha_frac": 0.5527272727, "autogenerated": false, "ratio": 4.06976...
# 01 - Vestigium # Vestigium means "trace" in Latin. In this problem we work with Latin squares # and matrix traces. The trace of a square matrix is the sum of the values on # the main diagonal (which runs from the upper left to the lower right). # An N-by-N square matrix is a Latin Square if each cell contains one o...
{ "repo_name": "Zubieta/CPP", "path": "Google_Code_Jam/2020/Qualifier_Round/01_Vestigium.py", "copies": "2", "size": "1832", "license": "mit", "hash": -1416390280962659300, "line_mean": 35.64, "line_max": 78, "alpha_frac": 0.663209607, "autogenerated": false, "ratio": 3.502868068833652, "config_...
#02-03a.py #------------------------------------------------------------ # first compute and plot the outlier fraction as a function # of max_depth max_depth_array = np.arange(1, 21) train_error = np.zeros(len(max_depth_array)) cv_error = np.zeros(len(max_depth_array)) for i, max_depth in enumerate(max_depth_array): ...
{ "repo_name": "vtesin/sklearn_tutorial", "path": "doc/notebooks/soln/02-03a.py", "copies": "4", "size": "1034", "license": "bsd-3-clause", "hash": -6348206193150569000, "line_mean": 30.3333333333, "line_max": 68, "alpha_frac": 0.6528046422, "autogenerated": false, "ratio": 2.92090395480226, "co...
#02-03b.py #------------------------------------------------------------ # compute and plot the outlier fraction # as a function of number of samples n_samples_array = np.linspace(50, Ntrain, 20).astype(int) train_error_2 = np.zeros(n_samples_array.shape) cv_error_2 = np.zeros(n_samples_array.shape) for i, n_samples ...
{ "repo_name": "rain1024/sklearn_tutorial", "path": "doc/notebooks/soln/02-03b.py", "copies": "4", "size": "1053", "license": "bsd-3-clause", "hash": -2466935906201194500, "line_mean": 31.90625, "line_max": 63, "alpha_frac": 0.6210826211, "autogenerated": false, "ratio": 2.9661971830985916, "con...
# 02/06/2017 import itertools from collections import Counter class Card(object): def __init__(self, value, suit): self.value = value self.suit = suit def rank(self): return "234567890JQKA".index(self.value) class Hand(object): def __init__(self, cards): assert len(cards)...
{ "repo_name": "tlseabra/dailyprogrammer", "path": "Python/hard/h317.py", "copies": "2", "size": "5674", "license": "mit", "hash": 8808928666491495000, "line_mean": 35.3782051282, "line_max": 107, "alpha_frac": 0.5384208671, "autogenerated": false, "ratio": 3.416014449127032, "config_test": fals...
# 020 - Valid Parentheses (Easy) # https://leetcode.com/problems/valid-parentheses/ class Solution(object): def isValid(self, s): """ :type s: str :rtype: bool """ # A stack for symbols. stack = [] for idx in range(len(s)): symbol = s[idx...
{ "repo_name": "zubie7a/Algorithms", "path": "LeetCode/01_Easy/lc_020.py", "copies": "1", "size": "1656", "license": "mit", "hash": 1810337038955149800, "line_mean": 33.5, "line_max": 81, "alpha_frac": 0.4951690821, "autogenerated": false, "ratio": 4.068796068796069, "config_test": false, "has...
# 021 - Merge Two Sorted Lists (Easy) # https://leetcode.com/problems/merge-two-sorted-lists/ # Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution(object): def mergeTwoLists(self, l1, l2): ...
{ "repo_name": "zubie7a/Algorithms", "path": "LeetCode/01_Easy/lc_021.py", "copies": "1", "size": "2263", "license": "mit", "hash": 8331326784094632000, "line_mean": 31.3428571429, "line_max": 79, "alpha_frac": 0.5240830756, "autogenerated": false, "ratio": 3.4761904761904763, "config_test": fal...
# 026 - Remove Duplicates From Sorted Array (Easy) # https://leetcode.com/problems/remove-duplicates-from-sorted-array/submissions/ class Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ # Deduplicate elements in a sorted list, i...
{ "repo_name": "zubie7a/Algorithms", "path": "LeetCode/01_Easy/lc_026.py", "copies": "1", "size": "1073", "license": "mit", "hash": -145369881276076200, "line_mean": 37.3214285714, "line_max": 80, "alpha_frac": 0.5908667288, "autogenerated": false, "ratio": 4.433884297520661, "config_test": fals...
# 028 - Implement strStr() (Easy) # https://leetcode.com/problems/implement-strstr/ class Solution(object): def strStr(self, haystack, needle): """ :type haystack: str :type needle: str :rtype: int """ if needle == "": return 0 # Build t...
{ "repo_name": "zubie7a/Algorithms", "path": "LeetCode/01_Easy/lc_028.py", "copies": "1", "size": "2677", "license": "mit", "hash": 5631125527481553000, "line_mean": 38.9552238806, "line_max": 95, "alpha_frac": 0.5136346657, "autogenerated": false, "ratio": 3.965925925925926, "config_test": fals...
# 02 - Nesting Depth # tl;dr Given a string of digits S, insert a minimum number of opening and # closing parentheses into it such that the resulting string is balanced and # each digit d is inside exactly d pairs of matching parentheses. num_cases = int(input()) for t in range(1, num_cases + 1): numbers = input(...
{ "repo_name": "zubie7a/Algorithms", "path": "Google_Code_Jam/2020/Qualifier_Round/02_Nesting_Depth.py", "copies": "2", "size": "1232", "license": "mit", "hash": -3387141469388816000, "line_mean": 33.2222222222, "line_max": 78, "alpha_frac": 0.6006493506, "autogenerated": false, "ratio": 3.85, "...
#02_reaction_game.py # Written for Simon Monk's Electronics Starter Kit for the Raspberry Pi by Henry Budden (@pi_tutor) #Thanks to Ben Nuttall from the Raspberry Pi Foundation for the GPIO Zero library #Import relevant libraries from gpiozero import * from time import sleep import random #Set pin numbers led_1 = LE...
{ "repo_name": "henrybudden/rpesk-advanced", "path": "02_reaction_game.py", "copies": "1", "size": "4465", "license": "mit", "hash": -2397144569582046000, "line_mean": 38.5132743363, "line_max": 125, "alpha_frac": 0.5126539754, "autogenerated": false, "ratio": 3.979500891265597, "config_test": f...
# 02 - Trouble Sort t = int(input()) for case in range(1, t + 1): n = int(input()) nums = list(map(int, input().split(" "))) # Trouble sort is like bubble sort, but instead will compare pairs separated # away by two positions. This means that only elements in even positions will # be compared with...
{ "repo_name": "Zubieta/CPP", "path": "Google_Code_Jam/2018/Qualifier_Round/Trouble_Sort.py", "copies": "3", "size": "1451", "license": "mit", "hash": 7265070357121993000, "line_mean": 31.9772727273, "line_max": 81, "alpha_frac": 0.5761543763, "autogenerated": false, "ratio": 3.582716049382716, ...
# 03.10.2007, c from __future__ import absolute_import from sfepy import data_dir from sfepy.mechanics.matcoefs import stiffness_from_lame filename_mesh = data_dir + '/meshes/2d/special/circle_in_square.mesh' # Whole domain $Y$. region_1000 = { 'name' : 'Y', 'select' : 'all', } # Domain $Y_1$. region_1 = { ...
{ "repo_name": "BubuLK/sfepy", "path": "tests/test_lcbc_2d.py", "copies": "5", "size": "2172", "license": "bsd-3-clause", "hash": 5617036390332742000, "line_mean": 16.1023622047, "line_max": 71, "alpha_frac": 0.4700736648, "autogenerated": false, "ratio": 2.3155650319829424, "config_test": true,...
# 03.10.2007, c from sfepy import data_dir filename_mesh = data_dir + '/meshes/2d/special/circle_in_square.mesh' # Whole domain $Y$. region_1000 = { 'name' : 'Y', 'select' : 'all', } # Domain $Y_1$. region_1 = { 'name' : 'Y1', 'select' : 'cells of group 1', } # Domain $Y_2$. region_2 = { 'name' ...
{ "repo_name": "RexFuzzle/sfepy", "path": "tests/test_lcbc_2d.py", "copies": "1", "size": "2086", "license": "bsd-3-clause", "hash": 6218837036810237000, "line_mean": 15.4251968504, "line_max": 78, "alpha_frac": 0.4506232023, "autogenerated": false, "ratio": 2.297356828193833, "config_test": tru...
#034丰富的else语句和简介的with语句 #else与异常处理 搭配 # if : *** else: *** ''' 要么怎样,要么不怎样 干完了能怎样,干不完就别想怎样 没有问题,那就干吧 ''' def showMaxFactor(num): count = num // 2 while count > 1: if num % count == 0: print("%d最大的约数是%d" % (num, count)) break count -= 1 else: print("%d是素数!" % ...
{ "repo_name": "icelip/python170829", "path": "034丰富的else语句和简介的with语句测试.py", "copies": "1", "size": "1156", "license": "epl-1.0", "hash": 6245428356949404000, "line_mean": 14, "line_max": 56, "alpha_frac": 0.5622222222, "autogenerated": false, "ratio": 2.0089285714285716, "config_test": false, ...
# 038 - Count and Say (Easy) # https://leetcode.com/problems/count-and-say/ class Solution(object): def countAndSay(self, n): """ :type n: int :rtype: str """ # "1": "11" -> 1 one. # "11" : "21" -> 2 ones. # "21" : "1211" -> 1 two, 1 one. # ...etc. ...
{ "repo_name": "zubie7a/Algorithms", "path": "LeetCode/01_Easy/lc_038.py", "copies": "1", "size": "1573", "license": "mit", "hash": 782754866886537300, "line_mean": 33.1956521739, "line_max": 88, "alpha_frac": 0.4691671964, "autogenerated": false, "ratio": 4.5201149425287355, "config_test": fals...
# 03 - Cryptopangrams # I don't know how to do it for N <= 10^100, only N <= 10^4. # The "factorize first value" thing will obviously explode for # such a large N. num_cases = int(input()) for t in range(1, num_cases + 1): # Parse the input. n, length = [int(x) for x in input().split(" ")] values = [in...
{ "repo_name": "zubie7a/CPP", "path": "Google_Code_Jam/2019/Qualifier_Round/03_Cryptopangrams.py", "copies": "3", "size": "2858", "license": "mit", "hash": -506474193357529900, "line_mean": 35.641025641, "line_max": 85, "alpha_frac": 0.6231630511, "autogenerated": false, "ratio": 3.576971214017522...
#03 import random class Jugador(object): def __init__(self, nombre="Jugador" ): self.nombre= nombre self.hp_max=random.randrange(45,55) self.mp_max=random.randrange(40,50) self.fuerza=random.randrange(3,7) self.inteligencia=random.randrange(2,5) self.hp=self.hp_max ...
{ "repo_name": "chelinho139/Tutoriales-Python", "path": "tut32.py", "copies": "1", "size": "3899", "license": "apache-2.0", "hash": -587982775870114300, "line_mean": 26.0763888889, "line_max": 72, "alpha_frac": 0.5586047705, "autogenerated": false, "ratio": 2.8294629898403483, "config_test": fal...
# 03 - Parenting Partening Returns # Scheduling kid activities and domestic necesities is a challenge for a couple # parents of a 3 year old child. They have a list of N activities to take care # during the day, each activity happens during a specified interval in the day. # Thet need to assign each activity to any o...
{ "repo_name": "Zubieta/CPP", "path": "Google_Code_Jam/2020/Qualifier_Round/03_Parenting_Partnering_Returns.py", "copies": "2", "size": "4723", "license": "mit", "hash": -5517275407275062000, "line_mean": 44.4134615385, "line_max": 80, "alpha_frac": 0.5864916367, "autogenerated": false, "ratio": 4...
# 03_rgb_cheerlights.py # Set the color to the latest color that # anyone in the world tweeted as #cheerlights from squid import * import urllib, time squid = Squid(18, 23, 24) cheerlights_url = "http://api.thingspeak.com/channels/1417/field/1/last.txt" # setup a map data structure with the RGB values for the differ...
{ "repo_name": "teknoteacher/raspirobot3", "path": "02_rgb_cheerlights.py", "copies": "1", "size": "1247", "license": "mit", "hash": 290496986510902000, "line_mean": 33.6388888889, "line_max": 88, "alpha_frac": 0.5485164395, "autogenerated": false, "ratio": 3.3164893617021276, "config_test": fal...
# 03_rgb.py # From the code for the Electronics Starter Kit for the Raspberry Pi by MonkMakes.com # Based on Recipe 9.9 in The Raspberry Pi Cookbook by Simon Monk. from Tkinter import * # tkinter provides the graphical user interface (GUI) import RPi.GPIO as GPIO import time # Configure the Pi to use the BCM (B...
{ "repo_name": "simonmonk/pi_starter_kit", "path": "03_rgb.py", "copies": "1", "size": "2518", "license": "mit", "hash": 4361744856778059000, "line_mean": 32.5866666667, "line_max": 92, "alpha_frac": 0.6707704527, "autogenerated": false, "ratio": 3.388963660834455, "config_test": false, "has_n...
# 04.06.2007, c # last revision: 25.02.2008 from __future__ import absolute_import from sfepy import data_dir filename_mesh = data_dir + '/meshes/various_formats/small3d.mesh' material_1 = { 'name' : 'coef', 'values' : {'coef' : 1.0}, } region_1000 = { 'name' : 'Omega', 'select' : 'all', } region_1 =...
{ "repo_name": "BubuLK/sfepy", "path": "tests/test_periodic_bc_3d.py", "copies": "5", "size": "2331", "license": "bsd-3-clause", "hash": 4944190231392829000, "line_mean": 18.9230769231, "line_max": 83, "alpha_frac": 0.4826254826, "autogenerated": false, "ratio": 2.4745222929936306, "config_test"...
# 04.06.2007, c # last revision: 25.02.2008 from sfepy import data_dir filename_mesh = data_dir + '/meshes/various_formats/small3d.mesh' material_1 = { 'name' : 'coef', 'values' : {'coef' : 1.0}, } region_1000 = { 'name' : 'Omega', 'select' : 'all', } region_1 = { 'name' : 'Left', 'select' : ...
{ "repo_name": "olivierverdier/sfepy", "path": "tests/test_periodic_bc_3d.py", "copies": "1", "size": "2123", "license": "bsd-3-clause", "hash": -8523634816320629000, "line_mean": 17.6228070175, "line_max": 65, "alpha_frac": 0.4696184644, "autogenerated": false, "ratio": 2.4070294784580497, "con...
# 04.06.2007, c # last revision: 25.02.2008 filename_mesh = 'database/tests/small3d.mesh' material_1 = { 'name' : 'coef', 'mode' : 'here', 'region' : 'Omega', 'coef' : 1.0, } region_1000 = { 'name' : 'Omega', 'select' : 'all', } region_1 = { 'name' : 'Left', 'select' : 'nodes in (x < ...
{ "repo_name": "certik/sfepy", "path": "tests/test_periodic_bc_3d.py", "copies": "1", "size": "2843", "license": "bsd-3-clause", "hash": 8882517256896980000, "line_mean": 19.9044117647, "line_max": 77, "alpha_frac": 0.4766092156, "autogenerated": false, "ratio": 2.7076190476190476, "config_test"...
#04_07_hangman_print_word import random words = ['chicken', 'dog', 'cat', 'mouse', 'frog'] lives_remaining = 14 guessed_letters = '' def play(): word = pick_a_word() while True: guess = get_guess(word) if process_guess(guess, word): print('You win! Well Done!') break if lives_remaining == 0: print('...
{ "repo_name": "simonmonk/prog_pi_ed2", "path": "04_07_hangman_print_word.py", "copies": "1", "size": "1042", "license": "mit", "hash": 8603108288111661000, "line_mean": 20.7291666667, "line_max": 50, "alpha_frac": 0.6775431862, "autogenerated": false, "ratio": 2.902506963788301, "config_test": ...
# 04.08.2009 #! #! Homogenization: Linear Elasticity #! ================================= #$ \centerline{Example input file, \today} #! Homogenization of heterogeneous linear elastic material from sfepy.fem.periodic import * from sfepy.mechanics.matcoefs import stiffness_tensor_youngpoisson from sfepy.homogenization....
{ "repo_name": "olivierverdier/sfepy", "path": "examples/homogenization/linear_homogenization.py", "copies": "1", "size": "6107", "license": "bsd-3-clause", "hash": -2206429618670202400, "line_mean": 30.9738219895, "line_max": 107, "alpha_frac": 0.5323399378, "autogenerated": false, "ratio": 2.888...
# 04.08.2009 #! #! Homogenization: Linear Elasticity #! ================================= #$ \centerline{Example input file, \today} #! Homogenization of heterogeneous linear elastic material import sfepy.discrete.fem.periodic as per from sfepy.mechanics.matcoefs import stiffness_from_youngpoisson from sfepy.homogeni...
{ "repo_name": "RexFuzzle/sfepy", "path": "examples/homogenization/linear_homogenization.py", "copies": "1", "size": "5287", "license": "bsd-3-clause", "hash": 5754898932409013000, "line_mean": 28.8700564972, "line_max": 107, "alpha_frac": 0.5313031965, "autogenerated": false, "ratio": 2.912947658...
#04_08_hangman_full import random words = ['chicken', 'dog', 'cat', 'mouse', 'frog'] lives_remaining = 14 guessed_letters = '' def play(): word = pick_a_word() while True: guess = get_guess(word) if process_guess(guess, word): print('You win! Well Done!') break if lives_remaining == 0: print('You a...
{ "repo_name": "simonmonk/prog_pi_ed2", "path": "04_08_hangman_full.py", "copies": "1", "size": "1572", "license": "mit", "hash": -7337390986606939000, "line_mean": 20.2567567568, "line_max": 50, "alpha_frac": 0.6844783715, "autogenerated": false, "ratio": 2.9165120593692024, "config_test": fals...
#04_09_hangman_full_solution import random words = ['chicken', 'dog', 'cat', 'mouse', 'frog'] lives_remaining = 14 guessed_letters = '' def play(): word = pick_a_word() while True: guess = get_guess(word) if process_guess(guess, word): print('You win! Well Done!') break if lives_remaining == 0: pri...
{ "repo_name": "simonmonk/prog_pi_ed2", "path": "04_09_hangman_full_solution.py", "copies": "1", "size": "1643", "license": "mit", "hash": 5408477614533430000, "line_mean": 21.2162162162, "line_max": 50, "alpha_frac": 0.6828971394, "autogenerated": false, "ratio": 2.9339285714285714, "config_tes...
# 042. Trapping Rain Water # Recursive solution with no tail recursive optimization may cause # RuntimeError: maximum recursion depth exceeded import unittest class Solution(object): def __trap__(self, height, hstack, index): # Base case, if no height left, no trap water. if height == []: ...
{ "repo_name": "hanlin-he/UTD", "path": "leetcode/py/042.rec.py", "copies": "1", "size": "2921", "license": "mit", "hash": 8189848700201871000, "line_mean": 29.4270833333, "line_max": 87, "alpha_frac": 0.4816843547, "autogenerated": false, "ratio": 3.2564102564102564, "config_test": true, "has...
# 042. Trapping Rain Water # Recursive solution with no tail recursive optimization may cause # RuntimeError: maximum recursion depth exceeded import unittest class Solution(object): def trap(self, height): """ :type height: List[int] :rtype: int """ ret = 0 index...
{ "repo_name": "hanlin-he/UTD", "path": "leetcode/py/042.py", "copies": "1", "size": "2392", "license": "mit", "hash": 9176467835250468000, "line_mean": 26.8139534884, "line_max": 79, "alpha_frac": 0.4071906355, "autogenerated": false, "ratio": 3.3737658674189, "config_test": true, "has_no_key...
#04 import sqlite3 def create():#테이블 생성 con = sqlite3.connect("aledger.db") cur = con.cursor() cur.execute("CREATE TABLE IF NOT EXISTS account(account_num TEXT PRIMARY KEY, name TEXT, password TEXT, money INTEGER)") #account테이블 생성, account_num이 기본키 con.commit() con.close() def viewall():#DB에 ...
{ "repo_name": "Martialhimanshu/Account-management-system", "path": "ledger_bk.py", "copies": "1", "size": "2413", "license": "mpl-2.0", "hash": -4778451989475139000, "line_mean": 32.6, "line_max": 124, "alpha_frac": 0.6466501241, "autogenerated": false, "ratio": 1.9300766283524904, "config_test...
# 04_thermomether_f.py # From the code for the Electronics Starter Kit for the Raspberry Pi by MonkMakes.com from Tkinter import * # tkinter provides the graphical user interface (GUI) import RPi.GPIO as GPIO import time, math C = 0.38 # uF - Tweek this value around 0.33 to improve accuracy R1 = 1000 # Ohms...
{ "repo_name": "simonmonk/pi_starter_kit", "path": "04_thermometer_f.py", "copies": "1", "size": "4117", "license": "mit", "hash": -646094627912686100, "line_mean": 33.8898305085, "line_max": 102, "alpha_frac": 0.6803497692, "autogenerated": false, "ratio": 3.2726550079491257, "config_test": fal...
# 04_thermomether.py # From the code for the Electronics Starter Kit for the Raspberry Pi by MonkMakes.com from Tkinter import * # tkinter provides the graphical user interface (GUI) import RPi.GPIO as GPIO import time, math C = 0.38 # uF - Tweek this value around 0.33 to improve accuracy R1 = 1000 # Ohms B...
{ "repo_name": "simonmonk/pi_starter_kit", "path": "04_thermometer.py", "copies": "1", "size": "4074", "license": "mit", "hash": 5862957425255477000, "line_mean": 33.8205128205, "line_max": 102, "alpha_frac": 0.6833578792, "autogenerated": false, "ratio": 3.2907915993537964, "config_test": false...
# 04_thermomether.py import RPi.GPIO as GPIO import time, math from RgbLedGPIO import RgbLed GPIO.setmode(GPIO.BCM) a_pin = 25 b_pin = 8 buzzer_pin = 7 fiddle_factor = 0.9; def discharge(): GPIO.setup(a_pin, GPIO.IN) GPIO.setup(b_pin, GPIO.OUT) GPIO.output(b_pin, False) time.sleep(0.01) def charge...
{ "repo_name": "jakubmikos/rpi-python", "path": "thermometer_cmd_line.py", "copies": "1", "size": "1679", "license": "mit", "hash": -2407122687842134500, "line_mean": 20.253164557, "line_max": 47, "alpha_frac": 0.5848719476, "autogenerated": false, "ratio": 2.7569786535303775, "config_test": fal...
# 05-07-03 #v1.0.3 # ordereddict.py # A class that is a drop in replacement for an ordinary dictionary. # methods that would normally return values/items in a random manner return them # in an ordered and consistent manner. # Copyright Michael Foord # Not for use in commercial projects without permission. (A...
{ "repo_name": "tschalch/pyTray", "path": "src/util/ordereddict.py", "copies": "1", "size": "14100", "license": "bsd-3-clause", "hash": -3320459828320156000, "line_mean": 39.7159763314, "line_max": 491, "alpha_frac": 0.5981560284, "autogenerated": false, "ratio": 4.086956521739131, "config_test"...
# 05.10.2007, c # last revision: 25.02.2008 from __future__ import absolute_import from sfepy import data_dir from sfepy.mechanics.matcoefs import stiffness_from_lame filename_mesh = data_dir + '/meshes/3d/special/cube_sphere.mesh' # Whole domain $Y$. region_1000 = { 'name' : 'Y', 'select' : 'all', } # Domai...
{ "repo_name": "lokik/sfepy", "path": "tests/test_lcbc_3d.py", "copies": "5", "size": "1935", "license": "bsd-3-clause", "hash": 7444949809907624000, "line_mean": 15.9736842105, "line_max": 64, "alpha_frac": 0.484754522, "autogenerated": false, "ratio": 2.3713235294117645, "config_test": true, ...
# 05.10.2007, c # last revision: 25.02.2008 from sfepy import data_dir filename_mesh = data_dir + '/meshes/3d/special/cube_sphere.mesh' # Whole domain $Y$. region_1000 = { 'name' : 'Y', 'select' : 'all', } # Domain $Y_1$. region_1 = { 'name' : 'Y1', 'select' : 'cells of group 1', } # Domain $Y_2$. r...
{ "repo_name": "RexFuzzle/sfepy", "path": "tests/test_lcbc_3d.py", "copies": "1", "size": "1853", "license": "bsd-3-clause", "hash": -1226128184962196000, "line_mean": 15.2543859649, "line_max": 78, "alpha_frac": 0.4624932542, "autogenerated": false, "ratio": 2.3575063613231553, "config_test": t...
# 053 - Maximum Subarray (Easy) # https://leetcode.com/problems/maximum-subarray/submissions/ # Use Kadane's Algorithm! class Solution(object): def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ # Find the max subarray ending at each index. # The...
{ "repo_name": "zubie7a/Algorithms", "path": "LeetCode/01_Easy/lc_053.py", "copies": "1", "size": "2298", "license": "mit", "hash": 740295592660026200, "line_mean": 33.8181818182, "line_max": 90, "alpha_frac": 0.5857267189, "autogenerated": false, "ratio": 4.0174825174825175, "config_test": fals...
# 053. Maximum Subarray # The D&C solution, however, python is not suitable for recursion. import unittest class Solution(object): def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) == 0: return 0 if len(nums) == 1: ...
{ "repo_name": "hanlin-he/UTD", "path": "leetcode/py/053.dc.py", "copies": "1", "size": "1451", "license": "mit", "hash": -8517537093766426000, "line_mean": 27.4509803922, "line_max": 77, "alpha_frac": 0.5127498277, "autogenerated": false, "ratio": 3.0483193277310923, "config_test": true, "has...