commit stringlengths 40 40 | old_file stringlengths 4 118 | new_file stringlengths 4 118 | old_contents stringlengths 0 2.94k | new_contents stringlengths 1 4.43k | subject stringlengths 15 444 | message stringlengths 16 3.45k | lang stringclasses 1
value | license stringclasses 13
values | repos stringlengths 5 43.2k | prompt stringlengths 17 4.58k | response stringlengths 1 4.43k | prompt_tagged stringlengths 58 4.62k | response_tagged stringlengths 1 4.43k | text stringlengths 132 7.29k | text_tagged stringlengths 173 7.33k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a74b8683315c14401ad535d373f0570e3e59510f | hummedia/test/test_user.py | hummedia/test/test_user.py | import json
def test_patch_user(app, ACCOUNTS):
from mongokit import Document, Connection
from hummedia import config
from hummedia.models import User
from bson.objectid import ObjectId
connection = Connection(host=config.MONGODB_HOST, port=config.MONGODB_PORT)
user = connection[User.__database__][Us... | Test showing that users cannot be updated. | Test showing that users cannot be updated.
| Python | mpl-2.0 | webnard/byu-hummedia-api,BYU-ODH/byu-hummedia-api,trevren11/byu-hummedia-api,jlmcdonald/byu-hummedia-api,dcravenus/byu-hummedia-api,trevren11/byu-hummedia-api,BYU-ODH/byu-hummedia-api,webnard/byu-hummedia-api,jlmcdonald/byu-hummedia-api,dcravenus/byu-hummedia-api | Test showing that users cannot be updated. | import json
def test_patch_user(app, ACCOUNTS):
from mongokit import Document, Connection
from hummedia import config
from hummedia.models import User
from bson.objectid import ObjectId
connection = Connection(host=config.MONGODB_HOST, port=config.MONGODB_PORT)
user = connection[User.__database__][Us... | <commit_before><commit_msg>Test showing that users cannot be updated.<commit_after> | import json
def test_patch_user(app, ACCOUNTS):
from mongokit import Document, Connection
from hummedia import config
from hummedia.models import User
from bson.objectid import ObjectId
connection = Connection(host=config.MONGODB_HOST, port=config.MONGODB_PORT)
user = connection[User.__database__][Us... | Test showing that users cannot be updated.import json
def test_patch_user(app, ACCOUNTS):
from mongokit import Document, Connection
from hummedia import config
from hummedia.models import User
from bson.objectid import ObjectId
connection = Connection(host=config.MONGODB_HOST, port=config.MONGODB_PORT)
... | <commit_before><commit_msg>Test showing that users cannot be updated.<commit_after>import json
def test_patch_user(app, ACCOUNTS):
from mongokit import Document, Connection
from hummedia import config
from hummedia.models import User
from bson.objectid import ObjectId
connection = Connection(host=config.M... | |
5a85c3dc02db2aa1461c8cc3f8e5881dd072c1e0 | test/test_acoustics.py | test/test_acoustics.py | import numpy as np
import pyfds as fds
def test_acoustic_material():
water = fds.AcousticMaterial(1500, 1000)
water.bulk_viscosity = 1e-3
water.shear_viscosity = 1e-3
assert np.isclose(water.absorption_coef, 7e-3 / 3)
| Add test case for AcousticMaterial. | Add test case for AcousticMaterial.
| Python | bsd-3-clause | emtpb/pyfds | Add test case for AcousticMaterial. | import numpy as np
import pyfds as fds
def test_acoustic_material():
water = fds.AcousticMaterial(1500, 1000)
water.bulk_viscosity = 1e-3
water.shear_viscosity = 1e-3
assert np.isclose(water.absorption_coef, 7e-3 / 3)
| <commit_before><commit_msg>Add test case for AcousticMaterial.<commit_after> | import numpy as np
import pyfds as fds
def test_acoustic_material():
water = fds.AcousticMaterial(1500, 1000)
water.bulk_viscosity = 1e-3
water.shear_viscosity = 1e-3
assert np.isclose(water.absorption_coef, 7e-3 / 3)
| Add test case for AcousticMaterial.import numpy as np
import pyfds as fds
def test_acoustic_material():
water = fds.AcousticMaterial(1500, 1000)
water.bulk_viscosity = 1e-3
water.shear_viscosity = 1e-3
assert np.isclose(water.absorption_coef, 7e-3 / 3)
| <commit_before><commit_msg>Add test case for AcousticMaterial.<commit_after>import numpy as np
import pyfds as fds
def test_acoustic_material():
water = fds.AcousticMaterial(1500, 1000)
water.bulk_viscosity = 1e-3
water.shear_viscosity = 1e-3
assert np.isclose(water.absorption_coef, 7e-3 / 3)
| |
9ab7baadfa9c04d899036c81a41f14fe5fbd3687 | bokeh/types.py | bokeh/types.py | from functools import wraps
from six import iteritems
from .properties import Property
_do_type_check = False
def _type_check(func, type_spec):
pass
def sig(**type_spec):
for key, val in iteritems(type_spec):
if isinstance(val, Property):
continue
elif issubclass(val, Property):
... | Allow to specify function signature | Allow to specify function signature
| Python | bsd-3-clause | evidation-health/bokeh,bsipocz/bokeh,mindriot101/bokeh,maxalbert/bokeh,aiguofer/bokeh,paultcochrane/bokeh,paultcochrane/bokeh,schoolie/bokeh,ChristosChristofidis/bokeh,saifrahmed/bokeh,aavanian/bokeh,DuCorey/bokeh,aiguofer/bokeh,xguse/bokeh,timothydmorton/bokeh,philippjfr/bokeh,laurent-george/bokeh,ericdill/bokeh,ptitj... | Allow to specify function signature | from functools import wraps
from six import iteritems
from .properties import Property
_do_type_check = False
def _type_check(func, type_spec):
pass
def sig(**type_spec):
for key, val in iteritems(type_spec):
if isinstance(val, Property):
continue
elif issubclass(val, Property):
... | <commit_before><commit_msg>Allow to specify function signature<commit_after> | from functools import wraps
from six import iteritems
from .properties import Property
_do_type_check = False
def _type_check(func, type_spec):
pass
def sig(**type_spec):
for key, val in iteritems(type_spec):
if isinstance(val, Property):
continue
elif issubclass(val, Property):
... | Allow to specify function signaturefrom functools import wraps
from six import iteritems
from .properties import Property
_do_type_check = False
def _type_check(func, type_spec):
pass
def sig(**type_spec):
for key, val in iteritems(type_spec):
if isinstance(val, Property):
continue
... | <commit_before><commit_msg>Allow to specify function signature<commit_after>from functools import wraps
from six import iteritems
from .properties import Property
_do_type_check = False
def _type_check(func, type_spec):
pass
def sig(**type_spec):
for key, val in iteritems(type_spec):
if isinstance(v... | |
7f63cd2bc9a94180da17cd3170540b49d535ec0c | csdms/dakota/tests/test_environment_base.py | csdms/dakota/tests/test_environment_base.py | """Tests for the csdms.dakota.environment.base module."""
from nose.tools import raises, assert_true, assert_equal
from csdms.dakota.environment.base import EnvironmentBase
class Concrete(EnvironmentBase):
"""A subclass of EnvironmentBase used for testing."""
def __init__(self):
EnvironmentBase.__i... | Add unit tests for EnvironmentBase class | Add unit tests for EnvironmentBase class
| Python | mit | csdms/dakota,csdms/dakota | Add unit tests for EnvironmentBase class | """Tests for the csdms.dakota.environment.base module."""
from nose.tools import raises, assert_true, assert_equal
from csdms.dakota.environment.base import EnvironmentBase
class Concrete(EnvironmentBase):
"""A subclass of EnvironmentBase used for testing."""
def __init__(self):
EnvironmentBase.__i... | <commit_before><commit_msg>Add unit tests for EnvironmentBase class<commit_after> | """Tests for the csdms.dakota.environment.base module."""
from nose.tools import raises, assert_true, assert_equal
from csdms.dakota.environment.base import EnvironmentBase
class Concrete(EnvironmentBase):
"""A subclass of EnvironmentBase used for testing."""
def __init__(self):
EnvironmentBase.__i... | Add unit tests for EnvironmentBase class"""Tests for the csdms.dakota.environment.base module."""
from nose.tools import raises, assert_true, assert_equal
from csdms.dakota.environment.base import EnvironmentBase
class Concrete(EnvironmentBase):
"""A subclass of EnvironmentBase used for testing."""
def __i... | <commit_before><commit_msg>Add unit tests for EnvironmentBase class<commit_after>"""Tests for the csdms.dakota.environment.base module."""
from nose.tools import raises, assert_true, assert_equal
from csdms.dakota.environment.base import EnvironmentBase
class Concrete(EnvironmentBase):
"""A subclass of Environm... | |
99bc39c983c9c7a408eaca530db1eadbba9eb4ad | corehq/apps/hqadmin/migrations/0018_back_populate_deploy_commit.py | corehq/apps/hqadmin/migrations/0018_back_populate_deploy_commit.py | # Generated by Django 2.2.13 on 2020-07-30 18:59
from django.db import migrations
from corehq.util.django_migrations import skip_on_fresh_install
@skip_on_fresh_install
def back_populate(apps, schema_editor):
HqDeploy = apps.get_model('hqadmin', 'HqDeploy')
for deploy in HqDeploy.objects.all():
if no... | Add migration that back populates the new commit field in the HqDeploy model | Add migration that back populates the new commit field in the HqDeploy model
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | Add migration that back populates the new commit field in the HqDeploy model | # Generated by Django 2.2.13 on 2020-07-30 18:59
from django.db import migrations
from corehq.util.django_migrations import skip_on_fresh_install
@skip_on_fresh_install
def back_populate(apps, schema_editor):
HqDeploy = apps.get_model('hqadmin', 'HqDeploy')
for deploy in HqDeploy.objects.all():
if no... | <commit_before><commit_msg>Add migration that back populates the new commit field in the HqDeploy model<commit_after> | # Generated by Django 2.2.13 on 2020-07-30 18:59
from django.db import migrations
from corehq.util.django_migrations import skip_on_fresh_install
@skip_on_fresh_install
def back_populate(apps, schema_editor):
HqDeploy = apps.get_model('hqadmin', 'HqDeploy')
for deploy in HqDeploy.objects.all():
if no... | Add migration that back populates the new commit field in the HqDeploy model# Generated by Django 2.2.13 on 2020-07-30 18:59
from django.db import migrations
from corehq.util.django_migrations import skip_on_fresh_install
@skip_on_fresh_install
def back_populate(apps, schema_editor):
HqDeploy = apps.get_model('h... | <commit_before><commit_msg>Add migration that back populates the new commit field in the HqDeploy model<commit_after># Generated by Django 2.2.13 on 2020-07-30 18:59
from django.db import migrations
from corehq.util.django_migrations import skip_on_fresh_install
@skip_on_fresh_install
def back_populate(apps, schema_... | |
925e1cb04363f5bf95cde2abcf4b9be4a243dbd0 | docs/examples/image_from_mapfile.py | docs/examples/image_from_mapfile.py | from subprocess import Popen, PIPE
import tempfile, logging, os
def create_image_from_map(map_file, dll_location):
of = tempfile.NamedTemporaryFile(delete=False, suffix=".png", prefix="tmp_")
of.close()
logging.debug("Creating file %s", of.name)
# [SHP2IMG] -m [MAPFILE] -i png -o [RESULT]
params ... | Create sample image generation script | Create sample image generation script
| Python | mit | geographika/mappyfile,geographika/mappyfile | Create sample image generation script | from subprocess import Popen, PIPE
import tempfile, logging, os
def create_image_from_map(map_file, dll_location):
of = tempfile.NamedTemporaryFile(delete=False, suffix=".png", prefix="tmp_")
of.close()
logging.debug("Creating file %s", of.name)
# [SHP2IMG] -m [MAPFILE] -i png -o [RESULT]
params ... | <commit_before><commit_msg>Create sample image generation script<commit_after> | from subprocess import Popen, PIPE
import tempfile, logging, os
def create_image_from_map(map_file, dll_location):
of = tempfile.NamedTemporaryFile(delete=False, suffix=".png", prefix="tmp_")
of.close()
logging.debug("Creating file %s", of.name)
# [SHP2IMG] -m [MAPFILE] -i png -o [RESULT]
params ... | Create sample image generation scriptfrom subprocess import Popen, PIPE
import tempfile, logging, os
def create_image_from_map(map_file, dll_location):
of = tempfile.NamedTemporaryFile(delete=False, suffix=".png", prefix="tmp_")
of.close()
logging.debug("Creating file %s", of.name)
# [SHP2IMG] -m [MA... | <commit_before><commit_msg>Create sample image generation script<commit_after>from subprocess import Popen, PIPE
import tempfile, logging, os
def create_image_from_map(map_file, dll_location):
of = tempfile.NamedTemporaryFile(delete=False, suffix=".png", prefix="tmp_")
of.close()
logging.debug("Creating ... | |
b881b75624f636d7b4b3d65232655339e0fb9d0b | examples/example_ipython_notebook_config.py | examples/example_ipython_notebook_config.py | c = get_config()
# Tell IPython to use PostgresContentsManager.
c.NotebookApp.contents_manager_class = 'pgcontents.pgmanager.PostgresContentsManager'
# Set the url for the database used to store files. See
# http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html#postgresql
# for more info on db url formatting.
# c.... | Add an example configuration file. | DOC: Add an example configuration file.
| Python | apache-2.0 | quantopian/pgcontents | DOC: Add an example configuration file. | c = get_config()
# Tell IPython to use PostgresContentsManager.
c.NotebookApp.contents_manager_class = 'pgcontents.pgmanager.PostgresContentsManager'
# Set the url for the database used to store files. See
# http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html#postgresql
# for more info on db url formatting.
# c.... | <commit_before><commit_msg>DOC: Add an example configuration file.<commit_after> | c = get_config()
# Tell IPython to use PostgresContentsManager.
c.NotebookApp.contents_manager_class = 'pgcontents.pgmanager.PostgresContentsManager'
# Set the url for the database used to store files. See
# http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html#postgresql
# for more info on db url formatting.
# c.... | DOC: Add an example configuration file.c = get_config()
# Tell IPython to use PostgresContentsManager.
c.NotebookApp.contents_manager_class = 'pgcontents.pgmanager.PostgresContentsManager'
# Set the url for the database used to store files. See
# http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html#postgresql
# f... | <commit_before><commit_msg>DOC: Add an example configuration file.<commit_after>c = get_config()
# Tell IPython to use PostgresContentsManager.
c.NotebookApp.contents_manager_class = 'pgcontents.pgmanager.PostgresContentsManager'
# Set the url for the database used to store files. See
# http://docs.sqlalchemy.org/en... | |
1e47fe1e431c4bfc22bbe4d23e26814c655d65a3 | energyPATHWAYS/api/change_password.py | energyPATHWAYS/api/change_password.py | import click
from flask import Flask
import models
# create the application object
app = Flask(__name__)
app.config.from_pyfile('config.py')
models.db.init_app(app)
@click.command()
@click.argument('username')
@click.password_option()
def change_password(username, password):
with app.app_context():
user =... | Add script to change password for API user | Add script to change password for API user
| Python | mit | energyPATHWAYS/energyPATHWAYS | Add script to change password for API user | import click
from flask import Flask
import models
# create the application object
app = Flask(__name__)
app.config.from_pyfile('config.py')
models.db.init_app(app)
@click.command()
@click.argument('username')
@click.password_option()
def change_password(username, password):
with app.app_context():
user =... | <commit_before><commit_msg>Add script to change password for API user<commit_after> | import click
from flask import Flask
import models
# create the application object
app = Flask(__name__)
app.config.from_pyfile('config.py')
models.db.init_app(app)
@click.command()
@click.argument('username')
@click.password_option()
def change_password(username, password):
with app.app_context():
user =... | Add script to change password for API userimport click
from flask import Flask
import models
# create the application object
app = Flask(__name__)
app.config.from_pyfile('config.py')
models.db.init_app(app)
@click.command()
@click.argument('username')
@click.password_option()
def change_password(username, password):
... | <commit_before><commit_msg>Add script to change password for API user<commit_after>import click
from flask import Flask
import models
# create the application object
app = Flask(__name__)
app.config.from_pyfile('config.py')
models.db.init_app(app)
@click.command()
@click.argument('username')
@click.password_option()
... | |
89c9b215589ac14aff2ef408f4391f1b8ace9ea3 | examples/oscilloscope_plotting_pyqtgraph.py | examples/oscilloscope_plotting_pyqtgraph.py | #
# pymoku example: Plotting Oscilloscope with pyqtgraph
#
# This example demonstrates how you can configure the Oscilloscope instrument,
# and view triggered time-voltage data frames in real-time.
#
# pyqtgraph is used here as an alternative to matplotlib, it has more severe
# dependencies (i.e. Qt libraries), but is ... | Add an example showing how to plot in pyqtplot for a speed-increase compared to matplotlib | PM-372: Add an example showing how to plot in pyqtplot for a speed-increase compared to matplotlib
| Python | mit | liquidinstruments/pymoku | PM-372: Add an example showing how to plot in pyqtplot for a speed-increase compared to matplotlib | #
# pymoku example: Plotting Oscilloscope with pyqtgraph
#
# This example demonstrates how you can configure the Oscilloscope instrument,
# and view triggered time-voltage data frames in real-time.
#
# pyqtgraph is used here as an alternative to matplotlib, it has more severe
# dependencies (i.e. Qt libraries), but is ... | <commit_before><commit_msg>PM-372: Add an example showing how to plot in pyqtplot for a speed-increase compared to matplotlib<commit_after> | #
# pymoku example: Plotting Oscilloscope with pyqtgraph
#
# This example demonstrates how you can configure the Oscilloscope instrument,
# and view triggered time-voltage data frames in real-time.
#
# pyqtgraph is used here as an alternative to matplotlib, it has more severe
# dependencies (i.e. Qt libraries), but is ... | PM-372: Add an example showing how to plot in pyqtplot for a speed-increase compared to matplotlib#
# pymoku example: Plotting Oscilloscope with pyqtgraph
#
# This example demonstrates how you can configure the Oscilloscope instrument,
# and view triggered time-voltage data frames in real-time.
#
# pyqtgraph is used he... | <commit_before><commit_msg>PM-372: Add an example showing how to plot in pyqtplot for a speed-increase compared to matplotlib<commit_after>#
# pymoku example: Plotting Oscilloscope with pyqtgraph
#
# This example demonstrates how you can configure the Oscilloscope instrument,
# and view triggered time-voltage data fram... | |
6df3c7f4030555f5020ac1f09e30f75252686d0b | py/path-sum-iii.py | py/path-sum-iii.py | from collections import Counter
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def dfs(self, cur):
if cur:
self.subsum += cur.val
yield... | Add py solution for 437. Path Sum III | Add py solution for 437. Path Sum III
437. Path Sum III: https://leetcode.com/problems/path-sum-iii/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | Add py solution for 437. Path Sum III
437. Path Sum III: https://leetcode.com/problems/path-sum-iii/ | from collections import Counter
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def dfs(self, cur):
if cur:
self.subsum += cur.val
yield... | <commit_before><commit_msg>Add py solution for 437. Path Sum III
437. Path Sum III: https://leetcode.com/problems/path-sum-iii/<commit_after> | from collections import Counter
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def dfs(self, cur):
if cur:
self.subsum += cur.val
yield... | Add py solution for 437. Path Sum III
437. Path Sum III: https://leetcode.com/problems/path-sum-iii/from collections import Counter
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(... | <commit_before><commit_msg>Add py solution for 437. Path Sum III
437. Path Sum III: https://leetcode.com/problems/path-sum-iii/<commit_after>from collections import Counter
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# ... | |
50003d11234d73d53b1b3d09c5de963b707bca6b | src/nyc_trees/apps/survey/migrations/0022_merge.py | src/nyc_trees/apps/survey/migrations/0022_merge.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('survey', '0021_auto_20150506_1922'),
('survey', '0021_auto_20150506_1406'),
]
operations = [
]
| Resolve migration conflict via merge | Resolve migration conflict via merge
| Python | agpl-3.0 | azavea/nyc-trees,azavea/nyc-trees,kdeloach/nyc-trees,kdeloach/nyc-trees,kdeloach/nyc-trees,kdeloach/nyc-trees,maurizi/nyc-trees,azavea/nyc-trees,kdeloach/nyc-trees,azavea/nyc-trees,maurizi/nyc-trees,maurizi/nyc-trees,maurizi/nyc-trees,azavea/nyc-trees | Resolve migration conflict via merge | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('survey', '0021_auto_20150506_1922'),
('survey', '0021_auto_20150506_1406'),
]
operations = [
]
| <commit_before><commit_msg>Resolve migration conflict via merge<commit_after> | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('survey', '0021_auto_20150506_1922'),
('survey', '0021_auto_20150506_1406'),
]
operations = [
]
| Resolve migration conflict via merge# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('survey', '0021_auto_20150506_1922'),
('survey', '0021_auto_20150506_1406'),
]
operations... | <commit_before><commit_msg>Resolve migration conflict via merge<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('survey', '0021_auto_20150506_1922'),
('survey', '0021_au... | |
f363a8e615861cafc9a09b21247ca1b0ddad90a9 | scripts/igmp_monitor.py | scripts/igmp_monitor.py | #!/usr/bin/env python
from pcs.packets.localhost import *
from pcs.packets.ethernet import *
from pcs.packets.ipv4 import *
from pcs.packets.igmp import *
from pcs.packets.igmpv2 import *
from pcs.packets.payload import *
from pcs import *
from time import sleep
def main():
from optparse import OptionParser
... | Add a simple script which just dumps any IGMP traffic which it sees. This exercises the centralized IGMP receive path. | Add a simple script which just dumps any IGMP traffic which it sees.
This exercises the centralized IGMP receive path.
| Python | bsd-3-clause | gvnn3/PCS,gvnn3/PCS | Add a simple script which just dumps any IGMP traffic which it sees.
This exercises the centralized IGMP receive path. | #!/usr/bin/env python
from pcs.packets.localhost import *
from pcs.packets.ethernet import *
from pcs.packets.ipv4 import *
from pcs.packets.igmp import *
from pcs.packets.igmpv2 import *
from pcs.packets.payload import *
from pcs import *
from time import sleep
def main():
from optparse import OptionParser
... | <commit_before><commit_msg>Add a simple script which just dumps any IGMP traffic which it sees.
This exercises the centralized IGMP receive path.<commit_after> | #!/usr/bin/env python
from pcs.packets.localhost import *
from pcs.packets.ethernet import *
from pcs.packets.ipv4 import *
from pcs.packets.igmp import *
from pcs.packets.igmpv2 import *
from pcs.packets.payload import *
from pcs import *
from time import sleep
def main():
from optparse import OptionParser
... | Add a simple script which just dumps any IGMP traffic which it sees.
This exercises the centralized IGMP receive path.#!/usr/bin/env python
from pcs.packets.localhost import *
from pcs.packets.ethernet import *
from pcs.packets.ipv4 import *
from pcs.packets.igmp import *
from pcs.packets.igmpv2 import *
from pcs.pack... | <commit_before><commit_msg>Add a simple script which just dumps any IGMP traffic which it sees.
This exercises the centralized IGMP receive path.<commit_after>#!/usr/bin/env python
from pcs.packets.localhost import *
from pcs.packets.ethernet import *
from pcs.packets.ipv4 import *
from pcs.packets.igmp import *
from ... | |
bf31d86f89632526418844849183f8065b83aecf | scripts/protobuf_raw.py | scripts/protobuf_raw.py | #!/usr/bin/env python3
"""Raw decode sequence of messages with protoc.
Pass hex string (including variant length). Multiple messages
are supported.
"""
import os
import sys
import binascii
from pyatv.mrp import variant
if __name__ == '__main__':
buf = binascii.unhexlify(sys.argv[1])
while buf:
leng... | Add script to raw decode messages | Add script to raw decode messages
| Python | mit | postlund/pyatv,postlund/pyatv | Add script to raw decode messages | #!/usr/bin/env python3
"""Raw decode sequence of messages with protoc.
Pass hex string (including variant length). Multiple messages
are supported.
"""
import os
import sys
import binascii
from pyatv.mrp import variant
if __name__ == '__main__':
buf = binascii.unhexlify(sys.argv[1])
while buf:
leng... | <commit_before><commit_msg>Add script to raw decode messages<commit_after> | #!/usr/bin/env python3
"""Raw decode sequence of messages with protoc.
Pass hex string (including variant length). Multiple messages
are supported.
"""
import os
import sys
import binascii
from pyatv.mrp import variant
if __name__ == '__main__':
buf = binascii.unhexlify(sys.argv[1])
while buf:
leng... | Add script to raw decode messages#!/usr/bin/env python3
"""Raw decode sequence of messages with protoc.
Pass hex string (including variant length). Multiple messages
are supported.
"""
import os
import sys
import binascii
from pyatv.mrp import variant
if __name__ == '__main__':
buf = binascii.unhexlify(sys.arg... | <commit_before><commit_msg>Add script to raw decode messages<commit_after>#!/usr/bin/env python3
"""Raw decode sequence of messages with protoc.
Pass hex string (including variant length). Multiple messages
are supported.
"""
import os
import sys
import binascii
from pyatv.mrp import variant
if __name__ == '__main... | |
9d93af117cd035fb42206b408645e9a744ca2281 | chainer/testing/distribution_test.py | chainer/testing/distribution_test.py | import unittest
try:
import pytest # NOQA
_error = None
except ImportError as e:
_error = e
if _error is None:
from chainer.testing._distribution_test import distribution_unittest
else:
class distribution_unittest(unittest.TestCase):
def test_dummy(self):
raise RuntimeError(... | Allow `import chainer.testing` without pytest | Allow `import chainer.testing` without pytest
| Python | mit | niboshi/chainer,wkentaro/chainer,chainer/chainer,hvy/chainer,keisuke-umezawa/chainer,wkentaro/chainer,wkentaro/chainer,chainer/chainer,tkerola/chainer,okuta/chainer,okuta/chainer,chainer/chainer,hvy/chainer,niboshi/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,pfnet/chainer,hvy/chainer,wkentaro/chainer,okuta/... | Allow `import chainer.testing` without pytest | import unittest
try:
import pytest # NOQA
_error = None
except ImportError as e:
_error = e
if _error is None:
from chainer.testing._distribution_test import distribution_unittest
else:
class distribution_unittest(unittest.TestCase):
def test_dummy(self):
raise RuntimeError(... | <commit_before><commit_msg>Allow `import chainer.testing` without pytest<commit_after> | import unittest
try:
import pytest # NOQA
_error = None
except ImportError as e:
_error = e
if _error is None:
from chainer.testing._distribution_test import distribution_unittest
else:
class distribution_unittest(unittest.TestCase):
def test_dummy(self):
raise RuntimeError(... | Allow `import chainer.testing` without pytestimport unittest
try:
import pytest # NOQA
_error = None
except ImportError as e:
_error = e
if _error is None:
from chainer.testing._distribution_test import distribution_unittest
else:
class distribution_unittest(unittest.TestCase):
def test... | <commit_before><commit_msg>Allow `import chainer.testing` without pytest<commit_after>import unittest
try:
import pytest # NOQA
_error = None
except ImportError as e:
_error = e
if _error is None:
from chainer.testing._distribution_test import distribution_unittest
else:
class distribution_unit... | |
461d77e2c4335b4f3cc3c4ff2d2af8c5a9cdf9bf | tests/test_future/test_email_generation.py | tests/test_future/test_email_generation.py | # -*- coding: utf-8 -*-
"""Tests for email generation."""
from __future__ import unicode_literals
from future.backports.email.mime.multipart import MIMEMultipart
from future.backports.email.mime.text import MIMEText
from future.backports.email.utils import formatdate
from future.tests.base import unittest
class Ema... | Add a test for our fix | Add a test for our fix
| Python | mit | PythonCharmers/python-future,PythonCharmers/python-future | Add a test for our fix | # -*- coding: utf-8 -*-
"""Tests for email generation."""
from __future__ import unicode_literals
from future.backports.email.mime.multipart import MIMEMultipart
from future.backports.email.mime.text import MIMEText
from future.backports.email.utils import formatdate
from future.tests.base import unittest
class Ema... | <commit_before><commit_msg>Add a test for our fix<commit_after> | # -*- coding: utf-8 -*-
"""Tests for email generation."""
from __future__ import unicode_literals
from future.backports.email.mime.multipart import MIMEMultipart
from future.backports.email.mime.text import MIMEText
from future.backports.email.utils import formatdate
from future.tests.base import unittest
class Ema... | Add a test for our fix# -*- coding: utf-8 -*-
"""Tests for email generation."""
from __future__ import unicode_literals
from future.backports.email.mime.multipart import MIMEMultipart
from future.backports.email.mime.text import MIMEText
from future.backports.email.utils import formatdate
from future.tests.base impor... | <commit_before><commit_msg>Add a test for our fix<commit_after># -*- coding: utf-8 -*-
"""Tests for email generation."""
from __future__ import unicode_literals
from future.backports.email.mime.multipart import MIMEMultipart
from future.backports.email.mime.text import MIMEText
from future.backports.email.utils impor... | |
c2cae70605638455aedcb09ec31dc494071f3be3 | stoneridge_collator.py | stoneridge_collator.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
# TODO
| Add (empty, for now) data collator | Add (empty, for now) data collator
| Python | mpl-2.0 | mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge | Add (empty, for now) data collator | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
# TODO
| <commit_before><commit_msg>Add (empty, for now) data collator<commit_after> | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
# TODO
| Add (empty, for now) data collator#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
# TODO
| <commit_before><commit_msg>Add (empty, for now) data collator<commit_after>#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
# TODO
| |
dc59de726719db2c0366a43859e84209d694d249 | userprofile/migrations/0007_auto_20180323_1747.py | userprofile/migrations/0007_auto_20180323_1747.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2018-03-23 17:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('userprofile', '0006_auto_20180309_2215'),
]
operations = [
migrations.RemoveF... | Add migration files for new userprofile models | Add migration files for new userprofile models
| Python | mit | hackerspace-ntnu/website,hackerspace-ntnu/website,hackerspace-ntnu/website | Add migration files for new userprofile models | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2018-03-23 17:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('userprofile', '0006_auto_20180309_2215'),
]
operations = [
migrations.RemoveF... | <commit_before><commit_msg>Add migration files for new userprofile models<commit_after> | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2018-03-23 17:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('userprofile', '0006_auto_20180309_2215'),
]
operations = [
migrations.RemoveF... | Add migration files for new userprofile models# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2018-03-23 17:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('userprofile', '0006_auto_20180309_2215'),
]
... | <commit_before><commit_msg>Add migration files for new userprofile models<commit_after># -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2018-03-23 17:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('userpro... | |
5147963a188f3c13179600d92640f0a33a78af68 | algorithms/dynamic-programming/longest-increasing-subsequence/solution.py | algorithms/dynamic-programming/longest-increasing-subsequence/solution.py | #!/usr/bin/env python
import sys
def read(fn):
return fn(sys.stdin.readline())
def ceil(array, value):
"""
Returns the smallest index i such that array[i - 1] < value.
"""
l = 0
r = len(array) - 1
i = r + 1
while l <= r:
m = l + int((r - l) / 2)
if array[m] >= value... | Implement Longest Increasing Subsequence in Python | Implement Longest Increasing Subsequence in Python
| Python | mit | andreimaximov/algorithms,andreimaximov/algorithms,andreimaximov/algorithms,andreimaximov/algorithms | Implement Longest Increasing Subsequence in Python | #!/usr/bin/env python
import sys
def read(fn):
return fn(sys.stdin.readline())
def ceil(array, value):
"""
Returns the smallest index i such that array[i - 1] < value.
"""
l = 0
r = len(array) - 1
i = r + 1
while l <= r:
m = l + int((r - l) / 2)
if array[m] >= value... | <commit_before><commit_msg>Implement Longest Increasing Subsequence in Python<commit_after> | #!/usr/bin/env python
import sys
def read(fn):
return fn(sys.stdin.readline())
def ceil(array, value):
"""
Returns the smallest index i such that array[i - 1] < value.
"""
l = 0
r = len(array) - 1
i = r + 1
while l <= r:
m = l + int((r - l) / 2)
if array[m] >= value... | Implement Longest Increasing Subsequence in Python#!/usr/bin/env python
import sys
def read(fn):
return fn(sys.stdin.readline())
def ceil(array, value):
"""
Returns the smallest index i such that array[i - 1] < value.
"""
l = 0
r = len(array) - 1
i = r + 1
while l <= r:
m =... | <commit_before><commit_msg>Implement Longest Increasing Subsequence in Python<commit_after>#!/usr/bin/env python
import sys
def read(fn):
return fn(sys.stdin.readline())
def ceil(array, value):
"""
Returns the smallest index i such that array[i - 1] < value.
"""
l = 0
r = len(array) - 1
... | |
ffbedc8ed975b3eba3c8478f12a334bb94ceb6bd | openfisca_france/tests/test_enumerations.py | openfisca_france/tests/test_enumerations.py | # -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify
# it ... | Add test to detect Enums without enumeration. | Add test to detect Enums without enumeration.
| Python | agpl-3.0 | adrienpacifico/openfisca-france,adrienpacifico/openfisca-france,sgmap/openfisca-france,SophieIPP/openfisca-france,antoinearnoud/openfisca-france,benjello/openfisca-france,SophieIPP/openfisca-france,antoinearnoud/openfisca-france,benjello/openfisca-france,sgmap/openfisca-france | Add test to detect Enums without enumeration. | # -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify
# it ... | <commit_before><commit_msg>Add test to detect Enums without enumeration.<commit_after> | # -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify
# it ... | Add test to detect Enums without enumeration.# -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software... | <commit_before><commit_msg>Add test to detect Enums without enumeration.<commit_after># -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of ... | |
39d1e2e23acf28a79720aefca098e9af942ea44b | scripts/runmask-util.py | scripts/runmask-util.py | #!/usr/bin/env python
# Tobey Carman
# Dec 2016
import netCDF4 as nc
import argparse
import textwrap
def show_mask(file, note):
with nc.Dataset(file, 'r') as mask:
print "========== %s ==================================" % (note)
print "'%s'" % (file)
print mask.variables['run']
print mask.variable... | Add utility script for modifying run mask. | Add utility script for modifying run mask.
| Python | mit | tobeycarman/dvm-dos-tem,tobeycarman/dvm-dos-tem,tobeycarman/dvm-dos-tem,tobeycarman/dvm-dos-tem,tobeycarman/dvm-dos-tem,tobeycarman/dvm-dos-tem | Add utility script for modifying run mask. | #!/usr/bin/env python
# Tobey Carman
# Dec 2016
import netCDF4 as nc
import argparse
import textwrap
def show_mask(file, note):
with nc.Dataset(file, 'r') as mask:
print "========== %s ==================================" % (note)
print "'%s'" % (file)
print mask.variables['run']
print mask.variable... | <commit_before><commit_msg>Add utility script for modifying run mask.<commit_after> | #!/usr/bin/env python
# Tobey Carman
# Dec 2016
import netCDF4 as nc
import argparse
import textwrap
def show_mask(file, note):
with nc.Dataset(file, 'r') as mask:
print "========== %s ==================================" % (note)
print "'%s'" % (file)
print mask.variables['run']
print mask.variable... | Add utility script for modifying run mask.#!/usr/bin/env python
# Tobey Carman
# Dec 2016
import netCDF4 as nc
import argparse
import textwrap
def show_mask(file, note):
with nc.Dataset(file, 'r') as mask:
print "========== %s ==================================" % (note)
print "'%s'" % (file)
print mas... | <commit_before><commit_msg>Add utility script for modifying run mask.<commit_after>#!/usr/bin/env python
# Tobey Carman
# Dec 2016
import netCDF4 as nc
import argparse
import textwrap
def show_mask(file, note):
with nc.Dataset(file, 'r') as mask:
print "========== %s ==================================" % (note... | |
27dcea8076d02be193fddfdd13306f9f2d337689 | recipes/metric_distance_board_pin_values.py | recipes/metric_distance_board_pin_values.py | import RPi.GPIO as GPIO
from hcsr04sensor import sensor
# Created by Al Audet
# MIT License
def main():
'''Calculate the distance of an object in centimeters using a HCSR04 sensor
and a Raspberry Pi'''
# Use GPIO.BOARD values instead of BCM
trig_pin = 11
echo_pin = 13
# Default values
#... | Add recipe for board pin values | Add recipe for board pin values
| Python | mit | alaudet/hcsr04sensor | Add recipe for board pin values | import RPi.GPIO as GPIO
from hcsr04sensor import sensor
# Created by Al Audet
# MIT License
def main():
'''Calculate the distance of an object in centimeters using a HCSR04 sensor
and a Raspberry Pi'''
# Use GPIO.BOARD values instead of BCM
trig_pin = 11
echo_pin = 13
# Default values
#... | <commit_before><commit_msg>Add recipe for board pin values<commit_after> | import RPi.GPIO as GPIO
from hcsr04sensor import sensor
# Created by Al Audet
# MIT License
def main():
'''Calculate the distance of an object in centimeters using a HCSR04 sensor
and a Raspberry Pi'''
# Use GPIO.BOARD values instead of BCM
trig_pin = 11
echo_pin = 13
# Default values
#... | Add recipe for board pin valuesimport RPi.GPIO as GPIO
from hcsr04sensor import sensor
# Created by Al Audet
# MIT License
def main():
'''Calculate the distance of an object in centimeters using a HCSR04 sensor
and a Raspberry Pi'''
# Use GPIO.BOARD values instead of BCM
trig_pin = 11
echo_pin ... | <commit_before><commit_msg>Add recipe for board pin values<commit_after>import RPi.GPIO as GPIO
from hcsr04sensor import sensor
# Created by Al Audet
# MIT License
def main():
'''Calculate the distance of an object in centimeters using a HCSR04 sensor
and a Raspberry Pi'''
# Use GPIO.BOARD values inste... | |
d0494a9475437e70f5f03576d9b8888aaadac458 | migrations/versions/1815829d365_.py | migrations/versions/1815829d365_.py | """empty message
Revision ID: 1815829d365
Revises: 3fcddd64a72
Create Date: 2016-02-09 17:58:47.362133
"""
# revision identifiers, used by Alembic.
revision = '1815829d365'
down_revision = '3fcddd64a72'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | Replace title_abr_idx with new unique index that includes geometry_application_reference | Replace title_abr_idx with new unique index that includes geometry_application_reference
| Python | mit | LandRegistry/system-of-record,LandRegistry/system-of-record | Replace title_abr_idx with new unique index that includes geometry_application_reference | """empty message
Revision ID: 1815829d365
Revises: 3fcddd64a72
Create Date: 2016-02-09 17:58:47.362133
"""
# revision identifiers, used by Alembic.
revision = '1815829d365'
down_revision = '3fcddd64a72'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | <commit_before><commit_msg>Replace title_abr_idx with new unique index that includes geometry_application_reference<commit_after> | """empty message
Revision ID: 1815829d365
Revises: 3fcddd64a72
Create Date: 2016-02-09 17:58:47.362133
"""
# revision identifiers, used by Alembic.
revision = '1815829d365'
down_revision = '3fcddd64a72'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | Replace title_abr_idx with new unique index that includes geometry_application_reference"""empty message
Revision ID: 1815829d365
Revises: 3fcddd64a72
Create Date: 2016-02-09 17:58:47.362133
"""
# revision identifiers, used by Alembic.
revision = '1815829d365'
down_revision = '3fcddd64a72'
from alembic import op
im... | <commit_before><commit_msg>Replace title_abr_idx with new unique index that includes geometry_application_reference<commit_after>"""empty message
Revision ID: 1815829d365
Revises: 3fcddd64a72
Create Date: 2016-02-09 17:58:47.362133
"""
# revision identifiers, used by Alembic.
revision = '1815829d365'
down_revision =... | |
dccde3aa82fa7b01cec4c8d2a0035cac7414c37a | sensor_interface/scripts/hc-05_interface.py | sensor_interface/scripts/hc-05_interface.py | import rospy
import serial
import Adafruit_BBIO.UART as UART
from std_msgs.msg import String
import binascii
class Hc05InterfaceNode(object):
def __init__(self):
rospy.init_node('bluetooth_node')
self.port = "/dev/tty04"
self.init_serial()
self.init_publisher()
self.read_blu... | Add interface script for bluetooth module | Add interface script for bluetooth module
| Python | mit | vortexntnu/rov-control,vortexntnu/rov-control,vortexntnu/rov-control | Add interface script for bluetooth module | import rospy
import serial
import Adafruit_BBIO.UART as UART
from std_msgs.msg import String
import binascii
class Hc05InterfaceNode(object):
def __init__(self):
rospy.init_node('bluetooth_node')
self.port = "/dev/tty04"
self.init_serial()
self.init_publisher()
self.read_blu... | <commit_before><commit_msg>Add interface script for bluetooth module<commit_after> | import rospy
import serial
import Adafruit_BBIO.UART as UART
from std_msgs.msg import String
import binascii
class Hc05InterfaceNode(object):
def __init__(self):
rospy.init_node('bluetooth_node')
self.port = "/dev/tty04"
self.init_serial()
self.init_publisher()
self.read_blu... | Add interface script for bluetooth moduleimport rospy
import serial
import Adafruit_BBIO.UART as UART
from std_msgs.msg import String
import binascii
class Hc05InterfaceNode(object):
def __init__(self):
rospy.init_node('bluetooth_node')
self.port = "/dev/tty04"
self.init_serial()
se... | <commit_before><commit_msg>Add interface script for bluetooth module<commit_after>import rospy
import serial
import Adafruit_BBIO.UART as UART
from std_msgs.msg import String
import binascii
class Hc05InterfaceNode(object):
def __init__(self):
rospy.init_node('bluetooth_node')
self.port = "/dev/tty... | |
a792cd4c1525cf42efa91ae5fcc308795d6fcc5d | openslides/utils/translation_ext.py | openslides/utils/translation_ext.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.utils.translation_ext
~~~~~~~~~~~~~~~~~~~~~~~~
Localizable descriptions for django permissions.
:copyright: 2011 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
from django.utils.translation imp... | Support for localized permissions on top of the static django model. | Support for localized permissions on top of the static django model.
| Python | mit | FinnStutzenstein/OpenSlides,CatoTH/OpenSlides,normanjaeckel/OpenSlides,FinnStutzenstein/OpenSlides,tsiegleauq/OpenSlides,tsiegleauq/OpenSlides,CatoTH/OpenSlides,ostcar/OpenSlides,normanjaeckel/OpenSlides,FinnStutzenstein/OpenSlides,OpenSlides/OpenSlides,emanuelschuetze/OpenSlides,jwinzer/OpenSlides,CatoTH/OpenSlides,em... | Support for localized permissions on top of the static django model. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.utils.translation_ext
~~~~~~~~~~~~~~~~~~~~~~~~
Localizable descriptions for django permissions.
:copyright: 2011 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
from django.utils.translation imp... | <commit_before><commit_msg>Support for localized permissions on top of the static django model.<commit_after> | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.utils.translation_ext
~~~~~~~~~~~~~~~~~~~~~~~~
Localizable descriptions for django permissions.
:copyright: 2011 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
from django.utils.translation imp... | Support for localized permissions on top of the static django model.#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.utils.translation_ext
~~~~~~~~~~~~~~~~~~~~~~~~
Localizable descriptions for django permissions.
:copyright: 2011 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, ... | <commit_before><commit_msg>Support for localized permissions on top of the static django model.<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.utils.translation_ext
~~~~~~~~~~~~~~~~~~~~~~~~
Localizable descriptions for django permissions.
:copyright: 2011 by the OpenSlides t... | |
518b5e8a634c77762916acd778b6c355f7c0a549 | tests/utils/get_message_unit_tests.py | tests/utils/get_message_unit_tests.py | import unittest
from utils import get_message
class GetMessageUnitTests(unittest.TestCase):
def test_get_message_is_callable(self):
self.assertTrue(callable(get_message))
if __name__ == '__main__':
suite = unittest.defaultTestLoader.loadTestsFromTestCase(GetMessageUnitTests)
unittest.TextTestRunn... | Add get message unit tests | Add get message unit tests
| Python | mit | jdgillespie91/trackerSpend,jdgillespie91/trackerSpend | Add get message unit tests | import unittest
from utils import get_message
class GetMessageUnitTests(unittest.TestCase):
def test_get_message_is_callable(self):
self.assertTrue(callable(get_message))
if __name__ == '__main__':
suite = unittest.defaultTestLoader.loadTestsFromTestCase(GetMessageUnitTests)
unittest.TextTestRunn... | <commit_before><commit_msg>Add get message unit tests<commit_after> | import unittest
from utils import get_message
class GetMessageUnitTests(unittest.TestCase):
def test_get_message_is_callable(self):
self.assertTrue(callable(get_message))
if __name__ == '__main__':
suite = unittest.defaultTestLoader.loadTestsFromTestCase(GetMessageUnitTests)
unittest.TextTestRunn... | Add get message unit testsimport unittest
from utils import get_message
class GetMessageUnitTests(unittest.TestCase):
def test_get_message_is_callable(self):
self.assertTrue(callable(get_message))
if __name__ == '__main__':
suite = unittest.defaultTestLoader.loadTestsFromTestCase(GetMessageUnitTests)... | <commit_before><commit_msg>Add get message unit tests<commit_after>import unittest
from utils import get_message
class GetMessageUnitTests(unittest.TestCase):
def test_get_message_is_callable(self):
self.assertTrue(callable(get_message))
if __name__ == '__main__':
suite = unittest.defaultTestLoader.l... | |
c8d4e4d38d7836ab34b8bab251d7b56c07b88c30 | src/test/basic/basic.py | src/test/basic/basic.py | import unittest
import astar
class BasicTests(unittest.TestCase):
def test_bestpath(self):
"""ensure that we take the shortest path, and not the path with less elements.
the path with less elements is A -> B with a distance of 100
the shortest path is A -> C -> D -> B with a dista... | Test in order to ensure that the alogorithm returns the path that is optimal and not the first path it detects | Test in order to ensure that the alogorithm returns the path that is optimal and not the first path it detects
| Python | bsd-3-clause | jrialland/python-astar,jrialland/python-astar | Test in order to ensure that the alogorithm returns the path that is optimal and not the first path it detects | import unittest
import astar
class BasicTests(unittest.TestCase):
def test_bestpath(self):
"""ensure that we take the shortest path, and not the path with less elements.
the path with less elements is A -> B with a distance of 100
the shortest path is A -> C -> D -> B with a dista... | <commit_before><commit_msg>Test in order to ensure that the alogorithm returns the path that is optimal and not the first path it detects<commit_after> | import unittest
import astar
class BasicTests(unittest.TestCase):
def test_bestpath(self):
"""ensure that we take the shortest path, and not the path with less elements.
the path with less elements is A -> B with a distance of 100
the shortest path is A -> C -> D -> B with a dista... | Test in order to ensure that the alogorithm returns the path that is optimal and not the first path it detectsimport unittest
import astar
class BasicTests(unittest.TestCase):
def test_bestpath(self):
"""ensure that we take the shortest path, and not the path with less elements.
the path with... | <commit_before><commit_msg>Test in order to ensure that the alogorithm returns the path that is optimal and not the first path it detects<commit_after>import unittest
import astar
class BasicTests(unittest.TestCase):
def test_bestpath(self):
"""ensure that we take the shortest path, and not the path with... | |
688f9eca5b73e4c0ee4c1cfac62fe668a40d9e22 | test/unit/ggrc/models/test_table_args.py | test/unit/ggrc/models/test_table_args.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: andraz@reciprocitylabs.com
# Maintained By: andraz@reciprocitylabs.com
"""Tests for overriden __table_args__."""
import unittest
from ggrc.models... | Add a test for overriden __table_args__ | Add a test for overriden __table_args__
| Python | apache-2.0 | andrei-karalionak/ggrc-core,kr41/ggrc-core,edofic/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,josthkko/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,edofic/ggrc-core,AleksNeStu/ggrc-core,kr41/ggrc-core,selahssea/ggrc-core,selahssea/gg... | Add a test for overriden __table_args__ | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: andraz@reciprocitylabs.com
# Maintained By: andraz@reciprocitylabs.com
"""Tests for overriden __table_args__."""
import unittest
from ggrc.models... | <commit_before><commit_msg>Add a test for overriden __table_args__<commit_after> | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: andraz@reciprocitylabs.com
# Maintained By: andraz@reciprocitylabs.com
"""Tests for overriden __table_args__."""
import unittest
from ggrc.models... | Add a test for overriden __table_args__# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: andraz@reciprocitylabs.com
# Maintained By: andraz@reciprocitylabs.com
"""Tests for overriden __table_args__... | <commit_before><commit_msg>Add a test for overriden __table_args__<commit_after># Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: andraz@reciprocitylabs.com
# Maintained By: andraz@reciprocitylabs.c... | |
4395a165c421821717c6b8f30479e53fe56ab34c | examples/gwfilter_search.py | examples/gwfilter_search.py | """Module giving some examples how to use PyDOV to query boreholes."""
def get_description():
"""The description gives information about the Boring type."""
from pydov.search.grondwaterfilter import GrondwaterFilterSearch
gwfilter = GrondwaterFilterSearch()
print(gwfilter.get_description())
def get_... | Add example for filter search | Add example for filter search
| Python | mit | DOV-Vlaanderen/pydov | Add example for filter search | """Module giving some examples how to use PyDOV to query boreholes."""
def get_description():
"""The description gives information about the Boring type."""
from pydov.search.grondwaterfilter import GrondwaterFilterSearch
gwfilter = GrondwaterFilterSearch()
print(gwfilter.get_description())
def get_... | <commit_before><commit_msg>Add example for filter search<commit_after> | """Module giving some examples how to use PyDOV to query boreholes."""
def get_description():
"""The description gives information about the Boring type."""
from pydov.search.grondwaterfilter import GrondwaterFilterSearch
gwfilter = GrondwaterFilterSearch()
print(gwfilter.get_description())
def get_... | Add example for filter search"""Module giving some examples how to use PyDOV to query boreholes."""
def get_description():
"""The description gives information about the Boring type."""
from pydov.search.grondwaterfilter import GrondwaterFilterSearch
gwfilter = GrondwaterFilterSearch()
print(gwfilter... | <commit_before><commit_msg>Add example for filter search<commit_after>"""Module giving some examples how to use PyDOV to query boreholes."""
def get_description():
"""The description gives information about the Boring type."""
from pydov.search.grondwaterfilter import GrondwaterFilterSearch
gwfilter = Gr... | |
6998cbfd57366b8bcc598b1b89bb102b65e198c0 | bin/prxtransfer-dns-station-migration.py | bin/prxtransfer-dns-station-migration.py | import boto3
client = boto3.client("route53")
# List the FTP subdomains that should have explicit DNS records added
subdomains = [
"wxyz",
]
changes = []
for subdomain in subdomains:
changes.append(
{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": f"{subd... | Add migration script for prxtransfer.org DNS records | Add migration script for prxtransfer.org DNS records
| Python | mit | PRX/Infrastructure,PRX/Infrastructure,PRX/Infrastructure,PRX/Infrastructure,PRX/Infrastructure | Add migration script for prxtransfer.org DNS records | import boto3
client = boto3.client("route53")
# List the FTP subdomains that should have explicit DNS records added
subdomains = [
"wxyz",
]
changes = []
for subdomain in subdomains:
changes.append(
{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": f"{subd... | <commit_before><commit_msg>Add migration script for prxtransfer.org DNS records<commit_after> | import boto3
client = boto3.client("route53")
# List the FTP subdomains that should have explicit DNS records added
subdomains = [
"wxyz",
]
changes = []
for subdomain in subdomains:
changes.append(
{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": f"{subd... | Add migration script for prxtransfer.org DNS recordsimport boto3
client = boto3.client("route53")
# List the FTP subdomains that should have explicit DNS records added
subdomains = [
"wxyz",
]
changes = []
for subdomain in subdomains:
changes.append(
{
"Action": "UPSERT",
"R... | <commit_before><commit_msg>Add migration script for prxtransfer.org DNS records<commit_after>import boto3
client = boto3.client("route53")
# List the FTP subdomains that should have explicit DNS records added
subdomains = [
"wxyz",
]
changes = []
for subdomain in subdomains:
changes.append(
{
... | |
c2120e991d5556196af1960207ee6a2cb3a9ba30 | raspicam/main.py | raspicam/main.py | import logging
from config_resolver import Config
import cv2
from camera import USBCam
from processing import detect
from raspicam.webui import make_app
class Application:
def __init__(self, config):
self.config = config
self.frame_generator = USBCam().frame_generator()
def run_gui(self):... | import logging
from config_resolver import Config
import cv2
from camera import USBCam
from processing import detect
from raspicam.webui import make_app
LOG = logging.getLogger(__name__)
class Application:
def __init__(self, config):
self.config = config
self.initialised = False
self... | Remove "active" statements from constructor | Remove "active" statements from constructor
| Python | mit | exhuma/raspicam,exhuma/raspicam,exhuma/raspicam | import logging
from config_resolver import Config
import cv2
from camera import USBCam
from processing import detect
from raspicam.webui import make_app
class Application:
def __init__(self, config):
self.config = config
self.frame_generator = USBCam().frame_generator()
def run_gui(self):... | import logging
from config_resolver import Config
import cv2
from camera import USBCam
from processing import detect
from raspicam.webui import make_app
LOG = logging.getLogger(__name__)
class Application:
def __init__(self, config):
self.config = config
self.initialised = False
self... | <commit_before>import logging
from config_resolver import Config
import cv2
from camera import USBCam
from processing import detect
from raspicam.webui import make_app
class Application:
def __init__(self, config):
self.config = config
self.frame_generator = USBCam().frame_generator()
def... | import logging
from config_resolver import Config
import cv2
from camera import USBCam
from processing import detect
from raspicam.webui import make_app
LOG = logging.getLogger(__name__)
class Application:
def __init__(self, config):
self.config = config
self.initialised = False
self... | import logging
from config_resolver import Config
import cv2
from camera import USBCam
from processing import detect
from raspicam.webui import make_app
class Application:
def __init__(self, config):
self.config = config
self.frame_generator = USBCam().frame_generator()
def run_gui(self):... | <commit_before>import logging
from config_resolver import Config
import cv2
from camera import USBCam
from processing import detect
from raspicam.webui import make_app
class Application:
def __init__(self, config):
self.config = config
self.frame_generator = USBCam().frame_generator()
def... |
7a5f75c36ee70382763fc3c8f9d7441390a30e37 | plot_generator.py | plot_generator.py | __author__ = 'Anti'
import scipy.signal
import numpy as np
import matplotlib.pyplot as plt
def getWave(freq, time, duty=0.5):
np_square_wave_period = 2 * np.pi
return [i if i != -1 else 0 for i in scipy.signal.square(time * np_square_wave_period * freq, duty=duty)]
def newSignalPlot(signal, plot_nr, freq):... | Add python plot generator (pyplot). | Add python plot generator (pyplot).
| Python | mit | kahvel/VEP-BCI | Add python plot generator (pyplot). | __author__ = 'Anti'
import scipy.signal
import numpy as np
import matplotlib.pyplot as plt
def getWave(freq, time, duty=0.5):
np_square_wave_period = 2 * np.pi
return [i if i != -1 else 0 for i in scipy.signal.square(time * np_square_wave_period * freq, duty=duty)]
def newSignalPlot(signal, plot_nr, freq):... | <commit_before><commit_msg>Add python plot generator (pyplot).<commit_after> | __author__ = 'Anti'
import scipy.signal
import numpy as np
import matplotlib.pyplot as plt
def getWave(freq, time, duty=0.5):
np_square_wave_period = 2 * np.pi
return [i if i != -1 else 0 for i in scipy.signal.square(time * np_square_wave_period * freq, duty=duty)]
def newSignalPlot(signal, plot_nr, freq):... | Add python plot generator (pyplot).__author__ = 'Anti'
import scipy.signal
import numpy as np
import matplotlib.pyplot as plt
def getWave(freq, time, duty=0.5):
np_square_wave_period = 2 * np.pi
return [i if i != -1 else 0 for i in scipy.signal.square(time * np_square_wave_period * freq, duty=duty)]
def ne... | <commit_before><commit_msg>Add python plot generator (pyplot).<commit_after>__author__ = 'Anti'
import scipy.signal
import numpy as np
import matplotlib.pyplot as plt
def getWave(freq, time, duty=0.5):
np_square_wave_period = 2 * np.pi
return [i if i != -1 else 0 for i in scipy.signal.square(time * np_square... | |
ce3d667bb44c29b0d163ec2e1c8aa87d3cfe718c | horsephrase/_guess_guess.py | horsephrase/_guess_guess.py | # Guess how many guesses it will take to guess a password.
from __future__ import unicode_literals
from ._implementation import words
def how_long(length=4, choices=len(words), speed=1000 * 1000 * 1000,
optimism=2):
"""
How long might it take to guess a password?
@param length: the number o... | Put my back-of-the-envelope math here to check against. | Put my back-of-the-envelope math here to check against.
| Python | mit | glyph/horsephrase | Put my back-of-the-envelope math here to check against. | # Guess how many guesses it will take to guess a password.
from __future__ import unicode_literals
from ._implementation import words
def how_long(length=4, choices=len(words), speed=1000 * 1000 * 1000,
optimism=2):
"""
How long might it take to guess a password?
@param length: the number o... | <commit_before><commit_msg>Put my back-of-the-envelope math here to check against.<commit_after> | # Guess how many guesses it will take to guess a password.
from __future__ import unicode_literals
from ._implementation import words
def how_long(length=4, choices=len(words), speed=1000 * 1000 * 1000,
optimism=2):
"""
How long might it take to guess a password?
@param length: the number o... | Put my back-of-the-envelope math here to check against.# Guess how many guesses it will take to guess a password.
from __future__ import unicode_literals
from ._implementation import words
def how_long(length=4, choices=len(words), speed=1000 * 1000 * 1000,
optimism=2):
"""
How long might it tak... | <commit_before><commit_msg>Put my back-of-the-envelope math here to check against.<commit_after># Guess how many guesses it will take to guess a password.
from __future__ import unicode_literals
from ._implementation import words
def how_long(length=4, choices=len(words), speed=1000 * 1000 * 1000,
optim... | |
51479ca43a03329ec563a6218b44fc062712be4d | indra/tests/test_mgi_client.py | indra/tests/test_mgi_client.py | from indra.databases import mgi_client
def test_lookups():
assert mgi_client.get_id_from_name('Braf') == '88190'
assert mgi_client.get_name_from_id('1926283') == 'Pgap6'
assert mgi_client.get_id_from_name_synonym('Pgap6') == '1926283'
assert mgi_client.get_id_from_name_synonym('Tmem8') == '1926283'
... | Add some tests for MGI client | Add some tests for MGI client
| Python | bsd-2-clause | johnbachman/indra,johnbachman/indra,sorgerlab/indra,bgyori/indra,bgyori/indra,bgyori/indra,johnbachman/indra,sorgerlab/indra,sorgerlab/indra | Add some tests for MGI client | from indra.databases import mgi_client
def test_lookups():
assert mgi_client.get_id_from_name('Braf') == '88190'
assert mgi_client.get_name_from_id('1926283') == 'Pgap6'
assert mgi_client.get_id_from_name_synonym('Pgap6') == '1926283'
assert mgi_client.get_id_from_name_synonym('Tmem8') == '1926283'
... | <commit_before><commit_msg>Add some tests for MGI client<commit_after> | from indra.databases import mgi_client
def test_lookups():
assert mgi_client.get_id_from_name('Braf') == '88190'
assert mgi_client.get_name_from_id('1926283') == 'Pgap6'
assert mgi_client.get_id_from_name_synonym('Pgap6') == '1926283'
assert mgi_client.get_id_from_name_synonym('Tmem8') == '1926283'
... | Add some tests for MGI clientfrom indra.databases import mgi_client
def test_lookups():
assert mgi_client.get_id_from_name('Braf') == '88190'
assert mgi_client.get_name_from_id('1926283') == 'Pgap6'
assert mgi_client.get_id_from_name_synonym('Pgap6') == '1926283'
assert mgi_client.get_id_from_name_syn... | <commit_before><commit_msg>Add some tests for MGI client<commit_after>from indra.databases import mgi_client
def test_lookups():
assert mgi_client.get_id_from_name('Braf') == '88190'
assert mgi_client.get_name_from_id('1926283') == 'Pgap6'
assert mgi_client.get_id_from_name_synonym('Pgap6') == '1926283'
... | |
159962e6d1c8f1a855c356f458aeb7079cb6b07f | report_qweb_element_page_visibility/__openerp__.py | report_qweb_element_page_visibility/__openerp__.py | # -*- coding: utf-8 -*-
#########################################################################
# #
# Copyright (C) 2015 Agile Business Group #
# #
... | Migrate report_qweb_element_page_visibility module to 9.0 | [IMP] Migrate report_qweb_element_page_visibility module to 9.0
| Python | agpl-3.0 | OCA/reporting-engine,OCA/reporting-engine,OCA/reporting-engine,OCA/reporting-engine | [IMP] Migrate report_qweb_element_page_visibility module to 9.0 | # -*- coding: utf-8 -*-
#########################################################################
# #
# Copyright (C) 2015 Agile Business Group #
# #
... | <commit_before><commit_msg>[IMP] Migrate report_qweb_element_page_visibility module to 9.0<commit_after> | # -*- coding: utf-8 -*-
#########################################################################
# #
# Copyright (C) 2015 Agile Business Group #
# #
... | [IMP] Migrate report_qweb_element_page_visibility module to 9.0# -*- coding: utf-8 -*-
#########################################################################
# #
# Copyright (C) 2015 Agile Business Group #
# ... | <commit_before><commit_msg>[IMP] Migrate report_qweb_element_page_visibility module to 9.0<commit_after># -*- coding: utf-8 -*-
#########################################################################
# #
# Copyright (C) 2015 Agile Business Group ... | |
3c78b03aa3d0455290562ef31b84d7c8f5a91c9e | tests/test_ext_tasks.py | tests/test_ext_tasks.py | # -*- coding: utf-8 -*-
"""
Tests for discord.ext.tasks
"""
import asyncio
import datetime
import pytest
from discord import utils
from discord.ext import tasks
@pytest.mark.asyncio
async def test_explicit_initial_runs_tomorrow_single():
now = utils.utcnow()
if not ((0, 4) < (now.hour, now.minute) < (2... | Test regressions for the task extension | Test regressions for the task extension
* tests for testing regression of 19ad64a
* fix edge case for test running within 3 minutes of the start of the hour | Python | mit | Rapptz/discord.py,Harmon758/discord.py,Harmon758/discord.py,rapptz/discord.py | Test regressions for the task extension
* tests for testing regression of 19ad64a
* fix edge case for test running within 3 minutes of the start of the hour | # -*- coding: utf-8 -*-
"""
Tests for discord.ext.tasks
"""
import asyncio
import datetime
import pytest
from discord import utils
from discord.ext import tasks
@pytest.mark.asyncio
async def test_explicit_initial_runs_tomorrow_single():
now = utils.utcnow()
if not ((0, 4) < (now.hour, now.minute) < (2... | <commit_before><commit_msg>Test regressions for the task extension
* tests for testing regression of 19ad64a
* fix edge case for test running within 3 minutes of the start of the hour<commit_after> | # -*- coding: utf-8 -*-
"""
Tests for discord.ext.tasks
"""
import asyncio
import datetime
import pytest
from discord import utils
from discord.ext import tasks
@pytest.mark.asyncio
async def test_explicit_initial_runs_tomorrow_single():
now = utils.utcnow()
if not ((0, 4) < (now.hour, now.minute) < (2... | Test regressions for the task extension
* tests for testing regression of 19ad64a
* fix edge case for test running within 3 minutes of the start of the hour# -*- coding: utf-8 -*-
"""
Tests for discord.ext.tasks
"""
import asyncio
import datetime
import pytest
from discord import utils
from discord.ext import t... | <commit_before><commit_msg>Test regressions for the task extension
* tests for testing regression of 19ad64a
* fix edge case for test running within 3 minutes of the start of the hour<commit_after># -*- coding: utf-8 -*-
"""
Tests for discord.ext.tasks
"""
import asyncio
import datetime
import pytest
from disco... | |
7700aad28e7bd0053e3e8dba823b446822e2be73 | conftest.py | conftest.py | from django.conf import settings
import base64
import os
import os.path
def pytest_configure(config):
if not settings.configured:
os.environ['DJANGO_SETTINGS_MODULE'] = 'sentry.conf.server'
test_db = os.environ.get('DB', 'sqlite')
if test_db == 'mysql':
settings.DATABASES['default'].updat... | from django.conf import settings
import base64
import os
import os.path
def pytest_configure(config):
if not settings.configured:
os.environ['DJANGO_SETTINGS_MODULE'] = 'sentry.conf.server'
test_db = os.environ.get('DB', 'sqlite')
if test_db == 'mysql':
settings.DATABASES['default'].updat... | Disable compressor in test suite (compressor makes the test suite run 50% slower) | Disable compressor in test suite (compressor makes the test suite run 50% slower)
| Python | bsd-3-clause | mitsuhiko/sentry,JamesMura/sentry,JTCunning/sentry,imankulov/sentry,gencer/sentry,fotinakis/sentry,ewdurbin/sentry,JamesMura/sentry,Natim/sentry,beni55/sentry,jean/sentry,hongliang5623/sentry,kevinlondon/sentry,nicholasserra/sentry,zenefits/sentry,BuildingLink/sentry,argonemyth/sentry,drcapulet/sentry,boneyao/sentry,Si... | from django.conf import settings
import base64
import os
import os.path
def pytest_configure(config):
if not settings.configured:
os.environ['DJANGO_SETTINGS_MODULE'] = 'sentry.conf.server'
test_db = os.environ.get('DB', 'sqlite')
if test_db == 'mysql':
settings.DATABASES['default'].updat... | from django.conf import settings
import base64
import os
import os.path
def pytest_configure(config):
if not settings.configured:
os.environ['DJANGO_SETTINGS_MODULE'] = 'sentry.conf.server'
test_db = os.environ.get('DB', 'sqlite')
if test_db == 'mysql':
settings.DATABASES['default'].updat... | <commit_before>from django.conf import settings
import base64
import os
import os.path
def pytest_configure(config):
if not settings.configured:
os.environ['DJANGO_SETTINGS_MODULE'] = 'sentry.conf.server'
test_db = os.environ.get('DB', 'sqlite')
if test_db == 'mysql':
settings.DATABASES['... | from django.conf import settings
import base64
import os
import os.path
def pytest_configure(config):
if not settings.configured:
os.environ['DJANGO_SETTINGS_MODULE'] = 'sentry.conf.server'
test_db = os.environ.get('DB', 'sqlite')
if test_db == 'mysql':
settings.DATABASES['default'].updat... | from django.conf import settings
import base64
import os
import os.path
def pytest_configure(config):
if not settings.configured:
os.environ['DJANGO_SETTINGS_MODULE'] = 'sentry.conf.server'
test_db = os.environ.get('DB', 'sqlite')
if test_db == 'mysql':
settings.DATABASES['default'].updat... | <commit_before>from django.conf import settings
import base64
import os
import os.path
def pytest_configure(config):
if not settings.configured:
os.environ['DJANGO_SETTINGS_MODULE'] = 'sentry.conf.server'
test_db = os.environ.get('DB', 'sqlite')
if test_db == 'mysql':
settings.DATABASES['... |
80d726c48142bc83d7154e9554c1fd8053b81883 | tests/test_bmipytest.py | tests/test_bmipytest.py | from bmi_tester.bmipytest import load_component
entry_point = 'pymt_hydrotrend.bmi:Hydrotrend'
module_name, cls_name = entry_point.split(":")
def test_component_is_string():
component = load_component(entry_point)
assert isinstance(component, str)
def test_component_is_classname():
component = load_co... | Add tests for load_component function | Add tests for load_component function
It uses the hydrotrend plugin, which is a default installed with pymt.
This might make the tests fragile.
| Python | mit | csdms/bmi-tester | Add tests for load_component function
It uses the hydrotrend plugin, which is a default installed with pymt.
This might make the tests fragile. | from bmi_tester.bmipytest import load_component
entry_point = 'pymt_hydrotrend.bmi:Hydrotrend'
module_name, cls_name = entry_point.split(":")
def test_component_is_string():
component = load_component(entry_point)
assert isinstance(component, str)
def test_component_is_classname():
component = load_co... | <commit_before><commit_msg>Add tests for load_component function
It uses the hydrotrend plugin, which is a default installed with pymt.
This might make the tests fragile.<commit_after> | from bmi_tester.bmipytest import load_component
entry_point = 'pymt_hydrotrend.bmi:Hydrotrend'
module_name, cls_name = entry_point.split(":")
def test_component_is_string():
component = load_component(entry_point)
assert isinstance(component, str)
def test_component_is_classname():
component = load_co... | Add tests for load_component function
It uses the hydrotrend plugin, which is a default installed with pymt.
This might make the tests fragile.from bmi_tester.bmipytest import load_component
entry_point = 'pymt_hydrotrend.bmi:Hydrotrend'
module_name, cls_name = entry_point.split(":")
def test_component_is_string()... | <commit_before><commit_msg>Add tests for load_component function
It uses the hydrotrend plugin, which is a default installed with pymt.
This might make the tests fragile.<commit_after>from bmi_tester.bmipytest import load_component
entry_point = 'pymt_hydrotrend.bmi:Hydrotrend'
module_name, cls_name = entry_point.sp... | |
76aef076be0db297b8e4979d55acb28c798ade4a | test/src/unittest/extractor/test_musicextractor.py | test/src/unittest/extractor/test_musicextractor.py | #!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation (FSF), e... | Add unit test for MusicExtractor | Add unit test for MusicExtractor
Similar to the test for FreesoundExtractor
| Python | agpl-3.0 | carthach/essentia,carthach/essentia,MTG/essentia,MTG/essentia,carthach/essentia,MTG/essentia,MTG/essentia,MTG/essentia,carthach/essentia,carthach/essentia | Add unit test for MusicExtractor
Similar to the test for FreesoundExtractor | #!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation (FSF), e... | <commit_before><commit_msg>Add unit test for MusicExtractor
Similar to the test for FreesoundExtractor<commit_after> | #!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation (FSF), e... | Add unit test for MusicExtractor
Similar to the test for FreesoundExtractor#!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero Ge... | <commit_before><commit_msg>Add unit test for MusicExtractor
Similar to the test for FreesoundExtractor<commit_after>#!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify ... | |
339a72d10d707d5981515fd9c8ad85f85ea59aa0 | portal/migrations/versions/0fa4a0bd6595_.py | portal/migrations/versions/0fa4a0bd6595_.py | """empty message
Revision ID: 0fa4a0bd6595
Revises: b68a125b8470
Create Date: 2017-03-07 19:12:13.758000
"""
# revision identifiers, used by Alembic.
revision = '0fa4a0bd6595'
down_revision = 'b68a125b8470'
from alembic import op
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
... | Add migration to pick up missing enumeration value for encounter.auth_method | Add migration to pick up missing enumeration value for encounter.auth_method
| Python | bsd-3-clause | uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal | Add migration to pick up missing enumeration value for encounter.auth_method | """empty message
Revision ID: 0fa4a0bd6595
Revises: b68a125b8470
Create Date: 2017-03-07 19:12:13.758000
"""
# revision identifiers, used by Alembic.
revision = '0fa4a0bd6595'
down_revision = 'b68a125b8470'
from alembic import op
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
... | <commit_before><commit_msg>Add migration to pick up missing enumeration value for encounter.auth_method<commit_after> | """empty message
Revision ID: 0fa4a0bd6595
Revises: b68a125b8470
Create Date: 2017-03-07 19:12:13.758000
"""
# revision identifiers, used by Alembic.
revision = '0fa4a0bd6595'
down_revision = 'b68a125b8470'
from alembic import op
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
... | Add migration to pick up missing enumeration value for encounter.auth_method"""empty message
Revision ID: 0fa4a0bd6595
Revises: b68a125b8470
Create Date: 2017-03-07 19:12:13.758000
"""
# revision identifiers, used by Alembic.
revision = '0fa4a0bd6595'
down_revision = 'b68a125b8470'
from alembic import op
def upgr... | <commit_before><commit_msg>Add migration to pick up missing enumeration value for encounter.auth_method<commit_after>"""empty message
Revision ID: 0fa4a0bd6595
Revises: b68a125b8470
Create Date: 2017-03-07 19:12:13.758000
"""
# revision identifiers, used by Alembic.
revision = '0fa4a0bd6595'
down_revision = 'b68a125... | |
0ecb75cfd685cb8c2bd20b8704b8b6efe62244c5 | traits/util/toposort.py | traits/util/toposort.py | #-----------------------------------------------------------------------------
#
# Copyright (c) 2011, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions descr... | Add the topological_sort function back to traits.util. | BUG: Add the topological_sort function back to traits.util.
| Python | bsd-3-clause | burnpanck/traits,burnpanck/traits | BUG: Add the topological_sort function back to traits.util. | #-----------------------------------------------------------------------------
#
# Copyright (c) 2011, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions descr... | <commit_before><commit_msg>BUG: Add the topological_sort function back to traits.util.<commit_after> | #-----------------------------------------------------------------------------
#
# Copyright (c) 2011, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions descr... | BUG: Add the topological_sort function back to traits.util.#-----------------------------------------------------------------------------
#
# Copyright (c) 2011, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt... | <commit_before><commit_msg>BUG: Add the topological_sort function back to traits.util.<commit_after>#-----------------------------------------------------------------------------
#
# Copyright (c) 2011, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# ... | |
f5143f2782d2c09fe482b77fa77e9740e5c92710 | cfp/migrations/0048_auto_20150412_0740.py | cfp/migrations/0048_auto_20150412_0740.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cfp', '0047_auto_20150412_0647'),
]
operations = [
migrations.RemoveField(
model_name='conference',
... | Remove topics from models migration | Remove topics from models migration
| Python | mit | kyleconroy/speakers,kyleconroy/speakers,kyleconroy/speakers | Remove topics from models migration | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cfp', '0047_auto_20150412_0647'),
]
operations = [
migrations.RemoveField(
model_name='conference',
... | <commit_before><commit_msg>Remove topics from models migration<commit_after> | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cfp', '0047_auto_20150412_0647'),
]
operations = [
migrations.RemoveField(
model_name='conference',
... | Remove topics from models migration# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cfp', '0047_auto_20150412_0647'),
]
operations = [
migrations.RemoveField(
mo... | <commit_before><commit_msg>Remove topics from models migration<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cfp', '0047_auto_20150412_0647'),
]
operations = [
... | |
70227e79e1cd6bac97e35a1d701996e401fea7f2 | diaspy/conversations.py | diaspy/conversations.py | import requests
class Conversation:
"""This class represents a conversation.
.. note::
Remember that you need to have access to the conversation.
"""
def __init__(self, conv_id, client):
"""
:param conversation_id: id of the post and not the guid!
:type conversation_i... | Create new Conversations, answer to old ones or delete them | Create new Conversations, answer to old ones or delete them
| Python | mit | marekjm/diaspy | Create new Conversations, answer to old ones or delete them | import requests
class Conversation:
"""This class represents a conversation.
.. note::
Remember that you need to have access to the conversation.
"""
def __init__(self, conv_id, client):
"""
:param conversation_id: id of the post and not the guid!
:type conversation_i... | <commit_before><commit_msg>Create new Conversations, answer to old ones or delete them<commit_after> | import requests
class Conversation:
"""This class represents a conversation.
.. note::
Remember that you need to have access to the conversation.
"""
def __init__(self, conv_id, client):
"""
:param conversation_id: id of the post and not the guid!
:type conversation_i... | Create new Conversations, answer to old ones or delete themimport requests
class Conversation:
"""This class represents a conversation.
.. note::
Remember that you need to have access to the conversation.
"""
def __init__(self, conv_id, client):
"""
:param conversation_id: id... | <commit_before><commit_msg>Create new Conversations, answer to old ones or delete them<commit_after>import requests
class Conversation:
"""This class represents a conversation.
.. note::
Remember that you need to have access to the conversation.
"""
def __init__(self, conv_id, client):
... | |
85246afcca06fe60567392216ffc6805521594d3 | billjobs/tests/tests_export_account_email.py | billjobs/tests/tests_export_account_email.py | from django.test import TestCase
from billjobs.admin import UserAdmin
class EmailExportTestCase(TestCase):
""" Tests for email account export """
def test_action_is_avaible(self):
""" Test admin can select the action in dropdown list """
self.assertTrue(hasattr(UserAdmin, 'export_email'))
| Add test for email account export | Add test for email account export
| Python | mit | ioO/billjobs | Add test for email account export | from django.test import TestCase
from billjobs.admin import UserAdmin
class EmailExportTestCase(TestCase):
""" Tests for email account export """
def test_action_is_avaible(self):
""" Test admin can select the action in dropdown list """
self.assertTrue(hasattr(UserAdmin, 'export_email'))
| <commit_before><commit_msg>Add test for email account export<commit_after> | from django.test import TestCase
from billjobs.admin import UserAdmin
class EmailExportTestCase(TestCase):
""" Tests for email account export """
def test_action_is_avaible(self):
""" Test admin can select the action in dropdown list """
self.assertTrue(hasattr(UserAdmin, 'export_email'))
| Add test for email account exportfrom django.test import TestCase
from billjobs.admin import UserAdmin
class EmailExportTestCase(TestCase):
""" Tests for email account export """
def test_action_is_avaible(self):
""" Test admin can select the action in dropdown list """
self.assertTrue(hasattr... | <commit_before><commit_msg>Add test for email account export<commit_after>from django.test import TestCase
from billjobs.admin import UserAdmin
class EmailExportTestCase(TestCase):
""" Tests for email account export """
def test_action_is_avaible(self):
""" Test admin can select the action in dropdown... | |
dd9b0833fa55fc2e4bbc9e4453c303c9cd15caed | day-03-2.py | day-03-2.py | with open('day-03-input.txt', 'r') as f:
puzzle_input = f.read().replace('\n', '')
# Coordinates: (x, y)
class Santa:
def __init__(self):
self.x = 0
self.y = 0
def move(self, direction):
if direction == '^':
self.y += 1
elif direction == '>':
self... | Complete day 3 part 2 | Complete day 3 part 2
| Python | mit | foxscotch/advent-of-code,foxscotch/advent-of-code | Complete day 3 part 2 | with open('day-03-input.txt', 'r') as f:
puzzle_input = f.read().replace('\n', '')
# Coordinates: (x, y)
class Santa:
def __init__(self):
self.x = 0
self.y = 0
def move(self, direction):
if direction == '^':
self.y += 1
elif direction == '>':
self... | <commit_before><commit_msg>Complete day 3 part 2<commit_after> | with open('day-03-input.txt', 'r') as f:
puzzle_input = f.read().replace('\n', '')
# Coordinates: (x, y)
class Santa:
def __init__(self):
self.x = 0
self.y = 0
def move(self, direction):
if direction == '^':
self.y += 1
elif direction == '>':
self... | Complete day 3 part 2with open('day-03-input.txt', 'r') as f:
puzzle_input = f.read().replace('\n', '')
# Coordinates: (x, y)
class Santa:
def __init__(self):
self.x = 0
self.y = 0
def move(self, direction):
if direction == '^':
self.y += 1
elif direction == ... | <commit_before><commit_msg>Complete day 3 part 2<commit_after>with open('day-03-input.txt', 'r') as f:
puzzle_input = f.read().replace('\n', '')
# Coordinates: (x, y)
class Santa:
def __init__(self):
self.x = 0
self.y = 0
def move(self, direction):
if direction == '^':
... | |
b8dff8fb466c3627af75b06af5d46eebf0e3c12c | game_of_thrones.py | game_of_thrones.py | '''
Dothraki are planning an attack to usurp King Robert's throne. King Robert
learns of this conspiracy from Raven and plans to lock the single door
through which the enemy can enter his kingdom.
But, to lock the door he needs a key that is an anagram of a certain
palindrome string.The king has a string composed of... | Add Game of Thrones 1 | Add Game of Thrones 1
| Python | mit | GingerNinja23/programming-questions | Add Game of Thrones 1 | '''
Dothraki are planning an attack to usurp King Robert's throne. King Robert
learns of this conspiracy from Raven and plans to lock the single door
through which the enemy can enter his kingdom.
But, to lock the door he needs a key that is an anagram of a certain
palindrome string.The king has a string composed of... | <commit_before><commit_msg>Add Game of Thrones 1<commit_after> | '''
Dothraki are planning an attack to usurp King Robert's throne. King Robert
learns of this conspiracy from Raven and plans to lock the single door
through which the enemy can enter his kingdom.
But, to lock the door he needs a key that is an anagram of a certain
palindrome string.The king has a string composed of... | Add Game of Thrones 1'''
Dothraki are planning an attack to usurp King Robert's throne. King Robert
learns of this conspiracy from Raven and plans to lock the single door
through which the enemy can enter his kingdom.
But, to lock the door he needs a key that is an anagram of a certain
palindrome string.The king has... | <commit_before><commit_msg>Add Game of Thrones 1<commit_after>'''
Dothraki are planning an attack to usurp King Robert's throne. King Robert
learns of this conspiracy from Raven and plans to lock the single door
through which the enemy can enter his kingdom.
But, to lock the door he needs a key that is an anagram of... | |
a12be94ad54b826fb664b953dbeaabdbe5451f6c | games/migrations/0022_installer_reason.py | games/migrations/0022_installer_reason.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-11-04 21:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('games', '0021_auto_20170824_0548'),
]
operations = [
migrations.AddField(
... | Add migrations for installer reason | Add migrations for installer reason
| Python | agpl-3.0 | lutris/website,lutris/website,lutris/website,lutris/website | Add migrations for installer reason | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-11-04 21:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('games', '0021_auto_20170824_0548'),
]
operations = [
migrations.AddField(
... | <commit_before><commit_msg>Add migrations for installer reason<commit_after> | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-11-04 21:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('games', '0021_auto_20170824_0548'),
]
operations = [
migrations.AddField(
... | Add migrations for installer reason# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-11-04 21:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('games', '0021_auto_20170824_0548'),
]
operations... | <commit_before><commit_msg>Add migrations for installer reason<commit_after># -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-11-04 21:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('games', '0021_au... | |
9e941899aab38888a6e34bbe268eb7de7f8e27ee | zou/migrations/versions/443d1e78a932_.py | zou/migrations/versions/443d1e78a932_.py | """empty message
Revision ID: 443d1e78a932
Revises: 59e149a772cf
Create Date: 2018-08-07 21:36:03.384838
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '443d1e78a932'
down_revision = 'c726b98be194'
branch_labels = None
depends_on = None
def upgrade():
# ... | Add migration file for allow timelog flag | Add migration file for allow timelog flag
| Python | agpl-3.0 | cgwire/zou | Add migration file for allow timelog flag | """empty message
Revision ID: 443d1e78a932
Revises: 59e149a772cf
Create Date: 2018-08-07 21:36:03.384838
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '443d1e78a932'
down_revision = 'c726b98be194'
branch_labels = None
depends_on = None
def upgrade():
# ... | <commit_before><commit_msg>Add migration file for allow timelog flag<commit_after> | """empty message
Revision ID: 443d1e78a932
Revises: 59e149a772cf
Create Date: 2018-08-07 21:36:03.384838
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '443d1e78a932'
down_revision = 'c726b98be194'
branch_labels = None
depends_on = None
def upgrade():
# ... | Add migration file for allow timelog flag"""empty message
Revision ID: 443d1e78a932
Revises: 59e149a772cf
Create Date: 2018-08-07 21:36:03.384838
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '443d1e78a932'
down_revision = 'c726b98be194'
branch_labels = None
... | <commit_before><commit_msg>Add migration file for allow timelog flag<commit_after>"""empty message
Revision ID: 443d1e78a932
Revises: 59e149a772cf
Create Date: 2018-08-07 21:36:03.384838
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '443d1e78a932'
down_revisi... | |
eb3dd84713aff7220ec71fa3c4196aa5c3853e70 | tests/request_methods/test_subscriptions.py | tests/request_methods/test_subscriptions.py | """
Tests for the Subscriptions API class.
"""
import unittest
import mws
from .utils import CommonRequestTestTools
class SubscriptionsTestCase(unittest.TestCase, CommonRequestTestTools):
"""
Test cases for Subscriptions.
"""
# TODO: Add remaining methods for Subscriptions
def setUp(self):
... | Add stub for Subscriptions API testing | Add stub for Subscriptions API testing | Python | unlicense | GriceTurrble/python-amazon-mws,Bobspadger/python-amazon-mws | Add stub for Subscriptions API testing | """
Tests for the Subscriptions API class.
"""
import unittest
import mws
from .utils import CommonRequestTestTools
class SubscriptionsTestCase(unittest.TestCase, CommonRequestTestTools):
"""
Test cases for Subscriptions.
"""
# TODO: Add remaining methods for Subscriptions
def setUp(self):
... | <commit_before><commit_msg>Add stub for Subscriptions API testing<commit_after> | """
Tests for the Subscriptions API class.
"""
import unittest
import mws
from .utils import CommonRequestTestTools
class SubscriptionsTestCase(unittest.TestCase, CommonRequestTestTools):
"""
Test cases for Subscriptions.
"""
# TODO: Add remaining methods for Subscriptions
def setUp(self):
... | Add stub for Subscriptions API testing"""
Tests for the Subscriptions API class.
"""
import unittest
import mws
from .utils import CommonRequestTestTools
class SubscriptionsTestCase(unittest.TestCase, CommonRequestTestTools):
"""
Test cases for Subscriptions.
"""
# TODO: Add remaining methods for Subs... | <commit_before><commit_msg>Add stub for Subscriptions API testing<commit_after>"""
Tests for the Subscriptions API class.
"""
import unittest
import mws
from .utils import CommonRequestTestTools
class SubscriptionsTestCase(unittest.TestCase, CommonRequestTestTools):
"""
Test cases for Subscriptions.
"""
... | |
e67e32605552ebfd07e7ade5360b560c4010bd31 | fluent_blogs/migrations/0003_author_on_delete_set_null.py | fluent_blogs/migrations/0003_author_on_delete_set_null.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-30 19:25
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fluent_blogs', '0002_intro... | Add missing migration for on_delete=SET_NULL change | Add missing migration for on_delete=SET_NULL change
Added in Django 2.0 preparation (f9762719be92d0f33ead67ffa942a030ff514761)
| Python | apache-2.0 | edoburu/django-fluent-blogs,edoburu/django-fluent-blogs | Add missing migration for on_delete=SET_NULL change
Added in Django 2.0 preparation (f9762719be92d0f33ead67ffa942a030ff514761) | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-30 19:25
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fluent_blogs', '0002_intro... | <commit_before><commit_msg>Add missing migration for on_delete=SET_NULL change
Added in Django 2.0 preparation (f9762719be92d0f33ead67ffa942a030ff514761)<commit_after> | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-30 19:25
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fluent_blogs', '0002_intro... | Add missing migration for on_delete=SET_NULL change
Added in Django 2.0 preparation (f9762719be92d0f33ead67ffa942a030ff514761)# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-30 19:25
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
impor... | <commit_before><commit_msg>Add missing migration for on_delete=SET_NULL change
Added in Django 2.0 preparation (f9762719be92d0f33ead67ffa942a030ff514761)<commit_after># -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-30 19:25
from __future__ import unicode_literals
from django.conf import settings
from ... | |
2c0903218ec0c4ec710f12660c83a23964f177ba | atlassian_jwt_auth/tests/test_verifier.py | atlassian_jwt_auth/tests/test_verifier.py | import unittest
import mock
from ..signer import JWTAuthSigner
from ..verifier import JWTAuthVerifier
from .utils import (
get_new_rsa_private_key_in_pem_format,
get_public_key_pem_for_private_key_pem,
)
class TestJWTAuthVerifier(unittest.TestCase):
""" tests for the JWTAuthVerifier class. """
def... | Add a test for the JWTAuthVerifier. | Add a test for the JWTAuthVerifier.
Signed-off-by: David Black <c4b737561a711e07c31fd1e1811f33a5d770e31c@atlassian.com>
| Python | mit | atlassian/asap-authentication-python | Add a test for the JWTAuthVerifier.
Signed-off-by: David Black <c4b737561a711e07c31fd1e1811f33a5d770e31c@atlassian.com> | import unittest
import mock
from ..signer import JWTAuthSigner
from ..verifier import JWTAuthVerifier
from .utils import (
get_new_rsa_private_key_in_pem_format,
get_public_key_pem_for_private_key_pem,
)
class TestJWTAuthVerifier(unittest.TestCase):
""" tests for the JWTAuthVerifier class. """
def... | <commit_before><commit_msg>Add a test for the JWTAuthVerifier.
Signed-off-by: David Black <c4b737561a711e07c31fd1e1811f33a5d770e31c@atlassian.com><commit_after> | import unittest
import mock
from ..signer import JWTAuthSigner
from ..verifier import JWTAuthVerifier
from .utils import (
get_new_rsa_private_key_in_pem_format,
get_public_key_pem_for_private_key_pem,
)
class TestJWTAuthVerifier(unittest.TestCase):
""" tests for the JWTAuthVerifier class. """
def... | Add a test for the JWTAuthVerifier.
Signed-off-by: David Black <c4b737561a711e07c31fd1e1811f33a5d770e31c@atlassian.com>import unittest
import mock
from ..signer import JWTAuthSigner
from ..verifier import JWTAuthVerifier
from .utils import (
get_new_rsa_private_key_in_pem_format,
get_public_key_pem_for_priva... | <commit_before><commit_msg>Add a test for the JWTAuthVerifier.
Signed-off-by: David Black <c4b737561a711e07c31fd1e1811f33a5d770e31c@atlassian.com><commit_after>import unittest
import mock
from ..signer import JWTAuthSigner
from ..verifier import JWTAuthVerifier
from .utils import (
get_new_rsa_private_key_in_pem... | |
e2eda2123f24f65f3c17626b95abca28ed951479 | gen_sine_table.py | gen_sine_table.py | import math
with open("sine_table.h", "w") as f:
sines = []
for i in range(-1, 362):
sines.append(str("%.15f" % math.sin(math.radians(i))))
f.write("""#ifndef SINE_TABLE_H
#define SINE_TABLE_H
const double sine_table[] = { %s };
#endif /* SINE_TABLE_H */""" % (", ".join(sines), ))
| Use script to generate sine table for interpolation | Use script to generate sine table for interpolation
| Python | mit | ranisalt/epos-pcm-to-rgb,ranisalt/epos-pcm-to-rgb | Use script to generate sine table for interpolation | import math
with open("sine_table.h", "w") as f:
sines = []
for i in range(-1, 362):
sines.append(str("%.15f" % math.sin(math.radians(i))))
f.write("""#ifndef SINE_TABLE_H
#define SINE_TABLE_H
const double sine_table[] = { %s };
#endif /* SINE_TABLE_H */""" % (", ".join(sines), ))
| <commit_before><commit_msg>Use script to generate sine table for interpolation<commit_after> | import math
with open("sine_table.h", "w") as f:
sines = []
for i in range(-1, 362):
sines.append(str("%.15f" % math.sin(math.radians(i))))
f.write("""#ifndef SINE_TABLE_H
#define SINE_TABLE_H
const double sine_table[] = { %s };
#endif /* SINE_TABLE_H */""" % (", ".join(sines), ))
| Use script to generate sine table for interpolationimport math
with open("sine_table.h", "w") as f:
sines = []
for i in range(-1, 362):
sines.append(str("%.15f" % math.sin(math.radians(i))))
f.write("""#ifndef SINE_TABLE_H
#define SINE_TABLE_H
const double sine_table[] = { %s };
#endif /* SI... | <commit_before><commit_msg>Use script to generate sine table for interpolation<commit_after>import math
with open("sine_table.h", "w") as f:
sines = []
for i in range(-1, 362):
sines.append(str("%.15f" % math.sin(math.radians(i))))
f.write("""#ifndef SINE_TABLE_H
#define SINE_TABLE_H
const do... | |
25958e50f39a747a871961b5d97f027a925b7928 | code/data_setup/parse_alov_bb.py | code/data_setup/parse_alov_bb.py | """A script for parsing the Alov bounding box `.ann` files."""
import sys
import os
import itertools
import pandas as pd
import xml.etree.ElementTree as ET
if __name__ == '__main__':
bbox_dir = sys.argv[1]
output_filepath = sys.argv[2]
ann_files_by_dir = (i[2] for i in os.walk(bbox_dir))
bbox_ann_f... | Initialize alov parsing code with main block | Initialize alov parsing code with main block
| Python | mit | dansbecker/motion-tracking | Initialize alov parsing code with main block | """A script for parsing the Alov bounding box `.ann` files."""
import sys
import os
import itertools
import pandas as pd
import xml.etree.ElementTree as ET
if __name__ == '__main__':
bbox_dir = sys.argv[1]
output_filepath = sys.argv[2]
ann_files_by_dir = (i[2] for i in os.walk(bbox_dir))
bbox_ann_f... | <commit_before><commit_msg>Initialize alov parsing code with main block<commit_after> | """A script for parsing the Alov bounding box `.ann` files."""
import sys
import os
import itertools
import pandas as pd
import xml.etree.ElementTree as ET
if __name__ == '__main__':
bbox_dir = sys.argv[1]
output_filepath = sys.argv[2]
ann_files_by_dir = (i[2] for i in os.walk(bbox_dir))
bbox_ann_f... | Initialize alov parsing code with main block"""A script for parsing the Alov bounding box `.ann` files."""
import sys
import os
import itertools
import pandas as pd
import xml.etree.ElementTree as ET
if __name__ == '__main__':
bbox_dir = sys.argv[1]
output_filepath = sys.argv[2]
ann_files_by_dir = (i[2... | <commit_before><commit_msg>Initialize alov parsing code with main block<commit_after>"""A script for parsing the Alov bounding box `.ann` files."""
import sys
import os
import itertools
import pandas as pd
import xml.etree.ElementTree as ET
if __name__ == '__main__':
bbox_dir = sys.argv[1]
output_filepath ... | |
375e97c18daa7f12896dd3f6b9dccd179f22aa03 | gym_frozen_lake.py | gym_frozen_lake.py | # -*- coding: utf-8 -*-
import gym
from gym import wrappers
import numpy as np
import agent
# helper function and dictionaries
def running_average(a, size=100):
"""calculates the running average over array a"""
ra = []
ra.append(np.sum(a[:size]))
for i in range(size, len(a)):
ra.append(ra[... | Add solution for OpenAI gym frozen lake environment | Add solution for OpenAI gym frozen lake environment
| Python | mit | jakobj/python-tdl | Add solution for OpenAI gym frozen lake environment | # -*- coding: utf-8 -*-
import gym
from gym import wrappers
import numpy as np
import agent
# helper function and dictionaries
def running_average(a, size=100):
"""calculates the running average over array a"""
ra = []
ra.append(np.sum(a[:size]))
for i in range(size, len(a)):
ra.append(ra[... | <commit_before><commit_msg>Add solution for OpenAI gym frozen lake environment<commit_after> | # -*- coding: utf-8 -*-
import gym
from gym import wrappers
import numpy as np
import agent
# helper function and dictionaries
def running_average(a, size=100):
"""calculates the running average over array a"""
ra = []
ra.append(np.sum(a[:size]))
for i in range(size, len(a)):
ra.append(ra[... | Add solution for OpenAI gym frozen lake environment# -*- coding: utf-8 -*-
import gym
from gym import wrappers
import numpy as np
import agent
# helper function and dictionaries
def running_average(a, size=100):
"""calculates the running average over array a"""
ra = []
ra.append(np.sum(a[:size]))
... | <commit_before><commit_msg>Add solution for OpenAI gym frozen lake environment<commit_after># -*- coding: utf-8 -*-
import gym
from gym import wrappers
import numpy as np
import agent
# helper function and dictionaries
def running_average(a, size=100):
"""calculates the running average over array a"""
ra ... | |
00ae10769d95445b80be0e8d129fbc76b63aca5a | flexget/utils/soup.py | flexget/utils/soup.py | import html5lib
from html5lib import treebuilders
from cStringIO import StringIO
def get_soup(obj):
if isinstance(obj, basestring):
obj = StringIO(obj)
parser = html5lib.HTMLParser(tree=treebuilders.getTreeBuilder('beautifulsoup'))
return parser.parse(obj)
| import html5lib
from html5lib import treebuilders
from cStringIO import StringIO
# Hack, hide DataLossWarnings
# Based on html5lib code namespaceHTMLElements=False should do it, but nope ...
import warnings
from html5lib.constants import DataLossWarning
warnings.simplefilter('ignore', DataLossWarning)
def get_soup(o... | Hide DataLossWarnings that appeared with html5lib 0.90 or so. | Hide DataLossWarnings that appeared with html5lib 0.90 or so.
git-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@1124 3942dd89-8c5d-46d7-aeed-044bccf3e60c
| Python | mit | qk4l/Flexget,sean797/Flexget,ZefQ/Flexget,qk4l/Flexget,tobinjt/Flexget,grrr2/Flexget,jacobmetrick/Flexget,oxc/Flexget,camon/Flexget,crawln45/Flexget,xfouloux/Flexget,thalamus/Flexget,JorisDeRieck/Flexget,vfrc2/Flexget,patsissons/Flexget,cvium/Flexget,ianstalk/Flexget,tvcsantos/Flexget,jawilson/Flexget,OmgOhnoes/Flexget... | import html5lib
from html5lib import treebuilders
from cStringIO import StringIO
def get_soup(obj):
if isinstance(obj, basestring):
obj = StringIO(obj)
parser = html5lib.HTMLParser(tree=treebuilders.getTreeBuilder('beautifulsoup'))
return parser.parse(obj)
Hide DataLossWarnings that appeared with h... | import html5lib
from html5lib import treebuilders
from cStringIO import StringIO
# Hack, hide DataLossWarnings
# Based on html5lib code namespaceHTMLElements=False should do it, but nope ...
import warnings
from html5lib.constants import DataLossWarning
warnings.simplefilter('ignore', DataLossWarning)
def get_soup(o... | <commit_before>import html5lib
from html5lib import treebuilders
from cStringIO import StringIO
def get_soup(obj):
if isinstance(obj, basestring):
obj = StringIO(obj)
parser = html5lib.HTMLParser(tree=treebuilders.getTreeBuilder('beautifulsoup'))
return parser.parse(obj)
<commit_msg>Hide DataLossWa... | import html5lib
from html5lib import treebuilders
from cStringIO import StringIO
# Hack, hide DataLossWarnings
# Based on html5lib code namespaceHTMLElements=False should do it, but nope ...
import warnings
from html5lib.constants import DataLossWarning
warnings.simplefilter('ignore', DataLossWarning)
def get_soup(o... | import html5lib
from html5lib import treebuilders
from cStringIO import StringIO
def get_soup(obj):
if isinstance(obj, basestring):
obj = StringIO(obj)
parser = html5lib.HTMLParser(tree=treebuilders.getTreeBuilder('beautifulsoup'))
return parser.parse(obj)
Hide DataLossWarnings that appeared with h... | <commit_before>import html5lib
from html5lib import treebuilders
from cStringIO import StringIO
def get_soup(obj):
if isinstance(obj, basestring):
obj = StringIO(obj)
parser = html5lib.HTMLParser(tree=treebuilders.getTreeBuilder('beautifulsoup'))
return parser.parse(obj)
<commit_msg>Hide DataLossWa... |
0d94db97e795c572c723390ad2e4f978bb9d6296 | nova/tests/virt_unittest.py | nova/tests/virt_unittest.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2010 OpenStack LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | Add new libvirt_type option "uml" for user-mode-linux.. This switches the libvirt URI to uml:///system and uses a different template for the libvirt xml. | Add new libvirt_type option "uml" for user-mode-linux.. This switches the libvirt URI to uml:///system and uses a different template for the libvirt xml. | Python | apache-2.0 | n0ano/gantt,n0ano/gantt | Add new libvirt_type option "uml" for user-mode-linux.. This switches the libvirt URI to uml:///system and uses a different template for the libvirt xml. | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2010 OpenStack LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | <commit_before><commit_msg>Add new libvirt_type option "uml" for user-mode-linux.. This switches the libvirt URI to uml:///system and uses a different template for the libvirt xml.<commit_after> | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2010 OpenStack LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | Add new libvirt_type option "uml" for user-mode-linux.. This switches the libvirt URI to uml:///system and uses a different template for the libvirt xml.# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2010 OpenStack LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not... | <commit_before><commit_msg>Add new libvirt_type option "uml" for user-mode-linux.. This switches the libvirt URI to uml:///system and uses a different template for the libvirt xml.<commit_after># vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2010 OpenStack LLC
#
# Licensed under the Apache License, Vers... | |
cf9ce9293666201a4fabb7439a440c538ba77b47 | oauth2/test/__init__.py | oauth2/test/__init__.py | import sys
# Enables unit tests to be work under Python 2.6
# Code copied from https://github.com/facebook/tornado/blob/master/tornado/test/util.py
if sys.version_info >= (2, 7):
import unittest
else:
import unittest2 as unittest
| Handle import of unittest2 in python 2.6 | Handle import of unittest2 in python 2.6
| Python | mit | mygola/python-oauth2,wndhydrnt/python-oauth2,mygola/python-oauth2,mygola/python-oauth2,wndhydrnt/python-oauth2,gcd0318/python-oauth2,gcd0318/python-oauth2,CoolCloud/python-oauth2,candango/python-oauth2,candango/python-oauth2,CoolCloud/python-oauth2,candango/python-oauth2,CoolCloud/python-oauth2,wndhydrnt/python-oauth2,... | Handle import of unittest2 in python 2.6 | import sys
# Enables unit tests to be work under Python 2.6
# Code copied from https://github.com/facebook/tornado/blob/master/tornado/test/util.py
if sys.version_info >= (2, 7):
import unittest
else:
import unittest2 as unittest
| <commit_before><commit_msg>Handle import of unittest2 in python 2.6<commit_after> | import sys
# Enables unit tests to be work under Python 2.6
# Code copied from https://github.com/facebook/tornado/blob/master/tornado/test/util.py
if sys.version_info >= (2, 7):
import unittest
else:
import unittest2 as unittest
| Handle import of unittest2 in python 2.6import sys
# Enables unit tests to be work under Python 2.6
# Code copied from https://github.com/facebook/tornado/blob/master/tornado/test/util.py
if sys.version_info >= (2, 7):
import unittest
else:
import unittest2 as unittest
| <commit_before><commit_msg>Handle import of unittest2 in python 2.6<commit_after>import sys
# Enables unit tests to be work under Python 2.6
# Code copied from https://github.com/facebook/tornado/blob/master/tornado/test/util.py
if sys.version_info >= (2, 7):
import unittest
else:
import unittest2 as unittest... | |
3badc580de36ff0285f065e6924887cab4e3a48b | DataTag/management/commands/addtags.py | DataTag/management/commands/addtags.py | # -*- coding: utf-8 -*-
# vim: set ts=
from __future__ import unicode_literals
from django.conf import settings
from django.core.management.base import BaseCommand
from optparse import make_option
import yaml
class Command(BaseCommand):
args = None
help = 'Collect the tags from the sub-directories'
opt... | Add an helper to create the metadata for a dir | Add an helper to create the metadata for a dir
| Python | agpl-3.0 | ivoire/DataTag,ivoire/DataTag,ivoire/DataTag | Add an helper to create the metadata for a dir | # -*- coding: utf-8 -*-
# vim: set ts=
from __future__ import unicode_literals
from django.conf import settings
from django.core.management.base import BaseCommand
from optparse import make_option
import yaml
class Command(BaseCommand):
args = None
help = 'Collect the tags from the sub-directories'
opt... | <commit_before><commit_msg>Add an helper to create the metadata for a dir<commit_after> | # -*- coding: utf-8 -*-
# vim: set ts=
from __future__ import unicode_literals
from django.conf import settings
from django.core.management.base import BaseCommand
from optparse import make_option
import yaml
class Command(BaseCommand):
args = None
help = 'Collect the tags from the sub-directories'
opt... | Add an helper to create the metadata for a dir# -*- coding: utf-8 -*-
# vim: set ts=
from __future__ import unicode_literals
from django.conf import settings
from django.core.management.base import BaseCommand
from optparse import make_option
import yaml
class Command(BaseCommand):
args = None
help = 'Coll... | <commit_before><commit_msg>Add an helper to create the metadata for a dir<commit_after># -*- coding: utf-8 -*-
# vim: set ts=
from __future__ import unicode_literals
from django.conf import settings
from django.core.management.base import BaseCommand
from optparse import make_option
import yaml
class Command(BaseC... | |
be8b2f0d82131f04bd4c3e4d8d4a017734e4efa6 | python/use_decorator.py | python/use_decorator.py | #class to print out the x, y coordinate
class Coordinate(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __repr__(self):
return "Coord: " + str(self.__dict__)
#function to add
def add(a, b):
return Coordinate(a.x + b.x, a.y + b.y)
#function to substract
... | Add a script to show how to use decorator | Add a script to show how to use decorator
| Python | bsd-3-clause | qingkaikong/useful_script,qingkaikong/useful_script,qingkaikong/useful_script,qingkaikong/useful_script,qingkaikong/useful_script | Add a script to show how to use decorator | #class to print out the x, y coordinate
class Coordinate(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __repr__(self):
return "Coord: " + str(self.__dict__)
#function to add
def add(a, b):
return Coordinate(a.x + b.x, a.y + b.y)
#function to substract
... | <commit_before><commit_msg>Add a script to show how to use decorator<commit_after> | #class to print out the x, y coordinate
class Coordinate(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __repr__(self):
return "Coord: " + str(self.__dict__)
#function to add
def add(a, b):
return Coordinate(a.x + b.x, a.y + b.y)
#function to substract
... | Add a script to show how to use decorator#class to print out the x, y coordinate
class Coordinate(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __repr__(self):
return "Coord: " + str(self.__dict__)
#function to add
def add(a, b):
return Coordinate(a.x + b.x, a... | <commit_before><commit_msg>Add a script to show how to use decorator<commit_after>#class to print out the x, y coordinate
class Coordinate(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __repr__(self):
return "Coord: " + str(self.__dict__)
#function to add
def add(... | |
127a9b4a71863844af4e8c573a962802d10a6403 | tests/test_output.py | tests/test_output.py | #!/usr/bin/env python
"""
Unit tests for the output of see for various types of object.
"""
import itertools
try:
import unittest2 as unittest
except ImportError:
import unittest
import see
def union(*sets):
return set(itertools.chain(*sets))
SIGN_OPS = set(['+obj', '-obj'])
NUMBER_OPS = set('+ - * ... | Test some expected output of see() for int & float | Test some expected output of see() for int & float
| Python | bsd-3-clause | araile/see | Test some expected output of see() for int & float | #!/usr/bin/env python
"""
Unit tests for the output of see for various types of object.
"""
import itertools
try:
import unittest2 as unittest
except ImportError:
import unittest
import see
def union(*sets):
return set(itertools.chain(*sets))
SIGN_OPS = set(['+obj', '-obj'])
NUMBER_OPS = set('+ - * ... | <commit_before><commit_msg>Test some expected output of see() for int & float<commit_after> | #!/usr/bin/env python
"""
Unit tests for the output of see for various types of object.
"""
import itertools
try:
import unittest2 as unittest
except ImportError:
import unittest
import see
def union(*sets):
return set(itertools.chain(*sets))
SIGN_OPS = set(['+obj', '-obj'])
NUMBER_OPS = set('+ - * ... | Test some expected output of see() for int & float#!/usr/bin/env python
"""
Unit tests for the output of see for various types of object.
"""
import itertools
try:
import unittest2 as unittest
except ImportError:
import unittest
import see
def union(*sets):
return set(itertools.chain(*sets))
SIGN_OPS... | <commit_before><commit_msg>Test some expected output of see() for int & float<commit_after>#!/usr/bin/env python
"""
Unit tests for the output of see for various types of object.
"""
import itertools
try:
import unittest2 as unittest
except ImportError:
import unittest
import see
def union(*sets):
retu... | |
20d3f464a252df8226d58c45a86cc1a959814e59 | django_mysql/utils.py | django_mysql/utils.py | # -*- coding:utf-8 -*-
from __future__ import division
class WeightedAverageRate(object):
# Sub: new
#
# Required Arguments:
# target_t - Target time for t in <update()>
#
# Optional Arguments:
# weight - Weight of previous n/t values (default 0.75).
#
# Returns:
# Weig... | Move towards using the weighted average strategy of pt-online-schema-change | Move towards using the weighted average strategy of pt-online-schema-change
| Python | mit | nickmeharry/django-mysql,graingert/django-mysql,arnau126/django-mysql,adamchainz/django-mysql,arnau126/django-mysql,graingert/django-mysql,nickmeharry/django-mysql | Move towards using the weighted average strategy of pt-online-schema-change | # -*- coding:utf-8 -*-
from __future__ import division
class WeightedAverageRate(object):
# Sub: new
#
# Required Arguments:
# target_t - Target time for t in <update()>
#
# Optional Arguments:
# weight - Weight of previous n/t values (default 0.75).
#
# Returns:
# Weig... | <commit_before><commit_msg>Move towards using the weighted average strategy of pt-online-schema-change<commit_after> | # -*- coding:utf-8 -*-
from __future__ import division
class WeightedAverageRate(object):
# Sub: new
#
# Required Arguments:
# target_t - Target time for t in <update()>
#
# Optional Arguments:
# weight - Weight of previous n/t values (default 0.75).
#
# Returns:
# Weig... | Move towards using the weighted average strategy of pt-online-schema-change# -*- coding:utf-8 -*-
from __future__ import division
class WeightedAverageRate(object):
# Sub: new
#
# Required Arguments:
# target_t - Target time for t in <update()>
#
# Optional Arguments:
# weight - Weig... | <commit_before><commit_msg>Move towards using the weighted average strategy of pt-online-schema-change<commit_after># -*- coding:utf-8 -*-
from __future__ import division
class WeightedAverageRate(object):
# Sub: new
#
# Required Arguments:
# target_t - Target time for t in <update()>
#
# ... | |
ef5d6cd3989de2f97ba20799ce5f34b87b320128 | paper_to_git/commands/add_command.py | paper_to_git/commands/add_command.py | """
Add a new sync object to sync between a git repo and Dropbox Paper.
"""
import os
from paper_to_git.commands.base import BaseCommand
from paper_to_git.models import Sync, PaperFolder
__all__ = [
'AddCommand',
]
class AddCommand(BaseCommand):
"""Add a new sync object between paper and git.
"""
... | Create add command to add new sync. | Create add command to add new sync.
| Python | apache-2.0 | maxking/paper-to-git,maxking/paper-to-git | Create add command to add new sync. | """
Add a new sync object to sync between a git repo and Dropbox Paper.
"""
import os
from paper_to_git.commands.base import BaseCommand
from paper_to_git.models import Sync, PaperFolder
__all__ = [
'AddCommand',
]
class AddCommand(BaseCommand):
"""Add a new sync object between paper and git.
"""
... | <commit_before><commit_msg>Create add command to add new sync.<commit_after> | """
Add a new sync object to sync between a git repo and Dropbox Paper.
"""
import os
from paper_to_git.commands.base import BaseCommand
from paper_to_git.models import Sync, PaperFolder
__all__ = [
'AddCommand',
]
class AddCommand(BaseCommand):
"""Add a new sync object between paper and git.
"""
... | Create add command to add new sync."""
Add a new sync object to sync between a git repo and Dropbox Paper.
"""
import os
from paper_to_git.commands.base import BaseCommand
from paper_to_git.models import Sync, PaperFolder
__all__ = [
'AddCommand',
]
class AddCommand(BaseCommand):
"""Add a new sync obje... | <commit_before><commit_msg>Create add command to add new sync.<commit_after>"""
Add a new sync object to sync between a git repo and Dropbox Paper.
"""
import os
from paper_to_git.commands.base import BaseCommand
from paper_to_git.models import Sync, PaperFolder
__all__ = [
'AddCommand',
]
class AddCommand... | |
baaa94fcbb34ba8b1fe47d95537820e7ddfb0d7e | scikits/learn/externals/setup.py | scikits/learn/externals/setup.py | # -*- coding: utf-8 -*-
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('externals',parent_package,top_path)
config.add_subpackage('joblib')
config.add_subpackage('joblib/test')
return config
| Make sure that joblib does get installed. | BUG: Make sure that joblib does get installed.
| Python | bsd-3-clause | carrillo/scikit-learn,jorik041/scikit-learn,vibhorag/scikit-learn,nrhine1/scikit-learn,jorge2703/scikit-learn,rvraghav93/scikit-learn,ZENGXH/scikit-learn,stylianos-kampakis/scikit-learn,chrsrds/scikit-learn,tomlof/scikit-learn,kmike/scikit-learn,lin-credible/scikit-learn,cybernet14/scikit-learn,trankmichael/scikit-lear... | BUG: Make sure that joblib does get installed. | # -*- coding: utf-8 -*-
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('externals',parent_package,top_path)
config.add_subpackage('joblib')
config.add_subpackage('joblib/test')
return config
| <commit_before><commit_msg>BUG: Make sure that joblib does get installed.<commit_after> | # -*- coding: utf-8 -*-
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('externals',parent_package,top_path)
config.add_subpackage('joblib')
config.add_subpackage('joblib/test')
return config
| BUG: Make sure that joblib does get installed.# -*- coding: utf-8 -*-
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('externals',parent_package,top_path)
config.add_subpackage('joblib')
config.add_subpackage('joblib/test')... | <commit_before><commit_msg>BUG: Make sure that joblib does get installed.<commit_after># -*- coding: utf-8 -*-
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('externals',parent_package,top_path)
config.add_subpackage('joblib')... | |
612407d887ade72d7718b62c7a325821059bd9bc | scripts/restore_file.py | scripts/restore_file.py | # -*- coding: utf-8 -*-
"""Restore a deleted StoredFileNode. If the file was reuploaded, renames the file
to <filename> (restored).<ext>. For example, README.rst would be renamed to README (restored).rst.
python -m scripts.restore_file 123ab --dry
python -m scripts.restore_file 123ab
"""
import sys
import os
... | Add script to restore deleted files | Add script to restore deleted files
| Python | apache-2.0 | rdhyee/osf.io,icereval/osf.io,alexschiller/osf.io,felliott/osf.io,emetsger/osf.io,saradbowman/osf.io,DanielSBrown/osf.io,Nesiehr/osf.io,Johnetordoff/osf.io,abought/osf.io,RomanZWang/osf.io,aaxelb/osf.io,wearpants/osf.io,sloria/osf.io,HalcyonChimera/osf.io,mattclark/osf.io,mluke93/osf.io,sloria/osf.io,crcresearch/osf.io... | Add script to restore deleted files | # -*- coding: utf-8 -*-
"""Restore a deleted StoredFileNode. If the file was reuploaded, renames the file
to <filename> (restored).<ext>. For example, README.rst would be renamed to README (restored).rst.
python -m scripts.restore_file 123ab --dry
python -m scripts.restore_file 123ab
"""
import sys
import os
... | <commit_before><commit_msg>Add script to restore deleted files<commit_after> | # -*- coding: utf-8 -*-
"""Restore a deleted StoredFileNode. If the file was reuploaded, renames the file
to <filename> (restored).<ext>. For example, README.rst would be renamed to README (restored).rst.
python -m scripts.restore_file 123ab --dry
python -m scripts.restore_file 123ab
"""
import sys
import os
... | Add script to restore deleted files# -*- coding: utf-8 -*-
"""Restore a deleted StoredFileNode. If the file was reuploaded, renames the file
to <filename> (restored).<ext>. For example, README.rst would be renamed to README (restored).rst.
python -m scripts.restore_file 123ab --dry
python -m scripts.restore_fi... | <commit_before><commit_msg>Add script to restore deleted files<commit_after># -*- coding: utf-8 -*-
"""Restore a deleted StoredFileNode. If the file was reuploaded, renames the file
to <filename> (restored).<ext>. For example, README.rst would be renamed to README (restored).rst.
python -m scripts.restore_file 123... | |
d1cf10c0ad29f310a90d9ada7af4f9098344183a | src/data/retrieve_ned_files.py | src/data/retrieve_ned_files.py | # Copyright 2016 SAS Project 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 requ... | Add a script to retrieve NED elevation map files. | Add a script to retrieve NED elevation map files.
Retrieves base tileset zip files and updates. According to the USGS
NED website, the longer filenames are updates to the base tileset.
These are frequently replacing existing tiles, but may also augment
the dataset by filling in gaps in the coverage.
The coverage is c... | Python | apache-2.0 | Wireless-Innovation-Forum/Spectrum-Access-System,krlinus/Spectrum-Access-System,Wireless-Innovation-Forum/Spectrum-Access-System,gregbillock/Spectrum-Access-System,gregbillock/Spectrum-Access-System,gregbillock/Spectrum-Access-System,Wireless-Innovation-Forum/Spectrum-Access-System,Wireless-Innovation-Forum/Spectrum-Ac... | Add a script to retrieve NED elevation map files.
Retrieves base tileset zip files and updates. According to the USGS
NED website, the longer filenames are updates to the base tileset.
These are frequently replacing existing tiles, but may also augment
the dataset by filling in gaps in the coverage.
The coverage is c... | # Copyright 2016 SAS Project 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 requ... | <commit_before><commit_msg>Add a script to retrieve NED elevation map files.
Retrieves base tileset zip files and updates. According to the USGS
NED website, the longer filenames are updates to the base tileset.
These are frequently replacing existing tiles, but may also augment
the dataset by filling in gaps in the c... | # Copyright 2016 SAS Project 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 requ... | Add a script to retrieve NED elevation map files.
Retrieves base tileset zip files and updates. According to the USGS
NED website, the longer filenames are updates to the base tileset.
These are frequently replacing existing tiles, but may also augment
the dataset by filling in gaps in the coverage.
The coverage is c... | <commit_before><commit_msg>Add a script to retrieve NED elevation map files.
Retrieves base tileset zip files and updates. According to the USGS
NED website, the longer filenames are updates to the base tileset.
These are frequently replacing existing tiles, but may also augment
the dataset by filling in gaps in the c... | |
0144fda08af4513fb03be59b4c3dc0a13373a806 | via/views/blocker.py | via/views/blocker.py | """View decorators to integrate with checkmate's API."""
import logging
from checkmatelib import CheckmateClient, CheckmateException
from pyramid.httpexceptions import HTTPTemporaryRedirect
logger = logging.getLogger(__name__)
def checkmate_block(view, url_param="url", allow_all=True):
"""Intended to be used as... | Add decorator to test url against checkamte | Add decorator to test url against checkamte
| Python | bsd-2-clause | hypothesis/via,hypothesis/via,hypothesis/via | Add decorator to test url against checkamte | """View decorators to integrate with checkmate's API."""
import logging
from checkmatelib import CheckmateClient, CheckmateException
from pyramid.httpexceptions import HTTPTemporaryRedirect
logger = logging.getLogger(__name__)
def checkmate_block(view, url_param="url", allow_all=True):
"""Intended to be used as... | <commit_before><commit_msg>Add decorator to test url against checkamte<commit_after> | """View decorators to integrate with checkmate's API."""
import logging
from checkmatelib import CheckmateClient, CheckmateException
from pyramid.httpexceptions import HTTPTemporaryRedirect
logger = logging.getLogger(__name__)
def checkmate_block(view, url_param="url", allow_all=True):
"""Intended to be used as... | Add decorator to test url against checkamte"""View decorators to integrate with checkmate's API."""
import logging
from checkmatelib import CheckmateClient, CheckmateException
from pyramid.httpexceptions import HTTPTemporaryRedirect
logger = logging.getLogger(__name__)
def checkmate_block(view, url_param="url", all... | <commit_before><commit_msg>Add decorator to test url against checkamte<commit_after>"""View decorators to integrate with checkmate's API."""
import logging
from checkmatelib import CheckmateClient, CheckmateException
from pyramid.httpexceptions import HTTPTemporaryRedirect
logger = logging.getLogger(__name__)
def c... | |
b6cabee2b7697b532e5ba625123e904ffd838d6e | data_analysis/analyze_results.py | data_analysis/analyze_results.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Usage: analyze_results.py <result_data>
"""
from docopt import docopt
import pandas as pd
import numpy as np
from sklearn.metrics import mean_squared_error
from sklearn.metrics import r2_score
# Useful way to run the algorithm over multiple files
#
# for file in `ls ... | Add simple script to print some metrics. | [data_analysis] Add simple script to print some metrics.
| Python | mit | geektoni/Influenza-Like-Illness-Predictor,geektoni/Influenza-Like-Illness-Predictor | [data_analysis] Add simple script to print some metrics. | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Usage: analyze_results.py <result_data>
"""
from docopt import docopt
import pandas as pd
import numpy as np
from sklearn.metrics import mean_squared_error
from sklearn.metrics import r2_score
# Useful way to run the algorithm over multiple files
#
# for file in `ls ... | <commit_before><commit_msg>[data_analysis] Add simple script to print some metrics.<commit_after> | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Usage: analyze_results.py <result_data>
"""
from docopt import docopt
import pandas as pd
import numpy as np
from sklearn.metrics import mean_squared_error
from sklearn.metrics import r2_score
# Useful way to run the algorithm over multiple files
#
# for file in `ls ... | [data_analysis] Add simple script to print some metrics.#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Usage: analyze_results.py <result_data>
"""
from docopt import docopt
import pandas as pd
import numpy as np
from sklearn.metrics import mean_squared_error
from sklearn.metrics import r2_score
# Useful way to ru... | <commit_before><commit_msg>[data_analysis] Add simple script to print some metrics.<commit_after>#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Usage: analyze_results.py <result_data>
"""
from docopt import docopt
import pandas as pd
import numpy as np
from sklearn.metrics import mean_squared_error
from sklearn.me... | |
4c91252a47b8c3e096897d994df1fc5e4d6c9a9f | databroker/tests/test_queries.py | databroker/tests/test_queries.py | import pickle
import pytest
from ..queries import TimeRange
def test_time_range():
empty = TimeRange()
assert empty == dict(empty) == empty.query == {}
assert TimeRange(**empty.kwargs) == empty
since = TimeRange(since='2020')
expected = {'time': {'$gte': 1577854800.0}}
assert since == dict(... | Add tests for query objects. | Add tests for query objects.
| Python | bsd-3-clause | ericdill/databroker,ericdill/databroker | Add tests for query objects. | import pickle
import pytest
from ..queries import TimeRange
def test_time_range():
empty = TimeRange()
assert empty == dict(empty) == empty.query == {}
assert TimeRange(**empty.kwargs) == empty
since = TimeRange(since='2020')
expected = {'time': {'$gte': 1577854800.0}}
assert since == dict(... | <commit_before><commit_msg>Add tests for query objects.<commit_after> | import pickle
import pytest
from ..queries import TimeRange
def test_time_range():
empty = TimeRange()
assert empty == dict(empty) == empty.query == {}
assert TimeRange(**empty.kwargs) == empty
since = TimeRange(since='2020')
expected = {'time': {'$gte': 1577854800.0}}
assert since == dict(... | Add tests for query objects.import pickle
import pytest
from ..queries import TimeRange
def test_time_range():
empty = TimeRange()
assert empty == dict(empty) == empty.query == {}
assert TimeRange(**empty.kwargs) == empty
since = TimeRange(since='2020')
expected = {'time': {'$gte': 1577854800.0... | <commit_before><commit_msg>Add tests for query objects.<commit_after>import pickle
import pytest
from ..queries import TimeRange
def test_time_range():
empty = TimeRange()
assert empty == dict(empty) == empty.query == {}
assert TimeRange(**empty.kwargs) == empty
since = TimeRange(since='2020')
... | |
3639f1677199da5df01930d3f2a806582e208aad | test/test_bad_hostgroup.py | test/test_bad_hostgroup.py | #!/usr/bin/env python
# Copyright (C) 2009-2014:
# Sebastien Coavoux, s.coavoux@free.frc
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3... | Test - Add test for fix | Enh: Test - Add test for fix
| Python | agpl-3.0 | tal-nino/shinken,mohierf/shinken,staute/shinken_package,dfranco/shinken,titilambert/alignak,naparuba/shinken,lets-software/shinken,savoirfairelinux/shinken,Aimage/shinken,rednach/krill,KerkhoffTechnologies/shinken,tal-nino/shinken,rledisez/shinken,savoirfairelinux/shinken,Simage/shinken,peeyush-tm/shinken,peeyush-tm/sh... | Enh: Test - Add test for fix | #!/usr/bin/env python
# Copyright (C) 2009-2014:
# Sebastien Coavoux, s.coavoux@free.frc
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3... | <commit_before><commit_msg>Enh: Test - Add test for fix<commit_after> | #!/usr/bin/env python
# Copyright (C) 2009-2014:
# Sebastien Coavoux, s.coavoux@free.frc
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3... | Enh: Test - Add test for fix#!/usr/bin/env python
# Copyright (C) 2009-2014:
# Sebastien Coavoux, s.coavoux@free.frc
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software ... | <commit_before><commit_msg>Enh: Test - Add test for fix<commit_after>#!/usr/bin/env python
# Copyright (C) 2009-2014:
# Sebastien Coavoux, s.coavoux@free.frc
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Lic... | |
ff1d6d56cfb04cd382739b1399826c124fb7b31a | find-bug.py | find-bug.py | #!/usr/bin/env python
import argparse, tempfile, sys
from replace_imports import include_imports
parser = argparse.ArgumentParser(description='Attempt to create a small file which reproduces a bug found in a large development.')
parser.add_argument('bug_file', metavar='BUGGY_FILE', type=argparse.FileType('r'),
... | Write a top-level file to wrap the bug-finding process | Write a top-level file to wrap the bug-finding process
| Python | mit | JasonGross/coq-tools,JasonGross/coq-tools | Write a top-level file to wrap the bug-finding process | #!/usr/bin/env python
import argparse, tempfile, sys
from replace_imports import include_imports
parser = argparse.ArgumentParser(description='Attempt to create a small file which reproduces a bug found in a large development.')
parser.add_argument('bug_file', metavar='BUGGY_FILE', type=argparse.FileType('r'),
... | <commit_before><commit_msg>Write a top-level file to wrap the bug-finding process<commit_after> | #!/usr/bin/env python
import argparse, tempfile, sys
from replace_imports import include_imports
parser = argparse.ArgumentParser(description='Attempt to create a small file which reproduces a bug found in a large development.')
parser.add_argument('bug_file', metavar='BUGGY_FILE', type=argparse.FileType('r'),
... | Write a top-level file to wrap the bug-finding process#!/usr/bin/env python
import argparse, tempfile, sys
from replace_imports import include_imports
parser = argparse.ArgumentParser(description='Attempt to create a small file which reproduces a bug found in a large development.')
parser.add_argument('bug_file', meta... | <commit_before><commit_msg>Write a top-level file to wrap the bug-finding process<commit_after>#!/usr/bin/env python
import argparse, tempfile, sys
from replace_imports import include_imports
parser = argparse.ArgumentParser(description='Attempt to create a small file which reproduces a bug found in a large developmen... | |
77dad0076c177244e58d13a0593a6091f2c90340 | scikits/statsmodels/examples/tsa/ex_dates.py | scikits/statsmodels/examples/tsa/ex_dates.py | import scikits.statsmodels.api as sm
import numpy as np
import pandas
# Getting started
# ---------------
data = sm.datasets.sunspots.load()
# Right now an annual date series must be datetimes at the end of the year.
# We can use scikits.timeseries and datetime to create this array.
import datetime
import scikits.t... | Add examples for using dates with TSA models | ENH: Add examples for using dates with TSA models
| Python | bsd-3-clause | josef-pkt/statsmodels,hainm/statsmodels,huongttlan/statsmodels,musically-ut/statsmodels,wzbozon/statsmodels,DonBeo/statsmodels,bavardage/statsmodels,Averroes/statsmodels,jseabold/statsmodels,kiyoto/statsmodels,bert9bert/statsmodels,gef756/statsmodels,wzbozon/statsmodels,wwf5067/statsmodels,wesm/statsmodels,bsipocz/stat... | ENH: Add examples for using dates with TSA models | import scikits.statsmodels.api as sm
import numpy as np
import pandas
# Getting started
# ---------------
data = sm.datasets.sunspots.load()
# Right now an annual date series must be datetimes at the end of the year.
# We can use scikits.timeseries and datetime to create this array.
import datetime
import scikits.t... | <commit_before><commit_msg>ENH: Add examples for using dates with TSA models<commit_after> | import scikits.statsmodels.api as sm
import numpy as np
import pandas
# Getting started
# ---------------
data = sm.datasets.sunspots.load()
# Right now an annual date series must be datetimes at the end of the year.
# We can use scikits.timeseries and datetime to create this array.
import datetime
import scikits.t... | ENH: Add examples for using dates with TSA modelsimport scikits.statsmodels.api as sm
import numpy as np
import pandas
# Getting started
# ---------------
data = sm.datasets.sunspots.load()
# Right now an annual date series must be datetimes at the end of the year.
# We can use scikits.timeseries and datetime to cre... | <commit_before><commit_msg>ENH: Add examples for using dates with TSA models<commit_after>import scikits.statsmodels.api as sm
import numpy as np
import pandas
# Getting started
# ---------------
data = sm.datasets.sunspots.load()
# Right now an annual date series must be datetimes at the end of the year.
# We can u... | |
5b23140f2b9e6f24ddf6162cb0b110640bc3b203 | Primes/pollard_rho.py | Primes/pollard_rho.py | import random
def gcd( a, b):
if(b == 0): return a;
return gcd(b, a % b);
def pollardRho(N):
if N%2==0:
return 2
x = random.randint(1, N-1)
y = x
c = random.randint(1, N-1)
g = 1
while g==1:
x = ((x*x)%N+c)%N
... | Add implementation pollardrho in python. | Add implementation pollardrho in python.
| Python | mit | xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book | Add implementation pollardrho in python. | import random
def gcd( a, b):
if(b == 0): return a;
return gcd(b, a % b);
def pollardRho(N):
if N%2==0:
return 2
x = random.randint(1, N-1)
y = x
c = random.randint(1, N-1)
g = 1
while g==1:
x = ((x*x)%N+c)%N
... | <commit_before><commit_msg>Add implementation pollardrho in python.<commit_after> | import random
def gcd( a, b):
if(b == 0): return a;
return gcd(b, a % b);
def pollardRho(N):
if N%2==0:
return 2
x = random.randint(1, N-1)
y = x
c = random.randint(1, N-1)
g = 1
while g==1:
x = ((x*x)%N+c)%N
... | Add implementation pollardrho in python.import random
def gcd( a, b):
if(b == 0): return a;
return gcd(b, a % b);
def pollardRho(N):
if N%2==0:
return 2
x = random.randint(1, N-1)
y = x
c = random.randint(1, N-1)
g = 1
while g==1:
... | <commit_before><commit_msg>Add implementation pollardrho in python.<commit_after>import random
def gcd( a, b):
if(b == 0): return a;
return gcd(b, a % b);
def pollardRho(N):
if N%2==0:
return 2
x = random.randint(1, N-1)
y = x
c = random.randint(1, N-1)
... | |
cc1f60fc7b97ab7daa5bc26699667898b4c683cd | tests/relative_url_test.py | tests/relative_url_test.py | #! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
# uses the high level interface
import curl
import unittest
from . import app
from . import runwsgi
from . import util
setup_module, teardown_module = runwsgi.app_runner_setup((app.app, 8380))
class RelativeUrlTest(unittest.TestCase):
def setUp(se... | Test coverage for relative urls in curl module | Test coverage for relative urls in curl module
| Python | lgpl-2.1 | p/pycurl-archived,pycurl/pycurl,pycurl/pycurl,p/pycurl-archived,pycurl/pycurl,p/pycurl-archived | Test coverage for relative urls in curl module | #! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
# uses the high level interface
import curl
import unittest
from . import app
from . import runwsgi
from . import util
setup_module, teardown_module = runwsgi.app_runner_setup((app.app, 8380))
class RelativeUrlTest(unittest.TestCase):
def setUp(se... | <commit_before><commit_msg>Test coverage for relative urls in curl module<commit_after> | #! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
# uses the high level interface
import curl
import unittest
from . import app
from . import runwsgi
from . import util
setup_module, teardown_module = runwsgi.app_runner_setup((app.app, 8380))
class RelativeUrlTest(unittest.TestCase):
def setUp(se... | Test coverage for relative urls in curl module#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
# uses the high level interface
import curl
import unittest
from . import app
from . import runwsgi
from . import util
setup_module, teardown_module = runwsgi.app_runner_setup((app.app, 8380))
class Relati... | <commit_before><commit_msg>Test coverage for relative urls in curl module<commit_after>#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
# uses the high level interface
import curl
import unittest
from . import app
from . import runwsgi
from . import util
setup_module, teardown_module = runwsgi.app_ru... | |
b3f4dc3b1799edc9ba1260f09fda90916be43ecd | get_file.py | get_file.py | #!/usr/bin/env python
"""
Download file from Thingiverse.com
"""
import argparse
import os.path
import requests
from thingiverse_crawler import get_download_link
from download_model import download_single_file
def parse_args():
parser = argparse.ArgumentParser(__doc__);
parser.add_argument("--output-dir", he... | Add script to download single file from file_id. | Add script to download single file from file_id.
| Python | mit | qnzhou/ThingiverseCrawler | Add script to download single file from file_id. | #!/usr/bin/env python
"""
Download file from Thingiverse.com
"""
import argparse
import os.path
import requests
from thingiverse_crawler import get_download_link
from download_model import download_single_file
def parse_args():
parser = argparse.ArgumentParser(__doc__);
parser.add_argument("--output-dir", he... | <commit_before><commit_msg>Add script to download single file from file_id.<commit_after> | #!/usr/bin/env python
"""
Download file from Thingiverse.com
"""
import argparse
import os.path
import requests
from thingiverse_crawler import get_download_link
from download_model import download_single_file
def parse_args():
parser = argparse.ArgumentParser(__doc__);
parser.add_argument("--output-dir", he... | Add script to download single file from file_id.#!/usr/bin/env python
"""
Download file from Thingiverse.com
"""
import argparse
import os.path
import requests
from thingiverse_crawler import get_download_link
from download_model import download_single_file
def parse_args():
parser = argparse.ArgumentParser(__do... | <commit_before><commit_msg>Add script to download single file from file_id.<commit_after>#!/usr/bin/env python
"""
Download file from Thingiverse.com
"""
import argparse
import os.path
import requests
from thingiverse_crawler import get_download_link
from download_model import download_single_file
def parse_args():
... | |
5cf0e4369a62e89e34dbe5ea862a7fb5342cc32e | python/merge-kml-files/merge-kml-files.py | python/merge-kml-files/merge-kml-files.py | #!/usr/bin/env python
import sys
import lxml.etree
def main():
if len(sys.argv) < 3:
sys.stderr.write('ERROR: Must provide at least 2 KML files to merge\n')
sys.exit('Usage: {} FILE1 FILE2 ...'.format(sys.argv[0]))
first_kml_root = lxml.etree.parse(sys.argv[1]).getroot()
first_kml_ns... | Add script for merging KML files | Add script for merging KML files
| Python | mit | bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile | Add script for merging KML files | #!/usr/bin/env python
import sys
import lxml.etree
def main():
if len(sys.argv) < 3:
sys.stderr.write('ERROR: Must provide at least 2 KML files to merge\n')
sys.exit('Usage: {} FILE1 FILE2 ...'.format(sys.argv[0]))
first_kml_root = lxml.etree.parse(sys.argv[1]).getroot()
first_kml_ns... | <commit_before><commit_msg>Add script for merging KML files<commit_after> | #!/usr/bin/env python
import sys
import lxml.etree
def main():
if len(sys.argv) < 3:
sys.stderr.write('ERROR: Must provide at least 2 KML files to merge\n')
sys.exit('Usage: {} FILE1 FILE2 ...'.format(sys.argv[0]))
first_kml_root = lxml.etree.parse(sys.argv[1]).getroot()
first_kml_ns... | Add script for merging KML files#!/usr/bin/env python
import sys
import lxml.etree
def main():
if len(sys.argv) < 3:
sys.stderr.write('ERROR: Must provide at least 2 KML files to merge\n')
sys.exit('Usage: {} FILE1 FILE2 ...'.format(sys.argv[0]))
first_kml_root = lxml.etree.parse(sys.arg... | <commit_before><commit_msg>Add script for merging KML files<commit_after>#!/usr/bin/env python
import sys
import lxml.etree
def main():
if len(sys.argv) < 3:
sys.stderr.write('ERROR: Must provide at least 2 KML files to merge\n')
sys.exit('Usage: {} FILE1 FILE2 ...'.format(sys.argv[0]))
... | |
dfa76a4ad4a15e4068135b5f82ef5a00763c4b57 | open_humans/models.py | open_humans/models.py | from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
class Profile(models.Model):
user = models.OneToOneField(User)
about_me = models.TextField()
@receiver(post_save, sender=User, dispatch_uid='create_pro... | Add Profile model and post-save hook | Add Profile model and post-save hook
| Python | mit | OpenHumans/open-humans,OpenHumans/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans | Add Profile model and post-save hook | from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
class Profile(models.Model):
user = models.OneToOneField(User)
about_me = models.TextField()
@receiver(post_save, sender=User, dispatch_uid='create_pro... | <commit_before><commit_msg>Add Profile model and post-save hook<commit_after> | from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
class Profile(models.Model):
user = models.OneToOneField(User)
about_me = models.TextField()
@receiver(post_save, sender=User, dispatch_uid='create_pro... | Add Profile model and post-save hookfrom django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
class Profile(models.Model):
user = models.OneToOneField(User)
about_me = models.TextField()
@receiver(post_save, s... | <commit_before><commit_msg>Add Profile model and post-save hook<commit_after>from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
class Profile(models.Model):
user = models.OneToOneField(User)
about_me = mo... | |
2f9bd2a08160724144f0db00994213bdd2a741f5 | proselint/checks/wallace/tense_present.py | proselint/checks/wallace/tense_present.py | # -*- coding: utf-8 -*-
"""DFW201: Tense present.
---
layout: post
error_code: MAU103
source: DFW's Tense Present
source_url: http://bit.ly/1c85lgR
title: Tense present
date: 2014-06-10 12:31:19
categories: writing
---
Archaism.
"""
from proselint.tools import memoize
import re
@memoize
def chec... | Add some examples from tense present | Add some examples from tense present
| Python | bsd-3-clause | jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint | Add some examples from tense present | # -*- coding: utf-8 -*-
"""DFW201: Tense present.
---
layout: post
error_code: MAU103
source: DFW's Tense Present
source_url: http://bit.ly/1c85lgR
title: Tense present
date: 2014-06-10 12:31:19
categories: writing
---
Archaism.
"""
from proselint.tools import memoize
import re
@memoize
def chec... | <commit_before><commit_msg>Add some examples from tense present<commit_after> | # -*- coding: utf-8 -*-
"""DFW201: Tense present.
---
layout: post
error_code: MAU103
source: DFW's Tense Present
source_url: http://bit.ly/1c85lgR
title: Tense present
date: 2014-06-10 12:31:19
categories: writing
---
Archaism.
"""
from proselint.tools import memoize
import re
@memoize
def chec... | Add some examples from tense present# -*- coding: utf-8 -*-
"""DFW201: Tense present.
---
layout: post
error_code: MAU103
source: DFW's Tense Present
source_url: http://bit.ly/1c85lgR
title: Tense present
date: 2014-06-10 12:31:19
categories: writing
---
Archaism.
"""
from proselint.tools import m... | <commit_before><commit_msg>Add some examples from tense present<commit_after># -*- coding: utf-8 -*-
"""DFW201: Tense present.
---
layout: post
error_code: MAU103
source: DFW's Tense Present
source_url: http://bit.ly/1c85lgR
title: Tense present
date: 2014-06-10 12:31:19
categories: writing
---
Arc... | |
81cbf67fb637cf69bb47d43024eb9c860ae472e9 | test/test_borg.py | test/test_borg.py | import pytest
from borg_summon import borg
def test_hook_no_command():
with pytest.raises(borg.InvalidConfigError) as excinfo:
borg.hook({})
assert str(excinfo.value) == 'The "command" option is required for hooks.'
def test_borg_invalid_log_level():
with pytest.raises(borg.InvalidConfigError) as ... | Add tests for errors in borg.py | Add tests for errors in borg.py
| Python | mit | grensjo/borg-summon | Add tests for errors in borg.py | import pytest
from borg_summon import borg
def test_hook_no_command():
with pytest.raises(borg.InvalidConfigError) as excinfo:
borg.hook({})
assert str(excinfo.value) == 'The "command" option is required for hooks.'
def test_borg_invalid_log_level():
with pytest.raises(borg.InvalidConfigError) as ... | <commit_before><commit_msg>Add tests for errors in borg.py<commit_after> | import pytest
from borg_summon import borg
def test_hook_no_command():
with pytest.raises(borg.InvalidConfigError) as excinfo:
borg.hook({})
assert str(excinfo.value) == 'The "command" option is required for hooks.'
def test_borg_invalid_log_level():
with pytest.raises(borg.InvalidConfigError) as ... | Add tests for errors in borg.pyimport pytest
from borg_summon import borg
def test_hook_no_command():
with pytest.raises(borg.InvalidConfigError) as excinfo:
borg.hook({})
assert str(excinfo.value) == 'The "command" option is required for hooks.'
def test_borg_invalid_log_level():
with pytest.rais... | <commit_before><commit_msg>Add tests for errors in borg.py<commit_after>import pytest
from borg_summon import borg
def test_hook_no_command():
with pytest.raises(borg.InvalidConfigError) as excinfo:
borg.hook({})
assert str(excinfo.value) == 'The "command" option is required for hooks.'
def test_borg_... | |
713658c3dfa2ff70511057868d44647e5f67d065 | tests/model/test_range.py | tests/model/test_range.py | # Copyright (c) 2021. The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details
from datetime import datetime, timedelta
import pytz
from sqlalchemy import Column, literal, cast, TEXT
from... | Add unittest for `TsTzRange` (de-)serialization of `Interval`s | Add unittest for `TsTzRange` (de-)serialization of `Interval`s
Refs #160
| Python | apache-2.0 | agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft | Add unittest for `TsTzRange` (de-)serialization of `Interval`s
Refs #160 | # Copyright (c) 2021. The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details
from datetime import datetime, timedelta
import pytz
from sqlalchemy import Column, literal, cast, TEXT
from... | <commit_before><commit_msg>Add unittest for `TsTzRange` (de-)serialization of `Interval`s
Refs #160<commit_after> | # Copyright (c) 2021. The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details
from datetime import datetime, timedelta
import pytz
from sqlalchemy import Column, literal, cast, TEXT
from... | Add unittest for `TsTzRange` (de-)serialization of `Interval`s
Refs #160# Copyright (c) 2021. The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details
from datetime import datetime, timed... | <commit_before><commit_msg>Add unittest for `TsTzRange` (de-)serialization of `Interval`s
Refs #160<commit_after># Copyright (c) 2021. The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for det... | |
400ebfd601cad411c22f7e7b483351b8d45e876e | tests/unit/test_component_dependencies.py | tests/unit/test_component_dependencies.py | #!/usr/bin/env python
#
# test_component_dependencies.py:
# unit tests for vyconf.components.dependencies
#
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as pu... | Add unit tests for dependency sorting module. | Add unit tests for dependency sorting module.
| Python | lgpl-2.1 | vyos-legacy/vyconfd,vyos-legacy/vyconfd | Add unit tests for dependency sorting module. | #!/usr/bin/env python
#
# test_component_dependencies.py:
# unit tests for vyconf.components.dependencies
#
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as pu... | <commit_before><commit_msg>Add unit tests for dependency sorting module.<commit_after> | #!/usr/bin/env python
#
# test_component_dependencies.py:
# unit tests for vyconf.components.dependencies
#
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as pu... | Add unit tests for dependency sorting module.#!/usr/bin/env python
#
# test_component_dependencies.py:
# unit tests for vyconf.components.dependencies
#
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of ... | <commit_before><commit_msg>Add unit tests for dependency sorting module.<commit_after>#!/usr/bin/env python
#
# test_component_dependencies.py:
# unit tests for vyconf.components.dependencies
#
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# This library is free software; you can redistribute ... | |
a81acb590f6d3a2fd701c6d223607661964c9152 | app/access_control.py | app/access_control.py | from functools import wraps
from flask import flash, redirect, url_for, session
from app import views
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if 'logged_in' in session:
return f(*args, **kwargs)
else:
flash("Please login to continue.", "... | Create a decorator `login_required` for access control on pages for logged in users. | Create a decorator `login_required` for access control on pages for logged in users.
| Python | mit | alchermd/flask-todo-app,alchermd/flask-todo-app | Create a decorator `login_required` for access control on pages for logged in users. | from functools import wraps
from flask import flash, redirect, url_for, session
from app import views
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if 'logged_in' in session:
return f(*args, **kwargs)
else:
flash("Please login to continue.", "... | <commit_before><commit_msg>Create a decorator `login_required` for access control on pages for logged in users.<commit_after> | from functools import wraps
from flask import flash, redirect, url_for, session
from app import views
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if 'logged_in' in session:
return f(*args, **kwargs)
else:
flash("Please login to continue.", "... | Create a decorator `login_required` for access control on pages for logged in users.from functools import wraps
from flask import flash, redirect, url_for, session
from app import views
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if 'logged_in' in session:
ret... | <commit_before><commit_msg>Create a decorator `login_required` for access control on pages for logged in users.<commit_after>from functools import wraps
from flask import flash, redirect, url_for, session
from app import views
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
i... | |
a6091420faffc490ad721fbf86bd7b76002d5f16 | examples/demo/image_plot_origin_and_orientation.py | examples/demo/image_plot_origin_and_orientation.py | """
Demonstration of altering a plot's origin and orientation.
The origin parameter sets a plot's default origin to the specified corner
of the plot window. These positions has the following behavior:
* 'left' : index increases left to right
* 'right' : index increases right to left
* 'top' : index increas... | Add demo of origin and orientation values | Add demo of origin and orientation values
| Python | bsd-3-clause | tommy-u/chaco,tommy-u/chaco,tommy-u/chaco | Add demo of origin and orientation values | """
Demonstration of altering a plot's origin and orientation.
The origin parameter sets a plot's default origin to the specified corner
of the plot window. These positions has the following behavior:
* 'left' : index increases left to right
* 'right' : index increases right to left
* 'top' : index increas... | <commit_before><commit_msg>Add demo of origin and orientation values<commit_after> | """
Demonstration of altering a plot's origin and orientation.
The origin parameter sets a plot's default origin to the specified corner
of the plot window. These positions has the following behavior:
* 'left' : index increases left to right
* 'right' : index increases right to left
* 'top' : index increas... | Add demo of origin and orientation values"""
Demonstration of altering a plot's origin and orientation.
The origin parameter sets a plot's default origin to the specified corner
of the plot window. These positions has the following behavior:
* 'left' : index increases left to right
* 'right' : index increases ... | <commit_before><commit_msg>Add demo of origin and orientation values<commit_after>"""
Demonstration of altering a plot's origin and orientation.
The origin parameter sets a plot's default origin to the specified corner
of the plot window. These positions has the following behavior:
* 'left' : index increases left ... | |
fd81e6e0d968ffd3e5aaf81827ad42c9ca0dcb15 | tests/perf_concrete_execution.py | tests/perf_concrete_execution.py |
# Performance tests on concrete code execution without invoking Unicorn engine
import os
import time
import logging
import angr
test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests'))
def test_tight_loop(arch):
b = angr.Project(os.path.join(test_locatio... | Add a performance test for concrete execution. | Add a performance test for concrete execution.
| Python | bsd-2-clause | schieb/angr,iamahuman/angr,iamahuman/angr,schieb/angr,angr/angr,angr/angr,iamahuman/angr,schieb/angr,angr/angr | Add a performance test for concrete execution. |
# Performance tests on concrete code execution without invoking Unicorn engine
import os
import time
import logging
import angr
test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests'))
def test_tight_loop(arch):
b = angr.Project(os.path.join(test_locatio... | <commit_before><commit_msg>Add a performance test for concrete execution.<commit_after> |
# Performance tests on concrete code execution without invoking Unicorn engine
import os
import time
import logging
import angr
test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests'))
def test_tight_loop(arch):
b = angr.Project(os.path.join(test_locatio... | Add a performance test for concrete execution.
# Performance tests on concrete code execution without invoking Unicorn engine
import os
import time
import logging
import angr
test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests'))
def test_tight_loop(arch):
... | <commit_before><commit_msg>Add a performance test for concrete execution.<commit_after>
# Performance tests on concrete code execution without invoking Unicorn engine
import os
import time
import logging
import angr
test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries'... | |
a37ec297e01316981ab3976366adc54ad00d5f51 | pulses-to-data.py | pulses-to-data.py | import pyaudio
import struct
import math
import time
"""
Constants and definitions
"""
RATE = 44100
INPUT_BLOCK_TIME = 0.01 # seconds
INPUT_FRAMES_PER_BLOCK = int(RATE * INPUT_BLOCK_TIME)
PULSE_THRESHOLD = 0.6
MIN_SECONDS_BETWEEN_PULSES = 0.28
def get_rms(block):
# RMS amplitude is defined as the square root of... | Add initial code for pulse counting | Add initial code for pulse counting
Brief intro: my stationary bicycle *had* a measurement monitor with
speed, traveled kms, etc. However, it broke down. As my stationary bike
is quite old, I was not able to find a replacement (a good thing). I
noticed that the cable going from the rotor to the monitoring device has
a... | Python | mit | lamosty/exercise-bike-ui,lamosty/exercise-bike-ui | Add initial code for pulse counting
Brief intro: my stationary bicycle *had* a measurement monitor with
speed, traveled kms, etc. However, it broke down. As my stationary bike
is quite old, I was not able to find a replacement (a good thing). I
noticed that the cable going from the rotor to the monitoring device has
a... | import pyaudio
import struct
import math
import time
"""
Constants and definitions
"""
RATE = 44100
INPUT_BLOCK_TIME = 0.01 # seconds
INPUT_FRAMES_PER_BLOCK = int(RATE * INPUT_BLOCK_TIME)
PULSE_THRESHOLD = 0.6
MIN_SECONDS_BETWEEN_PULSES = 0.28
def get_rms(block):
# RMS amplitude is defined as the square root of... | <commit_before><commit_msg>Add initial code for pulse counting
Brief intro: my stationary bicycle *had* a measurement monitor with
speed, traveled kms, etc. However, it broke down. As my stationary bike
is quite old, I was not able to find a replacement (a good thing). I
noticed that the cable going from the rotor to ... | import pyaudio
import struct
import math
import time
"""
Constants and definitions
"""
RATE = 44100
INPUT_BLOCK_TIME = 0.01 # seconds
INPUT_FRAMES_PER_BLOCK = int(RATE * INPUT_BLOCK_TIME)
PULSE_THRESHOLD = 0.6
MIN_SECONDS_BETWEEN_PULSES = 0.28
def get_rms(block):
# RMS amplitude is defined as the square root of... | Add initial code for pulse counting
Brief intro: my stationary bicycle *had* a measurement monitor with
speed, traveled kms, etc. However, it broke down. As my stationary bike
is quite old, I was not able to find a replacement (a good thing). I
noticed that the cable going from the rotor to the monitoring device has
a... | <commit_before><commit_msg>Add initial code for pulse counting
Brief intro: my stationary bicycle *had* a measurement monitor with
speed, traveled kms, etc. However, it broke down. As my stationary bike
is quite old, I was not able to find a replacement (a good thing). I
noticed that the cable going from the rotor to ... | |
8790e50d71c6c24b3728f2d8f1d5c94c491abc90 | indra/tests/test_belief_engine.py | indra/tests/test_belief_engine.py | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from indra.statements import *
from indra.belief import BeliefEngine
ev1 = Evidence(source_api='reach')
ev2 = Evidence(source_api='trips')
ev3 = Evidence(source_api='assertion')
def test_prior_prob_one():
be =... | Add first round of tests | Add first round of tests
| Python | bsd-2-clause | sorgerlab/belpy,jmuhlich/indra,johnbachman/belpy,sorgerlab/indra,johnbachman/indra,johnbachman/belpy,bgyori/indra,sorgerlab/indra,pvtodorov/indra,sorgerlab/indra,johnbachman/belpy,johnbachman/indra,jmuhlich/indra,pvtodorov/indra,pvtodorov/indra,bgyori/indra,bgyori/indra,jmuhlich/indra,johnbachman/indra,pvtodorov/indra,... | Add first round of tests | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from indra.statements import *
from indra.belief import BeliefEngine
ev1 = Evidence(source_api='reach')
ev2 = Evidence(source_api='trips')
ev3 = Evidence(source_api='assertion')
def test_prior_prob_one():
be =... | <commit_before><commit_msg>Add first round of tests<commit_after> | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from indra.statements import *
from indra.belief import BeliefEngine
ev1 = Evidence(source_api='reach')
ev2 = Evidence(source_api='trips')
ev3 = Evidence(source_api='assertion')
def test_prior_prob_one():
be =... | Add first round of testsfrom __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from indra.statements import *
from indra.belief import BeliefEngine
ev1 = Evidence(source_api='reach')
ev2 = Evidence(source_api='trips')
ev3 = Evidence(source_api='assertion')
def test_pr... | <commit_before><commit_msg>Add first round of tests<commit_after>from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from indra.statements import *
from indra.belief import BeliefEngine
ev1 = Evidence(source_api='reach')
ev2 = Evidence(source_api='trips')
ev3 = Evide... | |
19e220698978a5cfe8129d1f207d390d1a343c1a | st2client/tests/unit/test_action_alias.py | st2client/tests/unit/test_action_alias.py | # Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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.org/licenses/LICENSE-2.0
#
# Unless ... | Add a direct st2 CLI test case for st2 alias-execution execute command. | Add a direct st2 CLI test case for st2 alias-execution execute command.
| Python | apache-2.0 | StackStorm/st2,Plexxi/st2,Plexxi/st2,nzlosh/st2,StackStorm/st2,nzlosh/st2,StackStorm/st2,Plexxi/st2,Plexxi/st2,nzlosh/st2,nzlosh/st2,StackStorm/st2 | Add a direct st2 CLI test case for st2 alias-execution execute command. | # Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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.org/licenses/LICENSE-2.0
#
# Unless ... | <commit_before><commit_msg>Add a direct st2 CLI test case for st2 alias-execution execute command.<commit_after> | # Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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.org/licenses/LICENSE-2.0
#
# Unless ... | Add a direct st2 CLI test case for st2 alias-execution execute command.# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 Li... | <commit_before><commit_msg>Add a direct st2 CLI test case for st2 alias-execution execute command.<commit_after># Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... | |
80eb53ffeb51b3a6707c9714a0ed7acf7228b017 | php5_fpm.py | php5_fpm.py | #!/usr/bin/env python
#
# igcollect - PHP5 FPM
#
# This is the data collector for the PHP5 FPM status page. It makes a
# HTTP request to get the page, and formats the output. All the numeric
# values of the requested pool is printed.
#
# Copyright (c) 2016, InnoGames GmbH
#
from __future__ import print_function
imp... | Add plugin for PHP5 FPM | Add plugin for PHP5 FPM
| Python | mit | innogames/igcollect | Add plugin for PHP5 FPM | #!/usr/bin/env python
#
# igcollect - PHP5 FPM
#
# This is the data collector for the PHP5 FPM status page. It makes a
# HTTP request to get the page, and formats the output. All the numeric
# values of the requested pool is printed.
#
# Copyright (c) 2016, InnoGames GmbH
#
from __future__ import print_function
imp... | <commit_before><commit_msg>Add plugin for PHP5 FPM<commit_after> | #!/usr/bin/env python
#
# igcollect - PHP5 FPM
#
# This is the data collector for the PHP5 FPM status page. It makes a
# HTTP request to get the page, and formats the output. All the numeric
# values of the requested pool is printed.
#
# Copyright (c) 2016, InnoGames GmbH
#
from __future__ import print_function
imp... | Add plugin for PHP5 FPM#!/usr/bin/env python
#
# igcollect - PHP5 FPM
#
# This is the data collector for the PHP5 FPM status page. It makes a
# HTTP request to get the page, and formats the output. All the numeric
# values of the requested pool is printed.
#
# Copyright (c) 2016, InnoGames GmbH
#
from __future__ imp... | <commit_before><commit_msg>Add plugin for PHP5 FPM<commit_after>#!/usr/bin/env python
#
# igcollect - PHP5 FPM
#
# This is the data collector for the PHP5 FPM status page. It makes a
# HTTP request to get the page, and formats the output. All the numeric
# values of the requested pool is printed.
#
# Copyright (c) 20... | |
54caac00ed4b6f302ee3dc4466711e0737f18352 | xpathwebdriver_tests/wipe_alerts.py | xpathwebdriver_tests/wipe_alerts.py | from xpathwebdriver_tests.test_XpathBrowser import WebUnitTestBase
import unittest
class TestXpathBrowserWipeAlerts(WebUnitTestBase):
def test_wipe_alerts(self):
from selenium.common.exceptions import UnexpectedAlertPresentException
body = '''
<script type="text/javascript">
... | Fix failing test in Codeship | Fix failing test in Codeship
| Python | mit | joaduo/xpathwebdriver,joaduo/xpathwebdriver | Fix failing test in Codeship | from xpathwebdriver_tests.test_XpathBrowser import WebUnitTestBase
import unittest
class TestXpathBrowserWipeAlerts(WebUnitTestBase):
def test_wipe_alerts(self):
from selenium.common.exceptions import UnexpectedAlertPresentException
body = '''
<script type="text/javascript">
... | <commit_before><commit_msg>Fix failing test in Codeship<commit_after> | from xpathwebdriver_tests.test_XpathBrowser import WebUnitTestBase
import unittest
class TestXpathBrowserWipeAlerts(WebUnitTestBase):
def test_wipe_alerts(self):
from selenium.common.exceptions import UnexpectedAlertPresentException
body = '''
<script type="text/javascript">
... | Fix failing test in Codeshipfrom xpathwebdriver_tests.test_XpathBrowser import WebUnitTestBase
import unittest
class TestXpathBrowserWipeAlerts(WebUnitTestBase):
def test_wipe_alerts(self):
from selenium.common.exceptions import UnexpectedAlertPresentException
body = '''
<script type="te... | <commit_before><commit_msg>Fix failing test in Codeship<commit_after>from xpathwebdriver_tests.test_XpathBrowser import WebUnitTestBase
import unittest
class TestXpathBrowserWipeAlerts(WebUnitTestBase):
def test_wipe_alerts(self):
from selenium.common.exceptions import UnexpectedAlertPresentException
... | |
801165049f9536840dd226c1790d41178dd6c812 | rdfalchemy/py3compat.py | rdfalchemy/py3compat.py | """
Utility functions and objects to ease Python 3 compatibility.
Contributed to rdflib 3 by Thomas Kluyver, re-used here.
"""
import sys
try:
from functools import wraps
except ImportError:
# No-op wraps decorator
def wraps(f):
def dec(newf): return newf
return dec
def cast_bytes(s, enc='... | Copy Thomas Kluyver's Py3 compat from rdflib | Copy Thomas Kluyver's Py3 compat from rdflib
| Python | mit | gjhiggins/RDFAlchemy | Copy Thomas Kluyver's Py3 compat from rdflib | """
Utility functions and objects to ease Python 3 compatibility.
Contributed to rdflib 3 by Thomas Kluyver, re-used here.
"""
import sys
try:
from functools import wraps
except ImportError:
# No-op wraps decorator
def wraps(f):
def dec(newf): return newf
return dec
def cast_bytes(s, enc='... | <commit_before><commit_msg>Copy Thomas Kluyver's Py3 compat from rdflib<commit_after> | """
Utility functions and objects to ease Python 3 compatibility.
Contributed to rdflib 3 by Thomas Kluyver, re-used here.
"""
import sys
try:
from functools import wraps
except ImportError:
# No-op wraps decorator
def wraps(f):
def dec(newf): return newf
return dec
def cast_bytes(s, enc='... | Copy Thomas Kluyver's Py3 compat from rdflib"""
Utility functions and objects to ease Python 3 compatibility.
Contributed to rdflib 3 by Thomas Kluyver, re-used here.
"""
import sys
try:
from functools import wraps
except ImportError:
# No-op wraps decorator
def wraps(f):
def dec(newf): return newf... | <commit_before><commit_msg>Copy Thomas Kluyver's Py3 compat from rdflib<commit_after>"""
Utility functions and objects to ease Python 3 compatibility.
Contributed to rdflib 3 by Thomas Kluyver, re-used here.
"""
import sys
try:
from functools import wraps
except ImportError:
# No-op wraps decorator
def wra... | |
5fa28bdbd6605939c92508245ca4d3e6a2fbbaaf | tests/test_ctrl_proc.py | tests/test_ctrl_proc.py | #!/usr/bin/env python
import time
from unittest import main, TestCase
import zmq
from neurokernel.tools.comm import get_random_port
from neurokernel.ctrl_proc import ControlledProcess
class test_ctrl_proc(TestCase):
def setUp(self):
ctx = zmq.Context()
self.sock = ctx.socket(zmq.ROUTER)
... | Add test of zmq-based control mechanism for ControlledProcess class. | Add test of zmq-based control mechanism for ControlledProcess class.
| Python | bsd-3-clause | cerrno/neurokernel | Add test of zmq-based control mechanism for ControlledProcess class. | #!/usr/bin/env python
import time
from unittest import main, TestCase
import zmq
from neurokernel.tools.comm import get_random_port
from neurokernel.ctrl_proc import ControlledProcess
class test_ctrl_proc(TestCase):
def setUp(self):
ctx = zmq.Context()
self.sock = ctx.socket(zmq.ROUTER)
... | <commit_before><commit_msg>Add test of zmq-based control mechanism for ControlledProcess class.<commit_after> | #!/usr/bin/env python
import time
from unittest import main, TestCase
import zmq
from neurokernel.tools.comm import get_random_port
from neurokernel.ctrl_proc import ControlledProcess
class test_ctrl_proc(TestCase):
def setUp(self):
ctx = zmq.Context()
self.sock = ctx.socket(zmq.ROUTER)
... | Add test of zmq-based control mechanism for ControlledProcess class.#!/usr/bin/env python
import time
from unittest import main, TestCase
import zmq
from neurokernel.tools.comm import get_random_port
from neurokernel.ctrl_proc import ControlledProcess
class test_ctrl_proc(TestCase):
def setUp(self):
ctx... | <commit_before><commit_msg>Add test of zmq-based control mechanism for ControlledProcess class.<commit_after>#!/usr/bin/env python
import time
from unittest import main, TestCase
import zmq
from neurokernel.tools.comm import get_random_port
from neurokernel.ctrl_proc import ControlledProcess
class test_ctrl_proc(Te... | |
f8d3e9466de6cafca7c1a493194bb3944c58c75b | scripts/set_hostname.py | scripts/set_hostname.py | #!/usr/bin/env python
import subprocess
from utils import file_templates
from utils.validation import is_valid_hostname
def main():
user_input = raw_input("Want to change the hostname?: Y/N")
if user_input == 'Y':
new_hostname = ''
while new_hostname == '':
user_input = raw_input("Enter a new hostname: ")
... | Add script to update hostname | Add script to update hostname
| Python | mit | projectweekend/Pi-Setup,projectweekend/Pi-Setup | Add script to update hostname | #!/usr/bin/env python
import subprocess
from utils import file_templates
from utils.validation import is_valid_hostname
def main():
user_input = raw_input("Want to change the hostname?: Y/N")
if user_input == 'Y':
new_hostname = ''
while new_hostname == '':
user_input = raw_input("Enter a new hostname: ")
... | <commit_before><commit_msg>Add script to update hostname<commit_after> | #!/usr/bin/env python
import subprocess
from utils import file_templates
from utils.validation import is_valid_hostname
def main():
user_input = raw_input("Want to change the hostname?: Y/N")
if user_input == 'Y':
new_hostname = ''
while new_hostname == '':
user_input = raw_input("Enter a new hostname: ")
... | Add script to update hostname#!/usr/bin/env python
import subprocess
from utils import file_templates
from utils.validation import is_valid_hostname
def main():
user_input = raw_input("Want to change the hostname?: Y/N")
if user_input == 'Y':
new_hostname = ''
while new_hostname == '':
user_input = raw_inp... | <commit_before><commit_msg>Add script to update hostname<commit_after>#!/usr/bin/env python
import subprocess
from utils import file_templates
from utils.validation import is_valid_hostname
def main():
user_input = raw_input("Want to change the hostname?: Y/N")
if user_input == 'Y':
new_hostname = ''
while ne... | |
2acb7e7da11aabe6b9c30f6197492d4150e4f496 | test/test_words.py | test/test_words.py |
import unittest
import numpy as np
import numpy.testing as test
from word2gauss.words import Vocabulary, iter_pairs
DTYPE = np.float32
class TestIterPairs(unittest.TestCase):
def test_iter_pairs(self):
np.random.seed(1234)
vocab = Vocabulary({'zero': 0, 'one': 1, 'two': 2})
actual = list... | Add a test for iter_pairs | Add a test for iter_pairs
| Python | mit | seomoz/word2gauss,seomoz/word2gauss | Add a test for iter_pairs |
import unittest
import numpy as np
import numpy.testing as test
from word2gauss.words import Vocabulary, iter_pairs
DTYPE = np.float32
class TestIterPairs(unittest.TestCase):
def test_iter_pairs(self):
np.random.seed(1234)
vocab = Vocabulary({'zero': 0, 'one': 1, 'two': 2})
actual = list... | <commit_before><commit_msg>Add a test for iter_pairs<commit_after> |
import unittest
import numpy as np
import numpy.testing as test
from word2gauss.words import Vocabulary, iter_pairs
DTYPE = np.float32
class TestIterPairs(unittest.TestCase):
def test_iter_pairs(self):
np.random.seed(1234)
vocab = Vocabulary({'zero': 0, 'one': 1, 'two': 2})
actual = list... | Add a test for iter_pairs
import unittest
import numpy as np
import numpy.testing as test
from word2gauss.words import Vocabulary, iter_pairs
DTYPE = np.float32
class TestIterPairs(unittest.TestCase):
def test_iter_pairs(self):
np.random.seed(1234)
vocab = Vocabulary({'zero': 0, 'one': 1, 'two': 2... | <commit_before><commit_msg>Add a test for iter_pairs<commit_after>
import unittest
import numpy as np
import numpy.testing as test
from word2gauss.words import Vocabulary, iter_pairs
DTYPE = np.float32
class TestIterPairs(unittest.TestCase):
def test_iter_pairs(self):
np.random.seed(1234)
vocab = ... | |
e91c1964a8996bba73751e1bd1679133594bb264 | tests/run_tests.py | tests/run_tests.py | # -*- coding: utf-8 -*-
import sys
import os
from openslides.__main__ import main as openslides_main
from openslides.utils.main import setup_django_settings_module
def main():
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
setup_django_settings_module(os.path.join(os.path... | Add script tu run the tests. | Add script tu run the tests.
| Python | mit | OpenSlides/openslides-protocol,OpenSlides/openslides-protocol,OpenSlides/openslides-protocol | Add script tu run the tests. | # -*- coding: utf-8 -*-
import sys
import os
from openslides.__main__ import main as openslides_main
from openslides.utils.main import setup_django_settings_module
def main():
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
setup_django_settings_module(os.path.join(os.path... | <commit_before><commit_msg>Add script tu run the tests.<commit_after> | # -*- coding: utf-8 -*-
import sys
import os
from openslides.__main__ import main as openslides_main
from openslides.utils.main import setup_django_settings_module
def main():
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
setup_django_settings_module(os.path.join(os.path... | Add script tu run the tests.# -*- coding: utf-8 -*-
import sys
import os
from openslides.__main__ import main as openslides_main
from openslides.utils.main import setup_django_settings_module
def main():
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
setup_django_settings... | <commit_before><commit_msg>Add script tu run the tests.<commit_after># -*- coding: utf-8 -*-
import sys
import os
from openslides.__main__ import main as openslides_main
from openslides.utils.main import setup_django_settings_module
def main():
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__f... | |
0f9d7027494232ef9c2791939776fc62f81c7835 | senlin/policies/base.py | senlin/policies/base.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | Add pre_op and post_op methods to PolicyBase | Add pre_op and post_op methods to PolicyBase
For all policies to be enforced, they may need a hooks that perform some
operations on the targeted clusters.
| Python | apache-2.0 | tengqm/senlin,openstack/senlin,openstack/senlin,Alzon/senlin,tengqm/senlin,tengqm/senlin-container,openstack/senlin,tengqm/senlin-container,Alzon/senlin,stackforge/senlin,stackforge/senlin | Add pre_op and post_op methods to PolicyBase
For all policies to be enforced, they may need a hooks that perform some
operations on the targeted clusters. | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | <commit_before><commit_msg>Add pre_op and post_op methods to PolicyBase
For all policies to be enforced, they may need a hooks that perform some
operations on the targeted clusters.<commit_after> | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | Add pre_op and post_op methods to PolicyBase
For all policies to be enforced, they may need a hooks that perform some
operations on the targeted clusters.# 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 L... | <commit_before><commit_msg>Add pre_op and post_op methods to PolicyBase
For all policies to be enforced, they may need a hooks that perform some
operations on the targeted clusters.<commit_after># Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the ... | |
b694c0da84f1a3f6b27b9d4a07c9f5cb2116d831 | utils/sign_file.py | utils/sign_file.py | #! /usr/bin/env python
"""
A script that creates signed Python files.
Distributing detached signatures is boring.
"""
from __future__ import print_function
import os
import argparse
import subprocess
def get_file_encoding(filename):
"""
Get the file encoding for the file with the given filename
"""
... | Write a generic script signing utility | Write a generic script signing utility
Signed-off-by: Thomas Nagy <d86e025e60d31fa2452cf443d0fed051ea678233@gmail.com>
| Python | agpl-3.0 | hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR,hlange/LogSoCR | Write a generic script signing utility
Signed-off-by: Thomas Nagy <d86e025e60d31fa2452cf443d0fed051ea678233@gmail.com> | #! /usr/bin/env python
"""
A script that creates signed Python files.
Distributing detached signatures is boring.
"""
from __future__ import print_function
import os
import argparse
import subprocess
def get_file_encoding(filename):
"""
Get the file encoding for the file with the given filename
"""
... | <commit_before><commit_msg>Write a generic script signing utility
Signed-off-by: Thomas Nagy <d86e025e60d31fa2452cf443d0fed051ea678233@gmail.com><commit_after> | #! /usr/bin/env python
"""
A script that creates signed Python files.
Distributing detached signatures is boring.
"""
from __future__ import print_function
import os
import argparse
import subprocess
def get_file_encoding(filename):
"""
Get the file encoding for the file with the given filename
"""
... | Write a generic script signing utility
Signed-off-by: Thomas Nagy <d86e025e60d31fa2452cf443d0fed051ea678233@gmail.com>#! /usr/bin/env python
"""
A script that creates signed Python files.
Distributing detached signatures is boring.
"""
from __future__ import print_function
import os
import argparse
import subproc... | <commit_before><commit_msg>Write a generic script signing utility
Signed-off-by: Thomas Nagy <d86e025e60d31fa2452cf443d0fed051ea678233@gmail.com><commit_after>#! /usr/bin/env python
"""
A script that creates signed Python files.
Distributing detached signatures is boring.
"""
from __future__ import print_function
... | |
a6d1e508d30b1c8c8f4ee07ee60b8841160259cc | scripts/threadtest.py | scripts/threadtest.py | #!/usr/bin/env python
# This is a basic script that will check that
# multithreaded behavior works as expected.
# The idea is to spin up a multithreaded server
# with views that use flask-shelve, and then to
# spawn multi threaded clients.
import os
import time
import threading
from urllib2 import urlopen
from werkze... | Add script to verify locking behavior | Add script to verify locking behavior
Basically, start up a multithreaded flask server and throw
a bunch of multithreaded clients at it. Make sure the
numbers at the end make sense.
| Python | bsd-3-clause | jamesls/flask-shelve | Add script to verify locking behavior
Basically, start up a multithreaded flask server and throw
a bunch of multithreaded clients at it. Make sure the
numbers at the end make sense. | #!/usr/bin/env python
# This is a basic script that will check that
# multithreaded behavior works as expected.
# The idea is to spin up a multithreaded server
# with views that use flask-shelve, and then to
# spawn multi threaded clients.
import os
import time
import threading
from urllib2 import urlopen
from werkze... | <commit_before><commit_msg>Add script to verify locking behavior
Basically, start up a multithreaded flask server and throw
a bunch of multithreaded clients at it. Make sure the
numbers at the end make sense.<commit_after> | #!/usr/bin/env python
# This is a basic script that will check that
# multithreaded behavior works as expected.
# The idea is to spin up a multithreaded server
# with views that use flask-shelve, and then to
# spawn multi threaded clients.
import os
import time
import threading
from urllib2 import urlopen
from werkze... | Add script to verify locking behavior
Basically, start up a multithreaded flask server and throw
a bunch of multithreaded clients at it. Make sure the
numbers at the end make sense.#!/usr/bin/env python
# This is a basic script that will check that
# multithreaded behavior works as expected.
# The idea is to spin up... | <commit_before><commit_msg>Add script to verify locking behavior
Basically, start up a multithreaded flask server and throw
a bunch of multithreaded clients at it. Make sure the
numbers at the end make sense.<commit_after>#!/usr/bin/env python
# This is a basic script that will check that
# multithreaded behavior wo... | |
b4dfc06e55cf1f8e0e6d4e0bb31efb35614ea57a | gntp/test/test_config.py | gntp/test/test_config.py | # Test when we don't have a config file
# Since we don't know if the user will have a config file or not when
# running this test, we will move it out of the way and then move it back
# when we're done
import os
from gntp.test import GNTPTestCase
from gntp.config import GrowlNotifier
ORIGINAL_CONFIG = os.path.expandu... | Add test for config file | Add test for config file
| Python | mit | kfdm/gntp | Add test for config file | # Test when we don't have a config file
# Since we don't know if the user will have a config file or not when
# running this test, we will move it out of the way and then move it back
# when we're done
import os
from gntp.test import GNTPTestCase
from gntp.config import GrowlNotifier
ORIGINAL_CONFIG = os.path.expandu... | <commit_before><commit_msg>Add test for config file<commit_after> | # Test when we don't have a config file
# Since we don't know if the user will have a config file or not when
# running this test, we will move it out of the way and then move it back
# when we're done
import os
from gntp.test import GNTPTestCase
from gntp.config import GrowlNotifier
ORIGINAL_CONFIG = os.path.expandu... | Add test for config file# Test when we don't have a config file
# Since we don't know if the user will have a config file or not when
# running this test, we will move it out of the way and then move it back
# when we're done
import os
from gntp.test import GNTPTestCase
from gntp.config import GrowlNotifier
ORIGINAL_... | <commit_before><commit_msg>Add test for config file<commit_after># Test when we don't have a config file
# Since we don't know if the user will have a config file or not when
# running this test, we will move it out of the way and then move it back
# when we're done
import os
from gntp.test import GNTPTestCase
from gn... | |
85f437f300a076001d2efc813c40eb19d14dbbe9 | Chapter-1/NCHS-school-song-prgm.py | Chapter-1/NCHS-school-song-prgm.py | #David Hickox
# Jan 12 17
# School Song Program
# Displays school song
#actualy prints the song
print("All hail our school NCHS\nWe'll sing your praises NCHS\n\nWith all our might\nWe will always make a fight")
#waits for an enter press to exit the program
input("\nPress Enter to continue")
| Create the school song program | Create the school song program | Python | mit | dwhickox/NCHS-Programming-1-Python-Programs | Create the school song program | #David Hickox
# Jan 12 17
# School Song Program
# Displays school song
#actualy prints the song
print("All hail our school NCHS\nWe'll sing your praises NCHS\n\nWith all our might\nWe will always make a fight")
#waits for an enter press to exit the program
input("\nPress Enter to continue")
| <commit_before><commit_msg>Create the school song program<commit_after> | #David Hickox
# Jan 12 17
# School Song Program
# Displays school song
#actualy prints the song
print("All hail our school NCHS\nWe'll sing your praises NCHS\n\nWith all our might\nWe will always make a fight")
#waits for an enter press to exit the program
input("\nPress Enter to continue")
| Create the school song program#David Hickox
# Jan 12 17
# School Song Program
# Displays school song
#actualy prints the song
print("All hail our school NCHS\nWe'll sing your praises NCHS\n\nWith all our might\nWe will always make a fight")
#waits for an enter press to exit the program
input("\nPress Enter to continu... | <commit_before><commit_msg>Create the school song program<commit_after>#David Hickox
# Jan 12 17
# School Song Program
# Displays school song
#actualy prints the song
print("All hail our school NCHS\nWe'll sing your praises NCHS\n\nWith all our might\nWe will always make a fight")
#waits for an enter press to exit th... | |
7de811bec7478efb8398a90f7f3c85e8427fb114 | test_computeengine.py | test_computeengine.py | from computeengine import Computation, States
def test_basic():
def b(a):
return a + 1
def c(a):
return 2 * a
def d(b, c):
return b + c
cpu = Computation()
cpu.add_node("a")
cpu.add_node("b", b, ["a"])
cpu.add_node("c", c, ["a"])
cpu.add_node("d", d, ["b", "c... | Add simple unit test for compute engine. | Add simple unit test for compute engine.
| Python | bsd-3-clause | janusassetallocation/loman | Add simple unit test for compute engine. | from computeengine import Computation, States
def test_basic():
def b(a):
return a + 1
def c(a):
return 2 * a
def d(b, c):
return b + c
cpu = Computation()
cpu.add_node("a")
cpu.add_node("b", b, ["a"])
cpu.add_node("c", c, ["a"])
cpu.add_node("d", d, ["b", "c... | <commit_before><commit_msg>Add simple unit test for compute engine.<commit_after> | from computeengine import Computation, States
def test_basic():
def b(a):
return a + 1
def c(a):
return 2 * a
def d(b, c):
return b + c
cpu = Computation()
cpu.add_node("a")
cpu.add_node("b", b, ["a"])
cpu.add_node("c", c, ["a"])
cpu.add_node("d", d, ["b", "c... | Add simple unit test for compute engine.from computeengine import Computation, States
def test_basic():
def b(a):
return a + 1
def c(a):
return 2 * a
def d(b, c):
return b + c
cpu = Computation()
cpu.add_node("a")
cpu.add_node("b", b, ["a"])
cpu.add_node("c", c, ... | <commit_before><commit_msg>Add simple unit test for compute engine.<commit_after>from computeengine import Computation, States
def test_basic():
def b(a):
return a + 1
def c(a):
return 2 * a
def d(b, c):
return b + c
cpu = Computation()
cpu.add_node("a")
cpu.add_node... | |
732f0490c83253aa6504506e0271268ddc979c53 | OIPA/iati/tests/test_activity_models.py | OIPA/iati/tests/test_activity_models.py | from django.test import TestCase
from iati.models import Activity
from iati.factory.utils import _create_test_activity
class ActivityModelTestCase(TestCase):
def test_create_activity(self):
self.assertEqual(Activity.objects.count(), 0)
_create_test_activity(id='100000', iati_identifier='100000')
... | Add unit tests for Activity model deletions | Add unit tests for Activity model deletions
| Python | agpl-3.0 | openaid-IATI/OIPA,zimmerman-zimmerman/OIPA,openaid-IATI/OIPA,openaid-IATI/OIPA,zimmerman-zimmerman/OIPA,zimmerman-zimmerman/OIPA,openaid-IATI/OIPA,openaid-IATI/OIPA,zimmerman-zimmerman/OIPA,zimmerman-zimmerman/OIPA | Add unit tests for Activity model deletions | from django.test import TestCase
from iati.models import Activity
from iati.factory.utils import _create_test_activity
class ActivityModelTestCase(TestCase):
def test_create_activity(self):
self.assertEqual(Activity.objects.count(), 0)
_create_test_activity(id='100000', iati_identifier='100000')
... | <commit_before><commit_msg>Add unit tests for Activity model deletions<commit_after> | from django.test import TestCase
from iati.models import Activity
from iati.factory.utils import _create_test_activity
class ActivityModelTestCase(TestCase):
def test_create_activity(self):
self.assertEqual(Activity.objects.count(), 0)
_create_test_activity(id='100000', iati_identifier='100000')
... | Add unit tests for Activity model deletionsfrom django.test import TestCase
from iati.models import Activity
from iati.factory.utils import _create_test_activity
class ActivityModelTestCase(TestCase):
def test_create_activity(self):
self.assertEqual(Activity.objects.count(), 0)
_create_test_activ... | <commit_before><commit_msg>Add unit tests for Activity model deletions<commit_after>from django.test import TestCase
from iati.models import Activity
from iati.factory.utils import _create_test_activity
class ActivityModelTestCase(TestCase):
def test_create_activity(self):
self.assertEqual(Activity.objec... | |
106fc0f8bae7c776a8f6c7dcec2947420492d118 | homographynet/callbacks.py | homographynet/callbacks.py | #!/usr/bin/env python
from keras.callbacks import Callback
import keras.backend as K
class LearningRateScheduler(Callback):
"""Learning rate scheduler.
See Caffe SGD docs
"""
def __init__(self, base_lr, gamma, step_size):
super().__init__()
self._lr = base_lr
self._gamma = g... | #!/usr/bin/env python
from keras.callbacks import Callback
import keras.backend as K
class LearningRateScheduler(Callback):
"""Learning rate scheduler.
See Caffe SGD docs
"""
def __init__(self, base_lr, gamma, step_size):
super().__init__()
self._base_lr = base_lr
self._gamm... | Fix calculation of current steps when starting with epoch != 0 | Fix calculation of current steps when starting with epoch != 0
| Python | apache-2.0 | baudm/HomographyNet | #!/usr/bin/env python
from keras.callbacks import Callback
import keras.backend as K
class LearningRateScheduler(Callback):
"""Learning rate scheduler.
See Caffe SGD docs
"""
def __init__(self, base_lr, gamma, step_size):
super().__init__()
self._lr = base_lr
self._gamma = g... | #!/usr/bin/env python
from keras.callbacks import Callback
import keras.backend as K
class LearningRateScheduler(Callback):
"""Learning rate scheduler.
See Caffe SGD docs
"""
def __init__(self, base_lr, gamma, step_size):
super().__init__()
self._base_lr = base_lr
self._gamm... | <commit_before>#!/usr/bin/env python
from keras.callbacks import Callback
import keras.backend as K
class LearningRateScheduler(Callback):
"""Learning rate scheduler.
See Caffe SGD docs
"""
def __init__(self, base_lr, gamma, step_size):
super().__init__()
self._lr = base_lr
... | #!/usr/bin/env python
from keras.callbacks import Callback
import keras.backend as K
class LearningRateScheduler(Callback):
"""Learning rate scheduler.
See Caffe SGD docs
"""
def __init__(self, base_lr, gamma, step_size):
super().__init__()
self._base_lr = base_lr
self._gamm... | #!/usr/bin/env python
from keras.callbacks import Callback
import keras.backend as K
class LearningRateScheduler(Callback):
"""Learning rate scheduler.
See Caffe SGD docs
"""
def __init__(self, base_lr, gamma, step_size):
super().__init__()
self._lr = base_lr
self._gamma = g... | <commit_before>#!/usr/bin/env python
from keras.callbacks import Callback
import keras.backend as K
class LearningRateScheduler(Callback):
"""Learning rate scheduler.
See Caffe SGD docs
"""
def __init__(self, base_lr, gamma, step_size):
super().__init__()
self._lr = base_lr
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.