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 |
|---|---|---|---|---|---|---|---|---|---|---|
0d64439bf587bad91d4ec622ef936c1d1fa19352 | accelerator/migrations/0054_update_eventbrite_organizer_id_field.py | accelerator/migrations/0054_update_eventbrite_organizer_id_field.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accelerator', '0053_add_eventbrite_organization_id_field'),
]
operations = [
migrations.RenameField(
model_name=... | Update the field to eventbrite_organizer_id | Update the field to eventbrite_organizer_id
| Python | mit | masschallenge/django-accelerator,masschallenge/django-accelerator | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('accelerator', '0053_add_eventbrite_organization_id_field'),
+ ]
+
+ operations = [
+ migrat... | |
7b7ae3bd3ea80af90238edbcec8e6377b30b9d35 | supriya/tools/nonrealtimetools/test/test_diff.py | supriya/tools/nonrealtimetools/test/test_diff.py |
def p2c_to_c2p(p2c):
c2p = {}
nodes_needing_parents = list(p2c)
for parent, children in p2c.items():
if not children:
continue
for child in children:
c2p[child] = parent
nodes_needing_parents.remove(child)
assert len(nodes_needing_parents) == 1
c... | Add sketch for tree-diff test. | Add sketch for tree-diff test.
| Python | mit | josiah-wolf-oberholtzer/supriya,Pulgama/supriya,Pulgama/supriya,Pulgama/supriya,Pulgama/supriya | ---
+++
@@ -0,0 +1,55 @@
+
+
+def p2c_to_c2p(p2c):
+ c2p = {}
+ nodes_needing_parents = list(p2c)
+ for parent, children in p2c.items():
+ if not children:
+ continue
+ for child in children:
+ c2p[child] = parent
+ nodes_needing_parents.remove(child)
+ asser... | |
7106069d4dc6dd9a55634da419d4c270c43f0849 | zerver/migrations/0304_remove_default_status_of_default_private_streams.py | zerver/migrations/0304_remove_default_status_of_default_private_streams.py | # Generated by Django 2.2.14 on 2020-08-10 20:21
from django.db import migrations
from django.db.backends.postgresql.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def remove_default_status_of_default_private_streams(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
... | Add migration to remove default status of private streams. | migration: Add migration to remove default status of private streams.
This commit adds migration which removes default status of exisitng
default private streams, i.e. private stream exists but they are no
longer default.
| Python | apache-2.0 | eeshangarg/zulip,andersk/zulip,showell/zulip,rht/zulip,rht/zulip,zulip/zulip,hackerkid/zulip,showell/zulip,hackerkid/zulip,andersk/zulip,zulip/zulip,zulip/zulip,eeshangarg/zulip,andersk/zulip,zulip/zulip,kou/zulip,andersk/zulip,rht/zulip,rht/zulip,rht/zulip,eeshangarg/zulip,punchagan/zulip,showell/zulip,zulip/zulip,pun... | ---
+++
@@ -0,0 +1,22 @@
+# Generated by Django 2.2.14 on 2020-08-10 20:21
+
+from django.db import migrations
+from django.db.backends.postgresql.schema import DatabaseSchemaEditor
+from django.db.migrations.state import StateApps
+
+
+def remove_default_status_of_default_private_streams(apps: StateApps, schema_edit... | |
3d6324080e112857e2cc8fab6a9c0c168ec0ab1f | tests/chainer_tests/functions_tests/pooling_tests/test_pooling_nd_kernel.py | tests/chainer_tests/functions_tests/pooling_tests/test_pooling_nd_kernel.py | import unittest
import mock
import chainer
from chainer import testing
from chainer.testing import attr
from chainer.functions.pooling import pooling_nd_kernel
@testing.parameterize(*testing.product({
'ndim': [2, 3, 4],
}))
@attr.gpu
class TestPoolingNDKernelMemo(unittest.TestCase):
def setUp(self):
... | Add test for memoization in N-dimensional pooling kernel generator. | Add test for memoization in N-dimensional pooling kernel generator.
| Python | mit | hvy/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,wkentaro/chainer,rezoo/chainer,jnishi/chainer,kashif/chainer,jnishi/chainer,ronekko/chainer,okuta/chainer,chainer/chainer,wkentaro/chainer,ktnyt/chainer,okuta/chainer,niboshi/chainer,chainer/chainer,cupy/cupy,jnishi/chainer,niboshi/chainer,okuta/chainer,nibosh... | ---
+++
@@ -0,0 +1,39 @@
+import unittest
+
+import mock
+
+import chainer
+from chainer import testing
+from chainer.testing import attr
+from chainer.functions.pooling import pooling_nd_kernel
+
+
+@testing.parameterize(*testing.product({
+ 'ndim': [2, 3, 4],
+}))
+@attr.gpu
+class TestPoolingNDKernelMemo(unitte... | |
f3a22d8f615710d7f62704dd9769542bad96fecb | apps/profile/management/commands/send_notification.py | apps/profile/management/commands/send_notification.py | from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from optparse import make_option
import datetime
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option("-u", "--username", dest="username", nargs=1, help="Specify user id or username"... | Add a command to send mail | Add a command to send mail
| Python | mit | bruceyou/NewsBlur,bruceyou/NewsBlur,bruceyou/NewsBlur,bruceyou/NewsBlur,bruceyou/NewsBlur,bruceyou/NewsBlur,bruceyou/NewsBlur,bruceyou/NewsBlur,bruceyou/NewsBlur | ---
+++
@@ -0,0 +1,31 @@
+from django.core.management.base import BaseCommand
+from django.contrib.auth.models import User
+from optparse import make_option
+import datetime
+
+class Command(BaseCommand):
+ option_list = BaseCommand.option_list + (
+ make_option("-u", "--username", dest="username", nargs=1,... | |
60b01109b2504e990b30a70f6cba25dd9d440626 | CFC_DataCollector/tests/recommenderTests/TestNewPipeline.py | CFC_DataCollector/tests/recommenderTests/TestNewPipeline.py | import unittest
import json
import logging
import numpy as np
from get_database import get_db, get_mode_db, get_section_db
from recommender import pipeline
import sys
import os
logging.basicConfig(level=logging.DEBUG)
class TestPipeline(unittest.TestCase):
def setUp(self):
self.testUserEmails = ["test@example.co... | Add a simple test script that invokes the pipeline | Add a simple test script that invokes the pipeline
So that we can make sure that all the pieces work together.
Modelled on the existing testPipeline code.
Thanks to Gautham (@gaukes)
| Python | bsd-3-clause | sunil07t/e-mission-server,yw374cornell/e-mission-server,e-mission/e-mission-server,yw374cornell/e-mission-server,shankari/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,joshzarrabi/e-mission-server,joshzarrabi/e-mission-server,sunil07t/e-missio... | ---
+++
@@ -0,0 +1,52 @@
+import unittest
+import json
+import logging
+import numpy as np
+from get_database import get_db, get_mode_db, get_section_db
+from recommender import pipeline
+import sys
+import os
+
+logging.basicConfig(level=logging.DEBUG)
+
+class TestPipeline(unittest.TestCase):
+ def setUp(self):
+ ... | |
d0e8a202597d5c28d7dc6efc4762040c83072223 | pombola/core/management/commands/core_find_stale_elasticsearch_documents.py | pombola/core/management/commands/core_find_stale_elasticsearch_documents.py | import sys
from django.core.management.base import BaseCommand, CommandError
from haystack import connections as haystack_connections
from haystack.exceptions import NotHandled
from haystack.query import SearchQuerySet
from haystack.utils.app_loading import get_models, load_apps
def get_all_indexed_models():
ba... | Add a command to help find out-of-sync objects in Elasticsearch | Add a command to help find out-of-sync objects in Elasticsearch
This is to help trying to figure out the problems behind issue #1424.
| Python | agpl-3.0 | geoffkilpin/pombola,geoffkilpin/pombola,geoffkilpin/pombola,mysociety/pombola,geoffkilpin/pombola,mysociety/pombola,mysociety/pombola,geoffkilpin/pombola,mysociety/pombola,geoffkilpin/pombola,mysociety/pombola,mysociety/pombola | ---
+++
@@ -0,0 +1,92 @@
+import sys
+
+from django.core.management.base import BaseCommand, CommandError
+
+from haystack import connections as haystack_connections
+from haystack.exceptions import NotHandled
+from haystack.query import SearchQuerySet
+from haystack.utils.app_loading import get_models, load_apps
+
+... | |
3d603d4d86f1822cf50eaee1818bfee7e5a2fe17 | recipe-server/normandy/recipes/migrations/0042_remove_invalid_signatures.py | recipe-server/normandy/recipes/migrations/0042_remove_invalid_signatures.py | """
Removes signatures, so they can be easily recreated during deployment.
This migration is intended to be used between "eras" of signatures. As
the serialization format of recipes changes, the signatures need to
also change. This could be handled automatically, but it is easier to
deploy if we just remove everything... | Add migration to reset signatures | recipe-server: Add migration to reset signatures
This is because the change to send only required fields in the
/api/v1/recipe/signed/ in f816fbcfc63e4ce56896c0d9e09ff82930f191b9.
| Python | mpl-2.0 | mozilla/normandy,Osmose/normandy,Osmose/normandy,mozilla/normandy,mozilla/normandy,Osmose/normandy,Osmose/normandy,mozilla/normandy | ---
+++
@@ -0,0 +1,40 @@
+"""
+Removes signatures, so they can be easily recreated during deployment.
+
+This migration is intended to be used between "eras" of signatures. As
+the serialization format of recipes changes, the signatures need to
+also change. This could be handled automatically, but it is easier to
+d... | |
0ff4afacf49e75eb9a299c00b5e03ad3da91265c | django_openid_provider/signals.py | django_openid_provider/signals.py | from registration.signals import user_registered
from django.contrib.auth.models import User
def create_openid(sender, user, **kwargs):
user.openid_set.create(openid = user.username, default = True)
user_registered.connect(create_openid, dispatch_uid="authentic.openid_provider")
| Create an openid url for the new user register | [openid-provider] Create an openid url for the new user register
Create an openid url with username of the new user automatically when he
registered.
| Python | agpl-3.0 | BryceLohr/authentic,incuna/authentic,pu239ppy/authentic2,adieu/authentic2,incuna/authentic,BryceLohr/authentic,adieu/authentic2,pu239ppy/authentic2,BryceLohr/authentic,incuna/authentic,incuna/authentic,pu239ppy/authentic2,pu239ppy/authentic2,adieu/authentic2,incuna/authentic,BryceLohr/authentic,adieu/authentic2 | ---
+++
@@ -0,0 +1,7 @@
+from registration.signals import user_registered
+from django.contrib.auth.models import User
+
+def create_openid(sender, user, **kwargs):
+ user.openid_set.create(openid = user.username, default = True)
+
+ user_registered.connect(create_openid, dispatch_uid="authentic.openid_... | |
337e66b111f012f5faac8abc60256e1cf7513847 | mezzanine_sermons/migrations/0002_auto_20150606_1059.py | mezzanine_sermons/migrations/0002_auto_20150606_1059.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mezzanine_sermons', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='sermon',
na... | Add migration to allow sermon_preacher to be blank | Add migration to allow sermon_preacher to be blank
| Python | bsd-2-clause | philipsouthwell/mezzanine-sermons,philipsouthwell/mezzanine-sermons | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('mezzanine_sermons', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ ... | |
a1deee1f63aa2271bc40731dfceb7e7852a9c38a | experimental/sngp/__init__.py | experimental/sngp/__init__.py | # coding=utf-8
# Copyright 2020 The Edward2 Authors.
#
# 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 o... | Add package-level import for SNGP. | Add package-level import for SNGP.
PiperOrigin-RevId: 322276743
| Python | apache-2.0 | google/edward2 | ---
+++
@@ -0,0 +1,22 @@
+# coding=utf-8
+# Copyright 2020 The Edward2 Authors.
+#
+# 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
+#
+... | |
80be0b153aa082fd22d365dc16f6c48b800165cd | pymatgen/symmetry/tests/test_spacegroup.py | pymatgen/symmetry/tests/test_spacegroup.py | #!/usr/bin/env python
'''
Created on Mar 12, 2012
'''
from __future__ import division
__author__="Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Mar 12, 2012"
import unittest
import os
from pymatg... | Add a unittest for spacegroup. Still very basic. | Add a unittest for spacegroup. Still very basic.
Former-commit-id: 515d29a50e2b0abf9889329545a6218ec8dbb707 [formerly ad5f851b7959f7bf09d7cd669d8db126fa962982]
Former-commit-id: 51cd323da532e54c94f8d427ed631c11c9ecfae5 | Python | mit | tallakahath/pymatgen,gpetretto/pymatgen,nisse3000/pymatgen,gpetretto/pymatgen,gpetretto/pymatgen,vorwerkc/pymatgen,Bismarrck/pymatgen,blondegeek/pymatgen,xhqu1981/pymatgen,ndardenne/pymatgen,blondegeek/pymatgen,tallakahath/pymatgen,gVallverdu/pymatgen,montoyjh/pymatgen,tschaume/pymatgen,fraricci/pymatgen,dongsenfo/pyma... | ---
+++
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+'''
+Created on Mar 12, 2012
+'''
+
+from __future__ import division
+
+__author__="Shyue Ping Ong"
+__copyright__ = "Copyright 2012, The Materials Project"
+__version__ = "0.1"
+__maintainer__ = "Shyue Ping Ong"
+__email__ = "shyue@mit.edu"
+__date__ = "Mar 12, 2012... | |
870de29a70255027a97053e089149cc98150c021 | basic-model-import/src/main/python/basic-model.py | basic-model-import/src/main/python/basic-model.py | # -*- coding: utf-8 -*-
import tensorflow as tf
x = tf.placeholder("double")
y = tf.placeholder("double")
z = tf.mul(x, y)
with tf.Session() as sess:
tf.train.write_graph(sess.graph_def, '/tmp/my-model', 'basic.pb', as_text=False) | Add (python) basic model itself | Add (python) basic model itself
| Python | mit | vjuranek/tensorflow-snippets,vjuranek/tensorflow-snippets | ---
+++
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+
+import tensorflow as tf
+
+x = tf.placeholder("double")
+y = tf.placeholder("double")
+z = tf.mul(x, y)
+
+with tf.Session() as sess:
+ tf.train.write_graph(sess.graph_def, '/tmp/my-model', 'basic.pb', as_text=False) | |
5d8541f247275e781d6740caa5f24e5b5395dfc9 | metafunctions/tests/test_imports.py | metafunctions/tests/test_imports.py | import unittest
import random
import importlib
class TestUnit(unittest.TestCase):
def test_api_imports(self):
expected_names = ['node', 'bind_call_state', 'star', 'store', 'recall', 'concurrent',
'mmap', 'locate_error']
random.shuffle(expected_names)
for name in ex... | Add simple test that api functions are importable | Add simple test that api functions are importable
| Python | mit | ForeverWintr/metafunctions | ---
+++
@@ -0,0 +1,11 @@
+import unittest
+import random
+import importlib
+
+class TestUnit(unittest.TestCase):
+ def test_api_imports(self):
+ expected_names = ['node', 'bind_call_state', 'star', 'store', 'recall', 'concurrent',
+ 'mmap', 'locate_error']
+ random.shuffle(ex... | |
fdcb0da2188e22341170d939a1d92b70189ff8df | migrations/versions/0114_another_letter_org.py | migrations/versions/0114_another_letter_org.py | """empty message
Revision ID: 0114_another_letter_org
Revises: 0113_job_created_by_nullable
Create Date: 2017-06-29 12:44:16.815039
"""
# revision identifiers, used by Alembic.
revision = '0114_another_letter_org'
down_revision = '0113_job_created_by_nullable'
from alembic import op
def upgrade():
op.execute(... | Add letter organisation for Companies House | Add letter organisation for Companies House
Depends on:
- [ ] https://github.com/alphagov/notifications-template-preview/pull/37
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,25 @@
+"""empty message
+
+Revision ID: 0114_another_letter_org
+Revises: 0113_job_created_by_nullable
+Create Date: 2017-06-29 12:44:16.815039
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '0114_another_letter_org'
+down_revision = '0113_job_created_by_nullable'
+
+from alembic im... | |
2e6d9f5c0d55e6fa8740679e643c2df14ac82134 | python/pygtk/python_gtk3_pygobject/container_paned.py | python/pygtk/python_gtk3_pygobject/container_paned.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
"""
This is the simplest Python GTK+3 Paned snippet.
See: https://lazka.github.io/pgi-docs/Gtk-3.0/classes/Paned.html
http://learngtk.org/tutorials/python_gtk3_tutorial/html/paned.html
"""
from gi.repositor... | Add a snippet (Python GTK+3). | Add a snippet (Python GTK+3).
| Python | mit | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | ---
+++
@@ -0,0 +1,36 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
+
+"""
+This is the simplest Python GTK+3 Paned snippet.
+
+See: https://lazka.github.io/pgi-docs/Gtk-3.0/classes/Paned.html
+ http://learngtk.org/tutorials/python_gtk3_tutorial/h... | |
22a318b760d8332be8526fb755d2cf1f154874fc | programming/python/installed_packages.py | programming/python/installed_packages.py | # from http://stackoverflow.com/a/23885252
import pip
installed_packages = pip.get_installed_distributions()
installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
for i in installed_packages])
for package in installed_packages_list:
print package
| Add script to show what python modules are installed | Add script to show what python modules are installed
| Python | mit | claremacrae/raspi_code,claremacrae/raspi_code,claremacrae/raspi_code | ---
+++
@@ -0,0 +1,8 @@
+# from http://stackoverflow.com/a/23885252
+
+import pip
+installed_packages = pip.get_installed_distributions()
+installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
+ for i in installed_packages])
+for package in installed_packages_list:
+ print package | |
8d34420d595e7b58220004ecf521cc8cfbc224f1 | selenium_tests/test_share_application.py | selenium_tests/test_share_application.py | # -*- coding: utf-8 -*-
from selenium_tests.UserDriverTest import UserDriverTest
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
class TestShareApplication(UserDriverTest):
def test_share_modal(self):
with self.running_container():
self.open_applicat... | Add tests for the share button | Add tests for the share button
| Python | bsd-3-clause | simphony/simphony-remote,simphony/simphony-remote,simphony/simphony-remote,simphony/simphony-remote | ---
+++
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+from selenium_tests.UserDriverTest import UserDriverTest
+from selenium.webdriver.common.by import By
+from selenium.webdriver.common.keys import Keys
+
+
+class TestShareApplication(UserDriverTest):
+ def test_share_modal(self):
+ with self.running_contain... | |
0d36640d47c30d8b9cd2b2eff1c8ccf1e97c13c5 | subscriptions/management/commands/add_missed_call_service_audio_notification_to_active_subscriptions.py | subscriptions/management/commands/add_missed_call_service_audio_notification_to_active_subscriptions.py | from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand, CommandError
from subscriptions.models import Subscription
class Command(BaseCommand):
help = ("Active subscription holders need to be informed via audio file "
"about the new missed call servic... | Add missed call service audio notification to active subscriptions | Add missed call service audio notification to active subscriptions
| Python | bsd-3-clause | praekelt/seed-staged-based-messaging,praekelt/seed-stage-based-messaging,praekelt/seed-stage-based-messaging | ---
+++
@@ -0,0 +1,32 @@
+from django.core.exceptions import ObjectDoesNotExist
+from django.core.management.base import BaseCommand, CommandError
+
+from subscriptions.models import Subscription
+
+
+class Command(BaseCommand):
+ help = ("Active subscription holders need to be informed via audio file "
+ ... | |
7319b0efbe0bb5515d1a244db4dadebab9a4e3ec | tests/app/soc/modules/gci/views/test_student_forms.py | tests/app/soc/modules/gci/views/test_student_forms.py | # Copyright 2012 the Melange authors.
#
# 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 wr... | Implement basic tests for GCI student form uploads. | Implement basic tests for GCI student form uploads.
| Python | apache-2.0 | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | ---
+++
@@ -0,0 +1,48 @@
+# Copyright 2012 the Melange authors.
+#
+# 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 ... | |
0869c28f6f8cd5a6ddd636a4850d1609a60f90a7 | bluebottle/funding/migrations/0044_auto_20191108_1008.py | bluebottle/funding/migrations/0044_auto_20191108_1008.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-11-08 09:08
from __future__ import unicode_literals
from django.db import migrations
def fix_funding_matching_currencies(apps, schema_editor):
Funding = apps.get_model('funding', 'Funding')
for funding in Funding.objects.filter(amount_matching__gt... | Fix amount matching in wrong currency | Fix amount matching in wrong currency
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.15 on 2019-11-08 09:08
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+def fix_funding_matching_currencies(apps, schema_editor):
+ Funding = apps.get_model('funding', 'Funding')
+ for funding in Fundi... | |
999262374abb57dcb9d5b48db155f180f95015b0 | count_labelsets.py | count_labelsets.py | """Count labelsets that occur in the multilabel data.
Input: name of the directory that contains the multilabel data in text files
(one text file per text).
Usage: python count_labelsets.py <input dir>
"""
import argparse
import codecs
import os
from collections import Counter
if __name__ == '__main__':
parser ... | Add script to count label set statistics | Add script to count label set statistics
Added a script that outputs statistics about label sets in the data.
| Python | apache-2.0 | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | ---
+++
@@ -0,0 +1,53 @@
+"""Count labelsets that occur in the multilabel data.
+
+Input: name of the directory that contains the multilabel data in text files
+(one text file per text).
+
+Usage: python count_labelsets.py <input dir>
+"""
+import argparse
+import codecs
+import os
+from collections import Counter
+
... | |
2c3281754bd0e57a263a85f518eb49fbe6a8d72b | corehq/apps/importer/management/commands/import_cases.py | corehq/apps/importer/management/commands/import_cases.py | import json
from datetime import datetime
from django.core.management import BaseCommand, CommandError
from corehq.apps.importer.tasks import do_import
from corehq.apps.importer.util import ImporterConfig, ExcelFile
from corehq.apps.users.models import WebUser
class Command(BaseCommand):
help = "import cases from... | import json
from datetime import datetime
from django.core.management import BaseCommand, CommandError
from dimagi.utils.web import json_handler
from corehq.apps.importer.tasks import do_import
from corehq.apps.importer.util import ImporterConfig, ExcelFile
from corehq.apps.users.models import WebUser
class Command(B... | Use json_handler to force ugettext_lazy | Use json_handler to force ugettext_lazy
| Python | bsd-3-clause | dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq | ---
+++
@@ -1,6 +1,7 @@
import json
from datetime import datetime
from django.core.management import BaseCommand, CommandError
+from dimagi.utils.web import json_handler
from corehq.apps.importer.tasks import do_import
from corehq.apps.importer.util import ImporterConfig, ExcelFile
from corehq.apps.users.models... |
2e766d9b7010cb8d3fefaf785102e869e69b4a95 | math/transpose_of_matrix/python/transpose_of_matrix.py | math/transpose_of_matrix/python/transpose_of_matrix.py | def transpose_matrix(matrix):
matrix_rows_quantity = len(matrix)
matrix_column_quantity = len(matrix[0])
transposed_matrix = [[0] * matrix_rows_quantity for _ in range(matrix_column_quantity)]
for row in range(matrix_rows_quantity):
for column in range(matrix_column_quantity):
tran... | Create function in python to transpose matrix | Create function in python to transpose matrix
| Python | cc0-1.0 | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | ---
+++
@@ -0,0 +1,11 @@
+def transpose_matrix(matrix):
+ matrix_rows_quantity = len(matrix)
+ matrix_column_quantity = len(matrix[0])
+
+ transposed_matrix = [[0] * matrix_rows_quantity for _ in range(matrix_column_quantity)]
+
+ for row in range(matrix_rows_quantity):
+ for column in range(matrix... | |
8a4c8802ef8744b6e691e69adf256008adaddcea | migrations/versions/0130_service_email_reply_to_row.py | migrations/versions/0130_service_email_reply_to_row.py | """empty message
Revision ID: 0130_service_email_reply_to_row
Revises: 0129_add_email_auth_permission
Create Date: 2017-08-29 14:09:41.042061
"""
# revision identifiers, used by Alembic.
revision = '0130_service_email_reply_to_row'
down_revision = '0129_add_email_auth_permission'
from alembic import op
NOTIFY_SER... | Add notification email reply_to script | Add notification email reply_to script
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,33 @@
+"""empty message
+
+Revision ID: 0130_service_email_reply_to_row
+Revises: 0129_add_email_auth_permission
+Create Date: 2017-08-29 14:09:41.042061
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '0130_service_email_reply_to_row'
+down_revision = '0129_add_email_auth_permission... | |
b2d7740cf1e328342b76f744f17e91029ee33061 | corehq/apps/users/management/commands/clear_bad_user_data.py | corehq/apps/users/management/commands/clear_bad_user_data.py | from django.core.management.base import BaseCommand
from corehq.apps.es import UserES
from corehq.apps.users.models import CommCareUser
from corehq.util.couch import iter_update, DocUpdate
from corehq.util.log import with_progress_bar
class Command(BaseCommand):
args = ""
help = ("Clears commcare_location_id ... | Add mgmt cmd to clear bad location user data | Add mgmt cmd to clear bad location user data
| Python | bsd-3-clause | qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq | ---
+++
@@ -0,0 +1,42 @@
+from django.core.management.base import BaseCommand
+from corehq.apps.es import UserES
+from corehq.apps.users.models import CommCareUser
+from corehq.util.couch import iter_update, DocUpdate
+from corehq.util.log import with_progress_bar
+
+
+class Command(BaseCommand):
+ args = ""
+ ... | |
adefe5d762da042cfa6589d6cfcbc337f98921da | sphinxcontrib/openstreetmap.py | sphinxcontrib/openstreetmap.py | # -*- coding: utf-8 -*-
"""
sphinxcontrib.openstreetmap
===========================
Embed OpenStreetMap on your documentation.
:copyright: Copyright 2015 HAYASHI Kentaro <kenhys@gmail.com>
:license: BSD, see LICENSE for details.
"""
from sphinx.util.compat import Directive
class openstreetmap(nodes.General, nod... | Add template script for supporting OpenStreetMap | Add template script for supporting OpenStreetMap
| Python | bsd-2-clause | kenhys/sphinxcontrib-openstreetmap,kenhys/sphinxcontrib-openstreetmap | ---
+++
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+"""
+ sphinxcontrib.openstreetmap
+ ===========================
+
+ Embed OpenStreetMap on your documentation.
+
+ :copyright: Copyright 2015 HAYASHI Kentaro <kenhys@gmail.com>
+ :license: BSD, see LICENSE for details.
+"""
+from sphinx.util.compat import Directive
+... | |
926fc398b24170d418e0836b8ea23320dc7ff193 | umibukela/migrations/0012_surveykoboproject.py | umibukela/migrations/0012_surveykoboproject.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('umibukela', '0011_cycleresultset_published'),
]
operations = [
migrations.CreateModel(
name='SurveyKoboProject',... | Add SurveyKoboProject which optionally indicates a form/submission origin | Add SurveyKoboProject which optionally indicates a form/submission origin
| Python | mit | Code4SA/umibukela,Code4SA/umibukela,Code4SA/umibukela,Code4SA/umibukela | ---
+++
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('umibukela', '0011_cycleresultset_published'),
+ ]
+
+ operations = [
+ migrations.CreateMod... | |
2a61cdcad1de2d4b080a91e7eaca714a3e2ec68b | test/lib/environment_test.py | test/lib/environment_test.py | # Run the following command to test:
#
# (in /usr/local/googkit)
# $ python -m {test_module_name}
#
# See also: http://docs.python.org/3.3/library/unittest.html#command-line-interface
#
# We cannot use unittest.mock on python 2.x!
# Please install the Mock module when you use Python 2.x.
#
# $ easy_install ... | Add a test for lib.environment | Add a test for lib.environment
| Python | mit | googkit/googkit,googkit/googkit,googkit/googkit | ---
+++
@@ -0,0 +1,44 @@
+# Run the following command to test:
+#
+# (in /usr/local/googkit)
+# $ python -m {test_module_name}
+#
+# See also: http://docs.python.org/3.3/library/unittest.html#command-line-interface
+#
+# We cannot use unittest.mock on python 2.x!
+# Please install the Mock module when you use... | |
11f1e4b8f12759e0492626e8d75c79c760d6ffcb | tests/basics/tests/types1.py | tests/basics/tests/types1.py | # basic types
print(bool)
print(int)
print(float)
print(complex)
print(tuple)
print(list)
print(set)
print(dict)
print(type(bool()) == bool)
print(type(int()) == int)
print(type(float()) == float)
print(type(complex()) == complex)
print(type(tuple()) == tuple)
print(type(list()) == list)
print(type(set()) == set)
pri... | Add test for basic builtin types. | Add test for basic builtin types.
| Python | mit | alex-robbins/micropython,supergis/micropython,stonegithubs/micropython,blmorris/micropython,Peetz0r/micropython-esp32,ganshun666/micropython,emfcamp/micropython,slzatz/micropython,blazewicz/micropython,jmarcelino/pycom-micropython,noahchense/micropython,vriera/micropython,blmorris/micropython,ahotam/micropython,dhyland... | ---
+++
@@ -0,0 +1,28 @@
+# basic types
+
+print(bool)
+print(int)
+print(float)
+print(complex)
+print(tuple)
+print(list)
+print(set)
+print(dict)
+
+print(type(bool()) == bool)
+print(type(int()) == int)
+print(type(float()) == float)
+print(type(complex()) == complex)
+print(type(tuple()) == tuple)
+print(type(li... | |
bed2210dd4e705b8574f2d1974f43b3a139a6477 | scripts/remove_after_use/verify_node_wiki_page_counts.py | scripts/remove_after_use/verify_node_wiki_page_counts.py | # -*- coding: utf-8 -*-
import sys
import logging
from website.app import setup_django, init_app
from scripts import utils as script_utils
from django.db import transaction
setup_django()
from osf.models import AbstractNode
from addons.wiki.models import WikiPage, WikiVersion
logger = logging.getLogger(__name__)
de... | Add test script for verifying counts. | Add test script for verifying counts.
| Python | apache-2.0 | felliott/osf.io,aaxelb/osf.io,mfraezz/osf.io,HalcyonChimera/osf.io,erinspace/osf.io,binoculars/osf.io,felliott/osf.io,saradbowman/osf.io,felliott/osf.io,pattisdr/osf.io,Johnetordoff/osf.io,HalcyonChimera/osf.io,erinspace/osf.io,mattclark/osf.io,mfraezz/osf.io,mfraezz/osf.io,baylee-d/osf.io,adlius/osf.io,pattisdr/osf.io... | ---
+++
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+import sys
+import logging
+from website.app import setup_django, init_app
+from scripts import utils as script_utils
+from django.db import transaction
+
+setup_django()
+from osf.models import AbstractNode
+from addons.wiki.models import WikiPage, WikiVersion
+
+
+... | |
63b8222a1b75aef2f78bdce41bc18b46cba5a2b7 | Charts/Testing/Python/TestLinePlot.py | Charts/Testing/Python/TestLinePlot.py | #!/usr/bin/env python
# Run this test like so:
# vtkpython TestLinePlot.py -D $VTK_DATA_ROOT \
# -B $VTK_DATA_ROOT/Baseline/Charts/
import os
import vtk
import vtk.test.Testing
import math
class TestLinePlot(vtk.test.Testing.vtkTest):
def testLinePlot(self):
"Test if line plots can be built with python"... | Add Python LinePlot Charts Test | Add Python LinePlot Charts Test
Largely a clone of the Cxx version save that the data arrays must
be manipulated directly since the vtkVariant based methods on vtkTable
aren't available to Python.
| Python | bsd-3-clause | sankhesh/VTK,msmolens/VTK,Wuteyan/VTK,cjh1/VTK,candy7393/VTK,keithroe/vtkoptix,biddisco/VTK,aashish24/VTK-old,msmolens/VTK,candy7393/VTK,demarle/VTK,arnaudgelas/VTK,demarle/VTK,SimVascular/VTK,berendkleinhaneveld/VTK,sumedhasingla/VTK,mspark93/VTK,biddisco/VTK,msmolens/VTK,hendradarwin/VTK,naucoin/VTKSlicerWidgets,nauc... | ---
+++
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+
+# Run this test like so:
+# vtkpython TestLinePlot.py -D $VTK_DATA_ROOT \
+# -B $VTK_DATA_ROOT/Baseline/Charts/
+
+import os
+import vtk
+import vtk.test.Testing
+import math
+
+class TestLinePlot(vtk.test.Testing.vtkTest):
+ def testLinePlot(self):
+ "Tes... | |
def7caf595c4d995673f2fb8b997fc4f6b563d09 | tests/integration-test/test_cis_splice_effects_main.py | tests/integration-test/test_cis_splice_effects_main.py | #!/usr/bin/env python
'''
test_cis_splice_effects_main.py -- Integration test for `regtools cis-splice-effects`
Copyright (c) 2015, The Griffith Lab
Author: Avinash Ramu <aramu@genome.wustl.edu>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated docu... | Add test for cis-splice-effects main | Add test for cis-splice-effects main
| Python | mit | griffithlab/regtools,griffithlab/regtools,griffithlab/regtools,griffithlab/regtools,griffithlab/regtools,gatoravi/regtools,gatoravi/regtools,griffithlab/regtools,gatoravi/regtools,gatoravi/regtools,gatoravi/regtools | ---
+++
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+'''
+test_cis_splice_effects_main.py -- Integration test for `regtools cis-splice-effects`
+
+ Copyright (c) 2015, The Griffith Lab
+
+ Author: Avinash Ramu <aramu@genome.wustl.edu>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy... | |
465aec2bf42d285b1707e0dbd8913856e6859e9d | tests/startsymbol_tests/NonterminalNotInGrammarTest.py | tests/startsymbol_tests/NonterminalNotInGrammarTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 10.08.2017 23:20
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase, main
from grammpy import *
from grammpy.exceptions import NonterminalDoesNotExistsException
class NonterminalNotInGrammarTest(TestCase):
pass
if __name__ == '__main__':... | Add file for tests of setting invalid nonterminal as start symbol | Add file for tests of setting invalid nonterminal as start symbol
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 10.08.2017 23:20
+:Licence GNUv3
+Part of grammpy
+
+"""
+
+from unittest import TestCase, main
+from grammpy import *
+from grammpy.exceptions import NonterminalDoesNotExistsException
+
+
+class NonterminalNotInGrammarTest(TestCa... | |
2d1e8de13ce20c9e05e9e584d045431406af31c0 | conman/routes/migrations/0003_add_validators.py | conman/routes/migrations/0003_add_validators.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import conman.routes.validators
class Migration(migrations.Migration):
dependencies = [
('routes', '0002_remove_slug_parent'),
]
operations = [
migrations.AlterField(
mod... | Add missing migration (validators on Route.url) | Add missing migration (validators on Route.url)
| Python | bsd-2-clause | Ian-Foote/django-conman,meshy/django-conman,meshy/django-conman | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import conman.routes.validators
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('routes', '0002_remove_slug_parent'),
+ ]
+
+ operations = [
+ ... | |
76607bfd2b909eb004a897d9b4c78c93690e0f32 | press_releases/migrations/0009_auto_20170519_1308.py | press_releases/migrations/0009_auto_20170519_1308.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icekit_press_releases', '0008_auto_20161128_1049'),
]
operations = [
migrations.AddField(
model_name='pressrelea... | Update DB migrations following upstream change in ICEkit | Update DB migrations following upstream change in ICEkit
The `WorkflowStateMixin` model in django-icekit --
which is used as a basis for the `PressReleaseListing`
model -- was updated with two new fields: `brief`,
and `admin_notes`.
This change updates the model in this project to
comply with the upstream changes.
A... | Python | mit | ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/icekit-press-releases,ic-labs/django-icekit,ic-labs/icekit-press-releases,ic-labs/django-icekit | ---
+++
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('icekit_press_releases', '0008_auto_20161128_1049'),
+ ]
+
+ operations = [
+ migrations.Add... | |
9d4b8961cb1129cf02dffdbe987babe0942a4f9b | migrations/versions/0136_notification_template_hist.py | migrations/versions/0136_notification_template_hist.py | """
Revision ID: 0136_notification_template_hist
Revises: 0135_stats_template_usage
Create Date: 2017-11-08 10:15:07.039227
"""
from alembic import op
revision = '0136_notification_template_hist'
down_revision = '0135_stats_template_usage'
def upgrade():
op.drop_constraint('notifications_template_id_fkey', 'no... | Add a migration to replace notifications_template foreign key | Add a migration to replace notifications_template foreign key
Removes notifications.template_id foreign key and replaces it with
a composite foreign key constraint to TemplateHistory using the
existing notification columns for template ID and template version.
Foreign key constraint is created as NOT VALID to avoid l... | Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,36 @@
+"""
+
+Revision ID: 0136_notification_template_hist
+Revises: 0135_stats_template_usage
+Create Date: 2017-11-08 10:15:07.039227
+
+"""
+from alembic import op
+
+revision = '0136_notification_template_hist'
+down_revision = '0135_stats_template_usage'
+
+
+def upgrade():
+ op.drop_constr... | |
173df69a56a0088fcee12cd58c94d631eb952c0d | normandy/studies/migrations/0002_auto_20180510_2256.py | normandy/studies/migrations/0002_auto_20180510_2256.py | # Generated by Django 2.0.5 on 2018-05-10 22:56
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('studies', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='extension',
options={'ordering': ('-id',)},
... | Add migration for meta change on Extensions | Add migration for meta change on Extensions
| Python | mpl-2.0 | mozilla/normandy,mozilla/normandy,mozilla/normandy,mozilla/normandy | ---
+++
@@ -0,0 +1,17 @@
+# Generated by Django 2.0.5 on 2018-05-10 22:56
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('studies', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='extension',
+ ... | |
c76a24e25609fba8bdff5babc0319be6f8ea145c | connect_config/migrations/0003_auto_20141207_1231.py | connect_config/migrations/0003_auto_20141207_1231.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('connect_config', '0002_auto_20141104_1434'),
]
operations = [
migrations.AlterModelOptions(
name='siteconfig',
... | Add migration for translation cleanup | Add migration for translation cleanup
| Python | bsd-3-clause | f3r3nc/connect,nlhkabu/connect,f3r3nc/connect,f3r3nc/connect,nlhkabu/connect,nlhkabu/connect,nlhkabu/connect,f3r3nc/connect | ---
+++
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('connect_config', '0002_auto_20141104_1434'),
+ ]
+
+ operations = [
+ migrations.AlterModel... | |
4d0295eb55e92a8885b4e48749f6db019e2fb5a3 | django/users/migrations/0002_auto_20140922_0843.py | django/users/migrations/0002_auto_20140922_0843.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def add_echonest_forward(apps, schema_editor):
"""Create echonest user."""
User = apps.get_model("users", "User")
User.objects.update_or_create(email='echonest')
def add_echonest_backward(apps, sche... | Add migration to create echonest user | Add migration to create echonest user
| Python | bsd-3-clause | FreeMusicNinja/freemusic.ninja,FreeMusicNinja/freemusic.ninja | ---
+++
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+def add_echonest_forward(apps, schema_editor):
+ """Create echonest user."""
+ User = apps.get_model("users", "User")
+ User.objects.update_or_create(email='echonest')
+... | |
22171f517cfa72ed69fa1c321c6c647108de3a6d | app/grandchallenge/retina_core/signals.py | app/grandchallenge/retina_core/signals.py | from django.dispatch import receiver
from django.db.models.signals import post_save
from guardian.shortcuts import assign_perm
from django.conf import settings
from grandchallenge.annotations.models import (
MeasurementAnnotation,
BooleanClassificationAnnotation,
IntegerClassificationAnnotation,
Polygo... | Add post_save signal for annotations to add correct object level permissions | Add post_save signal for annotations to add correct object level permissions
| Python | apache-2.0 | comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django | ---
+++
@@ -0,0 +1,47 @@
+from django.dispatch import receiver
+from django.db.models.signals import post_save
+from guardian.shortcuts import assign_perm
+from django.conf import settings
+
+from grandchallenge.annotations.models import (
+ MeasurementAnnotation,
+ BooleanClassificationAnnotation,
+ Integer... | |
3c1f879469202a2001db94ba47055a3a9fab43f0 | ecommerce/extensions/catalogue/migrations/0045_add_edx_employee_coupon_category.py | ecommerce/extensions/catalogue/migrations/0045_add_edx_employee_coupon_category.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-01-22 09:46
from __future__ import unicode_literals
from django.db import migrations
from oscar.apps.catalogue.categories import create_from_breadcrumbs
from oscar.core.loading import get_model
Category = get_model('catalogue', 'Category')
COUPON_CATEGORY... | Add new coupon category for edX. | Add new coupon category for edX.
Added a data migration to create a new coupon category for edX
employees.
PROD-1177
| Python | agpl-3.0 | eduNEXT/edunext-ecommerce,edx/ecommerce,eduNEXT/edunext-ecommerce,eduNEXT/edunext-ecommerce,edx/ecommerce,edx/ecommerce,eduNEXT/edunext-ecommerce,edx/ecommerce | ---
+++
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.27 on 2020-01-22 09:46
+from __future__ import unicode_literals
+
+from django.db import migrations
+from oscar.apps.catalogue.categories import create_from_breadcrumbs
+from oscar.core.loading import get_model
+
+Category = get_model('cata... | |
7fdce241ba818755f6822e44f66bf503cbea3a77 | exercises/chapter_04/exercise_04_04/exercise_04_04.py | exercises/chapter_04/exercise_04_04/exercise_04_04.py | # 4-5. Summing a Million
numbers = list(range(1, 1000001))
print("min = ", min(numbers))
print("max = ", max(numbers))
print("sum = ", sum(numbers))
| Add solution to exercise 4.4. | Add solution to exercise 4.4.
| Python | mit | HenrikSamuelsson/python-crash-course | ---
+++
@@ -0,0 +1,6 @@
+# 4-5. Summing a Million
+
+numbers = list(range(1, 1000001))
+print("min = ", min(numbers))
+print("max = ", max(numbers))
+print("sum = ", sum(numbers)) | |
10a0fc5f62dcd85b022cc781855d9675f2beb365 | alembic/versions/36fba9f9069d_delete_unused_project_columns.py | alembic/versions/36fba9f9069d_delete_unused_project_columns.py | """delete unused project columns
Revision ID: 36fba9f9069d
Revises: 151b2f642877
Create Date: 2015-08-07 09:45:22.044720
"""
# revision identifiers, used by Alembic.
revision = '36fba9f9069d'
down_revision = '151b2f642877'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.drop_column('project',... | Add migration for removing unused columns in project | Add migration for removing unused columns in project
| Python | agpl-3.0 | PyBossa/pybossa,Scifabric/pybossa,PyBossa/pybossa,Scifabric/pybossa,geotagx/pybossa,geotagx/pybossa | ---
+++
@@ -0,0 +1,30 @@
+"""delete unused project columns
+
+Revision ID: 36fba9f9069d
+Revises: 151b2f642877
+Create Date: 2015-08-07 09:45:22.044720
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '36fba9f9069d'
+down_revision = '151b2f642877'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+... | |
5e75bf7b71c57ebc617dc0f073c2ed14585944be | tests/test_base.py | tests/test_base.py | import unittest
from requests import HTTPError
from kbcstorage.base import Endpoint
class TestEndpoint(unittest.TestCase):
"""
Test Endpoint functionality.
"""
def setUp(self):
self.root = 'https://httpbin.org'
self.token = ''
def test_get(self):
"""
Simple get w... | Add tests for the base endpoint HTTP methods | Add tests for the base endpoint HTTP methods
This tests the `try: ... except: raise finally: ...` gotcha caught
by @pocin.
| Python | mit | Ogaday/sapi-python-client,Ogaday/sapi-python-client | ---
+++
@@ -0,0 +1,62 @@
+import unittest
+
+from requests import HTTPError
+
+from kbcstorage.base import Endpoint
+
+
+class TestEndpoint(unittest.TestCase):
+ """
+ Test Endpoint functionality.
+ """
+ def setUp(self):
+ self.root = 'https://httpbin.org'
+ self.token = ''
+
+ def test_... | |
1890fbeacb34d1067a6e12909953cf070a8321c1 | tests/FindEpsilonRules/SimpleChainingSecondTest.py | tests/FindEpsilonRules/SimpleChainingSecondTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 20.08.2017 16:07
:Licence GNUv3
Part of grammpy-transforms
"""
from unittest import TestCase, main
from grammpy import *
from grammpy_transforms import ContextFree
class S(Nonterminal): pass
class A(Nonterminal): pass
class B(Nonterminal): pass
class C(Nont... | Add next text of chaining when looking for nonterminals rewritable to epsilon | Add next text of chaining when looking for nonterminals rewritable to epsilon
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 20.08.2017 16:07
+:Licence GNUv3
+Part of grammpy-transforms
+
+"""
+
+
+from unittest import TestCase, main
+from grammpy import *
+from grammpy_transforms import ContextFree
+
+class S(Nonterminal): pass
+class A(Nonterminal): p... | |
87babdfba0236de5d0742f9e336f8e3dbf603c65 | temba/flows/migrations/0046_flowrun_responded_unnull.py | temba/flows/migrations/0046_flowrun_responded_unnull.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('flows', '0045_populate_responded'),
]
operations = [
migrations.AlterField(
mod... | Set FlowRun.respnoded to be non-nullable | Set FlowRun.respnoded to be non-nullable
| Python | agpl-3.0 | pulilab/rapidpro,reyrodrigues/EU-SMS,tsotetsi/textily-web,tsotetsi/textily-web,pulilab/rapidpro,reyrodrigues/EU-SMS,tsotetsi/textily-web,tsotetsi/textily-web,pulilab/rapidpro,ewheeler/rapidpro,ewheeler/rapidpro,tsotetsi/textily-web,pulilab/rapidpro,pulilab/rapidpro,ewheeler/rapidpro,reyrodrigues/EU-SMS,ewheeler/rapidpr... | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+from django.conf import settings
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('flows', '0045_populate_responded'),
+ ]
+
+ operations = [
+ ... | |
af4c6d9747197b23014ba71803da792f9e612a12 | django_mailbox/migrations/0004_bytestring_to_unicode.py | django_mailbox/migrations/0004_bytestring_to_unicode.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('django_mailbox', '0003_auto_20150409_0316'),
]
operations = [
migrations.AlterField(
model_name='message',
... | Add migration to resolve inconsistency between python2 and python3 strings | Add migration to resolve inconsistency between python2 and python3 strings
| Python | mit | Shekharrajak/django-mailbox,coddingtonbear/django-mailbox,ad-m/django-mailbox,leifurhauks/django-mailbox | ---
+++
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('django_mailbox', '0003_auto_20150409_0316'),
+ ]
+
+ operations = [
+ migrations.AlterField... | |
3cedd52bb022dac3083c7de1245fd49882f39f41 | examples/sacred/mnist/model_from_mongo.py | examples/sacred/mnist/model_from_mongo.py | """
A simple Python API for loading Keras models from MongoDB run artifact stored
by the Sacred library.
Usage:
run_id = '5843062c4e60f9a60c9db41f'
model = get_model(get_run(run_id))
"""
from bson.objectid import ObjectId
import keras
import pymongo
from tempfile import TemporaryDirectory
mongo_client = pymongo.Mon... | Add a script to load a Keras model from MongoDB where it was stored by Sacred. | Add a script to load a Keras model from MongoDB where it was stored by Sacred.
| Python | mit | bzamecnik/sanctuary | ---
+++
@@ -0,0 +1,70 @@
+"""
+A simple Python API for loading Keras models from MongoDB run artifact stored
+by the Sacred library.
+
+Usage:
+
+run_id = '5843062c4e60f9a60c9db41f'
+model = get_model(get_run(run_id))
+"""
+
+from bson.objectid import ObjectId
+import keras
+import pymongo
+from tempfile import Tempo... | |
48dd9e5de783297a99278a347f20914a4e4053a8 | efs_cache_cleaner/cache_cleaner.py | efs_cache_cleaner/cache_cleaner.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
import os
import time
import sys
def delete(path):
print(path)
try:
os.unlink(path)
except PermissionError as err:
print(f"Failed to delete {path}: {err}", file=sys.stderr)
def delete_directory_if_empty(path):
try:
os.rmdir(pa... | Remove old files and empty directories | Remove old files and empty directories
| Python | mit | wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api | ---
+++
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+import os
+
+import time
+
+import sys
+
+
+def delete(path):
+ print(path)
+ try:
+ os.unlink(path)
+ except PermissionError as err:
+ print(f"Failed to delete {path}: {err}", file=sys.stderr)
+
+
+def delete_directory... | |
4c3a7cee4993ce9a76a084e89bcdf9f0931375a5 | modules/nagios/files/usr/lib/nagios/plugins/check_file_size.py | modules/nagios/files/usr/lib/nagios/plugins/check_file_size.py | #!/usr/bin/env python
import sys
import os.path
import datetime
import optparse
DESC="Nagios check: WARN if a file is smaller than a minimum number of bytes."
def main(argv):
parser = optparse.OptionParser(description=DESC)
parser.add_option('-p', '--path', type='string', help="Path to check")
parser.ad... | Add a check to assert a file is a minimum size | Add a check to assert a file is a minimum size
EFG generates an extract of the IL2 data by extracting and converting
each night to an IL0 representation.
This check is intended to be used to verify that the file is generated
and looks reasonable.
| Python | mit | alphagov/govuk-puppet,alphagov/govuk-puppet,alphagov/govuk-puppet,alphagov/govuk-puppet,alphagov/govuk-puppet,alphagov/govuk-puppet | ---
+++
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+import sys
+import os.path
+import datetime
+import optparse
+
+DESC="Nagios check: WARN if a file is smaller than a minimum number of bytes."
+
+def main(argv):
+ parser = optparse.OptionParser(description=DESC)
+
+ parser.add_option('-p', '--path', type='stri... | |
4816a7e7c24474e37d9dfe4ecde8079c92eb66e1 | doc/examples/segmentation/plot_compact_watershed.py | doc/examples/segmentation/plot_compact_watershed.py | """
=============================================
Find Regular Segments Using Compact Watershed
=============================================
The watershed transform is commonly used as a starting point for many
segmentation algorithms. However, without a judicious choice of seeds, it
can produce very uneven fragment ... | Add compact watershed gallery example | Add compact watershed gallery example
| Python | bsd-3-clause | rjeli/scikit-image,paalge/scikit-image,vighneshbirodkar/scikit-image,vighneshbirodkar/scikit-image,vighneshbirodkar/scikit-image,paalge/scikit-image,rjeli/scikit-image,rjeli/scikit-image,paalge/scikit-image | ---
+++
@@ -0,0 +1,42 @@
+"""
+=============================================
+Find Regular Segments Using Compact Watershed
+=============================================
+
+The watershed transform is commonly used as a starting point for many
+segmentation algorithms. However, without a judicious choice of seeds, it... | |
0b0c0269b6fbd14aac97d68fae35cefb0b2e4578 | alembic/versions/283afd3c9a32_add_jingle_interval.py | alembic/versions/283afd3c9a32_add_jingle_interval.py | """Add jingle interval
Revision ID: 283afd3c9a32
Revises: 53954e77cafc
Create Date: 2019-06-26 12:48:16.180224
"""
# revision identifiers, used by Alembic.
revision = '283afd3c9a32'
down_revision = '53954e77cafc'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alem... | Add configurable jingle interval migration | Add configurable jingle interval migration
| Python | agpl-3.0 | rootio/rootio_web,rootio/rootio_web,rootio/rootio_web,rootio/rootio_web | ---
+++
@@ -0,0 +1,26 @@
+"""Add jingle interval
+
+Revision ID: 283afd3c9a32
+Revises: 53954e77cafc
+Create Date: 2019-06-26 12:48:16.180224
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '283afd3c9a32'
+down_revision = '53954e77cafc'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrad... | |
eaa5bad75434ac050f438dff730936164106bfa9 | designate/storage/impl_sqlalchemy/migrate_repo/versions/066_add_update_status_index.py | designate/storage/impl_sqlalchemy/migrate_repo/versions/066_add_update_status_index.py | # Copyright (c) 2015 Rackspace Inc.
#
# Author: Tim Simmons <tim.simmons@rackspace.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | Add an index to speed up update_status | Add an index to speed up update_status
This adds an index that speeds up the update_status method in
designate-central
Change-Id: I62600ebbf066dc746a696263f0e72ca373076353
Closes-Bug: 1445115
| Python | apache-2.0 | cneill/designate-testing,ramsateesh/designate,grahamhayes/designate,cneill/designate,grahamhayes/designate,tonyli71/designate,cneill/designate,kiall/designate-py3,ionrock/designate,ionrock/designate,ionrock/designate,muraliselva10/designate,ramsateesh/designate,grahamhayes/designate,kiall/designate-py3,openstack/design... | ---
+++
@@ -0,0 +1,49 @@
+# Copyright (c) 2015 Rackspace Inc.
+#
+# Author: Tim Simmons <tim.simmons@rackspace.com>
+#
+# 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... | |
b4085ddea32ce5487d2d649a130984d8902e8399 | tests/alservice/service/test_wsgi.py | tests/alservice/service/test_wsgi.py | import json
import pytest
from future.backports.urllib.parse import urlencode
from jwkest.jwk import RSAKey, rsa_load
from jwkest.jws import JWS
class TestWSGIApp:
@pytest.fixture(autouse=True)
def create_test_client(self, app, cert_and_key):
self.app = app.test_client()
self.signing_key = RS... | Add test of full flow in WSGI app. | Add test of full flow in WSGI app.
| Python | apache-2.0 | its-dirg/ALservice | ---
+++
@@ -0,0 +1,52 @@
+import json
+
+import pytest
+from future.backports.urllib.parse import urlencode
+from jwkest.jwk import RSAKey, rsa_load
+from jwkest.jws import JWS
+
+
+class TestWSGIApp:
+ @pytest.fixture(autouse=True)
+ def create_test_client(self, app, cert_and_key):
+ self.app = app.test... | |
abfa62411ae77b5e541ac6b5a23883b6d1b6f31f | neuroimaging/utils/tests/data/__init__.py | neuroimaging/utils/tests/data/__init__.py | """Information used for locating nipy test data.
Nipy uses a set of test data that is installed separately. The test
data should be located in the directory ``~/.nipy/tests/data``.
Install the data in your home directory from the data repository::
$ mkdir -p .nipy/tests/data
$ svn co http://neuroimaging.scipy.or... | Add data repository package. Link to externally installed nipy data. | Add data repository package. Link to externally installed nipy data. | Python | bsd-3-clause | yarikoptic/NiPy-OLD,yarikoptic/NiPy-OLD | ---
+++
@@ -0,0 +1,22 @@
+"""Information used for locating nipy test data.
+
+Nipy uses a set of test data that is installed separately. The test
+data should be located in the directory ``~/.nipy/tests/data``.
+
+Install the data in your home directory from the data repository::
+ $ mkdir -p .nipy/tests/data
+ $ ... | |
6aceb95b6372654c9cb2fa2d86fd07fb81f33c50 | contrib/automation_tests/orbit_thread_state.py | contrib/automation_tests/orbit_thread_state.py | """
Copyright (c) 2020 The Orbit Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
"""
from absl import app
from core.orbit_e2e import E2ETestSuite
from test_cases.connection_window import FilterAndSelectFirstProcess, ConnectToStadiaInstanc... | Add smoke test for thread state collection | Add smoke test for thread state collection
Only a smoke test until more advanced facilities to inspect the capture view
are introduced.
Bug: http://b/176960292
Test: Run the test locally.
| Python | bsd-2-clause | google/orbit,google/orbit,google/orbit,google/orbit | ---
+++
@@ -0,0 +1,31 @@
+"""
+Copyright (c) 2020 The Orbit Authors. All rights reserved.
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+"""
+
+from absl import app
+
+from core.orbit_e2e import E2ETestSuite
+from test_cases.connection_window import FilterAndSelec... | |
798ddd081ff488194c9f0cb1bcab839099e1db70 | bluebottle/funding/migrations/0047_auto_20191116_1540.py | bluebottle/funding/migrations/0047_auto_20191116_1540.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-11-16 14:40
from __future__ import unicode_literals
from django.db import migrations
from django.db.models import F
def fix_matching_currencies(apps, schema_editor):
Funding = apps.get_model('funding', 'Funding')
Funding.objects.update(amount_matc... | Fix matching currency being different then target currency | Fix matching currency being different then target currency
BB-15798 #resolve
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.15 on 2019-11-16 14:40
+from __future__ import unicode_literals
+
+from django.db import migrations
+from django.db.models import F
+
+
+def fix_matching_currencies(apps, schema_editor):
+ Funding = apps.get_model('funding', 'Funding')
+... | |
18a2fde9b573e4db34e247cdd8dce6f506d8e34e | tests/Settings/TestSettingRelation.py | tests/Settings/TestSettingRelation.py | # Copyright (c) 2016 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
import pytest
import UM.Settings.SettingRelation
def test_create():
with pytest.raises(ValueError):
relation = UM.Settings.SettingRelation.SettingRelation(None, 2, UM.Settings.SettingRelation.RelationType.R... | Add test suite for SettingRelation | Add test suite for SettingRelation
Extremely simple test since SettingRelation is essentially a tuple.
Contributes to issue CURA-1278.
| Python | agpl-3.0 | onitake/Uranium,onitake/Uranium | ---
+++
@@ -0,0 +1,25 @@
+# Copyright (c) 2016 Ultimaker B.V.
+# Uranium is released under the terms of the AGPLv3 or higher.
+
+import pytest
+
+import UM.Settings.SettingRelation
+
+def test_create():
+ with pytest.raises(ValueError):
+ relation = UM.Settings.SettingRelation.SettingRelation(None, 2, UM.Se... | |
42c53d0f9afa61799e3c98327746e790f6fb0b1b | letters/migrations/0002_set_ordering_letter.py | letters/migrations/0002_set_ordering_letter.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-08-04 19:28
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('letters', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
... | Add ordering for letters to migration | Add ordering for letters to migration
| Python | mit | bwhicks/PlinyProject,bwhicks/PlinyProject,bwhicks/PlinyProject,bwhicks/PlinyProject | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.2 on 2017-08-04 19:28
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('letters', '0001_initial'),
+ ]
+
+ operations = [
+ ... | |
ddcc6e3fe252f5666d9f33023361cb0e01ca351a | tests/test_inet.py | tests/test_inet.py | # -*- coding: utf-8 -*-
import pytest
import csv
from inet.inet import Inet
class TestInet():
"""Test the Inet class functions as expected"""
def test_no_data_file(self):
with pytest.raises(AttributeError):
Inet(data_file=None)
def test_wrong_file_type(self, tmpdir):
with py... | Add inet read file tests | Add inet read file tests
| Python | mit | nestauk/inet | ---
+++
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+import pytest
+import csv
+
+from inet.inet import Inet
+
+
+class TestInet():
+ """Test the Inet class functions as expected"""
+
+ def test_no_data_file(self):
+ with pytest.raises(AttributeError):
+ Inet(data_file=None)
+
+ def test_wron... | |
31a36698c42e4c5d0e5d5a44cb924dcff231a7e4 | tests/test_main.py | tests/test_main.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from unittest import TestCase
from centerline import Centerline
from shapely.geometry import (GeometryCollection, LineString, MultiLineString,
MultiPoint, MultiPolygon, Point, Polygon)
class TestCenterlineSupportedGeometr... | Cover the type support with tests | Cover the type support with tests
| Python | mit | fitodic/centerline,fitodic/centerline,fitodic/polygon-centerline | ---
+++
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import unicode_literals
+
+from unittest import TestCase
+
+from centerline import Centerline
+from shapely.geometry import (GeometryCollection, LineString, MultiLineString,
+ MultiPoint, MultiPolygon, Point, Polygon)
+
... | |
6ba5fe781d32467a185e0c0d73fda401846e5370 | scripts/update_centroid_reports.py | scripts/update_centroid_reports.py | #!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import argparse
from mica import centroid_dashboard
# Cheat. Needs entrypoint scripts
centroid_dashboard.update_observed_metrics()
| Add a silly script for the centroid reports | Add a silly script for the centroid reports
| Python | bsd-3-clause | sot/mica,sot/mica | ---
+++
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+# Licensed under a 3-clause BSD style license - see LICENSE.rst
+import os
+import argparse
+
+from mica import centroid_dashboard
+
+
+# Cheat. Needs entrypoint scripts
+centroid_dashboard.update_observed_metrics() | |
3eb99e0cd378e9cc3e15bef85c55e02ef28a8af3 | education/management/commands/fake_incoming_message.py | education/management/commands/fake_incoming_message.py | from django.core.management.base import BaseCommand
from optparse import make_option
from rapidsms_httprouter.router import get_router
from rapidsms.models import Connection
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option("-p", "--phone", dest="phone"),
make_optio... | Add command to make testing incoming messages easier. | Add command to make testing incoming messages easier.
| Python | bsd-3-clause | unicefuganda/edtrac,unicefuganda/edtrac,unicefuganda/edtrac | ---
+++
@@ -0,0 +1,27 @@
+from django.core.management.base import BaseCommand
+from optparse import make_option
+from rapidsms_httprouter.router import get_router
+from rapidsms.models import Connection
+
+class Command(BaseCommand):
+
+ option_list = BaseCommand.option_list + (
+ make_option("-p", "--phone... | |
5e53c6fd8f58935adfe8db3d7825dfd91780f961 | test/data/observatory/repository/test_repo_client.py | test/data/observatory/repository/test_repo_client.py | import unittest
from cartoframes.data.clients import SQLClient
from cartoframes.data.observatory.repository.repo_client import RepoClient
from ..examples import db_dataset1, db_dataset2
try:
from unittest.mock import Mock, patch
except ImportError:
from mock import Mock, patch
class TestRepoClient(unittest... | Add unit tests for repo client | Add unit tests for repo client
| Python | bsd-3-clause | CartoDB/cartoframes,CartoDB/cartoframes | ---
+++
@@ -0,0 +1,65 @@
+import unittest
+
+from cartoframes.data.clients import SQLClient
+from cartoframes.data.observatory.repository.repo_client import RepoClient
+
+from ..examples import db_dataset1, db_dataset2
+
+try:
+ from unittest.mock import Mock, patch
+except ImportError:
+ from mock import Mock,... | |
d4949ced78d06ebc87a6f938d67f706eb9425f91 | flatblocks/management/commands/unassignedflatblocks.py | flatblocks/management/commands/unassignedflatblocks.py | import os
from django.core.management.base import BaseCommand
from django.template.loader import get_template
from django.conf import settings
from flatblocks.templatetags.flatblock_tags import FlatBlockNode
from flatblocks.models import FlatBlock
class Command(BaseCommand):
help = "List unassigned flatblocks ... | Add command for checking & saving unassigned flatblocks in the database | Add command for checking & saving unassigned flatblocks in the database
| Python | bsd-3-clause | funkybob/django-flatblocks,funkybob/django-flatblocks | ---
+++
@@ -0,0 +1,50 @@
+import os
+
+from django.core.management.base import BaseCommand
+from django.template.loader import get_template
+
+from django.conf import settings
+
+from flatblocks.templatetags.flatblock_tags import FlatBlockNode
+from flatblocks.models import FlatBlock
+
+
+class Command(BaseCommand):
... | |
cad8853286ee87c3efca07e80250cc5b5e43f3e3 | pidman/pid/migrations/0003_rm_invalidark_target_urlfield.py | pidman/pid/migrations/0003_rm_invalidark_target_urlfield.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pid', '0002_pid_sequence_initial_value'),
]
operations = [
migrations.DeleteModel(
name='InvalidArk',
),... | Add invalid ark and target uri field migration | Add invalid ark and target uri field migration
Not significant changes, but django complains about model changes
not matching otherwise.
| Python | apache-2.0 | emory-libraries/pidman,emory-libraries/pidman | ---
+++
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('pid', '0002_pid_sequence_initial_value'),
+ ]
+
+ operations = [
+ migrations.DeleteModel(
... | |
82f920aa0538f189417621f32a532644282ca7f6 | pylearn2/scripts/tests/test_summarize_model.py | pylearn2/scripts/tests/test_summarize_model.py | """
A unit test for the summarize_model.py script
"""
import cPickle
import os
from pylearn2.testing.skip import skip_if_no_matplotlib
from pylearn2.models.mlp import MLP, Linear
from pylearn2.scripts.summarize_model import summarize
def test_summarize_model():
"""
Asks the summarize_model.py script to inspe... | Add unit test for summarize_model.py | Add unit test for summarize_model.py
| Python | bsd-3-clause | msingh172/pylearn2,abergeron/pylearn2,nouiz/pylearn2,sandeepkbhat/pylearn2,alexjc/pylearn2,hantek/pylearn2,ashhher3/pylearn2,abergeron/pylearn2,se4u/pylearn2,Refefer/pylearn2,shiquanwang/pylearn2,ashhher3/pylearn2,w1kke/pylearn2,TNick/pylearn2,cosmoharrigan/pylearn2,fyffyt/pylearn2,fishcorn/pylearn2,fishcorn/pylearn2,g... | ---
+++
@@ -0,0 +1,22 @@
+"""
+A unit test for the summarize_model.py script
+"""
+import cPickle
+import os
+
+from pylearn2.testing.skip import skip_if_no_matplotlib
+from pylearn2.models.mlp import MLP, Linear
+from pylearn2.scripts.summarize_model import summarize
+
+
+def test_summarize_model():
+ """
+ As... | |
bdc3a1620f15b842ade92815ba24bf611f9d96c1 | taggit_machinetags/migrations/0002_auto_20201012_1308.py | taggit_machinetags/migrations/0002_auto_20201012_1308.py | # Generated by Django 3.1.2 on 2020-10-12 12:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
('taggit_machinetags', '0001_initial'),
]
operations = [
... | Add migration for content types fields | Add migration for content types fields
| Python | bsd-2-clause | lpomfrey/django-taggit-machinetags | ---
+++
@@ -0,0 +1,25 @@
+# Generated by Django 3.1.2 on 2020-10-12 12:08
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('contenttypes', '0002_remove_content_type_name'),
+ ('taggit_machinetags', '0001_... | |
e333e8d07ee32668fc132a21c13cdf674443d1e9 | chrome_frame/tools/helper_shutdown.py | chrome_frame/tools/helper_shutdown.py | # Copyright (c) 2010 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.
'''This is a simple helper script to shut down the Chrome Frame helper process.
It needs the Python Win32 extensions.'''
import pywintypes
import sys
imp... | Add a tiny helper script to shutdown the chrome frame helper process. | Add a tiny helper script to shutdown the chrome frame helper process.
BUG=53127
TEST=Run script, chrome_frame_helper.exe is shut down.
Review URL: http://codereview.chromium.org/3312010
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@58587 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | Fireblend/chromium-crosswalk,M4sse/chromium.src,keishi/chromium,patrickm/chromium.src,pozdnyakov/chromium-crosswalk,patrickm/chromium.src,nacl-webkit/chrome_deps,anirudhSK/chromium,junmin-zhu/chromium-rivertrail,fujunwei/chromium-crosswalk,ChromiumWebApps/chromium,Just-D/chromium-1,dednal/chromium.src,dushu1203/chromiu... | ---
+++
@@ -0,0 +1,30 @@
+# Copyright (c) 2010 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.
+'''This is a simple helper script to shut down the Chrome Frame helper process.
+It needs the Python Win32 extensions.'''
+... | |
a65f897f441eb001bf825805c955ac52a6026a87 | bluebottle/projects/migrations/0026_auto_20170424_1653.py | bluebottle/projects/migrations/0026_auto_20170424_1653.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-24 14:53
from __future__ import unicode_literals
from django.db import migrations
def correct_needs_approval_status(apps, schema_editor):
Project = apps.get_model('projects', 'Project')
for project in Project.objects.filter(payout_status='needs... | Mark projects that have a bluebottle payout as not needing approval | Mark projects that have a bluebottle payout as not needing approval
BB-9612 #resolve
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.6 on 2017-04-24 14:53
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+def correct_needs_approval_status(apps, schema_editor):
+ Project = apps.get_model('projects', 'Project')
+
+ for project in Proje... | |
43cd8e0e79b37b932e4942890af8b708f2e37482 | openstack/tests/functional/compute/v2/test_limits.py | openstack/tests/functional/compute/v2/test_limits.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 functional tests for compute limits | Add functional tests for compute limits
Change-Id: Ifb192d412081beadf15023343af71ab23ceba7a1
| Python | apache-2.0 | stackforge/python-openstacksdk,dudymas/python-openstacksdk,dtroyer/python-openstacksdk,mtougeron/python-openstacksdk,dudymas/python-openstacksdk,briancurtin/python-openstacksdk,briancurtin/python-openstacksdk,openstack/python-openstacksdk,mtougeron/python-openstacksdk,stackforge/python-openstacksdk,openstack/python-ope... | ---
+++
@@ -0,0 +1,24 @@
+# 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... | |
cda8afef07cf959989f5e46577d3ce6b19c9e105 | rdtools/energy_normalization.py | rdtools/energy_normalization.py | ''' Energy Normalization Module
This module contains functions to help normalize AC energy output with measured
irradiance in preparation for calculating PV system degradation.
'''
import pandas as pd
import pvlib
def normalize_with_sapm(pvlib_pvsystem, energy, irradiance):
'''
Normalize system AC energy ou... | Rename 'tools' to 'rdtools' module directory. | Rename 'tools' to 'rdtools' module directory.
| Python | mit | kwhanalytics/rdtools,kwhanalytics/rdtools | ---
+++
@@ -0,0 +1,76 @@
+''' Energy Normalization Module
+
+This module contains functions to help normalize AC energy output with measured
+irradiance in preparation for calculating PV system degradation.
+'''
+
+import pandas as pd
+import pvlib
+
+
+def normalize_with_sapm(pvlib_pvsystem, energy, irradiance):
+ ... | |
13db5fc93d2aec28ea8a52f32353e86d8f49c12e | python/christmas_names/name_chooser.py | python/christmas_names/name_chooser.py | #! /usr/bin/python
# vim: set ai sw=4:
import random
import time
family_list = [["Alia", "Tanya"],
["Nick", "Ariana", "Max"],
["Paige", "Ian", "Kendra"]
]
# Given a family_list, create 2 new data structures:
# 1) Just a raw list of all the names
# 2) A dictionary mapping from a name to a ... | Add python program (really a collection of functions) which will choose a set of name pairings for a christmas gift exchange. | Add python program (really a collection of functions) which will choose a
set of name pairings for a christmas gift exchange.
| Python | bsd-2-clause | tedzo/python_play | ---
+++
@@ -0,0 +1,61 @@
+#! /usr/bin/python
+
+# vim: set ai sw=4:
+
+import random
+import time
+
+family_list = [["Alia", "Tanya"],
+ ["Nick", "Ariana", "Max"],
+ ["Paige", "Ian", "Kendra"]
+ ]
+
+# Given a family_list, create 2 new data structures:
+# 1) Just a raw list of all the names
+# ... | |
9a9469337fa562f11d23dab813dd334d9f35f0f1 | elections/uk/migrations/0003_adjust_roles_for_grouping.py | elections/uk/migrations/0003_adjust_roles_for_grouping.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from django.db import migrations
def adjust_roles_for_grouping(apps, schema_editor):
Election = apps.get_model('elections', 'Election')
for election in Election.objects.all():
if re.search(r'^local\.[^.]+\.2016', election.slug... | Change for_post_role of local & mayoral elections for better grouping | Change for_post_role of local & mayoral elections for better grouping
On various pages we're now grouping elections by the post role that
they're for. Unfortunately in some UK installations there's a different
for_post_role for each local councillor election, and each mayoral
election (e.g. 'Councillor for St Helens'... | Python | agpl-3.0 | neavouli/yournextrepresentative,mysociety/yournextmp-popit,DemocracyClub/yournextrepresentative,neavouli/yournextrepresentative,DemocracyClub/yournextrepresentative,mysociety/yournextmp-popit,mysociety/yournextrepresentative,neavouli/yournextrepresentative,neavouli/yournextrepresentative,DemocracyClub/yournextrepresent... | ---
+++
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+import re
+
+from django.db import migrations
+
+
+def adjust_roles_for_grouping(apps, schema_editor):
+ Election = apps.get_model('elections', 'Election')
+ for election in Election.objects.all():
+ if re.searc... | |
6655f7d62347f96bf4fe8673faf26c0c3e2b2e0b | neutron/tests/unit/conf/policies/test_floatingip_pools.py | neutron/tests/unit/conf/policies/test_floatingip_pools.py | # Copyright (c) 2021 Red Hat 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 agreed to in writi... | Add tests for floatingip pools API's new policy rules | Add tests for floatingip pools API's new policy rules
Related-blueprint: bp/secure-rbac-roles
Change-Id: I3f4f668866a7d1dacb583a177e8475617a762bf7
| Python | apache-2.0 | openstack/neutron,mahak/neutron,openstack/neutron,mahak/neutron,openstack/neutron,mahak/neutron | ---
+++
@@ -0,0 +1,85 @@
+# Copyright (c) 2021 Red Hat 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 ... | |
e93939c9b0aee674ed9003727a267f6844d8ece6 | DungeonsOfNoudar486/make_palette.py | DungeonsOfNoudar486/make_palette.py | import glob
from PIL import Image
from math import floor
palette = [[0,0,0]];
def transform( pixel ):
return [ 20 * ( pixel[ 0 ] / 20), 20 * ( pixel[ 1 ] / 20), 20 * ( pixel[ 2 ] / 20 ) ]
def add_to_palette( filename ):
imgFile = Image.open( filename )
img = imgFile.load()
for y in range( 0, imgFile.h... | Add utility to extract palette for the DOS version | Add utility to extract palette for the DOS version
| Python | bsd-2-clause | TheFakeMontyOnTheRun/dungeons-of-noudar,TheFakeMontyOnTheRun/dungeons-of-noudar | ---
+++
@@ -0,0 +1,31 @@
+import glob
+from PIL import Image
+from math import floor
+palette = [[0,0,0]];
+
+def transform( pixel ):
+ return [ 20 * ( pixel[ 0 ] / 20), 20 * ( pixel[ 1 ] / 20), 20 * ( pixel[ 2 ] / 20 ) ]
+
+def add_to_palette( filename ):
+ imgFile = Image.open( filename )
+ img = imgFile.l... | |
363f93e1ea11fe99311df06d6dfcba76343f3c4e | django/sierra/api/migrations/0002_auto_20190517_1053.py | django/sierra/api/migrations/0002_auto_20190517_1053.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='apiuser',
name='permissio... | Add migration for earlier change to api models | Add migration for earlier change to api models
Oops! Apparently I forgot to run makemigrations after a minor change to
API models.
| Python | bsd-3-clause | unt-libraries/catalog-api,unt-libraries/catalog-api,unt-libraries/catalog-api,unt-libraries/catalog-api | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('api', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_n... | |
789bcb17da60c17e521d442c21dc6fe1aec28392 | src/ggrc/migrations/versions/20170203150557_7471e16ebb76_fix_vendors_columns_data_type.py | src/ggrc/migrations/versions/20170203150557_7471e16ebb76_fix_vendors_columns_data_type.py | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Bring vendors' start_date and end_date columns into conformity with the model
Create Date: 2017-02-03 15:05:57.538217
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
... | Fix column data type in vendors table | Fix column data type in vendors table
| Python | apache-2.0 | plamut/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core | ---
+++
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 Google Inc.
+# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
+
+"""
+Bring vendors' start_date and end_date columns into conformity with the model
+
+Create Date: 2017-02-03 15:05:57.538217
+"""
+# disable Invalid constant name pylint warni... | |
e0cdbf908c47e926b371ec3d97165818ed0a4423 | apps/documents/migrations/0005_update_content_types.py | apps/documents/migrations/0005_update_content_types.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
sql = """UPDATE django_content_type
SET model = 'chapter'
WHERE model = 'document' AND
app_label = 'meinberlin_documents';"""
reverse_sql = """UPDATE django_content_type
... | Add content_type migration to keep comments etc. | Add content_type migration to keep comments etc.
| Python | agpl-3.0 | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | ---
+++
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+sql = """UPDATE django_content_type
+ SET model = 'chapter'
+ WHERE model = 'document' AND
+ app_label = 'meinberlin_documents';"""
+
+reverse_sql = """UPDATE... | |
a0fea14fe7fd5a938e0f2583dbd9dc6bb9040bc1 | Python/232_ImplementQueueUsingStack.py | Python/232_ImplementQueueUsingStack.py | class Stack(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.__queue = []
def push(self, x):
"""
:type x: int
:rtype: nothing
"""
self.__queue.append(x)
def pop(self):
"""
:rtype: nothing
... | Add solution for 232 implement queue using stack. | Add solution for 232 implement queue using stack.
| Python | mit | comicxmz001/LeetCode,comicxmz001/LeetCode | ---
+++
@@ -0,0 +1,36 @@
+class Stack(object):
+ def __init__(self):
+ """
+ initialize your data structure here.
+ """
+ self.__queue = []
+
+ def push(self, x):
+ """
+ :type x: int
+ :rtype: nothing
+ """
+ self.__queue.append(x)
+
+ def pop(s... | |
8cdca8db430b74b4f8ae74492d6d2d740aa670a6 | apps/network/tests/test_routes/test_association_requests.py | apps/network/tests/test_routes/test_association_requests.py |
def test_send_association_request(client):
result = client.post("/association-requests/request", data={"id": "54623156", "address": "159.15.223.162"})
assert result.status_code == 200
assert result.get_json() == {"msg": "Association request sent!"}
def test_receive_association_request(client):
result ... | ADD Network association_requests unit tests | ADD Network association_requests unit tests
| Python | apache-2.0 | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | ---
+++
@@ -0,0 +1,35 @@
+
+def test_send_association_request(client):
+ result = client.post("/association-requests/request", data={"id": "54623156", "address": "159.15.223.162"})
+ assert result.status_code == 200
+ assert result.get_json() == {"msg": "Association request sent!"}
+
+def test_receive_associ... | |
aedb8c78b1512cb0b0f887c5dc05686170313d74 | journal/migrations/0016_auto_20170110_1737.py | journal/migrations/0016_auto_20170110_1737.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-10 17:37
from __future__ import unicode_literals
from django.conf import settings
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency... | Make uid unique together with journal/user, not on its own. | Make uid unique together with journal/user, not on its own.
| Python | agpl-3.0 | etesync/journal-manager | ---
+++
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.4 on 2017-01-10 17:37
+from __future__ import unicode_literals
+
+from django.conf import settings
+import django.core.validators
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
... | |
5fbf720c97d08144a3518c8995a3b76d2b923377 | python/turbodbc_test/test_cursor_unsupported_features.py | python/turbodbc_test/test_cursor_unsupported_features.py | from unittest import TestCase
from turbodbc import connect
dsn = "Exasol R&D test database"
class TestCursorUnsupportedFeatures(TestCase):
"""
Test optional features mentioned in PEP-249 "behave" as specified
"""
def test_callproc_unsupported(self):
cursor = connect(dsn).cursor()
... | Add test for optional Python database API features which are not implemented | Add test for optional Python database API features which are not implemented
| Python | mit | blue-yonder/turbodbc,blue-yonder/turbodbc,blue-yonder/turbodbc,blue-yonder/turbodbc | ---
+++
@@ -0,0 +1,23 @@
+from unittest import TestCase
+
+from turbodbc import connect
+
+
+dsn = "Exasol R&D test database"
+
+
+class TestCursorUnsupportedFeatures(TestCase):
+ """
+ Test optional features mentioned in PEP-249 "behave" as specified
+ """
+ def test_callproc_unsupported(self):
+ ... | |
afa3abdf6cb98db93feb39825dd434adb4c7965f | documents/management/commands/import_from_csv.py | documents/management/commands/import_from_csv.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from django.core.management.base import BaseCommand
from django.core.files import File
import csv
from users.models import User
from catalog.models import Course
from documents import logic
class Command(BaseCommand):
help = 'Import docu... | Add import from csv command | Add import from csv command
| Python | agpl-3.0 | UrLab/DocHub,UrLab/beta402,UrLab/DocHub,UrLab/beta402,UrLab/beta402,UrLab/DocHub,UrLab/DocHub | ---
+++
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+import os
+from django.core.management.base import BaseCommand
+from django.core.files import File
+import csv
+
+from users.models import User
+from catalog.models import Course
+from documents import logic
+
+
+class Comma... | |
53c9b988d2ccda253080deaa35b70d814309a4aa | src/algorithms/simple_hybrid.py | src/algorithms/simple_hybrid.py | def predict(predictions_vector_0, predictions_vector_1, mixing_variable=0.5, num_partitions=30):
"""Apply a simple linear hybrid recommender.
This function implements the simple linear hybrid recommender Zhou et. al:
"Solving the apparent diversity-accuracy dilemma of recommender systems"
http://arxiv... | Add a simple hybrid recommender from Zhou et. al | Add a simple hybrid recommender from Zhou et. al
| Python | apache-2.0 | tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes | ---
+++
@@ -0,0 +1,58 @@
+def predict(predictions_vector_0, predictions_vector_1, mixing_variable=0.5, num_partitions=30):
+ """Apply a simple linear hybrid recommender.
+
+ This function implements the simple linear hybrid recommender Zhou et. al:
+
+ "Solving the apparent diversity-accuracy dilemma of reco... | |
9710af9d9e350d8331736d76f27af1fb46671aa2 | salt/beacons/twilio_txt_msg.py | salt/beacons/twilio_txt_msg.py | # -*- coding: utf-8 -*-
'''
Beacon to emit Twilio text messages
'''
# Import Python libs
from __future__ import absolute_import
from datetime import datetime
import logging
# Import 3rd Party libs
try:
from twilio.rest import TwilioRestClient
HAS_TWILIO = True
except ImportError:
HAS_TWILIO = False
log =... | Add Twilio text message beacon | Add Twilio text message beacon
This beacon will poll a Twilio account for text messages
and emit an event on Salt's event bus as texts are received.
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+'''
+Beacon to emit Twilio text messages
+'''
+
+# Import Python libs
+from __future__ import absolute_import
+from datetime import datetime
+import logging
+
+# Import 3rd Party libs
+try:
+ from twilio.rest import TwilioRestClient
+ HAS_TWILIO = True
+except ... | |
f81a2f9e3f1123ec474bce3278107a94c70e0dc3 | python/helpers/pydev/_pydev_bundle/_pydev_filesystem_encoding.py | python/helpers/pydev/_pydev_bundle/_pydev_filesystem_encoding.py | def __getfilesystemencoding():
'''
Note: there's a copy of this method in interpreterInfo.py
'''
import sys
try:
ret = sys.getfilesystemencoding()
if not ret:
raise RuntimeError('Unable to get encoding.')
return ret
except:
try:
#Handle Jyt... | import sys
def __getfilesystemencoding():
'''
Note: there's a copy of this method in interpreterInfo.py
'''
try:
ret = sys.getfilesystemencoding()
if not ret:
raise RuntimeError('Unable to get encoding.')
return ret
except:
try:
#Handle Jytho... | Fix deadlock in remote debugger (PY-18546) | Fix deadlock in remote debugger (PY-18546)
| Python | apache-2.0 | salguarnieri/intellij-community,ThiagoGarciaAlves/intellij-community,allotria/intellij-community,semonte/intellij-community,idea4bsd/idea4bsd,semonte/intellij-community,da1z/intellij-community,ThiagoGarciaAlves/intellij-community,mglukhikh/intellij-community,allotria/intellij-community,xfournet/intellij-community,salgu... | ---
+++
@@ -1,8 +1,10 @@
+import sys
+
+
def __getfilesystemencoding():
'''
Note: there's a copy of this method in interpreterInfo.py
'''
- import sys
try:
ret = sys.getfilesystemencoding()
if not ret: |
195edf0e5578e0d30677b4da7375d8f04e9a91a1 | alembic/versions/18ebf3181f87_add_a_negated_column_for_rules.py | alembic/versions/18ebf3181f87_add_a_negated_column_for_rules.py | """Add a negated column for rules.
Revision ID: 18ebf3181f87
Revises: 4a95022fd7f3
Create Date: 2014-08-22 15:48:08.952913
"""
# revision identifiers, used by Alembic.
revision = '18ebf3181f87'
down_revision = '4a95022fd7f3'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('rules', ... | Add alembic revision for that. | Add alembic revision for that.
| Python | lgpl-2.1 | jeremycline/fmn,jeremycline/fmn,jeremycline/fmn | ---
+++
@@ -0,0 +1,22 @@
+"""Add a negated column for rules.
+
+Revision ID: 18ebf3181f87
+Revises: 4a95022fd7f3
+Create Date: 2014-08-22 15:48:08.952913
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '18ebf3181f87'
+down_revision = '4a95022fd7f3'
+
+from alembic import op
+import sqlalchemy as sa
+
+... | |
698273ac6863eeaa3963c84fac6a49a918cc261b | freelancefinder/freelancefinder/tests/test_xforwardedfor_middleware.py | freelancefinder/freelancefinder/tests/test_xforwardedfor_middleware.py | """Test the X-Forwarded-For middleware."""
from ..middleware.xforwardedfor import xforwardedfor
def get_response_method(thing):
"""Do nothing."""
return thing
def test_setting_correctly(rf):
"""Override REMOTE_ADDR if HTTP_X_FORWARDED_FOR is present."""
request = rf.get('/')
request.META['REMOT... | Add tests for xforwardedfor middleware | Add tests for xforwardedfor middleware
| Python | bsd-3-clause | ScorpionResponse/freelancefinder,ScorpionResponse/freelancefinder,ScorpionResponse/freelancefinder | ---
+++
@@ -0,0 +1,33 @@
+"""Test the X-Forwarded-For middleware."""
+
+from ..middleware.xforwardedfor import xforwardedfor
+
+
+def get_response_method(thing):
+ """Do nothing."""
+ return thing
+
+
+def test_setting_correctly(rf):
+ """Override REMOTE_ADDR if HTTP_X_FORWARDED_FOR is present."""
+ reque... | |
bff3f017a889da1922355e05b598895f59d841de | horizontalIlluminance.py | horizontalIlluminance.py | #!/usr/bin/env python
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
# This code plot the horizontal illuminance inside a room using a SISO array.
# Semi-angle at half illuminance (degree)
tethaHalf = 70
# Lambertian emission order (adimensional)
m = -np.log(2)/np.log10(... | Create code to plot Horizontal Illuminance. | Create code to plot Horizontal Illuminance.
| Python | mit | sophiekovalevsky/Visible-Light-Communication | ---
+++
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+
+import numpy as np
+from mpl_toolkits.mplot3d import Axes3D
+import matplotlib.pyplot as plt
+
+# This code plot the horizontal illuminance inside a room using a SISO array.
+
+# Semi-angle at half illuminance (degree)
+tethaHalf = 70
+
+# Lambertian emission order ... | |
014010bec210bc4ebb7d24dbdd21a0cdf75bee2f | migrations/versions/990_add_missing_nice_to_have_requirements_field.py | migrations/versions/990_add_missing_nice_to_have_requirements_field.py | """Adds missing 'niceToHaveRequirements' to old published Brief data blobs.
Revision ID: 990
Revises: 980
Create Date: 2017-09-05 17:08:57.947569
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '990'
down_revision = '980'
briefs_table = sa.Table(
'briefs'... | Fix old Briefs missing niceToHaveRequirements field | Fix old Briefs missing niceToHaveRequirements field
This was causing errors when suppliers applied to these Briefs
and any copies of them.
| Python | mit | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | ---
+++
@@ -0,0 +1,47 @@
+"""Adds missing 'niceToHaveRequirements' to old published Brief data blobs.
+
+Revision ID: 990
+Revises: 980
+Create Date: 2017-09-05 17:08:57.947569
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = '990'
+down_revision = '980... | |
b7da0da12d74d111cff72e74ae487864c53fa808 | django_backend_test/django_backend_test/celery.py | django_backend_test/django_backend_test/celery.py | from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_backend_test.local_settings')
from django.conf import settings
app = Celery('django_backend_test')
# ... | Add Celery file to async tasks | Add Celery file to async tasks
| Python | mit | semorale/backend-test,semorale/backend-test,semorale/backend-test | ---
+++
@@ -0,0 +1,19 @@
+from __future__ import absolute_import, unicode_literals
+import os
+from celery import Celery
+
+# set the default Django settings module for the 'celery' program.
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_backend_test.local_settings')
+from django.conf import settings
+app =... | |
dd1d51ba29b2f3729431c1552fd955697d04a0f7 | museum_site/migrations/0004_alter_file_company.py | museum_site/migrations/0004_alter_file_company.py | # Generated by Django 3.2.7 on 2021-10-28 19:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('museum_site', '0003_auto_20211028_1858'),
]
operations = [
migrations.AlterField(
model_name='file',
name='company',... | Increase length of company field | Increase length of company field
| Python | mit | DrDos0016/z2,DrDos0016/z2,DrDos0016/z2 | ---
+++
@@ -0,0 +1,18 @@
+# Generated by Django 3.2.7 on 2021-10-28 19:02
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('museum_site', '0003_auto_20211028_1858'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model... | |
81e3cc0800793b9e540066831b72ab6df3a1d358 | scripts/add_user.py | scripts/add_user.py | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Script to add a new user."""
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from apps import db
from apps.models.models import *
def main():
# Add user
name = input("Name: ")
passwd = input("Passwor... | Add a script to add manually a new user | [UPD] Add a script to add manually a new user
| Python | mit | frapac/bibtex-browser,frapac/bibtex-browser,frapac/bibtex-browser | ---
+++
@@ -0,0 +1,26 @@
+# !/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+"""Script to add a new user."""
+
+import os
+import sys
+
+sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
+from apps import db
+from apps.models.models import *
+
+
+def main():
+ # Add user
+ name = ... | |
0e562045ad47f55f799054dd29c51a465ac926a3 | python/array/RemoveDuplicatesFromSortedArrayII.py | python/array/RemoveDuplicatesFromSortedArrayII.py | #Too many mistakes were made.
#0. should use while loop instead of for.
#1. messed up with index. maybe with the sleepy head at 3pm
class Solution:
# @param a list of integers
# @return an integer
def removeDuplicates(self, A):
result = len(A)
if result == 0:
return result
... | Remove Duplicates From Sorted Array II | Remove Duplicates From Sorted Array II
| Python | mit | sureleo/leetcode,sureleo/leetcode,lsingal/leetcode,sureleo/leetcode,lsingal/leetcode,lsingal/leetcode | ---
+++
@@ -0,0 +1,42 @@
+#Too many mistakes were made.
+#0. should use while loop instead of for.
+#1. messed up with index. maybe with the sleepy head at 3pm
+class Solution:
+ # @param a list of integers
+ # @return an integer
+ def removeDuplicates(self, A):
+ result = len(A)
+ if result ==... | |
bb9e626b3d8d8d83aa3d0eb951b5610041ce6070 | paasta_tools/contrib/check_registered_slaves_aws.py | paasta_tools/contrib/check_registered_slaves_aws.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import unicode_literals
import argparse
import sys
from paasta_tools.autoscaling.autoscaling_cluster_lib import get_sfr
from paasta_tools.autoscaling.autoscaling_cluster_lib import get_sfr_slaves
from paasta_tools.autoscaling.autoscaling_clu... | Check AWS instances register in mesos | Check AWS instances register in mesos
This is a quick attempt to give us visibility of AWS resources that
don't end up registering in mesos.
This covers a lot of potential problems with the bootstrap process.
This could be better:
* maybe should check how long a resource has been hanging around for
* also check ASGs... | Python | apache-2.0 | somic/paasta,Yelp/paasta,Yelp/paasta,somic/paasta | ---
+++
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
+import argparse
+import sys
+
+from paasta_tools.autoscaling.autoscaling_cluster_lib import get_sfr
+from paasta_tools.autoscaling.autoscaling_cluster_lib import get_sfr_slaves
+from paa... | |
b5abd635f5aee8c6a89aa51136e49913e41d256a | pyxform/tests_v1/test_validate_unicode_exception.py | pyxform/tests_v1/test_validate_unicode_exception.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pyxform.tests_v1.pyxform_test_case import PyxformTestCase
class ValidateUnicodeException(PyxformTestCase):
"""
Validation errors may include non-ASCII characters. In particular, ODK Validate
uses ͎ (small arrow) to indicate where a problem starts.
"""... | Add test for unicode characters in Validate errors | Add test for unicode characters in Validate errors
| Python | bsd-2-clause | XLSForm/pyxform,XLSForm/pyxform | ---
+++
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from pyxform.tests_v1.pyxform_test_case import PyxformTestCase
+
+class ValidateUnicodeException(PyxformTestCase):
+ """
+ Validation errors may include non-ASCII characters. In particular, ODK Validate
+ uses ͎ (small arrow) to indi... | |
5d1bad7ebb1121349d08260554368553c02d1a37 | fuzzing/fuzz_websocket_parser.py | fuzzing/fuzz_websocket_parser.py | import sys
import atheris
with atheris.instrument_imports():
from websockets.exceptions import PayloadTooBig, ProtocolError
from websockets.frames import Frame
from websockets.streams import StreamReader
def test_one_input(data):
fdp = atheris.FuzzedDataProvider(data)
mask = fdp.ConsumeBool()
... | Add fuzz target for WebSocket parser. | Add fuzz target for WebSocket parser.
| Python | bsd-3-clause | aaugustin/websockets,aaugustin/websockets,aaugustin/websockets,aaugustin/websockets | ---
+++
@@ -0,0 +1,46 @@
+import sys
+
+import atheris
+
+
+with atheris.instrument_imports():
+ from websockets.exceptions import PayloadTooBig, ProtocolError
+ from websockets.frames import Frame
+ from websockets.streams import StreamReader
+
+
+def test_one_input(data):
+ fdp = atheris.FuzzedDataProvi... | |
632b5b3fedef17b908cb29d777b52b69d2127da1 | actstream/migrations/0003_auto_20160528_1411.py | actstream/migrations/0003_auto_20160528_1411.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-28 14:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('actstream', '0002_remove_action_data'),
]
operations = [
migrations.AlterFie... | Add migration for changes to model | Add migration for changes to model
| Python | bsd-3-clause | jrsupplee/django-activity-stream,jrsupplee/django-activity-stream | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.6 on 2016-05-28 14:11
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('actstream', '0002_remove_action_data'),
+ ]
+
+ o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.