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 |
|---|---|---|---|---|---|---|---|---|---|---|
1ffc7f76e814d0395653989706a16d4b4797a44e | talks/management/commands/add_talks.py | talks/management/commands/add_talks.py | from django.core.management.base import BaseCommand
from events.models import Event
from cfp.models import PaperApplication
from talks.models import Talk
class Command(BaseCommand):
help = "Bulk add talks from application ids"
def add_arguments(self, parser):
parser.add_argument('event_id', type=int... | Add command for bulk adding talks | Add command for bulk adding talks
| Python | bsd-3-clause | WebCampZg/conference-web,WebCampZg/conference-web,WebCampZg/conference-web | ---
+++
@@ -0,0 +1,29 @@
+from django.core.management.base import BaseCommand
+
+from events.models import Event
+from cfp.models import PaperApplication
+from talks.models import Talk
+
+
+class Command(BaseCommand):
+ help = "Bulk add talks from application ids"
+
+ def add_arguments(self, parser):
+ p... | |
f6d7bff264acd27984aaf2b60f76f6a9bec7ed34 | RevitPyCVC/Test/externaleventexample.py | RevitPyCVC/Test/externaleventexample.py | from Autodesk.Revit.UI import IExternalEventHandler, IExternalApplication, Result, ExternalEvent, IExternalCommand
from Autodesk.Revit.DB import Form
class ExternalEventExample(IExternalEventHandler):
def execute(self, app):
TaskDialog.Show("External Event", "Click Close to close")
def GetName(self):
... | Add GUI for 3D Rotation script | Add GUI for 3D Rotation script
| Python | mit | Nahouhak/pythoncvc.net,Nahouhak/pythoncvc.net | ---
+++
@@ -0,0 +1,63 @@
+from Autodesk.Revit.UI import IExternalEventHandler, IExternalApplication, Result, ExternalEvent, IExternalCommand
+from Autodesk.Revit.DB import Form
+
+class ExternalEventExample(IExternalEventHandler):
+ def execute(self, app):
+ TaskDialog.Show("External Event", "Click Close to... | |
8e66b89ac7a9003533afe34bf691ee17ec37d1f5 | tests/test_publisher.py | tests/test_publisher.py | from lektor.publisher import Command
def test_Command_triggers_no_warnings(recwarn):
# This excercises the issue where publishing via rsync resulted
# in ResourceWarnings about unclosed streams.
# This is essentially how RsyncPublisher runs rsync.
with Command(["echo"]) as client:
for _ in cl... | Add test to excercise unclosed file warnings | Add test to excercise unclosed file warnings
| Python | bsd-3-clause | lektor/lektor,lektor/lektor,lektor/lektor,lektor/lektor | ---
+++
@@ -0,0 +1,20 @@
+from lektor.publisher import Command
+
+
+def test_Command_triggers_no_warnings(recwarn):
+ # This excercises the issue where publishing via rsync resulted
+ # in ResourceWarnings about unclosed streams.
+
+ # This is essentially how RsyncPublisher runs rsync.
+ with Command(["ec... | |
6c61e0a477a03dcd81d90bf828ba6c036c86b355 | pydocstring/docstring.py | pydocstring/docstring.py | class Docstring:
"""Class for storing docstring information.
Following headers are used by this class:
* 'summary' - first line of the docstring
* 'extended' - blocks of extended description concerning the functionality of the code
* 'parameters' - parameters of a method
* 'other parameters' -... | Add general framework for coding | Add general framework for coding
using documentation
| Python | mit | kimt33/pydocstring | ---
+++
@@ -0,0 +1,96 @@
+class Docstring:
+ """Class for storing docstring information.
+
+ Following headers are used by this class:
+
+ * 'summary' - first line of the docstring
+ * 'extended' - blocks of extended description concerning the functionality of the code
+ * 'parameters' - parameters of ... | |
444f69848b43d25469b2babd55317e44744e41cb | tests/test_highlevel.py | tests/test_highlevel.py | import collections
import pathlib
import numpy as np
import pytest
import eccodes
SAMPLE_DATA_FOLDER = pathlib.Path(__file__).parent / "sample-data"
TEST_GRIB_DATA = SAMPLE_DATA_FOLDER / "tiggelam_cnmc_sfc.grib2"
TEST_GRIB_DATA2 = SAMPLE_DATA_FOLDER / "era5-levels-members.grib"
def test_filereader():
with ecco... | Add tests for the high-level interface | Add tests for the high-level interface
| Python | apache-2.0 | ecmwf/eccodes-python,ecmwf/eccodes-python | ---
+++
@@ -0,0 +1,77 @@
+import collections
+import pathlib
+
+import numpy as np
+import pytest
+
+import eccodes
+
+SAMPLE_DATA_FOLDER = pathlib.Path(__file__).parent / "sample-data"
+TEST_GRIB_DATA = SAMPLE_DATA_FOLDER / "tiggelam_cnmc_sfc.grib2"
+TEST_GRIB_DATA2 = SAMPLE_DATA_FOLDER / "era5-levels-members.grib"
... | |
efac0ccf8357c5bee978513722331ee196b9936f | bin/resize_regions.py | bin/resize_regions.py | #!/usr/bin/env python
#
# resize_ranges
# Resizes ranges in a BED file around a center point
#
import sys
import argparse
import csv
def resize_row(row, width):
start, end = int(row[1]), int(row[2])
original_range = end-start
margin = (original_range - width) / 2
start = start + margin
end = end ... | Add python script to resize regions | Add python script to resize regions
| Python | mit | Duke-GCB/TrackHubGenerator,Duke-GCB/TrackHubGenerator | ---
+++
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+#
+# resize_ranges
+# Resizes ranges in a BED file around a center point
+#
+
+import sys
+import argparse
+import csv
+
+def resize_row(row, width):
+ start, end = int(row[1]), int(row[2])
+ original_range = end-start
+ margin = (original_range - width) / 2
... | |
c96468a38c06a4c439d52754bfd93d86ca9aeace | tests/db.py | tests/db.py | '''Test case for MongoDB database backend
'''
import unittest
from lighty.db import fields, models
class ModelTestCase(unittest.TestCase):
'''Test case
'''
def testClassExtending(self):
'''Test is child class inherit all the field from parent class
'''
class Base(models.Model):
... | Add test case for model class inheritance | Add test case for model class inheritance
| Python | bsd-3-clause | GrAndSE/lighty | ---
+++
@@ -0,0 +1,30 @@
+'''Test case for MongoDB database backend
+'''
+import unittest
+
+from lighty.db import fields, models
+
+
+class ModelTestCase(unittest.TestCase):
+ '''Test case
+ '''
+
+ def testClassExtending(self):
+ '''Test is child class inherit all the field from parent class
+ ... | |
88473f3486a98a869928f0945998337084bfe3f3 | Lib/test/outstanding_bugs.py | Lib/test/outstanding_bugs.py | #
# This file is for everybody to add tests for bugs that aren't
# fixed yet. Please add a test case and appropriate bug description.
#
# When you fix one of the bugs, please move the test to the correct
# test_ module.
#
import unittest
from test import test_support
class TestBug1385040(unittest.TestCase):
def t... | Add a test file (which isn't run by regrtest) for bugs which aren't fixed yet. | Add a test file (which isn't run by regrtest) for bugs which
aren't fixed yet.
Includes a first test (for compiler).
| Python | mit | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | ---
+++
@@ -0,0 +1,24 @@
+#
+# This file is for everybody to add tests for bugs that aren't
+# fixed yet. Please add a test case and appropriate bug description.
+#
+# When you fix one of the bugs, please move the test to the correct
+# test_ module.
+#
+
+import unittest
+from test import test_support
+
+class TestB... | |
431f14a19549d9d22fe35e87403695d68eb7f906 | distarray/__init__.py | distarray/__init__.py | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
fro... | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
"""... | Add a package-level DistArray docstring. | Add a package-level DistArray docstring. | Python | bsd-3-clause | enthought/distarray,RaoUmer/distarray,RaoUmer/distarray,enthought/distarray | ---
+++
@@ -4,6 +4,17 @@
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
+"""
+DistArray: Distributed NumPy-like arrays
+========================================
+
+Documentation is available in docstrings and onlin... |
7aff8534b2b579efbc403882ade471f6ce4f3157 | dropout_rnn.py | dropout_rnn.py | import tensorflow as tf
import numpy as np
#First Option
keep_prob = 0.5
cell = tf.contrib.rnn.BasicRNNCell(num_units=n_neurons)
cell_drop = tf.contrib.rnn.DropoutWrapper(cell, input_keep_prob=keep_prob)
multi_layer_cell = tf.contrib.rnn.MultiRNNCell([cell_drop] * n_layers)
rnn_outputs, states = tf.nn.dynamic_rnn(mu... | Add rudimentary code for dropout RNN | Add rudimentary code for dropout RNN
Non functioning code for illustration
| Python | mit | KT12/hands_on_machine_learning | ---
+++
@@ -0,0 +1,38 @@
+import tensorflow as tf
+import numpy as np
+
+#First Option
+
+keep_prob = 0.5
+
+cell = tf.contrib.rnn.BasicRNNCell(num_units=n_neurons)
+cell_drop = tf.contrib.rnn.DropoutWrapper(cell, input_keep_prob=keep_prob)
+multi_layer_cell = tf.contrib.rnn.MultiRNNCell([cell_drop] * n_layers)
+rnn_... | |
bff010be0ee1a8e512486777c47228449a766cd3 | webhooks/admin.py | webhooks/admin.py | from django.contrib import admin
from .models import Webhook
admin.site.register(Webhook)
| from django.contrib import admin
from .models import Webhook
class WebhookAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'event', 'url')
list_editable = ('event', 'url')
list_filter = ('event',)
admin.site.register(Webhook, WebhookAdmin)
| Add custom ModelAdmin for easier editing from list view | Add custom ModelAdmin for easier editing from list view | Python | bsd-2-clause | chop-dbhi/django-webhooks,pombredanne/django-webhooks,chop-dbhi/django-webhooks,pombredanne/django-webhooks | ---
+++
@@ -1,4 +1,9 @@
from django.contrib import admin
from .models import Webhook
-admin.site.register(Webhook)
+class WebhookAdmin(admin.ModelAdmin):
+ list_display = ('__unicode__', 'event', 'url')
+ list_editable = ('event', 'url')
+ list_filter = ('event',)
+
+admin.site.register(Webhook, WebhookA... |
147218ee982598703ae59880892beb076552ea4c | fetch-binary-build.py | fetch-binary-build.py | import urllib2
import os
pieces = """
Security.hdrs.tar.gz
Security.root.tar.gz
SecurityTokend.hdrs.tar.gz
SecurityTokend.root.tar.gz
libsecurity_cdsa_client.hdrs.tar.gz
libsecurity_cdsa_client.root.tar.gz
libsecurity_cdsa_utilities.hdrs.tar.gz
libsecurity_cdsa_utilities.root.tar.gz
libsecurity_utilities.root.tar.gz
... | Add script to fetch the binary pieces from Apple. | Add script to fetch the binary pieces from Apple.
| Python | lgpl-2.1 | dirkx/OpenSC.tokend,dirkx/OpenSC.tokend,dirkx/OpenSC.tokend,dirkx/OpenSC.tokend,dirkx/OpenSC.tokend,dirkx/OpenSC.tokend | ---
+++
@@ -0,0 +1,49 @@
+import urllib2
+import os
+
+
+pieces = """
+Security.hdrs.tar.gz
+Security.root.tar.gz
+SecurityTokend.hdrs.tar.gz
+SecurityTokend.root.tar.gz
+libsecurity_cdsa_client.hdrs.tar.gz
+libsecurity_cdsa_client.root.tar.gz
+libsecurity_cdsa_utilities.hdrs.tar.gz
+libsecurity_cdsa_utilities.root.t... | |
5c37027a2d1e686523db6aa75556c4148d27ca70 | yithlibraryserver/tests/test_config.py | yithlibraryserver/tests/test_config.py | import os
import unittest
from yithlibraryserver.config import read_setting_from_env
class ConfigTests(unittest.TestCase):
def test_read_setting_from_env(self):
settings = {
'foo_bar': '1',
}
self.assertEqual('1', read_setting_from_env(settings, 'foo_bar'))
self... | Add a test for the read_setting_from_env function | Add a test for the read_setting_from_env function
| Python | agpl-3.0 | lorenzogil/yith-library-server,Yaco-Sistemas/yith-library-server,lorenzogil/yith-library-server,Yaco-Sistemas/yith-library-server,Yaco-Sistemas/yith-library-server,lorenzogil/yith-library-server | ---
+++
@@ -0,0 +1,22 @@
+import os
+import unittest
+
+from yithlibraryserver.config import read_setting_from_env
+
+
+class ConfigTests(unittest.TestCase):
+
+ def test_read_setting_from_env(self):
+ settings = {
+ 'foo_bar': '1',
+ }
+
+ self.assertEqual('1', read_setting_fro... | |
5e74e5f527a5ce85f730afa5944e46d6bf843794 | httpavail.py | httpavail.py | import sys, requests, argparse
from retrying import retry
argparser = argparse.ArgumentParser()
argparser.add_argument('url')
argparser.add_argument('-t', '--timeout', type=int, default=120)
argparser.add_argument('-d', '--delay', type=int, default=1)
args = argparser.parse_args()
@retry(stop_max_delay = args.timeou... | Add http availability checker script | Add http availability checker script
| Python | mit | ulich/docker-httpavail | ---
+++
@@ -0,0 +1,23 @@
+import sys, requests, argparse
+from retrying import retry
+
+argparser = argparse.ArgumentParser()
+argparser.add_argument('url')
+argparser.add_argument('-t', '--timeout', type=int, default=120)
+argparser.add_argument('-d', '--delay', type=int, default=1)
+args = argparser.parse_args()
+
... | |
42e7c630e10d651108166646ae45d7b8682eee18 | test/Test_sliding_window_tree.py | test/Test_sliding_window_tree.py | import unittest
import sliding_window_tree
# For now, use a *.remap.sam file (paired end reads aligned to a consensus sequence with indels removed).
SAM_FILENAME = "./data/TestSample-RT_S17.HIV1B-vif.remap.sam"
MAPQ_CUTOFF = 0 # alignment quality cutoff
MAX_PROP_N = 0 # maximum proportion of N bases in MSA-aligned s... | Add unit test for full pipeline to get sliding window dn/ds | Add unit test for full pipeline to get sliding window dn/ds
| Python | bsd-2-clause | cfe-lab/Umberjack,cfe-lab/Umberjack | ---
+++
@@ -0,0 +1,27 @@
+import unittest
+import sliding_window_tree
+
+# For now, use a *.remap.sam file (paired end reads aligned to a consensus sequence with indels removed).
+SAM_FILENAME = "./data/TestSample-RT_S17.HIV1B-vif.remap.sam"
+MAPQ_CUTOFF = 0 # alignment quality cutoff
+MAX_PROP_N = 0 # maximum prop... | |
b348d261468a21ef80fc0e42d0a8ebc25d2c6cea | generic_filter/itimer.py | generic_filter/itimer.py | # IPython log file
import genfilt as c
import genfilt_py as p
import numpy as np
image = np.random.rand(500, 500)
get_ipython().magic('timeit out = c.maximum_filter(image)')
get_ipython().magic('timeit out = p.maximum_filter(image)')
| Add IPython script to run benchmarks | Add IPython script to run benchmarks
The `itimer.py` script uses IPython magic so it must be run using
`ipython -i`, *not* with the vanilla Python interpreter.
| Python | mit | jni/performance-tests | ---
+++
@@ -0,0 +1,9 @@
+# IPython log file
+
+
+import genfilt as c
+import genfilt_py as p
+import numpy as np
+image = np.random.rand(500, 500)
+get_ipython().magic('timeit out = c.maximum_filter(image)')
+get_ipython().magic('timeit out = p.maximum_filter(image)') | |
b66838605bac08fbd889c4efe9fc9f68407c8eb0 | libgstc/python/gstcerror.py | libgstc/python/gstcerror.py | # GStreamer Daemon - gst-launch on steroids
# Python client library abstracting gstd interprocess communication
# Copyright (c) 2015-2019 RidgeRun, LLC (http://www.ridgerun.com)
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# ... | Add gstc error handler class | Add gstc error handler class
| Python | lgpl-2.1 | RidgeRun/gstd-1.x,RidgeRun/gstd-1.x,RidgeRun/gstd-1.x,RidgeRun/gstd-1.x | ---
+++
@@ -0,0 +1,47 @@
+# GStreamer Daemon - gst-launch on steroids
+# Python client library abstracting gstd interprocess communication
+
+# Copyright (c) 2015-2019 RidgeRun, LLC (http://www.ridgerun.com)
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provide... | |
ae65e73c8ec9564613aaa9acd3868b9fe15f9c63 | IPython/utils/tempdir.py | IPython/utils/tempdir.py | """TemporaryDirectory class, copied from Python 3.2.
This is copied from the stdlib and will be standard in Python 3.2 and onwards.
"""
# This code should only be used in Python versions < 3.2, since after that we
# can rely on the stdlib itself.
try:
from tempfile import TemporaryDirectory
except ImportError:
... | Add context manager for temporary directories from Python 3.2 | Add context manager for temporary directories from Python 3.2
This is very useful in tests, and after writing my own version I found
out that python 3.2 has now a basically identical implementation to
mine, so I copied that instead. We can remove our copy once we're not
supporting python 2.x anymore.
| Python | bsd-3-clause | ipython/ipython,ipython/ipython | ---
+++
@@ -0,0 +1,76 @@
+"""TemporaryDirectory class, copied from Python 3.2.
+
+This is copied from the stdlib and will be standard in Python 3.2 and onwards.
+"""
+
+# This code should only be used in Python versions < 3.2, since after that we
+# can rely on the stdlib itself.
+try:
+ from tempfile import Tempo... | |
c7868451f5387f8c7d10303b268498633bbd4a2f | functional/tests/compute/v2/test_server.py | functional/tests/compute/v2/test_server.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 functional tests for server CRUD | Add functional tests for server CRUD
Change-Id: I77f292d47a9bea6a5b486ce513c0c19ec8c845dd
| Python | apache-2.0 | openstack/python-openstackclient,redhat-openstack/python-openstackclient,BjoernT/python-openstackclient,BjoernT/python-openstackclient,openstack/python-openstackclient,dtroyer/python-openstackclient,dtroyer/python-openstackclient,redhat-openstack/python-openstackclient | ---
+++
@@ -0,0 +1,55 @@
+# 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... | |
42a81521776c3e0fb1ad740bbf98e9a37e59bc1a | scripts/tests/test_remove_wiki_title_forward_slashes.py | scripts/tests/test_remove_wiki_title_forward_slashes.py | from nose.tools import *
from framework.mongo import database as db
from scripts.remove_wiki_title_forward_slashes import main
from tests.base import OsfTestCase
from tests.factories import NodeWikiFactory, ProjectFactory
class TestRemoveWikiTitleForwardSlashes(OsfTestCase):
def test_forward_slash_is_removed_... | Add tests for removing "/" from wiki titles | Add tests for removing "/" from wiki titles
| Python | apache-2.0 | abought/osf.io,CenterForOpenScience/osf.io,brianjgeiger/osf.io,HalcyonChimera/osf.io,hmoco/osf.io,HalcyonChimera/osf.io,doublebits/osf.io,rdhyee/osf.io,monikagrabowska/osf.io,kch8qx/osf.io,Johnetordoff/osf.io,kwierman/osf.io,cwisecarver/osf.io,laurenrevere/osf.io,wearpants/osf.io,acshi/osf.io,emetsger/osf.io,TomHeatwol... | ---
+++
@@ -0,0 +1,38 @@
+from nose.tools import *
+
+from framework.mongo import database as db
+
+from scripts.remove_wiki_title_forward_slashes import main
+
+from tests.base import OsfTestCase
+from tests.factories import NodeWikiFactory, ProjectFactory
+
+
+class TestRemoveWikiTitleForwardSlashes(OsfTestCase):
+... | |
dbaca46d0f5a852e22d056a261f432b501d70d14 | openstack_auth/tests/unit/test_password.py | openstack_auth/tests/unit/test_password.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 a unit test for the password change form | Add a unit test for the password change form
Change-Id: I5eeacefc3a0bd7d7f958f00befeb18e949c789db
| Python | apache-2.0 | openstack/horizon,openstack/horizon,openstack/horizon,openstack/horizon | ---
+++
@@ -0,0 +1,85 @@
+# 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... | |
c2dff4281ec50786eb82e729f1d6d5ce69376046 | notes/s3utils.py | notes/s3utils.py | from storages.backends.s3boto import S3BotoStorage
StaticRootS3BotoStorage = lambda: S3BotoStorage(location='static')
MediaRootS3BotoStorage = lambda: S3BotoStorage(location='media')
| Add missing S3 boto storage classes | Add missing S3 boto storage classes
| Python | mit | creynaud/notes-server | ---
+++
@@ -0,0 +1,4 @@
+from storages.backends.s3boto import S3BotoStorage
+
+StaticRootS3BotoStorage = lambda: S3BotoStorage(location='static')
+MediaRootS3BotoStorage = lambda: S3BotoStorage(location='media') | |
7d32f720f45903761c05d4b622705551c742c425 | profile_dgim.py | profile_dgim.py | import time
from dgim.utils import generate_random_stream
from dgim.dgim import Dgim
def profile_dgim(dgim, stream):
for elt in stream:
dgim.update(elt)
def main():
N = 100
r = 2
length = 1000000
dgim = Dgim(N=N, r=r)
stream = generate_random_stream(length=length)
time_start = ti... | Create a script to profile code. | Create a script to profile code.
| Python | bsd-3-clause | simondolle/dgim,simondolle/dgim | ---
+++
@@ -0,0 +1,23 @@
+import time
+from dgim.utils import generate_random_stream
+from dgim.dgim import Dgim
+
+def profile_dgim(dgim, stream):
+ for elt in stream:
+ dgim.update(elt)
+
+def main():
+
+ N = 100
+ r = 2
+ length = 1000000
+
+ dgim = Dgim(N=N, r=r)
+ stream = generate_rando... | |
431ca01ca4d62c68c3e8ab858138f5fa9b1f2d4c | validity.py | validity.py | import pandas as pd
import numpy as np
import operator,os
def extract( file_name ):
with open(file_name) as f:
for i,line in enumerate(f,1):
if "SCN" in line:
return i
def main(lta_file):
os.system('ltahdr -i ' + lta_file + '> lta_header')
dictionary = {}
skipped_r... | Add file to extract source name from LTA header | Add file to extract source name from LTA header
| Python | mit | NCRA-TIFR/gadpu,NCRA-TIFR/gadpu | ---
+++
@@ -0,0 +1,28 @@
+import pandas as pd
+import numpy as np
+import operator,os
+
+def extract( file_name ):
+ with open(file_name) as f:
+ for i,line in enumerate(f,1):
+ if "SCN" in line:
+ return i
+
+def main(lta_file):
+ os.system('ltahdr -i ' + lta_file + '> lta_hea... | |
4fa68b92ef31ff4b95d846d08a1259d2ccba5670 | test/selenium/src/run_selenium.py | test/selenium/src/run_selenium.py | #!/usr/bin/env python2.7
# 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: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
import sys
import os
import commands
import logging
imp... | Add new test runner for selenium tests | Add new test runner for selenium tests
This is an extra test runner that is meant only for inside docker
containers. The original test runner will remain untill we handle the
screen capture of the test runs, so we can run the tests on our local
machine and view the browser window.
| Python | apache-2.0 | prasannav7/ggrc-core,plamut/ggrc-core,kr41/ggrc-core,josthkko/ggrc-core,VinnieJohns/ggrc-core,jmakov/ggrc-core,j0gurt/ggrc-core,jmakov/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,plamut/ggrc-core,josthkko/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,andrei-ka... | ---
+++
@@ -0,0 +1,36 @@
+#!/usr/bin/env python2.7
+# 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: miha@reciprocitylabs.com
+# Maintained By: miha@reciprocitylabs.com
+
+import sys
+import os... | |
01b6ec639eb35c2d9b978839442481afc1f66422 | quiz/4-substr.py | quiz/4-substr.py | #!/usr/bin/env python3
def arr_from_str(text):
arr = list()
for i in text:
if ord('A') <= ord(i) <= ord('Z'):
arr.append(ord(i) - ord('A'))
return arr
def solve_q1(pat, radix, target):
dfa = [[0] * radix]
dfa[0][pat[0]] = 1
pre = 0
for i in range(1, len(pat)):
... | Add autosolver for quiz in week 4. | Add autosolver for quiz in week 4.
| Python | mit | hghwng/mooc-algs2,hghwng/mooc-algs2 | ---
+++
@@ -0,0 +1,72 @@
+#!/usr/bin/env python3
+
+
+def arr_from_str(text):
+ arr = list()
+ for i in text:
+ if ord('A') <= ord(i) <= ord('Z'):
+ arr.append(ord(i) - ord('A'))
+ return arr
+
+
+def solve_q1(pat, radix, target):
+ dfa = [[0] * radix]
+ dfa[0][pat[0]] = 1
+
+ pre ... | |
7b1108b596a48ab1d837aa0a3bba07e6d50abe32 | tests/test_classifier.py | tests/test_classifier.py | import pytest
import numpy as np
from sklearn.utils.estimator_checks import check_estimator
from sklearn.model_selection import train_test_split
import legendary_potato.classifiers as classifiers
def classifier_iterator():
"""Return an iterator over classifier.
"""
return (classifiers.svdd,)
def two_c... | Add tests for (not yet implemented) classifier | [TESTS] Add tests for (not yet implemented) classifier
| Python | mit | manu3618/legendary-potato | ---
+++
@@ -0,0 +1,64 @@
+import pytest
+
+import numpy as np
+from sklearn.utils.estimator_checks import check_estimator
+from sklearn.model_selection import train_test_split
+
+import legendary_potato.classifiers as classifiers
+
+
+def classifier_iterator():
+ """Return an iterator over classifier.
+ """
+ ... | |
34b1d1de57022e2d7cbfb1d3c1fac8c29632caef | tests/test_converters.py | tests/test_converters.py | import unittest
from beaker.converters import asbool, aslist
class AsBool(unittest.TestCase):
def test_truth_str(self):
for v in ('true', 'yes', 'on', 'y', 't', '1'):
self.assertTrue(asbool(v), "%s should be considered True" % (v,))
v = v.upper()
self.assertTrue(asbool... | Bring coverage for the converters module up to 100%. | Bring coverage for the converters module up to 100%.
--HG--
branch : trunk
| Python | bsd-3-clause | enomado/beaker,jvanasco/beaker,masayuko/beaker | ---
+++
@@ -0,0 +1,54 @@
+import unittest
+
+from beaker.converters import asbool, aslist
+
+
+class AsBool(unittest.TestCase):
+ def test_truth_str(self):
+ for v in ('true', 'yes', 'on', 'y', 't', '1'):
+ self.assertTrue(asbool(v), "%s should be considered True" % (v,))
+ v = v.upper... | |
5e60c2c7e794ad1cac8340d10d9d913ad486a28c | tests/test_getproject.py | tests/test_getproject.py | """Tests for the ``getproject`` subcommand."""
import os
from pew._utils import temp_environ, invoke_pew as invoke
from utils import TemporaryDirectory
def test_getproject(env1):
"""Check that ``getproject`` prints an environment’s project directory."""
with temp_environ():
os.environ.pop('VIRTUAL_E... | Add tests for the `getproject` subcommand | Add tests for the `getproject` subcommand
| Python | mit | berdario/pew,berdario/pew | ---
+++
@@ -0,0 +1,60 @@
+"""Tests for the ``getproject`` subcommand."""
+
+import os
+
+from pew._utils import temp_environ, invoke_pew as invoke
+from utils import TemporaryDirectory
+
+
+def test_getproject(env1):
+ """Check that ``getproject`` prints an environment’s project directory."""
+ with temp_enviro... | |
bc37951f9ff2064d70b7cee42f92ccc4a1284140 | tests/test_chaining.py | tests/test_chaining.py | import mr_streams as ms
import unittest
# :::: auxilary functions ::::
def add_one(x):
return x + 1
def triplicate(x):
return (x,x,x)
def no_op(*args, **kwargs):
pass
class TestChaining(unittest.TestCase):
def test_MaFiTaFlTkTpDr(self):
_ = ms.stream(range(20))
_.map(add_one)\
... | Fix bug in reduce and tap. | Fix bug in reduce and tap.
| Python | mit | caffeine-potent/Streamer-Datastructure | ---
+++
@@ -0,0 +1,26 @@
+import mr_streams as ms
+import unittest
+
+# :::: auxilary functions ::::
+def add_one(x):
+ return x + 1
+
+def triplicate(x):
+ return (x,x,x)
+
+def no_op(*args, **kwargs):
+ pass
+
+class TestChaining(unittest.TestCase):
+
+ def test_MaFiTaFlTkTpDr(self):
+ _ = ms.str... | |
39da7b8fff5420187c1c3f388cdb744cbde38e7d | tests/test_database.py | tests/test_database.py | from StringIO import StringIO
from django.core.management import call_command
import pytest
def test_for_missing_migrations():
output = StringIO()
try:
call_command(
'makemigrations', interactive=False, dry_run=True, exit_code=True,
stdout=output)
except SystemExit as e:
... | Add test to fail if there are migrations missing. | Add test to fail if there are migrations missing.
| Python | mpl-2.0 | mozilla/telemetry-analysis-service,mozilla/telemetry-analysis-service,mozilla/telemetry-analysis-service,mozilla/telemetry-analysis-service | ---
+++
@@ -0,0 +1,16 @@
+from StringIO import StringIO
+from django.core.management import call_command
+import pytest
+
+
+def test_for_missing_migrations():
+ output = StringIO()
+ try:
+ call_command(
+ 'makemigrations', interactive=False, dry_run=True, exit_code=True,
+ stdout=... | |
40148403575885640d7b90a33e2497081503757e | pygraphc/evaluation/CalinskiHarabaszIndex2.py | pygraphc/evaluation/CalinskiHarabaszIndex2.py | from pygraphc.similarity.CosineSimilarity import CosineSimilarity
class CalinskiHarabaszIndex(object):
def __init__(self, clusters, preprocessed_logs, log_length):
self.clusters = clusters
self.preprocessed_logs = preprocessed_logs
self.log_length = log_length
self.cluster_centroid... | Create new generic Calinski Harabasz index | Create new generic Calinski Harabasz index
| Python | mit | studiawan/pygraphc | ---
+++
@@ -0,0 +1,66 @@
+from pygraphc.similarity.CosineSimilarity import CosineSimilarity
+
+
+class CalinskiHarabaszIndex(object):
+ def __init__(self, clusters, preprocessed_logs, log_length):
+ self.clusters = clusters
+ self.preprocessed_logs = preprocessed_logs
+ self.log_length = log_l... | |
f29ac339dba7bb90327cdf9b41245ce7c383b126 | vimap-test.py | vimap-test.py | import imap_cli
from imap_cli import config
from imap_cli import search
connect_conf = config.new_context_from_file(section='imap')
display_conf = config.new_context_from_file(section='display')
imap_account = imap_cli.connect(**connect_conf)
display_conf['format_list'] = u'{uid:>5} : {from:<40} : {subject}'
for tr... | Add a python test file | Add a python test file
| Python | mit | Gentux/vimap | ---
+++
@@ -0,0 +1,14 @@
+import imap_cli
+from imap_cli import config
+from imap_cli import search
+
+
+connect_conf = config.new_context_from_file(section='imap')
+display_conf = config.new_context_from_file(section='display')
+imap_account = imap_cli.connect(**connect_conf)
+
+
+display_conf['format_list'] = u'{ui... | |
2540d4d9383d8c2cb67ef85fd1f2e3206b006902 | app/views.py | app/views.py | from django.shortcuts import render_to_response
from django.http import HttpResponse
from app.models import Event
def home(request):
if request.method == 'POST':
if request.POST.has_key('what') and len(request.POST['what']) > 0:
e = Event.objects.create(what=request.POST['what'])
e.save()
else:
... | Add a view that handles POST and GET requests for the useless log | Add a view that handles POST and GET requests for the useless log
| Python | mit | schatten/logan | ---
+++
@@ -0,0 +1,17 @@
+from django.shortcuts import render_to_response
+from django.http import HttpResponse
+
+from app.models import Event
+
+def home(request):
+ if request.method == 'POST':
+ if request.POST.has_key('what') and len(request.POST['what']) > 0:
+ e = Event.objects.create(what=request.POS... | |
299cb28627228465a1cde6bb21682bc91314cdf6 | tools/clang-format/clang-format-sublime.py | tools/clang-format/clang-format-sublime.py | # This file is a minimal clang-format sublime-integration. To install:
# - Change 'binary' if clang-format is not on the path (see below).
# - Put this file into your sublime Packages directory, e.g. on Linux:
# ~/.config/sublime-text-2/Packages/User/clang-format-sublime.py
# - Add a key binding:
# { "keys": ["... | Add basic clang-format integration for sublime text. | Add basic clang-format integration for sublime text.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@182015 91177308-0d34-0410-b5e6-96231b3b80d8
| Python | apache-2.0 | llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/cl... | ---
+++
@@ -0,0 +1,55 @@
+# This file is a minimal clang-format sublime-integration. To install:
+# - Change 'binary' if clang-format is not on the path (see below).
+# - Put this file into your sublime Packages directory, e.g. on Linux:
+# ~/.config/sublime-text-2/Packages/User/clang-format-sublime.py
+# - Add a... | |
5ec8f36c2831c0870afbf2926e3fb473cea4780d | document/migrations/0008_auto_20160519_2253.py | document/migrations/0008_auto_20160519_2253.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-19 20:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('document', '0007_auto_20160518_1825'),
]
operations = [
migrations.AlterMode... | Change kamerstuk id from integer to string | Change kamerstuk id from integer to string
Anything can be the id. No documentation on standards.
| Python | mit | openkamer/openkamer,openkamer/openkamer,openkamer/openkamer,openkamer/openkamer | ---
+++
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.5 on 2016-05-19 20:53
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('document', '0007_auto_20160518_1825'),
+ ]
+
+ op... | |
3c301335a4c39b1099c9fd29d7eebbf6506c0979 | codes/20180922/test.py | codes/20180922/test.py | # coding: utf-8
import matplotlib.pyplot as plt
import numpy as np
import os
from tqdm import trange
os.makedirs('./images/', exist_ok=True)
i = 0
for i in trange(10000, desc='saving images'):
img = np.full((64, 64, 3), 128)
plt.imshow(img / 255.)
plt.axis('off')
plt.tick_params(labelbottom=False, labelleft=Fals... | Add code that makes many images being clear memory. | Add code that makes many images being clear memory.
| Python | mit | iShoto/testpy | ---
+++
@@ -0,0 +1,17 @@
+# coding: utf-8
+
+import matplotlib.pyplot as plt
+import numpy as np
+import os
+from tqdm import trange
+
+os.makedirs('./images/', exist_ok=True)
+
+i = 0
+for i in trange(10000, desc='saving images'):
+ img = np.full((64, 64, 3), 128)
+ plt.imshow(img / 255.)
+ plt.axis('off')
+ plt.tic... | |
b8143d73d8f557ea9612b056c457d31a20de7aae | h2o-py/tests/testdir_algos/deepwater/pyunit_inception_bn_feature_extraction.py | h2o-py/tests/testdir_algos/deepwater/pyunit_inception_bn_feature_extraction.py | from __future__ import print_function
import sys, os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from tests import pyunit_utils
from h2o.estimators.deepwater import H2ODeepWaterEstimator
import urllib
def deepwater_inception_bn_feature_extraction():
if not H2ODeepWaterEstimator.available(): return
... | Add feature extraction (transfer learning) for Inception 1k model for cat/dog/mouse dataset (no training). | Add feature extraction (transfer learning) for Inception 1k model for cat/dog/mouse dataset (no training).
| Python | apache-2.0 | h2oai/h2o-dev,spennihana/h2o-3,mathemage/h2o-3,h2oai/h2o-3,h2oai/h2o-3,mathemage/h2o-3,mathemage/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3,michalkurka/h2o-3,h2oai/h2o-dev,michalkurka/h2o-3,mathemage/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,h2oai/h2o-dev,spennihana/h2o-3,h2oai/h2o-dev,h2oa... | ---
+++
@@ -0,0 +1,53 @@
+from __future__ import print_function
+import sys, os
+sys.path.insert(1, os.path.join("..","..",".."))
+import h2o
+from tests import pyunit_utils
+from h2o.estimators.deepwater import H2ODeepWaterEstimator
+
+import urllib
+
+def deepwater_inception_bn_feature_extraction():
+ if not H2ODe... | |
3edec9bf4b71e2cfde537f5f443d184323e5d8f8 | GetCallLogs.py | GetCallLogs.py | from twilio.rest import TwilioRestClient
import config
# To find these visit https://www.twilio.com/user/account
account_sid = config.account_sid
auth_token = config.auth_token
client = TwilioRestClient(account_sid, auth_token)
for call in client.calls.list():
print("From: " + call.from_formatted + " To: " + cal... | Add snippet to retrieve call logs from Twilio account | Add snippet to retrieve call logs from Twilio account
| Python | mit | mattstibbs/twilio-snippets | ---
+++
@@ -0,0 +1,11 @@
+from twilio.rest import TwilioRestClient
+import config
+
+# To find these visit https://www.twilio.com/user/account
+account_sid = config.account_sid
+auth_token = config.auth_token
+
+client = TwilioRestClient(account_sid, auth_token)
+
+for call in client.calls.list():
+ print("From: "... | |
11a962099ea8735227623443c62c0248b98e4805 | examples/hwapi/hwconfig_z_96b_carbon.py | examples/hwapi/hwconfig_z_96b_carbon.py | from machine import Signal
# 96Boards Carbon board
# USR1 - User controlled led, connected to PD2
# USR2 - User controlled led, connected to PA15
# BT - Bluetooth indicator, connected to PB5.
# Note - 96b_carbon uses (at the time of writing) non-standard
# for Zephyr port device naming convention.
LED = Signal(("GPIOA... | Add config for Zephyr port of 96Boards Carbon. | examples/hwapi: Add config for Zephyr port of 96Boards Carbon.
| Python | mit | infinnovation/micropython,HenrikSolver/micropython,henriknelson/micropython,cwyark/micropython,tralamazza/micropython,micropython/micropython-esp32,SHA2017-badge/micropython-esp32,tobbad/micropython,alex-robbins/micropython,deshipu/micropython,chrisdearman/micropython,hiway/micropython,Timmenem/micropython,adafruit/cir... | ---
+++
@@ -0,0 +1,9 @@
+from machine import Signal
+
+# 96Boards Carbon board
+# USR1 - User controlled led, connected to PD2
+# USR2 - User controlled led, connected to PA15
+# BT - Bluetooth indicator, connected to PB5.
+# Note - 96b_carbon uses (at the time of writing) non-standard
+# for Zephyr port device namin... | |
1d7e4aa94288db515a673f223e4b4488a80580be | tests/app/test_accessibility_statement.py | tests/app/test_accessibility_statement.py | import re
import subprocess
from datetime import datetime
def test_last_review_date():
statement_file_path = "app/templates/views/accessibility_statement.html"
# test local changes against master for a full diff of what will be merged
statement_diff = subprocess.run([f"git diff --exit-code origin/master ... | Add test for accessibility statement last review | Add test for accessibility statement last review
This is a proposal of a way to test that changes
to this page include updates to the 'last
reviewed' date, if needed.
| Python | mit | alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin | ---
+++
@@ -0,0 +1,24 @@
+import re
+import subprocess
+from datetime import datetime
+
+
+def test_last_review_date():
+ statement_file_path = "app/templates/views/accessibility_statement.html"
+
+ # test local changes against master for a full diff of what will be merged
+ statement_diff = subprocess.run([... | |
db43c60e49a26fd178cb101b45ca1cd709853f91 | samples/filter_vms.py | samples/filter_vms.py | #!/usr/bin/env python
"""
Written by Nathan Prziborowski
Github: https://github.com/prziborowski
This code is released under the terms of the Apache 2
http://www.apache.org/licenses/LICENSE-2.0.html
Example script to filter the list of VMs by a property's value.
Defaults for powered on VMs.
"""
import sys
from pyVmo... | Add sample for using Property collector to assist in filtering VMs | Add sample for using Property collector to assist in filtering VMs
The property collector can be used to fetch a subset of properties
for a large amount of objects with fewer round trips that iterating.
This sample shows how it could be used to fetch the power state of
all the VMs and post-process filter on them.
No... | Python | apache-2.0 | vmware/pyvmomi-community-samples,pathcl/pyvmomi-community-samples,prziborowski/pyvmomi-community-samples,ddcrjlalumiere/pyvmomi-community-samples,jm66/pyvmomi-community-samples | ---
+++
@@ -0,0 +1,81 @@
+#!/usr/bin/env python
+"""
+Written by Nathan Prziborowski
+Github: https://github.com/prziborowski
+
+This code is released under the terms of the Apache 2
+http://www.apache.org/licenses/LICENSE-2.0.html
+
+Example script to filter the list of VMs by a property's value.
+Defaults for power... | |
53e25e5cb1ffb62cb54fed021b2d61144e422b05 | download_from_Wikimedia_Commons.py | download_from_Wikimedia_Commons.py | #!/usr/bin/python
# -=- encoding: latin-1 -=-
"""Download files from Wikimedia Commons"""
import os
import logging
import argparse
from commonsdownloader import download_file
def get_file_names_from_textfile(textfile_handler):
"""Yield the file names and widths by parsing a given text fileahandler."""
for l... | Add script to download files from Commons | Add script to download files from Commons
This command line script interfaces with the commonsdownloader module.
It provides two ways to download files:
-give file names to the command line
-give a text file listing all the files to download
| Python | mit | Commonists/CommonsDownloader | ---
+++
@@ -0,0 +1,80 @@
+#!/usr/bin/python
+# -=- encoding: latin-1 -=-
+
+"""Download files from Wikimedia Commons"""
+
+import os
+import logging
+import argparse
+from commonsdownloader import download_file
+
+
+def get_file_names_from_textfile(textfile_handler):
+ """Yield the file names and widths by parsing... | |
8268f13015b4b6da7f3b1ab25898bb403c2ae22d | scripts/compact_seriesly.py | scripts/compact_seriesly.py | from logger import logger
from seriesly import Seriesly
from perfrunner.settings import StatsSettings
def main():
s = Seriesly(StatsSettings.SERIESLY['host'])
for db in s.list_dbs():
logger.info('Compacting {}'.format(db))
result = s[db].compact()
logger.info('Compaction finished: {}'... | Add a script for periodic compaction of Seriesly databases | CBPS-210: Add a script for periodic compaction of Seriesly databases
Change-Id: I95123c116c0dcdce4b4df02974d2a9fdeaef55dc
Reviewed-on: http://review.couchbase.org/69249
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Pavel Paulau <dd88eded64e90046a680e3a6c0828ceb8fe8a0e7@gmail... | Python | apache-2.0 | couchbase/perfrunner,pavel-paulau/perfrunner,pavel-paulau/perfrunner,couchbase/perfrunner,couchbase/perfrunner,pavel-paulau/perfrunner,couchbase/perfrunner,couchbase/perfrunner,couchbase/perfrunner,pavel-paulau/perfrunner,pavel-paulau/perfrunner | ---
+++
@@ -0,0 +1,16 @@
+from logger import logger
+from seriesly import Seriesly
+
+from perfrunner.settings import StatsSettings
+
+
+def main():
+ s = Seriesly(StatsSettings.SERIESLY['host'])
+ for db in s.list_dbs():
+ logger.info('Compacting {}'.format(db))
+ result = s[db].compact()
+ ... | |
cf9d549d161536a343fde1e66cb21a195630d6f2 | learning-python/ch07/try_catch_finally.py | learning-python/ch07/try_catch_finally.py | import json
def div(a, b):
try:
print("calculating {}/{}: ".format(a, b))
result = a / b
except ZeroDivisionError as ex:
print(ex)
else:
print("result is: {}".format(result))
finally:
print("Finally")
div(10, 5)
div(20, 0)
def parse_emp_json(json_data):
t... | Add try-catch-finally and exception demo. | Add try-catch-finally and exception demo.
| Python | apache-2.0 | precompiler/python-101 | ---
+++
@@ -0,0 +1,33 @@
+import json
+def div(a, b):
+ try:
+ print("calculating {}/{}: ".format(a, b))
+ result = a / b
+ except ZeroDivisionError as ex:
+ print(ex)
+ else:
+ print("result is: {}".format(result))
+ finally:
+ print("Finally")
+
+
+div(10, 5)
+
+div(20... | |
da0073ba679ac658d92859614a009343e13c3c8b | meta-iotqa/lib/oeqa/runtime/mraa_hello.py | meta-iotqa/lib/oeqa/runtime/mraa_hello.py | import os
from oeqa.oetest import oeRuntimeTest
class Mraa_hello(oeRuntimeTest):
'''Say hello to mraa library and get platform name through it'''
def test_mraa_hello(self):
'''Prepare test binaries to image'''
(status, output) = self.target.run('mkdir -p /opt/mraa-test/apps/')
(status, ... | Test case for saying hello to target and get platform information from it | Test case for saying hello to target and get platform information from it
| Python | mit | ostroproject/meta-iotqa,ostroproject/meta-iotqa,wanghongjuan/meta-iotqa-1,wanghongjuan/meta-iotqa-1,wanghongjuan/meta-iotqa-1,wanghongjuan/meta-iotqa-1,daweiwu/meta-iotqa-1,daweiwu/meta-iotqa-1,daweiwu/meta-iotqa-1,ostroproject/meta-iotqa,daweiwu/meta-iotqa-1,wanghongjuan/meta-iotqa-1,ostroproject/meta-iotqa,daweiwu/me... | ---
+++
@@ -0,0 +1,17 @@
+import os
+from oeqa.oetest import oeRuntimeTest
+
+class Mraa_hello(oeRuntimeTest):
+ '''Say hello to mraa library and get platform name through it'''
+ def test_mraa_hello(self):
+ '''Prepare test binaries to image'''
+ (status, output) = self.target.run('mkdir -p /opt/... | |
148af8380b93af6771541397e6956ed05f4fc0de | cogbot/extensions/faq.py | cogbot/extensions/faq.py | import json
import logging
import urllib.request
from discord.ext import commands
from discord.ext.commands import CommandError, Context
from cogbot import checks
from cogbot.cog_bot import CogBot
log = logging.getLogger(__name__)
class FaqConfig:
def __init__(self, **options):
self.database = options[... | Implement basic FAQ command with remote config | Implement basic FAQ command with remote config
| Python | mit | Arcensoth/cogbot | ---
+++
@@ -0,0 +1,73 @@
+import json
+import logging
+import urllib.request
+
+from discord.ext import commands
+from discord.ext.commands import CommandError, Context
+
+from cogbot import checks
+from cogbot.cog_bot import CogBot
+
+log = logging.getLogger(__name__)
+
+
+class FaqConfig:
+ def __init__(self, **... | |
6fd5333f1650cb12e81601bb73aefa9060e9c441 | closures/closure-simple-example.py | closures/closure-simple-example.py | def printMsg(msg):
#This is the main outer function that encloses printer function
#this function is nested inside the printMsg function
def printer():
print(msg)
#We return a function when printMsg function is called
return printer
#here we call the function printMsg and store its output in a... | Create this file as a simple example of closure | Create this file as a simple example of closure
i have added full working of example with comments so that whoever reads this can understand closure. This is the simplest closure example i can find. | Python | apache-2.0 | Aneesh540/python-projects | ---
+++
@@ -0,0 +1,19 @@
+def printMsg(msg):
+#This is the main outer function that encloses printer function
+
+ #this function is nested inside the printMsg function
+ def printer():
+
+ print(msg)
+ #We return a function when printMsg function is called
+ return printer
+#here we call the functi... | |
2fb4a2db2486248f4ffed867defd3ffec0cc0e12 | get_lexer.py | get_lexer.py | #!/usr/bin/python
from pygments.lexers import (get_all_lexers)
for lexname, aliases, _, mimetypes in get_all_lexers():
print "%s" % (lexname)
| Add small script to retrieve lexers from pygments | Add small script to retrieve lexers from pygments
| Python | agpl-3.0 | formorer/paste.pl,shlomif/paste.debian.net-paste.pl,formorer/paste.pl,shlomif/paste.debian.net-paste.pl,formorer/paste.pl | ---
+++
@@ -0,0 +1,7 @@
+#!/usr/bin/python
+
+from pygments.lexers import (get_all_lexers)
+
+for lexname, aliases, _, mimetypes in get_all_lexers():
+ print "%s" % (lexname)
+ | |
802c48c67423d7db2a6e056606c4bbba9d24f842 | guestbook.py | guestbook.py | # -*- coding: utf-8 -*-
import shelve
DATA_FILE = 'guestbook.dat'
def save_data(name, comment, create_at):
"""投稿データを保存します
"""
database = shelve.open(DATA_FILE)
if 'greeting_list' not in database:
greeting_list = []
else:
greeting_list = database['greeting_list']
greeting_l... | Implement top level function 'save_data()', 'load_data()' | Implement top level function 'save_data()', 'load_data()'
| Python | bsd-3-clause | raimon49/pypro2-guestbook-webapp,raimon49/pypro2-guestbook-webapp | ---
+++
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+
+import shelve
+
+
+DATA_FILE = 'guestbook.dat'
+
+
+def save_data(name, comment, create_at):
+ """投稿データを保存します
+ """
+ database = shelve.open(DATA_FILE)
+
+ if 'greeting_list' not in database:
+ greeting_list = []
+ else:
+ greeting_list... | |
558fb57d2ce4a74f8cc1dbbc245f54f6dd1e55d5 | scripts/text-files.py | scripts/text-files.py | from __future__ import print_function
import sys
from pyspark.sql import SparkSession, Row
from pyspark.sql.functions import col
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: text-files.py <input> <output>", file=sys.stderr)
exit(-1)
groupField = 'book'
spark = SparkSessi... | Add text-file.py to make minimal records from whole text files. | Add text-file.py to make minimal records from whole text files.
| Python | apache-2.0 | ViralTexts/vt-passim,ViralTexts/vt-passim,ViralTexts/vt-passim | ---
+++
@@ -0,0 +1,21 @@
+from __future__ import print_function
+import sys
+from pyspark.sql import SparkSession, Row
+from pyspark.sql.functions import col
+
+if __name__ == "__main__":
+ if len(sys.argv) != 3:
+ print("Usage: text-files.py <input> <output>", file=sys.stderr)
+ exit(-1)
+
+ grou... | |
c12cf495e8d548b3b79cd994bb10369f4da6c146 | test/benchmark_report.py | test/benchmark_report.py | '''
Make a report showing the speed of some critical commands
Check whether it is fast enough for your application
'''
from __future__ import print_function
from unrealcv import client
import docker_util
import time
import pytest
def run_command(cmd, num):
for _ in range(num):
client.request(cmd)
if __nam... | Add a benchmark report to show the speed performance. | Add a benchmark report to show the speed performance.
| Python | mit | unrealcv/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv | ---
+++
@@ -0,0 +1,34 @@
+'''
+Make a report showing the speed of some critical commands
+Check whether it is fast enough for your application
+'''
+from __future__ import print_function
+from unrealcv import client
+import docker_util
+import time
+import pytest
+
+def run_command(cmd, num):
+ for _ in range(num)... | |
b13cc8cc76bfa46e7a4fdcff664639fb18a12836 | trex/filters.py | trex/filters.py | # -*- coding: utf-8 -*-
#
# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of 'trex' for details.
#
import django_filters
from trex.models import Entry
class EntryFilter(django_filters.FilterSet):
from_date = django_filters.DateFilter(name="date", lookup_type="gte")
... | Add a filter class for Entries | Add a filter class for Entries
| Python | mit | bjoernricks/trex,bjoernricks/trex | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+#
+# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
+#
+# See LICENSE comming with the source of 'trex' for details.
+#
+
+import django_filters
+
+from trex.models import Entry
+
+
+class EntryFilter(django_filters.FilterSet):
+
+ from_date = django_filters.DateF... | |
e92c047dd6ba07d5ac4b0b79403d0c3b28e9f0d8 | pombola/core/management/commands/core_end_positions.py | pombola/core/management/commands/core_end_positions.py | from optparse import make_option
import sys
from django.core.management.base import NoArgsCommand, CommandError
from django_date_extensions.fields import ApproximateDate
from pombola.core.models import Person, Position, PositionTitle, Place, Organisation
def yyyymmdd_to_approx(yyyymmdd):
year, month, day = map(i... | Add script to end positions which meet the given criteria | Add script to end positions which meet the given criteria
| Python | agpl-3.0 | geoffkilpin/pombola,hzj123/56th,geoffkilpin/pombola,geoffkilpin/pombola,ken-muturi/pombola,ken-muturi/pombola,ken-muturi/pombola,geoffkilpin/pombola,hzj123/56th,mysociety/pombola,patricmutwiri/pombola,mysociety/pombola,geoffkilpin/pombola,hzj123/56th,hzj123/56th,mysociety/pombola,ken-muturi/pombola,mysociety/pombola,pa... | ---
+++
@@ -0,0 +1,51 @@
+from optparse import make_option
+import sys
+
+from django.core.management.base import NoArgsCommand, CommandError
+from django_date_extensions.fields import ApproximateDate
+
+from pombola.core.models import Person, Position, PositionTitle, Place, Organisation
+
+def yyyymmdd_to_approx(yyy... | |
338bf2188bfe54f1a73ac565ccca65b056aaf616 | pombola/kenya/management/commands/kenya_hide_people.py | pombola/kenya/management/commands/kenya_hide_people.py | from optparse import make_option
from django.core.management.base import NoArgsCommand, CommandError
from django.db.models import Q
from pombola.core.models import Person, Position
class Command(NoArgsCommand):
option_list = NoArgsCommand.option_list + (
make_option('--commit', action='store_true', dest... | Add a script for hiding people on Mzalendo, as requested | KE: Add a script for hiding people on Mzalendo, as requested
| Python | agpl-3.0 | mysociety/pombola,mysociety/pombola,hzj123/56th,geoffkilpin/pombola,mysociety/pombola,ken-muturi/pombola,geoffkilpin/pombola,patricmutwiri/pombola,patricmutwiri/pombola,hzj123/56th,geoffkilpin/pombola,patricmutwiri/pombola,patricmutwiri/pombola,patricmutwiri/pombola,ken-muturi/pombola,hzj123/56th,geoffkilpin/pombola,pa... | ---
+++
@@ -0,0 +1,43 @@
+from optparse import make_option
+
+from django.core.management.base import NoArgsCommand, CommandError
+from django.db.models import Q
+
+from pombola.core.models import Person, Position
+
+class Command(NoArgsCommand):
+
+ option_list = NoArgsCommand.option_list + (
+ make_option... | |
4e2bcaa57bcf3bd05c40cf8723032845a20a5c60 | py/minimum-index-sum-of-two-lists.py | py/minimum-index-sum-of-two-lists.py | from collections import defaultdict
class Solution(object):
def findRestaurant(self, list1, list2):
"""
:type list1: List[str]
:type list2: List[str]
:rtype: List[str]
"""
d1 = {x: i for (i, x) in enumerate(list1)}
min_idxes = []
min_idx_sum = len(list... | Add py solution for 599. Minimum Index Sum of Two Lists | Add py solution for 599. Minimum Index Sum of Two Lists
599. Minimum Index Sum of Two Lists: https://leetcode.com/problems/minimum-index-sum-of-two-lists/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,19 @@
+from collections import defaultdict
+class Solution(object):
+ def findRestaurant(self, list1, list2):
+ """
+ :type list1: List[str]
+ :type list2: List[str]
+ :rtype: List[str]
+ """
+ d1 = {x: i for (i, x) in enumerate(list1)}
+ min_idxe... | |
45a46bec14c2c0a2793083cb391f29a632281f11 | senlin/tests/tempest/api/profiles/test_profile_type.py | senlin/tests/tempest/api/profiles/test_profile_type.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
# distributed under t... | Add API test for profile type show/list | Add API test for profile type show/list
Change-Id: Ibb260e41f5ddcc9ac1e6603a8e749167927efc54
| Python | apache-2.0 | openstack/senlin,stackforge/senlin,openstack/senlin,openstack/senlin,stackforge/senlin | ---
+++
@@ -0,0 +1,41 @@
+# 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 writi... | |
a4e87163af7be902829bbaccd2076e4ff0f9bb34 | tools/plot_excit_dist.py | tools/plot_excit_dist.py | #!/usr/bin/env python
'''Plot excitation distribution from dmqmc output.'''
import os
import sys
import matplotlib.pyplot as pl
import argparse
try:
import pyhande as ph
except ImportError:
_script_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(_script_dir, '../pyhande'))
... | Add script to plot excitation distribution from output. | Add script to plot excitation distribution from output.
I think this is useful enough to warrant a script in the repo.
| Python | lgpl-2.1 | hande-qmc/hande,hande-qmc/hande,ruthfranklin/hande,hande-qmc/hande,hande-qmc/hande,hande-qmc/hande | ---
+++
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+'''Plot excitation distribution from dmqmc output.'''
+
+import os
+import sys
+import matplotlib.pyplot as pl
+import argparse
+try:
+ import pyhande as ph
+except ImportError:
+ _script_dir = os.path.dirname(os.path.abspath(__file__))
+ sys.path.append(os.pa... | |
6967884fa4df44a0a7fb3b81986dc2d4dc2818b3 | hera_mc/tests/test_default_db_schema.py | hera_mc/tests/test_default_db_schema.py | # -*- mode: python; coding: utf-8 -*-
# Copyright 2016 the HERA Collaboration
# Licensed under the 2-clause BSD license.
"""
Test that default database matches code schema.
"""
from sqlalchemy.orm import sessionmaker
from hera_mc import mc, MCDeclarativeBase
from hera_mc.db_check import is_sane_database
def test_def... | Add test for default_db schema | Add test for default_db schema
| Python | bsd-2-clause | HERA-Team/hera_mc,HERA-Team/Monitor_and_Control,HERA-Team/hera_mc | ---
+++
@@ -0,0 +1,23 @@
+# -*- mode: python; coding: utf-8 -*-
+# Copyright 2016 the HERA Collaboration
+# Licensed under the 2-clause BSD license.
+
+"""
+Test that default database matches code schema.
+"""
+from sqlalchemy.orm import sessionmaker
+from hera_mc import mc, MCDeclarativeBase
+from hera_mc.db_check i... | |
85cf22ff02a7c4af576d6553ae721d174364e357 | opps/core/admin/channel.py | opps/core/admin/channel.py | # -*- coding: utf-8 -*-
from datetime import datetime
from django.contrib import admin
from opps.core.models import Channel
class ChannelAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("name",)}
admin.site.register(Channel, ChannelAdmin)
| Add basic core admin on Channel | Add basic core admin on Channel
| Python | mit | williamroot/opps,williamroot/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,opps/opps,YACOWS/opps,YACOWS/opps,jeanmask/opps,opps/opps,williamroot/opps,opps/opps,jeanmask/opps,opps/opps,jeanmask/opps,jeanmask/opps | ---
+++
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+from datetime import datetime
+from django.contrib import admin
+
+from opps.core.models import Channel
+
+class ChannelAdmin(admin.ModelAdmin):
+
+ prepopulated_fields = {"slug": ("name",)}
+
+
+admin.site.register(Channel, ChannelAdmin) | |
d89a95534e3cd3c847a1adc504bc23e271b2ecbe | ndtable/datashape/tests/test_records.py | ndtable/datashape/tests/test_records.py | from ndtable import RecordDecl
from ndtable import float32, int32
from numpy import dtype
class Simple(RecordDecl):
foo = int32
bar = float32
__dummy = True
def test_to_numpy():
converted = Simple.to_numpy()
assert converted == dtype([('foo', '<i4'), ('bar', '<f4')])
| Test for record dshape <-> dtype conversions. | Test for record dshape <-> dtype conversions.
| Python | bsd-2-clause | seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core | ---
+++
@@ -0,0 +1,13 @@
+from ndtable import RecordDecl
+from ndtable import float32, int32
+from numpy import dtype
+
+class Simple(RecordDecl):
+ foo = int32
+ bar = float32
+
+ __dummy = True
+
+def test_to_numpy():
+ converted = Simple.to_numpy()
+ assert converted == dtype([('foo', '<i4'), ('bar'... | |
5ed02c90e85de86b54f423ed89cc0c8285944046 | hfetch/tests/python/tryKeyError.py | hfetch/tests/python/tryKeyError.py | from hfetch import *
import time
contact_names = ['127.0.0.1']
nodePort = 9042
keyspace = 'test'
table = 'particle'
token_ranges = [(8070430489100699999,8070450532247928832)]
num_keys = 10001
non_existent_keys = 10
cache_size = num_keys+non_existent_keys
try:
connectCassandra(contact_names,nodePort)
except Ex... | Test to verify behaviour when key not found | Test to verify behaviour when key not found
| Python | apache-2.0 | bsc-dd/hecuba,bsc-dd/hecuba,bsc-dd/hecuba,bsc-dd/hecuba | ---
+++
@@ -0,0 +1,52 @@
+from hfetch import *
+import time
+
+
+contact_names = ['127.0.0.1']
+nodePort = 9042
+keyspace = 'test'
+table = 'particle'
+
+token_ranges = [(8070430489100699999,8070450532247928832)]
+
+num_keys = 10001
+non_existent_keys = 10
+
+cache_size = num_keys+non_existent_keys
+
+try:
+ conne... | |
4aaad60df38a2fd73caacca7b47fe91276760b53 | sniffer/sniffer.py | sniffer/sniffer.py | import threading
from time import sleep
class Sniffer(threading.Thread):
def __init__(self, arg):
# Set thread to run as daemon
self.daemon = True
# Initialize object variables with parameters from arg dictionary
self.arg = arg
# Thread has not come to life yet
se... | Add Sniffer thread class sketch | Add Sniffer thread class sketch
| Python | mit | dimkarakostas/rupture,dimriou/rupture,dionyziz/rupture,dimkarakostas/rupture,dimkarakostas/rupture,dionyziz/rupture,dionyziz/rupture,dimkarakostas/rupture,esarafianou/rupture,dimriou/rupture,dimriou/rupture,esarafianou/rupture,dionyziz/rupture,dimriou/rupture,dionyziz/rupture,dimkarakostas/rupture,esarafianou/rupture,e... | ---
+++
@@ -0,0 +1,28 @@
+import threading
+from time import sleep
+
+
+class Sniffer(threading.Thread):
+ def __init__(self, arg):
+ # Set thread to run as daemon
+ self.daemon = True
+
+ # Initialize object variables with parameters from arg dictionary
+ self.arg = arg
+
+ # Th... | |
04f336f400445b10f54a75110a733c582606d933 | tests/test_validators.py | tests/test_validators.py | """
test_validators
~~~~~~~~~~~~~~
Unittests for bundled validators.
:copyright: 2007-2008 by James Crasta, Thomas Johansson.
:license: MIT, see LICENSE.txt for details.
"""
from py.test import raises
from wtforms.validators import ValidationError, length, url, not_empty, email, ip_addres... | Add first basic unittests using py.test | Add first basic unittests using py.test
| Python | bsd-3-clause | mobyle2-legacy/WTForms,mobyle2-legacy/WTForms | ---
+++
@@ -0,0 +1,60 @@
+"""
+ test_validators
+ ~~~~~~~~~~~~~~
+
+ Unittests for bundled validators.
+
+ :copyright: 2007-2008 by James Crasta, Thomas Johansson.
+ :license: MIT, see LICENSE.txt for details.
+"""
+
+from py.test import raises
+from wtforms.validators import ValidationError, l... | |
b0e629cf2451bf2f97d4723ccbdad85889057011 | EAN/ean_check.py | EAN/ean_check.py | #!environment python
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gen... | Add ean check free code | Add ean check free code
| Python | agpl-3.0 | Micronaet/micronaet-script,Micronaet/micronaet-script | ---
+++
@@ -0,0 +1,59 @@
+#!environment python
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it un... | |
e4b99f34c316a36d1fa7adb5ca0cc9c68804708f | scripts/netrng-perftest.py | scripts/netrng-perftest.py | #!/bin/python
import logging
from netrng import NetRNGServer
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
mainHandler = logging.StreamHandler()
mainHandler.setFormatter(logging.Formatter('%(asctime)s - %(message)s'))
log.addHandler(mainHandler)
server = NetRNGServer()
server.calibrate()
| Add HWRNG performance test script | Add HWRNG performance test script
| Python | mit | infincia/NetRNG | ---
+++
@@ -0,0 +1,15 @@
+#!/bin/python
+
+import logging
+from netrng import NetRNGServer
+
+
+log = logging.getLogger(__name__)
+log.setLevel(logging.DEBUG)
+mainHandler = logging.StreamHandler()
+mainHandler.setFormatter(logging.Formatter('%(asctime)s - %(message)s'))
+log.addHandler(mainHandler)
+
+
+server = Net... | |
b06803118b6ec9b7cb3d5b262e4d09d0492cc588 | tests/testcoverage.py | tests/testcoverage.py | from glyphsets.codepoints import CodepointsInSubset
from fontTools.unicodedata.Scripts import NAMES
import pytest
import unicodedata
from collections import defaultdict
import warnings
import sys
try:
import gflanguages
except Exception as e:
pytest.skip(
"Coverage test requires gflanguages to be insta... | Add a coverage test using the sample text files in gflanguages | Add a coverage test using the sample text files in gflanguages
| Python | apache-2.0 | googlefonts/glyphsets,googlefonts/glyphsets | ---
+++
@@ -0,0 +1,63 @@
+from glyphsets.codepoints import CodepointsInSubset
+from fontTools.unicodedata.Scripts import NAMES
+import pytest
+import unicodedata
+from collections import defaultdict
+import warnings
+import sys
+
+try:
+ import gflanguages
+except Exception as e:
+ pytest.skip(
+ "Covera... | |
d0ddbbec91f37c1e2a5c5e429c3586c57c584f8f | dp/fibonacci_number/fibonacci_number_dp.py | dp/fibonacci_number/fibonacci_number_dp.py | # computes the n_th number of the fibonacci sequence
# with the help of dynamic programming to avoid recursive recomputations
def dyn_fib(n, memo):
if n < 1:
return 0
if n == 1:
return 1
if n in memo:
return memo[n]
memo[n] = dyn_fib(n-1, memo) + dyn_fib(n-2, memo)
return mem... | Add fibonacci nth num computation w/ DP in python | Add fibonacci nth num computation w/ DP in python
| Python | cc0-1.0 | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | ---
+++
@@ -0,0 +1,18 @@
+# computes the n_th number of the fibonacci sequence
+# with the help of dynamic programming to avoid recursive recomputations
+def dyn_fib(n, memo):
+ if n < 1:
+ return 0
+ if n == 1:
+ return 1
+ if n in memo:
+ return memo[n]
+ memo[n] = dyn_fib(n-1, memo... | |
a03a639ccef6d837a05e22489fe324572b303cd4 | zephyr/management/commands/colorize_streams.py | zephyr/management/commands/colorize_streams.py | from optparse import make_option
from django.core.management.base import BaseCommand
from django.db.models import Count
from zephyr.models import Realm, StreamColor, Stream, UserProfile, Subscription, \
Message, Recipient
class Command(BaseCommand):
help = """Colorize streams in a realm for people who have no... | Add a management script to set stream colors for a domain. | Add a management script to set stream colors for a domain.
(imported from commit 186e8226b57d385bbbed756615c0c63315c9d463)
| Python | apache-2.0 | Gabriel0402/zulip,fw1121/zulip,punchagan/zulip,easyfmxu/zulip,brainwane/zulip,zofuthan/zulip,PaulPetring/zulip,swinghu/zulip,jonesgithub/zulip,shubhamdhama/zulip,susansls/zulip,yuvipanda/zulip,wangdeshui/zulip,lfranchi/zulip,DazWorrall/zulip,he15his/zulip,atomic-labs/zulip,atomic-labs/zulip,hayderimran7/zulip,eeshangar... | ---
+++
@@ -0,0 +1,62 @@
+from optparse import make_option
+
+from django.core.management.base import BaseCommand
+from django.db.models import Count
+from zephyr.models import Realm, StreamColor, Stream, UserProfile, Subscription, \
+ Message, Recipient
+
+class Command(BaseCommand):
+ help = """Colorize strea... | |
3452d21aa9e7e427296c05e38a9caf70a62c7bb6 | server/localfinance/scripts/addincome.py | server/localfinance/scripts/addincome.py | # -*- coding: utf-8 -*-
import os
import sys
import transaction
import pandas as pd
from sqlalchemy import engine_from_config
from pyramid.paster import (
get_appsettings,
setup_logging,
)
from ..models import (
DBSession,
AdminZone,
AdminZoneFinance,
)
def usage(argv):
cmd = os.pa... | Add script to import income data | Add script to import income data
| Python | mit | regardscitoyens/nosfinanceslocales,regardscitoyens/nosfinanceslocales,regardscitoyens/nosfinanceslocales | ---
+++
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+
+import os
+import sys
+import transaction
+
+import pandas as pd
+
+from sqlalchemy import engine_from_config
+
+from pyramid.paster import (
+ get_appsettings,
+ setup_logging,
+ )
+
+from ..models import (
+ DBSession,
+ AdminZone,
+ AdminZoneFi... | |
2ef9c50edb9e7d6488ec2b580c552f4c66fe5209 | tensorflow/tools/ci_build/builds/check_system_libs.py | tensorflow/tools/ci_build/builds/check_system_libs.py | #!/usr/bin/env python
# Checks that the options mentioned in syslibs_configure.bzl are consistent with the valid options in workspace.bzl
# Expects the tensorflow source folder as the first argument
import sys
import os
from glob import glob
tf_source_path = sys.argv[1]
if not os.path.isdir(tf_source_path):
raise... | Add script to validate system libs | Add script to validate system libs
| Python | apache-2.0 | karllessard/tensorflow,karllessard/tensorflow,frreiss/tensorflow-fred,Intel-Corporation/tensorflow,tensorflow/tensorflow,paolodedios/tensorflow,frreiss/tensorflow-fred,petewarden/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-tensorflow/tensorflow,annarev/tensorflow,gautam1858/tensor... | ---
+++
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+
+# Checks that the options mentioned in syslibs_configure.bzl are consistent with the valid options in workspace.bzl
+# Expects the tensorflow source folder as the first argument
+
+import sys
+import os
+from glob import glob
+
+tf_source_path = sys.argv[1]
+
+if not... | |
c0d7fe0548bb8b00fd612e494ee8eb38a24f927d | tests/parser_db.py | tests/parser_db.py | from compiler import error, parse
class ParserDB():
"""A class for parsing with memoized parsers."""
parsers = {}
@classmethod
def _parse(cls, data, start='program'):
mock = error.LoggerMock()
try:
parser = cls.parsers[start]
except KeyError:
parser =... | Add class to abstract parser memoization. | Tests: Add class to abstract parser memoization.
| Python | mit | Renelvon/llama,dionyziz/llama,Renelvon/llama,dionyziz/llama | ---
+++
@@ -0,0 +1,23 @@
+from compiler import error, parse
+
+
+class ParserDB():
+ """A class for parsing with memoized parsers."""
+
+ parsers = {}
+
+ @classmethod
+ def _parse(cls, data, start='program'):
+ mock = error.LoggerMock()
+
+ try:
+ parser = cls.parsers[start]
+ ... | |
670f08e73404c219df707a7a90b3c7b658086d1e | scripts/update_user_location.py | scripts/update_user_location.py | from google.cloud import firestore
import argparse
import datetime
import helpers
import random
def updateLocation(db, user, ref_lat, ref_lon, range):
doc_ref = db.collection(u'users').document(user.id)
lat = ref_lat + random.uniform(-range, range)
lon = ref_lon + random.uniform(-range, range)
doc_ref.update(... | Add script to update user location | Add script to update user location
| Python | mit | frinder/frinder-app,frinder/frinder-app,frinder/frinder-app | ---
+++
@@ -0,0 +1,38 @@
+from google.cloud import firestore
+import argparse
+import datetime
+import helpers
+import random
+
+
+def updateLocation(db, user, ref_lat, ref_lon, range):
+ doc_ref = db.collection(u'users').document(user.id)
+ lat = ref_lat + random.uniform(-range, range)
+ lon = ref_lon + random.un... | |
788700899de2b6576af6b7230b2d68e6dff278a5 | numba/tests/test_func_lifetime.py | numba/tests/test_func_lifetime.py |
from __future__ import print_function, absolute_import
import gc
import weakref
from numba import unittest_support as unittest
from numba.utils import IS_PY3
from numba import jit, types
from .support import TestCase
def global_func(x):
return x + 1
class TestFuncLifetime(TestCase):
"""
Test the life... | Add a simple test for function lifetime | Add a simple test for function lifetime
| Python | bsd-2-clause | cpcloud/numba,gmarkall/numba,stuartarchibald/numba,pitrou/numba,gmarkall/numba,pombredanne/numba,IntelLabs/numba,IntelLabs/numba,stuartarchibald/numba,gdementen/numba,ssarangi/numba,GaZ3ll3/numba,IntelLabs/numba,jriehl/numba,GaZ3ll3/numba,GaZ3ll3/numba,numba/numba,sklam/numba,gmarkall/numba,ssarangi/numba,stonebig/numb... | ---
+++
@@ -0,0 +1,58 @@
+
+from __future__ import print_function, absolute_import
+
+import gc
+import weakref
+
+from numba import unittest_support as unittest
+from numba.utils import IS_PY3
+from numba import jit, types
+from .support import TestCase
+
+
+def global_func(x):
+ return x + 1
+
+
+class TestFuncL... | |
48c7e914357199759321250341f54fa2d06c7c45 | support/patchapply.py | support/patchapply.py | #!/usr/bin/env python
##
# Copyright (c) 2005-2006 Apple Computer, Inc. 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
#
... | Patch applier. This is useful when you need to revert or switch a branch on a dependent project and need to re-apply patches without going through the ./run script's full update/patch cycle for all projects. | Patch applier. This is useful when you need to revert or switch a branch on a dependent project and need to re-apply
patches without going through the ./run script's full update/patch cycle for all projects.
git-svn-id: 81e381228600e5752b80483efd2b45b26c451ea2@513 e27351fd-9f3e-4f54-a53b-843176b1656c
| Python | apache-2.0 | trevor/calendarserver,trevor/calendarserver,trevor/calendarserver | ---
+++
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+
+##
+# Copyright (c) 2005-2006 Apple Computer, Inc. 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://w... | |
9bcd3e71f86d4a3b74c57276e65420cc8dc01fa1 | test/test_decorate.py | test/test_decorate.py |
import py.test
from tiddlyweb.model.policy import UserRequiredError
from tiddlywebplugins.utils import (entitle, do_html, require_role,
require_any_user)
STATUS = ''
HEADERS = []
def start_responser(status, headers, exc_info=None):
global STATUS
global HEADERS
STATUS = status
HEADERS = head... | Add a test file which tests the various decorator functions. | Add a test file which tests the various decorator functions.
| Python | bsd-3-clause | tiddlyweb/tiddlywebplugins.utils | ---
+++
@@ -0,0 +1,92 @@
+
+import py.test
+
+from tiddlyweb.model.policy import UserRequiredError
+from tiddlywebplugins.utils import (entitle, do_html, require_role,
+ require_any_user)
+
+STATUS = ''
+HEADERS = []
+
+def start_responser(status, headers, exc_info=None):
+ global STATUS
+ global HEADER... | |
2b7954302c5238bfde09ff8aed655263d3b238bb | maxwellbloch/mb_solve.py | maxwellbloch/mb_solve.py | # -*- coding: utf-8 -*-
import sys
from numpy import linspace, insert
from maxwellbloch import ob_solve
class MBSolve(ob_solve.OBSolve):
def __init__(self, ob_atom={}, t_min=0.0, t_max=1.0, t_steps=100,
method='mesolve', opts={}, savefile=None, z_min=0.0,
z_max=1.0, z_steps=... | Make MBSolve inherit from OBSolve | Make MBSolve inherit from OBSolve
| Python | mit | tommyogden/maxwellbloch,tommyogden/maxwellbloch | ---
+++
@@ -0,0 +1,86 @@
+# -*- coding: utf-8 -*-
+
+import sys
+
+from numpy import linspace, insert
+
+from maxwellbloch import ob_solve
+
+class MBSolve(ob_solve.OBSolve):
+
+ def __init__(self, ob_atom={}, t_min=0.0, t_max=1.0, t_steps=100,
+ method='mesolve', opts={}, savefile=None, z_min=0.0... | |
72e7fc3d7fe284ea7a8b47606708a35992576fdc | pdsspect/pds_image_view_canvas.py | pdsspect/pds_image_view_canvas.py | from ginga.qtw.ImageViewCanvasQt import ImageViewCanvas
class PDSImageViewCanvas(ImageViewCanvas):
def __init__(self):
super(PDSImageViewCanvas, self).__init__(render='widget')
self._subviews = []
self.set_autocut_params('zscale')
self.enable_autozoom('override')
self.enab... | Create subclass of ImageViewCanvas for pdsspect | Create subclass of ImageViewCanvas for pdsspect
| Python | bsd-3-clause | planetarypy/pdsspect | ---
+++
@@ -0,0 +1,26 @@
+from ginga.qtw.ImageViewCanvasQt import ImageViewCanvas
+
+
+class PDSImageViewCanvas(ImageViewCanvas):
+
+ def __init__(self):
+ super(PDSImageViewCanvas, self).__init__(render='widget')
+ self._subviews = []
+ self.set_autocut_params('zscale')
+ self.enable_a... | |
b91009404f0ad4b5450259a70cfa480cc1d8e6f5 | powerline/ext/terminal/segments.py | powerline/ext/terminal/segments.py | # -*- coding: utf-8 -*-
import os
import re
import socket
from powerline.lib.vcs import guess
def hostname():
if not os.environ.get('SSH_CLIENT'):
return None
return socket.gethostname()
def user():
user = os.environ.get('USER')
euid = os.geteuid()
return {
'contents': user,
'highlight': 'user' if euid... | # -*- coding: utf-8 -*-
import os
import re
import socket
from powerline.lib.vcs import guess
def hostname():
if not os.environ.get('SSH_CLIENT'):
return None
return socket.gethostname()
def user():
user = os.environ.get('USER')
euid = os.geteuid()
return {
'contents': user,
'highlight': 'user' if euid... | Use midline ellipsis for dir shortening | Use midline ellipsis for dir shortening
| Python | mit | junix/powerline,QuLogic/powerline,EricSB/powerline,areteix/powerline,russellb/powerline,xfumihiro/powerline,cyrixhero/powerline,S0lll0s/powerline,keelerm84/powerline,firebitsbr/powerline,IvanAli/powerline,xfumihiro/powerline,blindFS/powerline,Liangjianghao/powerline,s0undt3ch/powerline,xxxhycl2010/powerline,S0lll0s/pow... | ---
+++
@@ -38,7 +38,7 @@
cwd_split_len = len(cwd_split)
if cwd_split_len > dir_limit_depth + 1:
del(cwd_split[0:-dir_limit_depth])
- cwd_split.insert(0, u'…')
+ cwd_split.insert(0, u'⋯')
cwd = [i[0:dir_shorten_len] if dir_shorten_len and i else i for i in cwd_split[:-1]] + [cwd_split[-1]]
cwd = os.path.... |
ebb5a2f56c691456b5b65b9448d11b113c4efa46 | fedmsg/meta/announce.py | fedmsg/meta/announce.py | # This file is part of fedmsg.
# Copyright (C) 2012 Red Hat, Inc.
#
# fedmsg is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#... | # This file is part of fedmsg.
# Copyright (C) 2012 Red Hat, Inc.
#
# fedmsg is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#... | Handle the situation where in old message the 'username' key does not exists | Handle the situation where in old message the 'username' key does not exists
With this commit processing an old message with fedmsg_meta will not break
if that old message does not have the 'username' key.
| Python | lgpl-2.1 | chaiku/fedmsg,vivekanand1101/fedmsg,vivekanand1101/fedmsg,cicku/fedmsg,mathstuf/fedmsg,mathstuf/fedmsg,maxamillion/fedmsg,mathstuf/fedmsg,chaiku/fedmsg,fedora-infra/fedmsg,fedora-infra/fedmsg,pombredanne/fedmsg,pombredanne/fedmsg,cicku/fedmsg,maxamillion/fedmsg,chaiku/fedmsg,vivekanand1101/fedmsg,pombredanne/fedmsg,cic... | ---
+++
@@ -34,4 +34,7 @@
return msg['msg']['link']
def usernames(self, msg, **config):
- return set([msg['username']])
+ users = set()
+ if 'username' in msg:
+ users.update(set([msg['username']]))
+ return users |
23aac06f1b06ee3839023152f1f6fd420be1c13a | VehicleDetectionTracking/template_match.py | VehicleDetectionTracking/template_match.py | # Code given by Udacity, complete by Andres Guijarro
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
image = mpimg.imread('bbox-example-image.jpg')
#image = mpimg.imread('temp-matching-example-2.jpg')
templist = ['cutout1.jpg']
#templist = ['cutout1.jpg', 'cutout2.jpg', ... | Add scripts which Define a function that takes an image and a list of templates as inputs then searches the image and returns the a list of bounding boxes for matched templates | feat: Add scripts which Define a function that takes an image and a list of templates as inputs then searches the image and returns the a list of bounding boxes for matched templates
| Python | mit | aguijarro/SelfDrivingCar | ---
+++
@@ -0,0 +1,65 @@
+# Code given by Udacity, complete by Andres Guijarro
+
+import numpy as np
+import cv2
+import matplotlib.pyplot as plt
+import matplotlib.image as mpimg
+
+image = mpimg.imread('bbox-example-image.jpg')
+#image = mpimg.imread('temp-matching-example-2.jpg')
+templist = ['cutout1.jpg']
+#temp... | |
10b407b632b2aad1c8fc85e8f242ee4139b5b2a1 | test/integration/generate_partitions.py | test/integration/generate_partitions.py | import sys
import random
if len(sys.argv) != 3:
print >> sys.stderr, "USAGE: python generate_partitions.py nodes partitions_per_node"
sys.exit()
FORMAT_WIDTH = 10
nodes = int(sys.argv[1])
partitions = int(sys.argv[2])
ids = range(nodes * partitions)
# use known seed so this is repeatable
random.seed(928734... | Add script to generate partition ids. | Add script to generate partition ids.
| Python | apache-2.0 | nassim-git/project-voldemort,nassim-git/project-voldemort,nassim-git/project-voldemort,nassim-git/project-voldemort | ---
+++
@@ -0,0 +1,32 @@
+import sys
+import random
+
+if len(sys.argv) != 3:
+ print >> sys.stderr, "USAGE: python generate_partitions.py nodes partitions_per_node"
+ sys.exit()
+
+FORMAT_WIDTH = 10
+
+nodes = int(sys.argv[1])
+partitions = int(sys.argv[2])
+
+ids = range(nodes * partitions)
+
+# use known see... | |
5578122c42c328d41ac258b4b411eb67125ad2f0 | benchexec/tools/ulcseq.py | benchexec/tools/ulcseq.py | #!/usr/bin/env python
"""
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
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... | Add wrapper script for UL-CSeq tool | Add wrapper script for UL-CSeq tool
| Python | apache-2.0 | ultimate-pa/benchexec,martin-neuhaeusser/benchexec,ultimate-pa/benchexec,martin-neuhaeusser/benchexec,martin-neuhaeusser/benchexec,IljaZakharov/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,martin-neuhaeusser/benchexec,IljaZakharov/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,IljaZakharov/be... | ---
+++
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+"""
+BenchExec is a framework for reliable benchmarking.
+This file is part of BenchExec.
+Copyright (C) 2007-2015 Dirk Beyer
+All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with th... | |
f37798800c82a483faab875f7c1081bb8ffab84a | corehq/apps/hqcase/management/commands/delete_cases.py | corehq/apps/hqcase/management/commands/delete_cases.py | from optparse import make_option
from django.core.management.base import NoArgsCommand, BaseCommand
from couchdbkit import ResourceNotFound
from casexml.apps.case.models import CommCareCase
from dimagi.utils.decorators.memoized import memoized
from dimagi.utils.couch.database import iter_bulk_delete
from corehq.apps.us... | Add mngmnt command to delete all cases for a user | Add mngmnt command to delete all cases for a user
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq | ---
+++
@@ -0,0 +1,74 @@
+from optparse import make_option
+from django.core.management.base import NoArgsCommand, BaseCommand
+from couchdbkit import ResourceNotFound
+from casexml.apps.case.models import CommCareCase
+from dimagi.utils.decorators.memoized import memoized
+from dimagi.utils.couch.database import ite... | |
9d981457a8d6d1bf785eea65b1217d0d521ece72 | ir/importer.py | ir/importer.py | from urllib.request import urlopen
from anki.notes import Note
from aqt import mw
from bs4 import BeautifulSoup
from ir.util import getInput, setField
class Importer:
def importWebpage(self):
model = mw.col.models.byName(self.settings['modelName'])
newNote = Note(mw.col, model)
... | Move importing code into dedicated class | Move importing code into dedicated class
| Python | isc | luoliyan/incremental-reading-for-anki,luoliyan/incremental-reading-for-anki | ---
+++
@@ -0,0 +1,27 @@
+from urllib.request import urlopen
+
+from anki.notes import Note
+from aqt import mw
+
+from bs4 import BeautifulSoup
+
+from ir.util import getInput, setField
+
+
+class Importer:
+ def importWebpage(self):
+ model = mw.col.models.byName(self.settings['modelName'])
+ newNo... | |
0a5cbbe8e59e867843e2ee39d3972051c53fbc88 | bmi_tester/tests/utils.py | bmi_tester/tests/utils.py | import os
import tempfile
import shutil
from scripting.contexts import cd
from . import Bmi, INPUT_FILE
def setup_func():
# globals().update(bmi=Bmi())
# bmi.initialize(INPUT_FILE)
starting_dir = os.path.abspath(os.getcwd())
tmp_dir = os.path.abspath(tempfile.mkdtemp())
os.chdir(tmp_dir)
wi... | Add utilities for testing bmi. | Add utilities for testing bmi.
| Python | mit | csdms/bmi-tester | ---
+++
@@ -0,0 +1,55 @@
+import os
+import tempfile
+import shutil
+
+from scripting.contexts import cd
+
+from . import Bmi, INPUT_FILE
+
+
+def setup_func():
+ # globals().update(bmi=Bmi())
+ # bmi.initialize(INPUT_FILE)
+
+ starting_dir = os.path.abspath(os.getcwd())
+ tmp_dir = os.path.abspath(tempfi... | |
99be8919a0bc274dc311ebe3201dfc490a1d0d07 | setup.py | setup.py | import os
from distutils.core import setup, find_packages
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open(os.p... | import os
from distutils.core import setup
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open(os.path.join(os.pat... | Remove find_packages import, it's not in distutils | Remove find_packages import, it's not in distutils
| Python | bsd-2-clause | blaze/datashape,cowlicks/datashape,ContinuumIO/datashape,cpcloud/datashape,aterrel/datashape,quantopian/datashape,FrancescAlted/datashape,quantopian/datashape,aterrel/datashape,cowlicks/datashape,markflorisson/datashape,ContinuumIO/datashape,cpcloud/datashape,blaze/datashape,llllllllll/datashape,markflorisson/datashape... | ---
+++
@@ -1,5 +1,5 @@
import os
-from distutils.core import setup, find_packages
+from distutils.core import setup
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
@@ -17,7 +17,7 @@
license = "BSD",
keywords = "data language",... |
429d671502e44268b57fc4846ecefa15f8bf5a62 | tests/cupy_tests/cuda_tests/test_profile.py | tests/cupy_tests/cuda_tests/test_profile.py | import unittest
import mock
from cupy import cuda
class TestProfile(unittest.TestCase):
def test_profile(self):
start_patch = mock.patch('cupy.cuda.profiler.start')
stop_patch = mock.patch('cupy.cuda.profiler.stop')
with start_patch as start, stop_patch as stop:
with cuda.pr... | Write test case for profiler | Write test case for profiler
| Python | mit | ktnyt/chainer,wkentaro/chainer,pfnet/chainer,jnishi/chainer,delta2323/chainer,rezoo/chainer,cupy/cupy,chainer/chainer,jnishi/chainer,kashif/chainer,keisuke-umezawa/chainer,kiyukuta/chainer,niboshi/chainer,cupy/cupy,hvy/chainer,jnishi/chainer,anaruse/chainer,keisuke-umezawa/chainer,cupy/cupy,benob/chainer,hvy/chainer,ys... | ---
+++
@@ -0,0 +1,17 @@
+import unittest
+
+import mock
+
+from cupy import cuda
+
+
+class TestProfile(unittest.TestCase):
+
+ def test_profile(self):
+ start_patch = mock.patch('cupy.cuda.profiler.start')
+ stop_patch = mock.patch('cupy.cuda.profiler.stop')
+ with start_patch as start, stop... | |
6ea2029fd85a90b256144dee7524fa7885a009bd | pdc/apps/package/migrations/0011_auto_20160219_0915.py | pdc/apps/package/migrations/0011_auto_20160219_0915.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def add_new_image_type_and_format(apps, schema_editor):
formats = [
'tar.gz',
'tar.xz'
]
ImageFormat = apps.get_model('package', 'ImageFormat')
for format in formats:
Image... | Add 2 image formats and 1 image type. | Add 2 image formats and 1 image type.
Add 2 image formats 'tar.gz' and 'tar.xz'.
Add 1 image type 'docker'.
JIRA: PDC-1341
| Python | mit | product-definition-center/product-definition-center,release-engineering/product-definition-center,pombredanne/product-definition-center,release-engineering/product-definition-center,product-definition-center/product-definition-center,product-definition-center/product-definition-center,pombredanne/product-definition-cen... | ---
+++
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+def add_new_image_type_and_format(apps, schema_editor):
+ formats = [
+ 'tar.gz',
+ 'tar.xz'
+ ]
+ ImageFormat = apps.get_model('package', 'ImageFormat')
+... | |
af8641f1ae8e03508c66954774ac0eac41bf1de8 | soja_find.py | soja_find.py | import fnmatch
import os
def find_files(path, types):
"""
Find files from path with types
:param path: Where you will find.
:param types: Which types you will find.
:return: files
"""
matches = []
for root, dirnames, filenames in os.walk(path):
for extensions in types:
... | Add soja find, a easy find files tools. | Add soja find, a easy find files tools.
| Python | mit | iTaa/soja_box | ---
+++
@@ -0,0 +1,21 @@
+import fnmatch
+import os
+
+
+def find_files(path, types):
+ """
+ Find files from path with types
+ :param path: Where you will find.
+ :param types: Which types you will find.
+ :return: files
+ """
+ matches = []
+ for root, dirnames, filenames in os.walk(path):
+... | |
80e43fe71922137dd9760cebc8e15dd82cfb04b6 | tests/providers/test_godaddy.py | tests/providers/test_godaddy.py | # Test for one implementation of the interface
from unittest import TestCase
from lexicon.providers.godaddy import Provider
from integration_tests import IntegrationTests
import pytest
# Hook into testing framework by inheriting unittest.TestCase and reuse
# the tests which *each and every* implementation of the inte... | Configure integration tests for GoDaddy provider | Configure integration tests for GoDaddy provider
| Python | mit | AnalogJ/lexicon,tnwhitwell/lexicon,tnwhitwell/lexicon,AnalogJ/lexicon | ---
+++
@@ -0,0 +1,39 @@
+# Test for one implementation of the interface
+from unittest import TestCase
+from lexicon.providers.godaddy import Provider
+from integration_tests import IntegrationTests
+
+import pytest
+
+# Hook into testing framework by inheriting unittest.TestCase and reuse
+# the tests which *each a... | |
07fdaf648ac290438c91413a69fc77235bf691de | py/predict-the-winner.py | py/predict-the-winner.py | class Solution(object):
def PredictTheWinner(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
dp = dict()
def top_down(start, end):
if start == end:
dp[start, end] = 0
elif (start, end) not in dp:
dp[start... | Add py solution for 486. Predict the Winner | Add py solution for 486. Predict the Winner
486. Predict the Winner: https://leetcode.com/problems/predict-the-winner/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,15 @@
+class Solution(object):
+ def PredictTheWinner(self, nums):
+ """
+ :type nums: List[int]
+ :rtype: bool
+ """
+ dp = dict()
+ def top_down(start, end):
+ if start == end:
+ dp[start, end] = 0
+ elif (start, en... | |
5a431f7b0cc9eba3f8a68650aa41c3f1e31520c8 | s3stash/stash_single_mediajson.py | s3stash/stash_single_mediajson.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys, os
import argparse
import logging
import json
from s3stash.nxstash_mediajson import NuxeoStashMediaJson
def main(argv=None):
parser = argparse.ArgumentParser(
description='Create and stash media.json file fo... | Add script to create and single media.json file | Add script to create and single media.json file
| Python | bsd-3-clause | barbarahui/nuxeo-calisphere,barbarahui/nuxeo-calisphere | ---
+++
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+import sys, os
+import argparse
+import logging
+import json
+from s3stash.nxstash_mediajson import NuxeoStashMediaJson
+
+def main(argv=None):
+
+ parser = argparse.ArgumentParser(
+ descrip... | |
cc21429b99c8dc6a92487081dc8422b16abad85f | zerver/management/commands/dump_messages.py | zerver/management/commands/dump_messages.py | from optparse import make_option
from django.core.management.base import BaseCommand
from zerver.models import Message, Realm, Stream, Recipient
import datetime
import time
class Command(BaseCommand):
default_cutoff = time.time() - 60 * 60 * 24 * 30 # 30 days.
option_list = BaseCommand.option_list + (
... | Add a management command to dump all messages on public streams for a realm. | Add a management command to dump all messages on public streams for a realm.
(imported from commit f4f8bfece408b466af4db93b2da15cf69b68e0a3)
| Python | apache-2.0 | hengqujushi/zulip,stamhe/zulip,wweiradio/zulip,dattatreya303/zulip,ashwinirudrappa/zulip,ikasumiwt/zulip,DazWorrall/zulip,ipernet/zulip,hj3938/zulip,praveenaki/zulip,hackerkid/zulip,mahim97/zulip,so0k/zulip,zofuthan/zulip,babbage/zulip,saitodisse/zulip,joyhchen/zulip,jackrzhang/zulip,Suninus/zulip,dattatreya303/zulip,m... | ---
+++
@@ -0,0 +1,32 @@
+from optparse import make_option
+from django.core.management.base import BaseCommand
+from zerver.models import Message, Realm, Stream, Recipient
+
+import datetime
+import time
+
+class Command(BaseCommand):
+ default_cutoff = time.time() - 60 * 60 * 24 * 30 # 30 days.
+
+ option_lis... | |
15408424fc6c2e8a10a2739427cbdfd51867b49a | setup.py | setup.py | from setuptools import setup
import re
import upsidedown
VERSION = str(upsidedown.__version__)
(AUTHOR, EMAIL) = re.match('^(.*?)\s*<(.*)>$', upsidedown.__author__).groups()
URL = upsidedown.__url__
LICENSE = upsidedown.__license__
setup(name='upsidedown',
version=VERSION,
author=AUTHOR,
author_email=EMAI... | import re
import codecs
from setuptools import setup
import upsidedown
VERSION = str(upsidedown.__version__)
(AUTHOR, EMAIL) = re.match('^(.*?)\s*<(.*)>$', upsidedown.__author__).groups()
URL = upsidedown.__url__
LICENSE = upsidedown.__license__
with codecs.open('README', encoding='utf-8') as readme:
long_descr... | Use codecs to open the readme | Use codecs to open the readme
| Python | mit | jaraco/upsidedown,cburgmer/upsidedown | ---
+++
@@ -1,5 +1,7 @@
+import re
+import codecs
+
from setuptools import setup
-import re
import upsidedown
VERSION = str(upsidedown.__version__)
@@ -7,12 +9,16 @@
URL = upsidedown.__url__
LICENSE = upsidedown.__license__
+
+with codecs.open('README', encoding='utf-8') as readme:
+ long_description = re... |
afbaa30e4bf96be16ee8728c29abbbdcbe33d7b0 | contrib_bots/bots/helloworld/test_helloworld.py | contrib_bots/bots/helloworld/test_helloworld.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
our_dir = os.path.dirname(os.path.abspath(__file__))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..')
from bots... | Add tests for helloworld bot in contrib_bots. | testsuite: Add tests for helloworld bot in contrib_bots.
Add test file 'test_helloworld.py'.
| Python | apache-2.0 | jrowan/zulip,timabbott/zulip,shubhamdhama/zulip,jackrzhang/zulip,rishig/zulip,zulip/zulip,amanharitsh123/zulip,shubhamdhama/zulip,verma-varsha/zulip,punchagan/zulip,timabbott/zulip,vabs22/zulip,zulip/zulip,hackerkid/zulip,synicalsyntax/zulip,mahim97/zulip,mahim97/zulip,punchagan/zulip,zulip/zulip,jackrzhang/zulip,brain... | ---
+++
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+from __future__ import absolute_import
+from __future__ import print_function
+
+import os
+import sys
+
+our_dir = os.path.dirname(os.path.abspath(__file__))
+# For dev setups, we can find the API in the repo itself.
+if os.path.exists(os.path.join(our_dir, '..')):
... | |
e88b03898a1aef8bdb4a99e18e40cb20c8f77ba2 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='regulations-configs',
version='0.1.0',
description='CFPB-specific configuration for the eRegulations parser',
author='CFPB',
author_email='tech@cfpb.gov',
packages=find_packages(),
)
| Make it a Python package | Make it a Python package
| Python | cc0-1.0 | ascott1/regulations-configs,grapesmoker/regulations-configs,cfpb/regulations-configs,willbarton/regulations-configs | ---
+++
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+
+from setuptools import setup, find_packages
+
+setup(
+ name='regulations-configs',
+ version='0.1.0',
+ description='CFPB-specific configuration for the eRegulations parser',
+ author='CFPB',
+ author_email='tech@cfpb.gov',
+ packages=find_packages... | |
8a7e88f95d14c2d24f505113162543ebb45c9cbf | tests/write_cb_bogus_test.py | tests/write_cb_bogus_test.py | #! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
import os.path
import pycurl
import sys
import unittest
class WriteAbortTest(unittest.TestCase):
def setUp(self):
self.curl = pycurl.Curl()
def tearDown(self):
self.curl.close()
def write_cb_returning_string(self, data):
... | Check that bogus return values from write callback are correctly handled (still) | Check that bogus return values from write callback are correctly handled (still)
| Python | lgpl-2.1 | p/pycurl-archived,p/pycurl-archived,pycurl/pycurl,pycurl/pycurl,pycurl/pycurl,p/pycurl-archived | ---
+++
@@ -0,0 +1,44 @@
+#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
+# vi:ts=4:et
+
+import os.path
+import pycurl
+import sys
+import unittest
+
+class WriteAbortTest(unittest.TestCase):
+ def setUp(self):
+ self.curl = pycurl.Curl()
+
+ def tearDown(self):
+ self.curl.close()
+
+ d... | |
e2b44e953d959ef3281de7e90a10a5bc5900efca | setup.py | setup.py | #!/usr/bin/env python2.7
import glob, re, subprocess, sys
from distutils.core import setup
def run_setup():
try:
version = subprocess.check_output(['git', 'describe', '--tags'], stderr=open('/dev/null', 'w')).strip()
except:
print 'cannot determine version: no tags detected'
sys.exit(1... | Add basic package management support. | Add basic package management support.
| Python | mit | mk23/snmpy,mk23/snmpy | ---
+++
@@ -0,0 +1,25 @@
+#!/usr/bin/env python2.7
+
+import glob, re, subprocess, sys
+from distutils.core import setup
+
+def run_setup():
+ try:
+ version = subprocess.check_output(['git', 'describe', '--tags'], stderr=open('/dev/null', 'w')).strip()
+ except:
+ print 'cannot determine version:... | |
6f46fe06a4d4666cd518f5db5ae54924e317578f | sremailer.py | sremailer.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
import bottle
import stoneridge
@bottle.post('/email')
def email():
r = bottle.request
... | Add web form submit emailer | Add web form submit emailer
| Python | mpl-2.0 | mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge | ---
+++
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# This Source Code Form is subject to the terms of the Mozilla Public License,
+# v. 2.0. If a copy of the MPL was not distributed with this file, You can
+# obtain one at http://mozilla.org/MPL/2.0/.
+
+import bottle
+
+import stoneridge
+
+
+@bottle.post('/email')
+d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.