commit
stringlengths
40
40
subject
stringlengths
4
1.73k
repos
stringlengths
5
127k
old_file
stringlengths
2
751
new_file
stringlengths
2
751
new_contents
stringlengths
1
8.98k
old_contents
stringlengths
0
6.59k
license
stringclasses
13 values
lang
stringclasses
23 values
f3c9284bf7b5d9ae4acc413fd7feb824fdb7aca0
create field to exclude recomputation of old invoices
OCA/l10n-italy,dcorio/l10n-italy,dcorio/l10n-italy,OCA/l10n-italy,OCA/l10n-italy,dcorio/l10n-italy
l10n_it_fatturapa_in/migrations/12.0.1.18.3/pre-migration.py
l10n_it_fatturapa_in/migrations/12.0.1.18.3/pre-migration.py
from openupgradelib import openupgrade @openupgrade.migrate() def migrate(env, version): if not version: return openupgrade.logged_query( env.cr, """ ALTER TABLE fatturapa_attachment_in ADD COLUMN IF NOT EXISTS invoices_date character varying """, )
agpl-3.0
Python
60068d4deeba541b9518579d6d8473c4300e189d
Test killing onitu during a transfer
onitu/onitu,onitu/onitu,onitu/onitu
tests/functional/test_crash.py
tests/functional/test_crash.py
import os.path from os import unlink from utils.launcher import Launcher from utils.entries import Entries from utils.loop import CounterLoop, BooleanLoop from utils.files import generate, checksum from utils.tempdirs import TempDirs launcher = None dirs = TempDirs() rep1, rep2 = dirs.create(), dirs.create() json_fil...
mit
Python
e541d2c6c9c71647201ad39eb8a774eabe243139
Add gaussian smoothing example (#485)
akaszynski/vtkInterface
examples/01-filter/gaussian-smoothing.py
examples/01-filter/gaussian-smoothing.py
""" Gaussian smoothing ~~~~~~~~~~~~~~~~~~ Perform a gaussian convolution. """ import pyvista as pv from pyvista import examples # Load dataset data = examples.download_gourds() # Define a good point of view cp = [ (319.5, 239.5, 1053.7372980874645), (319.5, 239.5, 0.0), (0.0, 1.0, 0.0) ] ##############...
mit
Python
59d435ab1d0e5347180f60633d316aa7f2a3abdb
add send_TWH_text module to package
Timothy-W-Hilton/TimPyUtils
timutils/send_TWH_txt.py
timutils/send_TWH_txt.py
""" short module to send a text message to Tim Hilton's phone using Verizon's email-to-sms support and gmail's smtp mail server. I was unable to get UC Merced's outlook.com server to accept the outgoing message. Timothy W. Hilton, UC Merced, 25 Feb 2014 """ import smtplib import getpass def get_outgoing_mail_passwo...
mit
Python
4ef17b96531a511b7ad620a0753594a2892af65c
Add monte_carlo_multigpu.py
cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy
examples/finance/monte_carlo_multigpu.py
examples/finance/monte_carlo_multigpu.py
import argparse import contextlib import sys import time import cupy import numpy from black_scholes import black_scholes_kernel from monte_carlo import monte_carlo_kernel # CuPy also implements a feature to call kernels in different GPUs. # Through this sample, we will explain how to allocate arrays # in different ...
mit
Python
2b4c065b986ca1e05d0755b2b64502861b17364d
add import script for Oldham
DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations
polling_stations/apps/data_collection/management/commands/import_oldham.py
polling_stations/apps/data_collection/management/commands/import_oldham.py
from data_collection.management.commands import BaseXpressCsvImporter class Command(BaseXpressCsvImporter): council_id = 'E08000004' addresses_name = 'OldhamPropertyPostCodePollingStationWebLookup-2017-02-16.TSV' stations_name = 'OldhamPropertyPostCodePollingStationWebLookup-2017-02-16.TSV' ele...
bsd-3-clause
Python
1064b7bc9e343f3ab9308172f6a3129745e7a548
add test.py
gabstopper/smc-python
test.py
test.py
#!/usr/bin/python import smc from pprint import pprint import time import logging logger = logging.getLogger(__name__) smc.login('http://172.18.1.150:8082', 'EiGpKD4QxlLJ25dbBEp20001') #Example of using a search filter #Response is a json record with a reference link to the object #smc.get_element_by_href(href) ge...
apache-2.0
Python
fa2fd9cdab29a5736ae6b69c5f754f92a33c7f74
add wsgi.py
xuanthuong/golfgame
wsgi.py
wsgi.py
from server import app if __name__ == "__main__": app.run()
mit
Python
f4e12493c000b6bb3051e9c201347d420c8dd687
add basis for netcomp class
schae234/Camoco,schae234/Camoco
camoco/NetComp.py
camoco/NetComp.py
from .COB import COB class NetComp(Camoco): def __init__(self,name,networks): self.networks = set() # Add all the networks for n in networks: self.add_network(n) def add_network(self,net): ''' Add a network (COB) to the NetComp object. ...
mit
Python
2a3b89f42cde7088b304a3f224eaf52894f544ec
Add an python example for stream testing
xfleckx/BeMoBI,xfleckx/BeMoBI
misc/utils/LSL_Tests/RecieveAppStatistics.py
misc/utils/LSL_Tests/RecieveAppStatistics.py
"""Example program to show how to read a multi-channel time series from LSL.""" from pylsl import StreamInlet, resolve_stream import sys # first resolve an EEG stream on the lab network print("looking for an Unity3D.AppStatistics stream...") streams = resolve_stream('type', 'Unity3D.FPS.FT') # create a new inlet to r...
mit
Python
52c7d6ba8f6dcb6c6f1bd02790ab9bb7fae8ebcd
add script
adamewing/tebreak,adamewing/tebreak
scripts/grabBAMrecs.py
scripts/grabBAMrecs.py
#!/usr/bin/env python import sys import pysam import os import re from collections import defaultdict as dd import logging logger = logging.getLogger(__name__) FORMAT = '%(asctime)s %(message)s' logging.basicConfig(format=FORMAT) logger.setLevel(logging.INFO) def find_mate(read, bam): ''' AlignmentFile.mate() ...
mit
Python
6ad72a0c624abdda0df8d5c49366bfc597a12340
Add tests for utils experiment module
NLeSC/cptm,NLeSC/cptm
cptm/tests/test_utils_experiment.py
cptm/tests/test_utils_experiment.py
from nose.tools import assert_equal, assert_false from os import remove from os.path import join from json import dump from cptm.utils.experiment import load_config, add_parameter, thetaFileName, \ topicFileName, opinionFileName, tarFileName, experimentName def setup(): global jsonFile global config ...
apache-2.0
Python
f73800f8e4ccd76d858c08d8cc8a72a6f2274fb6
Validate settings a tad later
kingosticks/mopidy,pacificIT/mopidy,mopidy/mopidy,hkariti/mopidy,adamcik/mopidy,glogiotatidis/mopidy,rawdlite/mopidy,mokieyue/mopidy,jodal/mopidy,dbrgn/mopidy,jmarsik/mopidy,abarisain/mopidy,jodal/mopidy,mokieyue/mopidy,mopidy/mopidy,liamw9534/mopidy,quartz55/mopidy,bencevans/mopidy,swak/mopidy,quartz55/mopidy,rawdlite...
mopidy/__main__.py
mopidy/__main__.py
import logging import multiprocessing import optparse import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))) from mopidy import get_version, settings, SettingsError from mopidy.core import CoreProcess from mopidy.utils import get_class from mopidy.utils.log import...
import logging import multiprocessing import optparse import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))) from mopidy import get_version, settings, SettingsError from mopidy.core import CoreProcess from mopidy.utils import get_class from mopidy.utils.log import...
apache-2.0
Python
69b715ab99522967a6b1bb8f4abfc4f2b1e60912
check most of the analyzer code by importing the analyzer itself
cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo
tests/windows/test_analyzer.py
tests/windows/test_analyzer.py
# Copyright (C) 2017 Cuckoo Foundation. # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org # See the file 'docs/LICENSE' for copying permission. def test_analyzer(): """Simply imports the analyzer module to at least load most of the code.""" import analyzer analyzer # Fake usage.
mit
Python
4853257696373d248884efd1532af8a81c34ee93
Add LiveComposite creation helper script
bitsawer/renpy-shader,bitsawer/renpy-shader
tools/create_live_composite.py
tools/create_live_composite.py
""" Helper script for cropping images and creating a RenPy LiveComposite for them. Quite specific and mostly useful for processing images exported from a rendering program like Blender or from Photoshop layers. Requires Pillow Python image processing library to be installed. Command line example ...
mit
Python
e74571c6505bdf99a94fc27dd1ea60e23f55db0a
Add strace_inputs.py to strace a test executable and detect its dependencies.
gavinp/chromium,gavinp/chromium,yitian134/chromium,yitian134/chromium,gavinp/chromium,yitian134/chromium,gavinp/chromium,yitian134/chromium,yitian134/chromium,ropik/chromium,adobe/chromium,yitian134/chromium,adobe/chromium,ropik/chromium,ropik/chromium,gavinp/chromium,adobe/chromium,adobe/chromium,gavinp/chromium,gavin...
tools/isolate/strace_inputs.py
tools/isolate/strace_inputs.py
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Runs strace on a test and processes the logs to extract the dependencies from the source tree. Automatically extracts directori...
bsd-3-clause
Python
e94192a4c549e46ae0a155dbfa634ebde992903a
Create netntlm2hashcat.py
ins1gn1a/NetNTLM2HashCat,ins1gn1a/NetNTLM2HashCat
netntlm2hashcat.py
netntlm2hashcat.py
#!/usr/bin/env python import sys import re import argparse # Arg Input (Like a pirate) p = argparse.ArgumentParser(description='Convert NetNTLM John Hashes to Hashcat Format') p.add_argument('-i','--hash',action='store_true',help='Enter one-time hash input mode',required=False) p.add_argument('-f','--file',dest='file...
mit
Python
e3b025ae738b6aff8fb873bb41d1cc13e0845131
Create geddit-backend.py
azimos/geddit
geddit-backend.py
geddit-backend.py
#!/usr/bin/python import requests import json # Import modules for CGI handling import cgi, cgitb # Create instance of FieldStorage form = cgi.FieldStorage() # Get data from fields user_title = form.getvalue('search_title') print "Content-type: text/html\n\n"; # Setting attributes to send to Wikipedia API ba...
mit
Python
e6e5fbb671c2539f4f82c6eaca51fbf400133482
Write a silly Python script to compute some hard coded info from the generated ARM match table, which is substantially more efficient than dealing with tblgen.
GPUOpen-Drivers/llvm,chubbymaggie/asap,dslab-epfl/asap,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,llvm-mirror/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,dslab-epfl/asap,apple/swift-llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,chubbymaggie/asap,apple/swift...
utils/Target/ARM/analyze-match-table.py
utils/Target/ARM/analyze-match-table.py
#!/usr/bin/env python def analyze_match_table(path): # Extract the instruction table. data = open(path).read() start = data.index("static const MatchEntry MatchTable") end = data.index("\n};\n", start) lines = data[start:end].split("\n")[1:] # Parse the instructions. insns = [] for ln ...
apache-2.0
Python
5b2c1650059f9e4b69b6bab1d8ce88177f449e02
Add basic test for import
iModels/foyer,mosdef-hub/foyer,mosdef-hub/foyer,iModels/foyer
foyer/tests/test_external_forcefields.py
foyer/tests/test_external_forcefields.py
import pytest def test_basic_import(): import foyer assert 'external_forcefields' in dir(foyer) import foyer.external_forcefields
mit
Python
e5d58cc795541b5e4e8f791a441a4369df17ee19
Add first exercise
MindCookin/python-exercises
cuadradoDentroDeRangoDado.py
cuadradoDentroDeRangoDado.py
#!/usr/bin/env python def main(): def cuadr(num): return num * num def nom_cuad(num): return ("%d -> %d") % (num, cuadr(num)) def promptCuadr(): myNum1 = input("Enter num1: ") myNum2 = input("Enter num2: ") minimum = min(myNum1, myNum2) maximum = max(myNum1, myNum2) arr = [nom_cua...
apache-2.0
Python
aab833a4a267ed46e83a5968e87d357ae3a5a12b
Add new DemoStream example corresponding to the LSL4Unity Project
xfleckx/BeMoBI_Tools,xfleckx/BeMoBI_Tools,xfleckx/BeMoBI_Tools
utils/LSL_Tests/RecieveDemoStream.py
utils/LSL_Tests/RecieveDemoStream.py
"""Example program to show how to read a marker time series from LSL.""" import sys sys.path.append('./pylsl') # help python find pylsl relative to this example program from pylsl import StreamInlet, resolve_stream # first resolve an EEG stream on the lab network targetStreamType = 'Unity.Quaternion' print 'looking fo...
mit
Python
897371dac52c38b96b6a1a92cd8ce36e9b2d1003
Add django admin page for HQOauthApplication
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
corehq/apps/hqwebapp/admin.py
corehq/apps/hqwebapp/admin.py
from django.contrib import admin from corehq.apps.hqwebapp.models import HQOauthApplication @admin.register(HQOauthApplication) class HQOauthApplicationAdmin(admin.ModelAdmin): list_display = ( "id", "application_id", "application_name", "application_user", "application_client_type", "application...
bsd-3-clause
Python
09a8f4efcfc99f7add4d055465de621a47f06ee8
Add management command to sanitize 2fa sessions
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
corehq/apps/hqadmin/management/commands/clean_2fa_sessions.py
corehq/apps/hqadmin/management/commands/clean_2fa_sessions.py
from getpass import getpass from importlib import import_module from packaging import version from pkg_resources import DistributionNotFound, get_distribution from django.conf import settings from django.core.cache import caches from django.core.management.base import BaseCommand class Command(BaseCommand): help...
bsd-3-clause
Python
fb884d3453b42b68aa7ecc7b0523bf1460b6b9e0
Add missing EFS patch
cloudtools/troposphere,cloudtools/troposphere
scripts/patches/efs.py
scripts/patches/efs.py
patches = [ { "op": "replace", "path": "/ResourceTypes/AWS::EFS::AccessPoint/Properties/AccessPointTags/ItemType", "value": "Tag", }, { "op": "replace", "path": "/ResourceTypes/AWS::EFS::FileSystem/Properties/FileSystemTags/ItemType", "value": "Tag", }, ]
bsd-2-clause
Python
1ae811c79b1cbc28b2f71e8f2bb01b44cc3aa2b9
Improve import malware hashes cron
gdestuynder/MozDef,Phrozyn/MozDef,jeffbryner/MozDef,jeffbryner/MozDef,ameihm0912/MozDef,gdestuynder/MozDef,jeffbryner/MozDef,gdestuynder/MozDef,mozilla/MozDef,mozilla/MozDef,mpurzynski/MozDef,mozilla/MozDef,Phrozyn/MozDef,jeffbryner/MozDef,ameihm0912/MozDef,ameihm0912/MozDef,mozilla/MozDef,Phrozyn/MozDef,mpurzynski/Moz...
cron/import_malware_hashes.py
cron/import_malware_hashes.py
#!/usr/bin/env python # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # Copyright (c) 2017 Mozilla Corporation # # Contributors: # Brandon Myers bmyers@mozilla.com imp...
mpl-2.0
Python
58852970847bab30fee18e6ab824b24bc75d389f
Add the package-cleaning script
prophile/polypkg,prophile/polypkg
clean-packages.py
clean-packages.py
# WARNING: HERE BE DRAGONS import yaml import os.path import urllib.parse from copy import deepcopy urllib.parse.uses_relative.append('github') urllib.parse.uses_netloc.append('github') with open('packages.yaml') as f: package_db = yaml.load(f) def strip_prefix(prefix, url): for n in range(len(url) - 1, 0, ...
mit
Python
2e0fbcb3ec1c2f0311d7ee4bbfeac33662f66089
Monitor process using subprocess module
PSJoshi/python_scripts
monitor_process.py
monitor_process.py
import subprocess """ If the program is running "ps -ef | grep program" will return 2 or more rows (one with the program itself and the second one with "grep program"). Otherwise, it will only return one row ("grep program") You can trigger the alert on this if required. """ def monitor_process(name): args=['ps',...
apache-2.0
Python
0ae60d170c3a8fd33fac3b1283e646a7018027df
Add expertise removal migration
ctsit/qipr_approver,DevMattM/qipr_approver,ctsit/qipr_approver,DevMattM/qipr_approver,ctsit/qipr_approver,ctsit/qipr_approver,DevMattM/qipr_approver,DevMattM/qipr_approver,ctsit/qipr_approver,DevMattM/qipr_approver
qipr_approver/approver/migrations/0007_auto_20170227_1533.py
qipr_approver/approver/migrations/0007_auto_20170227_1533.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-02-27 15:33 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('approver', '0006_auto_20170222_1424'), ] operations = [ migrations.RemoveFi...
apache-2.0
Python
b629a8e6346359683e637fd8e2f34f1d704ad1bc
Add missing test
vahtras/util
test/test_full.py
test/test_full.py
import numpy as np from util.full import matrix def assert_(this, ref): print this print ref assert np.allclose(this, ref) def test_diag(): ref = [[1, 0, 0], [0, 1, 0], [0, 0, 1]] this = matrix.diag([1,1,1]) assert_(this, ref)
mit
Python
5e9b804ef20d71aa84cb4d3cdd8b3bad9863cf11
add validator
arturtamborski/wypok,arturtamborski/wypok,arturtamborski/wypok,arturtamborski/wypok
sections/validators.py
sections/validators.py
import re from django.core.validators import RegexValidator section_name_validator = RegexValidator( r'^[a-zA-Z][a-zA-Z0-9]{1,19}$', 'This field can contain only characters a-zA-Z0-9 and be max 20 characters long', code='invalid' )
mit
Python
e7db8f3dc4d945185a99b5b62ae0b528959651ac
add python version
Respekt1/linux_scripts_generall
versioncheck/python_version.py
versioncheck/python_version.py
from invoke import task from subprocess import call import invoke def check_invoke_version(ctx): minimal_verion = "0.15.0" if minimal_verion > invoke.__version__: print("Your python-invoke version is too old (currently "+invoke.__version__+"). Please update to version "+minimal_verion+" or higher.") ...
bsd-2-clause
Python
39cbea7183a77495173b10aef4d9f6ac10ad15f6
Add initial layout of resources
chop-dbhi/django-objectset,chop-dbhi/django-objectset
objectset/resources.py
objectset/resources.py
from django.conf.urls import patterns, url from django.http import HttpResponse from restlib2.resources import Resource from restlib2.http import codes from restlib2.params import Parametizer, param_cleaners from preserialize.serialize import serialize SET_OPERATIONS = { 'and': '__and__', 'or': '__or__', '...
bsd-2-clause
Python
ca9ed2756a12a2587f5b4d021597d2229196da50
Add migration to add china region
prattl/teamfinder,prattl/teamfinder,prattl/teamfinder,prattl/teamfinder
api/common/migrations/0007_add_china_region.py
api/common/migrations/0007_add_china_region.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-06-24 21:52 from __future__ import unicode_literals from django.db import migrations def forwards(apps, schema_editor): Region = apps.get_model('common.Region') region_to_add = 'China' try: Region.objects.get(name=region_to_add) exc...
apache-2.0
Python
680b2cb1488f83aef5b45476e23bd93a90069872
Create Content Loader app to Herd/DM standards - Configure Pyinstaller
FINRAOS/herd,FINRAOS/herd,FINRAOS/herd,FINRAOS/herd,FINRAOS/herd
herd-code/herd-tools/herd-content-loader/herdcl/hook-otags.py
herd-code/herd-tools/herd-content-loader/herdcl/hook-otags.py
hiddenimports = [ 'numpy', 'pandas._libs.tslibs.timedeltas', 'pandas._libs.tslibs.nattype', 'pandas._libs.tslibs.np_datetime', 'pandas._libs.skiplist' ]
apache-2.0
Python
56d14e7b0386588afd39f2413fafe0b9ba41806d
Access checking unit tests for SlotsTransferAdminPage.
rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son
tests/app/soc/modules/gsoc/views/test_slot_transfer_admin.py
tests/app/soc/modules/gsoc/views/test_slot_transfer_admin.py
# Copyright 2013 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
apache-2.0
Python
db446bf6dc4255f556f20235d2bdc28fa056ad46
Add list_owners.py to list shared folder owners
blokeley/backup_dropbox,blokeley/dfb
list_owners.py
list_owners.py
"""List all shared folders and their owners.""" import logging import os from typing import Iterator import dropbox from backup import File, setup_logging, get_members, get_files def get_folder_members(team: dropbox.DropboxTeam, folder: File) \ -> Iterator[dropbox.shar...
apache-2.0
Python
1c094fe58df0fa57884752be7f64ee9755e433f1
Create __init__.py
tKhan719/Theta
tests/__init__.py
tests/__init__.py
mit
Python
6edc4700f755380b8b9099ae78619cbd225a2790
add API tests
pfe-asr-2014/tsp-mooc-overview,pfe-asr-2014/tsp-mooc-overview
tests/api_test.py
tests/api_test.py
import overview, unittest, mock, json from overview.services import Services class ApiV1Test(unittest.TestCase): def send_patch_json(self, url, json_data): return self.app.patch(url, data = json.dumps(json_data), headers = [('Content-Type', 'application/json')]) def se...
mit
Python
0347d82e55382b9618158c4c5809c360e729c245
Create neworld_client.py
soul2867/OMOOC2py
_src/om2py4w/4wex0/neworld_client.py
_src/om2py4w/4wex0/neworld_client.py
#/usr/bin/env python # -*- coding: utf-8 -*- import sys # sys.setdefaultencoding() does not exist, here! reload(sys) # Reload does the trick! sys.setdefaultencoding('UTF8') from lxml import html import requests def read_note(): page = requests.get('http://localhost:8080/neworld') tree = html.fromstring(...
mit
Python
3a4c922d353df5f5b3f3cabe24b04090b0a3fd08
test the serve command
mattrobenolt/warehouse,robhudson/warehouse,techtonik/warehouse,techtonik/warehouse,mattrobenolt/warehouse,mattrobenolt/warehouse,robhudson/warehouse
tests/test_cli.py
tests/test_cli.py
# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
apache-2.0
Python
2299343d8b10658cc6682b23dbf9be9d5fd290f6
Add unit test for data integrity.
c4fcm/WhatWeWatch-Analysis,c4fcm/WhatWeWatch-Analysis,c4fcm/WhatWeWatch-Analysis
tests/testdata.py
tests/testdata.py
import ConfigParser import csv import unittest class DataTest(unittest.TestCase): def setUp(self): config = ConfigParser.RawConfigParser() config.read('../app.config') # Load the data from the csv into an array self.data = [] with open('../data/%s' % config.get('data', ...
bsd-3-clause
Python
78aebc48763b15dedc3aee65a18a2a39f46e5c30
add run module
zeaphoo/cocopot,zeaphoo/flagon
flagon/run.py
flagon/run.py
def run_simple(hostname, port, application, use_reloader=False, use_debugger=False): from wsgiref.simple_server import make_server from wsgiref.simple_server import WSGIRequestHandler, WSGIServer pass
mit
Python
b9399dbdfff80fec21cfed926779b67589835047
Create LettCombPhoneNum_002.py
cc13ny/algo,cc13ny/algo,Chasego/cod,Chasego/codi,cc13ny/algo,Chasego/codi,Chasego/codi,Chasego/cod,cc13ny/Allin,Chasego/codi,Chasego/codirit,cc13ny/Allin,Chasego/codirit,Chasego/codirit,cc13ny/algo,cc13ny/Allin,cc13ny/algo,cc13ny/Allin,Chasego/codirit,Chasego/codirit,Chasego/cod,Chasego/cod,Chasego/cod,Chasego/codi,cc1...
leetcode/017-Letter-Combinations-of-a-Phone-Number/LettCombPhoneNum_002.py
leetcode/017-Letter-Combinations-of-a-Phone-Number/LettCombPhoneNum_002.py
class Solution(object): def letterCombinations(self, digits): """ :type digits: str :rtype: List[str] """ def comb(digits, d2l): if not digits: return [""] res = [] for c in d2l[int(digits[0])]: ...
mit
Python
d92eff7e89e09167b126f99243986eae5792f705
Add py-debtcollector (#25212)
LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack
var/spack/repos/builtin/packages/py-debtcollector/package.py
var/spack/repos/builtin/packages/py-debtcollector/package.py
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyDebtcollector(PythonPackage): """ A collection of Python deprecation patterns and st...
lgpl-2.1
Python
6bd4b7e4c2dac2817250f184114eea8c05fbefb7
Add compat.py to get get_user_model working
Alir3z4/django-cuser
cuser/compat.py
cuser/compat.py
from __future__ import unicode_literals from django.conf import settings from django.core.exceptions import ImproperlyConfigured import django from django.utils.functional import lazy __all__ = ['User', 'AUTH_USER_MODEL'] # Django 1.5+ compatibility if django.VERSION >= (1, 5): AUTH_USER_MODEL = settings.AUTH_US...
bsd-3-clause
Python
422390ff7eb4d97eaf0c5c1a1b250010ee766ec7
Add tool for clean pyc files
xcgspring/AXUI,xcgspring/AXUI,xcgspring/AXUI
tools/cleanPYC.py
tools/cleanPYC.py
import re import os import sys print("%s path\n" % sys.argv[0]) path = sys.argv[1] for root, dirs, files in os.walk(path): for file_ in files: if re.match(".*.pyc$", file_): abs_file = os.path.join(root, file_) print("Clean %s" % abs_file) os.remove(abs_file)
apache-2.0
Python
3aacdb44210ca5af86bc9258eaecc1bbbda4ea7f
Implement colorization in it's own file
mmorenobarm/mbed-os,c1728p9/mbed-os,ryankurte/mbed-os,bcostm/mbed-os,rgrover/mbed,svogl/mbed-os,CalSol/mbed,geky/mbed,j-greffe/mbed-os,andreaslarssonublox/mbed,betzw/mbed-os,theotherjimmy/mbed,radhika-raghavendran/mbed-os5.1-onsemi,nRFMesh/mbed-os,mazimkhan/mbed-os,svogl/mbed-os,bcostm/mbed-os,pradeep-gr/mbed-os5-onsem...
tools/colorize.py
tools/colorize.py
""" mbed SDK Copyright (c) 2016 ARM Limited Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing...
apache-2.0
Python
0d0115ef5e088ed54a176e24cc94713b706f3d55
include migration
wwitzel3/awx,wwitzel3/awx,wwitzel3/awx,snahelou/awx,snahelou/awx,snahelou/awx,snahelou/awx,wwitzel3/awx
awx/main/migrations/0015_v300_label_changes.py
awx/main/migrations/0015_v300_label_changes.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('main', '0014_v300_invsource_cred'), ] operations = [ migrations.AlterField( model_name='label', name...
apache-2.0
Python
5db256e6ac4ee84e008afa8f94d767330e392709
Increase coverage
proyectos-analizo-info/pybossa-analizo-info,PyBossa/pybossa,Scifabric/pybossa,OpenNewsLabs/pybossa,inteligencia-coletiva-lsd/pybossa,CulturePlex/pybossa,inteligencia-coletiva-lsd/pybossa,CulturePlex/pybossa,harihpr/tweetclickers,geotagx/pybossa,geotagx/pybossa,OpenNewsLabs/pybossa,jean/pybossa,CulturePlex/pybossa,stefa...
test/test_vmcp.py
test/test_vmcp.py
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2013 SF Isle of Man Limited # # PyBossa is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at...
agpl-3.0
Python
0a3e00b27606eda26917c3c69b0344dc301502f0
Revert "will this fix tests?"
zestyr/lbry,lbryio/lbry,zestyr/lbry,lbryio/lbry,zestyr/lbry,lbryio/lbry
tests/__init__.py
tests/__init__.py
# log_support setups the default Logger class # and so we need to ensure that it is also # setup for the tests from lbrynet.core import log_support
mit
Python
3dbef22cee9ea83c7e80756037209334da237d4c
Remove unused compat types from compat.py
Hasimir/twython,vivek8943/twython,ping/twython,Fueled/twython,ryanmcgrath/twython,Oire/twython,fibears/twython,joebos/twython,Devyani-Divs/twython,akarambir/twython
twython/compat.py
twython/compat.py
import sys _ver = sys.version_info #: Python 2.x? is_py2 = (_ver[0] == 2) #: Python 3.x? is_py3 = (_ver[0] == 3) try: import simplejson as json except ImportError: import json if is_py2: from urllib import urlencode, quote_plus try: from urlparse import parse_qsl except ImportError: ...
import sys _ver = sys.version_info #: Python 2.x? is_py2 = (_ver[0] == 2) #: Python 3.x? is_py3 = (_ver[0] == 3) try: import simplejson as json except ImportError: import json if is_py2: from urllib import urlencode, quote_plus try: from urlparse import parse_qsl except ImportError: ...
mit
Python
f10049ae831570b54581c2a089218359febe5c50
add command for exporting to csv
tswicegood/django-fecfilings
fecfilings/management/commands/fecfilings_to_csv.py
fecfilings/management/commands/fecfilings_to_csv.py
from django.core.management.base import NoArgsCommand from fecfilings.models import Contributor class Command(NoArgsCommand): def handle(self, **options): for c in Contributor.objects.all(): print c.to_csv()
apache-2.0
Python
23165cbd1ac8ba1528649c04b56d598664e1da8b
Enhance mysensors binary sensor device classes (#13367)
tchellomello/home-assistant,Cinntax/home-assistant,jawilson/home-assistant,home-assistant/home-assistant,PetePriority/home-assistant,nkgilley/home-assistant,postlund/home-assistant,MartinHjelmare/home-assistant,persandstrom/home-assistant,auduny/home-assistant,molobrakos/home-assistant,molobrakos/home-assistant,aequita...
homeassistant/components/binary_sensor/mysensors.py
homeassistant/components/binary_sensor/mysensors.py
""" Support for MySensors binary sensors. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/binary_sensor.mysensors/ """ from homeassistant.components import mysensors from homeassistant.components.binary_sensor import ( DEVICE_CLASSES, DOMAIN, BinarySe...
""" Support for MySensors binary sensors. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/binary_sensor.mysensors/ """ from homeassistant.components import mysensors from homeassistant.components.binary_sensor import ( DEVICE_CLASSES, DOMAIN, BinarySe...
apache-2.0
Python
60ffb1d13f00851377960eb76c90a7ef4592d03c
Create kivy_android_carousel.py
skorokithakis/pythess-files,skorokithakis/pythess-files,skorokithakis/pythess-files
009---Nine-Nine/kivy_android_carousel.py
009---Nine-Nine/kivy_android_carousel.py
#!/usr/bin/python # -*- coding: utf-8 -*- import kivy from kivy.app import App from kivy.uix.button import Button from kivy.uix.image import Image from kivy.uix.label import Label from kivy.uix.scatter import Scatter from kivy.uix.screenmanager import Screen, ScreenManager, FadeTransition from kivy.uix.floatlayout imp...
mit
Python
c9f70c7a4a24be0cdd9dcf044a06051b0978efff
add exceptions
lorehov/json-rpc,clach04/json-rpc
jsonrpc/exceptions.py
jsonrpc/exceptions.py
class JSONRPCError(object): """ Error for JSON-RPC communication. When a rpc call encounters an error, the Response Object MUST contain the error member with a value that is a Object with the following members: code: A Number that indicates the error type that occurred. This MUST be an intege...
mit
Python
2947a2c9b6348d248e3ae740722d6a7aa04327c0
add reg d included definitions
cfpb/regulations-configs,ascott1/regulations-configs,grapesmoker/regulations-configs,willbarton/regulations-configs
regconfig/reg_d.py
regconfig/reg_d.py
from regparser.default_settings import * #### Regulation D INCLUDE_DEFINITIONS_IN_PART_1004 = [ ('Alternative mortgage transaction', 'Alternative mortgage transaction'), ('Creditor', 'Creditor'), ('State', 'State'), ('State law', 'State law'), ] INCLUDE_DEFINITIONS_IN['1004'] = INCLUDE_DEFINITIONS_IN...
cc0-1.0
Python
1e32a27b35e25e780e8af6cc76d1eb424328171b
add leetcode Populating Next Right Pointers in Each Node
Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code
leetcode/PopulatingNextRightPointersinEachNode/solution.py
leetcode/PopulatingNextRightPointersinEachNode/solution.py
# -*- coding:utf-8 -*- # Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # self.next = None class Solution: # @param root, a tree node # @return nothing def connect(self, root): ...
mit
Python
b220410ad51413d52076bec84a3bf1a660f9883b
Add a program that says Hello Shikha
ctsit/J.O.B-Training-Repo-1
helloShikha.py
helloShikha.py
#This is my hello world program print 'Hello Shikha!'
apache-2.0
Python
5a120774bae2d9775493c6806841a97e790b266e
Create citreo_code_v2.py
ujjwalkarn/DataSciencePython,ujjwalkarn/DataSciencePython
Logistic-Regression/citreo_code_v2.py
Logistic-Regression/citreo_code_v2.py
from datetime import datetime from csv import DictReader from math import exp, log, sqrt # parameters ################################################################# train = 'train.csv' # path to training file test = 'test.csv' # path to testing file D = 2 ** 20 # number of weights use for learning alpha = .1...
mit
Python
557652d4b4297dd80d844915c3d57fc3e46ac83a
add graham's solution:
pycam/python-functions-and-modules,pycam/python-basic,pycam/python-basic,pycam/python-functions-and-modules
solutions/4_21_grsr.py
solutions/4_21_grsr.py
import sys for line in sys.stdin: line = line.rstrip() pop, sample_id, sample_name, sex = line.split(",") if (sample_id == sys.argv[1]): print "Found", sample_id
unlicense
Python
8db04e5d648c9e923f7977f456242d9ea9b80050
Create pig_latin.py
Souloist/Projects,Souloist/Projects,Souloist/Projects,Souloist/Projects,Souloist/Projects
solutions/pig_latin.py
solutions/pig_latin.py
def pig_latin(input_string): new_string = [] for i in input_string.split(): if i[0] not in "aeiou": i = i[1:]+i[0] i +="ay" new_string.append(i) return ' '.join(new_string) def main(): user_input = str(raw_input("Please give me a phrase: ")) print pig_latin(user_input) if __name__ == '__main__': main()...
mit
Python
f5460adbaeb87421a7f193a700d25e5a3c6e4351
Create crypt.py
liyupi/self-python-tools
crypt.py
crypt.py
from itertools import cycle def crypt(source,key): result="" a=cycle(key) for ch in source: result+=chr(ord(ch)^ord(next(a))) return result if __name__=="__main__": source=input("输入想要加密/解密的字串:") key=input("输入密钥:") print("加密/解密成功!密码为:"+crypt(source,key))
mit
Python
5ed7db70874f3ebfe9c946d38ccf12228dacac3a
Test if we tried to commit with an empty message, it should raise a ValueError
PressLabs/pyolite,shawkinsl/pyolite
tests/test_git.py
tests/test_git.py
from unittest import TestCase from mock import MagicMock, patch from nose.tools import raises from pyolite.git import Git class TestGit(TestCase): @raises(ValueError) def test_commit_with_no_message(self): mock_repo = MagicMock() mock_index = MagicMock() mock_remotes = MagicMock() mock_repo.in...
bsd-2-clause
Python
1a3d9b3da91a5c87316e44498a876f70a49df8ad
add 70
ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler
python/p070.py
python/p070.py
import utils def is_perm(a, b): return sorted(str(a)) == sorted(str(b)) best = (10000, 1) primes = [ i for i in utils.primes(4000) if i > 2000 ] for i in primes: for j in primes: n = i * j if n > 10**7: break phi = (i - 1) * (j - 1) ratio = (n * 1.0) / phi ...
bsd-3-clause
Python
c4764ef1aa1a1aaa0ae8dd909c3578705c7a2060
add 77
ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler
python/p077.py
python/p077.py
import utils primes = utils.primes(100) def count(target): ways = [0] * (target + 1) ways[0] = 1 for p in primes: for j in xrange(p, target + 1): ways[j] += ways[j - p] return ways[target] for target in xrange(2, 100): if count(target) > 5000: print target b...
bsd-3-clause
Python
9a237141c9635d2a1dad6349ad73d24e969d8460
Add runner
subutux/HUD,subutux/HUD
hud-runner.py
hud-runner.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Convenience wrapper for running hud directly from source tree.""" from hud.hud import main if __name__ == '__main__': main()
mit
Python
bfb7d8d9356fe66f433556977a333e4256c6fb61
Create series.py
RonsenbergVI/trendpy,RonsenbergVI/trendpy
trendpy/series.py
trendpy/series.py
# series.py # MIT License # Copyright (c) 2017 Rene Jean Corneille # 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 Software without restriction, including without limitation the rights # to use, co...
mit
Python
250d1c20c16b6c0846a9fb94ef4ebc6e780221df
Create solution.py
lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges
hackerrank/algorithms/implementation/easy/equalize_the_array/py/solution.py
hackerrank/algorithms/implementation/easy/equalize_the_array/py/solution.py
def solution(nums): import collections if len(nums) == 0: return 0 item, count = collections.Counter(nums).most_common()[0] return len(nums) - count n = int(input()) nums = tuple(map(int, input().split())) cnt = solution(nums) print(cnt)
mit
Python
fca6421c53e286549d861c65c114991602f310ea
Add some adaptors.
drtconway/pykmer
pykmer/adaptors.py
pykmer/adaptors.py
""" This module provides some adaptors for converting between different data formats: `k2kf` Convert a sequence of k-mers to k-mer frequency pairs `kf2k` Convert a sequence of k-mer frequency pairs to k-mers `keyedKs` Provide keyed access to a sequence of k-mers `keyedKFs` Provide keyed access to a...
apache-2.0
Python
b7f3e32827bb9a0f122928d218f4d535febb0829
add command
xuwei0455/design_patterns
Command.py
Command.py
# -*- coding: utf-8 -*- """ Command pattern """ from os import listdir, curdir class ListCommand(object): def __init__(self, path=None): self.path = path or curdir def execute(self): self._list(self.path) @staticmethod def _list(path=None): print 'list path {} :'.format(p...
mit
Python
bd865a9fdc941b99be40a5ba3dcc02b819b2e9da
add cpm.utils.refstring
nodepy/nodepy-pm,nodepy/nodepy
cpm/utils/refstring.py
cpm/utils/refstring.py
# Copyright (c) 2017 Niklas Rosenstein # # 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 Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, d...
mit
Python
edb904ca105abfb767f94f366e19ed05374a8014
Create URL Shortner
harshfatepuria/data-analysis-test,harshfatepuria/data-analysis-test,harshfatepuria/data-analysis-test,harshfatepuria/data-analysis-test
URLShortner.py
URLShortner.py
import uuid import json import os from glob import iglob from pprint import pprint mapping={} mapping['URL']=[] #Getting JSON file of initial Tika parsing containing list of file paths categorized by MIME types file="C:/Users/rahul/Documents/GitHub/Scientific-Content-Enrichment-in-the-Text-Retrieval-Conference-TREC-Po...
apache-2.0
Python
62a13341610d476ba8ff9e3fd5a3476cbdb18225
Create convert.py
manasRK/glove-gensim
convert.py
convert.py
import gensim #word2vec embeddings start with a line with the number of lines (tokens?) and the number of dimensions of the file. This allows #gensim to allocate memory accordingly for querying the model. Larger dimensions mean larger memory is held captive. Accordingly, this line #has to be inserted into the GloVe em...
mit
Python
5d5ccc84eaaec6b6d749a9054f744a5a44f9dac9
add script for reading from PCF8574
lnitram/pi-playground,lnitram/pi-playground
i2c/PCF8574.py
i2c/PCF8574.py
#!/usr/bin/python import sys import smbus import time # Reads data from PCF8574 and prints the state of each port def readPCF8574(busnumber,address): address = int(address,16) busnumber = int(1) bus = smbus.SMBus(busnumber) state = bus.read_byte(address); for i in range(0,8): port = "port...
mit
Python
b792a8cb3d61dbac1c48a16585c7bb6725bc06a0
add barebones
riceissa/ssg-riceissa.com
barebones_ssg/ssg.py
barebones_ssg/ssg.py
# hack to get unicode working with jinja2 import sys reload(sys) sys.setdefaultencoding('utf-8') import glob import metadata as meta from tag_ontology import * import commands as c import json from jinja2 import Template, Environment, FileSystemLoader import os pages_pat = "pages/*.md" pages_lst = glob.glob(pages_p...
bsd-2-clause
Python
ddbe9de5cfc5b412812096291db6a37d120e03ce
add plotting the distribution of fields and apgoee
jobovy/apogee-maps
py/plot_dustwapogee.py
py/plot_dustwapogee.py
############################################################################### # plot_dustwapogee: plot the dust-map at 5 kpc with the APOGEE fields in the # sample overlayed ############################################################################### import sys import numpy import healpy from ga...
bsd-3-clause
Python
139a634515061674d3832320791d35ff512d8a5a
Add a snippet.
jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets
python/print_stderr.py
python/print_stderr.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys print("Error message", file=sys.stderr)
mit
Python
2909b4a7e46fe4a466e0c99abf90222c43f34d93
add tests for Every Election wrapper
DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations
polling_stations/apps/data_finder/tests/test_ee_wrapper.py
polling_stations/apps/data_finder/tests/test_ee_wrapper.py
import mock from django.test import TestCase from data_finder.helpers import EveryElectionWrapper # mock get_data() functions def get_data_exception(self, postcode): raise Exception() def get_data_no_elections(self, postcode): return [] def get_data_with_elections(self, postcode): return [ {}, ...
bsd-3-clause
Python
67d760f0a3ed081d43237e1b2106b86a4e6a56c6
add log handler
jhao104/proxy_pool,jhao104/proxy_pool
Util/LogHandler.py
Util/LogHandler.py
# -*- coding: utf-8 -*- """ ------------------------------------------------- File Name: LogHandler.py Description : Author : JHao date: 2017/3/6 ------------------------------------------------- Change Activity: 2017/3/6: log handler --------------------------------...
mit
Python
7331e1d1061a7a1ac9abc583d45746facfde9180
Create search-in-a-binary-search-tree.py
tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015
Python/search-in-a-binary-search-tree.py
Python/search-in-a-binary-search-tree.py
# Time: O(h) # Space: O(1) # Given the root node of a binary search tree (BST) and a value. # You need to find the node in the BST that the node's value equals the given value. # Return the subtree rooted with that node. # If such node doesn't exist, you should return NULL. # # For example, # # Given the tree: # ...
mit
Python
58311387849f8785fa964eb01e728c92bc0d8b61
Create levenshtein.py
MathYourLife/similarity_scores
levenshtein.py
levenshtein.py
# source: http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance def levenshtein(source, target): if len(source) < len(target): return levenshtein(target, source) # So now we have len(source) >= len(target). if len(target) == 0: return len(source) # We c...
mit
Python
a5b012db4cb4cc8a988c0ed37411194639dd1bbd
add tester.py module to pytools
spacetelescope/stsci.tools
lib/tester.py
lib/tester.py
#!/usr/bin/env python """ Package: pytools Author: Christopher Hanley Purpose: ======== Provide driver function for package tests. Dependencies: ============= - nose 0.10.4 or greater. Usage Example: ============== All packages will need to import jwtools.tester and add the following function to the __init__.py of...
bsd-3-clause
Python
6efc045d34f432723b52aa094c1caec3bf102e96
add sparse repeated updates benchmark
diogo149/treeano,diogo149/treeano,diogo149/treeano
benchmarks/sparse_repeated_updates.py
benchmarks/sparse_repeated_updates.py
import numpy as np import theano import theano.tensor as T fX = theano.config.floatX s = theano.shared(np.ones((10, 1), dtype=fX)) idxs = [0, 1, 1] fn = theano.function([], updates=[(s, T.inc_subtensor(s[idxs], s[idxs] ** 2))]) fn() print s.get_value()
apache-2.0
Python
4b43906004f9bfb6164bb2c0b95efaf1dbb881c8
add py
daiz713/Apricot,daiz713/Apricot,daiz713/Apricot,daiz713/Apricot
correction_image.py
correction_image.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Project Apricot # Copyright (c) 2015 Daiki, Takanori.
mit
Python
fc44d4463045e458796d13b3c97b34cf6ba47f61
Add script to create the player pitch weights.
isuraed/bluechip
bluechip/player/createpitchweights.py
bluechip/player/createpitchweights.py
import random from player.models import Player, Pitch, PlayerPitchWeight #TODO: Need to centralize this function call. random.seed(123456789) pitch_records = Pitch.objects.all().order_by('id') pitches_count = pitch_records.count() for p in Player.objects.all(): weights = [] sum_weights = 0 for _ in xrange(pitches_...
mit
Python
d3f68c385da4d2fa864ba748f41785be01c26c34
Add py solution for 551. Student Attendance Record I
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
py/student-attendance-record-i.py
py/student-attendance-record-i.py
class Solution(object): def checkRecord(self, s): """ :type s: str :rtype: bool """ A = False L = 0 for c in s: if c == 'L': L += 1 if L > 2: return False else: L = 0 ...
apache-2.0
Python
a1ee4d90e0cf159f27274423b989c98844fbeba1
Create mytask1b.py
john136/exercises
ml/mytask1b.py
ml/mytask1b.py
""" Features The objective of this task is to explore the corpus, deals.txt. The deals.txt file is a collection of deal descriptions, separated by a new line, from which we want to glean the following insights: 1. What is the most popular term across all the deals? 2. What is the least popular term across all t...
mit
Python
714e2e2ae5e8412ef522dc64666e6548307eec07
Add the init method to the topic model.
yiyangyi/cc98-tornado
model/topic.py
model/topic.py
class TopicModel(Query): def __init__(self, db): self.db = db self.table_name = "topic" super(TopicModel, self).__init__()
mit
Python
168c45fa913670c7f6d89ffc799fa9d13454d734
add multi-layer convolutional net for mnist
mnannt/mnist_experiments
multi-layer.py
multi-layer.py
""" solving mnist classification problem using tensorflow multi-layer architecture """ # Config BATCH_SIZE = 50 ITERATIONS = 20000 # Setup Logging import logging logging_format = '%(asctime)s - %(levelname)s - %(message)s' log_level = logging.DEBUG logging.basicConfig(filename='logfile.log',format=logging_format,leve...
mit
Python
c795f8e21d2b400134cb52ef7eae2cc7e26cfd99
Create ada.py
mduckles/CodeClub
ada.py
ada.py
mit
Python
028831c53d27452168b7a430eb713e01c966acb0
add privacy policy as first legal check
masschallenge/django-accelerator,masschallenge/django-accelerator
accelerator/migrations/0006_add_privacy_policy_legal_check.py
accelerator/migrations/0006_add_privacy_policy_legal_check.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2018-05-14 09:09 from __future__ import unicode_literals from django.db import migrations def add_privacy_policy_legal_check(apps, schema_editor): LegalCheck = apps.get_model('accelerator', 'LegalCheck') LegalCheck.objects.create( name='accepted...
mit
Python
a2975adeedcc4aa33ee8b63bd404675bb3453089
Add broker app.
LegionXI/pydarkstar,AdamGagorik/pydarkstar
apps/broker.py
apps/broker.py
""" Alter item database. """ import logging import sys import os # import hack to avoid PYTHONPATH try: import pydarkstar except ImportError: root = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) root, dirs, files = next(os.walk(root)) if 'pydarkstar' in dirs: sys.path.insert(1, r...
mit
Python
edb498113441acb68511a478f2ec18c1be4f1384
Add tests for provision state commands
openstack/python-ironicclient,NaohiroTamura/python-ironicclient,openstack/python-ironicclient,NaohiroTamura/python-ironicclient
ironicclient/tests/functional/osc/v1/test_baremetal_node_provision_states.py
ironicclient/tests/functional/osc/v1/test_baremetal_node_provision_states.py
# Copyright (c) 2016 Mirantis, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
apache-2.0
Python
7dbab1a6615a49513fe16c74550ddf2f52b0f698
Create 4-keys-keyboard.py
tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,yiwen-luo...
Python/4-keys-keyboard.py
Python/4-keys-keyboard.py
# Time: O(n) # Space: O(1) class Solution(object): def maxA(self, N): """ :type N: int :rtype: int """ if N <= 6: return N dp = [i for i in range(N+1)] for i in xrange(7, N+1): dp[i % 6] = max(dp[(i-4) % 6]*3,dp[(i-5) % 6]*4) ...
mit
Python
be9c88b630ea243afdef3d87ac0b316bd3300281
Add 283-move-zeroes.py
mvj3/leetcode
283-move-zeroes.py
283-move-zeroes.py
""" Question: Move Zeroes Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3, 12, 0, 0]. Note: You must do this in-place...
mit
Python
5d7f2fdfb1b850aacaf29ba76c7e5ed441e6db63
Create 32losmasgrandes.py
ManuComp/Los-2-mas-altos
32losmasgrandes.py
32losmasgrandes.py
#Integrantes del equipo #Chavez Pavon Jose Manuel #Ramirez Ramirez Servando #Saules Rojas David #Lopez Adriana import random #Funcino para crear una lista #La cual usaremos para simular las alturas de las 32 personas #La llenaremos de forma aleatoria def lista (): l = [] #Creamos la lista de las "alturas" for x i...
unlicense
Python
a7ccd7bc02476cfad85280ff1e742671453360de
Add Digital Outcomes and Specialists to frameworks
alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api
migrations/versions/420_dos_is_coming.py
migrations/versions/420_dos_is_coming.py
"""DOS is coming Revision ID: 420 Revises: 410_remove_empty_drafts Create Date: 2015-11-16 14:10:35.814066 """ # revision identifiers, used by Alembic. revision = '420' down_revision = '410_remove_empty_drafts' from alembic import op import sqlalchemy as sa from app.models import Framework def upgrade(): op.e...
mit
Python
273f0bd289d62c6980f095b0a8bb41a973b0678f
add import script for Bradford
DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations
polling_stations/apps/data_collection/management/commands/import_bradford.py
polling_stations/apps/data_collection/management/commands/import_bradford.py
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter class Command(BaseXpressDemocracyClubCsvImporter): council_id = 'E08000032' addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017.tsvJune2017.tsv' stations_name = 'parl.2017-06-08/Version 1/Democracy_Club__0...
bsd-3-clause
Python
12ba7e0c6db91f5ee46a1be9acaece110f98b911
add bigwig file reader
ronin-gw/PyMaSC,ronin-gw/PyMaSC
PyMaSC/bwreader.py
PyMaSC/bwreader.py
import os import wWigIO class BigWigFile(object): @staticmethod def wigToBigWig(wigfile, sizefile, bwfile): wWigIO.wigToBigWig(wigfile, sizefile, bwfile) @staticmethod def bigWigToWig(bwfile, wigfile): wWigIO.bigWigToWig(bwfile, wigfile) def __init__(self, path, chrom_size=None)...
mit
Python