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
1249c0674ec226d5513b5004f0d512fbc5ce1d61
scuole/states/migrations/0002_auto_20150508_1614.py
scuole/states/migrations/0002_auto_20150508_1614.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def create_texas(apps, schema_editor): State = apps.get_model('states', 'State') State.objects.create( name='Texas', slug='texas', ) class Migration(migrations.Migration): dependencies...
Add data migration for Texas State model
Add data migration for Texas State model
Python
mit
texastribune/scuole,texastribune/scuole,texastribune/scuole,texastribune/scuole
--- +++ @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +def create_texas(apps, schema_editor): + State = apps.get_model('states', 'State') + + State.objects.create( + name='Texas', + slug='texas', + ) + + +class Migrati...
303f79be64f9174aa7a60787a2d7e5598d353d0d
userprofile/migrations/0041_auto_20210428_1823.py
userprofile/migrations/0041_auto_20210428_1823.py
# Generated by Django 3.1.2 on 2021-04-28 18:23 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('userprofile', '0040_auto_20200315_1428'), ] operations = [ migrations.AlterModelOptions( name='profile', options={'permissio...
Add migration for member permission
Add migration for member permission
Python
mit
hackerspace-ntnu/website,hackerspace-ntnu/website,hackerspace-ntnu/website
--- +++ @@ -0,0 +1,17 @@ +# Generated by Django 3.1.2 on 2021-04-28 18:23 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('userprofile', '0040_auto_20200315_1428'), + ] + + operations = [ + migrations.AlterModelOptions( + name='...
2b3879b448885a471d305360f1bcf447b390755d
datasets/management/commands/load_freesound_examples.py
datasets/management/commands/load_freesound_examples.py
from django.core.management.base import BaseCommand import json from datasets.models import Dataset, Sound class Command(BaseCommand): help = 'Load examples from json taxonomy file. Use it as python manage.py load_freesound_false_examples ' \ 'DATASET_ID PATH/TO/TAOXNOMY_FILE.json' def add_argumen...
Add command load freesound examples
Add command load freesound examples
Python
agpl-3.0
MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets
--- +++ @@ -0,0 +1,27 @@ +from django.core.management.base import BaseCommand +import json +from datasets.models import Dataset, Sound + + +class Command(BaseCommand): + help = 'Load examples from json taxonomy file. Use it as python manage.py load_freesound_false_examples ' \ + 'DATASET_ID PATH/TO/TAOXN...
3c28f3c79893da231e8853f88adce6dbdaa206dc
apps/companyprofile/migrations/0003_company_image.py
apps/companyprofile/migrations/0003_company_image.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('gallery', '0002_auto_20150916_1953'), ('companyprofile', '0002_auto_20151014_2132'), ] operations = [ migrations.Add...
Add new image field migration
Add new image field migration
Python
mit
dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('gallery', '0002_auto_20150916_1953'), + ('companyprofile', '0002_auto_20151014_2132'), + ] + +...
d97ba0e4d71a89f346b2ece699134975ef97dd7f
wc_hist.py
wc_hist.py
# Create a histogram for word count data # Dan Kolbman 2014 import sys import numpy as np import matplotlib.pyplot as plt import matplotlib font = {'family' : 'normal', 'weight' : 'bold', 'size' : 28} matplotlib.rc('font', **font) def main( path ): wc = [] pct = [] # Read wc data with ope...
Add histogram for bio word counts
Add histogram for bio word counts
Python
mit
dankolbman/CleverTind,dankolbman/CleverTind
--- +++ @@ -0,0 +1,70 @@ +# Create a histogram for word count data +# Dan Kolbman 2014 +import sys +import numpy as np +import matplotlib.pyplot as plt +import matplotlib + +font = {'family' : 'normal', + 'weight' : 'bold', + 'size' : 28} + +matplotlib.rc('font', **font) + +def main( path ): + + wc ...
d6651c4c5be5074c45c54b0f8fd844cd25837a7b
ocradmin/storage/utils.py
ocradmin/storage/utils.py
""" Utils for document storage. """ import json from . import base class DocumentEncoder(json.JSONEncoder): """ Encoder for JSONifying documents. """ def default(self, doc): """Flatten node for JSON encoding.""" if issubclass(doc.__class__, base.BaseDocument): return dict( ...
Add a (basic) JSON encoder for documents
Add a (basic) JSON encoder for documents
Python
apache-2.0
vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium
--- +++ @@ -0,0 +1,22 @@ +""" +Utils for document storage. +""" + +import json +from . import base + +class DocumentEncoder(json.JSONEncoder): + """ + Encoder for JSONifying documents. + """ + def default(self, doc): + """Flatten node for JSON encoding.""" + if issubclass(doc.__class__, base...
e41172d55df9f1a0cb142b6a59625eef59dfa519
common/lib/xmodule/xmodule/tests/test_capa_module.py
common/lib/xmodule/xmodule/tests/test_capa_module.py
import json from mock import Mock import unittest from xmodule.capa_module import CapaModule from xmodule.modulestore import Location from lxml import etree from . import test_system class CapaFactory(object): """ A helper class to create problem modules with various parameters for testing. """ samp...
Add start of test framework for capa
Add start of test framework for capa
Python
agpl-3.0
utecuy/edx-platform,fintech-circle/edx-platform,chand3040/cloud_that,halvertoluke/edx-platform,vasyarv/edx-platform,longmen21/edx-platform,motion2015/edx-platform,mjirayu/sit_academy,ZLLab-Mooc/edx-platform,pomegranited/edx-platform,nanolearning/edx-platform,morenopc/edx-platform,ZLLab-Mooc/edx-platform,nanolearning/ed...
--- +++ @@ -0,0 +1,60 @@ +import json +from mock import Mock +import unittest + +from xmodule.capa_module import CapaModule +from xmodule.modulestore import Location +from lxml import etree + +from . import test_system + +class CapaFactory(object): + """ + A helper class to create problem modules with various p...
8b90c944678877ce9d68780590ad28573bf617a8
tests/formats_test/misc_test.py
tests/formats_test/misc_test.py
import unittest from blivet.formats.fs import * from blivet.size import Size class FSOverheadTestCase(unittest.TestCase): def test_required_size_FS(self): # FS is abstract parent which doesn't have metadata self.assertEqual(FS.get_required_size(Size("100 MiB")), Size("100 MiB")) self.asse...
Add tests for FS overhead methods
Add tests for FS overhead methods (ported from commit 9accd0e360ed4bede667b5f8a608e8c519ebd831)
Python
lgpl-2.1
vojtechtrefny/blivet,jkonecny12/blivet,jkonecny12/blivet,rhinstaller/blivet,vpodzime/blivet,vojtechtrefny/blivet,AdamWill/blivet,rhinstaller/blivet,AdamWill/blivet,vpodzime/blivet,rvykydal/blivet,rvykydal/blivet
--- +++ @@ -0,0 +1,26 @@ +import unittest + +from blivet.formats.fs import * +from blivet.size import Size + +class FSOverheadTestCase(unittest.TestCase): + + def test_required_size_FS(self): + # FS is abstract parent which doesn't have metadata + self.assertEqual(FS.get_required_size(Size("100 MiB")...
a8497dcbeaa9d39a98402c6e46c86cd10c7d4de3
tests/unit/client_regression.py
tests/unit/client_regression.py
"""Unit tests for the client library. TODO: we have plans to move ./client.py to integration/, since those are really integration tests. Once that's done we should move this to ./client.py; it's here now to avoid name collisions/conflicts. """ import flask import pytest from schema import Schema from hil import conf...
Add a regression test for the error-silencing issue.
Add a regression test for the error-silencing issue.
Python
apache-2.0
CCI-MOC/haas
--- +++ @@ -0,0 +1,56 @@ +"""Unit tests for the client library. + +TODO: we have plans to move ./client.py to integration/, since those +are really integration tests. Once that's done we should move this to +./client.py; it's here now to avoid name collisions/conflicts. +""" + +import flask +import pytest +from schem...
a96046b4b7372cb942509b5e9778d54124319617
bin/rofi_menu.py
bin/rofi_menu.py
from typing import Dict, Callable from rofi import Rofi def menu(r: Rofi, prompt: str, options: Dict[str, Callable], *args, **kwargs): """ Create a menu using rofi to execute on of some options, all args not documented are passed directly into Rofi.select :param options: A dict of strings to show o...
Add a common helper for selection menus
[rofi] Add a common helper for selection menus
Python
mit
mpardalos/dotfiles,mpardalos/dotfiles
--- +++ @@ -0,0 +1,21 @@ +from typing import Dict, Callable +from rofi import Rofi + +def menu(r: Rofi, prompt: str, options: Dict[str, Callable], *args, **kwargs): + """ + Create a menu using rofi to execute on of some options, all args not documented + are passed directly into Rofi.select + :param o...
096424ea7809e5512a932c79eff6676695c1d27e
telethon/network/connection/connection.py
telethon/network/connection/connection.py
import abc import asyncio class Connection(abc.ABC): """ The `Connection` class is a wrapper around ``asyncio.open_connection``. Subclasses are meant to communicate with this class through a queue. This class provides a reliable interface that will stay connected under any conditions for as long...
Create a new Connection class to work through queues
Create a new Connection class to work through queues
Python
mit
LonamiWebs/Telethon,expectocode/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon
--- +++ @@ -0,0 +1,96 @@ +import abc +import asyncio + + +class Connection(abc.ABC): + """ + The `Connection` class is a wrapper around ``asyncio.open_connection``. + + Subclasses are meant to communicate with this class through a queue. + + This class provides a reliable interface that will stay connecte...
35942980d9cd25be3ca6b28ab1eec92f55556f5f
snippet/example/python/ratelimit.py
snippet/example/python/ratelimit.py
import time from threading import Thread from queue import Queue class RateLimiter: def __init__(self, limit, delay=0.01): num = int(limit * delay) if num < 1: raise ValueError("limit * delay < 1") self._limit_num = limit self._delay = delay self._num_per_dela...
Add the python rate limiting example
Add the python rate limiting example
Python
mit
xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet
--- +++ @@ -0,0 +1,42 @@ +import time + +from threading import Thread +from queue import Queue + + +class RateLimiter: + def __init__(self, limit, delay=0.01): + num = int(limit * delay) + if num < 1: + raise ValueError("limit * delay < 1") + + self._limit_num = limit + self....
35ea2314cb8620020726627810b7aade27fba14b
sdoutil.py
sdoutil.py
import logging logging.basicConfig(level=logging.INFO) # dev_appserver.py --log_level debug . log = logging.getLogger(__name__) import io import threading from google.appengine.api import app_identity from google.appengine.api import mail def sdo_send_mail(to=None,subject=None,msg=None): if not to: log.e...
Move some shared functionality into util file
Move some shared functionality into util file
Python
apache-2.0
vholland/schemaorg,vholland/schemaorg,vholland/schemaorg,schemaorg/schemaorg,vholland/schemaorg,schemaorg/schemaorg,schemaorg/schemaorg,schemaorg/schemaorg,schemaorg/schemaorg
--- +++ @@ -0,0 +1,51 @@ +import logging +logging.basicConfig(level=logging.INFO) # dev_appserver.py --log_level debug . +log = logging.getLogger(__name__) + +import io +import threading + + +from google.appengine.api import app_identity +from google.appengine.api import mail +def sdo_send_mail(to=None,subject=None,m...
2894e0b8c99e57f5318987309cf2d5861a82d560
custom/enikshay/management/commands/bad_private_episodes.py
custom/enikshay/management/commands/bad_private_episodes.py
from __future__ import absolute_import, print_function import csv import datetime import six from django.core.management.base import BaseCommand from corehq.form_processor.interfaces.dbaccessors import CaseAccessors from corehq.util.log import with_progress_bar from custom.enikshay.case_utils import ( get_all_ep...
Add management command to find bad case structures
Add management command to find bad case structures
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,51 @@ +from __future__ import absolute_import, print_function + +import csv +import datetime + +import six +from django.core.management.base import BaseCommand + +from corehq.form_processor.interfaces.dbaccessors import CaseAccessors +from corehq.util.log import with_progress_bar +from custom.eniks...
de3c03af76ebb4f092f798a390a463fe78cc27f0
examples/device/audio_test/src/plot_audio_samples.py
examples/device/audio_test/src/plot_audio_samples.py
import sounddevice as sd import matplotlib.pyplot as plt import numpy as np if __name__ == '__main__': # devList = sd.query_devices() # print(devList) fs = 48000 # Sample rate duration = 100e-3 # Duration of recording device = 'Microphone (MicNode) MME' # MME is needed since ...
Add python script to plot audio sample data.
Add python script to plot audio sample data.
Python
mit
hathach/tinyusb,hathach/tinyusb,hathach/tinyusb
--- +++ @@ -0,0 +1,24 @@ +import sounddevice as sd +import matplotlib.pyplot as plt +import numpy as np + +if __name__ == '__main__': + + # devList = sd.query_devices() + # print(devList) + + fs = 48000 # Sample rate + duration = 100e-3 # Duration of recording + device = 'Microphone ...
0c3f5008dd66b0bb8dfd2a4993def7d0c7a5bf84
greyjay/articles/migrations/0091_articlepage_reading_time.py
greyjay/articles/migrations/0091_articlepage_reading_time.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-05-03 18:13 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('articles', '0090_auto_20170502_1621'), ] operations = [ migrations.AddField...
Add reading_time to article pages.
Add reading_time to article pages.
Python
mit
CIGIHub/greyjay,CIGIHub/greyjay,CIGIHub/greyjay
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2017-05-03 18:13 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('articles', '0090_auto_20170502_1621'), + ] + + o...
bef2796fc1df98d15c7198ee26b2526f42150b59
infrastructure/migrations/0016_auto_20210907_0131.py
infrastructure/migrations/0016_auto_20210907_0131.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2021-09-06 23:31 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('infrastructure', '0015_financialyear_active'), ] ...
Add migration for annual spend changes
Add migration for annual spend changes
Python
mit
Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data
--- +++ @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.29 on 2021-09-06 23:31 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('infrastructure', '0...
35eff67c8be55abb452181d035d081739fecbf8f
test/ut/test_plugin_text.py
test/ut/test_plugin_text.py
#!/usr/bin/env python3 #-*- encoding: utf-8 -*- import os, sys, tempfile, unittest import lxml.etree as etree ECMDS_INSTALL_DIR = os.path.normpath(os.path.join( os.path.dirname(os.path.realpath(sys.argv[0])), "..", ".." )) sys.path.insert(1, ECMDS_INSTALL_DIR + os.sep + 'lib') from net.ecromedos.error impor...
Add test for text plugin
Add test for text plugin
Python
mit
tobijk/ecromedos,tobijk/ecromedos
--- +++ @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +#-*- encoding: utf-8 -*- + +import os, sys, tempfile, unittest +import lxml.etree as etree + +ECMDS_INSTALL_DIR = os.path.normpath(os.path.join( + os.path.dirname(os.path.realpath(sys.argv[0])), + "..", ".." +)) + +sys.path.insert(1, ECMDS_INSTALL_DIR + os.sep +...
c465ecc0db52132c5c1692eb57f6cba8d70ce800
Artifactorial/migrations/0006_directory_on_delete.py
Artifactorial/migrations/0006_directory_on_delete.py
# Generated by Django 2.2.3 on 2019-08-06 09:42 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [("Artifactorial", "0005_share_user")] operations = [ migrations.AlterField( m...
Add missing migration after Django upgrade
Add missing migration after Django upgrade
Python
mit
ivoire/Artifactorial,ivoire/Artifactorial,ivoire/Artifactorial
--- +++ @@ -0,0 +1,33 @@ +# Generated by Django 2.2.3 on 2019-08-06 09:42 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [("Artifactorial", "0005_share_user")] + + operations = [ + ...
46ceb59f9e2c7cd20f3c20a6d79c360243eed06e
src/scripts/create_conll.py
src/scripts/create_conll.py
#!/usr/bin/env python3 """"Create a CoNLL corpus from FrameNet fulltext data tokens This CoNLL corpus will then be lemmatized using WordNet, and parsed using TurboParser. """ from pathlib import Path from xml.etree import ElementTree as ET import os from nltk.corpus import wordnet from paths import FRAMENET_FULLTE...
Add script to create CoNLL corpus from FN fulltext
Add script to create CoNLL corpus from FN fulltext
Python
agpl-3.0
aymara/knowledgesrl,aymara/knowledgesrl
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 + +""""Create a CoNLL corpus from FrameNet fulltext data tokens + +This CoNLL corpus will then be lemmatized using WordNet, and parsed using +TurboParser. +""" + +from pathlib import Path +from xml.etree import ElementTree as ET +import os + +from nltk.corpus import wo...
1b10e46754d2bc7783ff14632f145203db5bb67e
features/contributions/migrations/0002_auto_20170309_1515.py
features/contributions/migrations/0002_auto_20170309_1515.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-09 14:15 from __future__ import unicode_literals from django.db import migrations def copy_texts(apps, schema_editor): ContentType = apps.get_model('contenttypes.ContentType') Contribution = apps.get_model('contributions.Contribution') Contr...
Add migration to copy texts to contributions
Add migration to copy texts to contributions
Python
agpl-3.0
stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten
--- +++ @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-03-09 14:15 +from __future__ import unicode_literals + +from django.db import migrations + + +def copy_texts(apps, schema_editor): + ContentType = apps.get_model('contenttypes.ContentType') + Contribution = apps.get_model('c...
8370a3419144b63461f4add0003292d7d5d9f03e
glitter/blocks/banner/migrations/0004_delete_empty_blocks.py
glitter/blocks/banner/migrations/0004_delete_empty_blocks.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models def remove_empty_blocks(apps, schema_editor): BannerBlock = apps.get_model('glitter_banner', 'BannerBlock') ContentBlock = apps.get_model('glitter', 'ContentBlock') empty_blocks = BannerBlock.objects...
Clean up banner blocks without inlines
Clean up banner blocks without inlines
Python
bsd-3-clause
developersociety/django-glitter,developersociety/django-glitter,blancltd/django-glitter,blancltd/django-glitter,blancltd/django-glitter,developersociety/django-glitter
--- +++ @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +def remove_empty_blocks(apps, schema_editor): + BannerBlock = apps.get_model('glitter_banner', 'BannerBlock') + ContentBlock = apps.get_model('glitter', 'ContentBlock') + +...
c5b4b6b8cea87e382d4b411139d822fbcabe5248
thinc/tests/unit/test_hash_embed.py
thinc/tests/unit/test_hash_embed.py
import pytest import numpy from ...neural._classes.hash_embed import HashEmbed def test_init(): model = HashEmbed(64, 1000) assert model.nV == 1000 assert model.nO == 64 assert model.vectors.shape == (1000, 64) #assert model.word_weights.shape == (1000,) def test_seed_changes_bucket(): mode...
Add HashEmbed class and tests
Add HashEmbed class and tests
Python
mit
spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc
--- +++ @@ -0,0 +1,23 @@ +import pytest +import numpy + +from ...neural._classes.hash_embed import HashEmbed + + +def test_init(): + model = HashEmbed(64, 1000) + assert model.nV == 1000 + assert model.nO == 64 + assert model.vectors.shape == (1000, 64) + #assert model.word_weights.shape == (1000,) + +...
107976a8f6fab4e46eeaab0659237380624ee091
results/migrations/0018_fix_2015_resultevent_winners.py
results/migrations/0018_fix_2015_resultevent_winners.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def fix_2015_winners(apps, schema_editor): ResultEvent = apps.get_model('results', 'ResultEvent') Person = apps.get_model('popolo', 'Person') for re in ResultEvent.objects.filter(election__slug=2015): ...
Fix the 2015 ResultEvent winners
Fix the 2015 ResultEvent winners Due to a bad data migration in the past, all ResultEvent objects for the 2015 general election were associated with the Person with ID 1. This data migration fixes the winner field on the results.
Python
agpl-3.0
DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative
--- +++ @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +def fix_2015_winners(apps, schema_editor): + ResultEvent = apps.get_model('results', 'ResultEvent') + Person = apps.get_model('popolo', 'Person') + for re in ResultEvent.objects...
8299d4bf1705571ad789459c07abbd32733c8a18
tests/test_geant4_compat.py
tests/test_geant4_compat.py
import sys import os sys.path = [os.path.join(os.path.dirname(__file__), "..")] + sys.path from physt import h1, h2, histogramdd from physt.compat import geant4 import numpy as np import pytest class TestGeant4Compat(object): def test_read_h1(self): path = os.path.join(os.path.dirname(__file__), "data/gea...
Test for Geant4 (better ones for 2D would be nice)
Test for Geant4 (better ones for 2D would be nice)
Python
mit
janpipek/physt
--- +++ @@ -0,0 +1,25 @@ +import sys +import os +sys.path = [os.path.join(os.path.dirname(__file__), "..")] + sys.path +from physt import h1, h2, histogramdd +from physt.compat import geant4 +import numpy as np +import pytest + + +class TestGeant4Compat(object): + def test_read_h1(self): + path = os.path.jo...
39615b2da86743565f80ce99fa92de16b9500e3e
taiga/projects/migrations/0044_auto_20160531_1150.py
taiga/projects/migrations/0044_auto_20160531_1150.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-05-31 11:50 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('projects', '0043_auto_20160530_1004'), ] operations = [ migrations.AlterFiel...
Fix migrations between master and stable
[Backport] Fix migrations between master and stable
Python
agpl-3.0
taigaio/taiga-back,xdevelsistemas/taiga-back-community,xdevelsistemas/taiga-back-community,dayatz/taiga-back,taigaio/taiga-back,dayatz/taiga-back,xdevelsistemas/taiga-back-community,dayatz/taiga-back,taigaio/taiga-back
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.2 on 2016-05-31 11:50 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0043_auto_20160530_1004'), + ] + + op...
aceba92f510b367ffe17c720e602e767e0bb4457
Infinite_while_example.py
Infinite_while_example.py
#!/usr/bin/env python3 start = int(input("Enter the starting index: ")) end = int(input("Enter the last index: ")) if start > end: print("Invalid starting and last index !") else: print("The numbers from ",start,"till ",end,"are:") #Infinite While loop case while(True): if start > end: ...
Add solution to Infinite While loop
Add solution to Infinite While loop
Python
mit
khusi-anu/dgplug-python
--- +++ @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +start = int(input("Enter the starting index: ")) +end = int(input("Enter the last index: ")) + +if start > end: + print("Invalid starting and last index !") +else: + print("The numbers from ",start,"till ",end,"are:") + + #Infinite While loop case + ...
2cda4506be6b39442607eb24e0ec2ee7f11fcdc0
teami18n/teami18n/migrations/0002_populate_countries.py
teami18n/teami18n/migrations/0002_populate_countries.py
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import DataMigration from django.db import models from django_countries import countries from ..models import Country class Migration(DataMigration): def forwards(self, orm): for code, __ in countries: country = Co...
Add migration to create all country objects
Add migration to create all country objects
Python
mit
team-i18n/hackaway,team-i18n/hackaway,team-i18n/hackaway
--- +++ @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import DataMigration +from django.db import models +from django_countries import countries + +from ..models import Country + + +class Migration(DataMigration): + + def forwards(self, orm): + for code, ...
2ad125802c3508be830f860154ad48a2153fe898
warehouse/database/utils.py
warehouse/database/utils.py
def table_args(args): def wrapper(cls): targs = args bases = cls.__mro__[1:] for base in bases: if hasattr(base, "__table_args__"): targs = targs + base.__table_args__ return targs return wrapper
Add utility function for grabbing __table_args__
Add utility function for grabbing __table_args__
Python
bsd-2-clause
davidfischer/warehouse
--- +++ @@ -0,0 +1,11 @@ +def table_args(args): + def wrapper(cls): + targs = args + bases = cls.__mro__[1:] + + for base in bases: + if hasattr(base, "__table_args__"): + targs = targs + base.__table_args__ + + return targs + return wrapper
52e650a9181ce1e8bd8a2c0b1281f81bf6747874
calvin/actorstore/systemactors/std/ClassicDelay.py
calvin/actorstore/systemactors/std/ClassicDelay.py
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ericsson AB # # 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 ...
Add actor with behavior similar to old-style Delay
Add actor with behavior similar to old-style Delay
Python
apache-2.0
EricssonResearch/calvin-base,les69/calvin-base,les69/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base,les69/calvin-base,EricssonResearch/calvin-base,les69/calvin-base
--- +++ @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2015 Ericsson AB +# +# 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....
8206cded6a14dca1b7353add337b5a88e5e05422
Python/cali_first_guess.py
Python/cali_first_guess.py
#!/usr/bin/env python # Usage: cali_first_guess [shift] [slope] [sigma] [multiple] [offset] # Units are: [Ang.] [???] [km/s?] [None] [Norm.] # Reasonable defaults: 0.001 -0.002 3.0 1.37 0.002 import sys import json #print 'Number of arguments:', len(sys.argv), 'arguments.' #print ...
Add python script for creating first guesses.
Add python script for creating first guesses.
Python
mit
jbwhit/CaliCompari
--- +++ @@ -0,0 +1,38 @@ +#!/usr/bin/env python + +# Usage: cali_first_guess [shift] [slope] [sigma] [multiple] [offset] +# Units are: [Ang.] [???] [km/s?] [None] [Norm.] +# Reasonable defaults: 0.001 -0.002 3.0 1.37 0.002 + +import sys +import json + +#print 'Number of arguments:'...
51fa226d7b1d7d70d42127f1ff1f80848a9a6366
py/desimodel/test/test_seeing.py
py/desimodel/test/test_seeing.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- """Test desimodel.seeing. """ from __future__ import print_function, division import unittest import numpy as np from ..seeing import relative_probability, sample class TestSeeing(unittest.TestCase): """Test desimodel.seeing....
Add unit test for seeing module
Add unit test for seeing module
Python
bsd-3-clause
desihub/desimodel,desihub/desimodel
--- +++ @@ -0,0 +1,47 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +# -*- coding: utf-8 -*- +"""Test desimodel.seeing. +""" +from __future__ import print_function, division + +import unittest +import numpy as np +from ..seeing import relative_probability, sample + + +class TestSeeing(unittest.T...
91736e7a7cc2510bb2c9a7a6c7930ea30d9be388
py/intersection-of-two-arrays.py
py/intersection-of-two-arrays.py
class Solution(object): def intersection(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ return list(set(nums1) & set(nums2))
Add py solution for 349. Intersection of Two Arrays
Add py solution for 349. Intersection of Two Arrays 349. Intersection of Two Arrays: https://leetcode.com/problems/intersection-of-two-arrays/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,8 @@ +class Solution(object): + def intersection(self, nums1, nums2): + """ + :type nums1: List[int] + :type nums2: List[int] + :rtype: List[int] + """ + return list(set(nums1) & set(nums2))
ed8bf4ce4c8901af093e494cb6811a1ccf4660ba
website/tests/test_blog.py
website/tests/test_blog.py
## # Copyright (C) 2014 Jessica Tallon & Matt Molyneaux # # This file is part of Inboxen. # # Inboxen is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, o...
Test blog rendering and posting
Test blog rendering and posting
Python
agpl-3.0
Inboxen/Inboxen,Inboxen/Inboxen,Inboxen/Inboxen,Inboxen/Inboxen
--- +++ @@ -0,0 +1,64 @@ +## +# Copyright (C) 2014 Jessica Tallon & Matt Molyneaux +# +# This file is part of Inboxen. +# +# Inboxen is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation,...
8e4c58eabe2160b79044f6cc8d0cc04844b4c59f
Graphs/breadthFirstSearch.py
Graphs/breadthFirstSearch.py
#!/usr/local/bin/python # edX Intro to Computational Thinking and Data Science # Graphs - Breadth First Search to find shortest path lecture code import graphs def printPath(path): """Assumes path is a list of nodes""" result = '' for i in range(len(path)): result += str(path[i]) if i != ...
Add breadth first search for graphs
Add breadth first search for graphs
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,61 @@ +#!/usr/local/bin/python +# edX Intro to Computational Thinking and Data Science +# Graphs - Breadth First Search to find shortest path lecture code + +import graphs + + +def printPath(path): + """Assumes path is a list of nodes""" + result = '' + for i in range(len(path)): + ...
58ddb21bb245878d6358de6dd40ba4725414eb6a
greengrapher.py
greengrapher.py
from argparse import ArgumentParser from greengraph import Greengraph from matplotlib import pyplot as plt if __name__ == "__main__": parser = ArgumentParser(description = "Plot the amount of green space \ between two locations") parser.add_argument('--start') parser.add_argument('--end') parse...
Add a command line interface.
Add a command line interface.
Python
apache-2.0
paulsbrookes/greengraph
--- +++ @@ -0,0 +1,24 @@ +from argparse import ArgumentParser +from greengraph import Greengraph +from matplotlib import pyplot as plt + +if __name__ == "__main__": + parser = ArgumentParser(description = "Plot the amount of green space \ + between two locations") + parser.add_argument('--start') + pa...
fc56abad64ae9601b3ae2ef9fa4e55134041597a
active_redis/active_redis.py
active_redis/active_redis.py
def defaultConfig(*args, **kwargs): """Sets the default Redis client configuration.""" class ActiveRedis(object): """ Core class for interacting with Redis via ActiveRedis. """ def __init__(self, *args, **kwargs): try: if isinstance(args[0], Redis): self.redis = args[0] else: ...
Add core Active Redis module.
Add core Active Redis module.
Python
mit
kuujo/active-redis
--- +++ @@ -0,0 +1,40 @@ + +def defaultConfig(*args, **kwargs): + """Sets the default Redis client configuration.""" + +class ActiveRedis(object): + """ + Core class for interacting with Redis via ActiveRedis. + """ + def __init__(self, *args, **kwargs): + try: + if isinstance(args[0], Redis): + s...
9f5adef59a8065f0524cc9c16c2ddc46e46f57cc
google-stt.py
google-stt.py
from scikits.samplerate import resample from tempfile import mkstemp from os import remove import scikits.audiolab as audiolab # if you want make the down sample rate using scipy.signal #import scipy.signal import urllib2 import sys if len(sys.argv)<2 : print 'Usage: %s <audio file.wav>' %sys.argv[0] s...
Add google speech to text sample
Add google speech to text sample
Python
mit
voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts
--- +++ @@ -0,0 +1,47 @@ +from scikits.samplerate import resample +from tempfile import mkstemp +from os import remove +import scikits.audiolab as audiolab +# if you want make the down sample rate using scipy.signal +#import scipy.signal +import urllib2 +import sys + +if len(sys.argv)<2 : + print 'Usage: %s <a...
c269315ec83a0cfc6ec6c5bd58945ba68d6f69f3
analyzarr/ui/custom_tools.py
analyzarr/ui/custom_tools.py
from chaco.tools.api import ScatterInspector from numpy import zeros class PeakSelectionTool(ScatterInspector): def _deselect(self, index=None): super(PeakSelectionTool, self)._deselect(index) self._update_mask() # override this method so that we only select one peak at a time def _sel...
Add missing custom tools file
Add missing custom tools file
Python
bsd-2-clause
msarahan/analyzarr,msarahan/analyzarr
--- +++ @@ -0,0 +1,23 @@ +from chaco.tools.api import ScatterInspector +from numpy import zeros + +class PeakSelectionTool(ScatterInspector): + def _deselect(self, index=None): + super(PeakSelectionTool, self)._deselect(index) + self._update_mask() + + # override this method so that we only se...
6190a721030094d8eb9016fb85cb56e7d451b157
neutronclient/tests/functional/test_subnet_create.py
neutronclient/tests/functional/test_subnet_create.py
# Copyright 2015 Hewlett-Packard Development Company, L.P # # 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...
Add functional test for subnet create
Add functional test for subnet create This test adds a functional test to verify a subnet-create command with the arg order used in the docs. python-neutronclient introduced a regression which broke the usage of this order. This test will prevent this from happening in the future. Change-Id: If7e4211a4cbf33bc87a13045...
Python
apache-2.0
johnpbatty/python-neutronclient,rackerlabs/rackspace-python-neutronclient,venusource/python-neutronclient,Juniper/python-neutronclient,huntxu/python-neutronclient,Juniper/python-neutronclient,cryptickp/python-neutronclient,rackerlabs/rackspace-python-neutronclient,NeCTAR-RC/python-neutronclient,johnpbatty/python-neutro...
--- +++ @@ -0,0 +1,36 @@ +# Copyright 2015 Hewlett-Packard Development Company, L.P +# +# 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...
7afa271a1e8513fa78300f5aee10f4e7b63df293
jupyter_notebook_config.py
jupyter_notebook_config.py
# Configuration file for Jupyter-notebook. # https://github.com/jupyter/docker-demo-images/blob/master/resources/jupyter_notebook_config.partial.py c = get_config() c.NotebookApp.ip = '*' c.NotebookApp.open_browser = False c.NotebookApp.port = 8888 #9999 # Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real...
Add config file TODO: edit to work with IFrames
Add config file TODO: edit to work with IFrames
Python
bsd-3-clause
ProjectPyRhO/Prometheus,ProjectPyRhO/Prometheus,ProjectPyRhO/Prometheus,ProjectPyRhO/Prometheus
--- +++ @@ -0,0 +1,37 @@ +# Configuration file for Jupyter-notebook. +# https://github.com/jupyter/docker-demo-images/blob/master/resources/jupyter_notebook_config.partial.py + +c = get_config() +c.NotebookApp.ip = '*' +c.NotebookApp.open_browser = False +c.NotebookApp.port = 8888 #9999 + +# Whether to trust or not X...
a20507f980328e54adef30af696d7afd01bfd6d2
buffer/tests/test_link.py
buffer/tests/test_link.py
from nose.tools import eq_, raises from mock import MagicMock, patch from buffer.models.link import Link def test_links_shares(): ''' Test link's shares retrieving from constructor ''' mocked_api = MagicMock() mocked_api.get.return_value = {'shares': 123} link = Link(api=mocked_api, url='www.google.co...
Test basic link api call
Test basic link api call
Python
mit
vtemian/buffpy,bufferapp/buffer-python
--- +++ @@ -0,0 +1,16 @@ +from nose.tools import eq_, raises +from mock import MagicMock, patch + +from buffer.models.link import Link + +def test_links_shares(): + ''' + Test link's shares retrieving from constructor + ''' + + mocked_api = MagicMock() + mocked_api.get.return_value = {'shares': 123} + + link ...
778485d7637e9833ab5aea0327b21a77bf2a0c1e
dci/alembic/versions/8a64d57a77d3_add_server_default_to_component_active_.py
dci/alembic/versions/8a64d57a77d3_add_server_default_to_component_active_.py
# # Copyright (C) 2016 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 writin...
Add server_default value to component's active flag.
Add server_default value to component's active flag. This commit adds a server default value to component's active flag in order to update all the components rows of the existing database. Change-Id: Idba7c7e13450378d74904e7e17903c731c9427eb
Python
apache-2.0
redhat-cip/dci-control-server,enovance/dci-control-server,redhat-cip/dci-control-server,enovance/dci-control-server
--- +++ @@ -0,0 +1,38 @@ +# +# Copyright (C) 2016 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 ...
0946ad9e528c3c4485755e26f0a3323902d15a38
bsopener.py
bsopener.py
from bs4 import BeautifulSoup from urllib.request import urlopen from urllib.request import Request from const import constant class BSOpener(object): """ A wrapper arround urllib and BeautifulSoup used a helper for url requests """ # TODO: make this class a singleton class _Const(): """ Contains ...
Add a url opener abstraction module
Add a url opener abstraction module
Python
mit
iluxonchik/lyricist
--- +++ @@ -0,0 +1,27 @@ +from bs4 import BeautifulSoup +from urllib.request import urlopen +from urllib.request import Request +from const import constant + +class BSOpener(object): + """ A wrapper arround urllib and BeautifulSoup used a helper for url requests """ + # TODO: make this class a singleton + + ...
777d06e9048fd67b04deadaca0b05446f4804acd
email_tracker/south_migrations/0003_set_content_types.py
email_tracker/south_migrations/0003_set_content_types.py
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): "Write your forwards methods here." orm.TrackedEmail.objects.filter(body__con...
Add data migration to set correct content type of previously created navs.
Add data migration to set correct content type of previously created navs.
Python
mit
IndustriaTech/django-email-tracker,MagicSolutions/django-email-tracker
--- +++ @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +from south.utils import datetime_utils as datetime +from south.db import db +from south.v2 import DataMigration +from django.db import models + + +class Migration(DataMigration): + + def forwards(self, orm): + "Write your forwards methods here." + or...
bace18ec06e27d36492835fc009c2265b7ac5880
mla_game/apps/transcript/migrations/0018_auto_20171031_1422.py
mla_game/apps/transcript/migrations/0018_auto_20171031_1422.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-10-31 14:22 from __future__ import unicode_literals from django.db import migrations def create_votes(apps, schema_editor): TranscriptPhraseVote = apps.get_model( 'transcript', 'TranscriptPhraseVote' ) TranscriptPhraseCorrection = apps....
Convert 'not an error' corrections to TranscriptPhraseVote objects
Convert 'not an error' corrections to TranscriptPhraseVote objects
Python
mit
WGBH/FixIt,WGBH/FixIt,WGBH/FixIt
--- +++ @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.3 on 2017-10-31 14:22 +from __future__ import unicode_literals + +from django.db import migrations + + +def create_votes(apps, schema_editor): + TranscriptPhraseVote = apps.get_model( + 'transcript', 'TranscriptPhraseVote' + ) ...
23b2723d432fc84bb77f34d55a79b860ade3c62c
opentreemap/treemap/migrations/0045_add_modeling_permission.py
opentreemap/treemap/migrations/0045_add_modeling_permission.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-08-28 15:47 from __future__ import unicode_literals from django.db import migrations from django.db.utils import IntegrityError # Note: to reuse this data migration when adding a new permission # in the future, copy the code and update these three lines: _...
Add modeling permission data migration
Add modeling permission data migration Any permissions defined in code must have a supporting `Permission` row. This migration is unusual because it contains logic that was originally created in a different Django application. As a result, in some environments the change has already been applied. To deal with this si...
Python
agpl-3.0
maurizi/otm-core,maurizi/otm-core,maurizi/otm-core,maurizi/otm-core
--- +++ @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-08-28 15:47 +from __future__ import unicode_literals + +from django.db import migrations +from django.db.utils import IntegrityError + +# Note: to reuse this data migration when adding a new permission +# in the future, copy the c...
93c719f11a42b68d30d8c8229ce5edb22ad0ef95
indra/mock_statement.py
indra/mock_statement.py
class MockStatement(object): def __init__(evidence, mk_hash, supports): self.evidence = evidence self.__mk_hash = mk_hash self.supports = supports self.belief = None def matches_key(): return self.__mk_hash class MockEvidence(object): def __init__(source_api, selec...
Add classes to imitate Statements and Evidence in belief engine.
Add classes to imitate Statements and Evidence in belief engine.
Python
bsd-2-clause
johnbachman/belpy,sorgerlab/indra,bgyori/indra,sorgerlab/indra,bgyori/indra,sorgerlab/belpy,johnbachman/indra,sorgerlab/belpy,johnbachman/indra,pvtodorov/indra,johnbachman/belpy,johnbachman/belpy,pvtodorov/indra,pvtodorov/indra,sorgerlab/indra,johnbachman/indra,sorgerlab/belpy,bgyori/indra,pvtodorov/indra
--- +++ @@ -0,0 +1,19 @@ +class MockStatement(object): + def __init__(evidence, mk_hash, supports): + self.evidence = evidence + self.__mk_hash = mk_hash + self.supports = supports + self.belief = None + + def matches_key(): + return self.__mk_hash + + +class MockEvidence(obje...
7dc02947b33d0319bf849e30ea6c3fac28c78c9a
blanc_basic_pages/context_processors.py
blanc_basic_pages/context_processors.py
from django.utils.functional import SimpleLazyObject from django.contrib.flatpages.models import FlatPage from django.conf import settings from django.utils.safestring import mark_safe def flatpage(request): def get_flatpage(): url = request.path_info # This has no chance of working if no...
Add the lazy_flatpage context processor
Add the lazy_flatpage context processor Allows any non-flatpage to access a flatpage of the same request URL with lazy_flatpage
Python
bsd-3-clause
blancltd/blanc-basic-pages
--- +++ @@ -0,0 +1,28 @@ +from django.utils.functional import SimpleLazyObject +from django.contrib.flatpages.models import FlatPage +from django.conf import settings +from django.utils.safestring import mark_safe + + +def flatpage(request): + def get_flatpage(): + url = request.path_info + + # This ...
64216fcc89b251a64a4ceda5da02ccff5285f548
octohatrack_graphql.py
octohatrack_graphql.py
#!/usr/bin/env python """ Quick implementation of octhatrack with GraphQL USAGE ./octohatrack_graphql.py user/repo LIMITATIONS Limitations in the github graphql api means that this will only return the: - last 100 issues - last 100 comments per issue - last 100 pull requests - last 100 co...
Add proof of concept graphql implementation
Add proof of concept graphql implementation
Python
bsd-3-clause
glasnt/octohat,LABHR/octohatrack
--- +++ @@ -0,0 +1,91 @@ +#!/usr/bin/env python +""" +Quick implementation of octhatrack with GraphQL + + +USAGE + +./octohatrack_graphql.py user/repo + + +LIMITATIONS + +Limitations in the github graphql api means that this will only return the: + - last 100 issues + - last 100 comments per issue + - l...
ef0dd3851f001ebc44484a10d58e6f3f7c5671e1
color_names.py
color_names.py
colors_dict = dict( ENDC = '\033[0m', RED = '\033[31m', GREEN = '\033[32m', GOLD = '\033[33m', BLUE = '\033[34m', PURPLE = '\033[35m', LIGHTBLUE = '\033[36m', GRAY = '\033[37m', RED_BG = '\033[41m', GREEN_BG = '\033[42m', GOLD_BG = '\033[43m', BLUE_BG = '\033[44m', PU...
Add initial version of code.
Add initial version of code.
Python
mit
rec/josh
--- +++ @@ -0,0 +1,42 @@ +colors_dict = dict( + ENDC = '\033[0m', + RED = '\033[31m', + GREEN = '\033[32m', + GOLD = '\033[33m', + BLUE = '\033[34m', + PURPLE = '\033[35m', + LIGHTBLUE = '\033[36m', + GRAY = '\033[37m', + RED_BG = '\033[41m', + GREEN_BG = '\033[42m', + GOLD_BG = '\033...
4052fee38c8616177fa96e35e3a1975211dda7ba
regparser/web/jobs/migrations/0010_auto_20160921_2322.py
regparser/web/jobs/migrations/0010_auto_20160921_2322.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('jobs', '0009_auto_20160824_2347'), ] operations = [ migrations.AlterField( model_name='pipelinejob', ...
Add missing Web API migration file.
Add missing Web API migration file.
Python
cc0-1.0
eregs/regulations-parser,tadhg-ohiggins/regulations-parser,tadhg-ohiggins/regulations-parser,eregs/regulations-parser
--- +++ @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jobs', '0009_auto_20160824_2347'), + ] + + operations = [ + migrations.AlterField( + ...
5bf040c84bb5fddceba0324b409514e8c80e19eb
conda/python-scons/conda.py
conda/python-scons/conda.py
from distutils.version import StrictVersion from distutils.msvccompiler import get_build_version from sys import maxsize from SCons.Script import AddOption, GetOption from path import path import subprocess def generate(env): """Add Builders and construction variables to the Environment.""" if not 'conda' in e...
Add Conda Tool for SCons
Add Conda Tool for SCons
Python
apache-2.0
StatisKit/StatisKit,StatisKit/StatisKit
--- +++ @@ -0,0 +1,66 @@ +from distutils.version import StrictVersion +from distutils.msvccompiler import get_build_version +from sys import maxsize +from SCons.Script import AddOption, GetOption +from path import path +import subprocess + +def generate(env): + """Add Builders and construction variables to the Env...
e5642d8ab1d833896e3011cadcff7eb2eaf02d31
Sketches/MPS/Random/ChatServer.py
Sketches/MPS/Random/ChatServer.py
#!/usr/bin/python import socket import Axon from Kamaelia.Chassis.ConnectedServer import ServerCore from Kamaelia.Chassis.Pipeline import Pipeline from Kamaelia.Util.Console import * from Kamaelia.Util.PureTransformer import PureTransformer from Kamaelia.Apps.Grey.PeriodicWakeup import PeriodicWakeup from Kamaelia.A...
Test server for debugging a memory leak
Test server for debugging a memory leak
Python
apache-2.0
sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia
--- +++ @@ -0,0 +1,76 @@ +#!/usr/bin/python + + +import socket +import Axon +from Kamaelia.Chassis.ConnectedServer import ServerCore + +from Kamaelia.Chassis.Pipeline import Pipeline +from Kamaelia.Util.Console import * +from Kamaelia.Util.PureTransformer import PureTransformer +from Kamaelia.Apps.Grey.PeriodicWakeup...
4a8b30a6f4791d690e7cf159a407f0895008f4f3
cafe/patterns/context/__init__.py
cafe/patterns/context/__init__.py
class SessionManager(object): def __init__(self, factory, *args, **kwargs): self._kwargs = kwargs self._args = args self._factory = factory self.session = None def open(self): if self.session is None: self.session = self._factory(*self._args, **self._kwargs) ...
Add a genereic context based session pattern
Add a genereic context based session pattern
Python
apache-2.0
abn/python-cafe
--- +++ @@ -0,0 +1,22 @@ +class SessionManager(object): + def __init__(self, factory, *args, **kwargs): + self._kwargs = kwargs + self._args = args + self._factory = factory + self.session = None + + def open(self): + if self.session is None: + self.session = self._...
9863845fcf84ff17901109b3b355930d128cb632
datasets.py
datasets.py
# -*- coding: utf-8 -*- """ Created on Mon Jan 09 14:01:35 2017 @author: sakurai """ from fuel.schemes import SequentialScheme from fuel.streams import DataStream from random_fixed_size_crop_mod import RandomFixedSizeCrop from cars196_dataset import Cars196Dataset def get_cars196_streams(crop_size=227, load_in_me...
Implement the loader of streams of Cars 196
Implement the loader of streams of Cars 196
Python
mit
ronekko/deep_metric_learning
--- +++ @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +""" +Created on Mon Jan 09 14:01:35 2017 + +@author: sakurai +""" + + +from fuel.schemes import SequentialScheme +from fuel.streams import DataStream +from random_fixed_size_crop_mod import RandomFixedSizeCrop + +from cars196_dataset import Cars196Dataset + + +def ge...
e2fd04bbf886c2893e8addc9543f861dcfd8bb96
Doc/lib/tzinfo-examples.py
Doc/lib/tzinfo-examples.py
from datetime import tzinfo class UTC(tzinfo): """UTC""" def utcoffset(self, dt): return 0 def tzname(self, dt): return "UTC" def dst(self, dt): return 0 class FixedOffset(tzinfo): """Fixed offset in minutes east from UTC.""" def __init__(self, offset, name): ...
Move the examples of concrete tzinfo classes to a separate file, so the verbatim environment does not bollux page breaking.
Move the examples of concrete tzinfo classes to a separate file, so the verbatim environment does not bollux page breaking.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
--- +++ @@ -0,0 +1,51 @@ +from datetime import tzinfo + +class UTC(tzinfo): + """UTC""" + + def utcoffset(self, dt): + return 0 + + def tzname(self, dt): + return "UTC" + + def dst(self, dt): + return 0 + +class FixedOffset(tzinfo): + """Fixed offset in minutes east from UTC.""" + ...
d4187acb33a0f65dfc4bc38f31995e354847dcb3
nodeconductor/users/migrations/0002_invitation_error_message.py
nodeconductor/users/migrations/0002_invitation_error_message.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0001_initial'), ] operations = [ migrations.AddField( model_name='invitation', name='error_...
Add Invitation error message migration
Add Invitation error message migration - WAL-66
Python
mit
opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_n...
61a7dad7c47b25907246524a28252c6e8004a74f
sara_flexbe_states/src/sara_flexbe_states/LogEntity.py
sara_flexbe_states/src/sara_flexbe_states/LogEntity.py
#!/usr/bin/env python # encoding=utf8 from flexbe_core import EventState, Logger from sara_msgs.msg import Entity, Entities class LogEntity(EventState): ''' Print an entity or entities object in Flexbe runtime. Should be only used for debug. ># entity Entity The entity or entities array follow...
Create a state for print an entity in flexbe logger.
Create a state for print an entity in flexbe logger.
Python
bsd-3-clause
WalkingMachine/sara_behaviors,WalkingMachine/sara_behaviors
--- +++ @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# encoding=utf8 + +from flexbe_core import EventState, Logger +from sara_msgs.msg import Entity, Entities + + +class LogEntity(EventState): + ''' + Print an entity or entities object in Flexbe runtime. Should be only used for debug. + ># entity Entit...
085bc060daef833951717eb4d9131397ec056b90
alg_prim_minimum_spanning_tree.py
alg_prim_minimum_spanning_tree.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function def prim(): pass def main(): pass if __name__ == '__main__': main()
Add Prim's minimum spanning tree alg
Add Prim's minimum spanning tree alg
Python
bsd-2-clause
bowen0701/algorithms_data_structures
--- +++ @@ -0,0 +1,14 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +def prim(): + pass + + +def main(): + pass + + +if __name__ == '__main__': + main()
6d4712f5b077d9b00116a1181377584bafe170f2
bluebottle/segments/migrations/0007_auto_20220119_0945.py
bluebottle/segments/migrations/0007_auto_20220119_0945.py
# Generated by Django 2.2.24 on 2022-01-19 08:45 from django.db import migrations def migrate_extra_fields_to_segments(apps, schema_editor): Member = apps.get_model('members', 'Member') SegmentType = apps.get_model('segments', 'SegmentType') Segment = apps.get_model('segments', 'Segment') CustomMembe...
Migrate custom user fields to segments
Migrate custom user fields to segments
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
--- +++ @@ -0,0 +1,70 @@ +# Generated by Django 2.2.24 on 2022-01-19 08:45 + +from django.db import migrations + + +def migrate_extra_fields_to_segments(apps, schema_editor): + Member = apps.get_model('members', 'Member') + SegmentType = apps.get_model('segments', 'SegmentType') + Segment = apps.get_model('s...
e151466d2bf2a5843d683cada3c3d2563c1ab9d5
indra/tests/test_trrust.py
indra/tests/test_trrust.py
from nose.plugins.attrib import attr from indra.sources import trrust from indra.statements import RegulateAmount @attr('slow', 'webservice') def test_process_from_web(): tp = trrust.process_from_web() assert len(tp.statements) > 6200 for stmt in tp.statements: assert isinstance(stmt, RegulateAmou...
Add test for basic consistency
Add test for basic consistency
Python
bsd-2-clause
sorgerlab/belpy,sorgerlab/indra,bgyori/indra,sorgerlab/belpy,pvtodorov/indra,bgyori/indra,johnbachman/indra,sorgerlab/indra,pvtodorov/indra,johnbachman/belpy,pvtodorov/indra,sorgerlab/indra,johnbachman/belpy,johnbachman/indra,johnbachman/belpy,johnbachman/indra,pvtodorov/indra,sorgerlab/belpy,bgyori/indra
--- +++ @@ -0,0 +1,16 @@ +from nose.plugins.attrib import attr +from indra.sources import trrust +from indra.statements import RegulateAmount + + +@attr('slow', 'webservice') +def test_process_from_web(): + tp = trrust.process_from_web() + assert len(tp.statements) > 6200 + for stmt in tp.statements: + ...
3f15d22e126ba902afafce7484a1f7103401e9bb
instrument-classification/generate_audio_samples.py
instrument-classification/generate_audio_samples.py
""" This generates a single-tone audio clip for instrument classification. """ import music21 from music21.chord import Chord from music21.duration import Duration from music21.instrument import Instrument from music21.note import Note from music21.stream import Stream from music21.tempo import MetronomeMark from musi...
Add a script to generate a parametric single-note audio sample.
Add a script to generate a parametric single-note audio sample. It uses the music21 library to produce MIDI which can be synthesized then via fluidsynth. Parameters: pitch (MIDI note number), MIDI instrument, volume, duration, tempo.
Python
mit
bzamecnik/ml,bzamecnik/ml,bzamecnik/ml,bzamecnik/ml-playground,bzamecnik/ml-playground
--- +++ @@ -0,0 +1,55 @@ +""" +This generates a single-tone audio clip for instrument classification. +""" + +import music21 +from music21.chord import Chord +from music21.duration import Duration +from music21.instrument import Instrument +from music21.note import Note +from music21.stream import Stream +from music2...
4a372880df375a030caf7f3e6f688734b402601d
rpi/find_obj.py
rpi/find_obj.py
import io import socket import struct import time import picamera import picamera.array import cv2 import numpy as np client_socket = socket.socket() client_socket.connect(('10.42.0.1', 8000)) height = 240 width = 320 #height = 480 #width = 640 # Accept a single connection and make a file-like object out of it conne...
Add RPI file to find object
Add RPI file to find object
Python
mit
danielmundi/laser-tracking
--- +++ @@ -0,0 +1,71 @@ +import io +import socket +import struct +import time +import picamera +import picamera.array +import cv2 +import numpy as np + +client_socket = socket.socket() +client_socket.connect(('10.42.0.1', 8000)) + +height = 240 +width = 320 +#height = 480 +#width = 640 + +# Accept a single connectio...
ea4857f1f456e5f44d2706b3756c07695b1ee66b
filter_plugins/custom_plugins.py
filter_plugins/custom_plugins.py
# depem: Strip PEM headers and remove all whitespace from string # Usage: {{ foo | depem }} def depem(string): import re return re.sub(r'\s+|(-----(BEGIN|END).*-----)', '', string) class FilterModule(object): def filters(self): return { 'depem': depem, }
Add depem custom filter plugin
Add depem custom filter plugin
Python
apache-2.0
OpenConext/OpenConext-deploy,OpenConext/OpenConext-deploy,OpenConext/OpenConext-deploy,OpenConext/OpenConext-deploy,OpenConext/OpenConext-deploy
--- +++ @@ -0,0 +1,12 @@ +# depem: Strip PEM headers and remove all whitespace from string +# Usage: {{ foo | depem }} + +def depem(string): + import re + return re.sub(r'\s+|(-----(BEGIN|END).*-----)', '', string) + +class FilterModule(object): + def filters(self): + return { + 'depem': depem, + }
526e90b2b47a68f128e3cd618fd67ed6aefeaff5
mysite/profile/management/commands/profile_hourly_tasks.py
mysite/profile/management/commands/profile_hourly_tasks.py
import datetime import logging from django.core.management.base import BaseCommand import mysite.profile.tasks import mysite.search.models import mysite.search.tasks ## FIXME: Move to a search management command? def periodically_check_if_bug_epoch_eclipsed_the_cached_search_epoch(): logging.info("Checking if bu...
import datetime import logging from django.core.management.base import BaseCommand import mysite.profile.tasks import mysite.search.models import mysite.search.tasks ## FIXME: Move to a search management command? def periodically_check_if_bug_epoch_eclipsed_the_cached_search_epoch(): logging.info("Checking if bu...
Remove apparently superfluous call to fill_recommended_bugs_cache.
Remove apparently superfluous call to fill_recommended_bugs_cache.
Python
agpl-3.0
vipul-sharma20/oh-mainline,heeraj123/oh-mainline,willingc/oh-mainline,Changaco/oh-mainline,eeshangarg/oh-mainline,moijes12/oh-mainline,SnappleCap/oh-mainline,sudheesh001/oh-mainline,vipul-sharma20/oh-mainline,openhatch/oh-mainline,nirmeshk/oh-mainline,heeraj123/oh-mainline,mzdaniel/oh-mainline,vipul-sharma20/oh-mainlin...
--- +++ @@ -23,7 +23,6 @@ def handle(self, *args, **options): mysite.profile.tasks.sync_bug_epoch_from_model_then_fill_recommended_bugs_cache() - mysite.profile.tasks.fill_recommended_bugs_cache() # Every 4 hours, clear search cache if (datetime.datetime.utcnow().hour % 4) =...
89172832b94959dd54bc27ea446064f4167c8de1
syntacticframes_project/syntacticframes/migrations/0007_auto_20141106_2121.py
syntacticframes_project/syntacticframes/migrations/0007_auto_20141106_2121.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('syntacticframes', '0006_auto_20141103_0939'), ] operations = [ migrations.AlterModelOptions( name='verbnetclass'...
Migrate DB for fixed tree ordering
Migrate DB for fixed tree ordering
Python
mit
aymara/verbenet-editor,aymara/verbenet-editor,aymara/verbenet-editor
--- +++ @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('syntacticframes', '0006_auto_20141103_0939'), + ] + + operations = [ + migrations.AlterMode...
d143bb49bb632015d69a82adfb9ced6c27a706e7
voltracker/api/versions.py
voltracker/api/versions.py
# Copyright 2012 OpenStack Foundation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
Add voltracker api version display application
Add voltracker api version display application At present, the api only has its first version to support
Python
apache-2.0
vmthunder/volt
--- +++ @@ -0,0 +1,62 @@ +# Copyright 2012 OpenStack Foundation. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/lic...
0ce23f06834c2ba9c7ece89472206e94ea664067
utilities/folderize.py
utilities/folderize.py
""" For labs which were supposed to be submitted as .zip files, but the students submitted multiple flat files. Creates a folder based on their name that matches what gradefast expects, and moves all of the flat files into that folder. """ ext = "\.py" # regex fragment for the filetype import os import re for file in...
Add utility for flat files -> folder
Add utility for flat files -> folder
Python
mit
jhartz/gradefast,jhartz/gradefast,jhartz/gradefast,jhartz/gradefast
--- +++ @@ -0,0 +1,19 @@ +""" +For labs which were supposed to be submitted as .zip files, but the students +submitted multiple flat files. + +Creates a folder based on their name that matches what gradefast expects, +and moves all of the flat files into that folder. +""" +ext = "\.py" # regex fragment for the filety...
6051f6aac666c56941ed3f0c10467762accd25d4
test/test_opencascade_regular_extrusion.py
test/test_opencascade_regular_extrusion.py
# -*- coding: utf-8 -*- """Creates regular cube mesh by extrusion. """ import pygmsh from helpers import compute_volume def test(): x = 5 y = 4 z = 3 x_layers = 10 y_layers = 5 z_layers = 3 geom = pygmsh.opencascade.Geometry() p = geom.add_point([0, 0, 0], 1) _, l, _ = geom.extrud...
Add regular extrusion test case for OpenCASCADE
Add regular extrusion test case for OpenCASCADE
Python
bsd-3-clause
nschloe/python4gmsh
--- +++ @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +"""Creates regular cube mesh by extrusion. +""" +import pygmsh + +from helpers import compute_volume + + +def test(): + x = 5 + y = 4 + z = 3 + x_layers = 10 + y_layers = 5 + z_layers = 3 + geom = pygmsh.opencascade.Geometry() + p = geom.add_p...
fdc1131e1a32c68bfa999f57dad3110457b9be8e
tools/check_distribute.py
tools/check_distribute.py
#!/usr/bin/python '''Examine variables set by parsing input files and determine if they are being distributed to the other nodes or not. This is exceptionally useful for sanity-checking when debugging parallel code.''' import os import re import sys # script resides in the tools subdirectory of the project. tools_di...
Add a small script to check that input options are being distributed.
Add a small script to check that input options are being distributed. A useful sanity check for when doing parallel coding. ;-)
Python
lgpl-2.1
hande-qmc/hande,hande-qmc/hande,hande-qmc/hande,hande-qmc/hande,ruthfranklin/hande,hande-qmc/hande
--- +++ @@ -0,0 +1,78 @@ +#!/usr/bin/python +'''Examine variables set by parsing input files and determine if they are being distributed to the other nodes or not. + +This is exceptionally useful for sanity-checking when debugging parallel code.''' + +import os +import re +import sys + +# script resides in the tools ...
003738065233d9b9834fdc77a25177bd5a7b384e
corehq/apps/data_interfaces/migrations/0021_remove_automaticupdaterule_migrated.py
corehq/apps/data_interfaces/migrations/0021_remove_automaticupdaterule_migrated.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-09-14 12:21 from __future__ import unicode_literals from __future__ import absolute_import from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('data_interfaces', '0020_make_migrated_nullable'), ] ...
Remove 'migrated' field from AutomaticUpdateRule
Remove 'migrated' field from AutomaticUpdateRule
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.14 on 2018-09-14 12:21 +from __future__ import unicode_literals +from __future__ import absolute_import +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('data_interfaces', '0020...
604f299cf6398fa490acc48c55f7999e935283ac
spacy/lang/char_classes.py
spacy/lang/char_classes.py
# coding: utf8 from __future__ import unicode_literals import regex as re re.DEFAULT_VERSION = re.VERSION1 merge_char_classes = lambda classes: '[{}]'.format('||'.join(classes)) split_chars = lambda char: list(char.strip().split(' ')) merge_chars = lambda char: char.strip().replace(' ', '|') _bengali = r'[\p{L}&&\...
Add char classes to global language data
Add char classes to global language data
Python
mit
explosion/spaCy,recognai/spaCy,honnibal/spaCy,spacy-io/spaCy,spacy-io/spaCy,spacy-io/spaCy,aikramer2/spaCy,aikramer2/spaCy,explosion/spaCy,recognai/spaCy,honnibal/spaCy,spacy-io/spaCy,aikramer2/spaCy,spacy-io/spaCy,explosion/spaCy,recognai/spaCy,explosion/spaCy,aikramer2/spaCy,aikramer2/spaCy,aikramer2/spaCy,recognai/s...
--- +++ @@ -0,0 +1,49 @@ +# coding: utf8 +from __future__ import unicode_literals + +import regex as re + + +re.DEFAULT_VERSION = re.VERSION1 +merge_char_classes = lambda classes: '[{}]'.format('||'.join(classes)) +split_chars = lambda char: list(char.strip().split(' ')) +merge_chars = lambda char: char.strip().repla...
dad00fa29fb7084ec62f299c5c4cae5fa5d35a2f
zephyr/management/commands/create_realm.py
zephyr/management/commands/create_realm.py
from django.core.management.base import BaseCommand from zephyr.models import Realm, Message, UserProfile, Recipient, create_stream_if_needed, \ get_client from zephyr.views import do_send_message from django.utils.timezone import now class Command(BaseCommand): help = "Create a realm for the specified dom...
Add script to create new realms.
Add script to create new realms. (imported from commit 764d41f28b1af10860ea4d03a6aa983f40d3ffd7)
Python
apache-2.0
paxapy/zulip,sonali0901/zulip,yocome/zulip,aps-sids/zulip,Drooids/zulip,vabs22/zulip,m1ssou/zulip,luyifan/zulip,mansilladev/zulip,sharmaeklavya2/zulip,gigawhitlocks/zulip,andersk/zulip,Batterfii/zulip,amyliu345/zulip,alliejones/zulip,ipernet/zulip,calvinleenyc/zulip,jphilipsen05/zulip,tiansiyuan/zulip,hustlzp/zulip,Kin...
--- +++ @@ -0,0 +1,28 @@ +from django.core.management.base import BaseCommand +from zephyr.models import Realm, Message, UserProfile, Recipient, create_stream_if_needed, \ + get_client +from zephyr.views import do_send_message +from django.utils.timezone import now + +class Command(BaseCommand): + help = "C...
6a5a6203258be862e3b47ed62f61ca0dfef24628
common/djangoapps/student/migrations/0029_add_data_researcher.py
common/djangoapps/student/migrations/0029_add_data_researcher.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.27 on 2020-01-27 19:02 from __future__ import unicode_literals from django.db import migrations from student.models import CourseAccessRole def add_data_researcher(apps, schema_editor): """ Add a `data_researcher` role for everyone who is currently `staff` o...
Add a data researcher role for everyone who is currently staff or instructor.
Add a data researcher role for everyone who is currently staff or instructor.
Python
agpl-3.0
edx-solutions/edx-platform,cpennington/edx-platform,msegado/edx-platform,eduNEXT/edx-platform,angelapper/edx-platform,mitocw/edx-platform,EDUlib/edx-platform,stvstnfrd/edx-platform,edx-solutions/edx-platform,cpennington/edx-platform,arbrandes/edx-platform,arbrandes/edx-platform,appsembler/edx-platform,arbrandes/edx-pla...
--- +++ @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.27 on 2020-01-27 19:02 +from __future__ import unicode_literals + +from django.db import migrations +from student.models import CourseAccessRole + + +def add_data_researcher(apps, schema_editor): + """ + Add a `data_researcher` role f...
2fedb73b2c83fc7bb1b354d8b1ebd8dfe8497995
dataportal/tests/test_examples.py
dataportal/tests/test_examples.py
import unittest from ..examples.sample_data import (temperature_ramp, multisource_event, image_and_scalar) from metadatastore.api import Document class CommonSampleDataTests(object): def setUp(self): pass def test_basic_usage(self): events = self.example.run...
from nose.tools import assert_true from ..examples.sample_data import (temperature_ramp, multisource_event, image_and_scalar) from metadatastore.api import Document def run_example(example): events = example.run() assert_true(isinstance(events, list)) assert_true(isinsta...
Use generator test for examples.
REF: Use generator test for examples.
Python
bsd-3-clause
ericdill/datamuxer,danielballan/datamuxer,NSLS-II/dataportal,tacaswell/dataportal,danielballan/dataportal,ericdill/databroker,NSLS-II/datamuxer,danielballan/datamuxer,NSLS-II/dataportal,danielballan/dataportal,ericdill/databroker,tacaswell/dataportal,ericdill/datamuxer
--- +++ @@ -1,33 +1,13 @@ -import unittest +from nose.tools import assert_true from ..examples.sample_data import (temperature_ramp, multisource_event, image_and_scalar) from metadatastore.api import Document -class CommonSampleDataTests(object): - def setUp(self): - ...
f87b10b6a6639843b68777e5346109acb44c948a
profile_compressible_solver/gaussian.py
profile_compressible_solver/gaussian.py
from firedrake import (SpatialCoordinate, dot, cross, sqrt, atan_2, exp, as_vector, Constant, acos) import numpy as np class Gaussian(object): def __init__(self, mesh, dir_from_center, radial_dist, sigma_theta, ...
Set up object to create random pressure field
Set up object to create random pressure field
Python
mit
thomasgibson/firedrake-hybridization
--- +++ @@ -0,0 +1,89 @@ +from firedrake import (SpatialCoordinate, dot, cross, sqrt, atan_2, + exp, as_vector, Constant, acos) +import numpy as np + + +class Gaussian(object): + + def __init__(self, + mesh, + dir_from_center, + radial_dist, + ...
1f7bad5fc9c5aa1606cb194c7cb31729e914f042
smap-nepse/preprocessing/csvtohdf.py
smap-nepse/preprocessing/csvtohdf.py
import pandas as pd import numpy as np import os import glob def csvtohdf(source, destination): """Takes a csv file as input and storest it as a hdf5 file in the destnation path. The hdf5 file is stored in table format. """ try: data = pd.read_csv(source,index_col = 0,parse_dates=True) exce...
Add function to save .csv data as HDF files.
Add function to save .csv data as HDF files. The module provides functionality to save single .csv files as single HDF file. It also provides mechanism to store the whole data into a single HDFStore indexed using their filenames.
Python
mit
samshara/Stock-Market-Analysis-and-Prediction
--- +++ @@ -0,0 +1,63 @@ +import pandas as pd +import numpy as np +import os +import glob + +def csvtohdf(source, destination): + """Takes a csv file as input and storest it as a hdf5 file in the + destnation path. + The hdf5 file is stored in table format. +""" + try: + data = pd.read_csv(source,i...
801da273838654e7233a8110a252940c26aca208
src/conditionals/exercise3.py
src/conditionals/exercise3.py
# Rewrite fahr cel converter with try and except inp = raw_input('Enter Fahrenheit Temperature: ') try: fahr = float(inp) cel = (fahr - 32.0) * 5.0 / 9.0 print cel except: print 'Please enter a number' exit(0)
Rewrite fahr cel converter with try and except
Rewrite fahr cel converter with try and except
Python
mit
let42/python-course
--- +++ @@ -0,0 +1,11 @@ +# Rewrite fahr cel converter with try and except + +inp = raw_input('Enter Fahrenheit Temperature: ') +try: + fahr = float(inp) + cel = (fahr - 32.0) * 5.0 / 9.0 + print cel +except: + print 'Please enter a number' + +exit(0)
847682bfe21eeb9475f96cdbacc5bd873af095d3
src/locations/migrations/0005_auto_20161024_2257.py
src/locations/migrations/0005_auto_20161024_2257.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2016-10-24 19:57 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('locations', '0004_auto_20160828_2114'), ] operations = [ migrations.AlterModelOption...
Add migrations for location and district ordering
Add migrations for location and district ordering
Python
mit
mrts/foodbank-campaign,mrts/foodbank-campaign,mrts/foodbank-campaign,mrts/foodbank-campaign
--- +++ @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.8 on 2016-10-24 19:57 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('locations', '0004_auto_20160828_2114'), + ] + + operation...
f6e5d7134e1510211b7cd4cc5d87f69b7db98d5d
telemetry/telemetry/page/actions/action_runner_unittest.py
telemetry/telemetry/page/actions/action_runner_unittest.py
# Copyright 2014 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. from telemetry.core.backends.chrome import tracing_backend from telemetry.core.timeline import model from telemetry.page.actions import action_runner as actio...
Add unittests for action_runner.BeginInteraction and action_runner.EndInteraction.
Add unittests for action_runner.BeginInteraction and action_runner.EndInteraction. This is a reland of https://codereview.chromium.org/294943006 after it's reverted in https://codereview.chromium.org/284183014/. BUG=368767 Review URL: https://codereview.chromium.org/299443017 git-svn-id: de016e52bd170d2d4f2344f9bf9...
Python
bsd-3-clause
benschmaus/catapult,catapult-project/catapult,sahiljain/catapult,SummerLW/Perf-Insight-Report,sahiljain/catapult,benschmaus/catapult,benschmaus/catapult,catapult-project/catapult-csm,sahiljain/catapult,catapult-project/catapult-csm,catapult-project/catapult,benschmaus/catapult,SummerLW/Perf-Insight-Report,benschmaus/ca...
--- +++ @@ -0,0 +1,34 @@ +# Copyright 2014 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. +from telemetry.core.backends.chrome import tracing_backend +from telemetry.core.timeline import model +from telemetry.page.acti...
cd9315c288aec2e0d50402b5ce8fb830cf5c8957
src/ipf/getblockclasses.py
src/ipf/getblockclasses.py
# -*- coding: utf-8 -*- import pkgutil import inspect import os from ipfblock.ipfblock import IPFBlock from ipftype.ipftype import IPFType def get_classes_from_module(base_class, is_accepted=lambda x: True): """ Create dict {"class_name" : class object } for all classes bas...
Move get_classes_from_module reflection functions to separate file
Move get_classes_from_module reflection functions to separate file
Python
lgpl-2.1
anton-golubkov/Garland,anton-golubkov/Garland
--- +++ @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- + + +import pkgutil +import inspect +import os + +from ipfblock.ipfblock import IPFBlock +from ipftype.ipftype import IPFType + + +def get_classes_from_module(base_class, + is_accepted=lambda x: True): + """ Create dict {"class_name" : c...
1b7f6ca19e395f2285556ae43c97eb761dc9e565
candidates/management/commands/candidates_strip_ip_addresses.py
candidates/management/commands/candidates_strip_ip_addresses.py
from candidates.popit import PopItApiMixin, popit_unwrap_pagination from django.core.management.base import BaseCommand class Command(PopItApiMixin, BaseCommand): def handle(self, **options): for person in popit_unwrap_pagination( self.api.persons, per_page=100 ): ...
Add a command to strip the user IP addresses from PopIt
Add a command to strip the user IP addresses from PopIt
Python
agpl-3.0
openstate/yournextrepresentative,mysociety/yournextmp-popit,datamade/yournextmp-popit,DemocracyClub/yournextrepresentative,datamade/yournextmp-popit,neavouli/yournextrepresentative,mysociety/yournextrepresentative,openstate/yournextrepresentative,mhl/yournextmp-popit,datamade/yournextmp-popit,mysociety/yournextmp-popit...
--- +++ @@ -0,0 +1,17 @@ +from candidates.popit import PopItApiMixin, popit_unwrap_pagination + +from django.core.management.base import BaseCommand + +class Command(PopItApiMixin, BaseCommand): + + def handle(self, **options): + for person in popit_unwrap_pagination( + self.api.persons, + ...
97dbd021800f323aea6e1e84d464a77b5832fd75
tests/test_sorting_and_searching/test_find_kth_smallest.py
tests/test_sorting_and_searching/test_find_kth_smallest.py
import unittest from aids.sorting_and_searching.find_kth_smallest import find_kth_smallest class FindKthSmallestTestCase(unittest.TestCase): ''' Unit tests for find_kth_smallest ''' def setUp(self): self.example_1 = [54,26,93,17,77,31,44,55,20] def test_find_kth_smallest(self): s...
Add unit tests for find_kth_smallest
Add unit tests for find_kth_smallest
Python
mit
ueg1990/aids
--- +++ @@ -0,0 +1,20 @@ +import unittest + +from aids.sorting_and_searching.find_kth_smallest import find_kth_smallest + +class FindKthSmallestTestCase(unittest.TestCase): + ''' + Unit tests for find_kth_smallest + ''' + + def setUp(self): + self.example_1 = [54,26,93,17,77,31,44,55,20] + + def...
6cd0dc04b4389fd5e0829acd65a332382d4db635
fabric_colors/postgis/__init__.py
fabric_colors/postgis/__init__.py
from fabric.api import run, local from fabric_colors.deployment import _env_get def create_postgis_template(target): _env_get(target) command_string = """ POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib/postgis-2.0 # Creating the template spatial database. createdb -U postgres -E UTF8...
Add in template_postgis creation script
Add in template_postgis creation script
Python
bsd-2-clause
fabric-colors/fabric-colors,fabric-colors/fabric-colors
--- +++ @@ -0,0 +1,26 @@ +from fabric.api import run, local + +from fabric_colors.deployment import _env_get + + +def create_postgis_template(target): + _env_get(target) + command_string = """ + POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib/postgis-2.0 + # Creating the template spatial database....
bac22c6486cbd1bd909db44f003e778ab0380761
custom/bihar/management/commands/bihar_cleanup_case.py
custom/bihar/management/commands/bihar_cleanup_case.py
import logging import csv from django.core.management import BaseCommand from casexml.apps.case.models import CommCareCase from dimagi.utils.couch.database import iter_docs logger = logging.getLogger('case_cleanup') logger.setLevel('DEBUG') MOTECH_ID = "fb6e0b19cbe3ef683a10c4c4766a1ef3" class Command(BaseCommand):...
Clean up cases in bihar domain
Clean up cases in bihar domain
Python
bsd-3-clause
qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq
--- +++ @@ -0,0 +1,64 @@ +import logging +import csv +from django.core.management import BaseCommand +from casexml.apps.case.models import CommCareCase +from dimagi.utils.couch.database import iter_docs + +logger = logging.getLogger('case_cleanup') +logger.setLevel('DEBUG') + + +MOTECH_ID = "fb6e0b19cbe3ef683a10c4c47...
e1ceb24517db8710c11a94c589ad117aa46ac8a4
kamatis/util.py
kamatis/util.py
import logging import os import sys def makedirs(path): isdir = True exc_info = None try: os.makedirs(path) except OSError as err: if err.errno == 17: # Path already exists. if not os.path.isdir(path): message = '{} already exists and is not a dir.'.format...
Add method for creating a directory
Add method for creating a directory
Python
bsd-3-clause
luipugs/kamatis
--- +++ @@ -0,0 +1,28 @@ +import logging +import os +import sys + + +def makedirs(path): + isdir = True + exc_info = None + + try: + os.makedirs(path) + except OSError as err: + if err.errno == 17: # Path already exists. + if not os.path.isdir(path): + message = '{...
2226980daf685c1ecb7df99b5e1bb646b6cfbd3d
geotrek/feedback/migrations/0008_auto_20200526_1419.py
geotrek/feedback/migrations/0008_auto_20200526_1419.py
# Generated by Django 2.2.12 on 2020-05-26 14:19 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('feedback', '0007_auto_20200407_0728'), ] operations = [ migrations.AlterField( model_name='rep...
Add migration test for CASCADE
Add migration test for CASCADE
Python
bsd-2-clause
makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin
--- +++ @@ -0,0 +1,34 @@ +# Generated by Django 2.2.12 on 2020-05-26 14:19 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('feedback', '0007_auto_20200407_0728'), + ] + + operations = [ + migration...
14d1defaa72d3bfd23b36bcfdf8c786818f328fb
problem_48.py
problem_48.py
from time import time def main(): max = 1000 print str(sum([i**i for i in range(1, max+1)]))[-10:] if __name__ == '__main__': t = time() main() print 'Time:', time() - t
Add problem 48, self powers series
Add problem 48, self powers series
Python
mit
dimkarakostas/project-euler
--- +++ @@ -0,0 +1,12 @@ +from time import time + + +def main(): + max = 1000 + print str(sum([i**i for i in range(1, max+1)]))[-10:] + + +if __name__ == '__main__': + t = time() + main() + print 'Time:', time() - t
f0fa84e35e2af96844812cdd876dcfd60d841290
caffe2/python/operator_test/sparse_lengths_sum_benchmark.py
caffe2/python/operator_test/sparse_lengths_sum_benchmark.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import argparse import numpy as np import datetime from caffe2.python import core, workspace def benchmark_sparse_lengths_sum( dtype_str, categorical_l...
Add a quick SparseLengthsSum benchmark.
Add a quick SparseLengthsSum benchmark. Summary: TSIA - this makes it a bit easy to benchmark sparse lengths sum. Reviewed By: dzhulgakov Differential Revision: D5477844 fbshipit-source-id: 89e25c5e0dbf3538877ba1a9abc75a10abfa2757
Python
apache-2.0
pietern/caffe2,xzturn/caffe2,sf-wind/caffe2,xzturn/caffe2,davinwang/caffe2,pietern/caffe2,pietern/caffe2,Yangqing/caffe2,xzturn/caffe2,davinwang/caffe2,sf-wind/caffe2,sf-wind/caffe2,Yangqing/caffe2,xzturn/caffe2,xzturn/caffe2,sf-wind/caffe2,davinwang/caffe2,Yangqing/caffe2,Yangqing/caffe2,davinwang/caffe2,Yangqing/caff...
--- +++ @@ -0,0 +1,87 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import argparse +import numpy as np +import datetime + +from caffe2.python import core, workspace + + +def benchmark_sparse_lengths_sum( ...
0a0d449bfee13895db2ef5d494fb67bc34e631ee
mysite/scripts/delete-emo-projectexps.py
mysite/scripts/delete-emo-projectexps.py
from mysite.profile.models import ProjectExp, Person project_exps = ProjectExp.objects.filter( person=Person.objects.get(user__username='emo'))[:19] # Gonna limit to 20; damage mitigation just in case this query isn't right. for exp in project_exps: exp.delete()
Add script to delete emo's projectexps. We use this script when showing people how the importer works.
Add script to delete emo's projectexps. We use this script when showing people how the importer works.
Python
agpl-3.0
mzdaniel/oh-mainline,openhatch/oh-mainline,ehashman/oh-mainline,heeraj123/oh-mainline,nirmeshk/oh-mainline,SnappleCap/oh-mainline,campbe13/openhatch,campbe13/openhatch,heeraj123/oh-mainline,jledbetter/openhatch,eeshangarg/oh-mainline,willingc/oh-mainline,moijes12/oh-mainline,mzdaniel/oh-mainline,ojengwa/oh-mainline,nir...
--- +++ @@ -0,0 +1,7 @@ +from mysite.profile.models import ProjectExp, Person + +project_exps = ProjectExp.objects.filter( + person=Person.objects.get(user__username='emo'))[:19] +# Gonna limit to 20; damage mitigation just in case this query isn't right. +for exp in project_exps: + exp.delete()
07d2742da2b75d1c23451b76447acf5ec03f41b0
osf/management/commands/update_preprint_share_dates.py
osf/management/commands/update_preprint_share_dates.py
from __future__ import unicode_literals import logging from django.core.management.base import BaseCommand from scripts import utils as script_utils from osf.models import PreprintService from website.preprints.tasks import on_preprint_updated logger = logging.getLogger(__name__) def update_share_preprint_modified_...
Add management command to update preprint share dates
Add management command to update preprint share dates
Python
apache-2.0
HalcyonChimera/osf.io,laurenrevere/osf.io,crcresearch/osf.io,icereval/osf.io,crcresearch/osf.io,Johnetordoff/osf.io,sloria/osf.io,HalcyonChimera/osf.io,TomBaxter/osf.io,CenterForOpenScience/osf.io,CenterForOpenScience/osf.io,binoculars/osf.io,sloria/osf.io,baylee-d/osf.io,TomBaxter/osf.io,chrisseto/osf.io,binoculars/os...
--- +++ @@ -0,0 +1,43 @@ +from __future__ import unicode_literals +import logging + +from django.core.management.base import BaseCommand + +from scripts import utils as script_utils +from osf.models import PreprintService +from website.preprints.tasks import on_preprint_updated + +logger = logging.getLogger(__name__)...
936650dd8bc320731e7a703d6b1c9ab4092c3f0c
swap_nodes_in_pairs.py
swap_nodes_in_pairs.py
''' Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant space. You may not modify the values in the list, only nodes itself can be changed. ''' ''' Use a dummy head. ''' # Definition ...
Swap Nodes in Pairs problem
Swap Nodes in Pairs problem
Python
apache-2.0
zsmountain/leetcode,zsmountain/leetcode,zsmountain/leetcode
--- +++ @@ -0,0 +1,48 @@ +''' +Given a linked list, swap every two adjacent nodes and return its head. + +For example, +Given 1->2->3->4, you should return the list as 2->1->4->3. + +Your algorithm should use only constant space. You may not modify the values in the list, only nodes itself can be changed. +''' + +'''...
44035c166ffde209a47d7739af0d56acb4ec0422
notebooks/test_notebooks.py
notebooks/test_notebooks.py
# -*- coding: utf-8 -*- ''' Checks notebook execution result. Equal to this command + error management: jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --output executed_notebook.ipynb demo.ipynb For jupyter configuration information, run: jupyter --path ''' # Dependencies: nbformat, nbc...
Add script to automate notebooks testing
Add script to automate notebooks testing
Python
agpl-3.0
openfisca/openfisca-tunisia,openfisca/openfisca-tunisia
--- +++ @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + + +''' +Checks notebook execution result. +Equal to this command + error management: +jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --output executed_notebook.ipynb demo.ipynb + +For jupyter configuration information, run: jupyter --path...
e9a18df953c972204b393d5a374b74f1dc8303cd
backend/scripts/updatedf.py
backend/scripts/updatedf.py
#!/usr/bin/env python #import hashlib import os def main(): for root, dirs, files in os.walk("/mcfs/data/materialscommons"): for f in files: print f if __name__ == "__main__": main()
Add script to update uploaded files.
Add script to update uploaded files.
Python
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +#import hashlib +import os + +def main(): + for root, dirs, files in os.walk("/mcfs/data/materialscommons"): + for f in files: + print f + +if __name__ == "__main__": + main()
a997a84d2a3f1f485eeab24558a62aac15530999
src/sentry/runner/commands/repair.py
src/sentry/runner/commands/repair.py
""" sentry.runner.commands.repair ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function import os import click from sentry.runner.decorators import configuration @cl...
""" sentry.runner.commands.repair ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function import os import click from sentry.runner.decorators import configuration @cl...
Clarify error condition when failing to sync docs
Clarify error condition when failing to sync docs
Python
bsd-3-clause
mitsuhiko/sentry,daevaorn/sentry,jean/sentry,fotinakis/sentry,gencer/sentry,nicholasserra/sentry,daevaorn/sentry,looker/sentry,zenefits/sentry,nicholasserra/sentry,jean/sentry,looker/sentry,mvaled/sentry,JamesMura/sentry,zenefits/sentry,jean/sentry,mvaled/sentry,JackDanger/sentry,mvaled/sentry,zenefits/sentry,mvaled/se...
--- +++ @@ -21,8 +21,10 @@ from sentry.utils.integrationdocs import sync_docs, DOC_FOLDER if os.access(DOC_FOLDER, os.W_OK): sync_docs() + elif os.path.isdir(DOC_FOLDER): + click.echo(' - skipping, path cannot be written to: %r' % DOC_FOLDER) else: - click.echo(' - skipping (p...
6fec4a7e5f594ab34e2d7edcefa1695325669cff
stingray/tests/test_crossspectrum.py
stingray/tests/test_crossspectrum.py
from __future__ import division import numpy as np from nose.tools import raises from stingray import Lightcurve from stingray import Crossspectrum, AveragedCrossspectrum np.random.seed(20160528) class TestCrossspectrum(object): def setUp(self): tstart = 0.0 tend = 1.0 dt = 0.0001 ...
Initialize class for testing Crossspectrum
Initialize class for testing Crossspectrum
Python
mit
pabell/stingray,StingraySoftware/stingray,abigailStev/stingray,evandromr/stingray
--- +++ @@ -0,0 +1,34 @@ +from __future__ import division +import numpy as np +from nose.tools import raises +from stingray import Lightcurve +from stingray import Crossspectrum, AveragedCrossspectrum + +np.random.seed(20160528) + +class TestCrossspectrum(object): + + def setUp(self): + tstart = 0.0 + ...
f7c0f0a38f2632c8adf4e987cf330012d0a9c502
ureport/polls/migrations/0046_add_index_on_pollresults_contact.py
ureport/polls/migrations/0046_add_index_on_pollresults_contact.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations #language=SQL INDEX_SQL = """ CREATE INDEX polls_pollresult_contact ON polls_pollresult (contact); """ class Migration(migrations.Migration): dependencies = [ ('polls', '0045_fix_has_synced_field'),...
Add index on polls results contact field
Add index on polls results contact field
Python
agpl-3.0
xkmato/ureport,xkmato/ureport,rapidpro/ureport,Ilhasoft/ureport,xkmato/ureport,rapidpro/ureport,Ilhasoft/ureport,Ilhasoft/ureport,rapidpro/ureport,rapidpro/ureport,Ilhasoft/ureport
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + +#language=SQL +INDEX_SQL = """ +CREATE INDEX polls_pollresult_contact +ON polls_pollresult (contact); +""" + + +class Migration(migrations.Migration): + + dependencies = [ + ...
ed52a74fa6c60fec164badc8217e9e89bff40e70
test/test_metropolis_hasting_mcmc.py
test/test_metropolis_hasting_mcmc.py
#!/usr/bin/env python3 # # Tests the basic methods of the metropolis hasting MCMC routine. # # This file is part of PINTS. # Copyright (c) 2017-2018, University of Oxford. # For licensing information, see the LICENSE file distributed with the PINTS # software package. # import pints import pints.toy as toy import un...
Add basic unit test for MH
Add basic unit test for MH
Python
bsd-3-clause
martinjrobins/hobo,martinjrobins/hobo,martinjrobins/hobo,martinjrobins/hobo
--- +++ @@ -0,0 +1,83 @@ +#!/usr/bin/env python3 +# +# Tests the basic methods of the metropolis hasting MCMC routine. +# +# This file is part of PINTS. +# Copyright (c) 2017-2018, University of Oxford. +# For licensing information, see the LICENSE file distributed with the PINTS +# software package. +# +import pi...
461097d063e9e174cfbfcbc86e8add91414966bd
tests/test_03_multiple_dependency.py
tests/test_03_multiple_dependency.py
"""A complicated scenario with tests having multiple dependencies. """ import pytest pytest_plugins = "pytester" def test_multiple(testdir): testdir.makepyfile(""" import pytest pytest_plugins = "pytest_dependency" @pytest.mark.dependency(name="a") def test_a(): pyt...
Add a test with multiple dependencies.
Add a test with multiple dependencies.
Python
apache-2.0
RKrahl/pytest-dependency
--- +++ @@ -0,0 +1,73 @@ +"""A complicated scenario with tests having multiple dependencies. +""" + +import pytest + +pytest_plugins = "pytester" + + +def test_multiple(testdir): + testdir.makepyfile(""" + import pytest + + pytest_plugins = "pytest_dependency" + + @pytest.mark.dependency(name=...