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 |
|---|---|---|---|---|---|---|---|---|
255ce1edb94cb26b46d25a2de59c94d37c89826c | create contributor table | odarbelaeze/condor-ir,odarbelaeze/lsa-program | alembic/versions/37aac5545240_create_contributor_table.py | alembic/versions/37aac5545240_create_contributor_table.py | """create contributor table
Revision ID: 37aac5545240
Revises: 5d2851b90057
Create Date: 2016-04-23 17:59:57.155034
"""
# revision identifiers, used by Alembic.
revision = '37aac5545240'
down_revision = '5d2851b90057'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrad... | mit | Python | |
329c3d31b76b22c481278a7c0994c9a7ba3f2852 | Add new buyer email domain table | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | migrations/versions/1020_add_buyer_email_domain_table.py | migrations/versions/1020_add_buyer_email_domain_table.py | """Add buyer email domain table
Revision ID: 1020
Revises: 1010
Create Date: 2017-10-10 15:18:22.683693
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1020'
down_revision = '1010'
def upgrade():
op.create_table(
'buyer_email_domains',
sa... | mit | Python | |
fc329aa687d707dd17a36b3c3dd28332a65cd9a4 | Index Patch.project_id | bowlofstew/changes,dropbox/changes,dropbox/changes,dropbox/changes,dropbox/changes,bowlofstew/changes,wfxiang08/changes,wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,wfxiang08/changes,bowlofstew/changes | migrations/versions/34157be0e8a2_index_patch_project_.py | migrations/versions/34157be0e8a2_index_patch_project_.py | """Index Patch.project_id
Revision ID: 34157be0e8a2
Revises: f8ed1f99eb1
Create Date: 2014-01-02 21:59:37.076886
"""
# revision identifiers, used by Alembic.
revision = '34157be0e8a2'
down_revision = 'f8ed1f99eb1'
from alembic import op
def upgrade():
op.create_index('idx_patch_project_id', 'patch', ['project... | apache-2.0 | Python | |
b8ed13edb510b7b16ae0d832147358992112a628 | Add example definition file | opencorato/represent-boundaries,datamade/represent-boundaries,opencorato/represent-boundaries,opencorato/represent-boundaries,datamade/represent-boundaries,datamade/represent-boundaries | definition.example.py | definition.example.py | from datetime import date
import boundaries
boundaries.register('Federal electoral districts', # The name of the boundary set
# Generic singular name for a boundary from this set. Optional if the
# boundary set's name ends in "s".
singular='Federal electoral district', # If this were omitted, the same val... | mit | Python | |
ec396a29547347ad81c02e7252019e0ea1483bb2 | Add base task class | Cosiek/KombiVojager | base_task.py | base_task.py | #!/usr/bin/env python
# encoding: utf-8
from itertools import permutations
from math import sqrt, pow
class Node(object):
def __init__(self, name, x, y):
self.name = name
self.x = x
self.y = y
class BaseTask(object):
# base data (needs to be passed to init)
start = None
finis... | mit | Python | |
0a347cc3d0ade18027e8fb3de5b234d2d9dc0fc5 | Create gleu_score.py | nltk/nltk,nltk/nltk,nltk/nltk | nltk/translate/gleu_score.py | nltk/translate/gleu_score.py | # -*- coding: utf-8 -*-
# Natural Language Toolkit: GLEU Score
#
# Copyright (C) 2001-2016 NLTK Project
# Authors:
# Contributors:
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
""" GLEU score implementation. """
from __future__ import division
from collections import Counter
from nltk.util impo... | apache-2.0 | Python | |
275f542cf313ccd74a4ec2c210d7f08edee29c53 | Create derivative_compare.py | rupertsmall/numerical-tools,rupertsmall/numerical-tools | derivative_compare.py | derivative_compare.py | #program for finding the derivative of an arbitrary function
#this program asks the user to choose between the standard formula or the three-point formula, or compare, which outputs both
from math import *
NUM_POINTS = 200 #number of points per unit interval. of course, cannot exceed 10e308
EPSILON = .2*sqrt(10... | mit | Python | |
718f1c50fb8a2cd6fdc0376f8c6af1142c54a1e8 | Add regression test for #1491 | aikramer2/spaCy,explosion/spaCy,aikramer2/spaCy,explosion/spaCy,spacy-io/spaCy,recognai/spaCy,aikramer2/spaCy,honnibal/spaCy,recognai/spaCy,recognai/spaCy,aikramer2/spaCy,spacy-io/spaCy,aikramer2/spaCy,aikramer2/spaCy,explosion/spaCy,recognai/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy,recognai/... | spacy/tests/regression/test_issue1491.py | spacy/tests/regression/test_issue1491.py | # coding: utf8
from __future__ import unicode_literals
import pytest
import regex as re
from ...lang.en import English
from ...tokenizer import Tokenizer
@pytest.mark.xfail
def test_issue1491():
"""Test possible off-by-one error in tokenizer prefix/suffix/infix rules."""
prefix_re = re.compile(r'''[\[\("']'... | mit | Python | |
d32372bfaef73520b47ab665a2a6a4802b93ec8c | Move admin from cms_plugin_filer | skirsdeda/django-filer,jakob-o/django-filer,skirsdeda/django-filer,skirsdeda/django-filer,divio/django-filer,stefanfoulis/django-filer,stefanfoulis/django-filer,stefanfoulis/django-filer,jakob-o/django-filer,stefanfoulis/django-filer,webu/django-filer,skirsdeda/django-filer,skirsdeda/django-filer,divio/django-filer,div... | filer/admin/thumbnailoptionadmin.py | filer/admin/thumbnailoptionadmin.py | from django.contrib import admin
from filer.models import ThumbnailOption
class ThumbnailOptionAdmin(admin.ModelAdmin):
list_display = ('name', 'width', 'height')
| bsd-3-clause | Python | |
7326087147917888891a0c68e79b8c58cd5bc978 | add disable_autoscroll extension | dekstop/ipython_extensions,dekstop/ipython_extensions,minrk/ipython_extensions,danielballan/ipython_extensions,minrk/ipython_extensions,dekstop/ipython_extensions,danielballan/ipython_extensions,danielballan/ipython_extensions,minrk/ipython_extensions,NunoEdgarGub1/ipython_extensions,NunoEdgarGub1/ipython_extensions,Nu... | disable_autoscroll.py | disable_autoscroll.py | """
Extension for disabling autoscrolling long output, which is super annoying sometimes
Usage:
%load_ext disable_autoscroll
You can also put the js snippet below in profile_dir/static/js/custom.js
"""
from IPython.display import display, Javascript
disable_js = """
IPython.OutputArea.prototype._should_scroll ... | bsd-3-clause | Python | |
2e5184a438e709e410ce27ae6a0c2cda35b6fa30 | Create black-holes.py | Pouf/CodingCompetition,Pouf/CodingCompetition | CiO/black-holes.py | CiO/black-holes.py | from itertools import combinations
from math import pi, acos, hypot
def dist(a, b):
return hypot(a[0]-b[0], a[1]-b[1])
def area(r):
return pi*r**2
def checkio(data):
blackHoles = [list(bh) for bh in data]
while 1:
for bh in sorted(combinations(blackHoles, 2), key=lambda c: dist(*c)):
... | mit | Python | |
9113226b762e1822015bbed677d7647151f0aab2 | add example. | DO-CV/sara,DO-CV/sara,DO-CV/sara,DO-CV/sara,DO-CV/sara,DO-CV/sara | python/do/shakti/examples/image_processing.py | python/do/shakti/examples/image_processing.py | import sys
from PySide2.QtCore import Qt
import numpy as np
import do.sara as sara
import do.shakti as shakti
import cv2
def user_main():
video_file = sys.argv[1]
video_stream = sara.VideoStream()
video_stream.open(video_file)
# video_stream = cv2.VideoCapture(video_file)
# w = int(video_strea... | mpl-2.0 | Python | |
a812d3054e25768c19a470bf090b298e11786ed3 | Support for SSL in wsgi.Service | poznyakandrey/oslo.service,eezhova/oslo.service,openstack/oslo.service,citrix-openstack-build/oslo.service | openstack/common/sslutils.py | openstack/common/sslutils.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 IBM
#
# 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... | apache-2.0 | Python | |
b3a5a11fd4c236122dcf848f84de0856024cce4b | add app declaration | geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/drf-utm-zone-info,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/drf-utm-zone-info,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx | osmaxx/excerptexport/apps.py | osmaxx/excerptexport/apps.py | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class ExcerptExportConfig(AppConfig):
name = 'osmaxx.excerptexport'
verbose_name = _("Excerpt Export")
| mit | Python | |
f0844846a929fcf661044dcd1e1138e7b9c9aa8a | Create simple-test.py | OreoCassowary/datascience-workshop | src/simple-test.py | src/simple-test.py | #!/usr/bin/env python3.4
import csv
import ipaddress
with open('../example-data/simple-test-example-bgp-announcements.csv') as csvfile:
r = csv.reader(csvfile, delimiter=',', dialect='excel')
next(r) # skip header
for row in r:
try:
ts=int(row[0])
except:
pr... | agpl-3.0 | Python | |
df0364f29802bcf83b88eba1d46a7e1a6796b7b2 | add json_compare | Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python | json/json_compare.py | json/json_compare.py | # http://stackoverflow.com/questions/25851183/how-to-compare-two-json-objects-with-the-same-elements-in-a-different-order-equa
import json
a = json.loads("""
{
"errors": [
{"error": "invalid", "field": "email"},
{"error": "required", "field": "name"}
],
"success": false
}
""")
b = json.loa... | mit | Python | |
681083441f14d75368b9dbb8efa44b31fae3fb0b | add push particular stream to push service | Ziggeo/ZiggeoPythonSdk,Ziggeo/ZiggeoPythonSdk | demos/push_stream.py | demos/push_stream.py | import sys
from Ziggeo import Ziggeo
import json
if(len(sys.argv) < 6):
print ("Error\n")
print ("Usage: $>python push_video.py YOUR_API_TOKEN YOUR_PRIVATE_KEY VIDEO_TOKEN STREAM_TOKEN PUSH_SERVICE_TOKEN\n")
sys.exit()
api_token = sys.argv[1]
private_key = sys.argv[2]
video_token = sys.argv[3]
stream_token = sys.a... | apache-2.0 | Python | |
332316c8ff426d0167091b8a274fc39b32bff203 | Add SortedList tests. | vmlaker/coils | test/testSortedList.py | test/testSortedList.py | def test1():
"""Start from empty."""
from coils import SortedList
a = SortedList()
for val in range(10):
a.add(val)
assert a.getCountLT(5) == 5
assert a.getCountGT(5) == 4
assert a.removeLT(5) == 5
assert a.getCountLT(5) == 0
def test2():
"""Construct from list."""
from ... | mit | Python | |
2fe631c95dbdd566ddca962e11a1ea4c5016a51c | add location tests | ianctse/pvlib-python,wholmgren/pvlib-python,pvlib/pvlib-python,alorenzo175/pvlib-python,dacoex/pvlib-python,uvchik/pvlib-python,jforbess/pvlib-python,rubennj/pvlib-python,MoonRaker/pvlib-python,mikofski/pvlib-python,anomam/pvlib-python,cwhanse/pvlib-python | pvlib/test/test_location.py | pvlib/test/test_location.py | import logging
pvl_logger = logging.getLogger('pvlib')
import pytz
from nose.tools import raises
from pytz.exceptions import UnknownTimeZoneError
from ..location import Location
aztz = pytz.timezone('US/Arizona')
def test_location_required():
Location(32.2, -111)
def test_location_all():
Location(32.2,... | bsd-3-clause | Python | |
234e9635e47bae397f3ccb6025054703e6d16ef2 | Create a basic test suite | williamstein/python-inotify,ohanar/python-inotify,williamstein/python-inotify,ohanar/python-inotify | test/test.py | test/test.py | #!/usr/bin/env py.test
# This testing script can be run either from python 3 or python 2. Run with
# `py.test test.py` or `py.test-2.7 test.py`.
#
# If run from the test directory
from __future__ import print_function
import sys, os, shutil, tempfile, inspect
import pytest
if not sys.platform.startswith('linux'):... | lgpl-2.1 | Python | |
1f17727be72c369d68a1ff08566071a6181d834a | add extractor | FirstDraftGIS/firstdraft,FirstDraftGIS/firstdraft | projfd/appfd/extractor/__init__.py | projfd/appfd/extractor/__init__.py | import location_extractor
from re import findall
# we're just casting a wide net and extracting
# all the capitalized words and other words that follow rules
def extract_locations_from_text(text):
try:
print "starting extract_locations_from_text"
pattern = "(?:[A-Z][a-z]{1,15} )*(?:de )?[A-Z][... | apache-2.0 | Python | |
895b2364c586888ef3604fcb6867bec093e64007 | Create Style-Chooser.py | techbliss/IDA-Styler | Style-Chooser.py | Style-Chooser.py | import sys
from PyQt4 import QtGui
from PyQt4 import QtCore
def setStyleHelper(widget, style):
widget.setStyle(style)
widget.setPalette(style.standardPalette())
for child in widget.children():
if isinstance(child, QtGui.QWidget):
setStyleHelper(child, style)
def c... | mit | Python | |
4d653701340ab0ce3c084d266be658ca0b80cad0 | Add countTransactions.py | hleofxquotes/mnyjson,hleofxquotes/mnyjson,hleofxquotes/mnyjson | python/countTransactions.py | python/countTransactions.py | # Example on how to read the top-level accounts.json
# Then traverse each account directory to get
# * Number of transaction
# * Account Type
# * Current balance
import json
import re
import os
accounts = json.loads(open('accounts.json').read())
print '---'
print 'Number of accounts: ', len(accounts)
print '---'... | apache-2.0 | Python | |
cbd92e3aaa5989df524e999f148face2498656e0 | add dendro_glue for smooth stuff (need to update when I switch from s/n to data) | keflavich/APEX_CMZ_H2CO,adamginsburg/APEX_CMZ_H2CO,adamginsburg/APEX_CMZ_H2CO,keflavich/APEX_CMZ_H2CO | analysis/dendro_glue_sm.py | analysis/dendro_glue_sm.py | """
Load dendrograms into a Glue session
"""
from glue.core.data_factories import load_data,load_dendro
from glue.core import DataCollection
from glue.core.link_helpers import LinkSame
from glue.qt.glue_application import GlueApplication
from glue.core import Data, DataCollection, Component
from glue.core.data_factori... | bsd-3-clause | Python | |
ce4ad4594d7a4305a7fb2c71e3fc8a42e003761f | add show joke | mirontoli/tolle-rasp,mirontoli/tolle-rasp,mirontoli/tolle-rasp,mirontoli/tolle-rasp,mirontoli/tolle-rasp | python_scripts/show_joke.py | python_scripts/show_joke.py | #!/usr/bin/env python3
"""
2020-01-04
displays a random joke from https://icanhazdadjoke.com/
when the joystick is pressed in the middle
__author__ = "Anatoly Mironov @mirontoli"
"""
import urllib.request
from sense_hat import SenseHat, ACTION_RELEASED
sense = SenseHat()
sense.clear()
sense.set_rotation(180)
h... | mit | Python | |
38c0b131d64d76503e6106a1709884fb25f73a6f | Create tutorial2.py | davidwilson826/empty-app | tutorial2.py | tutorial2.py | mit | Python | ||
db9661b31d76c34e68bc7fc71c6a848d2a911ca3 | Throw in fabfile for benchmarking while I'm here | Coread/channels,raphael-boucher/channels,linuxlewis/channels,andrewgodwin/channels,django/channels,Coread/channels,raiderrobert/channels,Krukov/channels,andrewgodwin/django-channels,Krukov/channels | testproject/fabfile.py | testproject/fabfile.py | from fabric.api import sudo, task, cd
@task
def setup_redis():
sudo("apt-get update && apt-get install -y redis-server")
sudo("sed -i -e 's/127.0.0.1/0.0.0.0/g' /etc/redis/redis.conf")
sudo("/etc/init.d/redis-server stop")
sudo("/etc/init.d/redis-server start")
@task
def setup_channels():
sudo("... | bsd-3-clause | Python | |
e799dabb56aff65c9fe4b5277f0656c630d9f0e0 | add unit tests for baseproxy | tealover/nova,varunarya10/nova_test_latest,whitepages/nova,Juniper/nova,alaski/nova,cloudbase/nova,openstack/nova,zhimin711/nova,alvarolopez/nova,belmiromoreira/nova,watonyweng/nova,CCI-MOC/nova,mandeepdhami/nova,nikesh-mahalka/nova,openstack/nova,JioCloud/nova_test_latest,barnsnake351/nova,kimjaejoong/nova,JioCloud/no... | nova/tests/unit/cmd/test_baseproxy.py | nova/tests/unit/cmd/test_baseproxy.py | # Copyright 2015 IBM Corp.
#
# 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 | |
72bb2c2ea4acd3dff9c548468eabc6c1523f7278 | Check it out! | aaronjolson/Quantopian-Algorithms | 2_window_spy_sell_wait_conservative_strategy.py | 2_window_spy_sell_wait_conservative_strategy.py | # Put any initialization logic here. The context object will be passed to
# the other methods in your algorithm.
def initialize(context):
context.stocks = symbols('SPY')
# Will be called on every trade event for the securities you specify.
def handle_data(context, data):
for stock in context.stocks:
m... | mit | Python | |
0af767a326bea84d27148172d9e2ac4c83e1eadb | Add missing migration | makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek | geotrek/maintenance/migrations/0012_auto_20200311_1608.py | geotrek/maintenance/migrations/0012_auto_20200311_1608.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2020-03-11 15:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('maintenance', '0011_auto_20200305_1037'),
]
operations = [
migrations.Alte... | bsd-2-clause | Python | |
5668b75f66cff87582d2e085983f6db61a811e79 | Add tests for CarbonCacheHandler | criteo-forks/carbon,piotr1212/carbon,iain-buclaw-sociomantic/carbon,deniszh/carbon,obfuscurity/carbon,pu239ppy/carbon,graphite-project/carbon,piotr1212/carbon,deniszh/carbon,mleinart/carbon,graphite-project/carbon,krux/carbon,iain-buclaw-sociomantic/carbon,obfuscurity/carbon,johnseekins/carbon,johnseekins/carbon,criteo... | lib/carbon/tests/test_protocols.py | lib/carbon/tests/test_protocols.py | from unittest import TestCase, skip
from mock import Mock, patch
from carbon.cache import _MetricCache
import os.path
import pickle
class TestCacheManagementHandler(TestCase):
def setUp(self):
test_directory = os.path.dirname(os.path.realpath(__file__))
settings = {
'CONF_DIR': os.path.join(test_dire... | apache-2.0 | Python | |
3bbf23964315bcb6e3597e1864d6fe749bfa3685 | Add a few tests for the d1_test.sample module | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | test_utilities/src/d1_test/tests/test_sample.py | test_utilities/src/d1_test/tests/test_sample.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2016 DataONE
#
# Licensed under the Apache... | apache-2.0 | Python | |
93860c424016dfc1316dadcc11b9bc70dd60470f | add test-send-file-declined.py | Ziemin/telepathy-gabble,community-ssu/telepathy-gabble,Ziemin/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,community-ssu/telepathy-gabble,mlundblad/telepathy-gabble,community-ssu/telepathy-gabble,communit... | tests/twisted/file-transfer/test-send-file-declined.py | tests/twisted/file-transfer/test-send-file-declined.py | from file_transfer_helper import SendFileTest, FT_STATE_CANCELLED, \
FT_STATE_CHANGE_REASON_REMOTE_STOPPED, CHANNEL_TYPE_FILE_TRANSFER, exec_file_transfer_test
from twisted.words.xish import domish
import ns
class SendFileDeclinedTest(SendFileTest):
def got_send_iq(self):
SendFileTest.got_send_iq(self... | lgpl-2.1 | Python | |
224253662bdfcc175942fe723d49c658de60a502 | test coverage | mmarquezs/python-bitsnoop,infothrill/python-bitsnoop | tests/constant_type.py | tests/constant_type.py | # -*- coding: utf-8 -*-
import unittest
from bitsnoop.constant_type import ConstantType, Constants
class ConstantTypeTest(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
def tearDown(self):
unittest.TestCase.tearDown(self)
def test_Constants(self):
self.asse... | mit | Python | |
03b740431616b35fe1bbe70ac69fe9508390389c | Add new package: abi-dumper (#18738) | LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/abi-dumper/package.py | var/spack/repos/builtin/packages/abi-dumper/package.py | # Copyright 2013-2020 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 AbiDumper(MakefilePackage):
"""ABI Dumper is a tool to dump ABI of an ELF object containin... | lgpl-2.1 | Python | |
f9c820c39f8f6a8f626e93a9cfa1a99e2053a67d | Create new package. (#6518) | EmreAtes/spack,mfherbst/spack,mfherbst/spack,matthiasdiener/spack,iulian787/spack,EmreAtes/spack,EmreAtes/spack,tmerrick1/spack,krafczyk/spack,iulian787/spack,iulian787/spack,krafczyk/spack,matthiasdiener/spack,krafczyk/spack,LLNL/spack,EmreAtes/spack,LLNL/spack,mfherbst/spack,matthiasdiener/spack,iulian787/spack,LLNL/... | var/spack/repos/builtin/packages/r-phyloseq/package.py | var/spack/repos/builtin/packages/r-phyloseq/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
581c38bcbd9bc9eb4047bc18c957fbeaa4c79462 | consolidate params script | benedictpaten/marginPhase,benedictpaten/marginPhase,benedictpaten/marginPhase | toil/src/toil_marginphase/consolidate_params.py | toil/src/toil_marginphase/consolidate_params.py | from __future__ import print_function
import argparse
import glob
import json
import sys
import numpy as np
import os
LEARNED_PARAM_KEY = "readErrorModel"
MIN_DIST_OFF = .00000001
def parse_args():
parser = argparse.ArgumentParser("Consolidates output learned parameters for chunked marginPhase run")
parser.ad... | mit | Python | |
c01013ae830221f4ecd725b02291b51342424760 | Clean up the comments to clarify things | osisoft/PI-Connector-for-UFL-Samples,osisoft/PI-Connector-for-UFL-Samples,danielElopez/PI-Connector-for-UFL-Samples,JeromeLefebvre/PI-Connector-for-UFL-Samples,danielElopez/PI-Connector-for-UFL-Samples,osisoft/PI-Connector-for-UFL-Samples,danielElopez/PI-Connector-for-UFL-Samples | Python/piuflput.py | Python/piuflput.py | """ piuflput.py
Copyright 2016 OSIsoft, LLC.
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 agr... | """ piuflput.py
Copyright 2016 OSIsoft, LLC.
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 agr... | apache-2.0 | Python |
da466b391470333492a56395569812653ed6658f | Change docker-py dependency error to a warning, update fix command | thaJeztah/compose,shin-/compose,vdemeester/compose,sdurrheimer/compose,sdurrheimer/compose,schmunk42/compose,hoogenm/compose,jrabbit/compose,dnephin/compose,dnephin/compose,schmunk42/compose,swoopla/compose,funkyfuture/docker-compose,shin-/compose,thaJeztah/compose,hoogenm/compose,funkyfuture/docker-compose,jrabbit/com... | compose/cli/__init__.py | compose/cli/__init__.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import subprocess
import sys
# Attempt to detect https://github.com/docker/compose/issues/4344
try:
# We don't try importing pip because it messes with package imports
# on some Linux distros (... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import subprocess
import sys
# Attempt to detect https://github.com/docker/compose/issues/4344
try:
# We don't try importing pip because it messes with package imports
# on some Linux distros (... | apache-2.0 | Python |
63626ce05f27a9e68cda6449bec82c0f02a4c5d0 | Add color.py file to be able to colorize the ouput | uoi-io/python-uoi | uoi/color.py | uoi/color.py | # coding: utf-8
import sys
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
# Following from Python cookbook, #475186
def use_color(stream):
if not hasattr(stream, "isatty"):
return False
if not stream.isatty():
# Auto color only on TTYs
return False
try:
im... | apache-2.0 | Python | |
cb453fdae808e05c5a7d906a9c4a3ad47282aace | Create tutorial3.py | APikielny/Final-Project-Tanks,APikielny/ggame-tutorials | tutorial3.py | tutorial3.py | #Adam Pikielny
#Graphics: Assets and Looping
| mit | Python | |
653e438ff8918b89ed5cda1ea5f60b1c5c8a7629 | rename test - add test_ prefix | AnnaWyszomirska/lesson1_1 | tests/test_add_new_contact.py | tests/test_add_new_contact.py | # -*- coding: utf-8 -*-
import pytest
from fixture.application import Application
from model.contact import Contact
@pytest.fixture
def app(request):
fixture = Application()
request.addfinalizer(fixture.destroy)
return fixture
def test_add_contact(app):
app.session.login(username="admin", password="... | apache-2.0 | Python | |
5f35fa6622aa5bc3ad804a666d3c6b09752e2990 | add first upload script | tahoe-lafs/perf-tests,tahoe-lafs/perf-tests,tahoe-lafs/perf-tests | upload-kN.py | upload-kN.py | #! /usr/bin/python
import os, time, re, subprocess, urllib
TAHOE = os.path.expanduser("~/bin/tahoe")
BASEDIR = os.path.expanduser("~/.tahoe")
def restart(basedir, k, N):
fn = os.path.join(basedir, "tahoe.cfg")
newfn = fn+".new"
new = open(newfn, "w")
for line in open(fn,"r").readlines():
if l... | mit | Python | |
004e5411e94ed3a2f372f8a66b4683eebb5da11a | Add a test that imports runlint under both python2 and python3 | Khan/khan-linter,Khan/khan-linter,Khan/khan-linter,Khan/khan-linter | python_version_compat_test.py | python_version_compat_test.py | #!/usr/bin/env python
import subprocess
import unittest
class TestPy2Py3Compat(unittest.TestCase):
"""We need to be compatible with both python2 and 3.
Test that we can at least import runlint.py under both.
"""
def test_python2_compat(self):
subprocess.check_call(['python2', '-c', 'import ... | apache-2.0 | Python | |
bf068a702ae06857b11d844df0ca349456701a5a | test package metadata. | weblyzard/inscriptis,weblyzard/inscriptis,weblyzard/inscriptis | tests/test_metadata.py | tests/test_metadata.py | from inscriptis.metadata import (__author__, __author_email__, __copyright__,
__license__, __version__)
def test_metadata():
"""Test inscriptis package metadata."""
assert 'Albert Weichselbraun' in __author__
assert 'Fabian Odoni' in __author__
assert '@' in __author_... | apache-2.0 | Python | |
9e796aabbfccb97641b357e31ed9d61d9283e494 | add tests file for writer.structure2pd | dr-leo/pandaSDMX | tests/test_writer_structure2pd.py | tests/test_writer_structure2pd.py | import pytest
from . import test_data_path
from pandasdmx.writer.structure2pd import Writer
@pytest.fixture
def dsd_common():
from pandasdmx.reader.sdmxml import Reader
fd = open(test_data_path / 'common' / 'common.xml')
return Reader(None).initialize(fd)
@pytest.mark.xfail(reason='writer.structure2pd ... | apache-2.0 | Python | |
09c48a690958502568b76dc10bce751614a63f38 | Add udp sender for debug purpose | baptistelabat/orgie | udpSender.py | udpSender.py | import socket
UDP_IP = "192.168.1.1"
UDP_PORT = 1234
MESSAGE = "Hello, World!"
print "UDP target IP:", UDP_IP
print "UDP target port:", UDP_PORT
print "message:", MESSAGE
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))
| mit | Python | |
927cccd42fde1060a20057c1ca6ab5aeb2195f70 | add test settings from django docs | byteweaver/django-polls,byteweaver/django-polls | tests/test_settings.py | tests/test_settings.py | SECRET_KEY = 'fake-key'
INSTALLED_APPS = [
'tests',
]
| bsd-3-clause | Python | |
63946436592c33606f7c2ae1723d452ea136d39a | Create unixpaste.py | balachandrana/pythonista_stash_utilities | unixpaste.py | unixpaste.py | """ paste - merge corresponding or subsequent lines of files
Examples:
"""
"""
todo:
__doc__
test examples
"""
import argparse
import fileinput
import os
import re
import sys
def getline_from_stdin(ns):
if ns.stdin_eof:
return ""
try:
s = raw_input()
except EOFError:
s = ""... | mit | Python | |
edef5ae25b7228cf8b769a171305e9f9c32eeabb | Add some tests for the wiki markup. | jkingdon/ghilbert,kryptine/ghilbert,raphlinus/ghilbert,kryptine/ghilbert,raphlinus/ghilbert,raphlinus/ghilbert,raphlinus/ghilbert,jkingdon/ghilbert | app/test_ghmarkup.py | app/test_ghmarkup.py | # encoding: utf-8
import unittest
import ghmarkup
class test_ghmarkup(unittest.TestCase):
def test_unadorned_text(self):
self.assertEqual("<p>\nfoo\n</p>", ghmarkup.ghmarkup("foo"))
def test_bold(self):
self.assertEqual("<p>\nthe <strong>quick</strong> brown fox\n</p>", ghmarkup.ghmarkup(
"the *qui... | apache-2.0 | Python | |
056de4daf1a00f677d3f9bccebae849dc49e7c48 | Add check script for WithHueAndSaturation | aleju/imgaug,aleju/ImageAugmenter,aleju/imgaug | checks/check_with_hue_and_saturation.py | checks/check_with_hue_and_saturation.py | from __future__ import print_function, division
import imgaug as ia
import imgaug.augmenters as iaa
def main():
image = ia.quokka_square(size=(128, 128))
images = []
for i in range(15):
aug = iaa.WithHueAndSaturation(iaa.WithChannels(0, iaa.Add(i*20)))
images.append(aug.augment_image(imag... | mit | Python | |
0cad77f3ed033e96d02f44072e77daee2e906736 | Create sample-tinyshakespeare.1.py | hpssjellis/char-rnn-tensorflow-music-3dprinting,hpssjellis/char-rnn-tensorflow-music-3dprinting,hpssjellis/char-rnn-tensorflow-music-3dprinting,hpssjellis/char-rnn-tensorflow-music-3dprinting | sample-tinyshakespeare.1.py | sample-tinyshakespeare.1.py | from __future__ import print_function
import numpy as np
import tensorflow as tf
import argparse
import time
import os
from six.moves import cPickle
from utils import TextLoader
from model import Model
from six import text_type
import sys
def main():
parser = argparse.ArgumentParser(sys.argv)
parser.add_ar... | mit | Python | |
b05f95fb3e67ef2d13d67bf369e10c679a8b55cf | Add script to find site-packages dirs. | audreyr/useful | find_site_packages.py | find_site_packages.py | import site
from distutils.sysconfig import get_python_lib
print("Your main site-packages directory:")
print(get_python_lib())
print
print("All global site-packages directories on your system:")
print(site.getsitepackages())
| bsd-3-clause | Python | |
b9beb0a90bbf35f0ebdb690454c725d8023ab7ef | add project only configuration | apipanda/openssl,apipanda/openssl,apipanda/openssl,apipanda/openssl | openssl/config.py | openssl/config.py | import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
| mit | Python | |
f12dba1134b8c9b42dc607e3e672de0e1cc2a4d1 | Add an examples directory to illustrate operator usage. | buchuki/opterator | examples/copy.py | examples/copy.py | from opterator import opterate
@opterate
def main(filename1, filename2, recursive=False, backup=False,
suffix='~', *other_filenames):
'''An example copy script with some example parameters that might
be used in a copy command.
@param recursive store_true -r --recursive copy directories
... | mit | Python | |
58df907c14ca6bb52820387c085006fbdbf77e6c | Create vid_utils.py | deepserket/telegram-bot-youtube-downloader | vid_utils.py | vid_utils.py | import re
import os
from glob import glob
from subprocess import Popen, PIPE
from time import strftime, strptime
# many of these imports serve the commented code...
# this is the hard-split version (files need to be concatenated...)
def check_dimension(f):
""" If f is larger than 50MB it divides it into files up t... | mit | Python | |
423ca14be7792d1f646946fa269799e9d3cf4568 | Create __init__.py | biothings/biothings.api,biothings/biothings.api,SuLab/biothings.api | biothings/conf/__init__.py | biothings/conf/__init__.py | apache-2.0 | Python | ||
1a3f827f03df16d303bddf3ed883d16f0b875c0b | add missing file | wandb/client,wandb/client,wandb/client | wandb/viz.py | wandb/viz.py | from wandb.data_types import Table
from wandb.core import Error
class Visualize:
def __init__(self, viz_id, value):
self.viz_id = viz_id
self.value = value
def visualize(viz_id, value):
if not isinstance(value, Table):
raise Error("visualize value must be Table, not {}".format(type(val... | mit | Python | |
b3a0454ef6c7076d76ce6714078c61400e0f8c0d | Fix humans.txt Unit Tests | davehunt/kuma,MenZil/kuma,whip112/Whip112,varunkamra/kuma,robhudson/kuma,SphinxKnight/kuma,jezdez/kuma,tximikel/kuma,varunkamra/kuma,nhenezi/kuma,cindyyu/kuma,hoosteeno/kuma,mozilla/kuma,biswajitsahu/kuma,a2sheppy/kuma,a2sheppy/kuma,ronakkhunt/kuma,anaran/kuma,FrankBian/kuma,darkwing/kuma,a2sheppy/kuma,jwhitlock/kuma,j... | apps/humans/tests.py | apps/humans/tests.py | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
from os import makedirs
from os.path import dirname, exists, isdir
from nose.tools import assert_equal,... | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
from os.path import dirname
from os.path import exists
from nose.tools import assert_equal, ok_
import ... | mpl-2.0 | Python |
5fcec90a33828c09dbd5df6a48a8749e6ab64625 | Solve first Sunday counts | daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various | project_euler/019.counting_sundays.py | project_euler/019.counting_sundays.py | '''
Problem 019
You are given the following information, but you may prefer to do some research
for yourself.
1 Jan 1900 was a Monday.
Thirty days has September,
April, June and November.
All the rest have thirty-one,
Saving February alone,
Which has twenty-eight, rain or shine.
And on leap years, twenty-nine.
A... | mit | Python | |
65bae0d38b96fde3e3dd54cdc915e99b661b974a | Add Web tools: getHeader, getParticularClass, getLinks, errorHandling, bannerGrapper | rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network | web_tools.py | web_tools.py | import urllib, subprocess, random, re
from bs4 import BeautifulSoup # http://www.crummy.com/software/BeautifulSoup/bs4/doc/#
import socket, struct, binascii
class Web():
def getHeader(self, url):
"""Get Header Info"""
http_r = urllib.urlopen(url)
if http_r.code == 200:
return http_r.headers
e... | mit | Python | |
669a08a70a14fb477252eff5de39f8c088b73da2 | Test downloader functions too | HIIT/mediacollection | test/test_downloader.py | test/test_downloader.py | import sys
import os
path = os.path.abspath('.')
sys.path.append(path)
import downloader as d
good_urls = ['http://yle.fi/uutiset/tv-uutisten_politiikantoimittaja_timo_kuparinen_kuollut/9167149']
bad_urls = ['http://example.com', 'http://www.example.org']
class TestParser:
@classmethod
def setup_class(sel... | mit | Python | |
53ebb49c83749c395d6ac6e8d54f7faaacddb0af | Use tf's own mirror for alternative download links | tensorflow/tensorflow-pywrap_tf_optimizer,karllessard/tensorflow,annarev/tensorflow,paolodedios/tensorflow,aam-at/tensorflow,Intel-tensorflow/tensorflow,gunan/tensorflow,Intel-tensorflow/tensorflow,annarev/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-experimental_link_s... | third_party/opencl_headers/workspace.bzl | third_party/opencl_headers/workspace.bzl | """Loads OpenCL-Headers, used by TF Lite."""
load("//third_party:repo.bzl", "third_party_http_archive")
def repo():
third_party_http_archive(
name = "opencl_headers",
strip_prefix = "OpenCL-Headers-0d5f18c6e7196863bc1557a693f1509adfcee056",
sha256 = "03cbc1fd449399be0422cdb021400f63958ef2c... | """Loads OpenCL-Headers, used by TF Lite."""
load("//third_party:repo.bzl", "third_party_http_archive")
def repo():
third_party_http_archive(
name = "opencl_headers",
strip_prefix = "OpenCL-Headers-0d5f18c6e7196863bc1557a693f1509adfcee056",
sha256 = "03cbc1fd449399be0422cdb021400f63958ef2c... | apache-2.0 | Python |
2fb128fb341294f1f3848fbff55d30a6e123f8dd | Add PGI Compiler Package | skosukhin/spack,LLNL/spack,EmreAtes/spack,TheTimmy/spack,krafczyk/spack,mfherbst/spack,krafczyk/spack,krafczyk/spack,lgarren/spack,LLNL/spack,TheTimmy/spack,lgarren/spack,skosukhin/spack,skosukhin/spack,EmreAtes/spack,tmerrick1/spack,mfherbst/spack,krafczyk/spack,lgarren/spack,LLNL/spack,EmreAtes/spack,iulian787/spack,... | var/spack/repos/builtin/packages/pgi/package.py | var/spack/repos/builtin/packages/pgi/package.py | from spack import *
import spack
import llnl.util.tty as tty
import os
class Pgi(Package):
"""PGI optimizing multi-core x64 compilers for Linux, MacOS & Windows
with support for debugging and profiling of local MPI processes.
Note: The PGI compilers are licensed software. You will need to create
an ac... | lgpl-2.1 | Python | |
8df71c9acd9192d94fd62d3194b854cef3d98512 | add missing unit test | berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud | apps/topics-fetch-link/tests/python/test_normalize_youtube_url.py | apps/topics-fetch-link/tests/python/test_normalize_youtube_url.py | #/usr/bin/env python3
from mediawords.util.url import normalize_youtube_url, normalize_url_lossy
def test_youtube_urls():
nyu = normalize_youtube_url
assert nyu('http://foo.bar') == 'http://foo.bar'
assert nyu('http://youtube.com/foo/bar') == 'https://www.youtube.com/foo/bar'
assert nyu('https://you... | agpl-3.0 | Python | |
c5a35acd6706ebc8ef994b3afbcb9de7b1c77b1c | add package | iulian787/spack,tmerrick1/spack,mfherbst/spack,skosukhin/spack,lgarren/spack,skosukhin/spack,iulian787/spack,mfherbst/spack,skosukhin/spack,lgarren/spack,krafczyk/spack,LLNL/spack,iulian787/spack,TheTimmy/spack,tmerrick1/spack,matthiasdiener/spack,matthiasdiener/spack,mfherbst/spack,krafczyk/spack,lgarren/spack,iulian7... | var/spack/repos/builtin/packages/sed/package.py | var/spack/repos/builtin/packages/sed/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
9e9d506853511a2f69f91ba2ed7265db5a7e779a | Add object_class to LocationResource | gmimano/commcaretest,dimagi/commcare-hq,gmimano/commcaretest,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/c... | corehq/apps/locations/resources/v0_1.py | corehq/apps/locations/resources/v0_1.py | from tastypie import fields
from corehq.apps.locations.models import Location, root_locations
from corehq.apps.api.resources.v0_1 import CustomResourceMeta
from corehq.apps.api.util import get_object_or_not_exist
from corehq.apps.api.resources import JsonResource
class LocationResource(JsonResource):
type = "locat... | from tastypie import fields
from corehq.apps.locations.models import Location, root_locations
from corehq.apps.api.resources.v0_1 import CustomResourceMeta
from corehq.apps.api.util import get_object_or_not_exist
from corehq.apps.api.resources import JsonResource
class LocationResource(JsonResource):
type = "locat... | bsd-3-clause | Python |
8984c987bf665ddd542787a49157edc313eced87 | Implement basic queries | h2020-endeavour/endeavour,h2020-endeavour/endeavour | mctrl/query.py | mctrl/query.py | from influxdb import InfluxDBClient
from collections import OrderedDict
import protocols as proto
INFLUXDB_DB = "sdx"
INFLUXDB_HOST = "localhost"
INFLUXDB_PORT = 8086
INFLUXDB_USER = ""
INFLUXDB_PASS = ""
client = InfluxDBClient(
host=INFLUXDB_HOST, port=INFLUXDB_PORT,
username=INFLUXDB_USER, password... | apache-2.0 | Python | |
198e5843b20ca852c40952786e419ebd3ebe19c3 | add julia | Gagaro/pyfractal,Gagaro/pyfractal | fractal/julia.py | fractal/julia.py | TERATIONS = 300
class Julia(object):
def __init__(self, width, height, k_r, k_i,
min_r=-2.0, max_r=1.0, min_i=-1.5, iterations=ITERATIONS):
self.k_r = k_r
self.k_i = k_i
self.min_r = min_r
self.max_r = max_r
self.min_i = min_i
self.max_i = min_i + (... | mit | Python | |
2e0bfd36dc6b1230587c6c8633f892b83ee75a63 | Add regression test for #628. | teoliphant/numpy-refactor,efiring/numpy-work,teoliphant/numpy-refactor,chadnetzer/numpy-gaurdro,Ademan/NumPy-GSoC,chadnetzer/numpy-gaurdro,Ademan/NumPy-GSoC,illume/numpy3k,illume/numpy3k,jasonmccampbell/numpy-refactor-sprint,Ademan/NumPy-GSoC,jasonmccampbell/numpy-refactor-sprint,efiring/numpy-work,illume/numpy3k,jason... | numpy/lib/tests/test_regression.py | numpy/lib/tests/test_regression.py | from numpy.testing import *
set_local_path()
import numpy as np
restore_path()
rlevel = 1
class TestRegression(NumpyTestCase):
def test_polyfit_build(self,level=rlevel):
"""Ticket #628"""
ref = [-1.06123820e-06, 5.70886914e-04, -1.13822012e-01,
9.95368241e+00, -3.14526520e+02]
... | bsd-3-clause | Python | |
c0c7a6f4573645ebcd2111c081b67203a7628e96 | Add test RGOAPTestPreconditionEffectSymmetry | felix-kolbe/executive_rgoap | rgoap/test/TestPrecEffSym.py | rgoap/test/TestPrecEffSym.py | # Copyright (c) 2013, Felix Kolbe
# All rights reserved. BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of condit... | bsd-3-clause | Python | |
251752ac84944e765e05e83348cb6cc6ffdef1ca | Add CLI tests | Halibot/halibot,Halibot/halibot | tests/test_cli.py | tests/test_cli.py | import unittest
import os, sys, shutil
import subprocess, tempfile
import json
class CliTestCase(unittest.TestCase):
def setUp(self):
self.path = tempfile.mkdtemp(prefix='halibot-test')
self.mainPy = os.path.join(os.getcwd(), 'main.py')
os.chdir(self.path)
def tearDown(self):
os.chdir(os.path.dirname(self.m... | bsd-3-clause | Python | |
4aa2548ae1636a90c1b492d1ac535a27f0ce4cc7 | print a random sentence from smwat | natematias/minus_context | tweet_minus_context.py | tweet_minus_context.py | import nltk
import feedburner
import random
from HTMLParser import HTMLParser
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
def handle_data(self, d):
self.fed.append(d)
def get_data(self):
return ''.join(self.fed)
def strip_tags(html):
s =... | mit | Python | |
96b49759de3d51161a19eb6f773bb1ac3c89489c | Add fixture for setting config models from Bok Choy. | ovnicraft/edx-platform,eduNEXT/edx-platform,IONISx/edx-platform,miptliot/edx-platform,nttks/edx-platform,halvertoluke/edx-platform,ESOedX/edx-platform,louyihua/edx-platform,kmoocdev2/edx-platform,CourseTalk/edx-platform,TeachAtTUM/edx-platform,lduarte1991/edx-platform,pabloborrego93/edx-platform,CredoReference/edx-plat... | common/test/acceptance/fixtures/config.py | common/test/acceptance/fixtures/config.py | import requests
import re
import json
from lazy import lazy
from . import LMS_BASE_URL
class ConfigModelFixureError(Exception):
"""
Error occurred while configuring the stub XQueue.
"""
pass
class ConfigModelFixture(object):
"""
Configure a ConfigurationModel by using it's JSON api.
"""... | agpl-3.0 | Python | |
3c8dc1536cc306794c56f372f4302e14b4c80acf | Create plot_and_save.py | johnash1990/crashDataAnalysisTools | crashDataAnalysisTools/plot_and_save.py | crashDataAnalysisTools/plot_and_save.py | import os
import pandas as pd
from matplotlib.backends.backend_pdf import PdfPages
def PlotXVsY(df, colname_x, colname_y):
"""
scatter plot of attribute x against y
Parameters:
@df {dataframe} datasource
@colname_x {string} column name for attribute x
@colname_y {string} column name for attrib... | bsd-2-clause | Python | |
b264313d48a66b847a1cfa6459745f2d35e10cee | Print installed packages in pytest | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | tests/conftest.py | tests/conftest.py | import os
import subprocess
import sys
def _is_pip_installed():
try:
import pip # NOQA
return True
except ImportError:
return False
def _is_in_ci():
ci_name = os.environ.get('CUPY_CI', '')
return ci_name != ''
def pytest_configure(config):
# Print installed packages
... | mit | Python | |
c31eae3d02889a5517782bcaf20406c72bc0de14 | Add AWS poll for init complete plug-in. | CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge | actions/cloudbolt_plugins/aws/poll_for_init_complete.py | actions/cloudbolt_plugins/aws/poll_for_init_complete.py | import sys
import time
from infrastructure.models import Server
from jobs.models import Job
TIMEOUT = 600
def is_reachable(server):
"""
:type server: Server
"""
instance_id = server.ec2serverinfo.instance_id
ec2_region = server.ec2serverinfo.ec2_region
rh = server.resource_handler.cast()
... | apache-2.0 | Python | |
362d797a6e02c36f4c3645519ef39585e02ad863 | add util script to list missing MRMS files | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/mrms/list_missing.py | scripts/mrms/list_missing.py | """List out missing MRMS data files for a month"""
import datetime
import os
import sys
def main(argv):
"""Go Main"""
sts = datetime.datetime(int(argv[1]), int(argv[2]), int(argv[3]), 0, 0)
ets = datetime.datetime(int(argv[4]), int(argv[5]), int(argv[6]), 0, 0)
interval = datetime.timedelta(hours=1)
... | mit | Python | |
ee91d78412ce57d35fbba3bbe13f646c90756027 | Migrate product_template.cost_method to property (in stock_account) | 0k/OpenUpgrade,grap/OpenUpgrade,blaggacao/OpenUpgrade,csrocha/OpenUpgrade,0k/OpenUpgrade,grap/OpenUpgrade,damdam-s/OpenUpgrade,csrocha/OpenUpgrade,csrocha/OpenUpgrade,OpenUpgrade-dev/OpenUpgrade,Endika/OpenUpgrade,kirca/OpenUpgrade,OpenUpgrade/OpenUpgrade,hifly/OpenUpgrade,hifly/OpenUpgrade,OpenUpgrade-dev/OpenUpgrade,... | addons/stock_account/migrations/8.0.1.1/post-migrate.py | addons/stock_account/migrations/8.0.1.1/post-migrate.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | agpl-3.0 | Python | |
524eab0fe42e4b15105f4e5b8c3401d5b548e413 | add get_review_of_restaurant.py | zhewang/restauranthunter,zhewang/restauranthunter,zhewang/restauranthunter | datascripts/get_review_of_restaurant.py | datascripts/get_review_of_restaurant.py | import json
import pymysql
finalResult = {}
def QueryDB(business_id):
conn = pymysql.Connect(host='localhost', user='root', passwd='',charset='utf8', db='yelpdb')
cursor = conn.cursor()
cursor.execute( "SELECT stars, date FROM review WHERE business_id = %s", business_id )
conn.commit()
result = ... | mit | Python | |
db82fa83e65653aaff38d07ebe40464fe30e92c7 | Add starcheck archive update script | sot/mica,sot/mica | scripts/update_starchecks.py | scripts/update_starchecks.py | #!/usr/bin/env python
import mica.starcheck
mica.starcheck.main()
| bsd-3-clause | Python | |
a9ffc9cd376816800ac5ee93302dea3e2eaabb36 | Add backlight tests | rm-hull/luma.lcd,rm-hull/pcd8544 | tests/test_backlight.py | tests/test_backlight.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013-17 Richard Hull and contributors
# See LICENSE.rst for details.
try:
from unittest.mock import Mock
except ImportError:
from mock import Mock
from luma.lcd.device import backlight
gpio = Mock(unsafe=True)
def setup_function(function):
g... | mit | Python | |
8e75202872dd640c28173e2070b234165774f9db | Add function to generate logarithmically spaced integers. | chebee7i/buhmm | buhmm/misc.py | buhmm/misc.py | # encoding: utf-8
"""
Miscellaneous functions.
"""
from __future__ import division
import numpy as np
def logspace_int(limit, num=50):
"""
Returns (approximately) logarithmically spaced integers from 0 to `limit`.
This is often more appropriate than calling `np.logspace(...).astype(int)`,
or somethi... | mit | Python | |
b5db260f9499b7bdd5c13dc0c59c1ad6ad2d37fc | Automate initial seeding of user and oauth for development | impactlab/oeem-energy-datastore,impactlab/oeem-energy-datastore,impactlab/oeem-energy-datastore | datastore/management/commands/dev_seed.py | datastore/management/commands/dev_seed.py | from django.utils.timezone import now, timedelta
from django.core.management.base import BaseCommand
from datastore.models import *
from django.contrib.auth.models import User
from oauth2_provider.models import AccessToken, get_application_model
from datetime import datetime
ApplicationModel = get_application_model()
... | mit | Python | |
88b9ab92c5fe3374dba27c1d8c1d0b0b0e7411b7 | Add simple test for `mde_reference_new_footnote` command | SublimeText-Markdown/MarkdownEditing | tests/test_footnotes.py | tests/test_footnotes.py | from MarkdownEditing.tests import DereferrablePanelTestCase
class TestMdeReferenceNewFootnoteCommand(DereferrablePanelTestCase):
def test_new_footnote_in_first_line(self):
self.setBlockText(
"""
# Test 1
First inline.
Second inline.
Third inli... | mit | Python | |
81d3c9fdc6113f80b0434b49d5f3da94649d25c8 | Create new package. (#6042) | lgarren/spack,LLNL/spack,iulian787/spack,EmreAtes/spack,lgarren/spack,tmerrick1/spack,iulian787/spack,matthiasdiener/spack,lgarren/spack,krafczyk/spack,matthiasdiener/spack,mfherbst/spack,tmerrick1/spack,LLNL/spack,LLNL/spack,iulian787/spack,tmerrick1/spack,iulian787/spack,skosukhin/spack,skosukhin/spack,lgarren/spack,... | var/spack/repos/builtin/packages/r-biovizbase/package.py | var/spack/repos/builtin/packages/r-biovizbase/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
33f00a79dfc5b4cf4b97d772109e579f91ac1308 | add script to validate twinkles magNorms | LSSTDESC/Twinkles,DarkEnergyScienceCollaboration/Twinkles,DarkEnergyScienceCollaboration/Twinkles,LSSTDESC/Twinkles | workspace/magNorm/validate_twinkles_magnorms.py | workspace/magNorm/validate_twinkles_magnorms.py | import GCRCatalogs
import astropy.io.fits as fits
import lsst.sims.photUtils as sims_photUtils
import numpy as np
import os
data_dir = os.path.join(os.environ['TWINKLES_DIR'], 'data')
assert os.path.isdir(data_dir)
# load the mapping between galaxy_id and twinklesId
# (really, I just want a list of all of the galaxie... | mit | Python | |
46cf433787e402209df1bc5c1ea7be4bfd47e774 | Test simple cube case | innolitics/natural-neighbor-interpolation,innolitics/natural-neighbor-interpolation,innolitics/natural-neighbor-interpolation | tests/test_cube.py | tests/test_cube.py | import numpy as np
from numpy.testing import assert_allclose, assert_almost_equal
import pytest
from naturalneighbor import natural_neighbor
def known_cube(value_0_1_1=0, value_1_1_1=0, side_length=1):
known_points = np.array([
[0, 0, 0],
[1, 0, 0],
[0, 1, 0],
[0, 0, 1],
[... | mit | Python | |
c089b688504d09b67fd338ed5f94a4a2c1c737d5 | Add tests for Note constructor (n.b. some currently failing). | charlottepierce/music_essentials | tests/test_note.py | tests/test_note.py | import pytest
from music_basics import Note
# Manual note creation - correct values
def test_manual_note_creation_correct_pitch_uppercase():
n = Note('A', 4, 'bb')
assert n.pitch == 'A'
def test_manual_note_creation_correct_pitch_lowercase():
n = Note('b', 4, 'b')
assert n.pitch == 'B'
def test_manu... | mit | Python | |
61514737f7c69377a76d435c97d18829fc60dc2f | add tests to util.py | bernard357/plumbery,DimensionDataCBUSydney/plumbery,bernard357/plumbery,DimensionDataCBUSydney/plumbery | tests/test_util.py | tests/test_util.py | #!/usr/bin/env python
"""
Tests for `util` module.
Credit of test for the @retry decorator:
http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/
"""
import logging
import os
import unittest
from plumbery.util import retry
class RetryableError(Exception):
pass
class AnotherRetryableError... | apache-2.0 | Python | |
36f2caecadb492ca07c6c3a9f834e4915b1b7ac2 | convert TfL JSON to KML, easier to import in GIS tools | sandrotosi/ingresstools | tfl_json_to_kml.py | tfl_json_to_kml.py | #!/usr/bin/python3
from fastkml import kml
import json
import glob
import ast
from shapely.geometry import LineString
ns = '{http://www.opengis.net/kml/2.2}'
DESTDIR = 'tfl_bus_routes_kml'
busroutes = sorted(glob.glob('tfl_bus_routes/*.json'))
for busroute in busroutes:
with open(busroute) as f:
route... | mit | Python | |
637d7f890c5b57ce6b07708427dd5bd3bba2fba3 | add script to generate index files | DarkEnergyScienceCollaboration/Twinkles,rbiswas4/Twinkles,LSSTDESC/Twinkles,LSSTDESC/Twinkles,rbiswas4/Twinkles,DarkEnergyScienceCollaboration/Twinkles | twinkles/build_index_files.py | twinkles/build_index_files.py | """
Script to generate a set of astrometry.net index files from a phosim
instance catalog.
"""
import os
import shutil
import glob
import subprocess
def instcat_to_astrometry_net_input(instcat, ref_file='ref.txt'):
"""
Convert a phosim instance catalog to a FITS file in the form of a
binary table, retainin... | mit | Python | |
7ab4fec258441c4f1e868e403f86adaf0d3d3525 | Fix import error. | mzdaniel/oh-mainline,vipul-sharma20/oh-mainline,SnappleCap/oh-mainline,sudheesh001/oh-mainline,heeraj123/oh-mainline,mzdaniel/oh-mainline,Changaco/oh-mainline,waseem18/oh-mainline,campbe13/openhatch,nirmeshk/oh-mainline,campbe13/openhatch,onceuponatimeforever/oh-mainline,SnappleCap/oh-mainline,sudheesh001/oh-mainline,o... | mysite/testrunner.py | mysite/testrunner.py | from django.conf import settings
import xmlrunner.extra.djangotestrunner
from django.test.simple import run_tests
import os
def run(*args, **kwargs):
settings.CELERY_ALWAYS_EAGER = True
if os.environ.get('USER', 'unknown') == 'hudson':
# Hudson should run with xmlrunner because he consumes JUnit-style ... | from django.conf import settings
import xmlrunner.extra.djangotestrunner
from django.test.simple import run_tests
def run(*args, **kwargs):
settings.CELERY_ALWAYS_EAGER = True
if os.environ.get('USER', 'unknown') == 'hudson':
# Hudson should run with xmlrunner because he consumes JUnit-style xml
... | agpl-3.0 | Python |
23218181874779d62db97c24ddc9625f6c2fa5f2 | Revert of Remove the 'sleep_sync' argument. (patchset #1 id:1 of https://codereview.chromium.org/639763003/) | eunchong/build,eunchong/build,eunchong/build,eunchong/build | scripts/slave/random_delay.py | scripts/slave/random_delay.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.
"""A tool to sleep for a random amount of time, used by the buildbot slaves.
This is used to prevent the cron - zerg rush/herd s... | bsd-3-clause | Python | |
1e327a24079de5abbe219640c289adbb20b73a82 | Update path for test | kevinlondon/sentry,gencer/sentry,JackDanger/sentry,Kryz/sentry,mitsuhiko/sentry,zenefits/sentry,JamesMura/sentry,JackDanger/sentry,fotinakis/sentry,korealerts1/sentry,felixbuenemann/sentry,Natim/sentry,BuildingLink/sentry,JamesMura/sentry,mvaled/sentry,kevinlondon/sentry,beeftornado/sentry,jean/sentry,mitsuhiko/sentry,... | tests/sentry/api/endpoints/test_project_tagkey_values.py | tests/sentry/api/endpoints/test_project_tagkey_values.py | from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.models import TagKey, TagValue
from sentry.testutils import APITestCase
class ProjectTagKeyValuesTest(APITestCase):
def test_simple(self):
project = self.create_project()
tagkey = TagKey.objects.creat... | from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.models import TagKey, TagValue
from sentry.testutils import APITestCase
class ProjectTagKeyValuesTest(APITestCase):
def test_simple(self):
project = self.create_project()
tagkey = TagKey.objects.creat... | bsd-3-clause | Python |
a44e8907374f66ea80882fabe0fa4c5b8e46e6a2 | Add tables declaration in models.py | igboyes/virtool,igboyes/virtool,virtool/virtool,virtool/virtool | virtool/models.py | virtool/models.py | from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, String
Base = declarative_base()
class Label(Base):
__tablename__ = 'labels'
id = Column(String, primary_key=True)
name = Column(String)
color = Column(String)
description = Column(String)
def __repr__(se... | mit | Python | |
e069bf4ab02c100db441f3f87fa6b0a8c3d02e08 | add tools about setting system path of Python | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | server/Mars/Lib/PathHelper.py | server/Mars/Lib/PathHelper.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2016 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... | bsd-2-clause | Python | |
0e0eaf087195ffb121e0f4dc0ac5ccf30abb6a98 | add suds client for helloworld_soap example. | martijnvermaat/rpclib,arskom/spyne,martijnvermaat/rpclib,arskom/spyne,martijnvermaat/rpclib,arskom/spyne | examples/helloworld_soap_suds_client.py | examples/helloworld_soap_suds_client.py | #!/usr/bin/env python
# encoding: utf8
#
# Copyright © Burak Arslan <burak at arskom dot com dot tr>,
# Arskom Ltd. http://www.arskom.com.tr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are ... | lgpl-2.1 | Python | |
4ad0a45311ced986f8ab5f7b5ecfd1753177d6c7 | add z-stack code | zplab/rpc-scope | scope/client_util/z_stack.py | scope/client_util/z_stack.py | # The MIT License (MIT)
#
# Copyright (c) 2014-2015 WUSTL ZPLAB
#
# 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, ... | mit | Python | |
48658e23db83c265e782d9e5e8b3bd040757f2d0 | Add setup.py | Koheron/tcp-server,Koheron/koheron-server,Koheron/koheron-server,Koheron/koheron-server,Koheron/koheron-server,Koheron/tcp-server,Koheron/tcp-server,Koheron/tcp-server,Koheron/tcp-server | APIs/python/setup.py | APIs/python/setup.py | """ Setup for Koheron TCP server API
From https://github.com/pypa/sampleproject/blob/master/setup.py
(c) Koheron
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
# http://stackoverflow.com/que... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.