commit stringlengths 40 40 | old_file stringlengths 4 150 | new_file stringlengths 4 150 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 501 | message stringlengths 15 4.06k | lang stringclasses 4
values | license stringclasses 13
values | repos stringlengths 5 91.5k | diff stringlengths 0 4.35k |
|---|---|---|---|---|---|---|---|---|---|---|
adb6ce275e1cbc2d000286e169a4a96b25b32dbb | test_doc.py | test_doc.py | #!/usr/bin/env python
import doctest
import sys
if hasattr(doctest, "testfile"):
print("=== Test file: README ===")
failure, tests = doctest.testfile('README', optionflags=doctest.ELLIPSIS)
if failure:
sys.exit(1)
print("=== Test file: test.rst ===")
failure, tests = doctest.testfile('test/... | #!/usr/bin/env python
import doctest
import sys
if hasattr(doctest, "testfile"):
total_failures, total_tests = (0, 0)
print("=== Test file: README ===")
failure, tests = doctest.testfile('README', optionflags=doctest.ELLIPSIS)
total_failures += failure
total_tests += tests
print("=== Test file... | Allow doctest runner to keep going after failures | Allow doctest runner to keep going after failures
It will still return an error code, but there is little need to halt the
running of the three different doctest modules if an early one fails,
which may in fact mask the real reason for failure in an IPy internal
method.
Signed-off-by: Dan McGee <a6e5737275ff1276377ee... | Python | bsd-3-clause | dstam/python-ipy,sigma-random/python-ipy | ---
+++
@@ -2,20 +2,27 @@
import doctest
import sys
if hasattr(doctest, "testfile"):
+ total_failures, total_tests = (0, 0)
+
print("=== Test file: README ===")
failure, tests = doctest.testfile('README', optionflags=doctest.ELLIPSIS)
- if failure:
- sys.exit(1)
+ total_failures += failur... |
4318c0275b1c90fc65aff5ce59eaf101b78fba31 | scripts/award_badge_to_user.py | scripts/award_badge_to_user.py | #!/usr/bin/env python
"""Award a badge to a user.
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import click
from byceps.services.user_badge import service as badge_service
from byceps.util.system import get_config_filename_from_env_or_exit
from bootstrap.validator... | Add script to award a badge to a user | Add script to award a badge to a user
| Python | bsd-3-clause | m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps | ---
+++
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+"""Award a badge to a user.
+
+:Copyright: 2006-2018 Jochen Kupperschmidt
+:License: Modified BSD, see LICENSE for details.
+"""
+
+import click
+
+from byceps.services.user_badge import service as badge_service
+from byceps.util.system import get_config_filename_fro... | |
7a98fd7f4f5a3d29aa9b8b182e19d7c8b16bcc4a | symposion/reviews/migrations/0002_migrate_messages_to_feedback.py | symposion/reviews/migrations/0002_migrate_messages_to_feedback.py | # Generated by Django 2.0.13 on 2019-05-13 22:09
from django.db import migrations
def migrate_messages_to_feedback(apps, schema_editor):
"""
Migrate symposion.reviews.models.ProposalMessage to
conf_site.reviews.models.ProposalFeedback.
"""
ProposalMessage = apps.get_model("symposion_reviews", "Pr... | Migrate old proposal messages to new feedback. | Migrate old proposal messages to new feedback.
Migrate `symposion.reviews.models.ProposalMessage` objects to
`conf_site.reviews.models.ProposalFeedback` objects.
| Python | mit | pydata/conf_site,pydata/conf_site,pydata/conf_site | ---
+++
@@ -0,0 +1,30 @@
+# Generated by Django 2.0.13 on 2019-05-13 22:09
+
+from django.db import migrations
+
+
+def migrate_messages_to_feedback(apps, schema_editor):
+ """
+ Migrate symposion.reviews.models.ProposalMessage to
+ conf_site.reviews.models.ProposalFeedback.
+ """
+ ProposalMessage = a... | |
35f3aa0407b68210abe2e46648ae3a39ee21b17b | senlin/tests/tempest/api/receivers/test_receiver_show.py | senlin/tests/tempest/api/receivers/test_receiver_show.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Add API test for receiver show | Add API test for receiver show
Add API test for receiver show
Change-Id: I6d01189cdba772c1c085549a4a9838d43ce39a73
| Python | apache-2.0 | openstack/senlin,openstack/senlin,stackforge/senlin,openstack/senlin,stackforge/senlin | ---
+++
@@ -0,0 +1,54 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writi... | |
7c5ec81cd0775aaa47b004d275eac6496dd53297 | __init__.py | __init__.py | import os
import sys
def get_path(version=2014):
'''Get the path to these shaders for stuffing into Maya envvars.'''
return os.path.abspath(os.path.join(
__file__,
'..',
'build',
'%s-%d' % (
'macosx' if sys.platform == 'darwin' else 'linux',
version
... | Add a hook for key_base to find this tool | Add a hook for key_base to find this tool
For the dev command, really. | Python | bsd-3-clause | westernx/ksmrshaders | ---
+++
@@ -0,0 +1,16 @@
+import os
+import sys
+
+
+def get_path(version=2014):
+ '''Get the path to these shaders for stuffing into Maya envvars.'''
+
+ return os.path.abspath(os.path.join(
+ __file__,
+ '..',
+ 'build',
+ '%s-%d' % (
+ 'macosx' if sys.platform == 'darwi... | |
dc7887dde6b2ca8136647051da3c8cbe8762ca65 | samples/migrations/0014_auto_20170529_0935.py | samples/migrations/0014_auto_20170529_0935.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-29 12:35
from __future__ import unicode_literals
from django.db import migrations
import samples.custom.models
class Migration(migrations.Migration):
dependencies = [
('samples', '0013_auto_20170526_1718'),
]
operations = [
m... | Add mitration file for changing ObservedSymptom field | :memo: Add mitration file for changing ObservedSymptom field
| Python | mit | gems-uff/labsys,gems-uff/labsys,gems-uff/labsys | ---
+++
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11 on 2017-05-29 12:35
+from __future__ import unicode_literals
+
+from django.db import migrations
+import samples.custom.models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('samples', '0013_auto_20170526_1718... | |
39ec6a5c1c42ababb44aa1863d5e441ec807f345 | sara_flexbe_states/src/sara_flexbe_states/Wonderland_Read_Entity_Position.py | sara_flexbe_states/src/sara_flexbe_states/Wonderland_Read_Entity_Position.py | #!/usr/bin/env python
# encoding=utf8
from flexbe_core import EventState, Logger
import json
class Wonderland_Read_Entity_Position(EventState):
'''
Read the 3D position of an entity in a json string
># json_text string command to read
#< x_pos int x position of the entity
#< y_pos int y po... | Add a state for read an entity position in Wonderland. | Add a state for read an entity position in Wonderland.
| Python | bsd-3-clause | WalkingMachine/sara_behaviors,WalkingMachine/sara_behaviors | ---
+++
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+# encoding=utf8
+
+from flexbe_core import EventState, Logger
+import json
+
+class Wonderland_Read_Entity_Position(EventState):
+ '''
+ Read the 3D position of an entity in a json string
+
+ ># json_text string command to read
+
+ #< x_pos int x position ... | |
32c190b4ba195c164686fdef03029edda38549eb | velocity_step_example2sv.py | velocity_step_example2sv.py | import numpy as np
import matplotlib.pyplot as plt
import rsf
model = rsf.ExternalSystem()
# Set model initial conditions
model.mu0 = 0.6 # Friction initial (at the reference velocity)
model.a = 0.005 # Empirical coefficient for the direct effect
model.k = 1e-3 # Normalized System stiffness (friction/micron)
model.v ... | Add two state variable example | Add two state variable example
| Python | mit | jrleeman/rsfmodel | ---
+++
@@ -0,0 +1,45 @@
+import numpy as np
+import matplotlib.pyplot as plt
+import rsf
+
+model = rsf.ExternalSystem()
+
+# Set model initial conditions
+model.mu0 = 0.6 # Friction initial (at the reference velocity)
+model.a = 0.005 # Empirical coefficient for the direct effect
+model.k = 1e-3 # Normalized System... | |
6acc7838e250512957392fe3577f24f97c712cd2 | tests/app/notify_client/test_status_api_client.py | tests/app/notify_client/test_status_api_client.py | from app.notify_client.status_api_client import StatusApiClient
def test_get_count_of_live_services_and_organisations(mocker):
mocker.patch('app.extensions.RedisClient.get', return_value=None)
client = StatusApiClient()
mock = mocker.patch.object(client, 'get', return_value={})
client.get_count_of_li... | Add tests for existing status api client | Add tests for existing status api client
Essentially copies the tests found in the performance_platform
api client.
| Python | mit | alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin | ---
+++
@@ -0,0 +1,59 @@
+from app.notify_client.status_api_client import StatusApiClient
+
+
+def test_get_count_of_live_services_and_organisations(mocker):
+ mocker.patch('app.extensions.RedisClient.get', return_value=None)
+ client = StatusApiClient()
+ mock = mocker.patch.object(client, 'get', return_val... | |
5973e21ee459dd4f659f9a3a94be48e8a0df13bc | py/brick-wall.py | py/brick-wall.py | from collections import Counter
class Solution(object):
def leastBricks(self, wall):
"""
:type wall: List[List[int]]
:rtype: int
"""
c = Counter()
wall_width = sum(wall[0])
max_non_cut = 0
for row in wall:
subsum = 0
for n in ro... | Add py solution for 554. Brick Wall | Add py solution for 554. Brick Wall
554. Brick Wall: https://leetcode.com/problems/brick-wall/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,18 @@
+from collections import Counter
+class Solution(object):
+ def leastBricks(self, wall):
+ """
+ :type wall: List[List[int]]
+ :rtype: int
+ """
+ c = Counter()
+ wall_width = sum(wall[0])
+ max_non_cut = 0
+ for row in wall:
+ ... | |
f0251c2638f1242655b514eb4d8fddf16c655ad0 | test/test_data_uri.py | test/test_data_uri.py | import os
import unittest
from node import data_uri
TEST_TXT_FILE = "data_uri_test.txt"
TEST_CONTENTS = "foo\n"
class TestDataURI(unittest.TestCase):
def setUp(self):
with open(TEST_TXT_FILE, 'w') as f:
f.write(TEST_CONTENTS)
def tearDown(self):
os.remove(TEST_TXT_FILE)
def... | Add tests for data_uri module | Add tests for data_uri module
Address reviewer comments
| Python | mit | bglassy/OpenBazaar,bankonme/OpenBazaar,bankonme/OpenBazaar,atsuyim/OpenBazaar,rllola/OpenBazaar,NolanZhao/OpenBazaar,mirrax/OpenBazaar,bglassy/OpenBazaar,matiasbastos/OpenBazaar,habibmasuro/OpenBazaar,NolanZhao/OpenBazaar,saltduck/OpenBazaar,akhavr/OpenBazaar,mirrax/OpenBazaar,matiasbastos/OpenBazaar,NolanZhao/OpenBaza... | ---
+++
@@ -0,0 +1,40 @@
+import os
+import unittest
+
+from node import data_uri
+
+TEST_TXT_FILE = "data_uri_test.txt"
+TEST_CONTENTS = "foo\n"
+
+class TestDataURI(unittest.TestCase):
+
+ def setUp(self):
+ with open(TEST_TXT_FILE, 'w') as f:
+ f.write(TEST_CONTENTS)
+
+ def tearDown(self):... | |
455627ee963f1e61f1e9986fa00fa62318d8c179 | test/test_issuexxx.py | test/test_issuexxx.py | from rdflib import Graph, Namespace, URIRef, Literal
from rdflib.compare import to_isomorphic
import unittest
class TestIssueXXXX(unittest.TestCase):
def test_issuexxxx(self):
PROV = Namespace('http://www.w3.org/ns/prov#')
bob = URIRef("http://example.org/object/Bob")
value = Literal(flo... | Test serialisation of infinite values | Test serialisation of infinite values
| Python | bsd-3-clause | RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib | ---
+++
@@ -0,0 +1,27 @@
+from rdflib import Graph, Namespace, URIRef, Literal
+from rdflib.compare import to_isomorphic
+import unittest
+
+
+class TestIssueXXXX(unittest.TestCase):
+
+ def test_issuexxxx(self):
+ PROV = Namespace('http://www.w3.org/ns/prov#')
+
+ bob = URIRef("http://example.org/ob... | |
31c3aa17875bf6e3c51d0a8b47500cd4f234f002 | knights/k_tags.py | knights/k_tags.py |
import ast
from .klass import build_method
from .library import Library
register = Library()
def parse_args(bits):
'''
Parse tag bits as if they're function args
'''
code = ast.parse('x(%s)' % bits, mode='eval')
return code.body.args, code.body.keywords
@register.tag(name='block')
def block(s... | Add basic block tag implementation | Add basic block tag implementation
| Python | mit | funkybob/knights-templater,funkybob/knights-templater | ---
+++
@@ -0,0 +1,35 @@
+
+import ast
+
+from .klass import build_method
+from .library import Library
+
+register = Library()
+
+
+def parse_args(bits):
+ '''
+ Parse tag bits as if they're function args
+ '''
+ code = ast.parse('x(%s)' % bits, mode='eval')
+ return code.body.args, code.body.keywords... | |
1f1ffb3071f5ba3215b47745896352496df199fa | bin/cobbler/migrate_ks.py | bin/cobbler/migrate_ks.py | #!/usr/bin/python
import xmlrpclib
import logging
from compass.utils import setting_wrapper as setting
def main():
remote = xmlrpclib.Server(setting.COBBLER_INSTALLER_URL, allow_none=True)
token = remote.login(*setting.COBBLER_INSTALLER_TOKEN)
systems = remote.get_systems(token)
for system in system... | Migrate rendered kickstarts to solve cobbler single-threading issues | Migrate rendered kickstarts to solve cobbler single-threading issues
Change-Id: I431878dd1fbab44c5415739db1c6bb89788a5803
| Python | apache-2.0 | stackforge/compass-core,stackforge/compass-core,stackforge/compass-core,openstack/compass-core,baigk/compass-core,openstack/compass-core,openstack/compass-core,baigk/compass-core,stackforge/compass-core,baigk/compass-core,openstack/compass-core | ---
+++
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+import xmlrpclib
+import logging
+
+from compass.utils import setting_wrapper as setting
+
+
+def main():
+ remote = xmlrpclib.Server(setting.COBBLER_INSTALLER_URL, allow_none=True)
+ token = remote.login(*setting.COBBLER_INSTALLER_TOKEN)
+ systems = remote.get_... | |
5d705221e6e6e1d32c90bd8a6e7ee940008d91e9 | examples/chatserver/views.py | examples/chatserver/views.py | # -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.views.generic.base import TemplateView
from django.views.decorators.csrf import csrf_exempt
import redis
from ws4redis import settings as redis_settings
class BaseTemplateView(TemplateView):
def __... | # -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.views.generic.base import TemplateView
from django.views.decorators.csrf import csrf_exempt
import redis
from ws4redis import settings as redis_settings
class BaseTemplateView(TemplateView):
def __... | Use META.SERVER_NAME in template view. … | Use META.SERVER_NAME in template view. …
| Python | mit | yacneyac/django-websocket-redis,0nkery/django-websocket-redis3,yacneyac/django-websocket-redis,jgroszko/django-websocket-redis,0nkery/django-websocket-redis3,jgroszko/django-websocket-redis,malefice/django-websocket-redis,Frky/django-websocket-redis,Frky/django-websocket-redis,jrief/django-websocket-redis,malefice/djan... | ---
+++
@@ -13,7 +13,7 @@
def get_context_data(self, **kwargs):
context = super(BaseTemplateView, self).get_context_data(**kwargs)
- context.update(ws_url='ws://localhost:{SERVER_PORT}/ws/foobar'.format(**self.request.META))
+ context.update(ws_url='ws://{SERVER_NAME}:{SERVER_PORT}/ws/fo... |
09cf3f450a6a3d718cf011daf6ef4862ad0181b4 | examples/connected_region.py | examples/connected_region.py | import numpy as np
import matplotlib.pyplot as plt
import lulu.lulu_base as base
c = base.ConnectedRegion(shape=(5,5),
value=1, start_row=1,
rowptr=[0,4,6,10,14],
colptr=[2,3,4,5,0,5,0,1,2,5,0,2,3,5])
print c.todense()
dense = np.zeros((7,7,... | Add example to illustrate boundaries. | Add example to illustrate boundaries.
| Python | bsd-3-clause | stefanv/lulu | ---
+++
@@ -0,0 +1,38 @@
+import numpy as np
+import matplotlib.pyplot as plt
+
+import lulu.lulu_base as base
+
+c = base.ConnectedRegion(shape=(5,5),
+ value=1, start_row=1,
+ rowptr=[0,4,6,10,14],
+ colptr=[2,3,4,5,0,5,0,1,2,5,0,2,3,5])
+
+pri... | |
e4b1cccddde441a4973eb3c9f741e2ce47e1d8dc | openprescribing/frontend/tests/test_geojson_serializer.py | openprescribing/frontend/tests/test_geojson_serializer.py | import json
from django.test import TestCase
from django.core.serializers import serialize
from frontend.models import PCT
from api.geojson_serializer import as_geojson_stream
class GeoJSONSerializerTest(TestCase):
fixtures = ['orgs']
def test_output_is_the_same_as_core_serializer(self):
fields = ... | Add test for GeoJSON serializer | Add test for GeoJSON serializer
| Python | mit | ebmdatalab/openprescribing,ebmdatalab/openprescribing,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc,annapowellsmith/openpresc,ebmdatalab/openprescribing | ---
+++
@@ -0,0 +1,30 @@
+import json
+
+from django.test import TestCase
+from django.core.serializers import serialize
+
+from frontend.models import PCT
+from api.geojson_serializer import as_geojson_stream
+
+
+class GeoJSONSerializerTest(TestCase):
+
+ fixtures = ['orgs']
+
+ def test_output_is_the_same_as... | |
8f9ee7f7ad751a3d785e1063c7bbf52b4c8a8de2 | migrations/versions/0236_another_letter_org.py | migrations/versions/0236_another_letter_org.py | """empty message
Revision ID: 0236_another_letter_org
Revises: 0235_add_postage_to_pk
"""
# revision identifiers, used by Alembic.
revision = '0236_another_letter_org'
down_revision = '0235_add_postage_to_pk'
from alembic import op
NEW_ORGANISATIONS = [
('514', 'Brighton and Hove city council'),
]
def upgra... | Add letter org for Brighton and Hove | Add letter org for Brighton and Hove
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,35 @@
+"""empty message
+
+Revision ID: 0236_another_letter_org
+Revises: 0235_add_postage_to_pk
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '0236_another_letter_org'
+down_revision = '0235_add_postage_to_pk'
+
+from alembic import op
+
+
+NEW_ORGANISATIONS = [
+ ('514', 'Brig... | |
449285d8136015fe8c0ecd1c756d77b21dfba6e9 | html/cli-get-html-hyperlinks.py | html/cli-get-html-hyperlinks.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
from HTMLParser import HTMLParser
# HTML Hyperlink(s) getter
class GetHyperlinks(HTMLParser):
def __init__(self):
self.reset()
self.links = []
def handle_starttag(self, tag, attrs):
if tag == 'a':
for attr in at... | Add HTML hyperlink (<a> tag) finder/getter | Add HTML hyperlink (<a> tag) finder/getter
| Python | mit | rawswift/python-collections | ---
+++
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import urllib2
+from HTMLParser import HTMLParser
+
+# HTML Hyperlink(s) getter
+class GetHyperlinks(HTMLParser):
+
+ def __init__(self):
+ self.reset()
+ self.links = []
+
+ def handle_starttag(self, tag, attrs):
+ ... | |
923c463e4a8e2da3b2cbe60d7351a3036257551d | migrations/versions/65fc9ede4746_add_is_draft_status_to_queries_and_.py | migrations/versions/65fc9ede4746_add_is_draft_status_to_queries_and_.py | """Add is_draft status to queries and dashboards
Revision ID: 65fc9ede4746
Revises:
Create Date: 2016-12-07 18:08:13.395586
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
from sqlalchemy.exc import ProgrammingError
revision = '... | Add migration for the is_draft column | Add migration for the is_draft column
| Python | bsd-2-clause | stefanseifert/redash,amino-data/redash,getredash/redash,alexanderlz/redash,alexanderlz/redash,vishesh92/redash,imsally/redash,amino-data/redash,chriszs/redash,useabode/redash,44px/redash,EverlyWell/redash,imsally/redash,hudl/redash,amino-data/redash,rockwotj/redash,rockwotj/redash,M32Media/redash,hudl/redash,alexanderl... | ---
+++
@@ -0,0 +1,37 @@
+"""Add is_draft status to queries and dashboards
+
+Revision ID: 65fc9ede4746
+Revises:
+Create Date: 2016-12-07 18:08:13.395586
+
+"""
+from alembic import op
+import sqlalchemy as sa
+from sqlalchemy.dialects import postgresql
+
+# revision identifiers, used by Alembic.
+from sqlalchemy.e... | |
617819e7aff47f2764d13bd183080dea54f689f9 | test_equil_solver.py | test_equil_solver.py | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 5 09:44:38 2015
@author: jensv
"""
import numpy as np
import numpy.testing as test
import scipy.integrate as integrate
import equil_solver as es
from scipy.interpolate import splev
from nose.tools import with_setup
test_equil = None
def setup_func():
r"""
Gene... | Add tests for equilibrium profiles. | Add tests for equilibrium profiles.
| Python | mit | jensv/fluxtubestability,jensv/fluxtubestability | ---
+++
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Thu Nov 5 09:44:38 2015
+
+@author: jensv
+"""
+
+import numpy as np
+import numpy.testing as test
+import scipy.integrate as integrate
+import equil_solver as es
+from scipy.interpolate import splev
+from nose.tools import with_setup
+
+test_equil =... | |
04e63aa44bb2de8f769202c02a3a23a7e9d17d74 | tests/unit/test_handlers.py | tests/unit/test_handlers.py | from pmxbot import core
def test_contains_always_match():
"""
Contains handler should always match if no rate is specified.
"""
handler = core.ContainsHandler(name='#', func=None)
assert handler.match('Tell me about #foo', channel='bar')
| Add test capturing bad implementation of contains handler. | Add test capturing bad implementation of contains handler.
| Python | mit | yougov/pmxbot,yougov/pmxbot,yougov/pmxbot | ---
+++
@@ -0,0 +1,8 @@
+from pmxbot import core
+
+def test_contains_always_match():
+ """
+ Contains handler should always match if no rate is specified.
+ """
+ handler = core.ContainsHandler(name='#', func=None)
+ assert handler.match('Tell me about #foo', channel='bar') | |
14d048091cfa24d0f6abd5cb61d814c4fee9e6db | hooks/post_gen_project.py | hooks/post_gen_project.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Rename the generated kv file to be compatible with the original kivy kv file
detection of `App.load_kv`.
"""
import os
package_dir = '{{cookiecutter.repo_name}}'
old_kv_file = os.path.join(package_dir, '{{cookiecutter.app_class_name}}.kv')
lower_app_class_name = '{{... | Implement a post gen python script to rename the kv file | Implement a post gen python script to rename the kv file
| Python | mit | hackebrot/cookiedozer,hackebrot/cookiedozer | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""Rename the generated kv file to be compatible with the original kivy kv file
+detection of `App.load_kv`.
+"""
+
+import os
+
+
+package_dir = '{{cookiecutter.repo_name}}'
+old_kv_file = os.path.join(package_dir, '{{cookiecutter.app_class_... | |
92e840aef7ac0d9aee629db58791a43a71cd578c | myhdl/test/conversion/numeric/test_numass.py | myhdl/test/conversion/numeric/test_numass.py | from __future__ import absolute_import, print_function
from random import randrange
from myhdl import Signal, uintba, sintba, instance, delay, conversion
def NumassBench():
p = Signal(uintba(1, 8))
q = Signal(uintba(1, 40))
r = Signal(sintba(1, 9))
s = Signal(sintba(1, 41))
PBIGINT = randrange(2... | Revert "Revert "Revert "Revert "Added the number assignment test for numeric."""" | Revert "Revert "Revert "Revert "Added the number assignment test for numeric.""""
This reverts commit 91151bc6fd2c48c83656452e7c8f8f7e8b7b4218.
| Python | lgpl-2.1 | jmgc/myhdl-numeric,jmgc/myhdl-numeric,jmgc/myhdl-numeric | ---
+++
@@ -0,0 +1,55 @@
+from __future__ import absolute_import, print_function
+
+from random import randrange
+
+from myhdl import Signal, uintba, sintba, instance, delay, conversion
+
+
+def NumassBench():
+ p = Signal(uintba(1, 8))
+ q = Signal(uintba(1, 40))
+ r = Signal(sintba(1, 9))
+ s = Signal(s... | |
de760c40c8aa187131b0b3b7a9517445cb648634 | distance.py | distance.py | #Import needed libraries
import numpy as np
import cv2
cap=cv2.VideoCapture(0)
i=0
ret=True
while(i<1):
ret, frame =cap.read()
# print("Camera is still running buddy")
cv2.imwrite('test{0}.png'.format(i), frame)
i=i+1
cap.release()
cv2.destroyAllWindows()
| Add python script to take image frame from live camera feed | Add python script to take image frame from live camera feed
| Python | mit | galxy25/safeDriver | ---
+++
@@ -0,0 +1,18 @@
+#Import needed libraries
+import numpy as np
+import cv2
+
+cap=cv2.VideoCapture(0)
+
+i=0
+ret=True
+while(i<1):
+
+ ret, frame =cap.read()
+# print("Camera is still running buddy")
+ cv2.imwrite('test{0}.png'.format(i), frame)
+ i=i+1
+
+cap.release()
+cv2.destroyAllWindows()
+ | |
08749433dfcc8e3df19adcdfc4598f9cba43adee | ansible-tests/validations.py | ansible-tests/validations.py | #!/usr/bin/env python
import sys
import glob
def die(msg):
print msg
sys.exit(1)
def validations():
validations = glob.glob('playbooks/*.yaml')
return list(sorted(validations))
def command_list(**args):
for i, name in enumerate(validations()):
print "%d. %s" % (i + 1, name)
def comman... | Add a basic runner program | Add a basic runner program
It just lists validations right now. Ultimately it will run them and
potentially provide a HTTP API.
| Python | apache-2.0 | rthallisey/clapper,coolsvap/clapper,coolsvap/clapper,coolsvap/clapper,rthallisey/clapper | ---
+++
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+
+import sys
+import glob
+
+def die(msg):
+ print msg
+ sys.exit(1)
+
+def validations():
+ validations = glob.glob('playbooks/*.yaml')
+ return list(sorted(validations))
+
+
+def command_list(**args):
+ for i, name in enumerate(validations()):
+ ... | |
d3cac0f637a8667497ff311fc94bdceb19330b77 | plugins/modules/dedicated_server_monitoring.py | plugins/modules/dedicated_server_monitoring.py | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.module_utils.basic import AnsibleModule
DOCUMENTATION = '''
---
module: dedicated_server_monitoring
short_description: Enable or disable ovh monitoring on a dedicated server
description:
- Enable... | Add dedicated server monitoring modulec | INFRA-6746: Add dedicated server monitoring modulec
- Then you can add or remove OVH monitoring
| Python | mit | synthesio/infra-ovh-ansible-module | ---
+++
@@ -0,0 +1,89 @@
+#!/usr/bin/python
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+from ansible.module_utils.basic import AnsibleModule
+
+DOCUMENTATION = '''
+---
+module: dedicated_server_monitoring
+short_description: Enable or disable ovh monitoring on a dedic... | |
9080fae1e329a541102ec31fbf7a93dab36c891b | scripts/migrate_logs_branded_preprints.py | scripts/migrate_logs_branded_preprints.py | import sys
import logging
from website.app import init_app
from website.models import NodeLog, PreprintService
from scripts import utils as script_utils
from modularodm import Q
logger = logging.getLogger(__name__)
def do_migration(records, dry=False):
count = 0
for log in records:
provider = Prepr... | Add node log migration script for branded preprints | Add node log migration script for branded preprints
| Python | apache-2.0 | baylee-d/osf.io,leb2dg/osf.io,Johnetordoff/osf.io,brianjgeiger/osf.io,chennan47/osf.io,chrisseto/osf.io,rdhyee/osf.io,caneruguz/osf.io,CenterForOpenScience/osf.io,sloria/osf.io,alexschiller/osf.io,mluo613/osf.io,caseyrollins/osf.io,binoculars/osf.io,pattisdr/osf.io,HalcyonChimera/osf.io,caseyrollins/osf.io,hmoco/osf.io... | ---
+++
@@ -0,0 +1,47 @@
+import sys
+import logging
+
+from website.app import init_app
+from website.models import NodeLog, PreprintService
+from scripts import utils as script_utils
+from modularodm import Q
+
+logger = logging.getLogger(__name__)
+
+
+def do_migration(records, dry=False):
+ count = 0
+
+ fo... | |
a5efa5bd91cbbb2e963f48e4b8c2c371da02a6ec | readthedocs/core/migrations/0002_make_userprofile_user_a_onetoonefield.py | readthedocs/core/migrations/0002_make_userprofile_user_a_onetoonefield.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='use... | Add migration for UserProfile.user's change to OneToOneField | Add migration for UserProfile.user's change to OneToOneField
| Python | mit | gjtorikian/readthedocs.org,kdkeyser/readthedocs.org,titiushko/readthedocs.org,LukasBoersma/readthedocs.org,SteveViss/readthedocs.org,rtfd/readthedocs.org,techtonik/readthedocs.org,soulshake/readthedocs.org,royalwang/readthedocs.org,sunnyzwh/readthedocs.org,michaelmcandrew/readthedocs.org,wijerasa/readthedocs.org,clarkp... | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+from django.conf import settings
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('core', '0001_initial'),
+ ]
+
+ operations = [
+ migratio... | |
c600509c9c5069cc27d0c63ae34dc62a80087fa1 | scripts/rosedu-chat-logs.py | scripts/rosedu-chat-logs.py | #!/usr/local/bin/python3
import requests
from datetime import datetime, timedelta
url = "http://data.softwareliber.ro/irc-logs/%23rosedu/%23rosedu.{0:02d}-{1:02d}-{2}.log"
now = datetime.now()
yesterday = now - timedelta(hours=24)
ret = []
forbidden_lines = ["has quit", "has joined", "has left"]
for dates in [yester... | Add ROSEdu chat logs script | Add ROSEdu chat logs script
| Python | mit | smathson/dotfiles | ---
+++
@@ -0,0 +1,21 @@
+#!/usr/local/bin/python3
+import requests
+from datetime import datetime, timedelta
+
+url = "http://data.softwareliber.ro/irc-logs/%23rosedu/%23rosedu.{0:02d}-{1:02d}-{2}.log"
+
+now = datetime.now()
+yesterday = now - timedelta(hours=24)
+
+ret = []
+forbidden_lines = ["has quit", "has joi... | |
ff3a3cd831a70d89864d040c9cc6a71a378a5569 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
from cron_sentry.version import VERSION
setup(
name='cron-sentry',
version=VERSION,
author='Yipit Coders',
author_email='coders@yipit.com',
description='Cron-Sentry is a command-line wrapper that reports unsuccessful runs to Sentry (... | #!/usr/bin/env python
from setuptools import setup, find_packages
from cron_sentry.version import VERSION
setup(
name='cron-sentry',
version=VERSION,
author='Yipit Coders',
author_email='coders@yipit.com',
description='Cron-Sentry is a command-line wrapper that reports unsuccessful runs to Sentry (... | Add missing package requirement of argparse. | Add missing package requirement of argparse.
| Python | mit | ciiol/cron-sentry,sysadmind/cron-sentry | ---
+++
@@ -18,7 +18,7 @@
],
url='http://github.com/yipit/cron-sentry',
packages=find_packages(),
- install_requires=['raven'],
+ install_requires=['raven', 'argparse'],
data_files=[],
entry_points={
'console_scripts': [ |
8e124cf84b400a910e8dfc0c0b2b3fda3b846bd5 | sara_flexbe_states/src/sara_flexbe_states/Wonderland_Objects_In_A_Room.py | sara_flexbe_states/src/sara_flexbe_states/Wonderland_Objects_In_A_Room.py | #!/usr/bin/env python
# encoding=utf8
from flexbe_core import EventState, Logger
import json
class Wonderland_Objects_In_A_Room(EventState):
'''
Return all objects in a room
># json_text string json to read
#> names int[] array containing all names of objects in the room
#> ids ... | Add a state listing all entities in a room | Add a state listing all entities in a room
| Python | bsd-3-clause | WalkingMachine/sara_behaviors,WalkingMachine/sara_behaviors | ---
+++
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+# encoding=utf8
+
+from flexbe_core import EventState, Logger
+import json
+
+
+class Wonderland_Objects_In_A_Room(EventState):
+ '''
+ Return all objects in a room
+
+ ># json_text string json to read
+
+ #> names int[] array containing all name... | |
59a1d93ca6e0ff20035e2aa9c3ffc83e453f0942 | set1/challenge-2.py | set1/challenge-2.py | import base64
def fixed_xor(hex_a, hex_b):
decoded_a = base64.b16decode(hex_a, True)
decoded_b = base64.b16decode(hex_b, True)
xor_result = [chr(ord(a) ^ ord(b)) for a, b in zip(decoded_a, decoded_b)]
return base64.b16encode(''.join(xor_result))
if __name__ == '__main__':
hex_a = raw_input("hex_a... | Add solution to challenge 2. | Add solution to challenge 2.
| Python | mit | ericnorris/cryptopals-solutions | ---
+++
@@ -0,0 +1,14 @@
+import base64
+
+def fixed_xor(hex_a, hex_b):
+ decoded_a = base64.b16decode(hex_a, True)
+ decoded_b = base64.b16decode(hex_b, True)
+ xor_result = [chr(ord(a) ^ ord(b)) for a, b in zip(decoded_a, decoded_b)]
+
+ return base64.b16encode(''.join(xor_result))
+
+if __name__ == '__... | |
7f3acc09228460e4494ab7e4899edf3f131efc72 | build/android/test_runner.py | build/android/test_runner.py | #!/usr/bin/env python
# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All c... | Add Android test runner script for WebRTC. | Add Android test runner script for WebRTC.
The Android test execution toolchain scripts in Chromium
has been causing headaches for us several times. Mostly
because they're tailored at running Chrome tests only.
Wrapping their script in our own avoids the pain of
upstreaming new test names to Chromium and rolling them... | Python | bsd-3-clause | sippet/webrtc,sippet/webrtc,sippet/webrtc,sippet/webrtc,sippet/webrtc,sippet/webrtc | ---
+++
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be fo... | |
37dee83ed478eba2079bd6eb98c39d7ba2872c7d | multigtfs/management/commands/refreshgeometries.py | multigtfs/management/commands/refreshgeometries.py | #
# Copyright 2012-2014 John Whitlock
#
# 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 writ... | Add mgmt command for refreshing cached geometries | Add mgmt command for refreshing cached geometries
| Python | apache-2.0 | tulsawebdevs/django-multi-gtfs,tulsawebdevs/django-multi-gtfs,inmagik/django-multi-gtfs,inmagik/django-multi-gtfs,inmagik/django-multi-gtfs,inmagik/django-multi-gtfs | ---
+++
@@ -0,0 +1,79 @@
+#
+# Copyright 2012-2014 John Whitlock
+#
+# 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 b... | |
252bbb9c2eb4623c46e6ad5c78ce0299c2ba433b | misc/create_test_identifier.py | misc/create_test_identifier.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Creates an identifier in the same scheme as the ID minter.
Useful for creating test IDs.
ABSOLUTELY NOT FOR PRODUCTION USE.
"""
import random
import string
allowed_chars = [
char
for char in (string.ascii_lowercase + string.digits)
if char not in '0oil... | Check in my script for creating test IDs | Check in my script for creating test IDs
[skip ci]
| Python | mit | wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api | ---
+++
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+"""
+Creates an identifier in the same scheme as the ID minter.
+
+Useful for creating test IDs.
+
+ABSOLUTELY NOT FOR PRODUCTION USE.
+"""
+
+import random
+import string
+
+allowed_chars = [
+ char
+ for char in (string.ascii_lowercas... | |
fae3703d64c0f4975612ccc1ba7710b47dfec8b9 | tests/test_connection.py | tests/test_connection.py | from django.test import TestCase
from revproxy import connection
class TestOutput(TestCase):
def setUp(self):
self.connection = connection.HTTPConnectionPool.ConnectionCls('example.com')
def test_byte_url(self):
"""Output strings are always byte strings, even using Python 3"""
mock_... | Add tests for output as bytes and testing that the host line is second | Add tests for output as bytes and testing that the host line is second
| Python | mpl-2.0 | TracyWebTech/django-revproxy,TracyWebTech/django-revproxy | ---
+++
@@ -0,0 +1,22 @@
+from django.test import TestCase
+
+from revproxy import connection
+
+
+class TestOutput(TestCase):
+
+ def setUp(self):
+ self.connection = connection.HTTPConnectionPool.ConnectionCls('example.com')
+
+ def test_byte_url(self):
+ """Output strings are always byte string... | |
1856e8102b709176e46c3751bd21234dd5d1eacc | src/nodeconductor_assembly_waldur/packages/tests/unittests/test_admin.py | src/nodeconductor_assembly_waldur/packages/tests/unittests/test_admin.py | from django.test import TestCase
from .. import factories
from ... import admin, models
class TestPackageComponentForm(TestCase):
def test_package_component_form_is_valid_when_component_price_is_0(self):
data = {
'monthly_price': '0',
'amount': '2',
'type': models.Pac... | Add unit tests for package component form | Add unit tests for package component form [WAL-450]
| Python | mit | opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur | ---
+++
@@ -0,0 +1,32 @@
+from django.test import TestCase
+
+from .. import factories
+from ... import admin, models
+
+
+class TestPackageComponentForm(TestCase):
+
+ def test_package_component_form_is_valid_when_component_price_is_0(self):
+ data = {
+ 'monthly_price': '0',
+ 'amoun... | |
9f6673afa14dda9c4d32b3b30bd8e4f1a0489269 | Problem_04_palindrome/problem_4.py | Problem_04_palindrome/problem_4.py | def is_palindrome(number):
reversed_number = 0
n = number
while(n):
reversed_number = reversed_number * 10 + (n % 10)
#print("reversed_number:", reversed_number)
n //= 10
#print("n:", n)
return number == reversed_number
largest_palindrome = -1
for i in range(100, 1000):
#print("i:", i)
... | Solve problem 2 in Python | Solve problem 2 in Python
| Python | mit | sirodoht/project-euler,sirodoht/project-euler,sirodoht/project-euler | ---
+++
@@ -0,0 +1,22 @@
+def is_palindrome(number):
+
+ reversed_number = 0
+ n = number
+
+ while(n):
+ reversed_number = reversed_number * 10 + (n % 10)
+ #print("reversed_number:", reversed_number)
+ n //= 10
+ #print("n:", n)
+
+ return number == reversed_number
+
+
+largest_palindrome = -1
+for ... | |
703de44925dd4fe2d06aa4dcda51b56bad77af2f | test/benchmarks/startup/TestStartupDelays.py | test/benchmarks/startup/TestStartupDelays.py | """Test lldb's startup delays creating a target and setting a breakpoint."""
import os, sys
import unittest2
import lldb
import pexpect
from lldbbench import *
class StartupDelaysBench(BenchBase):
mydir = os.path.join("benchmarks", "startup")
def setUp(self):
BenchBase.setUp(self)
# Create s... | Add a benchmark for measuring start up delays of lldb, including: | Add a benchmark for measuring start up delays of lldb, including:
o create a fresh target; and
o set the first breakpoint
Example (using lldb to set a breakpoint on lldb's Driver::MainLoop function):
./dotest.py -v +b -x '-F Driver::MainLoop()' -p TestStartupDelays.py
...
1: test_startup_delay (TestStartupDelays.S... | Python | apache-2.0 | llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb | ---
+++
@@ -0,0 +1,82 @@
+"""Test lldb's startup delays creating a target and setting a breakpoint."""
+
+import os, sys
+import unittest2
+import lldb
+import pexpect
+from lldbbench import *
+
+class StartupDelaysBench(BenchBase):
+
+ mydir = os.path.join("benchmarks", "startup")
+
+ def setUp(self):
+ ... | |
047697aa92f297c5e9c74ef0bd9eb3702b5fce13 | bioagents/dtda/generate_tas_dump.py | bioagents/dtda/generate_tas_dump.py | import os
import pickle
from collections import defaultdict
from indra.sources import tas
from indra.databases import drugbank_client
def normalize_drug(drug):
flags = score_drug(drug)
if 'long_name' in flags:
if 'DRUGBANK' in drug.db_refs:
db_name = \
drugbank_client.get_d... | Add script to reproduce custom TAS dump | Add script to reproduce custom TAS dump
| Python | bsd-2-clause | sorgerlab/bioagents,bgyori/bioagents | ---
+++
@@ -0,0 +1,62 @@
+import os
+import pickle
+from collections import defaultdict
+from indra.sources import tas
+from indra.databases import drugbank_client
+
+
+def normalize_drug(drug):
+ flags = score_drug(drug)
+ if 'long_name' in flags:
+ if 'DRUGBANK' in drug.db_refs:
+ db_name = ... | |
a9af94015d395a674a8ba542b1ba12bc74114f47 | tests/test_stack/test_queue_two_stacks.py | tests/test_stack/test_queue_two_stacks.py | import unittest
from aids.stack.queue_two_stacks import QueueUsingTwoStacks
class QueueTwoStacksTestCase(unittest.TestCase):
'''
Unit tests for the Queue data structure implemented using two stacks
'''
def setUp(self):
self.test_queue = QueueUsingTwoStacks()
def test_queue_initialization(sel... | Add unit tests for queue_two_stacks | Add unit tests for queue_two_stacks
| Python | mit | ueg1990/aids | ---
+++
@@ -0,0 +1,33 @@
+import unittest
+
+from aids.stack.queue_two_stacks import QueueUsingTwoStacks
+
+class QueueTwoStacksTestCase(unittest.TestCase):
+ '''
+ Unit tests for the Queue data structure implemented using two stacks
+
+ '''
+
+ def setUp(self):
+ self.test_queue = QueueUsingTwoStacks()... | |
6ec81721055c4a236a4e6f3cd4bac3a116aea01a | tests/unit/cloud/clouds/test_qingcloud.py | tests/unit/cloud/clouds/test_qingcloud.py | import copy
from salt.cloud.clouds import qingcloud
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase
class QingCloudTestCase(TestCase, LoaderModuleMockMixin):
"""
Unit TestCase for salt.cloud.clouds.qingcloud module... | Validate qingcloud defaults to verifying SSL | Validate qingcloud defaults to verifying SSL
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,59 @@
+import copy
+
+from salt.cloud.clouds import qingcloud
+from tests.support.mixins import LoaderModuleMockMixin
+from tests.support.mock import MagicMock, patch
+from tests.support.unit import TestCase
+
+
+class QingCloudTestCase(TestCase, LoaderModuleMockMixin):
+ """
+ Unit TestCase ... | |
da722b889a2b637bf3895f9f0c5e614deee7e45f | scripts/util/add_clifiles.py | scripts/util/add_clifiles.py | """Utility script that copies neighboring clifiles when it is discovered
that we need new ones!"""
import psycopg2
import os
import sys
import shutil
def missing_logic(fn):
"""Figure out what to do when this filename is missing"""
print("Searching for replacement for '%s'" % (fn,))
lon = float(fn[17:23])
... | Add utility for copying clifiles when new points are needed. | Add utility for copying clifiles when new points are needed. | Python | mit | akrherz/idep,akrherz/idep,akrherz/dep,akrherz/dep,akrherz/dep,akrherz/idep,akrherz/dep,akrherz/dep,akrherz/idep,akrherz/idep,akrherz/idep | ---
+++
@@ -0,0 +1,43 @@
+"""Utility script that copies neighboring clifiles when it is discovered
+that we need new ones!"""
+import psycopg2
+import os
+import sys
+import shutil
+
+
+def missing_logic(fn):
+ """Figure out what to do when this filename is missing"""
+ print("Searching for replacement for '%s'... | |
1e363121f66d0ef01de6ff83b3dd9167df4d146f | tests/RemovingUnitRules/__init__.py | tests/RemovingUnitRules/__init__.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 24.08.2017 11:32
:Licence GNUv3
Part of grammpy-transforms
""" | Add directory for tests of removing unit rules | Add directory for tests of removing unit rules
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,8 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 24.08.2017 11:32
+:Licence GNUv3
+Part of grammpy-transforms
+
+""" | |
e44e50d16726b8517d497f50a276a9851be7fcf0 | tests/cmd/test_manage.py | tests/cmd/test_manage.py | # Copyright 2013: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | Add missing tests for rally/cmd/manage.py | Add missing tests for rally/cmd/manage.py
Change-Id: Id0e6659b957a346ab7d9aed4ff295e61f7eed515
| Python | apache-2.0 | cernops/rally,eonpatapon/rally,yeming233/rally,ytsarev/rally,paboldin/rally,vefimova/rally,gluke77/rally,group-policy/rally,aforalee/RRally,yeming233/rally,cernops/rally,varunarya10/rally,go-bears/rally,aplanas/rally,shdowofdeath/rally,vefimova/rally,amit0701/rally,vponomaryov/rally,openstack/rally,group-policy/rally,g... | ---
+++
@@ -0,0 +1,38 @@
+# Copyright 2013: Mirantis Inc.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/L... | |
95a53e362eac0b42e9f77bf9dba2b43a71b95e6d | vertex/repositories/__init__.py | vertex/repositories/__init__.py | from grapher import commons, errors
from grapher.repositories.base import EntityRepository
class CachedRepository(EntityRepository):
data = {}
def where(self, skip=0, limit=None, **query):
return []
def create(self, entities):
result = []
for entity in entities:
self... | Remove commons.request. Tests are now mocking flask_restful.request module. | Remove commons.request.
Tests are now mocking flask_restful.request module.
| Python | mit | lucasdavid/vertex | ---
+++
@@ -0,0 +1,51 @@
+from grapher import commons, errors
+from grapher.repositories.base import EntityRepository
+
+
+class CachedRepository(EntityRepository):
+ data = {}
+
+ def where(self, skip=0, limit=None, **query):
+ return []
+
+ def create(self, entities):
+ result = []
+
+ ... | |
783165571d6fe5b0e655e8c2a4cf7a77e74b3ea1 | wger/manager/migrations/0007_auto_20160311_2258.py | wger/manager/migrations/0007_auto_20160311_2258.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def convert_logs(apps, schema_editor):
'''
Adds a unit to users who have imperial units in the profile
'''
WorkoutLog = apps.get_model('manager', 'WorkoutLog')
UserProfile = apps.get_model('c... | Add data migration for settings and logs | Add data migration for settings and logs
| Python | agpl-3.0 | wger-project/wger,petervanderdoes/wger,petervanderdoes/wger,kjagoo/wger_stark,DeveloperMal/wger,DeveloperMal/wger,wger-project/wger,rolandgeider/wger,kjagoo/wger_stark,kjagoo/wger_stark,rolandgeider/wger,rolandgeider/wger,DeveloperMal/wger,DeveloperMal/wger,rolandgeider/wger,kjagoo/wger_stark,petervanderdoes/wger,wger-... | ---
+++
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+def convert_logs(apps, schema_editor):
+ '''
+ Adds a unit to users who have imperial units in the profile
+ '''
+
+ WorkoutLog = apps.get_model('manager', 'WorkoutLo... | |
206547027c6390664e498b6c5e00e48aa07a198c | libnamebench/config_test.py | libnamebench/config_test.py | #!/usr/bin/env python
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | Add some tests for dns config parsing | Add some tests for dns config parsing | Python | apache-2.0 | somehume/namebench | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+# Copyright 2009 Google Inc. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licen... | |
a1ef84da0df661a9371df23a623daf2b51304e89 | scripts/domain/effects.py | scripts/domain/effects.py |
class Effects:
def attack(self, player, dices):
pass
def defend(self, player, dmg, dodge):
pass
def dispute(self, player, attrName):
pass
| Add first version of the Effects base class | Add first version of the Effects base class
| Python | mit | VinGarcia/jit-rpg-system | ---
+++
@@ -0,0 +1,10 @@
+
+class Effects:
+ def attack(self, player, dices):
+ pass
+
+ def defend(self, player, dmg, dodge):
+ pass
+
+ def dispute(self, player, attrName):
+ pass | |
3b467abc665a1807d8a1adbba1be78d40f77b4ce | tests/unit/dataactcore/factories/job.py | tests/unit/dataactcore/factories/job.py | import factory
from factory import fuzzy
from datetime import date, datetime, timezone
from dataactcore.models import jobModels
class SubmissionFactory(factory.Factory):
class Meta:
model = jobModels.Submission
submission_id = None
datetime_utc = fuzzy.FuzzyDateTime(
datetime(2010, 1, 1... | Add factory for Submission model | Add factory for Submission model
| Python | cc0-1.0 | chambers-brian/SIG_Digital-Strategy_SI_ODP_Backend,fedspendingtransparency/data-act-broker-backend,fedspendingtransparency/data-act-broker-backend,chambers-brian/SIG_Digital-Strategy_SI_ODP_Backend | ---
+++
@@ -0,0 +1,25 @@
+import factory
+from factory import fuzzy
+
+from datetime import date, datetime, timezone
+
+from dataactcore.models import jobModels
+
+
+class SubmissionFactory(factory.Factory):
+ class Meta:
+ model = jobModels.Submission
+
+ submission_id = None
+ datetime_utc = fuzzy.F... | |
ffb1a660401d12eccb31787becc9c7ca45edaedc | algorithms/distances/euclidean_distance.py | algorithms/distances/euclidean_distance.py | from math import sqrt
from .distance_abstract import DistanceAbstract
class EuclideanDistance(DistanceAbstract):
def measure(cls, list1, list2):
distance = 0
min_len = min(len(list1), len(list2))
for i in range(0, min_len):
distance += sqrt(abs(list1[i]**2 - list2[i]**2))
... | Add support for Euclidean distance | Add support for Euclidean distance
| Python | mit | theowni/Keyboard-Typing-User-Recognition | ---
+++
@@ -0,0 +1,13 @@
+from math import sqrt
+from .distance_abstract import DistanceAbstract
+
+
+class EuclideanDistance(DistanceAbstract):
+ def measure(cls, list1, list2):
+ distance = 0
+ min_len = min(len(list1), len(list2))
+
+ for i in range(0, min_len):
+ distance += sqr... | |
ef7406a0ba6d87311c55bd0422bb2a411a51043a | vectorExtractorWithTuples.py | vectorExtractorWithTuples.py | import string
import sklearn
import numpy as np
from titleParse import *
import os
from sklearn import svm
import re
from featureHelpers.py import *
#testStringList = getTitles("test_data" + os.sep + "merged.txt")
#testStringList = getTitles("test.txt")
"""This is a function designed to extract an attribute vector out... | Revert "Got rid of tuples" | Revert "Got rid of tuples"
This reverts commit 958ab35bcf408502f1347db5720241c489de8260.
| Python | apache-2.0 | bharadwajramachandran/TartanRoof | ---
+++
@@ -0,0 +1,66 @@
+import string
+import sklearn
+import numpy as np
+from titleParse import *
+import os
+from sklearn import svm
+import re
+from featureHelpers.py import *
+
+#testStringList = getTitles("test_data" + os.sep + "merged.txt")
+#testStringList = getTitles("test.txt")
+"""This is a function desi... | |
09a2975b8940a2726620ffff95950ecdad3ca884 | pykmer/codec16.py | pykmer/codec16.py |
def encode(x):
"encode an integer using a 15-bit+continuation-bit encodeing"
r = []
while True:
r.append(x & 32767)
x >>= 15
if x == 0:
break
r = r[::-1]
n = len(r) - 1
i = 0
while i < n:
r[i] |= 32768
i += 1
return r
def encodeInto(x... | Add a 15/1 bit codec. | Add a 15/1 bit codec.
| Python | apache-2.0 | drtconway/pykmer | ---
+++
@@ -0,0 +1,47 @@
+
+def encode(x):
+ "encode an integer using a 15-bit+continuation-bit encodeing"
+ r = []
+ while True:
+ r.append(x & 32767)
+ x >>= 15
+ if x == 0:
+ break
+ r = r[::-1]
+ n = len(r) - 1
+ i = 0
+ while i < n:
+ r[i] |= 32768
+ ... | |
a834d778e4ec72beb26ebc458bfc3975217fcf7b | scripts/mc_rtp_launch_record.py | scripts/mc_rtp_launch_record.py | #!/usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# Copyright 2021 The HERA Collaboration
# Licensed under the 2-clause BSD license.
import numpy as np
from astropy.time import Time
from pyuvdata import UVData
from hera_mc import mc
from hera_mc.rtp import RTPLaunchRecord
ap = mc.get_mc_argument_parser()
... | Add script for adding/updating RTP launch records | Add script for adding/updating RTP launch records
| Python | bsd-2-clause | HERA-Team/hera_mc,HERA-Team/hera_mc | ---
+++
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+# -*- mode: python; coding: utf-8 -*-
+# Copyright 2021 The HERA Collaboration
+# Licensed under the 2-clause BSD license.
+
+import numpy as np
+from astropy.time import Time
+
+from pyuvdata import UVData
+
+from hera_mc import mc
+from hera_mc.rtp import RTPLaunchRe... | |
61bcf2e6c47e0ade839d2712edc0e499d17bb552 | tests/helpers.py | tests/helpers.py | # vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as ... | Add helper module for tests | Add helper module for tests
Currently the module contains a base class for all quilt tests.
| Python | mit | vadmium/python-quilt,bjoernricks/python-quilt | ---
+++
@@ -0,0 +1,46 @@
+# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
+
+# python-quilt - A Python implementation of the quilt patch system
+#
+# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU ... | |
0774aa1c1bf64c39d3f456c6e85fc85403219f7f | examples/multiple_windows.py | examples/multiple_windows.py | import webview
import threading
"""
This example demonstrates how to create and manage multiple windows
"""
def create_new_window():
# Create new window and store its uid
child_window = webview.create_window("Window #2", width=800, height=400)
# Load content into both windows
webview.load_html('<h1>M... | Add a simple multiple-window example | [All] Add a simple multiple-window example
| Python | bsd-3-clause | shivaprsdv/pywebview,r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview,shivaprsdv/pywebview,r0x0r/pywebview,shivaprsdv/pywebview,shivaprsdv/pywebview,r0x0r/pywebview | ---
+++
@@ -0,0 +1,22 @@
+import webview
+import threading
+
+"""
+This example demonstrates how to create and manage multiple windows
+"""
+
+def create_new_window():
+ # Create new window and store its uid
+ child_window = webview.create_window("Window #2", width=800, height=400)
+
+ # Load content into bo... | |
d58505e13edce70a34d4058dce4387d9ca43c911 | bench/pact-suite/uts/uts_calc.py | bench/pact-suite/uts/uts_calc.py |
# Estimate number of nodes for geometric uts with linear shape
b_0 = 4.0
gen_mx = 22
# level is from 0 onwards
def level_nodes(level):
branch_factors = [ b_0 * ( 1.0 - i / float(gen_mx)) for i in range(level + 1) ]
return reduce(lambda x, y: x*y, branch_factors)
print "b_0: %f gen_mx %d" % (b_0, gen_mx)
total ... | Add calculator for uts tree size | Add calculator for uts tree size
git-svn-id: 0c5512015aa96f7d3f5c3ad598bd98edc52008b1@12008 dc4e9af1-7f46-4ead-bba6-71afc04862de
| Python | apache-2.0 | swift-lang/swift-t,blue42u/swift-t,JohnPJenkins/swift-t,JohnPJenkins/swift-t,blue42u/swift-t,blue42u/swift-t,swift-lang/swift-t,JohnPJenkins/swift-t,swift-lang/swift-t,swift-lang/swift-t,JohnPJenkins/swift-t,JohnPJenkins/swift-t,basheersubei/swift-t,basheersubei/swift-t,basheersubei/swift-t,swift-lang/swift-t,JohnPJenk... | ---
+++
@@ -0,0 +1,21 @@
+
+# Estimate number of nodes for geometric uts with linear shape
+
+b_0 = 4.0
+gen_mx = 22
+
+# level is from 0 onwards
+def level_nodes(level):
+ branch_factors = [ b_0 * ( 1.0 - i / float(gen_mx)) for i in range(level + 1) ]
+ return reduce(lambda x, y: x*y, branch_factors)
+
+print "b_0... | |
d4443b05fbd48ca89d03942ef30bed1769948366 | contrib_bots/bots/thesaurus/test_thesaurus.py | contrib_bots/bots/thesaurus/test_thesaurus.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
our_dir = os.path.dirname(os.path.abspath(__file__))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..')
from bots... | Add tests for thesaurus bot in contrib_bots. | testsuite: Add tests for thesaurus bot in contrib_bots.
Add test file 'test_thesaurus.py'.
| Python | apache-2.0 | jackrzhang/zulip,punchagan/zulip,eeshangarg/zulip,brockwhittaker/zulip,zulip/zulip,amanharitsh123/zulip,brainwane/zulip,hackerkid/zulip,mahim97/zulip,showell/zulip,amanharitsh123/zulip,timabbott/zulip,verma-varsha/zulip,shubhamdhama/zulip,vaidap/zulip,shubhamdhama/zulip,mahim97/zulip,zulip/zulip,mahim97/zulip,dhcrzf/zu... | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+
+from __future__ import absolute_import
+from __future__ import print_function
+
+import os
+import sys
+
+our_dir = os.path.dirname(os.path.abspath(__file__))
+# For dev setups, we can find the API in the repo itself.
+if os.path.exists(os.path.join(our_dir, '..')):
... | |
25c215df5550e34de21bfde7416ed43286d70ef2 | core/migrations/0049_providerconfiguration.py | core/migrations/0049_providerconfiguration.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def create_provider_configuration(apps, schema_editor):
Provider = apps.get_model("core", "Provider")
ProviderConfiguration = apps.get_model("core", "ProviderConfiguration")
providers = Provider.object... | Add 0049 - ProviderConfiguration migration+RunPython | Add 0049 - ProviderConfiguration migration+RunPython
| Python | apache-2.0 | CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend | ---
+++
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+def create_provider_configuration(apps, schema_editor):
+ Provider = apps.get_model("core", "Provider")
+ ProviderConfiguration = apps.get_model("core", "ProviderConfiguratio... | |
387873ef2a953f89d7b98cade3a87b1339ff9ca6 | scripts/external_test_allocation.py | scripts/external_test_allocation.py | #!/usr/bin/env python
from django import setup
setup()
from service.monitoring import get_allocation_result_for
from core.models import Identity, Instance, AtmosphereUser
from django.utils.timezone import timedelta, datetime
import pytz, sys
from dateutil.parser import parse
if len(sys.argv) < 3:
print "Invalid # ... | Add a script to call for allocation result externally | Add a script to call for allocation result externally
| Python | apache-2.0 | CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend | ---
+++
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+from django import setup
+setup()
+from service.monitoring import get_allocation_result_for
+from core.models import Identity, Instance, AtmosphereUser
+from django.utils.timezone import timedelta, datetime
+import pytz, sys
+from dateutil.parser import parse
+
+if len... | |
45d7a6ed3a68793585b24474753cec2a01fc6c03 | Largest_Palindrome_Product.py | Largest_Palindrome_Product.py | # Find the largest palindrome made from the product of two n-digit numbers.
# Since the result could be very large, you should return the largest palindrome mod 1337.
# Example:
# Input: 2
# Output: 987
# Explanation: 99 x 91 = 9009, 9009 % 1337 = 987
# Note:
# The range of n is [1,8].
def largestPalindrome(n):
"... | Solve Largest Palindrome Product with brute force (Time Limit Exceeded) | Solve Largest Palindrome Product with brute force (Time Limit Exceeded)
| Python | mit | Kunal57/Python_Algorithms | ---
+++
@@ -0,0 +1,36 @@
+# Find the largest palindrome made from the product of two n-digit numbers.
+
+# Since the result could be very large, you should return the largest palindrome mod 1337.
+
+# Example:
+# Input: 2
+# Output: 987
+# Explanation: 99 x 91 = 9009, 9009 % 1337 = 987
+
+# Note:
+# The range of n is... | |
c5e0fe1845f2f503f59279305c3a41e1d6b70aa8 | localore/people/migrations/0010_auto_20160516_1123.py | localore/people/migrations/0010_auto_20160516_1123.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('people', '0009_auto_20160408_1535'),
]
operations = [
migrations.AlterModelOptions(
name='person',
o... | Add missed migration for 12d09f5. | Add missed migration for 12d09f5.
| Python | mpl-2.0 | ghostwords/localore,ghostwords/localore,ghostwords/localore | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('people', '0009_auto_20160408_1535'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(... | |
d67d5fc6de19f2a1191e7289fcf8b96116eb1cf9 | custom/icds/tests/test_views.py | custom/icds/tests/test_views.py | from __future__ import absolute_import
from django.test import TestCase
from django.test.utils import override_settings
from django.urls import reverse
class TestViews(TestCase):
@override_settings(CUSTOM_LANDING_TEMPLATE='icds/login.html')
def test_custom_login(self):
response = self.client.get(rever... | Test ICDS login doesn't 500 | Test ICDS login doesn't 500
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,11 @@
+from __future__ import absolute_import
+from django.test import TestCase
+from django.test.utils import override_settings
+from django.urls import reverse
+
+
+class TestViews(TestCase):
+ @override_settings(CUSTOM_LANDING_TEMPLATE='icds/login.html')
+ def test_custom_login(self):
+ ... | |
dd2b861cb1576943bb290bede5544eaec146bdbf | som_generationkwh/migrations/0.0.1.2/pre-0001_delete_inactive_investments.py | som_generationkwh/migrations/0.0.1.2/pre-0001_delete_inactive_investments.py | # coding=utf-8
from oopgrade import oopgrade
import netsvc
def migrate(cr,v):
print "somenergia-generationkwh_0.0.1.2: Hem entrat al Migrate"
return
def up(cursor, installed_version):
logger= netsvc.Logger()
print "somenergia-generationkwh_0.0.1.2: Hem entrat al UP"
if not installed_version:
... | Add second migration, it works! | Add second migration, it works!
| Python | agpl-3.0 | Som-Energia/somenergia-generationkwh,Som-Energia/somenergia-generationkwh | ---
+++
@@ -0,0 +1,43 @@
+# coding=utf-8
+from oopgrade import oopgrade
+import netsvc
+
+
+def migrate(cr,v):
+ print "somenergia-generationkwh_0.0.1.2: Hem entrat al Migrate"
+ return
+
+def up(cursor, installed_version):
+ logger= netsvc.Logger()
+ print "somenergia-generationkwh_0.0.1.2: Hem entrat al... | |
d44b79541dae38b8deabaab4e7fe990ce1cbfa95 | opal/tests/test_templatetags_patient_lists.py | opal/tests/test_templatetags_patient_lists.py | """
Unittests for opal.templatetags.patient_lists
"""
from mock import MagicMock
from opal.core.test import OpalTestCase
from opal.tests.test_patient_lists import TestTabbedPatientListGroup, TaggingTestPatientList
from opal.templatetags import patient_lists
class TabbedListGroupTestCase(OpalTestCase):
def test_... | Add tests for patient lists templatetags | Add tests for patient lists templatetags
| Python | agpl-3.0 | khchine5/opal,khchine5/opal,khchine5/opal | ---
+++
@@ -0,0 +1,24 @@
+"""
+Unittests for opal.templatetags.patient_lists
+"""
+from mock import MagicMock
+
+from opal.core.test import OpalTestCase
+
+from opal.tests.test_patient_lists import TestTabbedPatientListGroup, TaggingTestPatientList
+from opal.templatetags import patient_lists
+
+class TabbedListGroup... | |
1a50184437e73b8e14e6cd3a35ff5d5dc0e53fd5 | dna/test/test_DoublePinchHex.py | dna/test/test_DoublePinchHex.py | import components as comp
from model import DnaModel
#for plotting:
from numpy import linspace
import matplotlib.pyplot as plt
def round_down(num, divisor):
return num - (num%divisor)
def round_up(num, divisor):
return num + (num%divisor)
#actual test:
class DoublePinchHexTest(DnaModel):
def run(self):
... | Add a broken test for a Double Pinch Heat Exchanger | Add a broken test for a Double Pinch Heat Exchanger
| Python | bsd-3-clause | mwoc/pydna | ---
+++
@@ -0,0 +1,71 @@
+import components as comp
+from model import DnaModel
+
+#for plotting:
+from numpy import linspace
+import matplotlib.pyplot as plt
+
+def round_down(num, divisor):
+ return num - (num%divisor)
+def round_up(num, divisor):
+ return num + (num%divisor)
+
+#actual test:
+class DoublePin... | |
fd6056cc8b226f2d89ef63cbc03b2b4966d06593 | numba/tests/test_remove_dead.py | numba/tests/test_remove_dead.py | from numba import compiler, typing
from numba.targets import cpu
from numba import types
from numba.targets.registry import cpu_target
from numba import config
from numba.annotations import type_annotations
from numba.ir_utils import copy_propagate, apply_copy_propagate, get_name_var_table, remove_dels, remove_dead
fro... | Add test for dead code removal. | Add test for dead code removal.
| Python | bsd-2-clause | stonebig/numba,stonebig/numba,sklam/numba,cpcloud/numba,jriehl/numba,IntelLabs/numba,jriehl/numba,sklam/numba,gmarkall/numba,gmarkall/numba,numba/numba,sklam/numba,IntelLabs/numba,stonebig/numba,stuartarchibald/numba,IntelLabs/numba,seibert/numba,gmarkall/numba,seibert/numba,cpcloud/numba,stuartarchibald/numba,cpcloud/... | ---
+++
@@ -0,0 +1,67 @@
+from numba import compiler, typing
+from numba.targets import cpu
+from numba import types
+from numba.targets.registry import cpu_target
+from numba import config
+from numba.annotations import type_annotations
+from numba.ir_utils import copy_propagate, apply_copy_propagate, get_name_var_t... | |
31a6433ee74d8d13ba3035a41db8e925de1d2b5d | bin/2000/crosswalk_msa_tract.py | bin/2000/crosswalk_msa_tract.py | """crosswalk_msa_tract.py
Extract the crosswalk between 2000 msa and tracts.
"""
import os
import csv
#
# Import data
#
## MSA to counties crosswalk
# county_to_msa = {county: {msa: [cousub ids]}
county_to_msa = {}
with open('data/2000/crosswalks/msa_county.csv', 'r') as source:
reader = csv.reader(source, delim... | Add script to extract the crosswalk between msas and tracts | Add script to extract the crosswalk between msas and tracts
| Python | bsd-2-clause | scities/2000-us-metro-atlas | ---
+++
@@ -0,0 +1,66 @@
+"""crosswalk_msa_tract.py
+
+Extract the crosswalk between 2000 msa and tracts.
+"""
+import os
+import csv
+
+#
+# Import data
+#
+
+## MSA to counties crosswalk
+# county_to_msa = {county: {msa: [cousub ids]}
+county_to_msa = {}
+with open('data/2000/crosswalks/msa_county.csv', 'r') as sou... | |
0fbea33e99af8fbb30ba508b649ec0e898a6cc98 | examples/work_queue.py | examples/work_queue.py | import threading
import time
from walrus import Walrus
db = Walrus()
def create_consumer_group():
consumer = db.consumer_group('tasks-cg', ['tasks'])
if not db.exists('tasks'):
db.xadd('tasks', {'dummy': ''}, id=b'0-1')
consumer.create()
consumer.set_id('$')
return consumer
def ... | Add work queue example using streams. | Add work queue example using streams.
| Python | mit | coleifer/walrus | ---
+++
@@ -0,0 +1,56 @@
+import threading
+import time
+
+from walrus import Walrus
+
+
+db = Walrus()
+
+def create_consumer_group():
+ consumer = db.consumer_group('tasks-cg', ['tasks'])
+ if not db.exists('tasks'):
+ db.xadd('tasks', {'dummy': ''}, id=b'0-1')
+ consumer.create()
+ consu... | |
99340e34e219101ad21acdff22665a3fdbf5a64b | gravity/migrations/0003_ispindelconfiguration_temperature_correction.py | gravity/migrations/0003_ispindelconfiguration_temperature_correction.py | # Generated by Django 3.0.11 on 2020-11-27 19:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gravity', '0002_brewfather_updates'),
]
operations = [
migrations.AddField(
model_name='ispindelconfiguration',
nam... | Add migration for iSpindel temperature correction | Add migration for iSpindel temperature correction
| Python | mit | thorrak/fermentrack,thorrak/fermentrack,thorrak/fermentrack,thorrak/fermentrack,thorrak/fermentrack | ---
+++
@@ -0,0 +1,18 @@
+# Generated by Django 3.0.11 on 2020-11-27 19:22
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('gravity', '0002_brewfather_updates'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name... | |
7570120ee325e1b0595b39850dba11e4cce7629d | src/promo/__init__.py | src/promo/__init__.py | from contextlib import contextmanager
from email.mime.text import MIMEText
from email.utils import formatdate
from cfg import config, parse_end_date
import os
import re
from teammails import base_path, get_template, smtp_session
@contextmanager
def address_iterator(filename):
if not os.path.isfile(filename):
... | Add code to send promotional mails | Add code to send promotional mails
| Python | bsd-3-clause | janLo/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system | ---
+++
@@ -0,0 +1,63 @@
+from contextlib import contextmanager
+
+from email.mime.text import MIMEText
+from email.utils import formatdate
+
+from cfg import config, parse_end_date
+
+import os
+import re
+
+from teammails import base_path, get_template, smtp_session
+
+
+@contextmanager
+def address_iterator(filena... | |
0b8bbb5def7d5f621b26093897b01ac9a14239bf | src/tor/x25519-gen.py | src/tor/x25519-gen.py | #!/usr/bin/env python3
import base64
try:
import nacl.public
except ImportError:
print('PyNaCl is required: "pip install pynacl" or similar')
exit(1)
def key_str(key):
# bytes to base 32
key_bytes = bytes(key)
key_b32 = base64.b32encode(key_bytes)
# strip trailing ====
assert key_b32[-... | Add script for generating x25519 keys | Add script for generating x25519 keys
| Python | unlicense | pastly/python-snippits | ---
+++
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+import base64
+try:
+ import nacl.public
+except ImportError:
+ print('PyNaCl is required: "pip install pynacl" or similar')
+ exit(1)
+
+
+def key_str(key):
+ # bytes to base 32
+ key_bytes = bytes(key)
+ key_b32 = base64.b32encode(key_bytes)
+ #... | |
0135a28e5e4fc1183737e3d5bade231d7330d564 | scripts/run_on_swarming_bots/reboot_bot.py | scripts/run_on_swarming_bots/reboot_bot.py | #!/usr/bin/env python
#
# Copyright 2017 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Reboot a Swarming bot."""
import os
import sys
if sys.platform == 'win32':
os.system('shutdown /r /t 0')
else:
os.system('sudo reboot')
| Add Reboot script for run_on_swarming_bots | Add Reboot script for run_on_swarming_bots
Change-Id: I01c72ef2157660e5d7f3c5d47a9b30fa78054e9f
Reviewed-on: https://skia-review.googlesource.com/135381
Auto-Submit: Ben Wagner <3ef7217be91069877d94f7907ce5479000772cd3@google.com>
Commit-Queue: Kevin Lubick <7cdab2cfab351f23814786ba39716e90eed69047@google.com>
Reviewe... | Python | bsd-3-clause | google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+#
+# Copyright 2017 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+"""Reboot a Swarming bot."""
+
+
+import os
+import sys
+
+
+if sys.platform == 'win32':
+ os.system('shutdown /r /t 0')
+... | |
372fdf61b30041862383b16d2c0ca4ed84d530e4 | troposphere/s3.py | troposphere/s3.py | # Copyright (c) 2013, Bob Van Zant <bob@veznat.com>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty, Tags
class WebsiteConfiguration(AWSProperty):
props = {
'IndexDocument': (basestring, False),
'ErrorDocument': (basestring, False),
}
class... | Support for creating S3 buckets. | Support for creating S3 buckets.
| Python | bsd-2-clause | samcrang/troposphere,alonsodomin/troposphere,johnctitus/troposphere,WeAreCloudar/troposphere,mhahn/troposphere,wangqiang8511/troposphere,ikben/troposphere,7digital/troposphere,LouTheBrew/troposphere,mannytoledo/troposphere,cloudtools/troposphere,DualSpark/troposphere,Yipit/troposphere,inetCatapult/troposphere,dmm92/tro... | ---
+++
@@ -0,0 +1,42 @@
+# Copyright (c) 2013, Bob Van Zant <bob@veznat.com>
+# All rights reserved.
+#
+# See LICENSE file for full license.
+
+from . import AWSObject, AWSProperty, Tags
+
+
+class WebsiteConfiguration(AWSProperty):
+ props = {
+ 'IndexDocument': (basestring, False),
+ 'ErrorDocume... | |
5b13240d65f70f6418ca92b7cff81bc290e26fef | demo/ipython_notebook_config.py | demo/ipython_notebook_config.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Configuration file for ipython-notebook.
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
# Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded-
# For headerssent by the upstream reverse proxy... | Configure the IPython notebook user settings | Configure the IPython notebook user settings
| Python | bsd-3-clause | Zsailer/docker-jupyter-teaching,odewahn/docker-demo-images,danielballan/docker-demo-images,willjharmer/docker-demo-images,tanyaschlusser/docker-demo-images,pelucid/docker-demo-images,Zsailer/docker-demo-images,rgbkrk/docker-demo-images,vanceb/docker-demo-images,parente/docker-demo-images,philipz/docker-demo-images,phil... | ---
+++
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Configuration file for ipython-notebook.
+
+c = get_config()
+c.NotebookApp.ip = '*'
+c.NotebookApp.open_browser = False
+c.NotebookApp.port = 8888
+
+# Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded-
+# For he... | |
b29fa5c96fa5e0fdd2117164baace9ac8492867d | testmodel/webapp/selenium/test/log-in-test.py | testmodel/webapp/selenium/test/log-in-test.py | import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class LoginTestCase(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.addCleanup(self.browser.quit)
self.browser.get('http://localhost:8080/intermine-demo/begin.do')
... | Test ability to log in | Test ability to log in
| Python | lgpl-2.1 | tomck/intermine,elsiklab/intermine,Arabidopsis-Information-Portal/intermine,Arabidopsis-Information-Portal/intermine,joshkh/intermine,joshkh/intermine,justincc/intermine,joshkh/intermine,elsiklab/intermine,zebrafishmine/intermine,elsiklab/intermine,kimrutherford/intermine,elsiklab/intermine,Arabidopsis-Information-Port... | ---
+++
@@ -0,0 +1,30 @@
+import unittest
+from selenium import webdriver
+from selenium.webdriver.common.keys import Keys
+
+class LoginTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.browser = webdriver.Firefox()
+ self.addCleanup(self.browser.quit)
+ self.browser.get('http://localh... | |
13f06e971967106fba98aace57b7ffa0b07201eb | comrade/functional.py | comrade/functional.py | def lazy(func):
def lazy_func(self, *args, **kwargs):
cached_attribute = '_cached_%s' % func.__name__
if not hasattr(self, cached_attribute):
setattr(self, cached_attribute, func(self, *args, **kwargs))
return getattr(self, cached_attribute)
return lazy_func
| Add a @lazy decorator for simple lazy methods. | Add a @lazy decorator for simple lazy methods.
| Python | mit | bueda/django-comrade | ---
+++
@@ -0,0 +1,7 @@
+def lazy(func):
+ def lazy_func(self, *args, **kwargs):
+ cached_attribute = '_cached_%s' % func.__name__
+ if not hasattr(self, cached_attribute):
+ setattr(self, cached_attribute, func(self, *args, **kwargs))
+ return getattr(self, cached_attribute)
+ r... | |
23a4e55ba85dde4447d7768e8e4ffd7f1efcc385 | cme/modules/laps.py | cme/modules/laps.py | from impacket.ldap import ldapasn1 as ldapasn1_impacket
class CMEModule:
'''
Module by technobro refactored by @mpgn (now compatible with LDAP protocol + filter by computer)
Initial module:
@T3KX: https://github.com/T3KX/Crackmapexec-LAPS
Credit: @n00py1
Reference: https://www.n00... | Add LAPS module thx to @T3KX | Add LAPS module thx to @T3KX
| Python | bsd-2-clause | byt3bl33d3r/CrackMapExec | ---
+++
@@ -0,0 +1,48 @@
+from impacket.ldap import ldapasn1 as ldapasn1_impacket
+
+class CMEModule:
+ '''
+ Module by technobro refactored by @mpgn (now compatible with LDAP protocol + filter by computer)
+
+ Initial module:
+ @T3KX: https://github.com/T3KX/Crackmapexec-LAPS
+
+ Credit: @n00p... | |
3e0e9702becc5c7a8455b12113eb2341c27a34bd | CDJSVis/filtering/filters/tests/test_charge.py | CDJSVis/filtering/filters/tests/test_charge.py |
"""
Unit tests for the charge filter
"""
import unittest
import numpy as np
from ....state import lattice
from .. import chargeFilter
from .. import base
################################################################################
class TestChargeFilter(unittest.TestCase):
"""
Test charge filter
... | Add a test for the charge filter. | Add a test for the charge filter. | Python | mit | chrisdjscott/Atoman,chrisdjscott/Atoman,chrisdjscott/Atoman,chrisdjscott/Atoman,chrisdjscott/Atoman | ---
+++
@@ -0,0 +1,87 @@
+
+"""
+Unit tests for the charge filter
+
+"""
+import unittest
+
+import numpy as np
+
+from ....state import lattice
+from .. import chargeFilter
+from .. import base
+
+
+################################################################################
+
+class TestChargeFilter(unittest.Te... | |
ded110e2357ea400a64d90822efd43213374cfd4 | fedmsg.d/logging.py | fedmsg.d/logging.py | # Setup fedmsg logging.
# See the following for constraints on this format https://bit.ly/Xn1WDn
bare_format = "[%(asctime)s][%(name)10s %(levelname)7s] %(message)s"
config = dict(
logging=dict(
version=1,
formatters=dict(
bare={
"datefmt": "%Y-%m-%d %H:%M:%S",
... | # Setup fedmsg logging.
# See the following for constraints on this format https://bit.ly/Xn1WDn
bare_format = "[%(asctime)s][%(name)10s %(levelname)7s] %(message)s"
config = dict(
logging=dict(
version=1,
formatters=dict(
bare={
"datefmt": "%Y-%m-%d %H:%M:%S",
... | Add a comma here to help out people who modify this file. | Add a comma here to help out people who modify this file.
See https://bugzilla.redhat.com/show_bug.cgi?id=1184523
| Python | lgpl-2.1 | maxamillion/fedmsg,maxamillion/fedmsg,maxamillion/fedmsg,vivekanand1101/fedmsg,cicku/fedmsg,pombredanne/fedmsg,mathstuf/fedmsg,chaiku/fedmsg,vivekanand1101/fedmsg,pombredanne/fedmsg,cicku/fedmsg,cicku/fedmsg,chaiku/fedmsg,fedora-infra/fedmsg,chaiku/fedmsg,mathstuf/fedmsg,fedora-infra/fedmsg,fedora-infra/fedmsg,vivekana... | ---
+++
@@ -17,7 +17,7 @@
"formatter": "bare",
"level": "INFO",
"stream": "ext://sys.stdout",
- }
+ },
),
loggers=dict(
fedmsg={ |
8b45094e20c69f8a5c9aa9ca74de40763d27b8f2 | test_parallel_vectorize_numpy_2.py | test_parallel_vectorize_numpy_2.py | '''
Test parallel-vectorize with numpy.fromfunc.
Uses the work load from test_parallel_vectorize.
This time we pass a function pointer.
'''
from test_parallel_vectorize import *
import numpy as np
def main():
module = Module.new(__name__)
exe = CExecutor(module)
workdef = Work_D_D()
workfunc = workd... | Add test that uses function pointer. | Add test that uses function pointer.
| Python | bsd-3-clause | llvmpy/llvmpy,llvmpy/llvmpy,llvmpy/llvmpy,llvmpy/llvmpy,llvmpy/llvmpy,llvmpy/llvmpy | ---
+++
@@ -0,0 +1,69 @@
+'''
+Test parallel-vectorize with numpy.fromfunc.
+Uses the work load from test_parallel_vectorize.
+This time we pass a function pointer.
+'''
+
+from test_parallel_vectorize import *
+
+import numpy as np
+
+def main():
+ module = Module.new(__name__)
+ exe = CExecutor(module)
+
+ ... | |
3bc56faeb1d12082b2ceee147c37ae42bd7713ca | tests/test_serialization_format.py | tests/test_serialization_format.py | # Copyright 2019 D-Wave Systems 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 required by applicable law or... | Add one smoketest to str(sampleset) | Add one smoketest to str(sampleset)
| Python | apache-2.0 | oneklc/dimod,oneklc/dimod | ---
+++
@@ -0,0 +1,27 @@
+# Copyright 2019 D-Wave Systems 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
+#
+# ... | |
cd1620bb1b617f8413eafcf93c3da3ac43bfa088 | db_connection_pool.py | db_connection_pool.py | class ConnectionPool():
"""
Usage:
conn_pool = nmi_mysql.ConnectionPool(config)
db = conn_pool.get_connection()
db.query('SELECT 1', [])
conn_pool.return_connection(db)
conn_pool.close()
"""
def __init__(self, conf, max_pool_size=20):
self.conf = conf
... | Add db connection pool example | Add db connection pool example | Python | mit | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | ---
+++
@@ -0,0 +1,45 @@
+class ConnectionPool():
+ """
+ Usage:
+ conn_pool = nmi_mysql.ConnectionPool(config)
+ db = conn_pool.get_connection()
+ db.query('SELECT 1', [])
+ conn_pool.return_connection(db)
+ conn_pool.close()
+ """
+ def __init__(self, conf, max_pool_si... | |
e64df5ab8307c6f6120735816166c6ff8ffeccfc | neural_network/neural_network.py | neural_network/neural_network.py | #!/usr/bin/env python
import math
import numpy as np
def sigmoid(x):
return 1.0 / (1 + np.exp(-x))
def sigmoid_derivate(x):
return x * (1 - x)
def main():
np.random.seed(1)
# [4, 3]
features = np.array([[0, 0, 1], [0, 1, 1], [1, 0, 1], [1, 1, 1]])
# [4, 1]
labels = np.array([[0], [0], [1], [1]])
... | Implement backpropagation algorithm for neural network | Implement backpropagation algorithm for neural network
| Python | mit | tobegit3hub/ml_implementation,erwin00776/copy_ml_implements | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+
+import math
+import numpy as np
+
+
+def sigmoid(x):
+ return 1.0 / (1 + np.exp(-x))
+
+
+def sigmoid_derivate(x):
+ return x * (1 - x)
+
+
+def main():
+ np.random.seed(1)
+
+ # [4, 3]
+ features = np.array([[0, 0, 1], [0, 1, 1], [1, 0, 1], [1, 1, 1]])
+
+ # [... | |
15ec7cf519ce98ddb6dee50de2a2b3c6ace44680 | l10n_br_sale/tests/test_l10n_br_sale_product.py | l10n_br_sale/tests/test_l10n_br_sale_product.py | # @ 2019 Akretion - www.akretion.com.br -
# Magno Costa <magno.costa@akretion.com.br>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import odoo.tests.common as common
class TestL10nBRSaleProduct(common.TransactionCase):
def setUp(self):
super(TestL10nBRSaleProduct, self).setUp()
... | Move test from l10n_br_sale_product to l10n_br_sale. | [12.0][MIG][WIP] Move test from l10n_br_sale_product to l10n_br_sale.
| Python | agpl-3.0 | OCA/l10n-brazil,OCA/l10n-brazil,OCA/l10n-brazil,akretion/l10n-brazil,akretion/l10n-brazil,akretion/l10n-brazil | ---
+++
@@ -0,0 +1,67 @@
+# @ 2019 Akretion - www.akretion.com.br -
+# Magno Costa <magno.costa@akretion.com.br>
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+
+import odoo.tests.common as common
+
+
+class TestL10nBRSaleProduct(common.TransactionCase):
+ def setUp(self):
+ super(... | |
4000af5d4ca53683b4577d7394c923c22f79ca52 | simulate_loads.py | simulate_loads.py | import random
import itertools as it
from sklearn.externals import joblib
def simulate_loads(nfrag, ngt, q):
loads = [1] * nfrag
active = set(range(nfrag))
for k in range(1, len(loads)):
i0, i1 = random.sample(active, k=2)
active.remove(i0)
active.remove(i1)
active.add(len(l... | Add function to simulate load of CSR merge matrix | Add function to simulate load of CSR merge matrix
| Python | bsd-3-clause | jni/gala-scripts | ---
+++
@@ -0,0 +1,29 @@
+import random
+import itertools as it
+from sklearn.externals import joblib
+
+def simulate_loads(nfrag, ngt, q):
+ loads = [1] * nfrag
+ active = set(range(nfrag))
+ for k in range(1, len(loads)):
+ i0, i1 = random.sample(active, k=2)
+ active.remove(i0)
+ acti... | |
4a4cb336839d42cee872e52399e17249b948492a | rackattack/common/globallock.py | rackattack/common/globallock.py | import threading
import contextlib
import time
import traceback
import logging
_lock = threading.Lock()
@contextlib.contextmanager
def lock():
before = time.time()
with _lock:
acquired = time.time()
took = acquired - before
if took > 0.1:
logging.error(
"A... | import threading
import contextlib
import time
import traceback
import logging
_lock = threading.Lock()
def prettyStack():
return "\n".join([line.strip() for line in traceback.format_stack()])
@contextlib.contextmanager
def lock():
before = time.time()
with _lock:
acquired = time.time()
... | Print the stack info more clearly, when holding the global lock for too long | Print the stack info more clearly, when holding the global lock for too long
| Python | apache-2.0 | Stratoscale/rackattack-virtual,eliran-stratoscale/rackattack-virtual,Stratoscale/rackattack-virtual,eliran-stratoscale/rackattack-virtual | ---
+++
@@ -6,6 +6,10 @@
_lock = threading.Lock()
+
+
+def prettyStack():
+ return "\n".join([line.strip() for line in traceback.format_stack()])
@contextlib.contextmanager
@@ -17,14 +21,14 @@
if took > 0.1:
logging.error(
"Acquiring the global lock took more than 0... |
217b5fd119a835ee0c3f2a359fe814727ef1c954 | misc/system_list.py | misc/system_list.py | import lxml
import json
import urllib
from lxml import etree
tmpresponce = urllib.urlopen("https://api.eveonline.com/map/Sovereignty.xml.aspx")
resString = tmpresponce.read()
#print type(resString)
parser = etree.XMLParser(remove_blank_text=True)
responce = etree.XML(resString, parser)
print "starting"
systemID... | Load the Sovereignty xml and process | Load the Sovereignty xml and process
Compose a list of SystemID to SystemName mappings
| Python | apache-2.0 | Funi1234/InternetSpaceships,Funi1234/InternetSpaceships,Funi1234/InternetSpaceships | ---
+++
@@ -0,0 +1,31 @@
+import lxml
+import json
+import urllib
+from lxml import etree
+
+tmpresponce = urllib.urlopen("https://api.eveonline.com/map/Sovereignty.xml.aspx")
+
+resString = tmpresponce.read()
+
+#print type(resString)
+
+
+parser = etree.XMLParser(remove_blank_text=True)
+
+responce = etree.XML(resS... | |
0493098758f1c500a76852e9b032d2c867829ba8 | src/ggrc/migrations/versions/20150326190126_16883afbc18b_update_status_column_to_draft.py | src/ggrc/migrations/versions/20150326190126_16883afbc18b_update_status_column_to_draft.py |
"""Update status column to draft
Revision ID: 16883afbc18b
Revises: 56bda17c92ee
Create Date: 2015-03-26 19:01:26.702662
"""
# revision identifiers, used by Alembic.
revision = '16883afbc18b'
down_revision = '56bda17c92ee'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
from... | Update object status to Draft when null, CORE-1519 | Update object status to Draft when null, CORE-1519
| Python | apache-2.0 | AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,josthkko/ggrc-core,NejcZupec/ggrc-core,hyperNURb/ggrc-core,kr41/ggrc-core,vladan-m/ggrc-core,josthkko/ggrc-core,uskudnik/ggrc-core,vladan-m/ggrc-core,hasanalom/ggrc-core,jmakov/ggrc-core,andrei-karalionak/ggrc-core,VinnieJohns/ggrc-core,j0gurt/ggrc-core,h... | ---
+++
@@ -0,0 +1,32 @@
+
+"""Update status column to draft
+
+Revision ID: 16883afbc18b
+Revises: 56bda17c92ee
+Create Date: 2015-03-26 19:01:26.702662
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '16883afbc18b'
+down_revision = '56bda17c92ee'
+
+from alembic import op
+import sqlalchemy as sa
+fr... | |
a821717103f8b469b71cee4f60fce50dd792cb36 | InvenTree/stock/migrations/0071_auto_20211205_1733.py | InvenTree/stock/migrations/0071_auto_20211205_1733.py | # Generated by Django 3.2.5 on 2021-12-05 06:33
from django.db import migrations
import logging
logger = logging.getLogger('inventree')
def delete_scheduled(apps, schema_editor):
"""
Delete all stock items which are marked as 'scheduled_for_deletion'.
The issue that this field was addressing has now ... | Add a data migration which deletes any stock items which have been scheduled for deletion. | Add a data migration which deletes any stock items which have been scheduled for deletion.
Also deletes any instance of the "delete_old_stock_items" worker task
| Python | mit | SchrodingersGat/InvenTree,inventree/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,inventree/InvenTree | ---
+++
@@ -0,0 +1,47 @@
+# Generated by Django 3.2.5 on 2021-12-05 06:33
+
+from django.db import migrations
+
+import logging
+
+
+logger = logging.getLogger('inventree')
+
+
+def delete_scheduled(apps, schema_editor):
+ """
+ Delete all stock items which are marked as 'scheduled_for_deletion'.
+
+ The iss... | |
2de2a7fc80df710e308846ffde8aa4546e832394 | chrome/PRESUBMIT.py | chrome/PRESUBMIT.py | # Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Makes sure that the chrome/ code is cpplint clean."""
INCLUDE_CPP_FILES_ONLY = (
r'.*\.cc$', r'.*\.h$'
)
EXCLUDE = (
# Objective C confuses ever... | Call the new presubmit checks from chrome/ code, with a blacklist. | Call the new presubmit checks from chrome/ code, with a blacklist.
Review URL: http://codereview.chromium.org/400014
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@32190 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | yitian134/chromium,adobe/chromium,ropik/chromium,adobe/chromium,adobe/chromium,ropik/chromium,Crystalnix/house-of-life-chromium,yitian134/chromium,yitian134/chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,yitian134/chromium,Crystalnix/house-of-life-chromium,gavinp/chromium,yitian134/chromium,adobe/chromium,C... | ---
+++
@@ -0,0 +1,51 @@
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Makes sure that the chrome/ code is cpplint clean."""
+
+INCLUDE_CPP_FILES_ONLY = (
+ r'.*\.cc$', r'.*\.h$'
+)
+
+EXC... | |
ed6fa694ea7ce62cdbda89a60cbbaad1409c285b | misc/add_source_header.py | misc/add_source_header.py | #!/usr/bin/env python
import sys
import itertools
import os
import re
import traceback
from optparse import OptionParser
header_path = "source_header.txt"
def debug(s):
sys.stderr.write("[DEBUG] %s\n" % s)
def error(s):
sys.stderr.write("[ERROR] %s\n" % s)
def main():
parser = OptionParser()
(optio... | Add a utility script to add source header | Add a utility script to add source header
| Python | bsd-3-clause | naoyam/physis,naoyam/physis,naoyam/physis,naoyam/physis | ---
+++
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+
+import sys
+import itertools
+import os
+import re
+import traceback
+from optparse import OptionParser
+
+header_path = "source_header.txt"
+
+def debug(s):
+ sys.stderr.write("[DEBUG] %s\n" % s)
+
+def error(s):
+ sys.stderr.write("[ERROR] %s\n" % s)
+
+def m... | |
57e108e2b1680dc5ec26142d43e90207ec1a8a37 | app/common/falcon/error_handlers.py | app/common/falcon/error_handlers.py | from __future__ import unicode_literals, absolute_import, division
import re
import json
from uuid import uuid4
import falcon.responders
from falcon import HTTP_500, HTTP_404, HTTP_405
from app.common.errors import BaseAppError
from app.common.text_utils import to_first_lower
def _handle_app_error(ex, req, res, par... | Add handlers for internal/user errors, not found, method not allowed | Add handlers for internal/user errors, not found, method not allowed
| Python | mit | diyan/falcon_seed | ---
+++
@@ -0,0 +1,75 @@
+from __future__ import unicode_literals, absolute_import, division
+import re
+import json
+from uuid import uuid4
+
+import falcon.responders
+from falcon import HTTP_500, HTTP_404, HTTP_405
+
+from app.common.errors import BaseAppError
+from app.common.text_utils import to_first_lower
+
+
... | |
4718be19fd198ca0a2eaf4582dc283d52f40d42a | scripts/check-used-functions.py | scripts/check-used-functions.py | #!/usr/bin/env python
"""
Check that all the functions defined in the chemfiles-sys crate are
effectivelly used in the chemfiles binding.
"""
import os
ROOT = os.path.dirname(os.path.dirname(__file__))
def functions_list():
functions = []
with open(os.path.join(ROOT, "src", "chemfiles", "ffi.py")) as fd:
... | Add a script to check if all function are wraped to Python | Add a script to check if all function are wraped to Python
| Python | mpl-2.0 | Luthaf/Chemharp-python | ---
+++
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+"""
+Check that all the functions defined in the chemfiles-sys crate are
+effectivelly used in the chemfiles binding.
+"""
+import os
+
+ROOT = os.path.dirname(os.path.dirname(__file__))
+
+
+def functions_list():
+ functions = []
+ with open(os.path.join(ROOT, "... | |
77e489734f0206ba454c7b855615451b7cf021e1 | djangae/blobstore_service.py | djangae/blobstore_service.py | import os
import threading
import logging
blobstore_service = None
server = None
def start_blobstore_service():
"""
When the blobstore files API was deprecated, the blobstore storage was switched
to use a POST request to the upload handler when storing files uploaded via Django.
Unfortu... | import os
import threading
import logging
blobstore_service = None
server = None
def start_blobstore_service():
"""
When the blobstore files API was deprecated, the blobstore storage was switched
to use a POST request to the upload handler when storing files uploaded via Django.
Unfortu... | Make the blobstore service wsgi handler only serve our upload handler view | Make the blobstore service wsgi handler only serve our upload handler view
| Python | bsd-3-clause | potatolondon/djangae,leekchan/djangae,armirusco/djangae,armirusco/djangae,chargrizzle/djangae,chargrizzle/djangae,asendecka/djangae,jscissr/djangae,grzes/djangae,jscissr/djangae,kirberich/djangae,trik/djangae,chargrizzle/djangae,wangjun/djangae,wangjun/djangae,asendecka/djangae,asendecka/djangae,kirberich/djangae,SiPig... | ---
+++
@@ -20,12 +20,25 @@
global blobstore_service
global server
- from wsgiref.simple_server import make_server, demo_app
+ from wsgiref.simple_server import make_server
from google.appengine.tools.devappserver2.blob_upload import Application
+
+ from djangae.views import internalupload
+... |
61fe7343a7792d388edb074a0c8e4382e2d8adc1 | color_transformations_skimage.py | color_transformations_skimage.py | import numpy as np
import matplotlib.colors as mcolors
from skimage.color import rgb2lab as rgb2lab_skimage
from skimage.color import lab2rgb as lab2rgb_skimage
class RGBRangeError(Exception):
pass
def rgb2lab(rgb):
rgb = np.asarray(rgb).reshape(1, 1, 3)
lab = rgb2lab_skimage(rgb).reshape(3)
return ... | Use color transformation functions from scikit-image for now, even though it is a bit slower (there seems to be a bug somewhere in my manual implementation). | Use color transformation functions from scikit-image for now, even though it is a bit slower (there seems to be a bug somewhere in my manual implementation).
| Python | mit | maxalbert/colormap-selector | ---
+++
@@ -0,0 +1,57 @@
+import numpy as np
+import matplotlib.colors as mcolors
+from skimage.color import rgb2lab as rgb2lab_skimage
+from skimage.color import lab2rgb as lab2rgb_skimage
+
+
+class RGBRangeError(Exception):
+ pass
+
+
+def rgb2lab(rgb):
+ rgb = np.asarray(rgb).reshape(1, 1, 3)
+ lab = rgb... | |
e7b78b3de38faed02ed2168cd6b8f1cae2cbf575 | src/core/migrations/0073_auto_20220630_1608.py | src/core/migrations/0073_auto_20220630_1608.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2022-06-30 14:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0072_auto_20220623_1028'),
]
operations = [
migrations.AlterField(... | Add migration for new `max_length` of field `username`. | Add migration for new `max_length` of field `username`.
| Python | agpl-3.0 | BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.29 on 2022-06-30 14:08
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('core', '0072_auto_20220623_1028'),
+ ]
+
+ oper... | |
0ee87c220610b2e27330af7df61ae740a909405d | regparser/commands/proposal_pipeline.py | regparser/commands/proposal_pipeline.py | import click
from regparser.commands.annual_editions import annual_editions
from regparser.commands.current_version import current_version
from regparser.commands.diffs import diffs
from regparser.commands.fill_with_rules import fill_with_rules
from regparser.commands.import_notice import import_notice, parse_notice
f... | Add an analog to `pipeline` to deal with proposals | Add an analog to `pipeline` to deal with proposals
Some of the underlying commands aren't using dependencies properly, so there's
significant rebuilding every run. That said, it works!
| Python | cc0-1.0 | tadhg-ohiggins/regulations-parser,eregs/regulations-parser,eregs/regulations-parser,tadhg-ohiggins/regulations-parser | ---
+++
@@ -0,0 +1,52 @@
+import click
+
+from regparser.commands.annual_editions import annual_editions
+from regparser.commands.current_version import current_version
+from regparser.commands.diffs import diffs
+from regparser.commands.fill_with_rules import fill_with_rules
+from regparser.commands.import_notice im... | |
9ec49fe0d699e19d9a325b8e73bff4d7a75b8de4 | studies/migrations/0037_response_date_created.py | studies/migrations/0037_response_date_created.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-11-07 22:28
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('studies', '0036_add_scheduled_jobs'),
]
operations = [... | Add migration to add date_created field to response. | Add migration to add date_created field to response.
| Python | apache-2.0 | CenterForOpenScience/lookit-api,CenterForOpenScience/lookit-api,CenterForOpenScience/lookit-api | ---
+++
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.2 on 2017-11-07 22:28
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('studies', '0036_add_sche... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.