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 |
|---|---|---|---|---|---|---|---|---|---|---|
1a73bdd12bbe504e832d18959f588c2f71d02031 | lib_common/src/d1_common/typing.py | lib_common/src/d1_common/typing.py | # This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ma... | Add placeholder for adding type hinting using the new syntax in Python. | Add placeholder for adding type hinting using the new syntax in Python.
| Python | apache-2.0 | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | ---
+++
@@ -0,0 +1,30 @@
+# This work was created by participants in the DataONE project, and is
+# jointly copyrighted by participating institutions in DataONE. For
+# more information on DataONE, see our web site at http://dataone.org.
+#
+# Copyright 2009-2019 DataONE
+#
+# Licensed under the Apache License, Ver... | |
0525df595e2252f7165271b62cb52dd0d8eff651 | awx/main/tests/unit/notifications/test_rocketchat.py | awx/main/tests/unit/notifications/test_rocketchat.py | import mock
import pytest
from django.core.mail.message import EmailMessage
import awx.main.notifications.rocketchat_backend as rocketchat_backend
def test_send_messages():
with mock.patch('awx.main.notifications.rocketchat_backend.requests') as requests_mock:
backend = rocketchat_backend.RocketChatBacken... | Add unit test for rocket.chat notifications | Add unit test for rocket.chat notifications
Signed-off-by: Jeandre Le Roux <5c0729d9afb0a0db4c3e6949c77c15e4446fbca3@theblazehen.com>
| Python | apache-2.0 | wwitzel3/awx,wwitzel3/awx,wwitzel3/awx,wwitzel3/awx | ---
+++
@@ -0,0 +1,37 @@
+import mock
+import pytest
+from django.core.mail.message import EmailMessage
+
+import awx.main.notifications.rocketchat_backend as rocketchat_backend
+
+def test_send_messages():
+ with mock.patch('awx.main.notifications.rocketchat_backend.requests') as requests_mock:
+ backend =... | |
766cc675c52488e658a0884f0e0b5c8b044731b2 | lib/bridgedb/test/test_Storage.py | lib/bridgedb/test/test_Storage.py | #!/usr/bin/env python
"""Unittests for the :mod:`bridgedb.Storage` module."""
from twisted.python import log
from twisted.trial import unittest
import bridgedb.Storage as Storage
from twisted.internet import reactor
from twisted.internet.threads import deferToThread
import os
import threading
from time import sleep
c... | Add unit tests for bridgedb.Storage | Add unit tests for bridgedb.Storage
| Python | bsd-3-clause | mmaker/bridgedb,mmaker/bridgedb,pagea/bridgedb,pagea/bridgedb | ---
+++
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+"""Unittests for the :mod:`bridgedb.Storage` module."""
+
+from twisted.python import log
+from twisted.trial import unittest
+import bridgedb.Storage as Storage
+from twisted.internet import reactor
+from twisted.internet.threads import deferToThread
+import os
+impor... | |
84b31bb02746dec1667cc93a189c6e1c40ffac28 | studygroups/migrations/0015_auto_20150430_0126.py | studygroups/migrations/0015_auto_20150430_0126.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('studygroups', '0014_application_accepted_at'),
]
operations = [
migrations.AlterUniqueTogether(
name='studygroup... | Remove unique requirement for study group applications | Remove unique requirement for study group applications
| Python | mit | p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('studygroups', '0014_application_accepted_at'),
+ ]
+
+ operations = [
+ migrations.AlterUni... | |
183faa3b13d933a201f909465f8fcd432d616e04 | tests/basics/class_inherit_mul.py | tests/basics/class_inherit_mul.py | class A:
def __init__(self, x):
print('A init', x)
self.x = x
def f(self):
print(self.x)
def f2(self):
print(self.x)
class B:
def __init__(self, x):
print('B init', x)
self.x = x
def f(self):
print(self.x)
def f3(self):
print(s... | Add testcase for multiple inheritance. | tests: Add testcase for multiple inheritance.
| Python | mit | martinribelotta/micropython,vitiral/micropython,micropython/micropython-esp32,torwag/micropython,rubencabrera/micropython,trezor/micropython,puuu/micropython,neilh10/micropython,xyb/micropython,chrisdearman/micropython,dinau/micropython,slzatz/micropython,praemdonck/micropython,ruffy91/micropython,ChuckM/micropython,he... | ---
+++
@@ -0,0 +1,37 @@
+class A:
+ def __init__(self, x):
+ print('A init', x)
+ self.x = x
+
+ def f(self):
+ print(self.x)
+
+ def f2(self):
+ print(self.x)
+
+class B:
+ def __init__(self, x):
+ print('B init', x)
+ self.x = x
+
+ def f(self):
+ pri... | |
94de257a82a54ed5cb6a4d8c15107e889814b07f | examples/calculations/Gradient.py | examples/calculations/Gradient.py | # Copyright (c) 2015-2018 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
Gradient
========
Use `metpy.calc.gradient`.
This example demonstrates the various ways that MetPy's gradient function
can be utilized.
"""
import numpy as np
import met... | Add example of using gradient. | Add example of using gradient.
| Python | bsd-3-clause | dopplershift/MetPy,ahaberlie/MetPy,Unidata/MetPy,jrleeman/MetPy,ShawnMurd/MetPy,ahaberlie/MetPy,Unidata/MetPy,jrleeman/MetPy,dopplershift/MetPy | ---
+++
@@ -0,0 +1,64 @@
+# Copyright (c) 2015-2018 MetPy Developers.
+# Distributed under the terms of the BSD 3-Clause License.
+# SPDX-License-Identifier: BSD-3-Clause
+"""
+Gradient
+========
+
+Use `metpy.calc.gradient`.
+
+This example demonstrates the various ways that MetPy's gradient function
+can be utilize... | |
e8f1f4290b7eb2630cecf7e18da0f3ed2cad58d8 | autobuilder/slack.py | autobuilder/slack.py | import json
from twisted.internet import defer
from twisted.python import log
from buildbot.process.results import CANCELLED, EXCEPTION, FAILURE, SUCCESS, WARNINGS
from buildbot.reporters.notifier import NotifierBase
from buildbot.util import httpclientservice
COLORS = {
CANCELLED: 'warning',
EXCEPTION: 'warn... | Add Slack notifier supporting buildset summaries | Add Slack notifier supporting buildset summaries
| Python | mit | madisongh/autobuilder | ---
+++
@@ -0,0 +1,63 @@
+import json
+from twisted.internet import defer
+from twisted.python import log
+
+from buildbot.process.results import CANCELLED, EXCEPTION, FAILURE, SUCCESS, WARNINGS
+from buildbot.reporters.notifier import NotifierBase
+from buildbot.util import httpclientservice
+
+COLORS = {
+ CANCE... | |
5a97b4b6327dee09fa32eff68c8a934e85405853 | txircd/modules/extra/connlimit.py | txircd/modules/extra/connlimit.py | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
class ConnectionLimit(ModuleData):
implements(IPlugin, IModuleData)
name = "ConnectionLimit"
peerConnections = {}
def hookIRCd(self, ircd):
self.ircd = ircd
... | Implement the connection limit module | Implement the connection limit module
| Python | bsd-3-clause | Heufneutje/txircd,ElementalAlchemist/txircd | ---
+++
@@ -0,0 +1,50 @@
+from twisted.plugin import IPlugin
+from txircd.module_interface import IModuleData, ModuleData
+from zope.interface import implements
+
+class ConnectionLimit(ModuleData):
+ implements(IPlugin, IModuleData)
+
+ name = "ConnectionLimit"
+ peerConnections = {}
+
+ def hookIRCd(sel... | |
c3009dfd74f61813950160d9a4a826613db75249 | dynd/tests/test_type_pattern_match.py | dynd/tests/test_type_pattern_match.py | import sys
import unittest
from dynd import nd, ndt
class TestTypePatternMatch(unittest.TestCase):
def test_simple(self):
self.assertTrue(ndt.int32.matches(ndt.int32))
self.assertTrue(ndt.int16.matches('T'))
self.assertTrue(ndt.int16.matches('... * T'))
self.assertTrue(ndt.int16.mat... | Add some python tests of the type pattern matching | Add some python tests of the type pattern matching
| Python | bsd-2-clause | insertinterestingnamehere/dynd-python,izaid/dynd-python,izaid/dynd-python,michaelpacer/dynd-python,mwiebe/dynd-python,pombredanne/dynd-python,insertinterestingnamehere/dynd-python,ContinuumIO/dynd-python,izaid/dynd-python,cpcloud/dynd-python,izaid/dynd-python,aterrel/dynd-python,aterrel/dynd-python,aterrel/dynd-python,... | ---
+++
@@ -0,0 +1,20 @@
+import sys
+import unittest
+from dynd import nd, ndt
+
+class TestTypePatternMatch(unittest.TestCase):
+ def test_simple(self):
+ self.assertTrue(ndt.int32.matches(ndt.int32))
+ self.assertTrue(ndt.int16.matches('T'))
+ self.assertTrue(ndt.int16.matches('... * T'))
+... | |
71a8209f5b68a8edc663e876b369fd891a79a863 | lucid/misc/convert_matplotlib.py | lucid/misc/convert_matplotlib.py | import io
import numpy as np
from PIL import Image
def matplotlib_to_numpy(plt):
"""Convert a matplotlib plot to a numpy array represent it as an image.
Inputs:
plot - matplotlib plot
Returns:
A numpy array with shape [W, H, 3], representing RGB values between 0 and 1.
"""
f = io.BytesIO()
plt... | Add matplotlib plot -> numpy image util | Add matplotlib plot -> numpy image util
| Python | apache-2.0 | tensorflow/lucid,tensorflow/lucid,tensorflow/lucid,tensorflow/lucid | ---
+++
@@ -0,0 +1,20 @@
+import io
+import numpy as np
+from PIL import Image
+
+def matplotlib_to_numpy(plt):
+ """Convert a matplotlib plot to a numpy array represent it as an image.
+
+ Inputs:
+ plot - matplotlib plot
+
+ Returns:
+ A numpy array with shape [W, H, 3], representing RGB values between 0 a... | |
32a55869f9b7c1493e00db3f5fc622f5f73dced0 | mecode/devices/efd_pico_pulse.py | mecode/devices/efd_pico_pulse.py | ##############################################################################
#
# For EFD PICO Touch/Pulse controller and jetter
#
##############################################################################
import serial
# Constants
EOT = '\r'
ACK = '<3'
class EFDPicoPulse(object):
def __init__(self, compor... | Add initial picoPulse to devices | Add initial picoPulse to devices
| Python | mit | razeh/mecode,jminardi/mecode | ---
+++
@@ -0,0 +1,69 @@
+##############################################################################
+#
+# For EFD PICO Touch/Pulse controller and jetter
+#
+##############################################################################
+
+import serial
+
+# Constants
+EOT = '\r'
+ACK = '<3'
+
+class EFDPicoPulse... | |
58b1a723af7ba161398dbb6b77096c2974ec311f | pyli.py | pyli.py | import parser
import token
import symbol
import sys
from pprint import pprint
tree = parser.st2tuple(parser.suite(sys.argv[1]))
def convert_readable(tree):
return tuple(((token.tok_name[i]
if token.tok_name.get(i) else
symbol.sym_name[i])
if isinstance(i, i... | Add routine to make the parse tree ammenable | Add routine to make the parse tree ammenable
| Python | mit | thenoviceoof/pyli | ---
+++
@@ -0,0 +1,19 @@
+import parser
+import token
+import symbol
+
+import sys
+from pprint import pprint
+
+tree = parser.st2tuple(parser.suite(sys.argv[1]))
+
+def convert_readable(tree):
+ return tuple(((token.tok_name[i]
+ if token.tok_name.get(i) else
+ symbol.sym_name[... | |
46ae9c191abca889eeb601542eb1ea33224b3b94 | scripts/monitoring/cron-send-node-taints-status.py | scripts/monitoring/cron-send-node-taints-status.py | #!/usr/bin/env python
""" Node taints check for OpenShift V3 """
# Adding the ignore because it does not like the naming of the script
# to be different than the class name
# pylint: disable=invalid-name
# pylint: disable=wrong-import-position
# pylint: disable=broad-except
# pylint: disable=line-too-long
import arg... | Add monitor script for taints | Add monitor script for taints
| Python | apache-2.0 | blrm/openshift-tools,blrm/openshift-tools,blrm/openshift-tools,blrm/openshift-tools,blrm/openshift-tools,blrm/openshift-tools | ---
+++
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+""" Node taints check for OpenShift V3 """
+
+# Adding the ignore because it does not like the naming of the script
+# to be different than the class name
+# pylint: disable=invalid-name
+
+# pylint: disable=wrong-import-position
+# pylint: disable=broad-except
+# pyli... | |
3627c5ce2d35e647f359476e784b067506de44e4 | django_auth_policy/management/commands/unlock_all.py | django_auth_policy/management/commands/unlock_all.py | from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django_auth_policy.models import LoginAttempt
class Command(BaseCommand):
help = "Remove all locks on usernames and IP addresses"
def handle(self, *args, **options):
c = LoginAttempt.objects.filte... | Add management command which unlocks all lockout commands | Add management command which unlocks all lockout commands
| Python | bsd-3-clause | mcella/django-auth-policy,mcella/django-auth-policy,Dreamsolution/django-auth-policy,Dreamsolution/django-auth-policy | ---
+++
@@ -0,0 +1,12 @@
+from django.core.management.base import BaseCommand, CommandError
+from django.conf import settings
+
+from django_auth_policy.models import LoginAttempt
+
+
+class Command(BaseCommand):
+ help = "Remove all locks on usernames and IP addresses"
+
+ def handle(self, *args, **options):
+... | |
795dfe1df9ca3e0ada86de450e5f7cf2c80fe4e2 | tests/test_context_processors.py | tests/test_context_processors.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.test.client import RequestFactory
from django.test.utils import override_settings
from responsive.conf import settings
from responsive.context_processors import device
fro... | Add tests for responsive context_processors | Add tests for responsive context_processors
| Python | bsd-3-clause | mishbahr/django-responsive2,mishbahr/django-responsive2 | ---
+++
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from django.core.exceptions import ImproperlyConfigured
+from django.test import TestCase
+from django.test.client import RequestFactory
+from django.test.utils import override_settings
+
+from responsive.conf import settings
+from responsive... | |
3ef65ebffe960e205abe3efd36e5a5690a3ee947 | arcutils/exc.py | arcutils/exc.py | import warnings
class ARCUtilsDeprecationWarning(DeprecationWarning):
@classmethod
def warn(cls, message, stacklevel=2):
warnings.warn(message, cls, stacklevel)
warnings.simplefilter('default', ARCUtilsDeprecationWarning)
| Add a mechanism for deprecating things | Add a mechanism for deprecating things
| Python | mit | PSU-OIT-ARC/django-arcutils,wylee/django-arcutils,wylee/django-arcutils,PSU-OIT-ARC/django-arcutils | ---
+++
@@ -0,0 +1,11 @@
+import warnings
+
+
+class ARCUtilsDeprecationWarning(DeprecationWarning):
+
+ @classmethod
+ def warn(cls, message, stacklevel=2):
+ warnings.warn(message, cls, stacklevel)
+
+
+warnings.simplefilter('default', ARCUtilsDeprecationWarning) | |
c11e88c6baa95bcbf72c3a5e09e203a5b74c3bc8 | python/bin/python/pyqt4_symlinks.py | python/bin/python/pyqt4_symlinks.py | #!/usr/bin/env python
import os
import sys
from builtins import FileExistsError
try:
venv = os.environ['VIRTUAL_ENV']
except KeyError:
print('Virtual environment is not detected.')
raise
python_venv_version = sys.version_info[:2]
site_version = str(python_venv_version[0]) + '.' + str(python_venv_version[... | Add Python code for making symlinks for PyQt4 and SIP into a virtualenv | Add Python code for making symlinks for PyQt4 and SIP into a virtualenv
| Python | mit | edwinksl/dotfiles,edwinksl/dotfiles | ---
+++
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+import os
+import sys
+from builtins import FileExistsError
+
+try:
+ venv = os.environ['VIRTUAL_ENV']
+except KeyError:
+ print('Virtual environment is not detected.')
+ raise
+
+python_venv_version = sys.version_info[:2]
+site_version = str(python_venv_ver... | |
d0934c5530b2deaffa6a0f76ef997861412442b2 | setup.py | setup.py | from setuptools import setup, find_packages
with open('README.md', 'r') as f:
README = f.read()
setup(name='apigpio',
version='0.0.1',
description='asyncio-based python client for pigpiod',
long_description=README,
classifiers=[
"Development Status :: 3 - Alpha",
"Int... | Add basic python packaing info. | Add basic python packaing info.
| Python | mit | PierreRust/apigpio | ---
+++
@@ -0,0 +1,30 @@
+from setuptools import setup, find_packages
+
+
+with open('README.md', 'r') as f:
+ README = f.read()
+
+
+setup(name='apigpio',
+ version='0.0.1',
+ description='asyncio-based python client for pigpiod',
+ long_description=README,
+ classifiers=[
+ "Developm... | |
048c992ca7c9ebabab9a9f60d9432b99111e573e | stats.py | stats.py | import re
import sqlite3
def open_cloudfront_log_db():
db = sqlite3.connect('cf.db')
return db
def format_size(sz):
abbrevs = (
(1<<50, 'PB'),
(1<<40, 'TB'),
(1<<30, 'GB'),
(1<<20, 'MB'),
(1<<10, 'KB'),
(1, 'B')
)
for factor, suffix in abbrevs:
... | Print total byte count from db | Print total byte count from db
| Python | bsd-2-clause | hortont424/cfwatch | ---
+++
@@ -0,0 +1,35 @@
+import re
+import sqlite3
+
+def open_cloudfront_log_db():
+ db = sqlite3.connect('cf.db')
+ return db
+
+def format_size(sz):
+ abbrevs = (
+ (1<<50, 'PB'),
+ (1<<40, 'TB'),
+ (1<<30, 'GB'),
+ (1<<20, 'MB'),
+ (1<<10, 'KB'),
+ (1, 'B')
+ ... | |
92e3464a08fd7c8b38dbae9c3ea15f9f6f2b64ac | ReSId.py | ReSId.py | """
The GLEAM REsidual Source IDentifier program
Created by:
Robin Cook
March 24 2016
Modifications by:
Robin Cook
"""
# Imports
import sys
import os
import numpy as np
import math
# Other Imports
import scipy
import astropy
from optparse import OptionParser
usage = "usage: %prog [options] ... | Include initial option parser framework | Include initial option parser framework | Python | mit | AstroRobin/GLEAM-RESID | ---
+++
@@ -0,0 +1,32 @@
+"""
+The GLEAM REsidual Source IDentifier program
+
+Created by:
+Robin Cook
+March 24 2016
+
+Modifications by:
+Robin Cook
+"""
+
+# Imports
+import sys
+import os
+import numpy as np
+import math
+
+# Other Imports
+import scipy
+import astropy
+
+from optparse import OptionParser
+
+usag... | |
ae95f79ebced40badfbe7dff72ced0c4436567b1 | context_processors.py | context_processors.py | from django.conf import settings as sett
def settings(request):
my_dict = {
'SB_ROOT': sett.SB_ROOT,
'SITE_URL': sett.SITE_URL,
'SITE_NAME': sett.SITE_NAME,
'SITE_AUTHOR': sett.SITE_AUTHOR,
'PuSH_URL': sett.PUBSUBHUBBUB_URL,
}
return my_dict
| Add context processor for adding in data from the django settings file | Add context processor for adding in data from the django settings file
| Python | mit | kyleconroy/stashboard2 | ---
+++
@@ -0,0 +1,13 @@
+from django.conf import settings as sett
+
+def settings(request):
+
+ my_dict = {
+ 'SB_ROOT': sett.SB_ROOT,
+ 'SITE_URL': sett.SITE_URL,
+ 'SITE_NAME': sett.SITE_NAME,
+ 'SITE_AUTHOR': sett.SITE_AUTHOR,
+ 'PuSH_URL': sett.PUBSUBHUBBUB_URL,
+ }
+
+ ... | |
96e853995203aae902416b4ba82707161ac6170c | IPython/core/tests/test_prompts.py | IPython/core/tests/test_prompts.py | """Tests for prompt generation."""
import unittest
import nose.tools as nt
from IPython.testing import tools as tt, decorators as dec
from IPython.core.prompts import PromptManager
from IPython.testing.globalipapp import get_ipython
ip = get_ipython()
class PromptTests(unittest.TestCase):
def setUp(self):
... | Add tests for prompt system. | Add tests for prompt system.
| Python | bsd-3-clause | ipython/ipython,ipython/ipython | ---
+++
@@ -0,0 +1,43 @@
+"""Tests for prompt generation."""
+
+import unittest
+
+import nose.tools as nt
+
+from IPython.testing import tools as tt, decorators as dec
+from IPython.core.prompts import PromptManager
+from IPython.testing.globalipapp import get_ipython
+
+ip = get_ipython()
+
+
+class PromptTests(uni... | |
2576ad51ffeaecd645d030ca875c82f66ecd5ee8 | learntools/computer_vision/ex3.py | learntools/computer_vision/ex3.py | from learntools.core import *
import tensorflow as tf
class Q1(CodingProblem):
_vars = ['image_condense', 'image_detect', 'image_filter', 'image']
_hint = ""
_solution = CS("""
image_filter = tf.nn.conv2d(
input=image,
filters=kernel,
strides=1,
padding='SAME',
)
""")
def check(self, im... | Add exercise 3 checking code | Add exercise 3 checking code
| Python | apache-2.0 | Kaggle/learntools,Kaggle/learntools | ---
+++
@@ -0,0 +1,51 @@
+from learntools.core import *
+import tensorflow as tf
+
+class Q1(CodingProblem):
+ _vars = ['image_condense', 'image_detect', 'image_filter', 'image']
+ _hint = ""
+ _solution = CS("""
+image_filter = tf.nn.conv2d(
+ input=image,
+ filters=kernel,
+ strides=1,
+ paddin... | |
2e18b548bb13a274e94f4d3e36a631f9aa3e79a4 | taskflow/tests/unit/test_utils.py | taskflow/tests/unit/test_utils.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! 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
#
# ... | Add a basic rollback accumlator test. | Add a basic rollback accumlator test.
| Python | apache-2.0 | jessicalucci/TaskManagement,openstack/taskflow,pombredanne/taskflow-1,citrix-openstack-build/taskflow,junneyang/taskflow,varunarya10/taskflow,openstack/taskflow,jessicalucci/TaskManagement,jimbobhickville/taskflow,citrix-openstack-build/taskflow,varunarya10/taskflow,junneyang/taskflow,pombredanne/taskflow-1,jimbobhickv... | ---
+++
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright (C) 2012 Yahoo! 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
+#... | |
324cafc24bae3c9ecb0b06ad8701e2b4c40c75c2 | migration/versions/014_Add_terms_column.py | migration/versions/014_Add_terms_column.py | from sqlalchemy import Boolean, Column, MetaData, Table
meta = MetaData()
def upgrade(migrate_engine):
meta.bind = migrate_engine
account = Table('account', meta, autoload=True)
termsc = Column('terms', Boolean, default=False)
termsc.create(account, populate_default=True)
def downgrade(migrate_en... | Add migration for terms column | Add migration for terms column
| Python | agpl-3.0 | johnjohndoe/spendb,CivicVision/datahub,pudo/spendb,johnjohndoe/spendb,USStateDept/FPA_Core,openspending/spendb,pudo/spendb,pudo/spendb,nathanhilbert/FPA_Core,nathanhilbert/FPA_Core,USStateDept/FPA_Core,openspending/spendb,spendb/spendb,nathanhilbert/FPA_Core,openspending/spendb,CivicVision/datahub,CivicVision/datahub,j... | ---
+++
@@ -0,0 +1,19 @@
+from sqlalchemy import Boolean, Column, MetaData, Table
+
+
+meta = MetaData()
+
+
+def upgrade(migrate_engine):
+ meta.bind = migrate_engine
+ account = Table('account', meta, autoload=True)
+
+ termsc = Column('terms', Boolean, default=False)
+ termsc.create(account, populate_d... | |
bdadf9b67b6f35566d7ff874522aeaf4ee519e24 | tests/test_configure_alt_name.py | tests/test_configure_alt_name.py | from __future__ import unicode_literals, division, absolute_import
from tests import FlexGetBase
#todo: merge into test_series
def age_series(**kwargs):
from flexget.plugins.filter.series import Release
from flexget.manager import Session
import datetime
session = Session()
session.query(Release).... | Test for series configure loading alternate name | Test for series configure loading alternate name
| Python | mit | jawilson/Flexget,poulpito/Flexget,dsemi/Flexget,tarzasai/Flexget,X-dark/Flexget,jawilson/Flexget,antivirtel/Flexget,antivirtel/Flexget,vfrc2/Flexget,Flexget/Flexget,thalamus/Flexget,LynxyssCZ/Flexget,ianstalk/Flexget,spencerjanssen/Flexget,patsissons/Flexget,ratoaq2/Flexget,malkavi/Flexget,xfouloux/Flexget,tvcsantos/Fl... | ---
+++
@@ -0,0 +1,32 @@
+from __future__ import unicode_literals, division, absolute_import
+from tests import FlexGetBase
+
+#todo: merge into test_series
+
+def age_series(**kwargs):
+ from flexget.plugins.filter.series import Release
+ from flexget.manager import Session
+ import datetime
+ session = ... | |
50bd84ed86c924fa5b020dd1200ccbfcd95aaf1d | tests/test_requests.py | tests/test_requests.py | # -*- coding: utf-8 -*-
"""
Add comment here
~~~~~~~~~~~~~~~~
Add descripton here
:copyright: (c) 2014 Shinya Ohyanagi, All rights reserved.
:license: BSD, see LICENSE for more details.
"""
import os
import shutil
import requests
from unittest import TestCase
from unittest import skip
from autodo... | Add requests test. But now skipping. | Add requests test. But now skipping.
| Python | bsd-3-clause | heavenshell/py-autodoc | ---
+++
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+"""
+ Add comment here
+ ~~~~~~~~~~~~~~~~
+
+ Add descripton here
+
+
+ :copyright: (c) 2014 Shinya Ohyanagi, All rights reserved.
+ :license: BSD, see LICENSE for more details.
+"""
+import os
+import shutil
+import requests
+from unittest import Test... | |
380a86134a62265eb944d717cad002bbc4197be4 | cjdata/views.py | cjdata/views.py | from django.views.generic import DetailView, ListView
from django.shortcuts import get_object_or_404
from cjdata.models import Dataset, Category
from cjdata.search.query import sqs
class DatasetDetailView(DetailView):
model = Dataset
slug_field = 'uuid'
slug_url_kwarg = 'uuid'
def get_context_data(se... | from django.views.generic import DetailView, ListView
from django.shortcuts import get_object_or_404
from cjdata.models import Dataset, Category
from cjdata.search.query import sqs
class DatasetDetailView(DetailView):
model = Dataset
slug_field = 'uuid'
slug_url_kwarg = 'uuid'
def get_context_data(se... | Correct category lookup on url kwarg to use case insensitive. | Correct category lookup on url kwarg to use case insensitive.
| Python | bsd-3-clause | dmc2015/hall-of-justice,dmc2015/hall-of-justice,dmc2015/hall-of-justice,sunlightlabs/hall-of-justice,sunlightlabs/hall-of-justice,sunlightlabs/hall-of-justice | ---
+++
@@ -21,8 +21,8 @@
def get_queryset(self):
path_arg = self.kwargs.get('path', None)
- self.category = get_object_or_404(Category, path=path_arg.replace('-', ' '))
- return Dataset.objects.filter(categories__path__iexact=self.category.path)
+ self.category = get_object_or_40... |
1f495c7faa501efe15fb518ebe0dbf94a83e0f8a | pijobs/fortunejob.py | pijobs/fortunejob.py | import subprocess
from pijobs.scrolljob import SrollJob
class FortuneJob(ScrollJob):
def message(self):
return self.run_cmd('fortune')
def run_cmd(cmd):
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output = p.communicate()[0]
return ou... | Add job to display fortunes. | Add job to display fortunes.
| Python | mit | ollej/piapi,ollej/piapi | ---
+++
@@ -0,0 +1,11 @@
+import subprocess
+from pijobs.scrolljob import SrollJob
+
+class FortuneJob(ScrollJob):
+ def message(self):
+ return self.run_cmd('fortune')
+
+ def run_cmd(cmd):
+ p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ output =... | |
6054b634c79d95e5cd2a4ed5c796d8ffcd1ddcc1 | frigg/builds/migrations/0003_auto_20141029_2158.py | frigg/builds/migrations/0003_auto_20141029_2158.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('builds', '0002_auto_20141028_0710'),
]
operations = [
migrations.AlterModelOptions(
name='build',
options={'... | Add migration for ordering update | Add migration for ordering update
| Python | mit | frigg/frigg-hq,frigg/frigg-hq,frigg/frigg-hq | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('builds', '0002_auto_20141028_0710'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ ... | |
f3945fc1227b1650080fc52e63ce3b5ca795aefc | tools/visualization.py | tools/visualization.py | from pathlib import Path
from keras.applications import VGG16
from keras.models import Model
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import AxesGrid
from tools.datasets.urban_tribes import load_images
def plot_filter(image_path, layer_name, output_dir):
base_model = VGG16(weights='imagenet'... | Add a convenient function to plot filter | Add a convenient function to plot filter
| Python | mit | xiongliyang219/transfer-learning | ---
+++
@@ -0,0 +1,41 @@
+from pathlib import Path
+
+from keras.applications import VGG16
+from keras.models import Model
+import matplotlib.pyplot as plt
+from mpl_toolkits.axes_grid1 import AxesGrid
+
+from tools.datasets.urban_tribes import load_images
+
+
+def plot_filter(image_path, layer_name, output_dir):
+ ... | |
c7621bd5c5e48c8d45ae70836b681b715348d0ba | modules/module_oraakkeli.py | modules/module_oraakkeli.py |
import urllib
def command_oraakkeli(bot, user, channel, args):
"""Asks a question from the oracle (http://www.lintukoto.net/viihde/oraakkeli/)"""
if not args: return
args = urllib.quote_plus(args)
answer = getUrl("http://www.lintukoto.net/viihde/oraakkeli/index.php?kysymys=%s&html=0" % args).getCon... |
import urllib
def command_oraakkeli(bot, user, channel, args):
"""Asks a question from the oracle (http://www.lintukoto.net/viihde/oraakkeli/)"""
if not args: return
args = urllib.quote_plus(args)
answer = getUrl("http://www.lintukoto.net/viihde/oraakkeli/index.php?kysymys=%s&html=0" % args).getCon... | Update oracle module for UTF-8 | Update oracle module for UTF-8
git-svn-id: 056f9092885898c4775d98c479d2d33d00273e45@99 dda364a1-ef19-0410-af65-756c83048fb2
| Python | bsd-3-clause | EArmour/pyfibot,nigeljonez/newpyfibot,huqa/pyfibot,aapa/pyfibot,EArmour/pyfibot,rnyberg/pyfibot,rnyberg/pyfibot,lepinkainen/pyfibot,aapa/pyfibot,lepinkainen/pyfibot,huqa/pyfibot | ---
+++
@@ -10,4 +10,7 @@
answer = getUrl("http://www.lintukoto.net/viihde/oraakkeli/index.php?kysymys=%s&html=0" % args).getContent()
+ answer = unicode(answer)
+ answer = answer.encode("utf-8")
+
bot.say(channel, "Oraakkeli vastaa: %s" % answer) |
35cc1959ebfc209a7b2b15e7a323afc88474b3e5 | py/largest-palindrome-product.py | py/largest-palindrome-product.py | class Solution(object):
def largestPalindrome(self, n):
"""
:type n: int
:rtype: int
"""
if n == 1:
return 9
for x in xrange(3, 10 ** n):
# two numbers 10 ** n - i, 10 ** n - j
# x = i + j
# reverse(10 ** n - x) = i * j
... | Add py solution for 479. Largest Palindrome Product | Add py solution for 479. Largest Palindrome Product
479. Largest Palindrome Product: https://leetcode.com/problems/largest-palindrome-product/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,18 @@
+class Solution(object):
+ def largestPalindrome(self, n):
+ """
+ :type n: int
+ :rtype: int
+ """
+ if n == 1:
+ return 9
+ for x in xrange(3, 10 ** n):
+ # two numbers 10 ** n - i, 10 ** n - j
+ # x = i + j
+ ... | |
18d10b310d83de6b6244fd09b9fc742db5ced6e2 | py/assign-cookies.py | py/assign-cookies.py | from collections import Counter
class Solution(object):
def findContentChildren(self, children, s):
"""
:type g: List[int]
:type s: List[int]
:rtype: int
"""
if not s:
return 0
cookies = Counter(s)
it = iter(sorted(cookies))
cur = i... | Add py solution for 455. Assign Cookies | Add py solution for 455. Assign Cookies
455. Assign Cookies: https://leetcode.com/problems/assign-cookies/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,26 @@
+from collections import Counter
+class Solution(object):
+ def findContentChildren(self, children, s):
+ """
+ :type g: List[int]
+ :type s: List[int]
+ :rtype: int
+ """
+ if not s:
+ return 0
+ cookies = Counter(s)
+ it ... | |
192ec9e61839f9ea154a737cd219b3ca76bd7812 | Worker.py | Worker.py |
class Worker(object):
def __init__(self):
self.finished = False
class GridProcessor(Worker):
def __init__(self):
self.pid = os.getpid()
self.age = None
self.angle = None
self.data_dir = None
self.results_dir = None
def set_data_dir(self, data_dir):... | Check if data has nodata mask | Check if data has nodata mask
| Python | mit | stgl/scarplet,rmsare/scarplet | ---
+++
@@ -0,0 +1,45 @@
+
+
+
+class Worker(object):
+
+ def __init__(self):
+ self.finished = False
+
+
+class GridProcessor(Worker):
+
+ def __init__(self):
+ self.pid = os.getpid()
+ self.age = None
+ self.angle = None
+ self.data_dir = None
+ self.results_dir = Non... | |
2a214050a30048eab177f696d891a33c2860bb55 | pymatgen/symmetry/tests/test_spacegroup.py | pymatgen/symmetry/tests/test_spacegroup.py | #!/usr/bin/env python
'''
Created on Mar 12, 2012
'''
from __future__ import division
__author__="Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Mar 12, 2012"
import unittest
import os
from pymatg... | Add a unittest for spacegroup. Still very basic. | Add a unittest for spacegroup. Still very basic.
| Python | mit | rousseab/pymatgen,Bismarrck/pymatgen,Bismarrck/pymatgen,rousseab/pymatgen,sonium0/pymatgen,yanikou19/pymatgen,rousseab/pymatgen,Dioptas/pymatgen,Bismarrck/pymatgen,ctoher/pymatgen,sonium0/pymatgen,migueldiascosta/pymatgen,Dioptas/pymatgen,Bismarrck/pymatgen,yanikou19/pymatgen,yanikou19/pymatgen,migueldiascosta/pymatgen... | ---
+++
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+'''
+Created on Mar 12, 2012
+'''
+
+from __future__ import division
+
+__author__="Shyue Ping Ong"
+__copyright__ = "Copyright 2012, The Materials Project"
+__version__ = "0.1"
+__maintainer__ = "Shyue Ping Ong"
+__email__ = "shyue@mit.edu"
+__date__ = "Mar 12, 2012... | |
e3fdb634be82394703db6d2cc0bf1091646197d8 | skbeam/core/tests/test_smoothing.py | skbeam/core/tests/test_smoothing.py | # ######################################################################
# Copyright (c) 2014, Brookhaven Science Associates, Brookhaven #
# National Laboratory. All rights reserved. #
# #
# Redistribution and use in ... | Add test of smoothing module | Add test of smoothing module
| Python | bsd-3-clause | tacaswell/scikit-beam,Nikea/scikit-xray,tacaswell/scikit-xray,tacaswell/scikit-beam,scikit-xray/scikit-xray,scikit-xray/scikit-xray,tacaswell/scikit-xray,Nikea/scikit-xray,tacaswell/scikit-beam,scikit-xray/scikit-xray,Nikea/scikit-xray,tacaswell/scikit-xray | ---
+++
@@ -0,0 +1,47 @@
+# ######################################################################
+# Copyright (c) 2014, Brookhaven Science Associates, Brookhaven #
+# National Laboratory. All rights reserved. #
+# ... | |
497f5085143322d4b9d3ad23d35d30cdf852d1f6 | test/unit/sorting/test_heap_sort.py | test/unit/sorting/test_heap_sort.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
from helper.read_data_file import read_int_array
from sorting.heap_sort import sort
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class InsertionSortTester(unittest.TestCase):
# Test sort in default order, i.e., in ascending orde... | Add unit test for heap sort implementation. | Add unit test for heap sort implementation.
| Python | mit | weichen2046/algorithm-study,weichen2046/algorithm-study | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import unittest
+
+from helper.read_data_file import read_int_array
+from sorting.heap_sort import sort
+
+
+BASE_DIR = os.path.dirname(os.path.abspath(__file__))
+
+
+class InsertionSortTester(unittest.TestCase):
+
+ # Test sor... | |
3d52040663eaef07aa3e9d13500819b4633f1187 | typhon/tests/spareice/test_array.py | typhon/tests/spareice/test_array.py | import numpy as np
from typhon.spareice import Array, GroupedArrays
import xarray as xr
class TestArray:
"""Testing the array methods."""
pass
class TestGroupedArrays:
"""Testing the GroupedArrays methods."""
def test_dict(self):
# TODO: Implement test for export to / import from python dic... | Implement test class for Array and GroupedArrays | Implement test class for Array and GroupedArrays
| Python | mit | atmtools/typhon,atmtools/typhon | ---
+++
@@ -0,0 +1,47 @@
+import numpy as np
+from typhon.spareice import Array, GroupedArrays
+import xarray as xr
+
+
+class TestArray:
+ """Testing the array methods."""
+ pass
+
+
+class TestGroupedArrays:
+ """Testing the GroupedArrays methods."""
+
+ def test_dict(self):
+ # TODO: Implement t... | |
3c3259024310e3ed28bc71c8bb6fa60d608a049c | spacy/tests/doc/test_morphanalysis.py | spacy/tests/doc/test_morphanalysis.py | # coding: utf-8
from __future__ import unicode_literals
import pytest
import numpy
from spacy.attrs import IS_ALPHA, IS_DIGIT, IS_LOWER, IS_PUNCT, IS_TITLE, IS_STOP
from spacy.symbols import VERB
from spacy.vocab import Vocab
from spacy.tokens import Doc
@pytest.fixture
def i_has(en_tokenizer):
doc = en_tokenizer... | Add test for morph analysis | Add test for morph analysis
| Python | mit | spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,honnibal/spaCy,explosion/spaCy,spacy-io/spaCy | ---
+++
@@ -0,0 +1,30 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import pytest
+import numpy
+from spacy.attrs import IS_ALPHA, IS_DIGIT, IS_LOWER, IS_PUNCT, IS_TITLE, IS_STOP
+from spacy.symbols import VERB
+from spacy.vocab import Vocab
+from spacy.tokens import Doc
+
+@pytest.fixture
+def i_ha... | |
39c28f76540da294d9dd4adf4f84ae266922498d | test/test_clientagent.py | test/test_clientagent.py | #!/usr/bin/env python2
import unittest
from socket import *
from common import *
from testdc import *
CONFIG = """\
messagedirector:
bind: 127.0.0.1:57123
general:
dc_files:
- %r
roles:
- type: clientagent
bind: 127.0.0.1:57128
version: "Sword Art Online v5.1"
""" % test_dc
VERSION =... | Create clientagent unittest file, with test for CLIENT_HELLO behavior. | tests: Create clientagent unittest file, with test for CLIENT_HELLO behavior.
| Python | bsd-3-clause | pizcogirl/Astron,blindsighttf2/Astron,ketoo/Astron,pizcogirl/Astron,ketoo/Astron,blindsighttf2/Astron,blindsighttf2/Astron,ketoo/Astron,blindsighttf2/Astron,pizcogirl/Astron,ketoo/Astron,pizcogirl/Astron | ---
+++
@@ -0,0 +1,94 @@
+#!/usr/bin/env python2
+import unittest
+from socket import *
+
+from common import *
+from testdc import *
+
+CONFIG = """\
+messagedirector:
+ bind: 127.0.0.1:57123
+
+general:
+ dc_files:
+ - %r
+
+roles:
+ - type: clientagent
+ bind: 127.0.0.1:57128
+ version: "... | |
b5d0d935f21c76166cd767b81a08a59cce04f9cb | livereload/__init__.py | livereload/__init__.py | """django-livereload"""
__version__ = '0.1.dev'
__license__ = 'BSD License'
__author__ = 'Fantomas42'
__email__ = 'fantomas42@gmail.com'
__url__ = 'https://github.com/Fantomas42/django-livereload'
| Add metas information for the package | Add metas information for the package
| Python | bsd-3-clause | Fantomas42/django-livereload,kbussell/django-livereload | ---
+++
@@ -0,0 +1,8 @@
+"""django-livereload"""
+__version__ = '0.1.dev'
+__license__ = 'BSD License'
+
+__author__ = 'Fantomas42'
+__email__ = 'fantomas42@gmail.com'
+
+__url__ = 'https://github.com/Fantomas42/django-livereload' | |
7fa9fb24262c5ced8d09a2de34fd412cc5aa3758 | private/realclearpolitics-scraper/realclearpolitics/spiders/spider.py | private/realclearpolitics-scraper/realclearpolitics/spiders/spider.py | import scrapy
from realclearpolitics.items import TableItem
class RcpSpider(scrapy.Spider):
name = "realclearpoliticsSpider"
start_urls = []
def __init__(self, url, state_code):
self.url = url
self.state_code = state_code
def start_requests(self):
return [scrapy.FormRequest(se... | import scrapy
from realclearpolitics.items import TableItem
class RcpSpider(scrapy.Spider):
name = "realclearpoliticsSpider"
start_urls = []
columns = ['Poll','Date', 'Sample', 'Spread']
def __init__(self, url, state_code):
self.url = url
self.state_code = state_code
def start_req... | Put candidate score in field object | Put candidate score in field object
| Python | mit | dpxxdp/berniemetrics,Rumel/berniemetrics,dpxxdp/berniemetrics,fpagnoux/berniemetrics,fpagnoux/berniemetrics,dpxxdp/berniemetrics,fpagnoux/berniemetrics,Rumel/berniemetrics,dpxxdp/berniemetrics,fpagnoux/berniemetrics,Rumel/berniemetrics,Rumel/berniemetrics | ---
+++
@@ -4,6 +4,7 @@
class RcpSpider(scrapy.Spider):
name = "realclearpoliticsSpider"
start_urls = []
+ columns = ['Poll','Date', 'Sample', 'Spread']
def __init__(self, url, state_code):
self.url = url
@@ -25,9 +26,14 @@
for line in contentLines:
item = TableIt... |
e9105d4c0fcf7ff90b96e764cbf8acdb94856a7a | tests/executables/echo_server.py | tests/executables/echo_server.py | import sys
import socket
import select
from papa.utils import cast_string
__author__ = 'Scott Maxwell'
if len(sys.argv) != 2:
sys.stderr.write('Need one file descriptor\n')
sys.exit(1)
listen_socket = socket.fromfd(int(sys.argv[1]), socket.AF_INET, socket.SOCK_STREAM)
connection, address = listen_socket.acce... | Add simple echo server test app | Add simple echo server test app
| Python | mit | scottkmaxwell/papa | ---
+++
@@ -0,0 +1,23 @@
+import sys
+import socket
+import select
+from papa.utils import cast_string
+
+__author__ = 'Scott Maxwell'
+
+if len(sys.argv) != 2:
+ sys.stderr.write('Need one file descriptor\n')
+ sys.exit(1)
+
+listen_socket = socket.fromfd(int(sys.argv[1]), socket.AF_INET, socket.SOCK_STREAM)
+... | |
41c6a71e2a9e013966df06e3b5f458aa9a902bc8 | tests/test_core.py | tests/test_core.py | import pytest
from mock import Mock
from saleor.core.utils import (
Country, get_country_by_ip, get_currency_for_country)
@pytest.mark.parametrize('ip_data, expected_country', [
({'country': {'iso_code': 'PL'}}, Country('PL')),
({'country': {'iso_code': 'UNKNOWN'}}, None),
(None, None),
({}, None... | import pytest
from mock import Mock
from saleor.core.utils import (
Country, get_country_by_ip, get_currency_for_country, create_superuser)
from saleor.userprofile.models import User
@pytest.mark.parametrize('ip_data, expected_country', [
({'country': {'iso_code': 'PL'}}, Country('PL')),
({'country': {'i... | Add populatedb admin creation test | Add populatedb admin creation test
| Python | bsd-3-clause | car3oon/saleor,mociepka/saleor,jreigel/saleor,mociepka/saleor,tfroehlich82/saleor,maferelo/saleor,itbabu/saleor,itbabu/saleor,HyperManTT/ECommerceSaleor,KenMutemi/saleor,UITools/saleor,tfroehlich82/saleor,KenMutemi/saleor,maferelo/saleor,maferelo/saleor,UITools/saleor,mociepka/saleor,jreigel/saleor,jreigel/saleor,UIToo... | ---
+++
@@ -2,7 +2,8 @@
from mock import Mock
from saleor.core.utils import (
- Country, get_country_by_ip, get_currency_for_country)
+ Country, get_country_by_ip, get_currency_for_country, create_superuser)
+from saleor.userprofile.models import User
@pytest.mark.parametrize('ip_data, expected_country... |
1da0e093bd2a1fd70964dd0b80c0a554d46fd3e9 | src/tests/client/test_stacking.py | src/tests/client/test_stacking.py | # Copyright (c) 2016, LE GOFF Vincent
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and th... | Add tests for command stacking | Add tests for command stacking
| Python | bsd-3-clause | vlegoff/cocomud | ---
+++
@@ -0,0 +1,74 @@
+# Copyright (c) 2016, LE GOFF Vincent
+# All rights reserved.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+
+# * Redistributions of source code must retain the above copyright notice, ... | |
2dcfbc9dfecef4920a8dec9f3d2362f5ece13612 | sympy/printing/tests/test_numpy.py | sympy/printing/tests/test_numpy.py | from sympy import Piecewise
from sympy.abc import x
from sympy.printing.lambdarepr import NumPyPrinter
def test_numpy_piecewise_regression():
"""
NumPyPrinter needs to print Piecewise()'s choicelist as a list to avoid
breaking compatibility with numpy 1.8. This is not necessary in numpy 1.9+.
See gh-97... | Add test for NumPyPrinter regression | Add test for NumPyPrinter regression
| Python | bsd-3-clause | kevalds51/sympy,aktech/sympy,maniteja123/sympy,madan96/sympy,atreyv/sympy,madan96/sympy,jbbskinny/sympy,Vishluck/sympy,iamutkarshtiwari/sympy,skidzo/sympy,chaffra/sympy,jbbskinny/sympy,saurabhjn76/sympy,kaichogami/sympy,sahmed95/sympy,abhiii5459/sympy,wyom/sympy,wyom/sympy,drufat/sympy,oliverlee/sympy,kumarkrishna/symp... | ---
+++
@@ -0,0 +1,12 @@
+from sympy import Piecewise
+from sympy.abc import x
+from sympy.printing.lambdarepr import NumPyPrinter
+
+def test_numpy_piecewise_regression():
+ """
+ NumPyPrinter needs to print Piecewise()'s choicelist as a list to avoid
+ breaking compatibility with numpy 1.8. This is not nec... | |
a20255d2a2531eff982b78c15f5fc4d5cc1ec621 | tests/integration/suite/test_istio.py | tests/integration/suite/test_istio.py | import os
import pytest
import subprocess
from .common import random_str
from .conftest import cluster_and_client, ClusterContext
kube_fname = os.path.join(os.path.dirname(os.path.realpath(__file__)),
"k8s_kube_config")
istio_crd_url = "https://raw.githubusercontent.com/istio/istio/1.1.5" \
... | Add integration tests for VirtualService and DestinationRule | Add integration tests for VirtualService and DestinationRule
| Python | apache-2.0 | rancherio/rancher,rancherio/rancher,cjellick/rancher,rancher/rancher,rancher/rancher,cjellick/rancher,rancher/rancher,cjellick/rancher,rancher/rancher | ---
+++
@@ -0,0 +1,102 @@
+import os
+import pytest
+import subprocess
+from .common import random_str
+from .conftest import cluster_and_client, ClusterContext
+
+kube_fname = os.path.join(os.path.dirname(os.path.realpath(__file__)),
+ "k8s_kube_config")
+istio_crd_url = "https://raw.githubu... | |
79eff5aa96e54120f5f020ac45058088b3b77813 | tools/insert_dp_events_into_traceX.py | tools/insert_dp_events_into_traceX.py | #!/usr/bin/env python
import argparse
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
import sts.replay_event as replay_events
from sts.dataplane_traces.trace import Trace
from sts.input_traces.input_logger import InputLogger
from sts.log_processing.superlog_parser import parse
pa... | Add tool for removing need for TrafficInjection backwards compatibility | Add tool for removing need for TrafficInjection backwards compatibility
| Python | apache-2.0 | ucb-sts/sts,jmiserez/sts,ucb-sts/sts,jmiserez/sts | ---
+++
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+import argparse
+import os
+import sys
+
+sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
+import sts.replay_event as replay_events
+from sts.dataplane_traces.trace import Trace
+from sts.input_traces.input_logger import InputLogger
+from sts.log_proce... | |
86f35f14c91116c3f00e0227a2eeb10c58f20d4b | pymetabiosis/test/test_wrapper.py | pymetabiosis/test/test_wrapper.py | from pymetabiosis.module import import_module
from pymetabiosis.wrapper import MetabiosisWrapper
def test_getattr_on_module():
sqlite = import_module("sqlite")
assert isinstance(sqlite, MetabiosisWrapper)
connect = sqlite.connect
assert isinstance(connect, MetabiosisWrapper)
assert repr(connect).st... | Add a test for module.attribute | Add a test for module.attribute
| Python | mit | prabhuramachandran/pymetabiosis,rguillebert/pymetabiosis | ---
+++
@@ -0,0 +1,9 @@
+from pymetabiosis.module import import_module
+from pymetabiosis.wrapper import MetabiosisWrapper
+
+def test_getattr_on_module():
+ sqlite = import_module("sqlite")
+ assert isinstance(sqlite, MetabiosisWrapper)
+ connect = sqlite.connect
+ assert isinstance(connect, MetabiosisWr... | |
c279862c8be98d697f9340a7a5ed96cc17744b08 | icekit/admin_forms.py | icekit/admin_forms.py | from django.contrib.auth.forms import PasswordResetForm
class PasswordResetForm(PasswordResetForm):
"""
An extended Password reset form designed for staff users.
It limits the users allowed to use this form the send them a
password reset email to staff users only.
"""
def get_users(self, emai... | Add admin form for password reset to limit to staff. | Add admin form for password reset to limit to staff.
| Python | mit | ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit | ---
+++
@@ -0,0 +1,22 @@
+from django.contrib.auth.forms import PasswordResetForm
+
+
+class PasswordResetForm(PasswordResetForm):
+ """
+ An extended Password reset form designed for staff users.
+
+ It limits the users allowed to use this form the send them a
+ password reset email to staff users only.
... | |
19887c6d56761d1417b49f2e26787b9233bbdcae | Problems/newtonRaphson.py | Problems/newtonRaphson.py | #!/Applications/anaconda/envs/Python3/bin
def main():
# X^2 - 1
p_1 = (-1, 0, 1)
r_1 = newton_raphson(p_1)
print('Polynomial {} has root of {}'.format(print_poly(p_1), r_1))
# X^3 - 27
p_2 = (-27, 0, 0, 1)
r_2 = newton_raphson(p_2)
print('Polynomial {} has root of {}'.format(print_poly... | Add Newton-Raphson polynomial approximation problem | Add Newton-Raphson polynomial approximation problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,76 @@
+#!/Applications/anaconda/envs/Python3/bin
+
+def main():
+ # X^2 - 1
+ p_1 = (-1, 0, 1)
+ r_1 = newton_raphson(p_1)
+ print('Polynomial {} has root of {}'.format(print_poly(p_1), r_1))
+
+ # X^3 - 27
+ p_2 = (-27, 0, 0, 1)
+ r_2 = newton_raphson(p_2)
+ print('Polynomi... | |
7b9e7e3c2e0c6274dd4dc67621bdac6111e8d56f | improved_decorator.py | improved_decorator.py | from flask import abort, current_app, request
from functools import wraps
from twilio.util import RequestValidator
import os
def validate_twilio_request(f):
"""Validates that incoming requests genuinely originated from Twilio"""
@wraps(f)
def decorated_function(*args, **kwargs):
# Create an insta... | Add better decorator for testing | Add better decorator for testing
| Python | mit | TwilioDevEd/webhooks-example-flask | ---
+++
@@ -0,0 +1,28 @@
+from flask import abort, current_app, request
+from functools import wraps
+from twilio.util import RequestValidator
+
+import os
+
+
+def validate_twilio_request(f):
+ """Validates that incoming requests genuinely originated from Twilio"""
+ @wraps(f)
+ def decorated_function(*args... | |
0c62015b0eca96f3118ee099fb1d4f375738a888 | CodeFights/stringsRearrangement.py | CodeFights/stringsRearrangement.py | #!/usr/local/bin/python
# Code Fights Cracking Password Problem
import itertools
def stringsRearrangement(inputArray):
def f(x, y):
c = 0
for i in range(len(x)):
if x[i] != y[i]:
c += 1
if c == 1:
return True
return False
for k in iter... | Solve Code Fights strings rearrangement problem | Solve Code Fights strings rearrangement problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,55 @@
+#!/usr/local/bin/python
+# Code Fights Cracking Password Problem
+
+import itertools
+
+
+def stringsRearrangement(inputArray):
+
+ def f(x, y):
+ c = 0
+ for i in range(len(x)):
+ if x[i] != y[i]:
+ c += 1
+ if c == 1:
+ return Tr... | |
fb2f4abee96a209c2c2066ed92e9b22533f501c1 | Arrays/longest_1s_by_replacing_0.py | Arrays/longest_1s_by_replacing_0.py | import unittest
"""
Given an array of 0s and 1s, find the position of 0 to be replaced with 1 to get longest contiguous
sequence of 1s.
Input: 1 1 0 0 1 0 1 1 1 0 1 1 1
Output: index 9
Input: 1 1 1 1 0
Output: index 4
Input: 01010
Output: index 2
"""
"""
Approach:
1. The idea is to keep track of 2 indexes - prev_zero ... | Index of zero to get longest 1s | Index of zero to get longest 1s
| Python | mit | prathamtandon/g4gproblems | ---
+++
@@ -0,0 +1,53 @@
+import unittest
+"""
+Given an array of 0s and 1s, find the position of 0 to be replaced with 1 to get longest contiguous
+sequence of 1s.
+Input: 1 1 0 0 1 0 1 1 1 0 1 1 1
+Output: index 9
+Input: 1 1 1 1 0
+Output: index 4
+Input: 01010
+Output: index 2
+"""
+
+"""
+Approach:
+1. The idea ... | |
c2592b39fde98ac8ba46c165deb4a1245954f3a1 | tests/test_crawler.py | tests/test_crawler.py | import warnings
import unittest
from scrapy.crawler import Crawler
from scrapy.settings import Settings
from scrapy.utils.spider import DefaultSpider
from scrapy.utils.misc import load_object
class CrawlerTestCase(unittest.TestCase):
def setUp(self):
self.crawler = Crawler(DefaultSpider, Settings())
... | import warnings
import unittest
from twisted.internet import defer
from scrapy.crawler import Crawler, CrawlerRunner
from scrapy.settings import Settings
from scrapy.utils.spider import DefaultSpider
from scrapy.utils.misc import load_object
class CrawlerTestCase(unittest.TestCase):
def setUp(self):
se... | Test verifying that CrawlerRunner populates spider class settings | Test verifying that CrawlerRunner populates spider class settings
| Python | bsd-3-clause | elijah513/scrapy,darkrho/scrapy-scrapy,hansenDise/scrapy,dracony/scrapy,eliasdorneles/scrapy,URXtech/scrapy,olorz/scrapy,dgillis/scrapy,nguyenhongson03/scrapy,crasker/scrapy,heamon7/scrapy,kimimj/scrapy,Djlavoy/scrapy,nikgr95/scrapy,Timeship/scrapy,eLRuLL/scrapy,jdemaeyer/scrapy,finfish/scrapy,github-account-because-th... | ---
+++
@@ -1,7 +1,9 @@
import warnings
import unittest
-from scrapy.crawler import Crawler
+from twisted.internet import defer
+
+from scrapy.crawler import Crawler, CrawlerRunner
from scrapy.settings import Settings
from scrapy.utils.spider import DefaultSpider
from scrapy.utils.misc import load_object
@@ -2... |
f6fabf476e49d0d857217c428ed2ad1af7f034cd | candidates/management/commands/candidates_delete_everything_from_popit.py | candidates/management/commands/candidates_delete_everything_from_popit.py | import json
from candidates.models import PopItPerson
from candidates.popit import PopItApiMixin, get_base_url
from django.core.management.base import BaseCommand
class Command(PopItApiMixin, BaseCommand):
def handle(self, **options):
message = "WARNING: this will delete all people, posts, " \
... | Add a command to delete all objects from PopIt | Add a command to delete all objects from PopIt
| Python | agpl-3.0 | YoQuieroSaber/yournextrepresentative,datamade/yournextmp-popit,neavouli/yournextrepresentative,YoQuieroSaber/yournextrepresentative,datamade/yournextmp-popit,DemocracyClub/yournextrepresentative,YoQuieroSaber/yournextrepresentative,neavouli/yournextrepresentative,neavouli/yournextrepresentative,mysociety/yournextrepres... | ---
+++
@@ -0,0 +1,38 @@
+import json
+
+from candidates.models import PopItPerson
+from candidates.popit import PopItApiMixin, get_base_url
+
+from django.core.management.base import BaseCommand
+
+class Command(PopItApiMixin, BaseCommand):
+
+ def handle(self, **options):
+ message = "WARNING: this will d... | |
e9605dd5432806435dec26f7e23ebdf25074943b | blueLed.py | blueLed.py | '''
Dr Who Box: Blue Effects LED
'''
from __future__ import print_function
import RPi.GPIO as GPIO
import time
from multiprocessing import Process
import math
# Define PINS
LED = 18
# Use numbering based on P1 header
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(LED, GPIO.OUT, GPIO.LOW)
def pulsate... | Add stand-alone demo of pulsating LED using multiprocess. | Add stand-alone demo of pulsating LED using multiprocess.
| Python | mit | davidb24v/drwho | ---
+++
@@ -0,0 +1,57 @@
+'''
+
+Dr Who Box: Blue Effects LED
+
+'''
+
+from __future__ import print_function
+import RPi.GPIO as GPIO
+import time
+from multiprocessing import Process
+import math
+
+# Define PINS
+LED = 18
+
+# Use numbering based on P1 header
+GPIO.setmode(GPIO.BOARD)
+GPIO.setwarnings(False)
+GPI... | |
93e5e1b8d36e6488044c619e9015aa2e7c5ab29b | dynamic_programming/edit_distance.py | dynamic_programming/edit_distance.py | """
Author : Turfa Auliarachman
Date : October 12, 2016
This is a pure Python implementation of Dynamic Programming solution to the edit distance problem.
The problem is :
Given two strings A and B. Find the minimum number of operations to string B such that A = B. The permitted operations are removal, insertion... | Add Edit Distance DP Algorithm | Add Edit Distance DP Algorithm
| Python | mit | TheAlgorithms/Python | ---
+++
@@ -0,0 +1,74 @@
+"""
+Author : Turfa Auliarachman
+Date : October 12, 2016
+
+This is a pure Python implementation of Dynamic Programming solution to the edit distance problem.
+
+The problem is :
+Given two strings A and B. Find the minimum number of operations to string B such that A = B. The permitted... | |
3a08fa5f2dba14c2527f1a381d6bb7dbaaf94553 | dhash.py | dhash.py | '''
- a way to separate entries by key to know which machine to store it at
- eviction strategy:
* FIFO
* LRU
* LFU
- access pattern:
* write-thru
* write-around
* write-back
- latency vs consistency vs availability
- how would multithreading work? locks?
- collision resolution method
- resizing
* consistent hashing
* ... | Add basic config functionality and stubs for MockNode, MockDB, as well as different resizing methods, access patterns and eviction strategies. | Add basic config functionality and stubs for MockNode, MockDB, as well as different resizing methods, access patterns and eviction strategies.
| Python | mit | gudnm/dhash | ---
+++
@@ -0,0 +1,77 @@
+'''
+- a way to separate entries by key to know which machine to store it at
+- eviction strategy:
+* FIFO
+* LRU
+* LFU
+- access pattern:
+* write-thru
+* write-around
+* write-back
+- latency vs consistency vs availability
+- how would multithreading work? locks?
+- collision resolution m... | |
67320776e7c93004d023c71f6e855fea88f03d7c | statsmodels/tsa/tests/test_x13.py | statsmodels/tsa/tests/test_x13.py | from nose import SkipTest
from numpy.testing import assert_
from statsmodels.tsa.base.datetools import dates_from_range
from statsmodels.tsa.x12 import _find_x12, select_arima_order
x13path = _find_x12()
if x13path is False:
_have_x13 = False
else:
_have_x13 = True
class TestX13(object):
@classmethod
... | Add some smoke tests for x12/x13 | TST: Add some smoke tests for x12/x13
| Python | bsd-3-clause | gef756/statsmodels,adammenges/statsmodels,musically-ut/statsmodels,hlin117/statsmodels,josef-pkt/statsmodels,statsmodels/statsmodels,saketkc/statsmodels,DonBeo/statsmodels,saketkc/statsmodels,alekz112/statsmodels,ChadFulton/statsmodels,wzbozon/statsmodels,bashtage/statsmodels,DonBeo/statsmodels,wwf5067/statsmodels,asto... | ---
+++
@@ -0,0 +1,53 @@
+from nose import SkipTest
+from numpy.testing import assert_
+
+from statsmodels.tsa.base.datetools import dates_from_range
+from statsmodels.tsa.x12 import _find_x12, select_arima_order
+
+x13path = _find_x12()
+
+if x13path is False:
+ _have_x13 = False
+else:
+ _have_x13 = True
+
+c... | |
bd79e93b12f2d0563492a2c89813927d18c06ac1 | tensorflow/python/tpu/__init__.py | tensorflow/python/tpu/__init__.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Initialize TPU_ML_PLATFORM env variable with `Tensorflow`. | Initialize TPU_ML_PLATFORM env variable with `Tensorflow`.
PiperOrigin-RevId: 474832980
| Python | apache-2.0 | paolodedios/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/... | ---
+++
@@ -15,3 +15,5 @@
"""Ops related to Tensor Processing Units."""
+import os
+os.environ['TPU_ML_PLATFORM'] = 'Tensorflow' |
6aace4f414aa004551b03702c1dd2f5b5e9c8143 | tests/test_caster.py | tests/test_caster.py | """Additional tests for the caster to ensure full code coverage.
"""
import pytest
def test_corner():
from aflow.caster import cast
assert cast("numbers", "spinD", None) is None
assert cast("numbers", "spinD", "garbage") is None
| Increase test coverage for corner cases. | Increase test coverage for corner cases.
| Python | mit | rosenbrockc/aflow | ---
+++
@@ -0,0 +1,7 @@
+"""Additional tests for the caster to ensure full code coverage.
+"""
+import pytest
+def test_corner():
+ from aflow.caster import cast
+ assert cast("numbers", "spinD", None) is None
+ assert cast("numbers", "spinD", "garbage") is None | |
7de33228e89139605f7eb20ebd7ba3192306c123 | dataedit/management/commands/mirror.py | dataedit/management/commands/mirror.py | from django.core.management.base import BaseCommand, CommandError
from sqlalchemy.orm.session import sessionmaker
from api.connection import _get_engine
from dataedit.models import Table
from dataedit.views import schema_whitelist
import sqlalchemy as sqla
class Command(BaseCommand):
def handle(self, *args, **opt... | Add transition method for legacy databases | Add transition method for legacy databases
| Python | agpl-3.0 | openego/oeplatform,openego/oeplatform,openego/oeplatform,openego/oeplatform | ---
+++
@@ -0,0 +1,19 @@
+from django.core.management.base import BaseCommand, CommandError
+from sqlalchemy.orm.session import sessionmaker
+from api.connection import _get_engine
+from dataedit.models import Table
+from dataedit.views import schema_whitelist
+import sqlalchemy as sqla
+
+
+class Command(BaseCommand... | |
e4e70331e95a515d669e576ebcdb854d141a5a84 | Tools/remove-trailing-whitespace.py | Tools/remove-trailing-whitespace.py | #!/usr/bin/python
# This file is a part of the OpenSurgSim project.
# Copyright 2012-2013, SimQuest Solutions Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | Add a script to remove trailing whitespace from a file. | Add a script to remove trailing whitespace from a file.
Typical usage:
Tools/remove-trailing-whitespace.py Foo.h
or:
find SurgSim \( -name '*.h' -o -name '*.cpp' \) -print \
| xargs python Tools/remove-trailing-whitespace.py
| Python | apache-2.0 | simquest/opensurgsim,simquest/opensurgsim,simquest/opensurgsim,simquest/opensurgsim | ---
+++
@@ -0,0 +1,76 @@
+#!/usr/bin/python
+
+# This file is a part of the OpenSurgSim project.
+# Copyright 2012-2013, SimQuest Solutions Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the Lic... | |
960a12ee047a915e29258fcafcf642be11b838ed | overlay/DataRegion.py | overlay/DataRegion.py | class DataRegion:
def __init__(self):
self.data = []
def addTimeData(self, data_time, data_value):
self.data.append((data_time, data_value))
def isTimeInRegion(self, secs_since_epoch):
return self.data[0][0] <= secs_since_epoch <= self.data[-1][0]
def dataInTimeRegion(self, st... | Create class to hold regions of data | Create class to hold regions of data
| Python | mit | gizmo-cda/g2x,gizmo-cda/g2x,gizmo-cda/g2x,gizmo-cda/g2x,thelonious/g2x,thelonious/g2x | ---
+++
@@ -0,0 +1,52 @@
+class DataRegion:
+ def __init__(self):
+ self.data = []
+
+ def addTimeData(self, data_time, data_value):
+ self.data.append((data_time, data_value))
+
+ def isTimeInRegion(self, secs_since_epoch):
+ return self.data[0][0] <= secs_since_epoch <= self.data[-1][0... | |
6373384ddc2836fc23db27d1b230b9f4228a0e38 | bluebottle/cms/migrations/0062_auto_20200812_1514.py | bluebottle/cms/migrations/0062_auto_20200812_1514.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2020-07-17 08:37
from __future__ import unicode_literals
from django.core.exceptions import ObjectDoesNotExist
from django.db import migrations, models, connection
from django.utils.translation import activate, _trans
from tenant_extras.middleware import tenant_... | Add migration that deletes old statscontent objects from homepage | Add migration that deletes old statscontent objects from homepage
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.15 on 2020-07-17 08:37
+from __future__ import unicode_literals
+
+from django.core.exceptions import ObjectDoesNotExist
+from django.db import migrations, models, connection
+from django.utils.translation import activate, _trans
+from tena... | |
aa43336c74376ac9ea70ee407d936c28cfc7ccab | MOS6502.py | MOS6502.py | class Register(object):
def __init__(self, name, bitwidth):
self.name = name
self.value = 0
self.past = [0] # maybe for rewind?
self.symbVal = [z3.BitVec(self.name, bitwidth)] # maybe for
# symbolic
... | Add register and CPU stuff | Add register and CPU stuff
| Python | bsd-2-clause | pusscat/refNes | ---
+++
@@ -0,0 +1,55 @@
+class Register(object):
+ def __init__(self, name, bitwidth):
+ self.name = name
+ self.value = 0
+ self.past = [0] # maybe for rewind?
+ self.symbVal = [z3.BitVec(self.name, bitwidth)] # maybe for
+ # sym... | |
2f143f3eeaff68b2d871d4cc8e6c1e212bdf246b | tools/trigger-job.py | tools/trigger-job.py | #!/usr/bin/env python
# Copyright 2013 OpenStack Foundation
#
# 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 applicab... | Add manual job triggering script. | Add manual job triggering script.
Change-Id: Ic396c845e5f61a98d3b0e8c3fc08c6f9dbfffc6a
Reviewed-on: https://review.openstack.org/34437
Reviewed-by: Jeremy Stanley <98883b97e35b7bb1ac282bb863f2e9d917db0454@yuggoth.org>
Approved: Clark Boylan <635fc31d01fa593720982fa0568e87170cedbe2c@gmail.com>
Reviewed-by: Clark Boylan... | Python | apache-2.0 | devdattakulkarni/zuul_messaging,devdattakulkarni/zuul_messaging,gooddata/zuul,gooddata/zuul,wikimedia/integration-zuul,wikimedia/integration-zuul,gooddata/zuul,gooddata/zuul,wikimedia/integration-zuul,devdattakulkarni/zuul_messaging,gooddata/zuul,wikimedia/integration-zuul | ---
+++
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+# Copyright 2013 OpenStack Foundation
+#
+# 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-... | |
e9619cdf7292de21a97562cdc068be7d26402cac | readthedocs/oauth/management/commands/sync_vcs_data.py | readthedocs/oauth/management/commands/sync_vcs_data.py | from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from readthedocs.oauth.tasks import sync_remote_repositories
class Command(BaseCommand):
help = "Sync OAuth RemoteRepository and RemoteOrganization"
def add_arguments(self, parser):
parser.add_argument(
... | Add manafement command to Sync RemoteRepositories and RemoteOrganizations | Add manafement command to Sync RemoteRepositories and RemoteOrganizations
| Python | mit | rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org | ---
+++
@@ -0,0 +1,74 @@
+from django.contrib.auth.models import User
+from django.core.management.base import BaseCommand
+
+from readthedocs.oauth.tasks import sync_remote_repositories
+
+
+class Command(BaseCommand):
+ help = "Sync OAuth RemoteRepository and RemoteOrganization"
+
+ def add_arguments(self, pa... | |
f96919f5091126c96082acdcf430df9b93a97d06 | migrations/versions/0378_remove_doc_download_perm.py | migrations/versions/0378_remove_doc_download_perm.py | """
Revision ID: 0378_remove_doc_download_perm
Revises: 0377_populate_org_brand_pools
Create Date: 2022-10-12 11:55:28.906151
"""
from alembic import op
revision = "0378_remove_doc_download_perm"
down_revision = "0377_populate_org_brand_pools"
def upgrade():
op.execute("DELETE FROM service_permissions WHERE pe... | Remove temp doc download service perms | Remove temp doc download service perms
We added a service permission to gate the new document download security
features. Now that these have been released, let's remove the
permission.
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,20 @@
+"""
+
+Revision ID: 0378_remove_doc_download_perm
+Revises: 0377_populate_org_brand_pools
+Create Date: 2022-10-12 11:55:28.906151
+
+"""
+from alembic import op
+
+revision = "0378_remove_doc_download_perm"
+down_revision = "0377_populate_org_brand_pools"
+
+
+def upgrade():
+ op.execute... | |
d82a6fa96391630a17520c7ff8dbb23918c2a8aa | test/conserve-p/lj-fluid.py | test/conserve-p/lj-fluid.py | #! /usr/bin/env hoomd
from hoomd_script import *
init.create_random(N=10000, phi_p=0.2)
lj = pair.lj(r_cut=2.5)
lj.pair_coeff.set('A', 'A', epsilon=1.0, sigma=1.0, alpha=1.0)
all = group.all()
integrate.mode_standard(dt=0.005)
integrate.nvt(group=all, T=1.2, tau=0.5)
analyze.log(filename = 'thermo.log', quantities ... | Test script for evaluating momentum conservation | Test script for evaluating momentum conservation
git-svn-id: 0c14c15b0cdbdea73634a2d7d7d743954bb0522f@3197 fa922fa7-2fde-0310-acd8-f43f465a7996
| Python | bsd-3-clause | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | ---
+++
@@ -0,0 +1,15 @@
+#! /usr/bin/env hoomd
+
+from hoomd_script import *
+
+init.create_random(N=10000, phi_p=0.2)
+lj = pair.lj(r_cut=2.5)
+lj.pair_coeff.set('A', 'A', epsilon=1.0, sigma=1.0, alpha=1.0)
+
+all = group.all()
+integrate.mode_standard(dt=0.005)
+integrate.nvt(group=all, T=1.2, tau=0.5)
+
+analyze.... | |
7cb7fa17720864669ac1e0c3fe361e3925415169 | client/python/plot_request_times.py | client/python/plot_request_times.py | import requests
r = requests.get('http://localhost:8081/monitor_results/1')
print(r.json())
for monitoring_data in r.json():
print 'URL: ' + monitoring_data['urlToMonitor']['url']
| Add stub for python client | Add stub for python client
| Python | mit | gernd/simple-site-mon | ---
+++
@@ -0,0 +1,6 @@
+import requests
+
+r = requests.get('http://localhost:8081/monitor_results/1')
+print(r.json())
+for monitoring_data in r.json():
+ print 'URL: ' + monitoring_data['urlToMonitor']['url'] | |
7e5982299e8b5b07239f7fb1aa088e7eafd08f88 | tardis/montecarlo/enum.py | tardis/montecarlo/enum.py | from ctypes import c_int
class EnumerationType(type(c_int)):
def __new__(metacls, name, bases, dictionary):
if not "_members_" in dictionary:
_members_ = {}
for key, value in dictionary.items():
if not key.startswith("_"):
_members_[key] = value
... | Add metaclass and class for CEnumeration adoption. | Add metaclass and class for CEnumeration adoption.
| Python | bsd-3-clause | kaushik94/tardis,Tobychev/tardis,kaushik94/tardis,Tobychev/tardis,Tobychev/tardis,orbitfold/tardis,orbitfold/tardis,kaushik94/tardis,orbitfold/tardis,orbitfold/tardis,kaushik94/tardis | ---
+++
@@ -0,0 +1,32 @@
+from ctypes import c_int
+
+
+class EnumerationType(type(c_int)):
+ def __new__(metacls, name, bases, dictionary):
+ if not "_members_" in dictionary:
+ _members_ = {}
+ for key, value in dictionary.items():
+ if not key.startswith("_"):
+ ... | |
a5d99114ac3c7d146f0874744d6a54b27e9a990f | search/generate_db.py | search/generate_db.py | from random_words import RandomWords
from faker import Factory
import random
import sqlite3
NUM_GENERATE = 100
CATEGORIES = ['miscellaneous', 'appliance', 'bedding', 'toys', 'books', 'clothing',
'seasonal', 'electronics', 'household', 'kitchen', 'sports']
def generate_postings(count):
postings = []
for i in range... | Implement auto generate db postings | Implement auto generate db postings
| Python | mit | njbbaer/give-get-green,njbbaer/give-get-green,njbbaer/give-get-green | ---
+++
@@ -0,0 +1,45 @@
+from random_words import RandomWords
+from faker import Factory
+import random
+import sqlite3
+
+NUM_GENERATE = 100
+
+CATEGORIES = ['miscellaneous', 'appliance', 'bedding', 'toys', 'books', 'clothing',
+ 'seasonal', 'electronics', 'household', 'kitchen', 'sports']
+
+def generate_postings(... | |
881d7ed1e2ad8be504c02d29ccaaac4e12ea0605 | scripts/band_width.py | scripts/band_width.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
__author__ = "Yuji Ikeda"
from ph_plotter.common_arguments_adder import CommonArgumentsAdder
def run(variables):
from ph_plotter.band_error_plotter import Ba... | Add the script to plot band structures with bandwidths | Add the script to plot band structures with bandwidths
| Python | mit | yuzie007/ph_plotter | ---
+++
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+from __future__ import (absolute_import, division,
+ print_function, unicode_literals)
+
+__author__ = "Yuji Ikeda"
+
+from ph_plotter.common_arguments_adder import CommonArgumentsAdder
+
+
+def run(variables):
+ from ... | |
e567bdb0ed315f6e00be7d541e5d034fe926eeb6 | scripts/migration/migrate_citation_addons_list_id.py | scripts/migration/migrate_citation_addons_list_id.py | import logging
import sys
from modularodm import Q
from framework.mongo import database
from framework.transactions.context import TokuTransaction
from website.app import init_app
from scripts import utils as script_utils
logger = logging.getLogger(__name__)
PROVIDERS = ['mendeley', 'zotero']
def migrate_list_id_... | Add migration script for [citations]nodesettings <provider>_list_id --> list_id | Add migration script for [citations]nodesettings
<provider>_list_id --> list_id
| Python | apache-2.0 | mfraezz/osf.io,leb2dg/osf.io,asanfilippo7/osf.io,chennan47/osf.io,kch8qx/osf.io,brianjgeiger/osf.io,hmoco/osf.io,monikagrabowska/osf.io,caseyrollins/osf.io,SSJohns/osf.io,alexschiller/osf.io,mattclark/osf.io,doublebits/osf.io,HalcyonChimera/osf.io,acshi/osf.io,zamattiac/osf.io,felliott/osf.io,chrisseto/osf.io,CenterFor... | ---
+++
@@ -0,0 +1,95 @@
+import logging
+import sys
+
+from modularodm import Q
+
+from framework.mongo import database
+from framework.transactions.context import TokuTransaction
+
+from website.app import init_app
+from scripts import utils as script_utils
+
+logger = logging.getLogger(__name__)
+
+PROVIDERS = ['m... | |
361ca05d2ba9662551b688b1d7867edbec8d9705 | unittests/test_roles.py | unittests/test_roles.py | import pytest
@pytest.fixture
def mockctl(testdir):
testdir.makepyfile(mockctl="""
import mock
pytest_plugins = 'sangoma.lab.roles'
def pytest_lab_addroles(rolemanager):
rolemanager.register('mock', mock.Mock())
""")
def test_manage_location(testdir):
testdir.makecon... | Add unit tests for basic role stuff | Add unit tests for basic role stuff
| Python | mpl-2.0 | sangoma/pytestlab | ---
+++
@@ -0,0 +1,87 @@
+import pytest
+
+
+@pytest.fixture
+def mockctl(testdir):
+ testdir.makepyfile(mockctl="""
+ import mock
+ pytest_plugins = 'sangoma.lab.roles'
+
+ def pytest_lab_addroles(rolemanager):
+ rolemanager.register('mock', mock.Mock())
+ """)
+
+
+def test_man... | |
e6866b5e186600d88a61684c8f35c59c4fcc228f | utils/indirect_calls.py | utils/indirect_calls.py | #!/usr/bin/env python
"""A tool for looking for indirect jumps and calls in x86 binaries.
Helpful to verify whether or not retpoline mitigations are catching
all of the indirect branches in a binary and telling you which
functions the remaining ones are in (assembly, etc).
Depends on llvm-objdump being i... | Add a wrapper around llvm-objdump to look for indirect calls/jmps in x86 assembly. | Add a wrapper around llvm-objdump to look for indirect calls/jmps in x86 assembly.
Useful when looking for indirect calls/jmps the need mitigation
via retpoline or other mitigations for Spectre v2.
Feedback, extension, additional patches welcome.
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@329050 91177308-0... | Python | apache-2.0 | llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,apple/swift-llvm,llvm-mirror/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm... | ---
+++
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+
+"""A tool for looking for indirect jumps and calls in x86 binaries.
+
+ Helpful to verify whether or not retpoline mitigations are catching
+ all of the indirect branches in a binary and telling you which
+ functions the remaining ones are in (assembly, etc).
+... | |
34e875d1d876f05b3d5bb50f38ae61a7c48ea42b | server/migrations/0080_auto_20190202_1020.py | server/migrations/0080_auto_20190202_1020.py | # Generated by Django 2.1.4 on 2019-02-02 15:20
from django.db import migrations, models
import django.db.models.deletion
import ulid2
class Migration(migrations.Migration):
dependencies = [
('server', '0079_auto_20181211_1028'),
]
operations = [
migrations.CreateModel(
name... | Add in migration for ManagedItem, MangementSource. | Add in migration for ManagedItem, MangementSource.
| Python | apache-2.0 | sheagcraig/sal,salopensource/sal,sheagcraig/sal,salopensource/sal,sheagcraig/sal,salopensource/sal,sheagcraig/sal,salopensource/sal | ---
+++
@@ -0,0 +1,38 @@
+# Generated by Django 2.1.4 on 2019-02-02 15:20
+
+from django.db import migrations, models
+import django.db.models.deletion
+import ulid2
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('server', '0079_auto_20181211_1028'),
+ ]
+
+ operations = [
+ ... | |
f96c393611e07b31fe31bb44f7dc1729172483f0 | test_inclination.py | test_inclination.py | import numpy as np
from astropy import units as u
from poliastro.bodies import Earth
from poliastro.twobody import State
from poliastro.twobody.propagation import cowell
from poliastro.util import norm
def test_inclination():
a_0 = 7000.0
i_0 = (28.5 * u.deg).to(u.rad).value
f = 3.5e-7
k = Earth.k.... | Add test to study the change in inclination only | Add test to study the change in inclination only
| Python | mit | Juanlu001/pfc-uc3m | ---
+++
@@ -0,0 +1,54 @@
+import numpy as np
+
+from astropy import units as u
+
+from poliastro.bodies import Earth
+from poliastro.twobody import State
+from poliastro.twobody.propagation import cowell
+from poliastro.util import norm
+
+
+def test_inclination():
+ a_0 = 7000.0
+ i_0 = (28.5 * u.deg).to(u.rad... | |
3287e9d1814cdc9fec61d5ad5888168f08d44e70 | pyp2c.py | pyp2c.py | #!/usr/bin/env python
import sys
import argparse
def _description():
return 'A C preprocessor that interprets python'
""" The usage
We do override the usage since the one given by `argparse` put the positional
arguments at the end of it.
"""
def _usage():
return 'usage: pyp2c.py [-h] FILES ... --the... | Add very basic handling of options | Add very basic handling of options
| Python | mit | ccharly/pyaspp,ccharly/pyaspp,lisqlql/pyaspp,lisqlql/pyaspp | ---
+++
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+import sys
+import argparse
+
+def _description():
+ return 'A C preprocessor that interprets python'
+
+""" The usage
+
+ We do override the usage since the one given by `argparse` put the positional
+ arguments at the end of it.
+"""
+def _usage():
+ re... | |
a8e3209663a5268b029214964e2db7faf2d8cf36 | scripts/calculate_cell_areas.py | scripts/calculate_cell_areas.py | """Script to calculate cell areas from a curated image of cell outlines.
Outputs csv file with cell areas as well as an image where the colour
of each cell represents its area.
"""
import os
import logging
import argparse
from jicbioimage.core.image import Image
from jicbioimage.core.io import AutoName, AutoWrite
f... | Add initial script for calculating cell areas | Add initial script for calculating cell areas
| Python | mit | JIC-Image-Analysis/semi-automated-leaf-segmentation,JIC-Image-Analysis/semi-automated-leaf-segmentation | ---
+++
@@ -0,0 +1,84 @@
+"""Script to calculate cell areas from a curated image of cell outlines.
+
+Outputs csv file with cell areas as well as an image where the colour
+of each cell represents its area.
+"""
+
+import os
+import logging
+import argparse
+
+from jicbioimage.core.image import Image
+from jicbioimag... | |
17da1f5053a66e35ed1955a1cf716fac667f5859 | py/postResultsTest.py | py/postResultsTest.py | import urllib
import urllib2
url = 'http://app.dev.inowas.com/api/results.json'
params = urllib.urlencode({
'id': '1',
'propertyType': 'gwHead',
'width': 4,
'height': 4,
'upperLeftX': 0.005,
'upperLeftY': 0.005,
'scaleX': 1,
'scaleY': 1,
'skewX': 0,
'skewY': 0,
'srid': 4326,... | Add python folder with a rest-test-file | Add python folder with a rest-test-file
| Python | mit | inowas/inowas,inowas/inowas_api,inowas/inowas,inowas/inowas_api,inowas/inowas_api,inowas/inowas,inowas/inowas,inowas/inowas_api | ---
+++
@@ -0,0 +1,24 @@
+import urllib
+import urllib2
+
+url = 'http://app.dev.inowas.com/api/results.json'
+params = urllib.urlencode({
+ 'id': '1',
+ 'propertyType': 'gwHead',
+ 'width': 4,
+ 'height': 4,
+ 'upperLeftX': 0.005,
+ 'upperLeftY': 0.005,
+ 'scaleX': 1,
+ 'scaleY': 1,
+ 'ske... | |
b16ed06e1b0c5fb1b189e1992e13726bda99fd68 | examples/plot_pmt_time_slewing.py | examples/plot_pmt_time_slewing.py | # -*- coding: utf-8 -*-
"""
==================
PMT Time Slewing
==================
Show different variants of PMT time slewing calculations.
Variant 3 is currently (as of 2020-10-16) what's also used in Jpp.
"""
# Author: Tamas Gal <tgal@km3net.de>
# License: BSD-3
import km3pipe as kp
import numpy as np
import m... | Add PMT time slewing example | Add PMT time slewing example
| Python | mit | tamasgal/km3pipe,tamasgal/km3pipe | ---
+++
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+"""
+
+==================
+PMT Time Slewing
+==================
+
+Show different variants of PMT time slewing calculations.
+
+Variant 3 is currently (as of 2020-10-16) what's also used in Jpp.
+
+"""
+
+# Author: Tamas Gal <tgal@km3net.de>
+# License: BSD-3
+
+impo... | |
81c6d9664d08c72347ff8e1c7550ef53987dd8a0 | olympiad/sum.py | olympiad/sum.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2014 Fabian M.
#
# 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... | Add solution for test problem | Add solution for test problem
| Python | apache-2.0 | fabianm/olympiad,fabianm/olympiad,fabianm/olympiad | ---
+++
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright 2014 Fabian M.
+#
+# 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/lic... | |
fb2f00f0780ce447b985aedf5d13a36c4fcff4b1 | dipy/core/tests/test_propagation.py | dipy/core/tests/test_propagation.py | import numpy as np
import dipy as dp
import nibabel as ni
from nose.tools import assert_true, assert_false, \
assert_equal, assert_raises
from numpy.testing import assert_array_equal, assert_array_almost_equal
def test_fact():
pass
| TEST - new test file added for propagation | TEST - new test file added for propagation
| Python | bsd-3-clause | rfdougherty/dipy,samuelstjean/dipy,jyeatman/dipy,beni55/dipy,StongeEtienne/dipy,oesteban/dipy,beni55/dipy,demianw/dipy,maurozucchelli/dipy,maurozucchelli/dipy,matthieudumont/dipy,FrancoisRheaultUS/dipy,Messaoud-Boudjada/dipy,maurozucchelli/dipy,JohnGriffiths/dipy,oesteban/dipy,StongeEtienne/dipy,samuelstjean/dipy,mdesc... | ---
+++
@@ -0,0 +1,14 @@
+import numpy as np
+import dipy as dp
+import nibabel as ni
+
+from nose.tools import assert_true, assert_false, \
+ assert_equal, assert_raises
+
+from numpy.testing import assert_array_equal, assert_array_almost_equal
+
+
+def test_fact():
+
+ pass
+ | |
0e6fc9de3aaeec9d82bc6087b2ad1d8ef17d3c67 | contrib/inventory/lxc_inventory.py | contrib/inventory/lxc_inventory.py | #!/usr/bin/env python
#
# (c) 2015-16 Florian Haas, hastexo Professional Services GmbH
# <florian@hastexo.com>
# Based in part on:
# libvirt_lxc.py, (c) 2013, Michael Scherer <misc@zarb.org>
#
# This file is part of Ansible,
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the... | Add inventory script for LXC containers | Add inventory script for LXC containers
Enables an LXC server's configuration as an inventory source for LXC
containers.
In LXC, containers can be defined with an "lxc.group" configuration
option that is normally used with lxc-autostart -g. Here, we are using
the same option to build Ansible inventory groups.
In add... | Python | mit | thaim/ansible,thaim/ansible | ---
+++
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+#
+# (c) 2015-16 Florian Haas, hastexo Professional Services GmbH
+# <florian@hastexo.com>
+# Based in part on:
+# libvirt_lxc.py, (c) 2013, Michael Scherer <misc@zarb.org>
+#
+# This file is part of Ansible,
+#
+# Ansible is free software: you can redistribute it and/... | |
b0648969f03dfa1cd55cf1f201883ec82afd97be | test/test_command_parser.py | test/test_command_parser.py | from string import ascii_letters
import pytest
from nex.codes import CatCode
from nex.instructions import Instructions
from nex.instructioner import (Instructioner,
make_unexpanded_control_sequence_instruction,
char_cat_instr_tok)
from nex.utils import asc... | Add test for command parsing, without executing | Add test for command parsing, without executing
| Python | mit | eddiejessup/nex | ---
+++
@@ -0,0 +1,89 @@
+from string import ascii_letters
+
+import pytest
+
+from nex.codes import CatCode
+from nex.instructions import Instructions
+from nex.instructioner import (Instructioner,
+ make_unexpanded_control_sequence_instruction,
+ char_cat_... | |
5c66a9d8c7b53338d37ef9e959e55e14511f7c84 | packages/Python/lldbsuite/test/commands/gui/invalid-args/TestInvalidArgsGui.py | packages/Python/lldbsuite/test/commands/gui/invalid-args/TestInvalidArgsGui.py | import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
class GuiTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
TestBase.setUp(self)
@no_debug_info_test
def test_reproducer_generate_invalid_invocation(self):
self.expect... | Add test for invalid gui command | [lldb][NFC] Add test for invalid gui command
git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@370647 91177308-0d34-0410-b5e6-96231b3b80d8
| Python | apache-2.0 | llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb | ---
+++
@@ -0,0 +1,15 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+
+class GuiTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ TestBase.setUp(self)
+
+ @no_debug_info_test
+ def test_reproducer_generate_inval... | |
5056586586becb94bba265bdd90e46f2e2366534 | factory/checkFactory.py | factory/checkFactory.py | #!/bin/env python
#
# Description:
# Check if a glideinFactory is running
#
# Arguments:
# $1 = glidein submit_dir (i.e. factory dir)
#
# Author:
# Igor Sfiligoi Jul 9th 2008
#
import sys
import glideFactoryPidLib
try:
startup_dir=sys.argv[1]
factory_pid=glideFactoryPidLib.get_gfactory_pid(startup_dir)... | Check if a glideinFactory is running | Check if a glideinFactory is running
| Python | bsd-3-clause | holzman/glideinwms-old,bbockelm/glideinWMS,bbockelm/glideinWMS,bbockelm/glideinWMS,holzman/glideinwms-old,holzman/glideinwms-old,bbockelm/glideinWMS | ---
+++
@@ -0,0 +1,25 @@
+#!/bin/env python
+#
+# Description:
+# Check if a glideinFactory is running
+#
+# Arguments:
+# $1 = glidein submit_dir (i.e. factory dir)
+#
+# Author:
+# Igor Sfiligoi Jul 9th 2008
+#
+
+import sys
+import glideFactoryPidLib
+
+try:
+ startup_dir=sys.argv[1]
+ factory_pid=gli... | |
e7cf50d3f1b751e695f6d7bd1ca1bbe4a4e067cc | scripts/odom_trace.py | scripts/odom_trace.py | #!/usr/bin/env python
'''
Copyright 2016 William Baskin
/*****************************************
LICENSE SUMMARY
This package is licensed under the
MIT License. Please see the LICENSE.md
file in the root folder for the
complete license.
*****************************************/
Odom Trace
Reco... | Create a ros node for storing, replaying a robot's position | Create a ros node for storing, replaying a robot's position
| Python | mit | buckbaskin/drive_stack,buckbaskin/drive_stack,buckbaskin/drive_stack | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+
+'''
+Copyright 2016 William Baskin
+
+/*****************************************
+ LICENSE SUMMARY
+
+ This package is licensed under the
+ MIT License. Please see the LICENSE.md
+ file in the root folder for the
+ complete license.
+
+ *********************... | |
7bdc7e6002d837f7362f58f13e53e504e9de77e0 | examples/python/download_package.py | examples/python/download_package.py | #!/usr/bin/env python
"""
librepo - download a package
"""
import os
import sys
import shutil
from pprint import pprint
import librepo
DESTDIR = "downloaded_metadata"
PROGRESSBAR_LEN = 40
finished = False
def callback(data, total_to_download, downloaded):
"""Progress callback"""
global finished
if tot... | Add example of downloading a package | example: Add example of downloading a package
| Python | lgpl-2.1 | cgwalters/librepo,Conan-Kudo/librepo,Tojaj/librepo,cgwalters/librepo,Conan-Kudo/librepo,rpm-software-management/librepo,rpm-software-management/librepo,rpm-software-management/librepo,bgamari/librepo,Conan-Kudo/librepo,rholy/librepo,Tojaj/librepo,bgamari/librepo,rholy/librepo,rholy/librepo,bgamari/librepo,Tojaj/librepo... | ---
+++
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+"""
+librepo - download a package
+"""
+
+import os
+import sys
+import shutil
+from pprint import pprint
+
+import librepo
+
+DESTDIR = "downloaded_metadata"
+PROGRESSBAR_LEN = 40
+finished = False
+
+def callback(data, total_to_download, downloaded):
+ """Progre... | |
1d50c5f10faeb17f8c7a1b7290c7d80f52220ad9 | src/ggrc/migrations/versions/20161020125620_1db61b597d2d_remove_bad_ca_names.py | src/ggrc/migrations/versions/20161020125620_1db61b597d2d_remove_bad_ca_names.py | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Remove bad CA names
Create Date: 2016-10-20 12:56:20.500665
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name
from alembic import op
imp... | Add migration for fixing bad CA names | Add migration for fixing bad CA names
This migration removes all assessment template custom attribute
definition names that match any of the assessment global custom
attributes.
Resolves: GGRC-26, GGRC-111
| Python | apache-2.0 | AleksNeStu/ggrc-core,selahssea/ggrc-core,j0gurt/ggrc-core,josthkko/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,josthkko/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,selahssea/ggrc-core,andrei-karalionak/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,josthkko/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,... | ---
+++
@@ -0,0 +1,85 @@
+# Copyright (C) 2016 Google Inc.
+# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
+
+"""
+Remove bad CA names
+
+Create Date: 2016-10-20 12:56:20.500665
+"""
+# disable Invalid constant name pylint warning for mandatory Alembic variables.
+# pylint: disable=inv... | |
c618a65f95b3c0486dd62bba4b1255ad95bbe9d2 | quran_tafseer/tests/test_views.py | quran_tafseer/tests/test_views.py | from django.test import TestCase
from django.urls import reverse
from model_mommy import mommy
class TestTafsserViews(TestCase):
def setUp(self):
self.sura = mommy.make('quran_text.sura', name='Al-Fateha', index=1)
self.ayah = mommy.make('quran_text.ayah', number=1, sura=self.sura,
... | Add tests for Tafseer Views | Add tests for Tafseer Views
| Python | mit | EmadMokhtar/tafseer_api | ---
+++
@@ -0,0 +1,30 @@
+from django.test import TestCase
+from django.urls import reverse
+from model_mommy import mommy
+
+
+class TestTafsserViews(TestCase):
+ def setUp(self):
+ self.sura = mommy.make('quran_text.sura', name='Al-Fateha', index=1)
+ self.ayah = mommy.make('quran_text.ayah', numbe... | |
03b0e88c909a5e8f0eeb8116222f166891e45b28 | scale_perf/vertica_queries.py | scale_perf/vertica_queries.py | import sys
import argparse
from subprocess import Popen, PIPE
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--vertica_password",
help="Vertica password for disk.sh and alarm_transitions.sh", default='password',
required=False)
ret... | Add script to query vertica stats | Add script to query vertica stats
| Python | apache-2.0 | hpcloud-mon/monasca-perf,hpcloud-mon/monasca-perf | ---
+++
@@ -0,0 +1,59 @@
+import sys
+import argparse
+from subprocess import Popen, PIPE
+
+
+def parse_args():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--vertica_password",
+ help="Vertica password for disk.sh and alarm_transitions.sh", default='password',
+ ... | |
38e570e50976ee863fddd00129ce2d1782b06ca5 | examples/manual_stats_reporting.py | examples/manual_stats_reporting.py | """
Example of a manual_report() function that can be used either as a context manager
(with statement), or a decorator, to manually add entries to Locust's statistics.
Usage as a context manager:
with manual_report("stats entry name"):
# Run time of this block will be reported under a stats entry called... | Add example with a manual_report decorator/context manager that can be used to easily measure the time of functions/code blocks and manually report them as stats entries to the Locust statistics | Add example with a manual_report decorator/context manager that can be used to easily measure the time of functions/code blocks and manually report them as stats entries to the Locust statistics | Python | mit | mbeacom/locust,mbeacom/locust,mbeacom/locust,locustio/locust,locustio/locust,mbeacom/locust,locustio/locust,locustio/locust | ---
+++
@@ -0,0 +1,78 @@
+"""
+Example of a manual_report() function that can be used either as a context manager
+(with statement), or a decorator, to manually add entries to Locust's statistics.
+
+Usage as a context manager:
+
+ with manual_report("stats entry name"):
+ # Run time of this block will be ... | |
811eab1329a02a36244b7a8f79c23bf5bfce4dc6 | spotpy/unittests/test_objectivefunctions.py | spotpy/unittests/test_objectivefunctions.py | import unittest
from spotpy import objectivefunctions as of
import numpy as np
#https://docs.python.org/3/library/unittest.html
class TestObjectiveFunctions(unittest.TestCase):
# How many digits to match in case of floating point answers
tolerance = 10
def setUp(self):
np.random.seed(42)
... | Add tests for bias and length mismatch | Add tests for bias and length mismatch
| Python | mit | thouska/spotpy,thouska/spotpy,bees4ever/spotpy,thouska/spotpy,bees4ever/spotpy,bees4ever/spotpy | ---
+++
@@ -0,0 +1,33 @@
+import unittest
+from spotpy import objectivefunctions as of
+import numpy as np
+
+#https://docs.python.org/3/library/unittest.html
+
+class TestObjectiveFunctions(unittest.TestCase):
+
+ # How many digits to match in case of floating point answers
+ tolerance = 10
+
+ def setUp(se... | |
ee35ffbaef1990dfbedbb50d3d94eb9e4ae4a298 | migrations/versions/1f8e3cf51fbc_.py | migrations/versions/1f8e3cf51fbc_.py | """Add a creator_id to streams
Revision ID: 1f8e3cf51fbc
Revises: 70c7d046881
Create Date: 2013-12-08 16:55:14.142000
"""
# revision identifiers, used by Alembic.
revision = '1f8e3cf51fbc'
down_revision = '70c7d046881'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated b... | Add creator_id migration for streams | Add creator_id migration for streams
| Python | mit | streamr/marvin,streamr/marvin,streamr/marvin | ---
+++
@@ -0,0 +1,26 @@
+"""Add a creator_id to streams
+
+Revision ID: 1f8e3cf51fbc
+Revises: 70c7d046881
+Create Date: 2013-12-08 16:55:14.142000
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '1f8e3cf51fbc'
+down_revision = '70c7d046881'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def ... | |
019a520ae3672e2bac791d1606e5d905700e21c0 | comics/crawlers/yafgc.py | comics/crawlers/yafgc.py | from comics.crawler.base import BaseComicCrawler
from comics.crawler.meta import BaseComicMeta
class ComicMeta(BaseComicMeta):
name = 'Yet Another Fantasy Gamer Comic'
language = 'en'
url = 'http://yafgc.shipsinker.com/'
start_date = '2006-05-29'
history_capable_date = '2006-05-29'
schedule = '... | Add crawler for 'Yet Another Fantasy Gamer Comic' | Add crawler for 'Yet Another Fantasy Gamer Comic'
| Python | agpl-3.0 | jodal/comics,klette/comics,datagutten/comics,datagutten/comics,jodal/comics,datagutten/comics,jodal/comics,klette/comics,datagutten/comics,klette/comics,jodal/comics | ---
+++
@@ -0,0 +1,18 @@
+from comics.crawler.base import BaseComicCrawler
+from comics.crawler.meta import BaseComicMeta
+
+class ComicMeta(BaseComicMeta):
+ name = 'Yet Another Fantasy Gamer Comic'
+ language = 'en'
+ url = 'http://yafgc.shipsinker.com/'
+ start_date = '2006-05-29'
+ history_capable_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.