commit stringlengths 40 40 | old_file stringlengths 4 150 | new_file stringlengths 4 150 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 501 | message stringlengths 15 4.06k | lang stringclasses 4
values | license stringclasses 13
values | repos stringlengths 5 91.5k | diff stringlengths 0 4.35k |
|---|---|---|---|---|---|---|---|---|---|---|
8040b797ba78f59fd0d182dfd22993340cb37700 | test/test_logging.py | test/test_logging.py | from cStringIO import StringIO
import logging
import os
import sys
import tempfile
import unittest
from apel.common import set_up_logging
class LoggingTest(unittest.TestCase):
def setUp(self):
# Capture stdout in a StringIO object for inspection.
self._stdout = sys.stdout
sys.stdout = Str... | Add unittest for logging from apel.common.__init__ | Add unittest for logging from apel.common.__init__
| Python | apache-2.0 | apel/apel,stfc/apel,tofu-rocketry/apel,stfc/apel,tofu-rocketry/apel,apel/apel | ---
+++
@@ -0,0 +1,54 @@
+from cStringIO import StringIO
+import logging
+import os
+import sys
+import tempfile
+import unittest
+
+from apel.common import set_up_logging
+
+
+class LoggingTest(unittest.TestCase):
+ def setUp(self):
+ # Capture stdout in a StringIO object for inspection.
+ self._std... | |
c0e6979a98251fa2300b2c61f206775ef953f7a8 | tests/test-basics.py | tests/test-basics.py | #!/usr/bin/env python
import unittest
import pandas as pd
import pdfplumber
import sys, os
import six
import logging
logging.disable(logging.ERROR)
HERE = os.path.abspath(os.path.dirname(__file__))
class Test(unittest.TestCase):
def setUp(self):
path = os.path.join(HERE, "pdfs/nics-background-checks-201... | Add test for very basic things | Add test for very basic things
| Python | mit | jsvine/pdfplumber | ---
+++
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+import unittest
+import pandas as pd
+import pdfplumber
+import sys, os
+import six
+
+import logging
+logging.disable(logging.ERROR)
+
+HERE = os.path.abspath(os.path.dirname(__file__))
+
+class Test(unittest.TestCase):
+
+ def setUp(self):
+ path = os.path.... | |
305a137352ee2a287ded5d39657f91460e474e3b | tests/test_search.py | tests/test_search.py | """Test the ElasticSearch module"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from pytest import raises
from gobble.search import Contributo... | Add tests for ElasticSearch classes. | Add tests for ElasticSearch classes.
| Python | mit | openspending/gobble | ---
+++
@@ -0,0 +1,22 @@
+"""Test the ElasticSearch module"""
+
+from __future__ import unicode_literals
+from __future__ import print_function
+from __future__ import division
+from __future__ import absolute_import
+from future import standard_library
+standard_library.install_aliases()
+
+from pytest import raises... | |
5981cba4f2bac5b1c29d4901bd0b3b3f523eb8a9 | tests/test_tshark.py | tests/test_tshark.py | import mock
from pyshark.tshark.tshark import (
get_tshark_display_filter_flag,
get_tshark_interfaces,
get_tshark_version,
)
@mock.patch('pyshark.tshark.tshark.subprocess.check_output', autospec=True)
def test_get_tshark_version(mock_check_output):
mock_check_output.return_value = (
b'TShark 1... | Add tests for tshark sub-module | Add tests for tshark sub-module
| Python | mit | eaufavor/pyshark-ssl,KimiNewt/pyshark | ---
+++
@@ -0,0 +1,39 @@
+import mock
+
+from pyshark.tshark.tshark import (
+ get_tshark_display_filter_flag,
+ get_tshark_interfaces,
+ get_tshark_version,
+)
+
+@mock.patch('pyshark.tshark.tshark.subprocess.check_output', autospec=True)
+def test_get_tshark_version(mock_check_output):
+ mock_check_outp... | |
c637bb057698b2699c9515ee9aed8432d7c51fe7 | projects/generate.py | projects/generate.py | import os
import subprocess
import sys
# get the path to the directory containing the script
projects_directory = os.path.dirname(os.path.realpath(__file__))
platform_name = sys.platform
platform_folder = ""
if platform_name == 'win32':
platform_folder = "win"
elif platform_name == 'darwin':
platform_folder = "mac"... | Add Python project generation script. | Add Python project generation script.
| Python | mit | chrisculy/Divida,chrisculy/Divida | ---
+++
@@ -0,0 +1,27 @@
+import os
+import subprocess
+import sys
+
+# get the path to the directory containing the script
+projects_directory = os.path.dirname(os.path.realpath(__file__))
+
+platform_name = sys.platform
+platform_folder = ""
+if platform_name == 'win32':
+ platform_folder = "win"
+elif platform_nam... | |
ef204d9455070d3ebff2890813e98ca44d398212 | client/bootloader_run_application.py | client/bootloader_run_application.py | #!/usr/bin/env python
import utils
import commands
def parse_commandline_args():
parser = utils.ConnectionArgumentParser(description='Send a jump to application command.')
parser.add_argument("ids", metavar='DEVICEID', nargs='*', type=int,
help="Device IDs to send jump command")
par... | Add tool to send a jump to application command. | Add tool to send a jump to application command.
| Python | bsd-2-clause | cvra/can-bootloader,cvra/can-bootloader,cvra/can-bootloader,cvra/can-bootloader | ---
+++
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+import utils
+import commands
+
+def parse_commandline_args():
+ parser = utils.ConnectionArgumentParser(description='Send a jump to application command.')
+ parser.add_argument("ids", metavar='DEVICEID', nargs='*', type=int,
+ help="Device... | |
7c292b1577420d74fd72cbc4eef3d5364ba01bb2 | backend/django/apps/accounts/migrations/0001_initial.py | backend/django/apps/accounts/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-11 19:06
from __future__ import unicode_literals
import apps.accounts.models
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependenc... | Make the initial account migrations | Make the initial account migrations
| Python | mit | slavpetroff/sweetshop,slavpetroff/sweetshop | ---
+++
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.3 on 2017-07-11 19:06
+from __future__ import unicode_literals
+
+import apps.accounts.models
+from django.db import migrations, models
+import django.db.models.deletion
+import django.utils.timezone
+
+
+class Migration(migrations.Migratio... | |
3c9ef6d42bb45d147d0c6093ea134d94fc4cf29f | penn/libraries.py | penn/libraries.py | """A module for consuming the Penn Libraries API"""
import requests
BASE_URL = "http://dla.library.upenn.edu/2.0.0/search"
def search(query):
"""Search Penn Libraries Franklin for documents
The maximum pagesize currently is 50.
"""
params = {
's.cmd': 'setTextQuery(%s)setPageSize(50)setHoldin... | Add primitive library search support | Add primitive library search support
| Python | mit | pennlabs/penn-sdk-python,pennlabs/penn-sdk-python | ---
+++
@@ -0,0 +1,14 @@
+"""A module for consuming the Penn Libraries API"""
+import requests
+
+BASE_URL = "http://dla.library.upenn.edu/2.0.0/search"
+
+
+def search(query):
+ """Search Penn Libraries Franklin for documents
+ The maximum pagesize currently is 50.
+ """
+ params = {
+ 's.cmd': 's... | |
8290df4317b0aae2c15b4a82942413b84f754e84 | cla_public/apps/base/tests/test_locale.py | cla_public/apps/base/tests/test_locale.py | import unittest
from cla_public.apps.base.views import set_locale
from cla_public.app import create_app
from flask import request
class LocaleTest(unittest.TestCase):
def setUp(self):
self.app = create_app('config/testing.py')
ctx = self.app.test_request_context()
ctx.push()
self.client = self.app.... | Test locale is set based on query param | Test locale is set based on query param
| Python | mit | ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public | ---
+++
@@ -0,0 +1,30 @@
+import unittest
+from cla_public.apps.base.views import set_locale
+
+from cla_public.app import create_app
+from flask import request
+
+class LocaleTest(unittest.TestCase):
+
+ def setUp(self):
+ self.app = create_app('config/testing.py')
+ ctx = self.app.test_request_context()
+ ... | |
844fd2533063343c969d9ff9259c80605fe488dd | hiicart/forms.py | hiicart/forms.py | from django import forms
class PaymentFormBase(forms.Form):
def __getitem__(self, key):
payment_fields = self._get_payment_fields()
if key in payment_fields:
key = payment_fields[key]
return super(PaymentFormBase, self).__getitem__(key)
def _get_payment_fields(self):
ra... | Apply refactoring done to authorize.net form/gateway to braintree. | Apply refactoring done to authorize.net form/gateway to braintree.
| Python | mit | hiidef/hiicart,hiidef/hiicart | ---
+++
@@ -0,0 +1,19 @@
+from django import forms
+
+
+class PaymentFormBase(forms.Form):
+
+ def __getitem__(self, key):
+ payment_fields = self._get_payment_fields()
+ if key in payment_fields:
+ key = payment_fields[key]
+ return super(PaymentFormBase, self).__getitem__(key)
+
+ ... | |
8a07ebf3db3cd2b70534c92e90d5428444e3d8f1 | bookwormDB/bin/dbbindings-flask.py | bookwormDB/bin/dbbindings-flask.py | #!/usr/bin/env python
#So we load in the terms that allow the API implementation to happen for now.
from bookwormDB.general_API import SQLAPIcall as SQLAPIcall
from flask import Flask, request, Response
import json
import os
app = Flask(__name__)
@app.route('/')
def index():
JSONinput = request.args.get('queryTe... | Add a python-only alternative to dbbindings.py | Add a python-only alternative to dbbindings.py
Pushing a small web app that can return Bookworm API calls through Python, rather than Apache HTTP Server. It is currently a very simple porting of the Apache code that runs on port 8080, and is intended for minimal installs.
| Python | mit | Bookworm-project/BookwormDB,Bookworm-project/BookwormDB | ---
+++
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+
+#So we load in the terms that allow the API implementation to happen for now.
+from bookwormDB.general_API import SQLAPIcall as SQLAPIcall
+from flask import Flask, request, Response
+import json
+import os
+
+app = Flask(__name__)
+
+@app.route('/')
+def index():
+ ... | |
ea0ff4ae04907473e2af6e7629ea9d73a34f4d85 | graphysio/plotwidgets/poiselector.py | graphysio/plotwidgets/poiselector.py | from functools import partial
import numpy as np
import pandas as pd
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore
from graphysio.plotwidgets.plotwidget import PlotWidget
from graphysio.plotwidgets.tsplot import CurveItemWithFeet
class POISelectorWidget(PlotWidget):
@staticmethod
def mouseMo... | Add sketch for POI selector widget | Add sketch for POI selector widget
| Python | isc | jaj42/dyngraph,jaj42/GraPhysio,jaj42/GraPhysio | ---
+++
@@ -0,0 +1,43 @@
+from functools import partial
+
+import numpy as np
+import pandas as pd
+import pyqtgraph as pg
+
+from pyqtgraph.Qt import QtGui, QtCore
+
+from graphysio.plotwidgets.plotwidget import PlotWidget
+from graphysio.plotwidgets.tsplot import CurveItemWithFeet
+
+class POISelectorWidget(PlotWid... | |
3bcb4fd5fd9680d33423e76bd9502f408a5e498f | tests/test_modules/test_scanning/test_unrollingblock.py | tests/test_modules/test_scanning/test_unrollingblock.py | from mock import Mock
from malcolm.modules.scanning.blocks import unrolling_block
from malcolm.testutil import ChildTestCase
class TestUnrollingBlock(ChildTestCase):
def test_unrolling_block(self):
self.create_child_block(
unrolling_block,
Mock(),
mri="TEST:MRI",
... | Add test to instantiate unrolling block | Add test to instantiate unrolling block
| Python | apache-2.0 | dls-controls/pymalcolm,dls-controls/pymalcolm,dls-controls/pymalcolm | ---
+++
@@ -0,0 +1,13 @@
+from mock import Mock
+
+from malcolm.modules.scanning.blocks import unrolling_block
+from malcolm.testutil import ChildTestCase
+
+
+class TestUnrollingBlock(ChildTestCase):
+ def test_unrolling_block(self):
+ self.create_child_block(
+ unrolling_block,
+ Moc... | |
998442022f2c71197c6e91fb8de276316eff5cc5 | tempest/tests/lib/services/volume/v2/test_capabilities_client.py | tempest/tests/lib/services/volume/v2/test_capabilities_client.py | # Copyright 2017 AT&T Corporation.
# 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. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | Add Capabilities Client unit tests | Add Capabilities Client unit tests
Change-Id: I0bb5d0d7b775ee41dedf6ac30ece3698d585f072
| Python | apache-2.0 | Juniper/tempest,vedujoshi/tempest,cisco-openstack/tempest,cisco-openstack/tempest,vedujoshi/tempest,masayukig/tempest,openstack/tempest,Juniper/tempest,masayukig/tempest,openstack/tempest | ---
+++
@@ -0,0 +1,77 @@
+# Copyright 2017 AT&T Corporation.
+# 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. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/license... | |
1c39b15ef604db13c37e37080ba6294c163b0c5d | tools/gitlog2asciidoc.py | tools/gitlog2asciidoc.py | #!/usr/bin/python
import sys
import re
import subprocess
"""
This script generates a release note from the output of git log
between the specified tags.
Arguments:
since -- tag name
until -- tag name
Example Input:
* <commit subject>
+
<commit message>
Bug: issue 123
Change-Id: <change id>
Signed... | Add scripts to create release notes from git log | Add scripts to create release notes from git log
These script generates a list of commits from git log between
<since> and <until>. The output of this script is in asciidoc
format containting list of commits subject and body.
Bug: issue 1272
Change-Id: I32b2ee055e81c5663128aafefd5f46c2e17e58c8
| Python | apache-2.0 | midnightradio/gerrit,zommarin/gerrit,gcoders/gerrit,bpollack/gerrit,Seinlin/gerrit,thesamet/gerrit,keerath/gerrit_newssh,teamblueridge/gerrit,qtproject/qtqa-gerrit,GerritCodeReview/gerrit,anminhsu/gerrit,quyixia/gerrit,teamblueridge/gerrit,thinkernel/gerrit,Seinlin/gerrit,quyixia/gerrit,ashang/aaron-gerrit,Saulis/gerri... | ---
+++
@@ -0,0 +1,83 @@
+#!/usr/bin/python
+import sys
+import re
+import subprocess
+
+"""
+This script generates a release note from the output of git log
+between the specified tags.
+
+Arguments:
+since -- tag name
+until -- tag name
+
+Example Input:
+
+ * <commit subject>
+ +
+ <commit message>
+
+ Bug... | |
02cad9118c4aa03e783899ce4637d4c4fe010f57 | scripts/add-missing-terminal-part-ofs.py | scripts/add-missing-terminal-part-ofs.py | #!/usr/bin/env python
from common import db_connection
import sys
if len(sys.argv) != 3:
print >> sys.stderr, "Usage: %s <PROJECT-ID> <USER-ID>" % (sys.argv[0],)
sys.exit(1)
project_id = int(sys.argv[1])
user_id = int(sys.argv[2])
c = db_connection.cursor()
c.execute("SELECT id FROM relation WHERE project... | Add a script to add back the missing [terminal] part_of [skeleton] relationships | Add a script to add back the missing [terminal] part_of [skeleton] relationships
| Python | agpl-3.0 | htem/CATMAID,fzadow/CATMAID,htem/CATMAID,htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID,fzadow/CATMAID | ---
+++
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+
+from common import db_connection
+
+import sys
+
+if len(sys.argv) != 3:
+ print >> sys.stderr, "Usage: %s <PROJECT-ID> <USER-ID>" % (sys.argv[0],)
+ sys.exit(1)
+
+project_id = int(sys.argv[1])
+user_id = int(sys.argv[2])
+
+c = db_connection.cursor()
+
+c.exe... | |
58c10946515b37e55b06f3e455a59c44d3b6076d | buzzmobile/tests/rostest_utils.py | buzzmobile/tests/rostest_utils.py | import roslaunch
import functools
import subprocess
def with_roscore(obj):
"""Decorator to run all tests in a testcase with their own roscore.
This wraps the setUp and tearDown methods to start by first spinning up a
roscore process, and tears it down at the very end. This adds a small time
penalty, b... | Add utilities to make writing ros tests less painful. | Add utilities to make writing ros tests less painful.
| Python | mit | jgkamat/buzzmobile,gtagency/buzzmobile,gtagency/buzzmobile,jgkamat/buzzmobile,gtagency/buzzmobile,jgkamat/buzzmobile | ---
+++
@@ -0,0 +1,50 @@
+import roslaunch
+import functools
+import subprocess
+
+def with_roscore(obj):
+ """Decorator to run all tests in a testcase with their own roscore.
+
+ This wraps the setUp and tearDown methods to start by first spinning up a
+ roscore process, and tears it down at the very end. T... | |
e64b399370ae4ddb21a969d1b8c664d2201790f9 | engines/ep/management/sync_repl.py | engines/ep/management/sync_repl.py | #!/usr/bin/env python
""" Simple CLI for basic SyncWrite operations."""
from __future__ import print_function
from collections import defaultdict
import mc_bin_client
import sys
if len(sys.argv) < 7:
print("Usage: {} <host[:port]> <user> <password> <bucket> <op> <key> [value]".format(sys.argv[0]), file = sys.std... | Add basic CLI for SyncWrite requests | [SR] Add basic CLI for SyncWrite requests
Add sync_repl.py; a basic command-line interface to making Synchronous
Replication requests.
Example usage - to perform a set with durability requirements to key
'test' setting its value to 'XXX':
./sync_repl.py localhost:12000 Administrator asdasd default setD test XXX
... | Python | bsd-3-clause | daverigby/kv_engine,daverigby/kv_engine,daverigby/kv_engine,daverigby/kv_engine | ---
+++
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+
+""" Simple CLI for basic SyncWrite operations."""
+
+from __future__ import print_function
+from collections import defaultdict
+import mc_bin_client
+import sys
+
+if len(sys.argv) < 7:
+ print("Usage: {} <host[:port]> <user> <password> <bucket> <op> <key> [value... | |
e87f5c80d7723480544374c175cacc5540f9f6ab | Lib/test/leakers/test_generator_cycle.py | Lib/test/leakers/test_generator_cycle.py |
# This leaks since the introduction of yield-expr and the use of generators
# as coroutines, trunk revision 39239. The cycle-GC doesn't seem to pick up
# the cycle, or decides it can't clean it up.
def leak():
def gen():
while True:
yield g
g = gen()
| Add an example of a generator->freevar->cell->generator reference-cycle that doesn't get cleaned up and thus leaks. | Add an example of a generator->freevar->cell->generator reference-cycle that
doesn't get cleaned up and thus leaks.
| Python | mit | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | ---
+++
@@ -0,0 +1,11 @@
+
+# This leaks since the introduction of yield-expr and the use of generators
+# as coroutines, trunk revision 39239. The cycle-GC doesn't seem to pick up
+# the cycle, or decides it can't clean it up.
+
+def leak():
+ def gen():
+ while True:
+ yield g
+ g = gen()
+ | |
7529bbffd349c57d3ec527a91b620252d0814414 | kolibri/core/test/test_key_urls.py | kolibri/core/test/test_key_urls.py | from __future__ import absolute_import, print_function, unicode_literals
from django.core.urlresolvers import reverse
from rest_framework.test import APITestCase
from kolibri.auth.models import Facility, DeviceOwner
class KolibriTagNavigationTestCase(APITestCase):
def test_redirect_to_setup_wizard(self):
... | Test that redirects from root URL are performed appropriately. | Test that redirects from root URL are performed appropriately.
| Python | mit | mrpau/kolibri,rtibbles/kolibri,christianmemije/kolibri,jonboiser/kolibri,benjaoming/kolibri,jayoshih/kolibri,jtamiace/kolibri,learningequality/kolibri,jonboiser/kolibri,christianmemije/kolibri,jamalex/kolibri,DXCanas/kolibri,aronasorman/kolibri,whitzhu/kolibri,DXCanas/kolibri,lyw07/kolibri,MingDai/kolibri,lyw07/kolibri... | ---
+++
@@ -0,0 +1,20 @@
+from __future__ import absolute_import, print_function, unicode_literals
+
+from django.core.urlresolvers import reverse
+from rest_framework.test import APITestCase
+
+from kolibri.auth.models import Facility, DeviceOwner
+
+class KolibriTagNavigationTestCase(APITestCase):
+
+ def test_r... | |
8b778a0564d424fc4c9e91da90ced7e8cec9b002 | lava/utils/data_tables/backends.py | lava/utils/data_tables/backends.py | # Copyright (C) 2012 Linaro Limited
#
# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
#
# This file is part of LAVA Server.
#
# LAVA Server is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software... | Add array backend for data tables | Add array backend for data tables
This simple backend performs all operations inside python's runtime
memory. It is suitable for working with small data sets and experimenting
with data-tables.
The actual backend is not fully finished as it is not essential. It lacks
per-column search, regexp support and multi-column... | Python | agpl-3.0 | OSSystems/lava-server,Linaro/lava-server,OSSystems/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server | ---
+++
@@ -0,0 +1,72 @@
+# Copyright (C) 2012 Linaro Limited
+#
+# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
+#
+# This file is part of LAVA Server.
+#
+# LAVA Server is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# as pu... | |
b635b6f17e8fceba72e48ab074120d3bddd9388d | tools/process_EXO.py | tools/process_EXO.py |
# EXO Convesion Script
# Using specification v1.01
# J.C. Loach (2013)
# Textual replacements
remove = {r"\centering":"", r"newline":"", r"tabular":""};
# Main loop through data file
with open("exo_data.txt") as f_in:
for line in f_in:
for i, j in remove.iteritems():
line = line.replace(i,j)
line = l... | Add tool for converting EXO data from latex to JSON | Add tool for converting EXO data from latex to JSON
| Python | apache-2.0 | chrisstanford/persephone-darkside,nepahwin/persephone,nepahwin/persephone,chrisstanford/persephone-darkside | ---
+++
@@ -0,0 +1,48 @@
+
+# EXO Convesion Script
+# Using specification v1.01
+# J.C. Loach (2013)
+
+# Textual replacements
+remove = {r"\centering":"", r"newline":"", r"tabular":""};
+
+# Main loop through data file
+with open("exo_data.txt") as f_in:
+ for line in f_in:
+ for i, j in remove.iteritems():
+ ... | |
030e558b3b52900b8fa2cea9a92c055de3ec5b44 | corehq/apps/domain/management/commands/migrate_domain_countries.py | corehq/apps/domain/management/commands/migrate_domain_countries.py | from django.core.management.base import LabelCommand
from django_countries.countries import COUNTRIES
from corehq.apps.domain.models import Domain
class Command(LabelCommand):
help = "Migrates old django domain countries from string to list. Sept 2014."
args = ""
label = ""
def handle(self, *args, **o... | Add management command to migrate countries to list | Add management command to migrate countries to list
| Python | bsd-3-clause | puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq | ---
+++
@@ -0,0 +1,25 @@
+from django.core.management.base import LabelCommand
+from django_countries.countries import COUNTRIES
+from corehq.apps.domain.models import Domain
+
+class Command(LabelCommand):
+ help = "Migrates old django domain countries from string to list. Sept 2014."
+ args = ""
+ label = ... | |
2e9c58f00db55e12f3a9df1a71fe33fbe440d7ce | corehq/apps/domain/management/commands/migrate_domain_countries.py | corehq/apps/domain/management/commands/migrate_domain_countries.py | from django.core.management.base import LabelCommand
from django_countries.countries import COUNTRIES
from corehq.apps.domain.models import Domain
class Command(LabelCommand):
help = "Migrates old django domain countries from string to list. Sept 2014."
args = ""
label = ""
def handle(self, *args, **o... | from django.core.management.base import LabelCommand
from django_countries.countries import COUNTRIES
from corehq.apps.domain.models import Domain
class Command(LabelCommand):
help = "Migrates old django domain countries from string to list. Sept 2014."
args = ""
label = ""
def handle(self, *args, **o... | Add migration for deployment country to countries | Add migration for deployment country to countries
| Python | bsd-3-clause | qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq | ---
+++
@@ -11,14 +11,28 @@
print "Migrating Domain countries"
country_lookup = {x[1].lower(): x[0] for x in COUNTRIES}
+ #Special cases
+ country_lookup["USA"] = country_lookup["united states"]
+ country_lookup["California"] = country_lookup["united states"]
+ country_... |
5b251c46581e286f05e02ec2363b9c83a228f3fb | data_collection/social_media/twitter/spellchecking/get_category.py | data_collection/social_media/twitter/spellchecking/get_category.py | #!/usr/bin/env python2
# Install nltk: 'sudo pip install -U pyyaml nltk'
from nltk.stem.lancaster import LancasterStemmer
c = {'cname1': ['hello', 'rice', 'increasing'], 'cname2': ['horses', 'horse']}
c_stems = {}
st = LancasterStemmer()
# 1. Build set for existing categories
def init_stem_sets():
for cname in ... | Use NLTK to get word stems (useful for categorization) | Use NLTK to get word stems (useful for categorization)
| Python | bsd-3-clause | FAB4D/humanitas,FAB4D/humanitas,FAB4D/humanitas | ---
+++
@@ -0,0 +1,30 @@
+#!/usr/bin/env python2
+
+# Install nltk: 'sudo pip install -U pyyaml nltk'
+from nltk.stem.lancaster import LancasterStemmer
+
+c = {'cname1': ['hello', 'rice', 'increasing'], 'cname2': ['horses', 'horse']}
+c_stems = {}
+st = LancasterStemmer()
+
+# 1. Build set for existing categories
+d... | |
7ae164a58e229379f0acf674767bdb0b422cf13a | emission/net/ext_service/otp/test_otp.py | emission/net/ext_service/otp/test_otp.py | import unittest
import random
import datetime
import emission.net.ext_service.otp.otp as otp
import emission.core.wrapper.location as ecwl
import emission.storage.decorations.local_date_queries as ecsdlq
import emission.core.wrapper.user as ecwu
from past.utils import old_div
class TestOTPMethods(unittest.TestCase):... | Add test file for otp script | Add test file for otp script
| Python | bsd-3-clause | e-mission/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server | ---
+++
@@ -0,0 +1,56 @@
+import unittest
+import random
+import datetime
+import emission.net.ext_service.otp.otp as otp
+import emission.core.wrapper.location as ecwl
+import emission.storage.decorations.local_date_queries as ecsdlq
+import emission.core.wrapper.user as ecwu
+from past.utils import old_div
+
+
+cl... | |
6275c09373ac796876cebf62d74ac1f421eed3ca | ci/push/get_version_id.py | ci/push/get_version_id.py | import os
import sys
import csv
from push_api import SalesforcePushApi
# Force UTF8 output
reload(sys)
sys.setdefaultencoding('UTF8')
if __name__ == '__main__':
try:
username = os.environ.get('SF_USERNAME')
password = os.environ.get('SF_PASSWORD')
serverurl = os.environ.get('SF_SE... | Add push api script to get a version's salesforce id from its namespace and version number including support for patch and beta versions | Add push api script to get a version's salesforce id from its namespace
and version number including support for patch and beta versions
| Python | bsd-3-clause | steelbrick/CumulusCI,motivislearning/CumulusCI,steelbrick/CumulusCI,e02d96ec16/CumulusCI,cdcarter/CumulusCI,SalesforceFoundation/CumulusCI,Joble/CumulusCI,e02d96ec16/CumulusCI,motivislearning/CumulusCI,SalesforceFoundation/CumulusCI | ---
+++
@@ -0,0 +1,61 @@
+import os
+import sys
+import csv
+from push_api import SalesforcePushApi
+
+# Force UTF8 output
+reload(sys)
+sys.setdefaultencoding('UTF8')
+
+if __name__ == '__main__':
+ try:
+
+ username = os.environ.get('SF_USERNAME')
+ password = os.environ.get('SF_PASSWORD')
... | |
2f4722bb30e39510e985a08da1d28dbdd6ccd232 | test/widgets/test_crypto_ticker.py | test/widgets/test_crypto_ticker.py | # Copyright (c) 2021 elParaguayo
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distrib... | Add test for CryptoTicker widget | Add test for CryptoTicker widget
| Python | mit | ramnes/qtile,qtile/qtile,ramnes/qtile,qtile/qtile | ---
+++
@@ -0,0 +1,44 @@
+# Copyright (c) 2021 elParaguayo
+#
+# 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... | |
712ae25e8deda242856c2cc21afb86ba11c0258b | dockci/migrations/0003.py | dockci/migrations/0003.py | """
Migrate version to tag in build models
"""
import os
import shutil
import yaml
job_dirs = (
filename for filename in
os.listdir(os.path.join('data', 'builds'))
if os.path.isdir(os.path.join('data', 'builds', filename))
)
for job_dir in job_dirs:
build_files = (
filename for filename in
... | Add migration to rename version -> tag field | Add migration to rename version -> tag field
| Python | isc | RickyCook/paas-in-a-day-dockci,RickyCook/paas-in-a-day-dockci | ---
+++
@@ -0,0 +1,36 @@
+"""
+Migrate version to tag in build models
+"""
+import os
+import shutil
+import yaml
+
+
+job_dirs = (
+ filename for filename in
+ os.listdir(os.path.join('data', 'builds'))
+ if os.path.isdir(os.path.join('data', 'builds', filename))
+)
+for job_dir in job_dirs:
+ build_file... | |
c6108cacc7705c27b8913d82229c331551796830 | openprescribing/frontend/management/commands/migrate_some_dmd_data.py | openprescribing/frontend/management/commands/migrate_some_dmd_data.py | # This is a one-off command to migrate all TariffPrice and NCSOConcession data
# from the dmd app to the frontend app. It can be deleted once the dmd app has
# been removed.
from django.db import transaction
from django.core.management import BaseCommand
from dmd.models import TariffPrice as TariffPriceOld
from dmd.... | Add task to migrate TariffPrice and NCSOConcession data | Add task to migrate TariffPrice and NCSOConcession data
This file can be removed once the migration is done. (Should it be a
data migration?)
| Python | mit | ebmdatalab/openprescribing,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc | ---
+++
@@ -0,0 +1,39 @@
+# This is a one-off command to migrate all TariffPrice and NCSOConcession data
+# from the dmd app to the frontend app. It can be deleted once the dmd app has
+# been removed.
+
+from django.db import transaction
+from django.core.management import BaseCommand
+
+from dmd.models import Tari... | |
ab935c2fed108aeb1e7c0cad3ba97c48967c676f | flexx/util/eventhelper.py | flexx/util/eventhelper.py | import os
def iter_filenames(dir, ignore):
for dirpath, dirnames, filenames in os.walk(dir):
for fname in filenames:
filename = os.path.join(dirpath, fname)
if fname.endswith('.py'):
if fname not in ignore and filename not in ignore:
yie... | Add simple util to help convert to new event system | Add simple util to help convert to new event system
| Python | bsd-2-clause | jrversteegh/flexx,JohnLunzer/flexx,JohnLunzer/flexx,zoofIO/flexx,zoofIO/flexx,JohnLunzer/flexx,jrversteegh/flexx | ---
+++
@@ -0,0 +1,62 @@
+import os
+
+
+def iter_filenames(dir, ignore):
+ for dirpath, dirnames, filenames in os.walk(dir):
+ for fname in filenames:
+ filename = os.path.join(dirpath, fname)
+ if fname.endswith('.py'):
+ if fname not in ignore and filename not in igno... | |
1bb34ccef2f5c622f258a7dbe375e3a62b6cf63d | py/magical-string.py | py/magical-string.py | class Solution(object):
def magicalString(self, n):
"""
:type n: int
:rtype: int
"""
if n == 0:
return 0
elif n <= 3:
return 1
q = [1, 2, 2]
cur = 1
skip = 2
cnt_1 = 1
total_cnt = 3
for v in q:
... | Add py solution for 481. Magical String | Add py solution for 481. Magical String
481. Magical String: https://leetcode.com/problems/magical-string/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,26 @@
+class Solution(object):
+ def magicalString(self, n):
+ """
+ :type n: int
+ :rtype: int
+ """
+ if n == 0:
+ return 0
+ elif n <= 3:
+ return 1
+ q = [1, 2, 2]
+ cur = 1
+ skip = 2
+ cnt_1 = 1
+ ... | |
654d21100ff2908af6c44e2d2d71ba92b1e96722 | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'aa87035cc012ce0d533bb56b947bca81a6e71b82'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
... | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'e375124044f9044ac88076eba0cd17361ee0997c'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
... | Upgrade libchromiumcontent to remove dom storage quota | Upgrade libchromiumcontent to remove dom storage quota
Closes #897.
| Python | mit | beni55/electron,vHanda/electron,leftstick/electron,mubassirhayat/electron,simongregory/electron,voidbridge/electron,tomashanacek/electron,nicobot/electron,MaxWhere/electron,pandoraui/electron,farmisen/electron,shennushi/electron,thomsonreuters/electron,minggo/electron,LadyNaggaga/electron,MaxGraey/electron,lrlna/electr... | ---
+++
@@ -4,7 +4,7 @@
import sys
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
-LIBCHROMIUMCONTENT_COMMIT = 'aa87035cc012ce0d533bb56b947bca81a6e71b82'
+LIBCHROMIUMCONTENT_COMMIT = 'e375124044f9044ac88076eba0cd17361ee0997c'
ARCH = {
'cygwin': '32bit', |
d9348ebad71376dd6e8c350f9d559cdd54c60cd0 | games/management/commands/resize_media.py | games/management/commands/resize_media.py | """Resize all game banners to a fixed size"""
import os
import shutil
from django.core.management.base import BaseCommand
from django.conf import settings
from sorl.thumbnail import get_thumbnail
from games.models import Game
class Command(BaseCommand):
"""Resize banners and icons"""
ICON_PATH = os.path.join... | Add management command to move icons and banners to static locations | Add management command to move icons and banners to static locations
| Python | agpl-3.0 | lutris/website,lutris/website,lutris/website,lutris/website | ---
+++
@@ -0,0 +1,62 @@
+"""Resize all game banners to a fixed size"""
+import os
+import shutil
+from django.core.management.base import BaseCommand
+from django.conf import settings
+from sorl.thumbnail import get_thumbnail
+from games.models import Game
+
+
+class Command(BaseCommand):
+ """Resize banners and ... | |
67b90064cfaa09c55ea138895eb6c7ed9513bc96 | Python-demo/test-demo/test_loop_with_else.py | Python-demo/test-demo/test_loop_with_else.py | # coding=utf-8
"""
# test_loop_with_else.py
#
# Copyright(C) By AbsentM. 2018
#
# Author: AbsentM
# Date: 2018/03/18
#
# Description: Test python loop with else demo
#
# Change Log:
# 2018/03/18 AbsentM Create the file
# 2018/03/18 AbsentM Add test demo
#
"""
def run_for_else_validation(fruits):
"""
... | Add python loop with else demo | Add python loop with else demo
| Python | mit | absentm/Demo,absentm/Demo,absentm/Demo,absentm/Demo,absentm/Demo,absentm/Demo | ---
+++
@@ -0,0 +1,113 @@
+# coding=utf-8
+
+"""
+ # test_loop_with_else.py
+ #
+ # Copyright(C) By AbsentM. 2018
+ #
+ # Author: AbsentM
+ # Date: 2018/03/18
+ #
+ # Description: Test python loop with else demo
+ #
+ # Change Log:
+ # 2018/03/18 AbsentM Create the file
+ # 2018/03/18 AbsentM Add test demo
+ #
+""... | |
c8336a85f002dfe8437c6092f3d44bca2c5e0b45 | dbaas/maintenance/scripts/migrate_email.py | dbaas/maintenance/scripts/migrate_email.py | from django.contrib.auth.models import User
from copy import deepcopy
def _migrate(file_path):
arq = open(file_path)
for line in arq.readlines():
old_email, new_email = line.strip().split(',')
old_email = old_email.strip()
new_email = new_email.strip()
try:
old_user... | Create script to migrate email | Create script to migrate email
| Python | bsd-3-clause | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | ---
+++
@@ -0,0 +1,45 @@
+from django.contrib.auth.models import User
+from copy import deepcopy
+
+
+def _migrate(file_path):
+ arq = open(file_path)
+ for line in arq.readlines():
+ old_email, new_email = line.strip().split(',')
+ old_email = old_email.strip()
+ new_email = new_email.stri... | |
fe45b745e5f0a859f10b6edf2ad8f1e24cc01a56 | heat_integrationtests/functional/test_simultaneous_update.py | heat_integrationtests/functional/test_simultaneous_update.py | # 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, software
# d... | Add integration tests for simultaneous updates | Add integration tests for simultaneous updates
Convergence allows us to start a stack update while a previous update (or
create) is still in progress. If a resource is found to be locked by a
previous graph traversal when the new traversal comes to update it, the
earlier traversal is responsible for retriggering the r... | Python | apache-2.0 | openstack/heat,noironetworks/heat,noironetworks/heat,openstack/heat | ---
+++
@@ -0,0 +1,83 @@
+# 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... | |
35aa49152ab28d3364afeac4a053b41082f0b3b9 | systrace/systrace/monitor_unittest.py | systrace/systrace/monitor_unittest.py | # Copyright 2016 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 os
import unittest
from systrace import decorators
from systrace import update_systrace_trace_viewer
SCRIPT_DIR = os.path.dirname(os.path.abspath(__... | Validate files needed by Android tools | Validate files needed by Android tools
BUG=catapult:#2546
Review-Url: https://codereview.chromium.org/2194743002
| Python | bsd-3-clause | sahiljain/catapult,catapult-project/catapult-csm,benschmaus/catapult,catapult-project/catapult,catapult-project/catapult,benschmaus/catapult,benschmaus/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,benschmaus/catapult,catapult-project/catapult,benschmaus/catapult,catapult-projec... | ---
+++
@@ -0,0 +1,52 @@
+# Copyright 2016 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 os
+import unittest
+
+from systrace import decorators
+from systrace import update_systrace_trace_viewer
+
+SCRIPT_DI... | |
cc0d1d493a4f9d6d702951f21cce805a5e102a6f | spectral_graph_display.py | spectral_graph_display.py | import numpy as np
from scipy import io, sparse, linalg
# run this from elegant scipy chapter
chem = np.load('chem-network.npy')
gap = np.load('gap-network.npy')
neuron_types = np.load('neuron-types.npy')
neuron_ids = np.load('neurons.npy')
A = chem + gap
n = A.shape[0]
c = (A + A.T) / 2
d = sparse.diags([np.sum(c, ax... | Add spectral graph display script | Add spectral graph display script
| Python | bsd-3-clause | jni/useful-histories | ---
+++
@@ -0,0 +1,35 @@
+import numpy as np
+from scipy import io, sparse, linalg
+# run this from elegant scipy chapter
+
+chem = np.load('chem-network.npy')
+gap = np.load('gap-network.npy')
+neuron_types = np.load('neuron-types.npy')
+neuron_ids = np.load('neurons.npy')
+A = chem + gap
+n = A.shape[0]
+c = (A + A... | |
53436d9ea71b11c45fb7208c13b626d1b47d1f70 | tools/tests/test_linter_custom_check.py | tools/tests/test_linter_custom_check.py | import os
from itertools import chain
from mock import patch, MagicMock
from unittest import TestCase
from tools.linter_lib.custom_check import build_custom_checkers
ROOT_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
CHECK_MESSAGE = "Fix the corresponding rule in `tools/linter_lib/custom_check.py`.... | Add test case for custom_check.py | linter: Add test case for custom_check.py
Fixes #5406.
| Python | apache-2.0 | dhcrzf/zulip,jackrzhang/zulip,amanharitsh123/zulip,Galexrt/zulip,Galexrt/zulip,timabbott/zulip,rht/zulip,dhcrzf/zulip,rishig/zulip,zulip/zulip,zulip/zulip,showell/zulip,mahim97/zulip,timabbott/zulip,kou/zulip,kou/zulip,rht/zulip,synicalsyntax/zulip,punchagan/zulip,brainwane/zulip,timabbott/zulip,showell/zulip,synicalsy... | ---
+++
@@ -0,0 +1,39 @@
+import os
+
+from itertools import chain
+from mock import patch, MagicMock
+from unittest import TestCase
+
+from tools.linter_lib.custom_check import build_custom_checkers
+
+ROOT_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
+CHECK_MESSAGE = "Fix the corresponding rule i... | |
9475f33d5689d348721c3f7409f7bb9ae2f0e639 | solidity/hypothesis/SolidityTest.py | solidity/hypothesis/SolidityTest.py | import json
from hypothesis import given, assume, example
import hypothesis.strategies as st
import unittest
from web3 import Web3, TestRPCProvider, RPCProvider
import os
import sys
sys.path.append(os.path.join(os.path.join(os.path.dirname(__file__),'..'),'python'))
import BancorFormula
class TestFormula(unittest.T... | Add a test which executes the Solidity contract over an Ethereum RPC, and then compares the result with the Python emulation of the Solidity contract. | Add a test which executes the Solidity contract over an Ethereum RPC, and then compares the result with the Python emulation of the Solidity contract.
| Python | apache-2.0 | enjin/contracts | ---
+++
@@ -0,0 +1,37 @@
+import json
+from hypothesis import given, assume, example
+import hypothesis.strategies as st
+import unittest
+from web3 import Web3, TestRPCProvider, RPCProvider
+
+
+import os
+import sys
+sys.path.append(os.path.join(os.path.join(os.path.dirname(__file__),'..'),'python'))
+import Bancor... | |
45d7a440067f6c0aed45468863814fa0ee1c9449 | rembed/tests/test_plain_rnn.py | rembed/tests/test_plain_rnn.py | import unittest
import numpy as np
import theano
from theano import tensor as T
from rembed.plain_rnn import RNN
from rembed.util import VariableStore, CropAndPad, IdentityLayer
class RNNTestCase(unittest.TestCase):
"""Basic functional tests for RNN with dummy data."""
def _make_rnn(self, seq_length=4):
... | Check in plain RNN test. | Check in plain RNN test.
| Python | mit | stanfordnlp/spinn,nyu-mll/spinn,stanfordnlp/spinn,nyu-mll/spinn,nyu-mll/spinn,stanfordnlp/spinn | ---
+++
@@ -0,0 +1,52 @@
+import unittest
+
+import numpy as np
+import theano
+from theano import tensor as T
+
+from rembed.plain_rnn import RNN
+from rembed.util import VariableStore, CropAndPad, IdentityLayer
+
+
+class RNNTestCase(unittest.TestCase):
+
+ """Basic functional tests for RNN with dummy data."""
+... | |
5974132232605d27fde2704631e3c8a6d928a723 | src/simple-http-server.py | src/simple-http-server.py | #!/usr/bin/env python3
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
import os, http.server
def main(args):
os.chdir(args.directory)
addr = ('' ,args.port)
httpd = http.server.HTTPServer(addr, http.server.SimpleHTTPRequestHandler)
httpd.serve_forever()
if __name__ == '__main__':
... | Add stupidly simple HTTP server using standard python 3 | Add stupidly simple HTTP server using standard python 3
| Python | unlicense | pastly/python-snippits | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
+import os, http.server
+
+def main(args):
+ os.chdir(args.directory)
+ addr = ('' ,args.port)
+ httpd = http.server.HTTPServer(addr, http.server.SimpleHTTPRequestHandler)
+ httpd.serve_for... | |
82162a334595ad47090dc1a8991d53ab5ece3736 | components/expression_evaluator.py | components/expression_evaluator.py | """A set of utility functions to evaluate expressions.
Sample Usage:
print(SgExpressionEvaluator.EvaluateExpressionInRow(["a", "bb", "ccc"], [1, 2, 3], "bb + 2.0 + ccc / a"))
print(SgExpressionEvaluator.EvaluateExpressionsInRow(["a", "bb", "ccc"], [1, 2, 3], ["bb + 2.0 + ccc / a", "a + bb + ccc"]))
t = tb.... | Add SgExpressionEvaluator - Evaluates expressions given fields and values | Add SgExpressionEvaluator - Evaluates expressions given fields and values
| Python | mit | lnishan/SQLGitHub | ---
+++
@@ -0,0 +1,44 @@
+"""A set of utility functions to evaluate expressions.
+
+Sample Usage:
+ print(SgExpressionEvaluator.EvaluateExpressionInRow(["a", "bb", "ccc"], [1, 2, 3], "bb + 2.0 + ccc / a"))
+ print(SgExpressionEvaluator.EvaluateExpressionsInRow(["a", "bb", "ccc"], [1, 2, 3], ["bb + 2.0 + ccc / a... | |
a543e4dd62de6e0dbda0fa43c67d3a3fe2165499 | download_summaries.py | download_summaries.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from utils.summary_downloader import SummaryDownloader
if __name__ == '__main__':
# setting target dir and time interval of interest
tgt_dir = r"D:\nhl\official_and_json\2016-17"
date = "May 20, 2017"
to_date = "May 30, 2017"
downloader = SummaryDow... | Add initial version of download script | Add initial version of download script
| Python | mit | leaffan/pynhldb | ---
+++
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from utils.summary_downloader import SummaryDownloader
+
+if __name__ == '__main__':
+
+ # setting target dir and time interval of interest
+ tgt_dir = r"D:\nhl\official_and_json\2016-17"
+
+ date = "May 20, 2017"
+ to_date = "May... | |
1c270ec827b2cbb2d8ed6077366d2d7d10e17b16 | utilities/foto-files/manage-duplicates.py | utilities/foto-files/manage-duplicates.py | '''
Compare File Contents and remove duplicate files
get sha256 hash for each file found
use dictionary to check for duplicates
delete duplicates
Dave Cuthbert
(C) 2021-02-12
MIT License
'''
import os
from collections import defaultdict
import hashlib
import sys
def get_hash(file_name):
BLOCK_SIZE =... | Replace older dups management script | Replace older dups management script | Python | mit | daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various | ---
+++
@@ -0,0 +1,73 @@
+'''
+Compare File Contents and remove duplicate files
+
+ get sha256 hash for each file found
+ use dictionary to check for duplicates
+ delete duplicates
+
+Dave Cuthbert
+(C) 2021-02-12
+MIT License
+'''
+
+import os
+from collections import defaultdict
+import hashlib
+import sys... | |
81248594a64d59236c0ab369fb1d5d7eee073568 | tests/test_coefficient.py | tests/test_coefficient.py | # -*- coding: utf-8 -*-
from nose.tools import assert_equal
from openfisca_france.model.prelevements_obligatoires.prelevements_sociaux.cotisations_sociales.allegements import *
from openfisca_core.periods import *
from openfisca_france import FranceTaxBenefitSystem
def test_coefficient_proratisation_only_contract_pe... | Add failing test for coefficient_proratisation | Add failing test for coefficient_proratisation
| Python | agpl-3.0 | antoinearnoud/openfisca-france,antoinearnoud/openfisca-france,sgmap/openfisca-france,sgmap/openfisca-france | ---
+++
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+
+from nose.tools import assert_equal
+
+from openfisca_france.model.prelevements_obligatoires.prelevements_sociaux.cotisations_sociales.allegements import *
+from openfisca_core.periods import *
+from openfisca_france import FranceTaxBenefitSystem
+
+def test_coeffi... | |
608976fb5663adc5cbfa3ebc9af00171e3042a98 | monkey/cpu_profile.py | monkey/cpu_profile.py | from com.android.monkeyrunner import MonkeyRunner as mkr
from com.android.monkeyrunner import MonkeyDevice as mkd
import os, sys
sys.path.append(os.getcwd())
import common
# String Constants
cpucfg_pkg = 'br.ufpe.emilianofirmino.cpunuke'
cpustress_pkg = 'br.ufpe.emilianofirmino.cpujudge'
def config_cpu(device, core... | Add monkeyrunner script of cpu energy usage | Add monkeyrunner script of cpu energy usage
Signed-off-by: Emiliano Firmino <05e638a1dec5cbdb4665208eae603124467a154b@gmail.com>
| Python | mit | Miliox/droid_emc2,Miliox/droid_emc2,Miliox/droid_emc2,Miliox/droid_emc2,Miliox/droid_emc2 | ---
+++
@@ -0,0 +1,45 @@
+from com.android.monkeyrunner import MonkeyRunner as mkr
+from com.android.monkeyrunner import MonkeyDevice as mkd
+
+import os, sys
+sys.path.append(os.getcwd())
+
+import common
+
+# String Constants
+cpucfg_pkg = 'br.ufpe.emilianofirmino.cpunuke'
+cpustress_pkg = 'br.ufpe.emilianofirmino.... | |
5ef9ea4fe0c90fad89d5ab772f42c48fd702860c | portal/migrations/versions/91351a73e6e2_.py | portal/migrations/versions/91351a73e6e2_.py | from alembic import op
import sqlalchemy as sa
"""empty message
Revision ID: 91351a73e6e2
Revises: 63262fe95b9c
Create Date: 2018-03-08 15:34:22.391417
"""
# revision identifiers, used by Alembic.
revision = '91351a73e6e2'
down_revision = '63262fe95b9c'
def upgrade():
# ### commands auto generated by Alembic... | Add bitmask for subscribed events to intervention table. | Add bitmask for subscribed events to intervention table.
| Python | bsd-3-clause | uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal | ---
+++
@@ -0,0 +1,29 @@
+from alembic import op
+import sqlalchemy as sa
+
+
+"""empty message
+
+Revision ID: 91351a73e6e2
+Revises: 63262fe95b9c
+Create Date: 2018-03-08 15:34:22.391417
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '91351a73e6e2'
+down_revision = '63262fe95b9c'
+
+
+def upgrade():... | |
303152ec2828fe6c709ec17d21910a9b3a369004 | share/migrations/0034_auto_20160830_2102.py | share/migrations/0034_auto_20160830_2102.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-30 21:02
from __future__ import unicode_literals
from django.db import migrations
import share.models.fields
class Migration(migrations.Migration):
dependencies = [
('share', '0033_auto_20160829_1707'),
]
operations = [
migr... | Add migration for Link.url type change | Add migration for Link.url type change
| Python | apache-2.0 | laurenbarker/SHARE,zamattiac/SHARE,CenterForOpenScience/SHARE,laurenbarker/SHARE,laurenbarker/SHARE,aaxelb/SHARE,CenterForOpenScience/SHARE,zamattiac/SHARE,aaxelb/SHARE,zamattiac/SHARE,aaxelb/SHARE,CenterForOpenScience/SHARE | ---
+++
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-08-30 21:02
+from __future__ import unicode_literals
+
+from django.db import migrations
+import share.models.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('share', '0033_auto_20160829_1707'),... | |
b758d6b1c445093a261e0f2be175181fa57109e4 | math/basic/Greatest_digit_in_number/Greatest_digit_in_number.py | math/basic/Greatest_digit_in_number/Greatest_digit_in_number.py | number = 201328361572
maxDigit = -1
# convert number into unique set of digits and iterate over it
for c in set(str(number)):
# parse back to int and compare vs known max
i = int(c)
if i > maxDigit:
maxDigit = i
print(maxDigit)
# > 8
| Add greatest digit in number with python in math | Add greatest digit in number with python in math
| Python | cc0-1.0 | Deepak345/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,Deepak345/al-go-rithms,Deepak345/al-go-rithms,Deepak345/al-go-rithms,Deepak345/al-go-rithms,manikTharaka/al-go-rithms,ZoranPandovski/al-go-rithms,Cnidarias/al-go-rithms,Cnidarias/al-go-rithms,ZoranPandovski/al-go-... | ---
+++
@@ -0,0 +1,12 @@
+number = 201328361572
+maxDigit = -1
+
+# convert number into unique set of digits and iterate over it
+for c in set(str(number)):
+ # parse back to int and compare vs known max
+ i = int(c)
+ if i > maxDigit:
+ maxDigit = i
+
+print(maxDigit)
+# > 8 | |
12bc92863076c594422f327efc1ba23a321b05a7 | plotly/tests/test_optional/test_matplotlylib/test_date_times.py | plotly/tests/test_optional/test_matplotlylib/test_date_times.py | from __future__ import absolute_import
import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import datetime
from matplotlib.dates import date2num
import plotly.tools as tls
from unittest import TestCase
from plotly.tests.test_optional.optional_util... | Add test for dates in mpl. | Add test for dates in mpl.
| Python | mit | plotly/plotly.py,ee-in/python-api,plotly/python-api,plotly/python-api,plotly/python-api,ee-in/python-api,plotly/plotly.py,plotly/plotly.py,ee-in/python-api | ---
+++
@@ -0,0 +1,40 @@
+from __future__ import absolute_import
+import matplotlib
+# Force matplotlib to not use any Xwindows backend.
+matplotlib.use('Agg')
+import matplotlib.pyplot as plt
+import datetime
+from matplotlib.dates import date2num
+import plotly.tools as tls
+from unittest import TestCase
+
+from pl... | |
0224b1eeeb3db78f5445e413d3c5a3a8c3c4bc57 | tools/wf_generators/generate_parallel_wf.py | tools/wf_generators/generate_parallel_wf.py | #!/usr/bin/env python
import sys
try:
wf_name = str(sys.argv[1])
branch_cnt = int(sys.argv[2])
branch_depth = int(sys.argv[3])
add_join = len(sys.argv) > 4
except:
raise ValueError(
'Usage: <script_name> workflow_name'
' number_of_parallel_branches branch_depth add_join'
)
... | Add a script that generates a test workflow with needed paralellism | Add a script that generates a test workflow with needed paralellism
Change-Id: I6b1087f95b88a881e074a0af4f6f8be6d9413bc7
| Python | apache-2.0 | openstack/mistral,openstack/mistral | ---
+++
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+
+import sys
+
+
+try:
+ wf_name = str(sys.argv[1])
+ branch_cnt = int(sys.argv[2])
+ branch_depth = int(sys.argv[3])
+
+ add_join = len(sys.argv) > 4
+except:
+ raise ValueError(
+ 'Usage: <script_name> workflow_name'
+ ' number_of_paralle... | |
65ca8f29f8e24307fb90c26a319f30f5b5ca4bee | scripts/check_run_dir_file_read.py | scripts/check_run_dir_file_read.py | import argparse
import sys
from os import listdir
from os.path import join
from pymagicc.io import read_cfg_file, MAGICCData
def print_summary(cannot_read, ignored, dir_to_check):
if cannot_read:
print(
"Can't read the following files in {}:\n{}".format(
dir_to_check, "\n".jo... | Add check run dir file read in script | Add check run dir file read in script
| Python | agpl-3.0 | openclimatedata/pymagicc,openclimatedata/pymagicc | ---
+++
@@ -0,0 +1,58 @@
+import argparse
+import sys
+from os import listdir
+from os.path import join
+
+
+from pymagicc.io import read_cfg_file, MAGICCData
+
+
+def print_summary(cannot_read, ignored, dir_to_check):
+ if cannot_read:
+ print(
+ "Can't read the following files in {}:\n{}".forma... | |
5f1fc4687e463632049ea889a8fc566839201a8a | crawler/migrations/0002_auto_20160826_1216.py | crawler/migrations/0002_auto_20160826_1216.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-26 12:16
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('crawler', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_... | Add missing migration - that created bug, where table had wrong name | Add missing migration - that created bug, where table had wrong name
| Python | mit | lucasgr7/silverplate,lucasgr7/silverplate,lucasgr7/silverplate | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-08-26 12:16
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('crawler', '0001_initial'),
+ ]
+
+ operations = [
+ ... | |
7bd2df1ebfa02603a660c75cc13adcd35a326b68 | ALE/print_pa_table.py | ALE/print_pa_table.py | #for a directory of FASTA gene family files, compute a gene presence-absence (or Count-type) table
from __future__ import print_function
import os, re
to_check = [file for file in os.listdir("fasta/") if file.endswith(".fa")]
#first obtain a complete list of the species. This is an appalling inefficient "algorithm"
sp... | Print a presence/absence table from a directory of FASTA-formatted sequence files | Print a presence/absence table from a directory of FASTA-formatted sequence files
| Python | mit | Tancata/phylo,Tancata/phylo | ---
+++
@@ -0,0 +1,39 @@
+#for a directory of FASTA gene family files, compute a gene presence-absence (or Count-type) table
+from __future__ import print_function
+import os, re
+
+to_check = [file for file in os.listdir("fasta/") if file.endswith(".fa")]
+#first obtain a complete list of the species. This is an app... | |
bf11946afbac3a10b6a7ae502c81f7016c472719 | social_auth/fields.py | social_auth/fields.py | from django.core.exceptions import ValidationError
from django.db import models
from django.utils import simplejson
class JSONField(models.TextField):
"""Simple JSON field that stores python structures as JSON strings
on database.
"""
__metaclass__ = models.SubfieldBase
def to_python(self, value... | Store extra data in JSON format, also add method to extend extra values to store. Closes gh-30 | Store extra data in JSON format, also add method to extend extra values to store. Closes gh-30
| Python | bsd-3-clause | qas612820704/django-social-auth,sk7/django-social-auth,limdauto/django-social-auth,mayankcu/Django-social,thesealion/django-social-auth,qas612820704/django-social-auth,gustavoam/django-social-auth,getsentry/django-social-auth,lovehhf/django-social-auth,MjAbuz/django-social-auth,MjAbuz/django-social-auth,michael-borisov... | ---
+++
@@ -0,0 +1,43 @@
+from django.core.exceptions import ValidationError
+from django.db import models
+from django.utils import simplejson
+
+
+class JSONField(models.TextField):
+ """Simple JSON field that stores python structures as JSON strings
+ on database.
+ """
+
+ __metaclass__ = models.Subfi... | |
4c8216129ee655026e4c0e8c3781645017969614 | etc/wpt_result_analyzer.py | etc/wpt_result_analyzer.py | #!/usr/bin/env python
# Copyright 2019 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/l... | Add script to summarize WPT test directories with failing tests. | Add script to summarize WPT test directories with failing tests. | Python | mpl-2.0 | splav/servo,splav/servo,KiChjang/servo,DominoTree/servo,splav/servo,splav/servo,KiChjang/servo,DominoTree/servo,DominoTree/servo,DominoTree/servo,DominoTree/servo,splav/servo,DominoTree/servo,KiChjang/servo,KiChjang/servo,splav/servo,KiChjang/servo,KiChjang/servo,KiChjang/servo,DominoTree/servo,DominoTree/servo,DominoT... | ---
+++
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+
+# Copyright 2019 The Servo Project Developers. See the COPYRIGHT
+# file at the top-level directory of this distribution.
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LIC... | |
a48774d7279df4148df9dcfdedaefdd0689373ba | scripts/migrate_piwik_derived_nodes.py | scripts/migrate_piwik_derived_nodes.py | """
"""
import logging
import os
import sys
sys.path.insert(0, os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir)
))
from modularodm.query.querydialect import DefaultQueryDialect as Q
from website.app import init_app
from website.models import Node
logger = logging.getLogger('root')
app = in... | Add migration script for nodes with incorrect piwik_site_id set. | Add migration script for nodes with incorrect piwik_site_id set.
| Python | apache-2.0 | haoyuchen1992/osf.io,GaryKriebel/osf.io,KAsante95/osf.io,SSJohns/osf.io,kwierman/osf.io,sbt9uc/osf.io,njantrania/osf.io,Johnetordoff/osf.io,chennan47/osf.io,HarryRybacki/osf.io,cslzchen/osf.io,caseyrygt/osf.io,bdyetton/prettychart,amyshi188/osf.io,wearpants/osf.io,Nesiehr/osf.io,caseyrollins/osf.io,jeffreyliu3230/osf.i... | ---
+++
@@ -0,0 +1,52 @@
+"""
+
+"""
+
+import logging
+import os
+import sys
+sys.path.insert(0, os.path.abspath(
+ os.path.join(os.path.dirname(__file__), os.pardir)
+))
+
+from modularodm.query.querydialect import DefaultQueryDialect as Q
+
+from website.app import init_app
+from website.models import Node
+
+
... | |
6ee284adcc30213bc07153a16be475ec3e067d7e | rbtools/api/decode.py | rbtools/api/decode.py | import json
from rbtools.api.utils import parse_mimetype
DECODER_MAP = {}
def DefaultDecoder(payload):
"""Default decoder for API payloads.
The default decoder is used when a decoder is not found in the
DECODER_MAP. This is a last resort which should only be used when
something has gone wrong.
... | import json
from rbtools.api.utils import parse_mimetype
DECODER_MAP = {}
def DefaultDecoder(payload):
"""Default decoder for API payloads.
The default decoder is used when a decoder is not found in the
DECODER_MAP. This is a last resort which should only be used when
something has gone wrong.
... | Fix decoding of empty responses. | Fix decoding of empty responses.
When an empty response was given by the web server, we were
decoding to '{}', which is problematic when you are expecting
an empty response for things like empty text/plain files. This
fixes the problematic assumption we were making.
Reviewed at http://reviews.reviewboard.org/r/3680/
| Python | mit | davidt/rbtools,datjwu/rbtools,halvorlu/rbtools,beol/rbtools,reviewboard/rbtools,datjwu/rbtools,reviewboard/rbtools,halvorlu/rbtools,davidt/rbtools,datjwu/rbtools,davidt/rbtools,1tush/rbtools,beol/rbtools,haosdent/rbtools,beol/rbtools,haosdent/rbtools,reviewboard/rbtools,haosdent/rbtools,halvorlu/rbtools | ---
+++
@@ -54,9 +54,6 @@
The body of a Web API response will be decoded into a dictionary,
according to the provided mime_type.
"""
- if not payload:
- return {}
-
mime = parse_mimetype(mime_type)
format = '%s/%s' % (mime['main_type'], mime['format']) |
b58c85e5105b06ecb5d8598105b4c999287a5a62 | demo/searchJustLtr.py | demo/searchJustLtr.py | from features import formatFeature
baseQuery = {
"query": {
"ltr": {
"model": {
"stored": "" # Model name
},
"features": []# features]
}
}
}
def featureQueries(keywords):
try:
ftrId = 1
while True:
... | Add a script for Search w/ just LTR | Add a script for Search w/ just LTR
| Python | apache-2.0 | o19s/elasticsearch-learning-to-rank,o19s/elasticsearch-learning-to-rank | ---
+++
@@ -0,0 +1,41 @@
+from features import formatFeature
+
+baseQuery = {
+ "query": {
+ "ltr": {
+ "model": {
+ "stored": "" # Model name
+ },
+ "features": []# features]
+ }
+ }
+}
+
+def featureQueries(keywords):
+ try:
+ ... | |
e5124e51ac716cf47af89fca957acc5623470e45 | src/oscar/apps/dashboard/shipping/forms.py | src/oscar/apps/dashboard/shipping/forms.py | from django import forms
from oscar.core.loading import get_model
class WeightBasedForm(forms.ModelForm):
class Meta:
model = get_model('shipping', 'WeightBased')
fields = ['description', 'default_weight', 'countries']
class WeightBandForm(forms.ModelForm):
def __init__(self, method, *arg... | from django import forms
from oscar.core.loading import get_model
class WeightBasedForm(forms.ModelForm):
class Meta:
model = get_model('shipping', 'WeightBased')
fields = ['name', 'description', 'default_weight', 'countries']
class WeightBandForm(forms.ModelForm):
def __init__(self, meth... | Revert "Remove non-existing field from WeightBasedForm" | Revert "Remove non-existing field from WeightBasedForm"
This reverts commit af712fedf4963d66f56f5ab9054318c493572ab1.
| Python | bsd-3-clause | anentropic/django-oscar,okfish/django-oscar,solarissmoke/django-oscar,sonofatailor/django-oscar,django-oscar/django-oscar,django-oscar/django-oscar,john-parton/django-oscar,sasha0/django-oscar,john-parton/django-oscar,okfish/django-oscar,anentropic/django-oscar,sonofatailor/django-oscar,anentropic/django-oscar,solariss... | ---
+++
@@ -7,7 +7,7 @@
class Meta:
model = get_model('shipping', 'WeightBased')
- fields = ['description', 'default_weight', 'countries']
+ fields = ['name', 'description', 'default_weight', 'countries']
class WeightBandForm(forms.ModelForm): |
999481b2c49440f428205a161a2c4ccf5580167e | IPython/core/tests/test_debugger.py | IPython/core/tests/test_debugger.py | """Tests for debugging machinery.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012, The IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----... | Add simple test for modified repr as per review. | Add simple test for modified repr as per review.
| Python | bsd-3-clause | ipython/ipython,ipython/ipython | ---
+++
@@ -0,0 +1,35 @@
+"""Tests for debugging machinery.
+"""
+#-----------------------------------------------------------------------------
+# Copyright (c) 2012, The IPython Development Team.
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, dis... | |
a3eb4602aa5ec87e6f78477c4789ed2fbde1cf93 | stevedore/__init__.py | stevedore/__init__.py | # flake8: noqa
from .extension import ExtensionManager
from .enabled import EnabledExtensionManager
from .named import NamedExtensionManager
from .hook import HookManager
from .driver import DriverManager
import logging
# Configure a NullHandler for our log messages in case
# the app we're used from does not set up ... | # flake8: noqa
__all__ = [
'ExtensionManager',
'EnabledExtensionManager',
'NamedExtensionManager',
'HookManager',
'DriverManager',
]
from .extension import ExtensionManager
from .enabled import EnabledExtensionManager
from .named import NamedExtensionManager
from .hook import HookManager
from .dri... | Update null log handling for py26 | Update null log handling for py26
Python 2.6 does not have a NullHandler in the logging
module, so introduce a little class that does the same
work.
Also add __all__ to the package init so extra names are
not exported.
Resolves issue #2
Change-Id: Id59d394cd02372e2c31de336894f06653cb1e22d
| Python | apache-2.0 | mandeepdhami/stevedore,nelsnelson/stevedore,nelsnelson/stevedore,openstack/stevedore,varunarya10/stevedore,JioCloud/stevedore,JioCloud/stevedore,citrix-openstack-build/stevedore,mandeepdhami/stevedore,citrix-openstack-build/stevedore,varunarya10/stevedore | ---
+++
@@ -1,4 +1,12 @@
# flake8: noqa
+
+__all__ = [
+ 'ExtensionManager',
+ 'EnabledExtensionManager',
+ 'NamedExtensionManager',
+ 'HookManager',
+ 'DriverManager',
+]
from .extension import ExtensionManager
from .enabled import EnabledExtensionManager
@@ -10,9 +18,19 @@
# Configure a NullH... |
78b058759eac8239e8b8b377a365cefabcf5c21a | algorithm/dynamic_connectivity/unionfind.py | algorithm/dynamic_connectivity/unionfind.py | #-*- coding:utf-8 -*-
class QuickFind(object):
def __init__(self,objnum):
self.id=[i for i in range(0,objnum)]
def union(self,p,q):
qid=self.id[q]
pid=self.id[p]
j=0
for v in self.id:
if pid==v:
self.id[j]=qid
j=j+1
def connected(self,q,p):
return self.id[q]==self.id[p]
class QuickUnion(objec... | Add QuickUnion algorithm(a better algorithm) | Add QuickUnion algorithm(a better algorithm)
| Python | apache-2.0 | free-free/algorithm,free-free/algorithm | ---
+++
@@ -0,0 +1,45 @@
+#-*- coding:utf-8 -*-
+
+
+class QuickFind(object):
+ def __init__(self,objnum):
+ self.id=[i for i in range(0,objnum)]
+ def union(self,p,q):
+ qid=self.id[q]
+ pid=self.id[p]
+ j=0
+ for v in self.id:
+ if pid==v:
+ self.id[j]=qid
+ j=j+1
+ def connected(self,q,p):
+ return se... | |
4d2a513794ab61c1a6264807daaac9946cfebd25 | article/migrations/0012_alter_content_field_to_have_verbose_name.py | article/migrations/0012_alter_content_field_to_have_verbose_name.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import wagtail.wagtailcore.fields
class Migration(migrations.Migration):
dependencies = [
('article', '0011_alter_content_and_modular_content_fields'),
]
operations = [
migrations.Al... | Add migration for article content field verbose name introduction | Add migration for article content field verbose name introduction
| Python | bsd-3-clause | PARINetwork/pari,PARINetwork/pari,PARINetwork/pari,PARINetwork/pari | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import wagtail.wagtailcore.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('article', '0011_alter_content_and_modular_content_fields'),
+ ]
+
... | |
31e812c2abd7f7e8fd26dc36a87ce17c1ec75f86 | examples/single_frame_datalogger.py | examples/single_frame_datalogger.py | from pymoku import Moku, MokuException, NoDataException
from pymoku.instruments import *
import time, logging, traceback
logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
logging.getLogger('pymoku').setLevel(logging.DEBUG)
# Use Moku.get_by_serial() or get_by_name() if you don't know the I... | Add a simple single-frame data acquisition example | Examples: Add a simple single-frame data acquisition example
| Python | mit | liquidinstruments/pymoku,benizl/pymoku | ---
+++
@@ -0,0 +1,48 @@
+from pymoku import Moku, MokuException, NoDataException
+from pymoku.instruments import *
+import time, logging, traceback
+
+logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
+logging.getLogger('pymoku').setLevel(logging.DEBUG)
+
+# Use Moku.get_by_serial() or ge... | |
0c6930f1930dbba66ba928dab4ed195e6b6bf2cc | addons/crm/__terp__.py | addons/crm/__terp__.py | {
"name" : "Customer & Supplier Relationship Management",
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com/module_crm.html",
"category" : "Generic Modules/CRM & SRM",
"description": """The Tiny ERP case and request tracker enables a group of
people to intelligently and efficiently manage task... | {
"name" : "Customer & Supplier Relationship Management",
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com/module_crm.html",
"category" : "Generic Modules/CRM & SRM",
"description": """The Tiny ERP case and request tracker enables a group of
people to intelligently and efficiently manage task... | Add crm_security.xml file entry in update_xml section | Add crm_security.xml file entry in update_xml section
bzr revid: mga@tinyerp.com-80638551c5a66adf0a49181f6ff6ae283ced3709 | Python | agpl-3.0 | rahuldhote/odoo,CopeX/odoo,CopeX/odoo,JonathanStein/odoo,colinnewell/odoo,Codefans-fan/odoo,mustafat/odoo-1,shivam1111/odoo,CubicERP/odoo,andreparames/odoo,gdgellatly/OCB1,PongPi/isl-odoo,Nick-OpusVL/odoo,damdam-s/OpenUpgrade,ecosoft-odoo/odoo,andreparames/odoo,grap/OCB,NL66278/OCB,Daniel-CA/odoo,OpusVL/odoo,luistorres... | ---
+++
@@ -24,7 +24,7 @@
"depends" : ["base", "account"],
"init_xml" : ["crm_data.xml"],
"demo_xml" : ["crm_demo.xml"],
- "update_xml" : ["crm_view.xml", "crm_report.xml", "crm_wizard.xml"],
+ "update_xml" : ["crm_view.xml", "crm_report.xml", "crm_wizard.xml","crm_security.xml"],
"active": False,
"installa... |
1636e4755d9e0a58b4626750d82102152641068c | projects/DensePose/tests/test_structures.py | projects/DensePose/tests/test_structures.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
from densepose.structures import normalized_coords_transform
class TestStructures(unittest.TestCase):
def test_normalized_coords_transform(self):
bbox = (32, 24, 288, 216)
x0, y0, w, h = bbox
xmin, ym... | Add target for unit tests + basic test | Add target for unit tests + basic test
Summary: Add target for unit tests + basic test
Reviewed By: vkhalidov
Differential Revision: D20429230
fbshipit-source-id: 36bee00d2dd57a350e2a6f3dd58a87f0c9c8227e
| Python | apache-2.0 | facebookresearch/detectron2,facebookresearch/detectron2,facebookresearch/detectron2 | ---
+++
@@ -0,0 +1,25 @@
+# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
+
+import unittest
+
+from densepose.structures import normalized_coords_transform
+
+
+class TestStructures(unittest.TestCase):
+ def test_normalized_coords_transform(self):
+ bbox = (32, 24, 288, 216)
+ ... | |
b2eb9b8ec3223a359b9c44d5880022d1b48b11f2 | corehq/motech/repeaters/migrations/0003_migrate_connectionsettings.py | corehq/motech/repeaters/migrations/0003_migrate_connectionsettings.py | from django.db import migrations
from corehq.motech.repeaters.models import Repeater
def _migrate_to_connectionsettings(apps, schema_editor):
for repeater in iter_repeaters():
if not repeater.connection_settings_id:
repeater.create_connection_settings()
def iter_repeaters():
for result ... | Create ConnectionSettings for all Repeaters | Create ConnectionSettings for all Repeaters
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,30 @@
+from django.db import migrations
+
+from corehq.motech.repeaters.models import Repeater
+
+
+def _migrate_to_connectionsettings(apps, schema_editor):
+ for repeater in iter_repeaters():
+ if not repeater.connection_settings_id:
+ repeater.create_connection_settings()
+
+... | |
5582556d735da829fe629cc36f9664047997a5bb | src/ggrc_basic_permissions/roles/Auditor.py | src/ggrc_basic_permissions/roles/Auditor.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
scope = "Audit"
description = """
The permissions required by an auditor to ac... | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
scope = "Audit"
description = """
The permissions required by an auditor to ac... | Allow auditor to create relationship in context | Allow auditor to create relationship in context
This allows the auditor to map objects to the audit but not to unmap them while
not giving him edit permissions on the audit.
| Python | apache-2.0 | kr41/ggrc-core,j0gurt/ggrc-core,prasannav7/ggrc-core,andrei-karalionak/ggrc-core,prasannav7/ggrc-core,jmakov/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core,prasannav7/ggrc-core,jmakov/ggrc-core,j0gurt/ggrc-core,josthkko/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,andrei-karalionak... | ---
+++
@@ -30,6 +30,7 @@
"Request",
"ControlAssessment",
"Issue",
+ "Relationship",
"DocumentationResponse",
"InterviewResponse",
"PopulationSampleResponse", |
d3a5a3994a47b0b0f31be3951aead595f15dbbd9 | blivet/tasks/fstask.py | blivet/tasks/fstask.py | # fstask.py
# Superclass for filesystem tasks.
#
# Copyright (C) 2015 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This pro... | Add an abstract parent of all filesystem tasks. | Add an abstract parent of all filesystem tasks.
It defines the initializer, which should not vary among filesystem tasks.
Include a convenience class for simple unimplemented filesystem tasks.
Signed-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>
| Python | lgpl-2.1 | rvykydal/blivet,vojtechtrefny/blivet,AdamWill/blivet,rvykydal/blivet,rhinstaller/blivet,vpodzime/blivet,vojtechtrefny/blivet,jkonecny12/blivet,rhinstaller/blivet,jkonecny12/blivet,vpodzime/blivet,AdamWill/blivet | ---
+++
@@ -0,0 +1,47 @@
+# fstask.py
+# Superclass for filesystem tasks.
+#
+# Copyright (C) 2015 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your op... | |
ce96d59cf4b63101c061796ecf3793cc107a74c1 | migrations/versions/0105_opg_letter_org.py | migrations/versions/0105_opg_letter_org.py | """empty message
Revision ID: 0105_opg_letter_org
Revises: 0104_more_letter_orgs
Create Date: 2017-06-29 12:44:16.815039
"""
# revision identifiers, used by Alembic.
revision = '0105_opg_letter_org'
down_revision = '0104_more_letter_orgs'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects impor... | Add OPG to letter organisations | Add OPG to letter organisations
Logo was added here:
https://github.com/alphagov/notifications-template-preview/pull/19
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,28 @@
+"""empty message
+
+Revision ID: 0105_opg_letter_org
+Revises: 0104_more_letter_orgs
+Create Date: 2017-06-29 12:44:16.815039
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '0105_opg_letter_org'
+down_revision = '0104_more_letter_orgs'
+
+from alembic import op
+import sqlalc... | |
d1d130ea5d79fa65f9c2f8a2c50ac8b490580d17 | tests/test_mailparsers_security_announce.py | tests/test_mailparsers_security_announce.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from DebianChangesBot.mailparsers import SecurityAnnounceParser as p
class TestMailParserSecurityAnnounce(unittest.TestCase):
def setUp(self):
self.h... | Add some tests of SecurityAnnounceParser | Add some tests of SecurityAnnounceParser
Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@chris-lamb.co.uk>
| Python | agpl-3.0 | xtaran/debian-devel-changes-bot,lamby/debian-devel-changes-bot,sebastinas/debian-devel-changes-bot,xtaran/debian-devel-changes-bot,lamby/debian-devel-changes-bot,lamby/debian-devel-changes-bot | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import unittest
+
+import os, sys
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+from DebianChangesBot.mailparsers import SecurityAnnounceParser as p
+
+class TestMailParserSecurityAnnounce(unittest.TestCase)... | |
612ae3adb2636fb3a926cd29d87b4b388ca48476 | scripts/delete_old_user_login_events.py | scripts/delete_old_user_login_events.py | #!/usr/bin/env python
"""Delete login user events older than a given number of days.
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from datetime import datetime, timedelta
import click
from byceps.database import db
from byceps.services.user.models.event import Use... | Add script to delete user login events older than a number of days | Add script to delete user login events older than a number of days
| Python | bsd-3-clause | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | ---
+++
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+"""Delete login user events older than a given number of days.
+
+:Copyright: 2006-2020 Jochen Kupperschmidt
+:License: Modified BSD, see LICENSE for details.
+"""
+
+from datetime import datetime, timedelta
+
+import click
+
+from byceps.database import db
+from byc... | |
a33685a7a1432b86572c49ac895a7822cf6b58d2 | weathertracking/bin/gather_observations.py | weathertracking/bin/gather_observations.py | from weathertracking.models import WeatherStation, WeatherReport
if __name__ == '__main__': # called as a script
station_list = WeatherStation.objects.auto_poll() # retrieve all stations marked to poll automatically
for station in station_list:
var = station.update()
| Add script usable for cron/queue-ing retrievable of automatically polled stations | Add script usable for cron/queue-ing retrievable of automatically polled stations
git-svn-id: 138413ff556ff9267caefd2d209ba774763e85fb@8 696a86c2-f982-11dd-8259-6defae454439
| Python | bsd-3-clause | adamfast/django-weathertracking | ---
+++
@@ -0,0 +1,6 @@
+from weathertracking.models import WeatherStation, WeatherReport
+
+if __name__ == '__main__': # called as a script
+ station_list = WeatherStation.objects.auto_poll() # retrieve all stations marked to poll automatically
+ for station in station_list:
+ var = station.update() | |
6c339a14170ea77926bc8eb47bd7e61c80db4a42 | tests/test_cookiecutter_generation.py | tests/test_cookiecutter_generation.py | # -*- coding: utf-8 -*-
import pytest
@pytest.fixture
def context():
return {
"project_name": "My Test Project",
"repo_name": "my_test_project",
"author_name": "Test Author",
"email": "test@example.com",
"description": "A short description of the project.",
"domain_... | Implement a basic test with cookies.bake() | Implement a basic test with cookies.bake()
| Python | bsd-3-clause | ovidner/cookiecutter-django,luzfcb/cookiecutter-django,kappataumu/cookiecutter-django,aleprovencio/cookiecutter-django,HandyCodeJob/hcj-django-temp,hairychris/cookiecutter-django,calculuscowboy/cookiecutter-django,webspired/cookiecutter-django,hairychris/cookiecutter-django,schacki/cookiecutter-django,topwebmaster/cook... | ---
+++
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+
+import pytest
+
+@pytest.fixture
+def context():
+ return {
+ "project_name": "My Test Project",
+ "repo_name": "my_test_project",
+ "author_name": "Test Author",
+ "email": "test@example.com",
+ "description": "A short descrip... | |
20b82906da1ab9601a6525cb14b56cafb91e91e0 | tutorials/graphs/timeSeriesFromCSV.py | tutorials/graphs/timeSeriesFromCSV.py | ## \file
## \ingroup tutorial_graphs
## \notebook -js
## This macro illustrates the use of the time axis on a TGraph
## with data read from a text file containing the SWAN usage
## statistics during July 2017.
##
## \macro_image
## \macro_code
##
## \authors Danilo Piparo, Olivier Couet
import ROOT
# Open the data fi... | Add Python tutorial about time series | Add Python tutorial about time series
| Python | lgpl-2.1 | olifre/root,root-mirror/root,root-mirror/root,root-mirror/root,olifre/root,root-mirror/root,karies/root,root-mirror/root,olifre/root,root-mirror/root,root-mirror/root,karies/root,olifre/root,karies/root,karies/root,olifre/root,olifre/root,karies/root,karies/root,root-mirror/root,karies/root,olifre/root,karies/root,olif... | ---
+++
@@ -0,0 +1,56 @@
+## \file
+## \ingroup tutorial_graphs
+## \notebook -js
+## This macro illustrates the use of the time axis on a TGraph
+## with data read from a text file containing the SWAN usage
+## statistics during July 2017.
+##
+## \macro_image
+## \macro_code
+##
+## \authors Danilo Piparo, Olivier ... | |
b5142de511907167b3c9c7add5d14e6ec799633c | example/NaCl/dynmat.py | example/NaCl/dynmat.py | #!/usr/bin/env python
import yaml
import numpy as np
data = yaml.load(open("qpoints.yaml"))
dynmat = []
dynmat_data = data['phonon'][0]['dynamical_matrix']
for row in dynmat_data:
vals = np.reshape(row, (-1, 2))
dynmat.append(vals[:, 0] + vals[:, 1] * 1j)
dynmat = np.array(dynmat)
eigvals, eigvecs, = np.lina... | Add an example script in NaCle | Add an example script in NaCle
| Python | bsd-3-clause | atztogo/phonopy,atztogo/phonopy,atztogo/phonopy,atztogo/phonopy | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+import yaml
+import numpy as np
+
+data = yaml.load(open("qpoints.yaml"))
+dynmat = []
+dynmat_data = data['phonon'][0]['dynamical_matrix']
+for row in dynmat_data:
+ vals = np.reshape(row, (-1, 2))
+ dynmat.append(vals[:, 0] + vals[:, 1] * 1j)
+dynmat = np.arr... | |
2b0e7e221bcf6b01fa3eccfe6b33bf0763613630 | scripts/add_rtp_process_event.py | scripts/add_rtp_process_event.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2019 the HERA Collaboration
# Licensed under the 2-clause BSD License
"""
Script to add an RTP process event record to M&C.
"""
from __future__ import print_function, division, absolute_import
import numpy as np
import h5py
from astropy.time import Time
impor... | Add script for adding RTP process events | Add script for adding RTP process events
| Python | bsd-2-clause | HERA-Team/Monitor_and_Control,HERA-Team/hera_mc,HERA-Team/hera_mc | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright 2019 the HERA Collaboration
+# Licensed under the 2-clause BSD License
+
+"""
+Script to add an RTP process event record to M&C.
+"""
+from __future__ import print_function, division, absolute_import
+
+import numpy as np
+import h5... | |
c1fe209bde5d7edf95b809ebcb00c2167d74ede5 | quant/demo/demo_DAX.py | quant/demo/demo_DAX.py | #-*-coding:utf-8-*-
#!/usr/bin/python
# coding: UTF-8
import numpy as np
import pandas as pd
import pandas_datareader.data as web
import math
#从雅虎财经获取DAX指数的数据
DAX = web.DataReader(name='^GDAXI', data_source='yahoo',start = '2000-1-1')
#查看一下数据的一些信息 上面这一方法返回的是一个pandas dataframe的数据结构
print (DAX.info())
#绘制收盘价的曲线
DAX['... | Add demo of DAX analysis and MA | Add demo of DAX analysis and MA
| Python | apache-2.0 | yunfeiz/py_learnt | ---
+++
@@ -0,0 +1,38 @@
+#-*-coding:utf-8-*-
+#!/usr/bin/python
+# coding: UTF-8
+
+import numpy as np
+import pandas as pd
+import pandas_datareader.data as web
+import math
+
+#从雅虎财经获取DAX指数的数据
+DAX = web.DataReader(name='^GDAXI', data_source='yahoo',start = '2000-1-1')
+
+#查看一下数据的一些信息 上面这一方法返回的是一个pandas dataframe的... | |
d197fe8140d8d01e7b517fa0a6a5698548a65af8 | scripts/dump_s_file.py | scripts/dump_s_file.py | #!/usr/bin/env python3
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'pccora'))
from pccora import *
import math
def dump_values(obj):
for key in obj:
print("%s -> %s" % (key, obj[key]))
def dump_array_values(obj, elapsed_time):
i = 0
for container in obj:
i... | Add script to dump S-file PC-CORA data | Add script to dump S-file PC-CORA data
| Python | mit | kinow/pccora | ---
+++
@@ -0,0 +1,44 @@
+#!/usr/bin/env python3
+
+import sys, os
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'pccora'))
+from pccora import *
+import math
+
+def dump_values(obj):
+ for key in obj:
+ print("%s -> %s" % (key, obj[key]))
+
+def dump_array_values(obj, elapsed_time):
+ i... | |
0ea2108f1cb4ab889e780fdff2ad0730290950e0 | tests/basics/gen_yield_from_stopped.py | tests/basics/gen_yield_from_stopped.py | # Yielding from stopped generator is ok and results in None
def gen():
return 1
# This yield is just to make this a generator
yield
f = gen()
def run():
print((yield from f))
print((yield from f))
print((yield from f))
try:
next(run())
except StopIteration:
print("StopIteration")
| Add testcase for yielding from a stopped generator. | tests: Add testcase for yielding from a stopped generator.
| Python | mit | alex-robbins/micropython,cwyark/micropython,MrSurly/micropython-esp32,bvernoux/micropython,selste/micropython,Peetz0r/micropython-esp32,ryannathans/micropython,matthewelse/micropython,pozetroninc/micropython,ryannathans/micropython,PappaPeppar/micropython,hiway/micropython,pozetroninc/micropython,trezor/micropython,chr... | ---
+++
@@ -0,0 +1,18 @@
+# Yielding from stopped generator is ok and results in None
+
+def gen():
+ return 1
+ # This yield is just to make this a generator
+ yield
+
+f = gen()
+
+def run():
+ print((yield from f))
+ print((yield from f))
+ print((yield from f))
+
+try:
+ next(run())
+except S... | |
264a67f649cab578aaafea4b23bc38b05705a1ac | tests/styles/document_matcher_tests.py | tests/styles/document_matcher_tests.py | from nose.tools import istest, assert_equal
from mammoth import document_matchers
@istest
def equal_to_matcher_is_case_insensitive():
matcher = document_matchers.equal_to("Heading 1")
assert_equal(True, matcher.matches("heaDING 1"))
assert_equal(False, matcher.matches("heaDING 2"))
| Add test for making sure equal_to is case-insensitive | Add test for making sure equal_to is case-insensitive
| Python | bsd-2-clause | mwilliamson/python-mammoth | ---
+++
@@ -0,0 +1,10 @@
+from nose.tools import istest, assert_equal
+
+from mammoth import document_matchers
+
+
+@istest
+def equal_to_matcher_is_case_insensitive():
+ matcher = document_matchers.equal_to("Heading 1")
+ assert_equal(True, matcher.matches("heaDING 1"))
+ assert_equal(False, matcher.matches... | |
78821f2df84bbb822e076fb1591dfccc09bcb43c | cpm_data/migrations/0004_add_seasons_data.py | cpm_data/migrations/0004_add_seasons_data.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-08-27 22:21
from __future__ import unicode_literals
from django.db import migrations
def _get_seasons():
return '2012 2013 2014 2015 2016 2017'.split()
def add_seasons(apps, schema_editor):
Season = apps.get_model('cpm_data.Season')
Season.ob... | Add migrations for adding seasons | Add migrations for adding seasons
| Python | unlicense | kinaklub/next.filmfest.by,nott/next.filmfest.by,nott/next.filmfest.by,nott/next.filmfest.by,kinaklub/next.filmfest.by,kinaklub/next.filmfest.by,kinaklub/next.filmfest.by,nott/next.filmfest.by | ---
+++
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.8 on 2016-08-27 22:21
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+def _get_seasons():
+ return '2012 2013 2014 2015 2016 2017'.split()
+
+
+def add_seasons(apps, schema_editor):
+ Season = apps.get... | |
e477e7eefb3d562c300b366c0d3c801f2e640f13 | tools/development/slow_query_finder.py | tools/development/slow_query_finder.py | #! /usr/bin/env python
# -.- coding: utf-8 -.-
# Zeitgeist
#
# Copyright © 2011 Collabora Ltd.
# By Trever Fischer <trever.fischer@collabora.co.uk>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# t... | Add a script that uses a genetic algorithm to find slow queries | Add a script that uses a genetic algorithm to find slow queries
| Python | lgpl-2.1 | freedesktop-unofficial-mirror/zeitgeist__zeitgeist,freedesktop-unofficial-mirror/zeitgeist__zeitgeist,freedesktop-unofficial-mirror/zeitgeist__zeitgeist,freedesktop-unofficial-mirror/zeitgeist__zeitgeist,freedesktop-unofficial-mirror/zeitgeist__zeitgeist | ---
+++
@@ -0,0 +1,79 @@
+#! /usr/bin/env python
+# -.- coding: utf-8 -.-
+
+# Zeitgeist
+#
+# Copyright © 2011 Collabora Ltd.
+# By Trever Fischer <trever.fischer@collabora.co.uk>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser Gener... | |
6dca5c4564bbd2c8b6546090a646c7c841f1d7be | etc/theory/idealness_experiments/analysis.py | etc/theory/idealness_experiments/analysis.py | # -*- coding: utf-8 -*-
from string import printable
from generate_huffman import get_huffman_tree
def get_ideal_tree(freq_list):
freq_list = sorted(freq_list, reverse=True)
output = []
output.append('Char\t#\tHuff.codelen')
tree = []
for (current_occ, current_char) in freq_list:
if tree:... | Add idealness experiment py script | Add idealness experiment py script
| Python | mit | esarafianou/rupture,dionyziz/rupture,dimkarakostas/rupture,dimkarakostas/rupture,dionyziz/rupture,dimriou/rupture,dionyziz/rupture,esarafianou/rupture,dionyziz/rupture,dimriou/rupture,dimkarakostas/rupture,dimkarakostas/rupture,dimkarakostas/rupture,dionyziz/rupture,esarafianou/rupture,dimriou/rupture,dimriou/rupture,e... | ---
+++
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+
+from string import printable
+from generate_huffman import get_huffman_tree
+
+
+def get_ideal_tree(freq_list):
+ freq_list = sorted(freq_list, reverse=True)
+ output = []
+ output.append('Char\t#\tHuff.codelen')
+ tree = []
+ for (current_occ, curre... | |
8e59a09b8270af79d2ad3a2564904137a470c628 | events/migrations/0006_auto_20150827_2020.py | events/migrations/0006_auto_20150827_2020.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('events', '0005_auto_20150607_2005'),
]
operations = [
migrations.AlterField(
model_name='event',
nam... | Add migration for previous commit | Add migration for previous commit
| Python | mit | tuomas777/linkedevents,aapris/linkedevents,City-of-Helsinki/linkedevents,kooditiimi/linkedevents,aapris/linkedevents,kooditiimi/linkedevents,kooditiimi/linkedevents,City-of-Helsinki/linkedevents,aapris/linkedevents,kooditiimi/linkedevents,City-of-Helsinki/linkedevents,tuomas777/linkedevents,tuomas777/linkedevents | ---
+++
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('events', '0005_auto_20150607_2005'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ ... | |
03f365579df63f35ccee02fa1e6186f31acdac15 | tests/api/auth_test.py | tests/api/auth_test.py | import base64
from flask import Response
from flask.testing import FlaskClient
import pytest
import config
from skylines.api import auth
from skylines.app import SkyLines
from skylines.database import db
pytestmark = pytest.mark.usefixtures('db')
@pytest.fixture(scope='session')
def app():
app = SkyLines(confi... | Add test for the "auth" module | api: Add test for the "auth" module
| Python | agpl-3.0 | RBE-Avionik/skylines,snip/skylines,kerel-fs/skylines,shadowoneau/skylines,snip/skylines,kerel-fs/skylines,shadowoneau/skylines,Turbo87/skylines,Harry-R/skylines,Harry-R/skylines,skylines-project/skylines,skylines-project/skylines,Turbo87/skylines,TobiasLohner/SkyLines,TobiasLohner/SkyLines,TobiasLohner/SkyLines,RBE-Avi... | ---
+++
@@ -0,0 +1,57 @@
+import base64
+
+from flask import Response
+from flask.testing import FlaskClient
+import pytest
+
+import config
+from skylines.api import auth
+from skylines.app import SkyLines
+from skylines.database import db
+
+pytestmark = pytest.mark.usefixtures('db')
+
+
+@pytest.fixture(scope='ses... | |
b7c90f17465232f4c49cc1f05c614a9a17f6bece | tests/test_vservice.py | tests/test_vservice.py | from .base import ServiceTestCase
class VServiceTests(ServiceTestCase):
def verifyCustomName(self):
self.assertEquals(self.service.name, 'VService')
self.assertEquals(self.service._name, 'VService')
self.service.name = 'MyService'
self.assertEquals(self.service.name, 'MyService')
... | Add test to verify custom name functionality | Add test to verify custom name functionality
| Python | bsd-3-clause | fmoo/sparts,djipko/sparts,bboozzoo/sparts,pshuff/sparts,djipko/sparts,facebook/sparts,pshuff/sparts,facebook/sparts,bboozzoo/sparts,fmoo/sparts | ---
+++
@@ -0,0 +1,9 @@
+from .base import ServiceTestCase
+
+class VServiceTests(ServiceTestCase):
+ def verifyCustomName(self):
+ self.assertEquals(self.service.name, 'VService')
+ self.assertEquals(self.service._name, 'VService')
+ self.service.name = 'MyService'
+ self.assertEquals(... | |
c5e5e34482730fa50329d513bbe4ccb2ef7d51ff | data_preparation/crawl_bug_page/GetBug.py | data_preparation/crawl_bug_page/GetBug.py | #!/usr/bin/python
import os
import re
import subprocess
bugIds = []
def prepareCookieData():
out = subprocess.call("curl --cookie-jar cookie.data \"https://bugzilla-hostname/index.cgi?Bugzilla_login=name&Bugzilla_password=password&GoAheadAndLogIn=LogIn\" > login.txt", shell=True)
def gerateBugFile(bugid):... | Implement a tool to crawl bug pages. | Implement a tool to crawl bug pages.
| Python | apache-2.0 | bug-analysis/DDVP | ---
+++
@@ -0,0 +1,66 @@
+#!/usr/bin/python
+import os
+import re
+import subprocess
+
+bugIds = []
+def prepareCookieData():
+ out = subprocess.call("curl --cookie-jar cookie.data \"https://bugzilla-hostname/index.cgi?Bugzilla_login=name&Bugzilla_password=password&GoAheadAndLogIn=LogIn\" > login.txt", shell=True)... | |
ad57bd124aea637520696857f0b9897ed28f4a96 | 2018/clone/plot-time.py | 2018/clone/plot-time.py | # Helper script for making run-time plots.
#
# Requires a Python installation with the full numeric stack (Numpy, Matplotlib)
# including Seaborn (for prettier plots).
#
# Eli Bendersky [http://eli.thegreenplace.net]
# This code is in the public domain.
import numpy as np
import matplotlib.pyplot as plt
import seaborn
... | Add plotting of launch times | Add plotting of launch times
| Python | unlicense | eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog | ---
+++
@@ -0,0 +1,57 @@
+# Helper script for making run-time plots.
+#
+# Requires a Python installation with the full numeric stack (Numpy, Matplotlib)
+# including Seaborn (for prettier plots).
+#
+# Eli Bendersky [http://eli.thegreenplace.net]
+# This code is in the public domain.
+import numpy as np
+import matp... | |
b8b02b41ee5c5712f90c0621d5fd7130004eafb6 | fil_finder/tests/test_profiles.py | fil_finder/tests/test_profiles.py |
'''
Tests for functions in fil_finder.width_profiles.
'''
import pytest
import numpy as np
import numpy.testing as npt
from ..width_profiles.profile_line_width import walk_through_skeleton, return_ends
def make_test_skeleton(shape=(10, 10)):
skel = np.zeros(shape)
crds = np.array([[3, 3, 4], [4, 5, 6]])
... | Add tests for end finding and walk through a skeleton | Add tests for end finding and walk through a skeleton
| Python | mit | e-koch/FilFinder | ---
+++
@@ -0,0 +1,53 @@
+
+'''
+Tests for functions in fil_finder.width_profiles.
+'''
+
+import pytest
+
+import numpy as np
+import numpy.testing as npt
+
+
+from ..width_profiles.profile_line_width import walk_through_skeleton, return_ends
+
+
+def make_test_skeleton(shape=(10, 10)):
+ skel = np.zeros(shape)
+... | |
9874b911fa04cd5b6883845ee627c7d91c6376a2 | telemetry/telemetry/page/page_test_runner.py | telemetry/telemetry/page/page_test_runner.py | # 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.
import logging
import os
import sys
from telemetry.core import browser_finder
from telemetry.core import browser_options
from telemetry.page import page_... | Add a telemetry-based gpu_tests folder | Add a telemetry-based gpu_tests folder
BUG=143317
Review URL: https://chromiumcodereview.appspot.com/12252020
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@183915 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | sahiljain/catapult,benschmaus/catapult,benschmaus/catapult,SummerLW/Perf-Insight-Report,sahiljain/catapult,catapult-project/catapult,benschmaus/catapult,catapult-project/catapult-csm,benschmaus/catapult,sahiljain/catapult,catapult-project/catapult,catapult-project/catapult-csm,catapult-project/catapult-csm,SummerLW/Per... | ---
+++
@@ -0,0 +1,81 @@
+# 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.
+import logging
+import os
+import sys
+
+from telemetry.core import browser_finder
+from telemetry.core import browser_opti... | |
cd9a26a7ffbe44b89912d7d862b394f4dfc47269 | yithlibraryserver/oauth2/tests/test_utils.py | yithlibraryserver/oauth2/tests/test_utils.py | # Yith Library Server is a password storage server.
# Copyright (C) 2014 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# This file is part of Yith Library Server.
#
# Yith Library Server is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as publ... | Add tests for oauth2 utils | Add tests for oauth2 utils
| Python | agpl-3.0 | lorenzogil/yith-library-server,lorenzogil/yith-library-server,lorenzogil/yith-library-server | ---
+++
@@ -0,0 +1,67 @@
+# Yith Library Server is a password storage server.
+# Copyright (C) 2014 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
+#
+# This file is part of Yith Library Server.
+#
+# Yith Library Server is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Aff... | |
c0e9a1a741a16548a466b427338fab5ac8603537 | tests/test_main.py | tests/test_main.py | import copy
import os
from ecs_deplojo import main
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
def test_register_task_definitions(cluster):
task_definitions = {
"service-1": {
"definition": {
"family": "my-task-def",
"volumes": [],
"c... | Add a number of unittests for registering and deregistering task definitions | Add a number of unittests for registering and deregistering task definitions
| Python | mit | LabD/ecs-deplojo | ---
+++
@@ -0,0 +1,81 @@
+import copy
+import os
+
+from ecs_deplojo import main
+
+BASE_DIR = os.path.dirname(os.path.abspath(__file__))
+
+
+def test_register_task_definitions(cluster):
+ task_definitions = {
+ "service-1": {
+ "definition": {
+ "family": "my-task-def",
+ ... | |
5158ecbec55f142e79cd5efa0360e01b50142464 | changes/migrations/0006_auto_20170718_1414.py | changes/migrations/0006_auto_20170718_1414.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2017-07-18 14:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('changes', '0005_auto_20170601_1354'),
]
operations = [
migrations.AlterField... | Add migration for admin change | Add migration for admin change
| Python | bsd-3-clause | praekeltfoundation/ndoh-hub,praekeltfoundation/ndoh-hub,praekeltfoundation/ndoh-hub | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.1 on 2017-07-18 14:14
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('changes', '0005_auto_20170601_1354'),
+ ]
+
+ ope... | |
e07e436b461015365b2cbbdb96daa8bfc3ae31a4 | {{cookiecutter.repo_name}}/config/urls.py | {{cookiecutter.repo_name}}/config/urls.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
# Comment the next two lines to disable the admin:
from django.contrib import ad... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, patterns, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = patterns('', # noqa
url(r'^$... | Remove admin.autodiscover() call, it's called automatically in 1.7+ | Remove admin.autodiscover() call, it's called automatically in 1.7+
| Python | bsd-3-clause | interaktiviti/cookiecutter-django,asyncee/cookiecutter-django,kappataumu/cookiecutter-django,Sushantgakhar/cookiecutter-django,hairychris/cookiecutter-django,Sushantgakhar/cookiecutter-django,thornomad/cookiecutter-django,stepmr/cookiecutter-django,javipalanca/cookiecutter-django,wldcordeiro/cookiecutter-django-essenti... | ---
+++
@@ -2,19 +2,16 @@
from __future__ import unicode_literals
from django.conf import settings
-from django.conf.urls import patterns, include, url
+from django.conf.urls import include, patterns, url
from django.conf.urls.static import static
+from django.contrib import admin
from django.views.generic impo... |
7321bb9986ce1836ab65ac82f65576d6412494f2 | auth0/v2/test/test_device_credentials.py | auth0/v2/test/test_device_credentials.py | import unittest
import mock
from ..device_credentials import DeviceCredentials
class TestDeviceCredentials(unittest.TestCase):
@mock.patch('auth0.v2.device_credentials.RestClient')
def test_get(self, mock_rc):
mock_instance = mock_rc.return_value
c = DeviceCredentials(domain='domain', jwt_to... | Add unit tests for DeviceCredentials | Add unit tests for DeviceCredentials
| Python | mit | auth0/auth0-python,auth0/auth0-python | ---
+++
@@ -0,0 +1,45 @@
+import unittest
+import mock
+from ..device_credentials import DeviceCredentials
+
+
+class TestDeviceCredentials(unittest.TestCase):
+
+ @mock.patch('auth0.v2.device_credentials.RestClient')
+ def test_get(self, mock_rc):
+ mock_instance = mock_rc.return_value
+
+ c = De... | |
274511db02b95c14c19564d1e0b3d30ccf1bf532 | core/migrations/0011_auto_20150602_0128.py | core/migrations/0011_auto_20150602_0128.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0010_currentrate'),
]
operations = [
migrations.AlterModelOptions(
name='price',
options={'o... | Add migration for meta options | Add migration for meta options
| Python | unlicense | kvikshaug/btc.kvikshaug.no,kvikshaug/btc.kvikshaug.no,kvikshaug/btc.kvikshaug.no,kvikshaug/btc.kvikshaug.no | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('core', '0010_currentrate'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.