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 |
|---|---|---|---|---|---|---|---|---|
72a07977de03d722dc6b5b5b3768202e6c6ac81f | cover coordinates detection with unit tests | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | nodeconductor/structure/tests/unittests/test_tasks.py | nodeconductor/structure/tests/unittests/test_tasks.py | # encoding: utf-8
from django.test import TestCase
from nodeconductor.structure.tests import factories
from nodeconductor.structure.tests import models
from nodeconductor.core import utils as core_utils
from nodeconductor.structure import tasks
from mock import patch
class TestTasks(TestCase):
@patch('requests.... | mit | Python | |
eee6b08e07e60a8ec1f3c2fa2e156344e01737d2 | clean out | ad-m/django-avatar,imgmix/django-avatar,therocode/django-avatar,barbuza/django-avatar,brajeshvit/avatarmodule,jezdez/django-avatar,imgmix/django-avatar,MachineandMagic/django-avatar,jezdez/django-avatar,grantmcconnaughey/django-avatar,grantmcconnaughey/django-avatar,MachineandMagic/django-avatar,dannybrowne86/django-av... | avatar/admin.py | avatar/admin.py | from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.utils import six
from django.template.loader import render_to_string
from avatar.models import Avatar
from avatar.signals import avatar_updated
from avatar.util import get_user_model
class AvatarAdmin(admin.ModelAdmi... | from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.utils import six
from django.template.loader import render_to_string
from avatar.models import Avatar
from avatar.signals import avatar_updated
from avatar.util import get_user_model
class AvatarAdmin(admin.ModelAdmi... | bsd-3-clause | Python |
2d9300aeefc840e007d7c615ce48ad36343038f2 | Add "--optimize-autoloader" to `composer.phar install` command | hperadin/FrameworkBenchmarks,xitrum-framework/FrameworkBenchmarks,testn/FrameworkBenchmarks,Synchro/FrameworkBenchmarks,jamming/FrameworkBenchmarks,actframework/FrameworkBenchmarks,ratpack/FrameworkBenchmarks,hamiltont/FrameworkBenchmarks,hperadin/FrameworkBenchmarks,zane-techempower/FrameworkBenchmarks,valyala/Framewo... | php-silex/setup.py | php-silex/setup.py | import subprocess
import sys
import setup_util
from os.path import expanduser
home = expanduser("~")
def start(args):
setup_util.replace_text("php-silex/web/index.php", "192.168.100.102", "" + args.database_host + "")
setup_util.replace_text("php-silex/deploy/php-silex", "\".*\/FrameworkBenchmarks", "\"" + home +... |
import subprocess
import sys
import setup_util
from os.path import expanduser
home = expanduser("~")
def start(args):
setup_util.replace_text("php-silex/web/index.php", "192.168.100.102", "" + args.database_host + "")
setup_util.replace_text("php-silex/deploy/php-silex", "\".*\/FrameworkBenchmarks", "\"" + home ... | bsd-3-clause | Python |
26011563bf0880206269582a87f9fff61f262c83 | add a new migration | Johnetordoff/osf.io,icereval/osf.io,TomBaxter/osf.io,CenterForOpenScience/osf.io,CenterForOpenScience/osf.io,binoculars/osf.io,brianjgeiger/osf.io,laurenrevere/osf.io,icereval/osf.io,baylee-d/osf.io,mfraezz/osf.io,cslzchen/osf.io,sloria/osf.io,crcresearch/osf.io,crcresearch/osf.io,leb2dg/osf.io,felliott/osf.io,Johnetor... | osf/migrations/0056_citationstyle_has_bibliography.py | osf/migrations/0056_citationstyle_has_bibliography.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-29 14:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('osf', '0055_auto_20170823_1648'),
]
operations = [
migrations.AddField(
... | apache-2.0 | Python | |
d637cbe9c904fb0f0b67fbc10f66db299d153f4e | Add basic smoke tests for doc generation | boto/boto3 | tests/functional/test_docs.py | tests/functional/test_docs.py | # Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | apache-2.0 | Python | |
8fb94de6b72847bdb618ffa60fa037d16bab443e | Add closing tests module | danforthcenter/plantcv,danforthcenter/plantcv,danforthcenter/plantcv | tests/plantcv/test_closing.py | tests/plantcv/test_closing.py | import pytest
import cv2
import numpy as np
from plantcv.plantcv import closing
def test_closing(test_data):
# Read in test data
bin_img = cv2.imread(test_data.small_bin_img, -1)
filtered_img = closing(gray_img=bin_img)
# Assert that the output image has the dimensions of the input image and is binary... | mit | Python | |
548f4f6512ced9a9c41a074a3c8382f87ccafa66 | add image resizing to python script and give it a better name | dagar/xkcd-1110,dagar/xkcd-1110 | xkcd1110_stitch.py | xkcd1110_stitch.py | #! /usr/bin/env python
"""Combines resized tiles grabbed from xkcd 1110 into one large png"""
import Image
import os
import sys
def coord(image_x, image_y, tilesize):
'''
converts x, y coordinates to tile naming format
'''
image_dir = "images/"
if image_x > 0:
#east
lng = "%se" %... | mit | Python | |
c32d62eb82bbe6d728d66d7544c45dfb296afcd4 | Implement regression test runner in Python | bitsuperlab/cpp-play,frrp/bitshares,camponez/bitshares,frrp/bitshares,RemitaBit/Remitabit,FollowMyVote/bitshares,bitshares/bitshares-0.x,camponez/bitshares,jakeporter/Bitshares,dacsunlimited/dac_play,FollowMyVote/bitshares,FollowMyVote/bitshares,bitshares/bitshares,frrp/bitshares,RemitaBit/Remitabit,dacsunlimited/dac_p... | tests/run_regression_tests.py | tests/run_regression_tests.py | #!/usr/bin/env python3
# this file is an experiment to run regression tests in parallel
# using Python for cross platform to run with the same script on all platforms
# (currently .sh for Linux, .bat for Windows, ??? for Mac)
import os
import queue
import subprocess
import threading
class TestRunner(object):
de... | unlicense | Python | |
c226835aa56a2d5ba8583e63c4b75765cd24711d | add new package (#27971) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-zipfile-deflate64/package.py | var/spack/repos/builtin/packages/py-zipfile-deflate64/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 PyZipfileDeflate64(PythonPackage):
"""Extract Deflate64 ZIP archives with Python's zipfile... | lgpl-2.1 | Python | |
8c6646d75ec6f9345e1582c02611984a1d953582 | add reproducing case | pabigot/pyxb,pabigot/pyxb | tests/trac/test-issue-0092.py | tests/trac/test-issue-0092.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import pyxb.binding.generate
import pyxb.utils.domutils
import xml.dom.minidom as dom
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
xsd = '''<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns... | apache-2.0 | Python | |
86d8f0fd48ccb577a8300362ea9d181e63d2fa5d | Add unit tests for bandit.core.issue | stackforge/bandit,chair6/bandit,pombredanne/bandit,pombredanne/bandit,stackforge/bandit | tests/unit/core/test_issue.py | tests/unit/core/test_issue.py | # -*- coding:utf-8 -*-
#
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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
#
# Unl... | apache-2.0 | Python | |
3d935fcc7d2d2afb004348a8839f2ec7813fe78c | Add unbound performance plugin | kadashu/satori,kadashu/satori,kadashu/satori,kadashu/satori,kadashu/satori,kadashu/satori | satori-rules/plugin/unbound/30_unbound.py | satori-rules/plugin/unbound/30_unbound.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
# -- prioritized --
import sys
import os.path
# sys.path.append(os.path.join(os.path.dirname(__file__), '../libs'))
# -- stdlib --
import json
import re
import socket
import subprocess
import time
# -- third party --
# -- own --
# -- ... | apache-2.0 | Python | |
a0714c8754c769c4fee868f2b449d9dc69d144a9 | Add Welcome plugin to welcome new members | itsmartin/nimbus,Brottweiler/nimbus,bcbwilla/nimbus,Plastix/nimbus | plugins/welcome.py | plugins/welcome.py | import json
from plugin import Plugin
class Welcome(Plugin):
"""
Welcomes new members when they join the Slack team
"""
def __init__(self):
Plugin.__init__(self)
self.event_type = 'team_join'
def on_event(self, bot, event, response):
# Get list of all channels (don't incl... | mit | Python | |
3ce048f8c0346c30173b52a691bd18ece1cbc13d | Add a TensorFlow Probability sample | zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend | scripts/stock_price/tough_question_tfp.py | scripts/stock_price/tough_question_tfp.py | #!/usr/bin/python3
# coding: utf-8
'''
Implementation of the article below with TensorFlow Probability
'Bayesian Methods for Hackers'
https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/Chapter2_MorePyMC/Ch2_MorePyMC_PyMC3.ipynb
Based on an example of Ten... | mit | Python | |
e42c115f8a612b3995e30b3606913acb7e7b0f63 | Create 2-off.py | CamJam-EduKit/EduKit1 | Code/2-off.py | Code/2-off.py | import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)
GPIO.setup(23,GPIO.OUT)
GPIO.setup(24,GPIO.OUT)
print "Lights off"
GPIO.output(18,GPIO.LOW)
GPIO.output(23,GPIO.LOW)
GPIO.output(24,GPIO.LOW)
GPIO.cleanup()
| mit | Python | |
a2214039defb1094d47b7ce0abc4e56032136508 | Add merge migration | Johnetordoff/osf.io,cslzchen/osf.io,cslzchen/osf.io,Johnetordoff/osf.io,pattisdr/osf.io,CenterForOpenScience/osf.io,pattisdr/osf.io,adlius/osf.io,mattclark/osf.io,felliott/osf.io,saradbowman/osf.io,brianjgeiger/osf.io,felliott/osf.io,aaxelb/osf.io,baylee-d/osf.io,brianjgeiger/osf.io,CenterForOpenScience/osf.io,caseyrol... | osf/migrations/0137_merge_20181011_1525.py | osf/migrations/0137_merge_20181011_1525.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-10-11 15:25
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0136_merge_20181010_2242'),
('osf', '0136_add_ember_auth_register_waffle_flag'),
... | apache-2.0 | Python | |
1a3b9eec2a947a8f036fdea80a4d7de4b7549211 | Add prime functions library | dimkarakostas/project-euler | prime_functions.py | prime_functions.py | import numpy as np
from math import sqrt
def get_primes_below(n):
# http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188
""" Input n>=6, Returns a array of primes, 2 <= p < n """
sieve = np.ones(n/3 + (n % 6 == 2), dtype=np.bool)
sieve[0] = False
... | mit | Python | |
3f01678bdcdf62d1e6e7189db6ed1337f57bdfd8 | Create rename_add_prefix.py | RedRogueXIII/MetasequoiaScripts | rename_add_prefix.py | rename_add_prefix.py | def applyPrefix( prefix, name):
test = name.find(prefix)
if test == -1 or test != 0:
name = prefix + name
return name
class renamePrefixDialog(MQWidget.Dialog):
def __init__(self, parent):
MQWidget.Dialog.__init__(self, parent)
self.title = "Add Prefix to Selected Objects"
self.frame0 = self.create... | mit | Python | |
451a65d6b5cbc182418f00703e2da84b7c346a70 | Create Dictionary._((glas+python?glaskrypt)) | bhdz/glaslang,bhdz/glaslang | Dictionary.py | Dictionary.py | #!/usr/bin/env python
#
# Basic hack
#
# What?Needed??
# Bison like parser for js
# _WHY? Because I forget things easily
class Dict(dict)
def __init__(self, keyd, *arguments,**context):
self._context = context
# Elaborate on that
class Elaboration(Dict)
pass
# To bind them together... I have n... | bsd-3-clause | Python | |
0ebddf569f291ceca050972fe9cfd3d9e498e87c | add timeout decorator | pyannote/pyannote-audio,pyannote/pyannote-audio,pyannote/pyannote-audio | pyannote/audio/utils/timeout.py | pyannote/audio/utils/timeout.py | #!/usr/bin/env python
# encoding: utf-8
# Shamelessly stolen from
# https://gist.github.com/TySkby/143190ad1b88c6115597c45f996b030c
"""Easily put time restrictions on things
Note: Requires Python 3.x
Usage as a context manager:
```
with timeout(10):
something_that_should_not_exceed_ten_seconds()
```
Usage as a... | mit | Python | |
152def3ad56af928b81586867e3c8ee85cbf5311 | Add a client application class | will-hart/blitz,will-hart/blitz | blitz/client.py | blitz/client.py | __author__ = 'Will Hart'
from blitz.io.database import DatabaseClient
from blitz.io.tcp import TcpClient
import blitz.web.api as blitz_api
import blitz.web.http as blitz_http
import logging
#import json
import os.path
import tornado.httpserver
import tornado.ioloop
import tornado.web
class Config(object):
"""... | agpl-3.0 | Python | |
ca0bec705a6c68c7540c9b7f0a02972e1f26723c | Create py-递归设置.py | ganmk/python-prctice | py-递归设置.py | py-递归设置.py | #!/usr/bin/python
# -*- encoding:utf-8 -*-
import sys
sys.setrecursionlimit(1500) # set the maximum depth as 1500
def recursion(n):
if(n <= 0):
return
print n
recursion(n - 1)
if __name__ == "__main__":
recursion(1200)
| mit | Python | |
5ade8c78e6ab875047ca29779dc37f9029a9f0d6 | Create set_auth.py | brunocfnba/docker-airflow,brunocfnba/docker-airflow | bluemix/set_auth.py | bluemix/set_auth.py | import airflow
from airflow import models, settings
from airflow.contrib.auth.backends.password_auth import PasswordUser
user = PasswordUser(models.User())
user.username = 'username'
user.email = 'your@email.com'
user.password = 'pwd'
session = settings.Session()
session.add(user)
session.commit()
session.close()
| apache-2.0 | Python | |
6ce3ae4ef4a274e76bf1f6d76f0675bec2391d17 | add first pass of maria DB slave nagiors monitor - slave_sql and slave_io checks are done | ordergroove/check_mariadb_slaves | check_mariadb_slaves.py | check_mariadb_slaves.py | #!/usr/bin/env python
"""MariaDB slave status checker"""
import sys
import argparse
import MySQLdb
class SlaveStatusCheck(object):
"""Class to help us run slave status queries against MariaDB"""
REPLICATION_LAG_MODE = 'replication_lag'
SLAVESQL_MODE = 'slave_sql'
SLAVEIO_MODE = 'slave_io'
MODES = ... | mit | Python | |
cb5b85fc4a011f7eb9628b7099311b399f4d033d | Create born_on_a_friday.py | cclauss/Ten-lines-or-less | born_on_a_friday.py | born_on_a_friday.py | #!/usr/bin/env python3
from datetime import datetime
from typing import Tuple
def ask_month_day_year(prompt: str = "Enter your birthday") -> Tuple[int, int, int]:
date = input(f"{prompt} in the format: MM/DD/YYYY ")
month, day, year = (int(x.strip()) for x in date.split("/"))
return month, day, year
de... | apache-2.0 | Python | |
576dd7270714ec63beab9ce6af22f94e20dc1dd5 | Add admin model classes to forum_tracking app | franga2000/django-machina,ellmetha/django-machina,reinbach/django-machina,reinbach/django-machina,ellmetha/django-machina,reinbach/django-machina,franga2000/django-machina,franga2000/django-machina,ellmetha/django-machina | machina/apps/forum_tracking/admin.py | machina/apps/forum_tracking/admin.py | # -*- coding: utf-8 -*-
# Standard library imports
from __future__ import unicode_literals
# Third party imports
from django.contrib import admin
# Local application / specific library imports
from machina.core.db.models import get_model
ForumReadTrack = get_model('forum_tracking', 'ForumReadTrack')
TopicReadTrack ... | bsd-3-clause | Python | |
115d17320e9fcd3eab4e60f222f382a7d551948b | Add unittests for magnumclient.v1.client module | openstack/python-magnumclient | magnumclient/tests/v1/test_client.py | magnumclient/tests/v1/test_client.py | # Copyright (c) 2015 Thales Services SAS
#
# 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 l... | apache-2.0 | Python | |
a59f86ea4905534237f9a1e055bce6a3a3d5fb81 | add migration so edit_messaging is set to True when the role has edit_data set to True | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/users/migrations/0037_add_edit_messaging_permission.py | corehq/apps/users/migrations/0037_add_edit_messaging_permission.py |
from django.db import migrations
from corehq.apps.users.models_role import SQLPermission, UserRole
from corehq.util.django_migrations import skip_on_fresh_install
@skip_on_fresh_install
def migrate_edit_migrations_permissions(apps, schema_editor):
permission, created = SQLPermission.objects.get_or_create(value=... | bsd-3-clause | Python | |
a824039003abd693ff568d753c60bb6025bfd868 | Add cleanup_slaves.py script. | eunchong/build,eunchong/build,eunchong/build,eunchong/build | scripts/tools/cleanup_slaves.py | scripts/tools/cleanup_slaves.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.
"""Removes checkouts from try slaves."""
import os
import subprocess
import sys
ROOT_DIR = os.path.join(os.path.dirname(os.path.a... | bsd-3-clause | Python | |
72467acd590ae5a3494e5059ce2ba99cf656baaa | Add IsAdminOrReadOnly permission class | rstens/gwells,bcgov/gwells,bcgov/gwells,bcgov/gwells,bcgov/gwells,rstens/gwells,rstens/gwells,rstens/gwells | registries/permissions.py | registries/permissions.py | from rest_framework.permissions import IsAdminUser, SAFE_METHODS
class IsAdminOrReadOnly(IsAdminUser):
"""
Allows read-only access to all users (including anonymous users) and write access to admin users only
"""
def has_permission(self, request, view):
is_admin = super().has_permission(reques... | apache-2.0 | Python | |
d34b2a13b454ca2c08bd5e8bc3b38d80fb5367c6 | add initial mockup of curses UI | janusnic/fzsl,janusnic/fzsl,jsbronder/fzsl,jsbronder/fzsl | pyfs/ui.py | pyfs/ui.py | import curses
import os
import sys
import pyfs
class SimplePager(object):
def __init__(self):
self._old_stdout = sys.__stdout__
self._old_stdout_fd = os.dup(sys.stdout.fileno())
os.dup2(sys.stderr.fileno(), sys.stdout.fileno())
tty = open('/dev/tty')
os.dup2(tty.fileno(), ... | bsd-3-clause | Python | |
01b9d4a491e2d732e9684d0782dcbf38df5eeec9 | Add adapters.py to new channelworm directory | gsarma/ChannelWorm,joebowen/ChannelWorm,openworm/ChannelWorm,joebowen/ChannelWorm,VahidGh/ChannelWorm,VahidGh/ChannelWorm,openworm/ChannelWorm,joebowen/ChannelWorm,VahidGh/ChannelWorm,openworm/ChannelWorm,gsarma/ChannelWorm,gsarma/ChannelWorm,cheelee/ChannelWorm,openworm/ChannelWorm,gsarma/ChannelWorm,cheelee/ChannelWo... | channelworm/adapters.py | channelworm/adapters.py | # configure django to use default settings
# note that this can also be done using an environment variable
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
if hasattr(settings, 'DEBUG'):
# settings are configured already
pass
else:
# load default settings if they're ... | mit | Python | |
f4689709f55a5e3209de7221853cb35a36699dcd | add file | hydrology-tep/documentation,hydrology-tep/documentation,hydrology-tep/documentation | check_sphinx.py | check_sphinx.py | import py
import subprocess
def test_linkcheck(tmpdir):
doctrees = tmpdir.join("_build/doctrees")
htmldir = tmpdir.join("_build/html")
subprocess.check_call(["sphinx-build", "-W", "-blinkcheck", "-d",
str(doctrees), "source", str(htmldir)])
def test_build_docs(tmpdir):
doctrees = tmpdir.join(... | cc0-1.0 | Python | |
45a1efa21162a5f1c39d8255d13d2bbca8f6c0ca | Create 7_ten_row_abacus.py | roy2020china/BingDemo | 7_ten_row_abacus.py | 7_ten_row_abacus.py | #########################################################################
# 10-row School abacus
# by
# Michael H
#########################################################################
# Description partially extracted from from wikipedia
#
# Aroun... | mit | Python | |
9207041afb78f8d36442b7ee19b95055ebbc99cd | add test forms | valdergallo/mock_django_orm | app/tests/test_form.py | app/tests/test_form.py | from django.test import TestCase
from app.forms import FormAppOne
class TestForm(TestCase):
def test_invalid_name_form(self):
form = FormAppOne({'name': '1234', 'description': 'validate name'})
self.assertFalse(form.is_valid())
self.assertEquals(form.errors, {'name': [u'Name must be only ... | mit | Python | |
a460b73861d406b14519b3e391190d1b8d7e57a9 | Add maximal margin classifier. | lidalei/DataMining | max_margin_classifier.py | max_margin_classifier.py | import numpy as np
import matplotlib.pylab as plt
from sklearn.svm import SVC
X = np.array([[3, 4], [2, 2], [4, 4], [1, 4], [2, 1], [4, 3], [4, 1]])
y = np.array(['Red', 'Red', 'Red', 'Red', 'Blue', 'Blue', 'Blue'])
linear_svm = SVC(kernel = 'linear', C = 2 ** 15)
linear_svm.fit(X, y)
## w0 * X_1 + w1 * X_2 + b = 0 <... | mit | Python | |
2e821ab48542c89ac41ebc17036bddc164506a22 | Backup of some unused code | jakelever/knowledgediscovery,jakelever/knowledgediscovery,jakelever/knowledgediscovery,jakelever/knowledgediscovery | combine_data/cartesianProductOfIDs.py | combine_data/cartesianProductOfIDs.py | import argparse
import itertools
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Generate the cartesian product of two ID files')
parser.add_argument('--idFileA',required=True,type=str,help='First file of IDs')
parser.add_argument('--idFileB',required=True,type=str,help='Second file of IDS'... | mit | Python | |
178dff5f0af375f4f49416aeb41b5d7a718d69e8 | Add python script to demystify compiler output | 1blankz7/actor-framework,DavadDi/actor-framework,1blankz7/actor-framework,DavadDi/actor-framework,DavadDi/actor-framework,1blankz7/actor-framework,actor-framework/actor-framework,actor-framework/actor-framework,nq-ebaratte/actor-framework,actor-framework/actor-framework,DavadDi/actor-framework,nq-ebaratte/actor-framewo... | scripts/demystify.py | scripts/demystify.py | #!/usr/bin/env python
# This script demystifies C++ compiler output for CAF by
# replacing cryptic `typed_mpi<...>` templates with
# `replies_to<...>::with<...>` and `atom_constant<...>`
# with human-readable representation of the actual atom.
import sys
# decodes 6bit characters to ASCII
DECODING_TABLE = ' 01234567... | bsd-3-clause | Python | |
01e551bdfbe298cdbd30734a52305be25b65147a | add docker build.py | GregDMeyer/dynamite,GregDMeyer/dynamite | docker/build.py | docker/build.py | """
This script builds Docker images for various combinations of
parameters. Should be run from inside the git tree.
"""
import sys
from os import path
from argparse import ArgumentParser
from subprocess import run, PIPE, Popen
from time import time
import shutil
def parse_args(argv=None):
if argv is None:
... | mit | Python | |
d3210b3d25a2eef7c4d066878d444b9b381243eb | add roulette | desaster/uusipuu | modules/ruletti.py | modules/ruletti.py | # -*- coding: ISO-8859-15 -*-
from twisted.internet import reactor
from core.Uusipuu import UusipuuModule
import random
class Module(UusipuuModule):
def startup(self):
self.scheduled['unban'] = []
def cmd_ruletti(self, user, target, params):
nick = user.split('!', 1)[0]
if random... | bsd-2-clause | Python | |
432cbfc65ea1e6c1b9079915cce20769b88502fe | add wrapper script to run dbify module | jaeddy/bripipetools,jaeddy/bripipetools,BenaroyaResearch/bripipetools,jaeddy/bripipetools,BenaroyaResearch/bripipetools,BenaroyaResearch/bripipetools,BenaroyaResearch/bripipetools,jaeddy/bripipetools | scripts/run_dbify.py | scripts/run_dbify.py | import logging
import os
import sys
import argparse
import _mypath
from bripipetools import genlims
from bripipetools import dbify
def parse_input_args(parser=None):
parser.add_argument('-p', '--import_path',
required=True,
default=None,
hel... | mit | Python | |
d5b3bce22aec3e84b59fad379859aa636f2d3f1a | Create ColorConvolution.py | DigitalSlideArchive/HistomicsTK,DigitalSlideArchive/HistomicsTK | ColorConvolution.py | ColorConvolution.py | import numpy
def ColorConvolution ( I, W ):
'''
Reconstructs a color image from the stain matrix "W" and the stain intensity
images generated by ColorDeconvolution.
*Inputs:
I (rgbimage) - an RGB image of type unsigned char.
W (matrix) - a 3x3 matrix containing the color vectors in col... | apache-2.0 | Python | |
67d4bc38778632b482d9c372efb41104ecabedfa | add test cases for aggregate.py | ylxdzsw/MrBam,ylxdzsw/MrBam | test/test_aggregate.py | test/test_aggregate.py | from MrBam.bam import get_reads
from MrBam.aggregate import aggregate_reads
from helper import make_bam
from argparse import Namespace
from pysam import AlignmentFile
def test_aggregate_reads_1():
"it should aggregate pairs"
o = Namespace(verbos=False, qual=20)
reads = (
("r1", 'A', 60, 2, 11, 4,... | mit | Python | |
8f718c536897711663051a613e7f50d564fb4cbc | Call repair as part of upgrade | ifduyue/sentry,zenefits/sentry,zenefits/sentry,mvaled/sentry,imankulov/sentry,mvaled/sentry,mvaled/sentry,imankulov/sentry,beeftornado/sentry,BuildingLink/sentry,fotinakis/sentry,nicholasserra/sentry,nicholasserra/sentry,alexm92/sentry,BuildingLink/sentry,ifduyue/sentry,alexm92/sentry,JackDanger/sentry,jean/sentry,Jame... | src/sentry/management/commands/upgrade.py | src/sentry/management/commands/upgrade.py | """
sentry.management.commands.upgrade
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from django.core.management import call_command
from django.core.mana... | """
sentry.management.commands.upgrade
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from django.core.management import call_command
from django.core.mana... | bsd-3-clause | Python |
6569d7e36693512fdaadfb22a5aaf6f11fe0e084 | migrate dataregistry repeater | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/motech/repeaters/management/commands/migrate_dataregistrycaseupdaterepeater.py | corehq/motech/repeaters/management/commands/migrate_dataregistrycaseupdaterepeater.py | from corehq.motech.repeaters.management.commands.migrate_caserepeater import Command as MigrateCaseRepeaters
from corehq.motech.repeaters.models import SQLDataRegistryCaseUpdateRepeater
class Command(MigrateCaseRepeaters):
@classmethod
def couch_doc_type(cls):
return 'DataRegistryCaseUpdateRepeater'
... | bsd-3-clause | Python | |
5aa5ac33d2b841fa1d9c707681a9d024168672c4 | Create cdbtabledef.py | ChristinaHammer/Client_Database | cdbtabledef.py | cdbtabledef.py | """cdbtabledef.py
Developer: Noelle Todd
Last Updated: June 5, 2014
This module will create 4 tables for the client database, using the
sqlalchemy module, and the sqlite database. This module is still in
early testing stages, and as such, is subject to many changes, and
probably contains bugs.
"""
from sqlalchemy i... | mit | Python | |
1172811d073e544d249aeba64f2b6828ee75bd5d | test geometry | leethargo/geonet | tests/test_geometry.py | tests/test_geometry.py | import numpy as np
from numpy.testing import assert_allclose
from geonet.geometry import unit_vector, angle_between
def test_unit_vector():
v1 = np.array([1, 0, 0])
assert_allclose(unit_vector(v1), v1)
v2 = np.array([1, 1, 0])
u2 = unit_vector(v2)
assert_allclose(np.linalg.norm(u2), 1.0)
def tes... | mit | Python | |
f5aab57e443e5b5a7c2507f10c0c6f608d677500 | Add simple unparser test | pjwerneck/pyrql | tests/test_unparser.py | tests/test_unparser.py | # -*- coding: utf-8 -*-
from pyrql.parser import parser
from pyrql.unparser import unparser
import pytest
@pytest.mark.parametrize('func', ['eq', 'lt', 'le', 'gt', 'ge', 'ne'])
def test_cmp_functions(func):
parsed = {'name': func, 'args': ['a', 1]}
assert unparser.unparse(parsed) == '%s(a,1)' % func
pa... | mit | Python | |
0d623e0029dc7d7d6fb0bf9634904b23f2a11732 | Add files via upload | sainzad/stackOverflowCodeIdentifier | XMLAnalyze.py | XMLAnalyze.py | # Author: Andrew Sainz
#
# Purpose: XMLParser is designed to iterate through a collection of Post data collected from Stack Overflow
# forums. Data collected to analize the code tagged information to find the language of the code
# being utilized.
#
# How to use: To run from command line input "python... | mit | Python | |
5fb7d1912eda9d6381af3e0cfa7655ed2d6795f2 | Create Xclipboard.py | adyezik/Xclipboard | Xclipboard.py | Xclipboard.py | from tkinter import Tk
__all__=['copy','paste','clear']
__author__='Calvin(Martin)Adyezik adyezik@gmail.com'
__doc__="""simple Module to work with clipboard based on tkinter -Python 3"""
__name__='Xclipboard'
def copy(text):
"""copy text to clipboard """
try:
root=Tk()
root.withdraw()
... | mit | Python | |
501454e30a93b6ec706add520a6b106940b537d9 | Create card_pick.py | andrewzwicky/puzzles | FiveThirtyEightRiddler/2017-04-21/card_pick.py | FiveThirtyEightRiddler/2017-04-21/card_pick.py | import random
from collections import Counter
import matplotlib.pyplot as plt
from multiprocessing import Pool
import numpy as np
import itertools
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
def simulate_single_run(num_cards, hand_perc, stop_percentage):
hand_size = int(num_cards * hand_perc... | mit | Python | |
1730cecbc05928e93e2dec826a67139bf6765cc6 | Add a src-side script to display a summary of host info. | chuan9/chromium-crosswalk,chuan9/chromium-crosswalk,ltilve/chromium,chuan9/chromium-crosswalk,hgl888/chromium-crosswalk,ltilve/chromium,hgl888/chromium-crosswalk,fujunwei/chromium-crosswalk,Just-D/chromium-1,Pluto-tv/chromium-crosswalk,Fireblend/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,axinging/chromium-cro... | testing/scripts/host_info.py | testing/scripts/host_info.py | #!/usr/bin/env python
# Copyright 2015 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.
import json
import multiprocessing
import os
import platform
import subprocess
import sys
import common
def is_linux():
return sy... | bsd-3-clause | Python | |
ab31fea8a0d30bc4b68813ce635880d4682cfc2f | Write base classes for collection profiles. | dseomn/cohydra | cohydra/profile.py | cohydra/profile.py | import abc
import logging
import six
class Profile(six.with_metaclass(abc.ABCMeta)):
"""Base class for all collection profiles.
Attributes:
top_dir: Where this profile's files will be stored.
parent: The profile from which this profile is derived, or
None for a root profile.
children: List o... | apache-2.0 | Python | |
c2dac9161705e6edbf5b059fd8a442c2754577ff | Add Lambda job | tomislacker/python-mke-trash-pickup,tomislacker/python-mke-trash-pickup | refusereminder.py | refusereminder.py | #!/usr/bin/env python
from __future__ import print_function
import boto3
import json
import os
from mkerefuse.refuse import RefuseQuery
from mkerefuse.refuse import RefuseQueryAddress
DEFAULT_SNS_TOPIC = 'mke-trash-pickup'
"""Default topic to notify for pickup changes"""
DEFAULT_S3_BUCKET = 'mke-trash-pickup'
"""D... | unlicense | Python | |
8cac10350cdbc33d243a561ba06c25f5d01e9a04 | fix for lists | VirusTotal/content,demisto/content,demisto/content,VirusTotal/content,demisto/content,demisto/content,VirusTotal/content,VirusTotal/content | Scripts/SearchIncidents_5.0/SearchIncidents.py | Scripts/SearchIncidents_5.0/SearchIncidents.py | from typing import Dict, List
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
special = ['n', 't', '\\', '"', '\'', '7', 'r']
def check_if_found_incident(res: List):
if res and isinstance(res, list) and isinstance(res[0].get('Contents'), dict):
if 'dat... | from typing import Dict, List
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
special = ['n', 't', '\\', '"', '\'', '7', 'r']
def check_if_found_incident(res: List):
if res and isinstance(res, list) and isinstance(res[0].get('Contents'), dict):
if 'dat... | mit | Python |
d88a473030d52529ad0abc626776bbb5d4886067 | Add tests of raw FIPS U2F commands | Yubico/yubikey-manager,Yubico/yubikey-manager | test/on_yubikey/test_fips_u2f_commands.py | test/on_yubikey/test_fips_u2f_commands.py | import unittest
from fido2.hid import (CTAPHID)
from ykman.util import (TRANSPORT)
from ykman.driver_fido import (FIPS_U2F_CMD)
from .util import (DestructiveYubikeyTestCase, is_fips, open_device)
HID_CMD = 0x03
@unittest.skipIf(not is_fips(), 'FIPS YubiKey required.')
class TestFipsU2fCommands(DestructiveYubikeyT... | bsd-2-clause | Python | |
7f1f8c53508d7cbaf3513b738dff21e6ea6e5ca1 | add script to generate multiple instance catalogs in different bands | LSSTDESC/Twinkles,DarkEnergyScienceCollaboration/Twinkles,rbiswas4/Twinkles,rbiswas4/Twinkles,DarkEnergyScienceCollaboration/Twinkles,LSSTDESC/Twinkles | twinkles/InstcatGenerator.py | twinkles/InstcatGenerator.py | """
Based upon examples by Scott Daniel (scottvalscott@gmail.com) found here:
https://stash.lsstcorp.org/projects/SIM/repos/sims_catutils/browse/python/lsst/sims/
catUtils/exampleCatalogDefinitions/phoSimCatalogExamples.py
"""
from lsst.sims.catalogs.measures.instance import CompoundInstanceCatalog
from lsst.s... | mit | Python | |
1675ecd5ea2d4aaf8d8b6aa76d007d081f92eba6 | add context processor for static | praekelt/nurseconnect,praekelt/nurseconnect,praekelt/nurseconnect | nurseconnect/context_processors.py | nurseconnect/context_processors.py | from django.conf import settings
def compress_settings(request):
return {
'STATIC_URL': settings.STATIC_URL,
'ENV': settings.ENV
}
| bsd-2-clause | Python | |
a1820a0e5f9bd891b20f70ab68dfd4bb385047a0 | Add utils to allow multiclass classification. | davidgasquez/kaggle-airbnb | utils/multiclassification.py | utils/multiclassification.py | from __future__ import division
import numpy as np
from sklearn.multiclass import OneVsOneClassifier
from sklearn.multiclass import _fit_binary
from sklearn.externals.joblib import Parallel, delayed
from unbalanced_dataset import SMOTE
def _fit_ovo_binary(estimator, X, y, i, j, sampling=None):
"""Fit a single b... | mit | Python | |
175554c4af88e4ba634976e893510f04b43442b7 | Add tool for plotting a connection box lookahead delay matrix. | SymbiFlow/symbiflow-arch-defs,SymbiFlow/symbiflow-arch-defs | utils/plot_connection_box.py | utils/plot_connection_box.py | import argparse
import capnp
import os.path
import matplotlib.pyplot as plt
from matplotlib.colors import BoundaryNorm
from matplotlib.ticker import MaxNLocator
import numpy as np
def get_connection_box(cost_map, segment, connection_box):
assert cost_map.costMap.dims[0] == cost_map.offset.dims[0]
assert cost... | isc | Python | |
83f0e2ae541b6b08b3eb6d5d8097bdfd85ccbd3c | Create ROUSE_simulation.py | Shirui816/FTinMS | ROUSE_simulation.py | ROUSE_simulation.py | import numpy as np
from scipy.linalg import toeplitz
from scipy.optimize import curve_fit
import scipy.linalg as sla
from matplotlib import pyplot as plt
from numba import jit
from sys import argv
from tqdm import tqdm
from numba import guvectorize, float64, jit
def rouse_mat(n):
ret = np.array([[-1,1] + [0] * (n-2... | bsd-3-clause | Python | |
18d11a06e1e84ece32277e0860229555aae321f0 | Add a snippet (Python). | 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/cross-platform_home_directory.py | python/cross-platform_home_directory.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
print(os.path.expanduser("~"))
| mit | Python | |
c8b78cab7a32a300e418033185595fd79a290823 | add bmf study | YcheLanguageStudio/PythonStudy | qlcoder/image_processing/bmp_python3.py | qlcoder/image_processing/bmp_python3.py | import binascii
fi = open("aaa.bmp", "rb")
header = fi.read(1078)
line = fi.read()
fi.close()
binline = ''
for i in range(0,len(line)):
binline += bin(line[i])[2:].zfill(8)
newbinline = ''
for i in range(len(binline)):
if(i%7 == 0):
newbinline+='0'
newbinline+=binline[i]
newhexline = hex(int(newb... | mit | Python | |
c9b3bd8309d3d1448823787160021a8688e8f3c1 | Add python to make vv h5 file | sot/mica,sot/mica | vv_h5_setup.py | vv_h5_setup.py | import tables
vv_desc = dict(
obsid=tables.IntCol(pos=0),
revision=tables.IntCol(pos=1),
most_recent=tables.IntCol(pos=2),
slot=tables.IntCol(pos=3),
type=tables.StringCol(10,pos=4),
n_pts=tables.IntCol(pos=5),
rad_off=tables.FloatCol(pos=6),
frac_dy_big=tables.FloatCol(pos=7),
frac_dz_big=tables.FloatCol(pos=8),
frac... | bsd-3-clause | Python | |
836c7aa92cd9d35e7d54046e835f285410780b84 | Create nodejs.py | vadimkantorov/wigwam | wigs/nodejs.py | wigs/nodejs.py | class nodejs(Wig):
git_uri = 'https://github.com/nodejs/node'
tarball_uri = 'https://github.com/nodejs/node/archive/v$RELEASE_VERSION$.tar.gz'
last_release_version = 'v4.7.2'
| mit | Python | |
1edf0898422c74173a9b6526c789b140938664b5 | add main module | imsky/quickstart,imsky/quickstart | server/__main__.py | server/__main__.py | import server | mit | Python | |
d48035b06b952b9ac4d95897d08de50d5977bf9f | Add basic test for OrderedDict. | selste/micropython,mgyenik/micropython,swegener/micropython,dhylands/micropython,feilongfl/micropython,neilh10/micropython,jmarcelino/pycom-micropython,paul-xxx/micropython,tdautc19841202/micropython,blmorris/micropython,ceramos/micropython,Timmenem/micropython,noahchense/micropython,tdautc19841202/micropython,emfcamp/... | tests/basics/ordereddict1.py | tests/basics/ordereddict1.py | try:
from collections import OrderedDict
except ImportError:
try:
from _collections import OrderedDict
except ImportError:
print("SKIP")
import sys
sys.exit()
d = OrderedDict([(10, 20), ("b", 100), (1, 2)])
print(list(d.keys()))
print(list(d.values()))
del d["b"]
print(list(... | mit | Python | |
45ccdce362694f50c43828e3923fc9e3fa32c8bb | Add list_callbacks.py | Zeex/sampgdk,WopsS/sampgdk,WopsS/sampgdk,WopsS/sampgdk,Zeex/sampgdk,Zeex/sampgdk | scripts/list_callbacks.py | scripts/list_callbacks.py | #!/usr/bin/env python2
import sys
from parse_header import *
def main(argv):
for type, name, args, attrs in get_callbacks(sys.stdin.read()):
print name
if __name__ == "__main__":
main(sys.argv)
| apache-2.0 | Python | |
f075f21b53e13d53fc26e38bcf995d55ea44df67 | Patch bump for pypi | exa-analytics/exa,tjduigna/exa,exa-analytics/exa,alexvmarch/exa,alexvmarch/exa,avmarchenko/exa,alexvmarch/exa | exa/__init__.py | exa/__init__.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
'''
Exa
#########
This package creates a systematic infrastructure for an ecosystem of packages,
tailored to specific industry or academic displines, for organizing, processin... | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
'''
Exa
#########
This package creates a systematic infrastructure for an ecosystem of packages,
tailored to specific industry or academic displines, for organizing, processin... | apache-2.0 | Python |
ec91d5106bfab93e0540e5dc4a0bbd9b7cea151b | add script to update old .h5 files to support normalization | pyannote/pyannote-audio,pyannote/pyannote-audio,pyannote/pyannote-audio | scripts/update_data_h5.py | scripts/update_data_h5.py | # update h5 files created by old versions of pyannote-speaker-embedding
# estimate mu/sigma and save it back to the file
# usage: update_data_h5.py /path/to/file.h5
import sys
import h5py
import numpy as np
from tqdm import tqdm
data_h5 = sys.argv[1]
with h5py.File(data_h5, mode='r') as fp:
X = fp['X']
weigh... | mit | Python | |
50ba17b46c7fcc7eb42a48a5ec82e295fdbeae13 | Add missing migration | aromanovich/kozmic-ci,abak-press/kozmic-ci,artofhuman/kozmic-ci,artofhuman/kozmic-ci,abak-press/kozmic-ci,aromanovich/kozmic-ci,abak-press/kozmic-ci,artofhuman/kozmic-ci,aromanovich/kozmic-ci,aromanovich/kozmic-ci,abak-press/kozmic-ci,artofhuman/kozmic-ci | migrations/versions/25ecf1c9b3fb_introduce_deploykey_entity.py | migrations/versions/25ecf1c9b3fb_introduce_deploykey_entity.py | """Introduce DeployKey entity
Revision ID: 25ecf1c9b3fb
Revises: 1c314d48261a
Create Date: 2014-02-08 02:56:34.174597
"""
# revision identifiers, used by Alembic.
revision = '25ecf1c9b3fb'
down_revision = '1c314d48261a'
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import mysql
from kozm... | bsd-3-clause | Python | |
0e833de83903c26fb3ca04c10b140c712350a12f | Create tests.py | rmotr-curriculum-testing/learn-testing-repo | unit-3-mixed-reading-and-assignment-lessons/lesson-3-assignment-one-code-block/tests.py | unit-3-mixed-reading-and-assignment-lessons/lesson-3-assignment-one-code-block/tests.py | import unittest
class ConvertTemperatureTestCase(unittest.TestCase):
def test_fahrenheit_to_celsius(self):
self.assertEqual(convert_temperature(32, to='celsius'), 0)
def test_celsius_to_fahrenheit(self):
self.assertEqual(convert_temperature(40, to='fahrenheit'), 104)
def test_default_par... | mit | Python | |
6c6d3d365e021918fe88450136a75bbac7a21d5c | add .percol.d | temmings/dotfiles,temmings/dotfiles,temmings/dotfiles,temmings/dotfiles,temmings/dotfiles | .percol.d/rc.py | .percol.d/rc.py | # Emacs like
percol.import_keymap({
"C-h" : lambda percol: percol.command.delete_backward_char(),
"C-d" : lambda percol: percol.command.delete_forward_char(),
"C-k" : lambda percol: percol.command.kill_end_of_line(),
"C-y" : lambda percol: percol.command.yank(),
"C-t" : lambda percol: percol.command... | apache-2.0 | Python | |
d7595d6d80468ec5f0e4bde86db8a431c4384ad3 | Solve 41. | klen/euler | 041/solution.py | 041/solution.py | # coding: utf-8
""" Project Euler problem #41. """
import math as mt
def problem():
u""" Solve the problem.
We shall say that an n-digit number is pandigital if it makes use of all
the digits 1 to n exactly once. For example, 2143 is a 4-digit pandigital
and is also prime.
What is the largest ... | mit | Python | |
b395239526a4246193aa9ce0e541538e5690f408 | Return change | bandarji/lekhan | python/reddit/least_bills.py | python/reddit/least_bills.py | def bills_needed(money):
"""Determine optimal numbers of each bill denomination for amount.
Args:
money, int: Amount of money to figure bills for
Returns:
cash, dict: Count of each type of bill needed for sum
"""
denominations = [1, 2, 5, 10, 20, 50, 100]
cash = {}
balance =... | apache-2.0 | Python | |
9bcb2566afa8191e24fb4f66b3fb882724ba4083 | Test ragged getitem | explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc | thinc/tests/test_indexing.py | thinc/tests/test_indexing.py | import pytest
import numpy
from numpy.testing import assert_allclose
from thinc.types import Ragged
@pytest.fixture
def ragged():
data = numpy.zeros((20, 4), dtype="f")
lengths = numpy.array([4, 2, 8, 1, 4], dtype="i")
data[0] = 0
data[1] = 1
data[2] = 2
data[3] = 3
data[4] = 4
data[5]... | mit | Python | |
f433cdb41f33a7b9daeaf276bf19d2617534e781 | Add Tensor Flow | kakaba2009/MachineLearning,kakaba2009/MachineLearning,kakaba2009/MachineLearning,kakaba2009/MachineLearning | python/src/fft/fourier_nd.py | python/src/fft/fourier_nd.py | import numpy as np
import pylab as plt
import pandas as pd
from numpy import fft
import src.mylib.mfile as mfile
def bandpass_filter(x, freq, frequency_of_signal=0, band=0.1):
if (frequency_of_signal - band) < abs(freq) < (frequency_of_signal + band):
return x
else:
return 0
d1 = mfile.loadClo... | apache-2.0 | Python | |
470063b8d468394432e729e7417c88263614b5f0 | Create msub_cluster.py | crazyhottommy/ChIP-seq-analysis | snakemake_ChIPseq_pipeline/msub_cluster.py | snakemake_ChIPseq_pipeline/msub_cluster.py | mit | Python | ||
a7b0fc1effd0e68018bc3c33f1dc0b952b23003b | update nav access restrictions | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0095_update_nav_tree_access_restrictions.py | accelerator/migrations/0095_update_nav_tree_access_restrictions.py | # Generated by Django 2.2.24 on 2022-03-29 16:24
from django.db import migrations
def update_nav_access_restrictions(apps, schema_editor):
NavTreeItem = apps.get_model('accelerator', 'NavTreeItem')
urls = ['/judging/panel/', '/judging/commitments/', '/nav/judging']
nav_items = NavTreeItem.objects.filter(... | mit | Python | |
645efb8ffcc3c9a3e41db2619430ffcb7a6d570f | Migrate Req/Ass to have verified/finished date | andrei-karalionak/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,NejcZupec/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,kr41/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,edofic/ggrc-core,andrei-karalionak/ggrc-core,kr41/ggrc-core,selahssea/ggrc-core,josthkko/ggrc-core,prasannav7/ggrc-core,prasannav... | src/ggrc/migrations/versions/20160314140338_4fd36860d196_add_finished_date_to_request_and_.py | src/ggrc/migrations/versions/20160314140338_4fd36860d196_add_finished_date_to_request_and_.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: andraz@reciprocitylabs.com
# Maintained By: andraz@reciprocitylabs.com
"""
add finished date to request and assessment
Create Date: 2016-03-14 14:... | apache-2.0 | Python | |
b05ab5401e716eab305625ad369ec5d362ae491a | add andromercury tool | eight-pack-abdominals/androguard,zhakui/androguard,HackLinux/androguard,subho007/androguard,xysec/androguard,cdht/androguard,ropik/androguard,code4bones/androguard,subho007/androguard,eight-pack-abdominals/androguard,urwithajit9/androguard,Ever-Never/androguard,eight-pack-abdominals/androguard,mohsinjuni/androguard,jba... | andromercury.py | andromercury.py | #!/usr/bin/env python
# This file is part of Androguard.
#
# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>
# All rights reserved.
#
# Androguard is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation,... | apache-2.0 | Python | |
bad82f3c77dbeebdc2332d193f0c8290c5186862 | add rudimentary api | mitdbg/aurum-datadiscovery,mitdbg/aurum-datadiscovery,mitdbg/aurum-datadiscovery,mitdbg/aurum-datadiscovery,mitdbg/aurum-datadiscovery,mitdbg/aurum-datadiscovery | frontend/app.py | frontend/app.py | import os
import sys
import inspect
import json
from flask import Flask
# move to top level
currentdir = os.path.dirname(
os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
from api.reporting import Report
from api.apiutils import Scope,... | mit | Python | |
37baa669ed1e00fabddd33478fa75f4047075ce3 | Create Python object detection script. | vancezuo/cs473-vision | cs473vision/ObjectDetector.py | cs473vision/ObjectDetector.py | '''
Created on Feb 28, 2014
@author: Vance Zuo
'''
import numpy
import cv2
class ObjectDetector(object):
'''
classdocs
'''
def __init__(self, params):
'''
Constructor
'''
self.bg_img = None
self.fg_img = None
return
def load_image(self, b... | mit | Python | |
4aacc8d55c138c405d561bbf9ddfd9ddab483e62 | add wxPython example. | devlights/try-python | trypython/extlib/gui/wx01.py | trypython/extlib/gui/wx01.py | """
wxPython についてのサンプルです
お決まりの Hello world について
REFERENCES:: http://bit.ly/2OcHRh7
"""
# noinspection PyPackageRequirements
import wx
from trypython.common.commoncls import SampleBase
class Sample(SampleBase):
def exec(self):
app = wx.App()
frm = wx.Frame(parent=None, title='Hello World')
... | mit | Python | |
9566d71a267015005ad937cd92bd105d2ffff274 | print users with multiple matching urls | tapilab/twnews,tapilab/twnews | twnews/print_urls_by_user.py | twnews/print_urls_by_user.py | """
Print users who were found for multiple urls.
user url1 score1 url2 score2 ...
"""
import codecs
from collections import defaultdict
import json
import sys
from . import __data__
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
def print_urls_by_user(tweets_file=__data__ + '/tweets.json'):
user2urls = def... | bsd-3-clause | Python | |
e5627134d9a2c052a523f66a2ec9867b3432fae2 | Test Issue #461: ent_iob tag incorrect after setting entities. | recognai/spaCy,spacy-io/spaCy,Gregory-Howard/spaCy,banglakit/spaCy,banglakit/spaCy,recognai/spaCy,aikramer2/spaCy,Gregory-Howard/spaCy,honnibal/spaCy,oroszgy/spaCy.hu,spacy-io/spaCy,aikramer2/spaCy,banglakit/spaCy,explosion/spaCy,recognai/spaCy,banglakit/spaCy,Gregory-Howard/spaCy,raphael0202/spaCy,honnibal/spaCy,aikra... | spacy/tests/tokens/test_add_entities.py | spacy/tests/tokens/test_add_entities.py | from __future__ import unicode_literals
import spacy
from spacy.vocab import Vocab
from spacy.matcher import Matcher
from spacy.tokens.doc import Doc
from spacy.attrs import *
from spacy.pipeline import EntityRecognizer
import pytest
@pytest.fixture(scope="module")
def en_vocab():
return spacy.get_lang_class('en... | mit | Python | |
7cee0980a67b827e4cf06c15e0f1c3b412f68c22 | Create main.py to actually perform the test | rkawauchi/IHK,rkawauchi/IHK | main.py | main.py | import io
import argparse
def initialize_argument_parser():
parser = argparse.ArgumentParser(description='Simulate Indian health solutions')
parser.add_argument('-s', '--solution', dest='solution',
help='the solution to test', default='health kiosk')
return vars(parser.parse_args())
if __name... | bsd-3-clause | Python | |
233c7f0152a05afcef62b596f7c90abe7e9eec90 | add a base pipeline for converting json to bigquery | Jigsaw-Code/censoredplanet-analysis,Jigsaw-Code/censoredplanet-analysis | pipeline/flatten_json.py | pipeline/flatten_json.py | """Beam pipeline for converting json scan files into bigquery tables."""
from __future__ import absolute_import
import argparse
import json
import logging
from pprint import pprint
import apache_beam as beam
from apache_beam.io import ReadFromText
from apache_beam.io.gcp.internal.clients import bigquery
from apache_... | apache-2.0 | Python | |
361c3496274a960c5e927899a39618f8fee9db0a | Add Basic Trellis Histogram to Examples | jakevdp/altair,ellisonbg/altair,altair-viz/altair | altair/vegalite/v2/examples/trellis_histogram.py | altair/vegalite/v2/examples/trellis_histogram.py | """
Trellis Histogram
-----------------
This example shows how to make a basic trellis histogram.
https://vega.github.io/vega-lite/examples/trellis_bar_histogram.html
"""
import altair as alt
cars = alt.load_dataset('cars')
chart = alt.Chart(cars).mark_bar().encode(
x=alt.X("Horsepower",
type="quantit... | bsd-3-clause | Python | |
a7e8b3a2b63ed4717a783754446b30c4f288e76a | Create channelinfo.py | appu1232/Selfbot-for-Discord | cogs/channelinfo.py | cogs/channelinfo.py | import discord
from discord.ext import commands
from random import randint, choice
class Channelinfo:
"""Shows Channel infos."""
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=['channel', 'cinfo', 'ci'], pass_context=True, no_pm=True)
async def channelinfo(self, ctx, *, chan... | mit | Python | |
333453fe6a74d7bada941ee7aeed3660452efcaf | add tests | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | tests/install_tests/test_cupy_builder/test_command.py | tests/install_tests/test_cupy_builder/test_command.py | from cupy_builder._command import filter_files_by_extension
def test_filter_files_by_extension():
sources_cpp = ['a.cpp', 'b.cpp']
sources_pyx = ['c.pyx']
sources = sources_cpp + sources_pyx
assert filter_files_by_extension(
sources, '.cpp') == (sources_cpp, sources_pyx)
assert filter_file... | mit | Python | |
8a7963644ff470fc7da8bc22a7f3fd6ef1be3ed2 | define password generator. | soasme/rio,soasme/rio,soasme/rio | rio/utils/token.py | rio/utils/token.py | # -*- coding: utf-8 -*-
"""
rio.utils.token
~~~~~~~~~~~~~~~
"""
import random
import string
def password_generator(length):
"""Generate a random password.
:param length: integer.
"""
return ''.join(random.choice(string.ascii_lowercase + string.digits)
for _ in range(length))
| mit | Python | |
1d4397860ffd297eb02b5f4b96b0e18a3c7e12cd | Add test recipes. | ulule/django-badgify,ulule/django-badgify | badgify/tests/recipes.py | badgify/tests/recipes.py | # -*- coding: utf-8 -*-
from ..recipe import BaseRecipe
from ..compat import get_user_model
class BadRecipe(object):
pass
class NotImplementedRecipe(BaseRecipe):
pass
class Recipe1(BaseRecipe):
name = 'Recipe 1'
slug = 'recipe1'
description = 'Recipe 1 description'
@property
def image... | mit | Python | |
f6c07ad620f7e3ef73fdad5f2d97d1dd911e390f | Create signal.py | mh-g/check-mk_signal-cli,mh-g/check-mk_signal-cli | signal.py | signal.py | #!/usr/bin/python3
# Send via Signal
import os
from pydbus import SystemBus
from dateutil import parser
from datetime import datetime
eventhostname=os.environ.get ("NOTIFY_HOSTNAME", "<no host>")
eventdatetimeString=os.environ.get ("NOTIFY_LONGDATETIME", "<no time>")
if eventdatetimeString == "<no time>":
eventda... | mit | Python | |
269e9821a52f1d68e2a48beb76b20c227dc84b55 | add 0007(count one file omitting multiple-line comment) | lz199144/python,ZSeaPeng/python,haiyangd/python-show-me-the-code-,Yrthgze/prueba-sourcetree2,DIYgod/python,hooting/show-me-the-code-python,ZSeaPeng/python,yangzilong1986/python,dominjune/python,xiaoixa/python,Jaccorot/python,luoxufeiyan/python,JiYouMCC/python,merfii/PythonExercises,zhenglaizhang/python,karnikamit/pytho... | robot527/0007/count_codes.py | robot527/0007/count_codes.py | #! usr/bin/python3
"""
第 0007 题:有个目录,里面是你自己写过的程序,统计一下你写过多少行代码。
包括空行和注释,但是要分别列出来。
"""
class PyfileInfo:
def __init__(self, file):
self.file_name = file
self.total_line_num = 0
self.blank_line_num = 0
self.comment_line_num = 0
def count_lines(self):
if self.file_... | mit | Python | |
74d8390dce4dd5a8fe8a6f7f4304b80afadfec1d | Add basic calendar framework | chrisfrederickson/firepi,chrisfrederickson/firepi,chrisfrederickson/firepi,chrisfrederickson/firepi | app/calender.py | app/calender.py | class CalenderManager:
def __init__(self):
pass
def add_event(self, user, starttime, endtime):
pass
def get_current_event(self):
#Return NONE if no event
pass
def remove_event(self, id):
pass
def get_upcoming_events(self, num):
pass | mit | Python | |
93a03023cf0c73b78680d431c828f4b9ebc49802 | add disk_cache.py | EscapeLife/web_crawler | 3.下载缓存/3.disk_cache.py | 3.下载缓存/3.disk_cache.py | #!/usr/bin/env python
# coding:utf-8
import os
import re
import zlib
import shutil
import urlparse
import cPickle as pickle
from datetime import datetime, timedelta
from link_crawler import link_crawler
class DiskCache:
"""通过使用磁盘空间保存文件的方式对资源文件进行缓存
"""
def __init__(self, cache_dir='cache', expires=timede... | mit | Python | |
9c33c1e7fcaf111e7a590b035974aa288bbe5895 | Create weechat script | fwilson42/bot-regime,fwilson42/bot-regime | czar.py | czar.py | SCRIPT_NAME = 'czar'
SCRIPT_AUTHOR = 'Samuel Damashek <samuel.damashek@gmail.com>'
SCRIPT_VERSION = '1.0'
SCRIPT_LICENSE = 'GPL3'
SCRIPT_DESC = 'Run czar commands natively in WeeChat'
SCRIPT_COMMAND = 'czar'
try:
import weechat
except ImportError:
print('This script must be run under WeeChat.')
print('Get ... | bsd-3-clause | Python | |
af19c62cfa27f27cd37bf558ac77a7845dff7754 | Create generate_chapters.py | satishgoda/leo-editor-tutorial | sandbox/generate_chapters.py | sandbox/generate_chapters.py | @language python
VOLUME = 'II'
TOTAL_CHAPTERS = 42
URL = "http://www.feynmanlectures.caltech.edu/{0}_{1:02}.html"
copied_position = p.copy()
for index in range(1, TOTAL_CHAPTERS+1):
new_node = copied_position.insertAsLastChild()
new_node.h = "@chapter {0} Chapter {1:02} - ".format(VOLUME, index)
new_node... | mit | Python | |
48115d48da43f7f4517d8f55edee95d6c9e7cc45 | Create saveGraphToFile.py | mobile2015/neoPyth,mobile2015/neoPyth,mobile2015/neoPyth | save-load/saveGraphToFile.py | save-load/saveGraphToFile.py | from py2neo import Graph, Node, Relationship
graph = Graph()
# Get username
usr_name = input("Enter username: ")
print ("Username: " + usr_name)
# Get user_id
usr_id = input("Enter user id: ")
print ("User id: " + usr_id)
print("Nodes")
resultsAllNodes = graph.cypher.execute("MATCH (n) RETURN n")
print(resultsAllNode... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.