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 |
|---|---|---|---|---|---|---|---|---|---|---|
56c933ad84837f60f5dbb36c2a8c0fc26b1d5ce9 | project/scripts/main.py | project/scripts/main.py | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Add skeleton code for fetching and updating database data. Hard coded for now | Add skeleton code for fetching and updating database data. Hard coded for now
| Python | apache-2.0 | googleinterns/sgonks,googleinterns/sgonks,googleinterns/sgonks,googleinterns/sgonks | ---
+++
@@ -0,0 +1,43 @@
+# Copyright 2021 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by appl... | |
00c61d58532a6ace185e8740bf4d7cbbfa2c960a | ogusa/tests/test_data.py | ogusa/tests/test_data.py | import pytest
# from ogusa.execute.scipts import runner
def test_set_data(monkeypatch):
"""
Check that setting `data` to 'cps' uses cps data
"""
from ogusa.txfunc import get_tax_func_estimate, tax_func_estimate
from ogusa import get_micro_data
mocked_fn = get_micro_data
baseline=False
s... | Add test for cps file | Add test for cps file
| Python | mit | OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic | ---
+++
@@ -0,0 +1,18 @@
+import pytest
+# from ogusa.execute.scipts import runner
+
+def test_set_data(monkeypatch):
+ """
+ Check that setting `data` to 'cps' uses cps data
+ """
+ from ogusa.txfunc import get_tax_func_estimate, tax_func_estimate
+ from ogusa import get_micro_data
+ mocked_fn = ge... | |
9b7d8998066c7963de11e32bd5755f9e1fff0baf | migrations/versions/6a8c19565060_move_to_flask.py | migrations/versions/6a8c19565060_move_to_flask.py | """Rename tables to account for Flask-SQLAlchemy's auto-naming.
Unlike our own (old) table name generator, Flask-SQLAlchemy inserts
underscores in names that are CamelCase (i.e. table names are snake_case).
There's no reason to keep the old behavior, but we need this migration script
otherwise.
Revision ID: 6a8c19565... | Add a migration script accounting for flask changes | Add a migration script accounting for flask changes
Per the script's docstring, the only thing about the schema that's
changed is that the table names Flask-SQLAlchemy generates are slightly
different. The schema is otherwise the same, with one caveat:
With Postgres, for every table that has an AUTO INCREMENT id, ano... | Python | apache-2.0 | SahilTikale/haas,henn/hil,henn/haas,henn/hil_sahil,kylehogan/haas,meng-sun/hil,meng-sun/hil,kylehogan/hil,CCI-MOC/haas,henn/hil,kylehogan/hil,henn/hil_sahil | ---
+++
@@ -0,0 +1,36 @@
+"""Rename tables to account for Flask-SQLAlchemy's auto-naming.
+
+Unlike our own (old) table name generator, Flask-SQLAlchemy inserts
+underscores in names that are CamelCase (i.e. table names are snake_case).
+There's no reason to keep the old behavior, but we need this migration script
+o... | |
00462a7270f48846a5287520f5764a190b11928c | migrations/versions/530a92c42c5_.py | migrations/versions/530a92c42c5_.py | """empty message
Revision ID: 530a92c42c5
Revises: 3255e6bed08
Create Date: 2016-08-09 19:46:36.752946
"""
# revision identifiers, used by Alembic.
revision = '530a92c42c5'
down_revision = '3255e6bed08'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
###... | Add migration: add 'private' field to Post table, drop Photo table | Add migration: add 'private' field to Post table, drop Photo table
| Python | mit | heejongahn/hjlog,heejongahn/hjlog,heejongahn/hjlog,heejongahn/hjlog | ---
+++
@@ -0,0 +1,32 @@
+"""empty message
+
+Revision ID: 530a92c42c5
+Revises: 3255e6bed08
+Create Date: 2016-08-09 19:46:36.752946
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '530a92c42c5'
+down_revision = '3255e6bed08'
+
+from alembic import op
+import sqlalchemy as sa
+from sqlalchemy.dialects... | |
fc2ab4cadd4c4bac34c35aeaeb3047da30524063 | driver27/management/commands/testing_multirecord.py | driver27/management/commands/testing_multirecord.py | from django.core.management.base import BaseCommand, CommandError
from driver27.models import Driver, Competition, Season
from driver27.records import get_record_config
class Command(BaseCommand):
help = 'Test multirecord'
def get_multirecord(self, driver, multirecords, **kwargs):
multiple_records = ... | Add command to testing future implementation of get multiple records for driver profile. | Add command to testing future implementation of get multiple records for driver profile.
| Python | mit | SRJ9/django-driver27,SRJ9/django-driver27,SRJ9/django-driver27 | ---
+++
@@ -0,0 +1,28 @@
+from django.core.management.base import BaseCommand, CommandError
+from driver27.models import Driver, Competition, Season
+from driver27.records import get_record_config
+
+
+class Command(BaseCommand):
+ help = 'Test multirecord'
+
+ def get_multirecord(self, driver, multirecords, **... | |
e9917a9f4855ebb3b464977a26c7549baeb6a610 | contrib/satgpio.py | contrib/satgpio.py | """
Author: Juan Luis Cano Rodríguez
Code to read GP data from Celestrak using the HTTP API and python-sgp4.
Requires some extra dependencies:
$ pip install httpx sgp4
"""
import io
import json
import xml.etree.ElementTree as ET
import httpx
from sgp4 import exporter, omm
from sgp4.api import Satrec
def _gene... | Add contrib code to load GP data from Celestrak | Add contrib code to load GP data from Celestrak
| Python | mit | poliastro/poliastro | ---
+++
@@ -0,0 +1,96 @@
+"""
+Author: Juan Luis Cano Rodríguez
+
+Code to read GP data from Celestrak using the HTTP API and python-sgp4.
+
+Requires some extra dependencies:
+
+ $ pip install httpx sgp4
+
+"""
+
+import io
+import json
+import xml.etree.ElementTree as ET
+
+import httpx
+from sgp4 import exporter,... | |
0008b7f22ee3d5f16c1d6bf4e62211633818a30c | project/tools/mktopic.py | project/tools/mktopic.py | #!/usr/bin/env python
#
# mk_topic.py
#
# Make a notebook for a new topic
#
import datetime
import os
import sys
import lib
from jinja2 import Environment, FileSystemLoader
from lib import nullstrip, slugify
template_env = Environment(loader=FileSystemLoader("data/templates"))
# -t template would be nice, but this wi... | Add new utility to make source documents | Add new utility to make source documents
| Python | mit | holdenweb/nbtools,holdenweb/nbtools | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+#
+# mk_topic.py
+#
+# Make a notebook for a new topic
+#
+import datetime
+import os
+import sys
+
+import lib
+from jinja2 import Environment, FileSystemLoader
+from lib import nullstrip, slugify
+
+template_env = Environment(loader=FileSystemLoader("data/templates")... | |
1fc00c46538052c008dd9f7da9693987fc8a1da6 | fm/matrix_factorization.py | fm/matrix_factorization.py | #!/usr/bin/python
import numpy
def matrix_factorization(R,
P,
Q,
K,
train_step=1000,
learning_rate=0.01,
regular_beta=0.01):
"""
Args:
R: the objetive [N, M] m... | Add implementation of matrix factorization | Add implementation of matrix factorization
| Python | mit | tobegit3hub/ml_implementation | ---
+++
@@ -0,0 +1,75 @@
+#!/usr/bin/python
+
+import numpy
+
+
+def matrix_factorization(R,
+ P,
+ Q,
+ K,
+ train_step=1000,
+ learning_rate=0.01,
+ regular_beta=0.01):
+ ... | |
1d086e026e5f480c8205951dfe714cceaad929c7 | config/trace_pox_l2_consistency.py | config/trace_pox_l2_consistency.py | from config.experiment_config_lib import ControllerConfig
from sts.topology import BufferedPatchPanel
from sts.topology import ConsistencyTopology
from sts.controller_manager import UserSpaceControllerPatchPanel
from sts.control_flow.fuzzer import Fuzzer
from sts.input_traces.input_logger import InputLogger
from sts.si... | Add the consistency config file | Add the consistency config file
| Python | apache-2.0 | jmiserez/sts,jmiserez/sts | ---
+++
@@ -0,0 +1,61 @@
+from config.experiment_config_lib import ControllerConfig
+from sts.topology import BufferedPatchPanel
+from sts.topology import ConsistencyTopology
+from sts.controller_manager import UserSpaceControllerPatchPanel
+from sts.control_flow.fuzzer import Fuzzer
+from sts.input_traces.input_logg... | |
6f6bfbd7d627b518be830567a36b89a0859b4974 | astropy_helpers/test_helpers.py | astropy_helpers/test_helpers.py | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import warnings
from .commands.test import AstropyTest
# Leaving this module here for now, but really it needn't exist
# (and it's doubtful that any code depends on it anymore)
warnings.warn('The astropy_hel... | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import warnings
from .commands.test import AstropyTest
# Leaving this module here for now, but really it needn't exist
# (and it's doubtful that any code depends on it anymore)
warnings.warn('The astropy_hel... | Change the warning message, since this will only affect v1.1 and up | Change the warning message, since this will only affect v1.1 and up [skip ci]
| Python | bsd-3-clause | astropy/astropy-helpers,bsipocz/astropy-helpers,dpshelio/astropy-helpers,Cadair/astropy-helpers,embray/astropy_helpers,dpshelio/astropy-helpers,bsipocz/astropy-helpers,larrybradley/astropy-helpers,astropy/astropy-helpers,bsipocz/astropy-helpers,larrybradley/astropy-helpers,embray/astropy_helpers,embray/astropy_helpers,... | ---
+++
@@ -9,5 +9,5 @@
# Leaving this module here for now, but really it needn't exist
# (and it's doubtful that any code depends on it anymore)
warnings.warn('The astropy_helpers.test_helpers module is deprecated as '
- 'of version 1.0.4; the AstropyTest command can be found in '
+ 'of ... |
f8342d9bb3cfecacf0d1d0ab24fdba45459afae8 | towers_of_hanoi/python/towers_of_hanoi.py | towers_of_hanoi/python/towers_of_hanoi.py | def move( n, src, dest, temp ):
if n >= 1 :
move( n - 1, src, temp, dest )
print( "Moving %d -> %d" % (src, dest))
move( n - 1, temp, dest, src )
def main():
move(3,1,3,2)
if __name__ == "__main__":
main()
| Add python implementation of toh | Add python implementation of toh
| Python | cc0-1.0 | EUNIX-TRIX/al-go-rithms,Cnidarias/al-go-rithms,ZoranPandovski/al-go-rithms,manikTharaka/al-go-rithms,arijitkar98/al-go-rithms,manikTharaka/al-go-rithms,EUNIX-TRIX/al-go-rithms,Cnidarias/al-go-rithms,ZoranPandovski/al-go-rithms,EUNIX-TRIX/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,EUNIX-TRIX/al... | ---
+++
@@ -0,0 +1,15 @@
+def move( n, src, dest, temp ):
+
+ if n >= 1 :
+ move( n - 1, src, temp, dest )
+
+ print( "Moving %d -> %d" % (src, dest))
+
+ move( n - 1, temp, dest, src )
+
+
+def main():
+ move(3,1,3,2)
+
+if __name__ == "__main__":
+ main() | |
53e9bf58bebf8b440f76558575d656e41cbaf4f9 | python/ecep/portal/management/commands/load_neighborhoods.py | python/ecep/portal/management/commands/load_neighborhoods.py | # Copyright (c) 2013 Azavea, Inc.
# See LICENSE in the project root for copying permission
from django.core.management.base import BaseCommand
from django.contrib.gis.utils import LayerMapping
from django.db import IntegrityError
from portal.models import Neighborhood
class Command(BaseCommand):
"""
Import s... | Add function to load neighborhood data | Add function to load neighborhood data
| Python | mit | smartchicago/chicago-early-learning,smartchicago/chicago-early-learning,smartchicago/chicago-early-learning,smartchicago/chicago-early-learning | ---
+++
@@ -0,0 +1,45 @@
+# Copyright (c) 2013 Azavea, Inc.
+# See LICENSE in the project root for copying permission
+
+from django.core.management.base import BaseCommand
+from django.contrib.gis.utils import LayerMapping
+from django.db import IntegrityError
+
+from portal.models import Neighborhood
+
+class Comma... | |
d3188c550c486c4219cf0cc0e38f6696f8b340af | pratica-01/randlist.py | pratica-01/randlist.py | # encoding:utf-8
import random
def main():
rl = RandList(500, 1000)
rl.gen_random_list()
rl.print_block_list()
print "\n\nPronto!"
class RandList(object):
def __init__(self, first, second):
self.first = first
self.second = second
self.populacao = []
def gen_random_li... | Add classe RandList.py para gerar um deck embaralhado | Add classe RandList.py para gerar um deck embaralhado
| Python | mit | tonussi/freezing-dubstep,tonussi/freezing-dubstep,tonussi/freezing-dubstep | ---
+++
@@ -0,0 +1,31 @@
+# encoding:utf-8
+
+import random
+
+def main():
+ rl = RandList(500, 1000)
+ rl.gen_random_list()
+ rl.print_block_list()
+ print "\n\nPronto!"
+
+class RandList(object):
+
+ def __init__(self, first, second):
+ self.first = first
+ self.second = second
+ ... | |
36f2372c6b5a25d96ecc38297a05a139e6e7f6b5 | results/migrations/0012_migrate_resultevent_data.py | results/migrations/0012_migrate_resultevent_data.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def migrate_remaining_fields_to_popolo_models(apps, schema_editor):
ResultEvent = apps.get_model('results', 'ResultEvent')
Organization = apps.get_model('popolo', 'Organization')
Post = apps.get_model('popolo... | Add a data migration to move more ResultEvent fields to Popolo models | Add a data migration to move more ResultEvent fields to Popolo models
| Python | agpl-3.0 | DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative | ---
+++
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+def migrate_remaining_fields_to_popolo_models(apps, schema_editor):
+ ResultEvent = apps.get_model('results', 'ResultEvent')
+ Organization = apps.get_model('popolo', 'Organization... | |
1ef3cda8915d22e6e862eab06796783af43fe0e5 | app/timetables/migrations/0009_auto_20160919_1149.py | app/timetables/migrations/0009_auto_20160919_1149.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-09-19 11:49
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('timetables', '0008_auto_20160913_2203'),
]
operations = [
migrations.AddFiel... | Add migration for additional slug fields. | Add migration for additional slug fields.
| Python | mit | teamtaverna/core | ---
+++
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-09-19 11:49
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('timetables', '0008_auto_20160913_2203'),
+ ]
+
+ ... | |
da8b184267d04ae8c95772b4cbfaef7603d4ed67 | scripts/jenkins_console_log_search.py | scripts/jenkins_console_log_search.py | #!/usr/bin/env python3
"""
This short script uses curl requests to search the last 100 builds of
a jenkins job to find recurring errors, written in Python3.
It results in printing a list of links to builds that match the search
As the requests package is not included within kv, you will need to either
download this pa... | Add utility script for searching Jenkins console logs | Add utility script for searching Jenkins console logs
This small python script can be used to quickly check the last
100 (or more if you're willing to edit and wait) to see if a
string is present within the console log. This can help find
instances of errors to help determine intermittent failures from
one off problem... | Python | bsd-3-clause | daverigby/kv_engine,daverigby/kv_engine,daverigby/kv_engine,daverigby/kv_engine | ---
+++
@@ -0,0 +1,69 @@
+#!/usr/bin/env python3
+
+"""
+This short script uses curl requests to search the last 100 builds of
+a jenkins job to find recurring errors, written in Python3.
+It results in printing a list of links to builds that match the search
+As the requests package is not included within kv, you wi... | |
1409d2276f5533c9704903197f491beae65c125a | familias/migrations/0036_merge_20170621_2219.py | familias/migrations/0036_merge_20170621_2219.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-06-21 22:19
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('familias', '0035_auto_20170621_2211'),
('familias', '0034_add_oficio_estudiante'),
]
... | Change the field escuela in the Integrante form to plantel. And add a optional value escuela to all members | Change the field escuela in the Integrante form to plantel. And add a
optional value escuela to all members
Merge migrations
| Python | mit | erikiado/jp2_online,erikiado/jp2_online,erikiado/jp2_online | ---
+++
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.2 on 2017-06-21 22:19
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('familias', '0035_auto_20170621_2211'),
+ ('familias', '... | |
01b5b572149f19550d4fdec3fd7d1e40aee9b624 | astroid/brain/brain_boto3.py | astroid/brain/brain_boto3.py | # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
"""Astroid hooks for understanding boto3.ServiceRequest()"""
import astroid
from astroid import MANAGER, extract_node
BOTO_SERVICE_FACTORY_QUALIFIED_NAME = "... | Transform boto3.ServiceRequest to look like dynamic class | Transform boto3.ServiceRequest to look like dynamic class
`boto3.resource` creates resources dynamically via a resource factory.
Unfortunately that completely breaks static analysis leading to spurious
false positives since pylint cannot determine sanely that attributes
exist or not.
Here's an example of accessing th... | Python | lgpl-2.1 | PyCQA/astroid | ---
+++
@@ -0,0 +1,28 @@
+# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
+# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
+
+"""Astroid hooks for understanding boto3.ServiceRequest()"""
+import astroid
+from astroid import MANAGER, extract_node
+
+BOTO... | |
b92e1548f3944465cc7ac112d4c88e9aae8f4ead | rowboat/views/webhooks.py | rowboat/views/webhooks.py | import subprocess
from flask import Blueprint, request, current_app
# from rowboat.redis import rdb
# from rowboat.util.decos import authed
from disco.types.message import MessageEmbed
from disco.types.webhook import Webhook
webhooks = Blueprint('webhooks', __name__, url_prefix='/webhooks')
@webhooks.route('/circl... | import subprocess
from flask import Blueprint, request, current_app
# from rowboat.redis import rdb
# from rowboat.util.decos import authed
from disco.types.message import MessageEmbed
from disco.types.webhook import Webhook
webhooks = Blueprint('webhooks', __name__, url_prefix='/webhooks')
@webhooks.route('/circl... | Fix invalid key (nice docs circleci) | Fix invalid key (nice docs circleci)
| Python | mit | ThaTiemsz/jetski,aliasfalse/rowboat,aliasfalse/rowboat,aliasfalse/rowboat,ThaTiemsz/jetski,b1naryth1ef/rowboat,b1naryth1ef/rowboat,aliasfalse/rowboat,b1naryth1ef/rowboat,ThaTiemsz/jetski,b1naryth1ef/rowboat,ThaTiemsz/jetski | ---
+++
@@ -24,7 +24,7 @@
embed.title = 'Build #{} - {} ({})'.format(
data['build_num'],
data['subject'],
- data['commiter_name'],
+ data['author_name'],
)
embed.url = data['build_url']
@@ -38,6 +38,7 @@
))
embed.description = '\n'.join(steps)
+ embe... |
17dc07a496d976b082189395498a476089d66108 | chainer_datasets.py | chainer_datasets.py | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 23 13:09:27 2017
@author: sakurai
"""
import numpy as np
import matplotlib.pyplot as plt
from chainer.datasets import TupleDataset
import cars196_dataset
from my_iterators import SerialIterator
from indexes_samplers import NPairMCIndexesSampler
if __name__ == '__main... | Implement example codes to use Cars196 with the modified SerialIterator | Implement example codes to use Cars196 with the modified SerialIterator
| Python | mit | ronekko/deep_metric_learning | ---
+++
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Mon Jan 23 13:09:27 2017
+
+@author: sakurai
+"""
+
+import numpy as np
+import matplotlib.pyplot as plt
+
+from chainer.datasets import TupleDataset
+
+import cars196_dataset
+from my_iterators import SerialIterator
+from indexes_samplers import NPai... | |
abe3f5489fb91102ea45b85ea6200542e7ca5f67 | test/unit/test_smplayservice.py | test/unit/test_smplayservice.py | import unittest
from hamcrest import *
from service.smplayservice import SmPlayServiceStarter
from smcontext import SmContext, SmApplication
class TestSmPlayService(unittest.TestCase):
def setUp(self):
sm_application = SmApplication("test/conf/", features = {})
sm_context = SmContext(sm_application, "")
... | Add tests for assets version extraction | Add tests for assets version extraction
| Python | apache-2.0 | hmrc/service-manager,hmrc/service-manager,hmrc/service-manager,hmrc/service-manager | ---
+++
@@ -0,0 +1,17 @@
+import unittest
+from hamcrest import *
+
+from service.smplayservice import SmPlayServiceStarter
+from smcontext import SmContext, SmApplication
+
+class TestSmPlayService(unittest.TestCase):
+ def setUp(self):
+ sm_application = SmApplication("test/conf/", features = {})
+ sm_contex... | |
3624a1d989723f257020c7e93be3f05c4ca45561 | tests/formats_test/misc_test.py | tests/formats_test/misc_test.py | #!/usr/bin/python
import unittest
from blivet.formats import device_formats
import blivet.formats.fs as fs
class MethodsTestCase(unittest.TestCase):
"""Test some methods that do not require actual images."""
def setUp(self):
self.fs = {}
for k, v in device_formats.items():
if iss... | Add some simple tests for file formats. | Add some simple tests for file formats.
Signed-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>
| Python | lgpl-2.1 | rhinstaller/blivet,jkonecny12/blivet,dwlehman/blivet,AdamWill/blivet,vojtechtrefny/blivet,vojtechtrefny/blivet,vpodzime/blivet,rvykydal/blivet,dwlehman/blivet,rhinstaller/blivet,rvykydal/blivet,AdamWill/blivet,vpodzime/blivet,jkonecny12/blivet | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/python
+import unittest
+
+from blivet.formats import device_formats
+import blivet.formats.fs as fs
+
+class MethodsTestCase(unittest.TestCase):
+ """Test some methods that do not require actual images."""
+
+ def setUp(self):
+ self.fs = {}
+ for k, v in dev... | |
a6f75a09d028a02681fd549f6841e8cce791fe56 | stack_repeat_visit_spectra.py | stack_repeat_visit_spectra.py |
"""
Stack RAVE spectra from repeat visits.
"""
import cPickle as pickle
import os
import numpy as np
from astropy.table import Table
parent_spectrum_dir = "/data/gaia-eso/arc/rave/pre-normalized-spectra-with-correct-errors"
stacked_spectrum_dir = os.path.join(parent_spectrum_dir, "stacked-spectra")
if not os.path.... | Add script to co-add repeat visits of stars | Add script to co-add repeat visits of stars
| Python | mit | AnnieJumpCannon/RAVE,AnnieJumpCannon/RAVE | ---
+++
@@ -0,0 +1,76 @@
+
+
+"""
+Stack RAVE spectra from repeat visits.
+"""
+
+import cPickle as pickle
+import os
+import numpy as np
+from astropy.table import Table
+
+parent_spectrum_dir = "/data/gaia-eso/arc/rave/pre-normalized-spectra-with-correct-errors"
+stacked_spectrum_dir = os.path.join(parent_spectrum_... | |
146119213c6d96301b475f49cedde830e0f8e84f | kubernetes/client/apis/__init__.py | kubernetes/client/apis/__init__.py | from __future__ import absolute_import
import warnings
# flake8: noqa
# alias kubernetes.client.api package and print deprecation warning
from kubernetes.client.api import *
warnings.filterwarnings('default', module='kubernetes.client.apis')
warnings.warn(
"The package kubernetes.client.apis is renamed and depre... | Add kubernetes.client.apis as an alias to kubernetes.client.api | Add kubernetes.client.apis as an alias to kubernetes.client.api
Reference: https://github.com/kubernetes-client/python/issues/974
Signed-off-by: Nabarun Pal <46a782cbd1e9f752958998187886c2b51fda054c@gmail.com>
| Python | apache-2.0 | kubernetes-client/python,kubernetes-client/python | ---
+++
@@ -0,0 +1,13 @@
+from __future__ import absolute_import
+import warnings
+
+# flake8: noqa
+
+# alias kubernetes.client.api package and print deprecation warning
+from kubernetes.client.api import *
+
+warnings.filterwarnings('default', module='kubernetes.client.apis')
+warnings.warn(
+ "The package kuber... | |
8d1a849026447e8bcf49d7e74dbd280f5b2a3e9e | string_fundamental/Anagram.py | string_fundamental/Anagram.py | """
An anagram of a string is another string that contains same characters, only the order of characters can be different.
For example "qwerty" and "werqty" are anagrams of each other.
Below methods uses two lists to store the count of every character in respective strings which will be used to determine whether pro... | Add program for anagram in string_fundamental. | Add program for anagram in string_fundamental.
| Python | cc0-1.0 | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | ---
+++
@@ -0,0 +1,34 @@
+"""
+ An anagram of a string is another string that contains same characters, only the order of characters can be different.
+ For example "qwerty" and "werqty" are anagrams of each other.
+ Below methods uses two lists to store the count of every character in respective strings which will b... | |
059f084da18bf5e27aa0369bc4658dbccc6789a4 | python/equality_in_a_array.py | python/equality_in_a_array.py | from collections import Counter
size = int(input().strip())
counts = Counter((map(int, input().strip().split(' '))))
element, count = counts.most_common(1)[0]
print (size - count)
| Solve equality in a array | Solve equality in a array
| Python | mit | rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank | ---
+++
@@ -0,0 +1,6 @@
+from collections import Counter
+
+size = int(input().strip())
+counts = Counter((map(int, input().strip().split(' '))))
+element, count = counts.most_common(1)[0]
+print (size - count) | |
13332854f1d8a863a53504be6edac57f267b0569 | tests/cpp/test_constraints.py | tests/cpp/test_constraints.py | import pytest
import toppra.cpp as tac
def test_linear_vel():
c = tac.LinearJointVelocity([-1, -1], [1, 1])
c.discretizationType = tac.DiscretizationType.Interpolation
assert c.hasUbounds()
assert c.hasXbounds()
assert not c.hasLinearInequalities()
def test_linear_accel():
c = tac.LinearJoi... | Add test for constraint bindings | Add test for constraint bindings
| Python | mit | hungpham2511/toppra,hungpham2511/toppra,hungpham2511/toppra | ---
+++
@@ -0,0 +1,20 @@
+import pytest
+import toppra.cpp as tac
+
+
+def test_linear_vel():
+ c = tac.LinearJointVelocity([-1, -1], [1, 1])
+ c.discretizationType = tac.DiscretizationType.Interpolation
+
+ assert c.hasUbounds()
+ assert c.hasXbounds()
+ assert not c.hasLinearInequalities()
+
+
+def t... | |
a4efdbb5c0817080c3ad381110865ce08081761e | nanshe_workflow/_reg_joblib.py | nanshe_workflow/_reg_joblib.py | import dask
import dask.distributed
import distributed
try:
import dask.distributed.joblib
except ImportError:
pass
try:
import distributed.joblib
except ImportError:
pass
import sklearn
import sklearn.externals
import sklearn.externals.joblib
| Add backwards compatible Distributed Joblib hook | Add backwards compatible Distributed Joblib hook
Depending on the versions of Distributed, Joblib, and scikit-learn,
there are different strategies for registering the Joblib backend. Try
going with the standard Distributed technique first, which may fail for
Distributed 1.24.0+. In other cases, import `joblib` and
`s... | Python | apache-2.0 | DudLab/nanshe_workflow,nanshe-org/nanshe_workflow | ---
+++
@@ -0,0 +1,18 @@
+import dask
+import dask.distributed
+
+import distributed
+
+try:
+ import dask.distributed.joblib
+except ImportError:
+ pass
+
+try:
+ import distributed.joblib
+except ImportError:
+ pass
+
+import sklearn
+import sklearn.externals
+import sklearn.externals.joblib | |
05680d0d5a88adaae83d144558eeee5af1ce0c02 | python/paddle/v2/framework/tests/test_seq_pool.py | python/paddle/v2/framework/tests/test_seq_pool.py | import unittest
import numpy as np
from op_test import OpTest
class TestSeqAvgPool1D(OpTest):
def setUp(self):
self.op_type = 'sequence_avg_pool'
# one level, batch size is 4
x = np.random.uniform(0.1, 1, [11, 23]).astype('float32')
lod = [[0, 4, 5, 8, 11]]
out = np.zeros(... | Add unit testing for sequence average pool operator. | Add unit testing for sequence average pool operator.
| Python | apache-2.0 | luotao1/Paddle,hedaoyuan/Paddle,lcy-seso/Paddle,baidu/Paddle,PaddlePaddle/Paddle,reyoung/Paddle,reyoung/Paddle,pengli09/Paddle,hedaoyuan/Paddle,PaddlePaddle/Paddle,luotao1/Paddle,lcy-seso/Paddle,jacquesqiao/Paddle,hedaoyuan/Paddle,chengduoZH/Paddle,pengli09/Paddle,chengduoZH/Paddle,putcn/Paddle,tensor-tang/Paddle,pkuyy... | ---
+++
@@ -0,0 +1,51 @@
+import unittest
+import numpy as np
+from op_test import OpTest
+
+
+class TestSeqAvgPool1D(OpTest):
+ def setUp(self):
+ self.op_type = 'sequence_avg_pool'
+ # one level, batch size is 4
+ x = np.random.uniform(0.1, 1, [11, 23]).astype('float32')
+ lod = [[0, ... | |
51760a4cf96074b9d2eb609451512b3fafff7aaa | make_test_data.py | make_test_data.py | import sqlite3
INSERT_SONG = '''
INSERT INTO jukebox_song_queue VALUES (?)
'''
TEST_URIS = [
'spotify:track:5lB3bZKPhng9s4hKB1sSIe',
'spotify:track:5MSfgtOBZkbxlcwsI9XNpf',
'spotify:track:1shuGbTnKx4AXjlx7IauM5'
]
if __name__ == '__main__':
conn = sqlite3.connect('jukebox.db')
cursor = conn.c... | Add script to make some test data | Add script to make some test data
| Python | mit | projectweekend/Pi-Jukebox,projectweekend/Pi-Jukebox,projectweekend/Pi-Jukebox | ---
+++
@@ -0,0 +1,25 @@
+import sqlite3
+
+
+INSERT_SONG = '''
+INSERT INTO jukebox_song_queue VALUES (?)
+'''
+
+TEST_URIS = [
+ 'spotify:track:5lB3bZKPhng9s4hKB1sSIe',
+ 'spotify:track:5MSfgtOBZkbxlcwsI9XNpf',
+ 'spotify:track:1shuGbTnKx4AXjlx7IauM5'
+]
+
+
+if __name__ == '__main__':
+
+ conn = sqlit... | |
29d2f9f79917cebaf5e126b4ddac4f341ef2a2ae | etk/cli/ontodocgen.py | etk/cli/ontodocgen.py | from etk.ontology_api import Ontology
from etk.ontology_report_generator import OntologyReportGenerator
def add_arguments(parser):
parser.description = 'Generate HTML report for the input ontology files'
parser.add_argument('files', nargs='+', help='Input turtle files.')
parser.add_argument('--no-validati... | Add a cli for ontology report generator | Add a cli for ontology report generator
| Python | mit | usc-isi-i2/etk,usc-isi-i2/etk,usc-isi-i2/etk | ---
+++
@@ -0,0 +1,34 @@
+from etk.ontology_api import Ontology
+from etk.ontology_report_generator import OntologyReportGenerator
+
+
+def add_arguments(parser):
+ parser.description = 'Generate HTML report for the input ontology files'
+ parser.add_argument('files', nargs='+', help='Input turtle files.')
+ ... | |
9ff26b3e351e9bb686d59529454b00b52afde0af | us_ignite/maps/utils.py | us_ignite/maps/utils.py | def get_location_dict(item, location_type):
return {
'type': location_type,
'latitude': item.position.latitude,
'longitude': item.position.longitude,
'name': item.name,
'website': item.get_absolute_url(),
'category': '',
'image': '',
'content': item.na... | Relocate dict generator for the locations. | Relocate dict generator for the locations.
| Python | bsd-3-clause | us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite | ---
+++
@@ -0,0 +1,11 @@
+def get_location_dict(item, location_type):
+ return {
+ 'type': location_type,
+ 'latitude': item.position.latitude,
+ 'longitude': item.position.longitude,
+ 'name': item.name,
+ 'website': item.get_absolute_url(),
+ 'category': '',
+ 'im... | |
ee1343d8e1bbe0ad8533125b28956b150a41147a | Lib/test/test_gettext.py | Lib/test/test_gettext.py | import os
import gettext
def get_qualified_path(name):
"""Return a more qualified path to name"""
import sys
import os
path = sys.path
try:
path = [os.path.dirname(__file__)] + path
except NameError:
pass
for dir in path:
fullname = os.path.join(dir, name)
if... | Test suite for new gettext.py module. | Test suite for new gettext.py module.
| Python | mit | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | ---
+++
@@ -0,0 +1,76 @@
+import os
+import gettext
+
+def get_qualified_path(name):
+ """Return a more qualified path to name"""
+ import sys
+ import os
+ path = sys.path
+ try:
+ path = [os.path.dirname(__file__)] + path
+ except NameError:
+ pass
+ for dir in path:
+ full... | |
2b5cad439ef59cf1aa1ebec396f02b1bec7cdaaa | sum_primes/sum_primes.py | sum_primes/sum_primes.py |
def gen_primes():
# logic from Sieve of Eratosthenes
# by David Eppstein, UC Irvine, 28 Feb 2002
# http://code.activestate.com/recipes/117119/
# changed var names
sieve = {}
check_int = 2
while True:
if check_int not in sieve:
yield check_int
sieve[check_int ... | Implement solution for sum of first 1000 primes | Implement solution for sum of first 1000 primes
| Python | mit | MikeDelaney/CodeEval | ---
+++
@@ -0,0 +1,25 @@
+
+def gen_primes():
+ # logic from Sieve of Eratosthenes
+ # by David Eppstein, UC Irvine, 28 Feb 2002
+ # http://code.activestate.com/recipes/117119/
+ # changed var names
+ sieve = {}
+ check_int = 2
+ while True:
+ if check_int not in sieve:
+ yield ... | |
7b22421343cc29695f254c9334db0481c2c34f64 | numba2/runtime/obj/intobject.py | numba2/runtime/obj/intobject.py | # -*- coding: utf-8 -*-
"""
int/long implementation.
"""
from __future__ import print_function, division, absolute_import
from ... import jit, implements, typeof
from ..interfaces import Number
@implements('Int[nbits]', Number)
class Int(object):
pass
@typeof.case((int, long))
def typeof(pyval):
return Int... | Add dummy int/long object implementing Number | Add dummy int/long object implementing Number
| Python | bsd-2-clause | flypy/flypy,flypy/flypy | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+
+"""
+int/long implementation.
+"""
+
+from __future__ import print_function, division, absolute_import
+
+from ... import jit, implements, typeof
+from ..interfaces import Number
+
+@implements('Int[nbits]', Number)
+class Int(object):
+ pass
+
+@typeof.case((in... | |
284913283fa2340681bdfb5ca3ca3faef9d404b4 | app/soc/modules/gci/views/helper/url_patterns.py | app/soc/modules/gci/views/helper/url_patterns.py | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | Implement GCI url patterns module based on the core url patterns module. | Implement GCI url patterns module based on the core url patterns module.
This code is partly taken from Selwyn's patches during GSoC 2011. Thanks
to Selwyn for the patch.
--HG--
extra : rebase_source : a64b9d703c2e309084a77aec627b8c7160186c66
| Python | apache-2.0 | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | ---
+++
@@ -0,0 +1,40 @@
+#!/usr/bin/env python2.5
+#
+# Copyright 2011 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICEN... | |
58d0bd08b942f07f80ba3e4a0bd0a6849919e4c9 | utils/simtel_to_astri_cropped_geom_json_file.py | utils/simtel_to_astri_cropped_geom_json_file.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# This script is provided under the terms and conditions of the MIT license:
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (th... | Add a tool script to make geom.json files. | Add a tool script to make geom.json files.
| Python | mit | jdhp-sap/data-pipeline-standalone-scripts,jdhp-sap/sap-cta-data-pipeline,jdhp-sap/data-pipeline-standalone-scripts,jdhp-sap/sap-cta-data-pipeline | ---
+++
@@ -0,0 +1,83 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
+
+# This script is provided under the terms and conditions of the MIT license:
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and... | |
e0e7ccbea4a0c55533e27e595b59e442a9da263d | openstack/common/setup.py | openstack/common/setup.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# 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/... | Split functions to avoid eventlet import. | Split functions to avoid eventlet import.
Some of these functions are used in setup.py. In a virtualenv
based workflow, python setup.py sdist is called to create a
tarball which is then installed into the virtualenv. These
functions need to be in a separate file so that they can be
imported by setup.py without eventle... | Python | apache-2.0 | markmc/oslo.packaging,markmc/oslo.packaging | ---
+++
@@ -0,0 +1,42 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2011 OpenStack LLC.
+# 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... | |
74e5e9e8d6dd117b91466f30b961593ef43dd618 | dbaas/maintenance/scripts/compare_resource_id.py | dbaas/maintenance/scripts/compare_resource_id.py | from faasclient.client import Client
credential = get_credentials_for(Environment.objects.get(name='dev'), CredentialType.FAAS)
faas_client = Client(
authurl=credential.endpoint,
user=credential.user, key=credential.password,
tenant_name=credential.project,
insecure=False
)
for vol in Volume.objects.filter(ho... | Create script to compare resource id of all volumes | Create script to compare resource id of all volumes
| Python | bsd-3-clause | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | ---
+++
@@ -0,0 +1,19 @@
+from faasclient.client import Client
+
+
+credential = get_credentials_for(Environment.objects.get(name='dev'), CredentialType.FAAS)
+faas_client = Client(
+ authurl=credential.endpoint,
+ user=credential.user, key=credential.password,
+ tenant_name=credential.project,
+ insecure=False
+... | |
4a3c77eb0e69b1bd79c411e2956c158f969bf04c | databroker/tests/test_v2/test_relative_root_map.py | databroker/tests/test_v2/test_relative_root_map.py | import pathlib
import shutil
from bluesky.plans import count
from databroker._drivers.jsonl import BlueskyJSONLCatalog
import intake
from ophyd.sim import img
import pytest
from suitcase.jsonl import Serializer
def test_relative_root_map(RE, tmpdir):
"""
When a Run has no RunStop document, whether because it... | Add test for relative root_map. | Add test for relative root_map.
| Python | bsd-3-clause | ericdill/databroker,ericdill/databroker | ---
+++
@@ -0,0 +1,51 @@
+import pathlib
+import shutil
+
+from bluesky.plans import count
+from databroker._drivers.jsonl import BlueskyJSONLCatalog
+import intake
+from ophyd.sim import img
+import pytest
+from suitcase.jsonl import Serializer
+
+
+def test_relative_root_map(RE, tmpdir):
+ """
+ When a Run ha... | |
53cfbf8ffd1485bf6a88f5d92fcb9fdaf9c6866a | venues/plugin_jacktherooster.py | venues/plugin_jacktherooster.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import List
import lxml.html
import re
import time
from venues.abstract_venue import AbstractVenue
class Jacktherooster(AbstractVenue):
def __init__(self):
super().__init__()
self.url = "http://www.meteli.net/jacktherooster"
sel... | Add plugin for venue Jack the rooster. | Add plugin for venue Jack the rooster.
| Python | isc | weezel/BandEventNotifier | ---
+++
@@ -0,0 +1,81 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+from typing import List
+
+import lxml.html
+
+import re
+import time
+
+from venues.abstract_venue import AbstractVenue
+
+
+class Jacktherooster(AbstractVenue):
+ def __init__(self):
+ super().__init__()
+ self.url = "http:/... | |
d84f748f60542d91542ef2e623947f72d562ca35 | junction/proposals/migrations/0028_auto_20200617_2337.py | junction/proposals/migrations/0028_auto_20200617_2337.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2020-06-17 18:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("proposals", "0027_auto_20200502_0540"),
]
operations = [
migrations.AlterField... | Add missing migrations related to video URL | Add missing migrations related to video URL
Related to #668
Signed-off-by: Nabarun Pal <46a782cbd1e9f752958998187886c2b51fda054c@gmail.com>
| Python | mit | pythonindia/junction,pythonindia/junction,pythonindia/junction,pythonindia/junction | ---
+++
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9 on 2020-06-17 18:07
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("proposals", "0027_auto_20200502_0540"),
+ ]
+
+ ope... | |
34968a1c507af6d5343e15e4c2da533fd90740da | py/sort-characters-by-frequency.py | py/sort-characters-by-frequency.py | from collections import Counter
class Solution(object):
def frequencySort(self, s):
"""
:type s: str
:rtype: str
"""
c = Counter(s)
return ''.join(a * b for a, b in sorted(c.iteritems(), key=lambda x:-x[1]))
| Add py solution for 451. Sort Characters By Frequency | Add py solution for 451. Sort Characters By Frequency
451. Sort Characters By Frequency: https://leetcode.com/problems/sort-characters-by-frequency/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,9 @@
+from collections import Counter
+class Solution(object):
+ def frequencySort(self, s):
+ """
+ :type s: str
+ :rtype: str
+ """
+ c = Counter(s)
+ return ''.join(a * b for a, b in sorted(c.iteritems(), key=lambda x:-x[1])) | |
b7e0811fccbd76ee690c9e042ca86ad419b2d226 | pyservice/extensions.py | pyservice/extensions.py | from pyservice.layer import Layer
class ClientAuthLayer(Layer):
def handle_request(self, context, next):
client = context["client"]
key = client._attr("authuser", None)
pw = client._attr("authpw", None)
if key is None or pw is None:
raise ValueError("Must provide authus... | Add sample basic auth layers | Add sample basic auth layers
Not very flexible, these are more meant to be a sample for others
creating Layers. Given how similar the code is and how basic most
hande_request() methods will be, it might be worth creating something
similar to @contextmanager, so that it's trivial to create a layer from
a single method... | Python | mit | numberoverzero/pyservice | ---
+++
@@ -0,0 +1,21 @@
+from pyservice.layer import Layer
+
+class ClientAuthLayer(Layer):
+
+ def handle_request(self, context, next):
+ client = context["client"]
+ key = client._attr("authuser", None)
+ pw = client._attr("authpw", None)
+ if key is None or pw is None:
+ ... | |
6f632dc5b0f1ee35aaf0041d5bd09f3458dd9d42 | enabled/_50_rackspace.py | enabled/_50_rackspace.py | DASHBOARD = 'rackspace'
ADD_INSTALLED_APPS = [
'rackspace',
]
ADD_ANGULAR_MODULES = ['horizon.dashboard.rackspace']
# If set to True, this dashboard will not be added to the settings.
DISABLED = False
| Update enabled to be simpler and match rpc-openstack. | Update enabled to be simpler and match rpc-openstack.
| Python | apache-2.0 | BjoernT/rpc-openstack,jacobwagner/rpc-openstack,rcbops/rpc-openstack,robb-romans/rpc-openstack,galstrom21/rpc-openstack,xeregin/rpc-openstack,jacobwagner/rpc-openstack,darrenchan/rpc-openstack,xeregin/rpc-openstack,cloudnull/rpc-openstack,xeregin/rpc-openstack,cloudnull/rpc-openstack,sigmavirus24/rpc-openstack,darrench... | ---
+++
@@ -0,0 +1,10 @@
+DASHBOARD = 'rackspace'
+
+ADD_INSTALLED_APPS = [
+ 'rackspace',
+]
+
+ADD_ANGULAR_MODULES = ['horizon.dashboard.rackspace']
+
+# If set to True, this dashboard will not be added to the settings.
+DISABLED = False | |
964607453ea240f8f281a1d84c24fe3b98fda6f4 | exp/alto/tools/find_nulls.py | exp/alto/tools/find_nulls.py | #!/usr/bin/env python
# *-* coding=utf-8 *-*
# Compares the nolarge.graphs file (the one without #-lines) and Alto's output to find sentences that cannot be parsed
import sys
from itertools import izip
import re
def find_nulls(fn1, fn2):
with open(sys.argv[1]) as nolarge_graphs, open (sys.argv[2]) as alto_outpu... | Add script for finding sentences that cannot be parsed with our IRTG | Add script for finding sentences that cannot be parsed with our IRTG
| Python | mit | kornai/4lang,kornai/4lang,kornai/4lang,kornai/4lang | ---
+++
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+# *-* coding=utf-8 *-*
+
+# Compares the nolarge.graphs file (the one without #-lines) and Alto's output to find sentences that cannot be parsed
+
+import sys
+from itertools import izip
+import re
+
+def find_nulls(fn1, fn2):
+ with open(sys.argv[1]) as nolarge_gr... | |
95c33d94d5efa5157c45c96cb7f2279c655568a7 | dashboard/dashboard/services/google_sheets_service.py | dashboard/dashboard/services/google_sheets_service.py | # Copyright 2017 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.
"""An interface to the Google Spreadsheets API.
API documentation: https://developers.google.com/sheets/api/reference/rest/
This service uses the default a... | Add basic spreadsheet service which can get a range from a public spreadsheet. | Add basic spreadsheet service which can get a range from a public spreadsheet.
Justification: the owners and some other more minor details about
benchmarks are currently stored in a spreadsheet. I need to get that
data to make a solid benchmark health report, and I'd like to get the
report soon so we can use it to get... | Python | bsd-3-clause | catapult-project/catapult,sahiljain/catapult,benschmaus/catapult,benschmaus/catapult,benschmaus/catapult,sahiljain/catapult,sahiljain/catapult,benschmaus/catapult,catapult-project/catapult-csm,benschmaus/catapult,catapult-project/catapult-csm,catapult-project/catapult-csm,catapult-project/catapult-csm,sahiljain/catapul... | ---
+++
@@ -0,0 +1,45 @@
+# Copyright 2017 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.
+
+"""An interface to the Google Spreadsheets API.
+
+API documentation: https://developers.google.com/sheets/api/reference/rest... | |
e1b62a5d39fd3a4adb7d783c131fd122ba09c3d5 | support/biicode-build.py | support/biicode-build.py | #!/usr/bin/env python
# Build the project with Biicode.
import bootstrap, glob, os, shutil
from download import Downloader
from subprocess import check_call
os_name = os.environ['TRAVIS_OS_NAME']
if os_name == 'linux':
# Install newer version of CMake.
bootstrap.install_cmake(
'cmake-3.1.1-Linux-i386.tar.gz',... | #!/usr/bin/env python
# Build the project with Biicode.
import bootstrap, glob, os, shutil
from download import Downloader
from subprocess import check_call
os_name = os.environ['TRAVIS_OS_NAME']
if os_name == 'linux':
# Install newer version of CMake.
bootstrap.install_cmake(
'cmake-3.1.1-Linux-i386.tar.gz',... | Install CMake in system dirs | Install CMake in system dirs | Python | bsd-2-clause | blaquee/cppformat,mojoBrendan/fmt,cppformat/cppformat,mojoBrendan/fmt,seungrye/cppformat,lightslife/cppformat,nelson4722/cppformat,alabuzhev/fmt,alabuzhev/fmt,lightslife/cppformat,lightslife/cppformat,cppformat/cppformat,alabuzhev/fmt,cppformat/cppformat,Jopie64/cppformat,blaquee/cppformat,mojoBrendan/fmt,dean0x7d/cppf... | ---
+++
@@ -9,7 +9,7 @@
if os_name == 'linux':
# Install newer version of CMake.
bootstrap.install_cmake(
- 'cmake-3.1.1-Linux-i386.tar.gz', check_installed=False, download_dir=None, install_dir='.')
+ 'cmake-3.1.1-Linux-i386.tar.gz', check_installed=False, download_dir=None)
with Downloader().downloa... |
94f1a090214d13d6b2dc28576014c2b83d93d18d | sgt/accounts/migrations/0003_auto_20160507_1902.py | sgt/accounts/migrations/0003_auto_20160507_1902.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-05-07 19:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0002_auto_20150629_1908'),
]
operations = [
migrations.AlterField(... | Create migration file for accounts app | Create migration file for accounts app
| Python | mit | mazulo/SGT,mazulo/SGT | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9 on 2016-05-07 19:02
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('accounts', '0002_auto_20150629_1908'),
+ ]
+
+ oper... | |
8a2979ae72bcd691521e2694c974219edfe5dc3b | altair/examples/top_k_with_others.py | altair/examples/top_k_with_others.py | """
Top-K plot with Others
----------------------
This example shows how to use aggregate, window, and calculate transfromations
to display the top-k directors by average worldwide gross while grouping the
remaining directors as 'All Others'.
"""
# category: case studies
import altair as alt
from vega_datasets import ... | Add example for Top-K with Others. | DOC: Add example for Top-K with Others.
| Python | bsd-3-clause | altair-viz/altair,jakevdp/altair | ---
+++
@@ -0,0 +1,35 @@
+"""
+Top-K plot with Others
+----------------------
+This example shows how to use aggregate, window, and calculate transfromations
+to display the top-k directors by average worldwide gross while grouping the
+remaining directors as 'All Others'.
+"""
+# category: case studies
+import alta... | |
fd6a777857bc55f1744d86d3756051b236b7f822 | package_monitor/migrations/0004_auto_20160109_1339.py | package_monitor/migrations/0004_auto_20160109_1339.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('package_monitor', '0003_packageversion_next_version'),
]
operations = [
migrations.AlterField(
model_name='packa... | Add missing migration, bump to version 0.3.2 | Add missing migration, bump to version 0.3.2
It's only metadata (labels), so not a dealbreaker.
| Python | mit | yunojuno/django-package-monitor,yunojuno/django-package-monitor | ---
+++
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('package_monitor', '0003_packageversion_next_version'),
+ ]
+
+ operations = [
+ migrations.... | |
0534a6a8a59d16d189b6dc8f452a29b4dee4ff72 | evelink/__init__.py | evelink/__init__.py | """EVELink - Python bindings for the EVE API."""
import logging
from evelink import account
from evelink import api
from evelink import char
from evelink import constants
from evelink import corp
from evelink import eve
from evelink import map
from evelink import server
__version__ = "0.4.0"
# Implement NullHandler... | """EVELink - Python bindings for the EVE API."""
import logging
from evelink import account
from evelink import api
from evelink import char
from evelink import constants
from evelink import corp
from evelink import eve
from evelink import map
from evelink import server
__version__ = "0.4.1"
# Implement NullHandler... | Update version to 0.4.1 for release | Update version to 0.4.1 for release
| Python | mit | bastianh/evelink,zigdon/evelink,ayust/evelink,Morloth1274/EVE-Online-POCO-manager,FashtimeDotCom/evelink | ---
+++
@@ -11,7 +11,7 @@
from evelink import map
from evelink import server
-__version__ = "0.4.0"
+__version__ = "0.4.1"
# Implement NullHandler because it was only added in Python 2.7+.
class NullHandler(logging.Handler): |
221ce25961d1344acf04146c1006c5dc239649ac | anaconda-mode/0.1.1/anaconda_mode.py | anaconda-mode/0.1.1/anaconda_mode.py | """
anaconda_mode
~~~~~~~~~~~~~
This is anaconda_mode autocompletion server.
:copyright: (c) 2013-2015 by Artem Malyshev.
:license: GPL3, see LICENSE for more details.
"""
from __future__ import (
absolute_import, unicode_literals, division, print_function)
import sys
from functools import w... | Check in anaconda-mode.py so pip doesn't need to install it. | Check in anaconda-mode.py so pip doesn't need to install it.
| Python | mit | Wilfred/.emacs.d,Wilfred/.emacs.d,Wilfred/.emacs.d,Wilfred/.emacs.d,Wilfred/.emacs.d,Wilfred/.emacs.d,Wilfred/.emacs.d | ---
+++
@@ -0,0 +1,105 @@
+"""
+ anaconda_mode
+ ~~~~~~~~~~~~~
+
+ This is anaconda_mode autocompletion server.
+
+ :copyright: (c) 2013-2015 by Artem Malyshev.
+ :license: GPL3, see LICENSE for more details.
+"""
+
+from __future__ import (
+ absolute_import, unicode_literals, division, print_funct... | |
96c76f7a73f247374f5f0113ca048a8970398009 | tests/unit/utils/cache_test.py | tests/unit/utils/cache_test.py | # -*- coding: utf-8 -*-
'''
tests.unit.utils.cache_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test the salt cache objects
'''
# Import Salt Testing libs
from salttesting import TestCase
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
from salt.utils import cache
im... | Add some unit tests for cache object | Add some unit tests for cache object
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+'''
+ tests.unit.utils.cache_test
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ Test the salt cache objects
+'''
+
+# Import Salt Testing libs
+from salttesting import TestCase
+from salttesting.helpers import ensure_in_syspath
+ensure_in_syspath('../../')
+
+# Import s... | |
7d6d73dab90be9d3c77cfd81d73e0b5e21c340fa | playlist-to-yaml.py | playlist-to-yaml.py | """Convert Exportify csv Spotify playlists to yaml."""
import os
import glob
import pandas
import yaml
csv_files = glob.glob("*.csv")
for playlist_file in csv_files:
playlist_name, _ = os.path.splitext(playlist_file)
yaml_file = 'yaml/{}.yaml'.format(playlist_name)
print("- {}".format(yaml_file))
pl... | Convert a Spotify playylist from Exportify to yaml | Convert a Spotify playylist from Exportify to yaml
| Python | mit | mdpiper/wunderkammer,mdpiper/wunderkammer,mdpiper/wunderkammer,mdpiper/wunderkammer | ---
+++
@@ -0,0 +1,20 @@
+"""Convert Exportify csv Spotify playlists to yaml."""
+import os
+import glob
+import pandas
+import yaml
+
+
+csv_files = glob.glob("*.csv")
+
+for playlist_file in csv_files:
+ playlist_name, _ = os.path.splitext(playlist_file)
+ yaml_file = 'yaml/{}.yaml'.format(playlist_name)
+ ... | |
a414bf58797809c3d79251fe0c818b1496bb36a8 | scripts/hmi.py | scripts/hmi.py | #!/usr/bin/env python
import rospy
from std_msgs.msg import Int32
from controller.msg import control
mux_pub = rospy.Publisher('pwm_signal_input', Int32, queue_size=10)
def controller_callback(data):
mux_pub.publish(data.strafe_X)
print(data.strafe_X)
if __name__ == '__main__':
rospy.init_node('mux_... | Add human machine interface node | Add human machine interface node
| Python | mit | vortexntnu/rov-control,vortexntnu/rov-control,vortexntnu/rov-control | ---
+++
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+import rospy
+from std_msgs.msg import Int32
+from controller.msg import control
+
+
+mux_pub = rospy.Publisher('pwm_signal_input', Int32, queue_size=10)
+
+def controller_callback(data):
+ mux_pub.publish(data.strafe_X)
+ print(data.strafe_X)
+
+
+if __name__... | |
4bc449e790bec8faf700162e3b9c98e001aa1ff2 | python/grayscale.py | python/grayscale.py | import requests
import json
# Convert a given image to gray color model. A grayscale (or graylevel) image is simply one in which the only colors are shades of gray.
# https://pixlab.io/#/cmd?id=grayscale for additional information.
req = requests.get('https://api.pixlab.io/grayscale',params={'img':'https://www.allabo... | Convert a given image to gray color model | Convert a given image to gray color model | Python | bsd-2-clause | symisc/pixlab,symisc/pixlab,symisc/pixlab | ---
+++
@@ -0,0 +1,12 @@
+import requests
+import json
+
+# Convert a given image to gray color model. A grayscale (or graylevel) image is simply one in which the only colors are shades of gray.
+# https://pixlab.io/#/cmd?id=grayscale for additional information.
+
+req = requests.get('https://api.pixlab.io/grayscale'... | |
d3eaa685f788fc6dd19681175d9e0b45a6989fdf | caffe2/python/layers/add_bias.py | caffe2/python/layers/add_bias.py | ## @package add_bias
# Module caffe2.python.layers.add_bias
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core, schema
from caffe2.python.layers.layers import (
ModelLayer,
LayerPara... | Add bias to cosine distance for two tower models | Add bias to cosine distance for two tower models
Summary: Currently using two tower models with cosine distance results in bad calibration. Adding bias to the output of cosine term solves the problem.
Reviewed By: xianjiec
Differential Revision: D5132606
fbshipit-source-id: eb4fa75acf908db89954eeee67627b4a00572f61
| Python | apache-2.0 | pietern/caffe2,pietern/caffe2,xzturn/caffe2,pietern/caffe2,bwasti/caffe2,pietern/caffe2,davinwang/caffe2,pietern/caffe2,xzturn/caffe2,davinwang/caffe2,davinwang/caffe2,bwasti/caffe2,xzturn/caffe2,davinwang/caffe2,xzturn/caffe2,Yangqing/caffe2,xzturn/caffe2,davinwang/caffe2,bwasti/caffe2,bwasti/caffe2,Yangqing/caffe2,sf... | ---
+++
@@ -0,0 +1,54 @@
+## @package add_bias
+# Module caffe2.python.layers.add_bias
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+from caffe2.python import core, schema
+from caffe2.python.layers.layers im... | |
437b334588ce05bb94d489e51cb43af76cd5180c | localtv/management/commands/clear_tiers_state.py | localtv/management/commands/clear_tiers_state.py | # This file is part of Miro Community.
# Copyright (C) 2011 Participatory Culture Foundation
#
# Miro Community 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, or (at y... | Add a management command that resets tiers state | Add a management command that resets tiers state
| Python | agpl-3.0 | pculture/mirocommunity,pculture/mirocommunity,pculture/mirocommunity,pculture/mirocommunity | ---
+++
@@ -0,0 +1,54 @@
+# This file is part of Miro Community.
+# Copyright (C) 2011 Participatory Culture Foundation
+#
+# Miro Community 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 v... | |
e2be62a7c4e5184851b4f0383a324ffefa1e3b48 | tools/touch_all_files.py | tools/touch_all_files.py | #!/usr/bin/python
"""
This script touches all files known to the database, creating a skeletal
mirror for local development.
"""
import sys, os
import store
def get_paths(cursor, prefix=None):
store.safe_execute(cursor, "SELECT python_version, name, filename FROM release_files")
for type, name, filename in c... | Add script to synthesize all uploaded files. Patch by Dan Callahan. | Add script to synthesize all uploaded files.
Patch by Dan Callahan.
git-svn-id: 757818eefc3e095bf4f5c16d67ad3f55b5150c3d@608 072f9a9a-8cf7-0310-8ca5-bf92c90cb7c1
| Python | bsd-3-clause | ericholscher/pypi,ericholscher/pypi | ---
+++
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+"""
+This script touches all files known to the database, creating a skeletal
+mirror for local development.
+"""
+
+import sys, os
+import store
+
+def get_paths(cursor, prefix=None):
+ store.safe_execute(cursor, "SELECT python_version, name, filename FROM release_file... | |
592786370f21730bcf574b2ce483550ee176ca20 | python/chapter_4.py | python/chapter_4.py | import math
class Opt:
def __init__(self, v = None):
self.valid = (v != None)
self.value = v
def safe_rezi(x):
if x == 0:
return Opt()
else:
return Opt(1/x)
def safe_root(x):
if x < 0:
return Opt()
else:
return Opt(math.sqrt(x))
def compose(f,g):
... | Add Python Chapter 4 Challenges | Add Python Chapter 4 Challenges
| Python | mit | stefanheyder/ReadingCourseCategoryTheroy,stefanheyder/ReadingCourseCategoryTheroy | ---
+++
@@ -0,0 +1,29 @@
+import math
+
+class Opt:
+ def __init__(self, v = None):
+ self.valid = (v != None)
+ self.value = v
+
+def safe_rezi(x):
+ if x == 0:
+ return Opt()
+ else:
+ return Opt(1/x)
+
+def safe_root(x):
+ if x < 0:
+ return Opt()
+ else:
+ ... | |
28bb129931e14d5681ba717f6c949e2305fd2e03 | django/website/main/tests/test_merge_coverage_handling.py | django/website/main/tests/test_merge_coverage_handling.py | from mock import Mock
from main.management.commands.merge_coverage_files import Command
from main.tests.helper_methods import mock_out_unwanted_methods
def test_merge_coverage_handle_calls_parse_options():
merge_coverage_files_command = Command()
# We don't want these methods to run
mock_out_unwanted_me... | Add tests to run command to merge content | Add tests to run command to merge content | Python | agpl-3.0 | daniell/kashana,aptivate/alfie,daniell/kashana,aptivate/alfie,daniell/kashana,daniell/kashana,aptivate/kashana,aptivate/kashana,aptivate/kashana,aptivate/alfie,aptivate/alfie,aptivate/kashana | ---
+++
@@ -0,0 +1,58 @@
+from mock import Mock
+
+from main.management.commands.merge_coverage_files import Command
+from main.tests.helper_methods import mock_out_unwanted_methods
+
+
+def test_merge_coverage_handle_calls_parse_options():
+ merge_coverage_files_command = Command()
+
+ # We don't want these me... | |
9a56b447aaf546814e4e87bc6d60855b33fdf3ff | tests/test_pgbackup.py | tests/test_pgbackup.py | # coding: utf-8
"""
Unit tests for essential functions in postgresql backup.
"""
from unittest.mock import MagicMock, mock_open, patch
import pytest
import smdba.postgresqlgate
class TestPgBackup:
"""
Test suite for postgresql backup.
"""
@patch("smdba.postgresqlgate.os.path.exists", MagicMock(return_... | Add unit test suite for PgBackup | Add unit test suite for PgBackup
| Python | mit | SUSE/smdba,SUSE/smdba | ---
+++
@@ -0,0 +1,24 @@
+# coding: utf-8
+"""
+Unit tests for essential functions in postgresql backup.
+"""
+from unittest.mock import MagicMock, mock_open, patch
+import pytest
+import smdba.postgresqlgate
+
+
+class TestPgBackup:
+ """
+ Test suite for postgresql backup.
+ """
+ @patch("smdba.postgres... | |
eee3d08ae24174ae0c44853a688e30d3adaf13c5 | cryptex/pl_calculator.py | cryptex/pl_calculator.py | from decimal import Decimal
from cryptex.transaction import Deposit, Withdrawal
from cryptex.trade import Buy, Sell
from functools import partial
class PLCalculator(object):
def __init__(self, exchange):
self.exchange = exchange
@staticmethod
def convert_transaction(market, tx):
"""
... | Add PL Calculator for unrealized profit and loss calculation | Add PL Calculator for unrealized profit and loss calculation
| Python | mit | coink/cryptex | ---
+++
@@ -0,0 +1,63 @@
+from decimal import Decimal
+
+from cryptex.transaction import Deposit, Withdrawal
+from cryptex.trade import Buy, Sell
+from functools import partial
+
+class PLCalculator(object):
+ def __init__(self, exchange):
+ self.exchange = exchange
+
+ @staticmethod
+ def convert_tra... | |
a4e5a2d0efa013847f0b1e90954739fe7224e30d | tests/test_resources.py | tests/test_resources.py | import pytest
from mock import patch, Mock
from spanky.resources import package
class TestPackageResource(object):
def test_package_install(self):
pack = package.Package('nginx')
pack._ok = Mock()
pack._ok.return_value = 'install ok installed'
pack.installed = Mock()
pa... | Add unit tests for package resource | Add unit tests for package resource
| Python | bsd-3-clause | pglbutt/spanky,pglbutt/spanky,pglbutt/spanky | ---
+++
@@ -0,0 +1,59 @@
+import pytest
+
+from mock import patch, Mock
+
+from spanky.resources import package
+
+
+class TestPackageResource(object):
+
+ def test_package_install(self):
+ pack = package.Package('nginx')
+ pack._ok = Mock()
+ pack._ok.return_value = 'install ok installed'
+
+... | |
855972f9e8b59732a65111fb69f1388272727849 | yatsm/regression/cran.py | yatsm/regression/cran.py | """ Regression or prediction methods from R
"""
import numpy as np
from rpy2.robjects.packages import importr
import rpy2.robjects.numpy2ri
rpy2.robjects.numpy2ri.activate()
Rstats = importr('stats')
def CRAN_spline(x, y, spar=0.55):
""" Return a prediction function for a smoothing spline from R
Use `rpy2`... | Move R's spline to regression module | Move R's spline to regression module
| Python | mit | c11/yatsm,c11/yatsm | ---
+++
@@ -0,0 +1,38 @@
+""" Regression or prediction methods from R
+"""
+import numpy as np
+from rpy2.robjects.packages import importr
+import rpy2.robjects.numpy2ri
+
+rpy2.robjects.numpy2ri.activate()
+
+Rstats = importr('stats')
+
+
+def CRAN_spline(x, y, spar=0.55):
+ """ Return a prediction function for a... | |
bc1f2adee99e2c20c897e6ec012e4014aecba26b | tests/test_models.py | tests/test_models.py | import unittest
from app import create_app, db
from app.models import User
class TestUtils(unittest.TestCase):
def setUp(self):
self.app = create_app("testing")
self.app_ctx = self.app.app_context()
self.app_ctx.push()
db.create_all()
def tearDown(self):
db.session.re... | Add test for User table initialization | Add test for User table initialization
| Python | mit | Encrylize/MyDictionary,Encrylize/MyDictionary,Encrylize/MyDictionary | ---
+++
@@ -0,0 +1,26 @@
+import unittest
+
+from app import create_app, db
+from app.models import User
+
+
+class TestUtils(unittest.TestCase):
+ def setUp(self):
+ self.app = create_app("testing")
+ self.app_ctx = self.app.app_context()
+ self.app_ctx.push()
+ db.create_all()
+
+ ... | |
604b24cfdf03b657e4a60d3f8dd9e2cf1c10cf5a | baseline_knn_mi_webKB.py | baseline_knn_mi_webKB.py | import numpy as np
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_selection import chi2, SelectKBest
from sklearn.neighbors import KNeighborsClassifier
from sklearn import metrics
from sklearn.model_selection import cross_val_score
data = pd.read_table("data/WebKB/... | Add inital MI feature selection code | Add inital MI feature selection code
| Python | mit | achyudhk/Ensemble-Text-Classification | ---
+++
@@ -0,0 +1,35 @@
+import numpy as np
+import pandas as pd
+from sklearn.feature_extraction.text import TfidfVectorizer
+from sklearn.feature_selection import chi2, SelectKBest
+from sklearn.neighbors import KNeighborsClassifier
+from sklearn import metrics
+from sklearn.model_selection import cross_val_score
... | |
c50700f935c81d8fde838192c6201a513d3ab1cf | src/draw_mosaic.py | src/draw_mosaic.py | import optparse
import fractions
import cairo
import turkshead
width = 8
height = 6
size = 200
img = cairo.ImageSurface( cairo.FORMAT_RGB24, width * size, height * size )
ctx = cairo.Context( img )
ctx.set_source_rgb( 1, 1, 0xBF / 255. )
ctx.paint()
ctx.translate( -size / 2, -size / 2 )
ctx.set_source_rgb( 0, 0, 0 ... | Add a mosaic drawer in Python | Add a mosaic drawer in Python
| Python | mit | jacquev6/DrawTurksHead,jacquev6/DrawTurksHead,jacquev6/DrawTurksHead | ---
+++
@@ -0,0 +1,28 @@
+import optparse
+import fractions
+
+import cairo
+
+import turkshead
+
+width = 8
+height = 6
+size = 200
+
+img = cairo.ImageSurface( cairo.FORMAT_RGB24, width * size, height * size )
+ctx = cairo.Context( img )
+ctx.set_source_rgb( 1, 1, 0xBF / 255. )
+ctx.paint()
+ctx.translate( -size / ... | |
90c6293ef1f719d53e02bd4c6f613cb205fa9497 | test/test_connection.py | test/test_connection.py | """ Tests for the Connection module """
import unittest
from src import connection
class TestConnection(unittest.TestCase):
""" Tests for the Connection module """
def test_default_instantiation(self):
""" Test a known default instantiation """
single_connection = connection.Connection()
... | Add tests for connection class | Add tests for connection class
| Python | mit | blairck/jaeger | ---
+++
@@ -0,0 +1,72 @@
+""" Tests for the Connection module """
+
+import unittest
+
+from src import connection
+
+class TestConnection(unittest.TestCase):
+ """ Tests for the Connection module """
+
+ def test_default_instantiation(self):
+ """ Test a known default instantiation """
+ single_c... | |
641ebde8628ee9bb85ab0bd675bcecc88c06d171 | split_fasta_file.py | split_fasta_file.py | #!/usr/bin/env python
__description__ = "Split a fasta file and generate a file for each entry"
__author__ = "Konrad Foerstner <konrad@foerstner.org>"
__copyright__ = "2013 by Konrad Foerstner <konrad@foerstner.org>"
__license__ = "ISC license"
__email__ = "konrad@foerstner.org"
__version__ = "0.1"
import argparse
im... | Add script to split fasta files | Add script to split fasta files
| Python | isc | konrad/kuf_bio_scripts | ---
+++
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+__description__ = "Split a fasta file and generate a file for each entry"
+__author__ = "Konrad Foerstner <konrad@foerstner.org>"
+__copyright__ = "2013 by Konrad Foerstner <konrad@foerstner.org>"
+__license__ = "ISC license"
+__email__ = "konrad@foerstner.org"
+__ve... | |
b500e4b0e8ac0088fbff906dfb42e9e604fbc397 | cardinal/test_exceptions.py | cardinal/test_exceptions.py | import pytest
import exceptions
def test_exceptions():
# testing exception inheritance
with pytest.raises(Exception):
raise exceptions.CardinalException
with pytest.raises(exceptions.CardinalException):
raise exceptions.InternalError
with pytest.raises(exceptions.CardinalException):... | Add simple unit tests for exceptions | Add simple unit tests for exceptions
| Python | mit | BiohZn/Cardinal,JohnMaguire/Cardinal | ---
+++
@@ -0,0 +1,36 @@
+import pytest
+
+import exceptions
+
+
+def test_exceptions():
+ # testing exception inheritance
+ with pytest.raises(Exception):
+ raise exceptions.CardinalException
+
+ with pytest.raises(exceptions.CardinalException):
+ raise exceptions.InternalError
+
+ with pyt... | |
fc5c95e7480e38cbd3156b1e6b968e50fa98954d | Problems/towersOfHanoi.py | Problems/towersOfHanoi.py | #!/Applications/anaconda/envs/Python3/bin
def main():
for i in range(1, 8):
print("============================")
print("Towers of Hanoi: {} Disks".format(i))
towers_of_hanoi(i)
print("Number of moves: {}".format(2**i - 1))
print("============================")
return ... | Add Towers of Hanoi algorithm and tests | Add Towers of Hanoi algorithm and tests
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,32 @@
+#!/Applications/anaconda/envs/Python3/bin
+
+
+def main():
+ for i in range(1, 8):
+ print("============================")
+ print("Towers of Hanoi: {} Disks".format(i))
+ towers_of_hanoi(i)
+ print("Number of moves: {}".format(2**i - 1))
+ print("======... | |
017840d4b6986ea1b0c43791b76f724e1f4aaf22 | 004.py | 004.py | """
Project Euler Problem 4
=======================
A palindromic number reads the same both ways. The largest palindrome made
from the product of two 2-digit numbers is 9009 = 91 * 99.
Find the largest palindrome made from the product of two 3-digit numbers.
"""
def largest_palindrome(start , end):
"""
Takes... | Add solution and unit tests for problem 4 | Add solution and unit tests for problem 4
| Python | mit | BeataBak/project-euler-problems | ---
+++
@@ -0,0 +1,40 @@
+"""
+Project Euler Problem 4
+=======================
+
+A palindromic number reads the same both ways. The largest palindrome made
+from the product of two 2-digit numbers is 9009 = 91 * 99.
+
+Find the largest palindrome made from the product of two 3-digit numbers.
+"""
+def largest_palin... | |
6c8136ff03250b41418a415efcfc4717ad73c82c | app/twitterappengine.py | app/twitterappengine.py | import time
from django.utils import simplejson
from google.appengine.ext import db
class _DbCacheEntry(db.Model):
value = db.TextProperty(required=True)
timestamp = db.DateTimeProperty(required=True, auto_now=True)
class DbCache(object):
'''Simple cache on top of Google App engine's datastore'''
def... | Add helper classes for using python-twitter on App Engine (currently just a cache implementation on top of the App Engine datastore). | Add helper classes for using python-twitter on App Engine (currently just a
cache implementation on top of the App Engine datastore).
| Python | apache-2.0 | mihaip/streamspigot,mihaip/streamspigot,mihaip/streamspigot,mihaip/streamspigot | ---
+++
@@ -0,0 +1,45 @@
+import time
+
+from django.utils import simplejson
+from google.appengine.ext import db
+
+class _DbCacheEntry(db.Model):
+ value = db.TextProperty(required=True)
+ timestamp = db.DateTimeProperty(required=True, auto_now=True)
+
+class DbCache(object):
+ '''Simple cache on top of Go... | |
d6a8b8a518727a50f9dbe41f5874061b5ae6bc33 | hyperion/model/tests/test_fortran.py | hyperion/model/tests/test_fortran.py | import pytest
import numpy as np
from .. import Model
from .test_helpers import random_filename, get_test_dust
def test_point_source_outside_grid():
dust = get_test_dust()
m = Model()
m.set_cartesian_grid([-1., 1.], [-1., 1.], [-1., 1.])
m.add_density_grid(np.array([[[1.]]]), dust)
m.set_n_phot... | Add test to check that error is properly raised when a photon is emitted outside the grid. | Add test to check that error is properly raised when a photon is emitted outside the grid. | Python | bsd-2-clause | bluescarni/hyperion,hyperion-rt/hyperion,astrofrog/hyperion,hyperion-rt/hyperion,hyperion-rt/hyperion,bluescarni/hyperion,astrofrog/hyperion | ---
+++
@@ -0,0 +1,26 @@
+import pytest
+import numpy as np
+
+from .. import Model
+from .test_helpers import random_filename, get_test_dust
+
+
+def test_point_source_outside_grid():
+
+ dust = get_test_dust()
+
+ m = Model()
+ m.set_cartesian_grid([-1., 1.], [-1., 1.], [-1., 1.])
+ m.add_density_grid(n... | |
274d6a95cafb882ef422a46c2e5f91739b368c6f | sugar/context_processors.py | sugar/context_processors.py | # encoding: utf-8
from django.conf import settings
from django.contrib.sites.models import Site
def site_settings(request):
"""Expose common Django settings to templates"""
context = {
'CURRENT_SITE': Site.objects.get_current(),
}
for k in ('DEBUG', 'LOCAL_DEV', 'VERSION', 'MEDIA_URL', 'STAT... | Add a basic context processor which exposes common settings | Add a basic context processor which exposes common settings
| Python | bsd-3-clause | acdha/django-sugar | ---
+++
@@ -0,0 +1,17 @@
+# encoding: utf-8
+
+from django.conf import settings
+from django.contrib.sites.models import Site
+
+def site_settings(request):
+ """Expose common Django settings to templates"""
+
+ context = {
+ 'CURRENT_SITE': Site.objects.get_current(),
+ }
+
+ for k in ('DEBUG', 'L... | |
e8688d666ae2ccbd06fc5e2811789886cbd1d5f2 | harvester/post_processing/fix_repeated_displayDate.py | harvester/post_processing/fix_repeated_displayDate.py | # -*- coding: utf-8 -*-
import re
r=re.compile(r'(\d\d\d\d)-\1')
def fix_repeated_date(doc):
dates = doc['sourceResource'].get('date', None)
if dates:
if isinstance(dates, list):
new_dates = []
for d in dates:
disp_date = d.get('displayDate', '')
... | Fix for display date repeat of YYYY | Fix for display date repeat of YYYY
| Python | bsd-3-clause | mredar/harvester,barbarahui/harvester,barbarahui/harvester,ucldc/harvester,ucldc/harvester,mredar/harvester | ---
+++
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+import re
+
+r=re.compile(r'(\d\d\d\d)-\1')
+
+def fix_repeated_date(doc):
+ dates = doc['sourceResource'].get('date', None)
+ if dates:
+ if isinstance(dates, list):
+ new_dates = []
+ for d in dates:
+ disp_date = ... | |
77f15c5b055bc9ba04b0857f5a34b2e537d2c158 | test/6785/norequire_test.py | test/6785/norequire_test.py | import unittest
import checksieve
class TestNoRequire(unittest.TestCase):
def test_no_require(self):
sieve = '''
require ["copy", "environment"];
if anyof (environment :is "imap.cause" "APPEND",
environment :is "imap.cause" "COPY") {
if environment :is "imap.mailbox" "ActionItems" {
r... | Add failing test validating missing imapsieve capability. | Add failing test validating missing imapsieve capability.
Issue #41
| Python | mit | dburkart/check-sieve,dburkart/check-sieve,dburkart/check-sieve | ---
+++
@@ -0,0 +1,21 @@
+import unittest
+import checksieve
+
+class TestNoRequire(unittest.TestCase):
+
+ def test_no_require(self):
+ sieve = '''
+ require ["copy", "environment"];
+
+ if anyof (environment :is "imap.cause" "APPEND",
+ environment :is "imap.cause" "COPY") {
+ if environment :is... | |
827dbf8a97cf42d1571fa5eca0b3726027d80d53 | lsv_compassion/model/invoice_line.py | lsv_compassion/model/invoice_line.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __open... | Add missing file in previous commit. | Add missing file in previous commit.
| Python | agpl-3.0 | MickSandoz/compassion-switzerland,eicher31/compassion-switzerland,ndtran/compassion-switzerland,eicher31/compassion-switzerland,MickSandoz/compassion-switzerland,Secheron/compassion-switzerland,ecino/compassion-switzerland,ecino/compassion-switzerland,CompassionCH/compassion-switzerland,ecino/compassion-switzerland,Sec... | ---
+++
@@ -0,0 +1,31 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2015 Compassion CH (http://www.compassion.ch)
+# Releasing children from poverty in Jesus' name
+# @author: Emanuel Cino <ecino@compassion.ch>
+#
+# The l... | |
06b1344fe949cf0d7c53e56a1f42e281571dbfea | get_fib.py | get_fib.py | """Implement a function recursivly to get the desired
Fibonacci sequence value.
Your code should have the same input/output as the
iterative code in the instructions."""
def get_fib(position):
""" Algorithm:
1. If position matches with base cases(0 and 1) then
return the position. i.e.
1.1 If p... | Add recursive also for fibonnaci | Add recursive also for fibonnaci
| Python | mit | rav1n/basic-algorithms | ---
+++
@@ -0,0 +1,26 @@
+"""Implement a function recursivly to get the desired
+Fibonacci sequence value.
+Your code should have the same input/output as the
+iterative code in the instructions."""
+
+def get_fib(position):
+ """ Algorithm:
+ 1. If position matches with base cases(0 and 1) then
+ return... | |
083549a49dfe242efdc631de3b698b2db1bf5119 | robot/robot/tests/autonomous_test.py | robot/robot/tests/autonomous_test.py | '''
Runs all of the autonomous modes in a basic way
'''
def test_all_autonomous(robot, wpilib, fake_time):
autonomous_chooser = wpilib.SmartDashboard._table.data['Autonomous Mode']
auto_tm = 10
tm_limit = auto_tm
for choice in autonomous_chooser.choices.keys():
# set the mode
... | Add simplistic test to run through all autonomous modes | Add simplistic test to run through all autonomous modes
| Python | bsd-3-clause | frc1418/2014 | ---
+++
@@ -0,0 +1,28 @@
+'''
+ Runs all of the autonomous modes in a basic way
+'''
+
+
+def test_all_autonomous(robot, wpilib, fake_time):
+
+ autonomous_chooser = wpilib.SmartDashboard._table.data['Autonomous Mode']
+
+ auto_tm = 10
+ tm_limit = auto_tm
+
+ for choice in autonomous_chooser.choic... | |
e7c48871ee7d7132155697ac44fc31a29dcb00e1 | CodeFights/twinsScore.py | CodeFights/twinsScore.py | #!/usr/local/bin/python
# Code Fights Twins Score Problem
def twinsScore(b, m):
return [sum(item) for item in zip(b, m)]
def main():
tests = [
[[22, 13, 45, 32], [28, 41, 13, 32], [50, 54, 58, 64]],
[[0, 0, 0], [100, 100, 100], [100, 100, 100]],
[[42], [42], [84]],
[[46, 22, ... | Solve Code Fights twins score problem | Solve Code Fights twins score problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,33 @@
+#!/usr/local/bin/python
+# Code Fights Twins Score Problem
+
+
+def twinsScore(b, m):
+ return [sum(item) for item in zip(b, m)]
+
+
+def main():
+ tests = [
+ [[22, 13, 45, 32], [28, 41, 13, 32], [50, 54, 58, 64]],
+ [[0, 0, 0], [100, 100, 100], [100, 100, 100]],
+ ... | |
d38ea61fc5ffa7c526094900a0dbb8c7405aac7b | indra/db/get_db_stats.py | indra/db/get_db_stats.py | import boto3
from indra.db.util import get_db_statistics
from datetime import datetime
def main():
utcnow = datetime.utcnow()
fname = "Primary_Database_Status_Report_%s.txt" % utcnow.strftime("%Y%m%d")
print("Creating report in: %s." % fname)
print("\nBegin Report============\n")
get_db_statistics... | Create script to run stats on aws. | Create script to run stats on aws.
| Python | bsd-2-clause | pvtodorov/indra,johnbachman/indra,sorgerlab/indra,sorgerlab/indra,pvtodorov/indra,pvtodorov/indra,sorgerlab/belpy,sorgerlab/indra,bgyori/indra,sorgerlab/belpy,johnbachman/belpy,pvtodorov/indra,johnbachman/indra,sorgerlab/belpy,johnbachman/belpy,johnbachman/belpy,bgyori/indra,bgyori/indra,johnbachman/indra | ---
+++
@@ -0,0 +1,21 @@
+import boto3
+from indra.db.util import get_db_statistics
+from datetime import datetime
+
+def main():
+ utcnow = datetime.utcnow()
+ fname = "Primary_Database_Status_Report_%s.txt" % utcnow.strftime("%Y%m%d")
+ print("Creating report in: %s." % fname)
+
+ print("\nBegin Report=... | |
a4dd889a44cf7b4ea4e2e85880343ede234ec60c | geotrek/core/migrations/0017_remove_path_from_factories.py | geotrek/core/migrations/0017_remove_path_from_factories.py | # Generated by Django 2.0.13 on 2020-04-06 13:40
from django.conf import settings
from django.contrib.gis.geos import Point, LineString
from django.db import migrations
def remove_generated_paths_factories(apps, schema_editor):
PathModel = apps.get_model('core', 'Path')
PathModel.objects.filter(geom=LineStri... | Add migration remove generated paths | Add migration remove generated paths
| Python | bsd-2-clause | GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek | ---
+++
@@ -0,0 +1,21 @@
+# Generated by Django 2.0.13 on 2020-04-06 13:40
+
+from django.conf import settings
+from django.contrib.gis.geos import Point, LineString
+from django.db import migrations
+
+
+def remove_generated_paths_factories(apps, schema_editor):
+ PathModel = apps.get_model('core', 'Path')
+ P... | |
64141d4e195000289b005028f7368452698c701c | tests/test_tests.py | tests/test_tests.py | # Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | Add a test to ensure access to missing attributes raises the correct exception | Add a test to ensure access to missing attributes raises the correct
exception
| Python | apache-2.0 | klmitch/dtest,klmitch/dtest | ---
+++
@@ -0,0 +1,29 @@
+# Copyright 2011 OpenStack LLC.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/L... | |
74217c0a7db82fa0df153e68e22395ee1e820071 | PyGdbUtil.py | PyGdbUtil.py | # coding=utf-8
import os
"""
公用方法
"""
"""
日志
level: 级别
msg: 信息
"""
log_limit_level = 2
def log(level, msg, limit_level=log_limit_level):
if 2-level > log_limit_level:
return
if level == 0: # [info]
print "[info] " + str(msg)
elif level == 1:
print "[warn] " + ... | Add util & lots of funciton | Add util & lots of funciton
| Python | mit | Jecvay/PyGDB | ---
+++
@@ -0,0 +1,39 @@
+# coding=utf-8
+
+import os
+
+"""
+ 公用方法
+"""
+
+"""
+ 日志
+ level: 级别
+ msg: 信息
+"""
+log_limit_level = 2
+def log(level, msg, limit_level=log_limit_level):
+ if 2-level > log_limit_level:
+ return
+ if level == 0: # [info]
+ print "[info] " + str(msg)
+... | |
194bf3f4ba0b3488a5cfbb536247ac9f1bc7a006 | tests/test_vcs_prompt.py | tests/test_vcs_prompt.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_vcs_prompt
---------------
"""
import os
import pytest
from cookiecutter import utils
@pytest.fixture
def clean_cookiecutter_dirs(request):
if os.path.isdir('cookiecutter-pypackage'):
utils.rmtree('cookiecutter-pypackage')
os.mkdir('cookiecutte... | Reimplement setup and teardown of TestVCSPrompt | Reimplement setup and teardown of TestVCSPrompt
| Python | bsd-3-clause | tylerdave/cookiecutter,Vauxoo/cookiecutter,sp1rs/cookiecutter,cichm/cookiecutter,audreyr/cookiecutter,vintasoftware/cookiecutter,pjbull/cookiecutter,Springerle/cookiecutter,cichm/cookiecutter,kkujawinski/cookiecutter,Springerle/cookiecutter,moi65/cookiecutter,ramiroluz/cookiecutter,janusnic/cookiecutter,venumech/cookie... | ---
+++
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+test_vcs_prompt
+---------------
+"""
+
+import os
+import pytest
+
+from cookiecutter import utils
+
+
+@pytest.fixture
+def clean_cookiecutter_dirs(request):
+ if os.path.isdir('cookiecutter-pypackage'):
+ utils.rmtree('cooki... | |
ad706e2a98e564159aa5b505d7522fa39bfcceb5 | python/video-tools/rename-thetvdb.py | python/video-tools/rename-thetvdb.py | #!/usr/bin/env python
'''
TODO:
- Get episode names, numbers, seasons from URL
- Get path to rename from stdin
- Get thetvdb url from stdin
'''
import os
import os.path
PATH_TO_RENAME = '/path/to/episodes'
INFILE_NAME = '/path/to/episodes.txt'
def main():
episodes = {}
# Get episode names, numbers, s... | Add simple script for renaming files using thetvdb.com | Add simple script for renaming files using thetvdb.com
| Python | mit | bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile | ---
+++
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+'''
+TODO:
+- Get episode names, numbers, seasons from URL
+- Get path to rename from stdin
+- Get thetvdb url from stdin
+'''
+
+import os
+import os.path
+
+PATH_TO_RENAME = '/path/to/episodes'
+INFILE_NAME = '/path/to/episodes.txt'
+
+
+def main():
+ episodes ... | |
d36f7dbdc6b25e85ca857074edda0b2d33a4b833 | bluebottle/files/migrations/0003_auto_20191111_1533.py | bluebottle/files/migrations/0003_auto_20191111_1533.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-11-11 12:19
from __future__ import unicode_literals
from django.db import migrations
from bluebottle.utils.utils import update_group_permissions
def add_group_permissions(apps, schema_editor):
group_perms = {
'Staff': {
'perms': (
... | Add document / image permissions | Add document / image permissions
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.15 on 2019-11-11 12:19
+from __future__ import unicode_literals
+
+from django.db import migrations
+from bluebottle.utils.utils import update_group_permissions
+
+
+def add_group_permissions(apps, schema_editor):
+ group_perms = {
+ ... | |
89221866255a8191938346b59ea32bc805fa6be9 | tests/ExperimentTest.py | tests/ExperimentTest.py | import sys
sys.path.insert(0,".")
import unittest
import neuroml
import neuroml.writers as writers
import PyOpenWorm
from PyOpenWorm import *
import networkx
import rdflib
import rdflib as R
import pint as Q
import os
import subprocess as SP
import subprocess
import tempfile
import doctest
from glob import glob
from ... | Add one test for Experiment object | Add one test for Experiment object
This was copied over from the tests for related dataobjects.
Maybe all of these types of test could be factored out into the
DataObjectTest.py testfile?
| Python | mit | gsarma/PyOpenWorm,openworm/PyOpenWorm,openworm/PyOpenWorm,gsarma/PyOpenWorm | ---
+++
@@ -0,0 +1,28 @@
+import sys
+sys.path.insert(0,".")
+import unittest
+import neuroml
+import neuroml.writers as writers
+import PyOpenWorm
+from PyOpenWorm import *
+import networkx
+import rdflib
+import rdflib as R
+import pint as Q
+import os
+import subprocess as SP
+import subprocess
+import tempfile
+i... | |
5bfe049c57198367ec244ff6ae7779c87d9f1e53 | tests/cases/uris.py | tests/cases/uris.py | [
{
"message": b"GET / HTTP/1.1\r\n\r\n",
"expected": {
"request_method": b"GET",
"request_uri": b"/",
"http_version": b"HTTP/1.1",
},
},
{
"message": b"GET /foo/bar/ HTTP/1.1\r\n\r\n",
"expected": {
"request_method": b"... | Test a variety of URIs | Test a variety of URIs
| Python | apache-2.0 | dstufft/http11,dstufft/http11 | ---
+++
@@ -0,0 +1,66 @@
+[
+ {
+ "message": b"GET / HTTP/1.1\r\n\r\n",
+ "expected": {
+ "request_method": b"GET",
+ "request_uri": b"/",
+ "http_version": b"HTTP/1.1",
+ },
+ },
+ {
+ "message": b"GET /foo/bar/ HTTP/1.1\r\n\r\n",
+ "expect... | |
862b18e3e0c93418124068ddd76f4ad37f71f015 | toolbox/neph_cli_util.py | toolbox/neph_cli_util.py | import argparse
import os
from nephoria.testcontroller import TestController
import logging
parser = argparse.ArgumentParser(description='Euca Runtime Config Generator')
parser.add_argument('--get-credentials', dest='get_credentials', action='store_true',
default=False,
help='Ope... | Add first pass at simple cli tooling | Add first pass at simple cli tooling
| Python | bsd-2-clause | nephomaniac/nephoria,nephomaniac/nephoria | ---
+++
@@ -0,0 +1,54 @@
+import argparse
+import os
+from nephoria.testcontroller import TestController
+import logging
+parser = argparse.ArgumentParser(description='Euca Runtime Config Generator')
+parser.add_argument('--get-credentials', dest='get_credentials', action='store_true',
+ default=Fa... | |
8f7e6623e34827f480eee971a8922b56922aa3e4 | tests/test_queryable.py | tests/test_queryable.py | from busbus.queryable import Queryable
def test_queryable():
q = Queryable(xrange(10)).where(lambda x: x % 5 == 0)
assert next(q) == 0
assert next(q) == 5
| Add basic test case for Queryable class | Add basic test case for Queryable class
| Python | mit | spaceboats/busbus | ---
+++
@@ -0,0 +1,7 @@
+from busbus.queryable import Queryable
+
+
+def test_queryable():
+ q = Queryable(xrange(10)).where(lambda x: x % 5 == 0)
+ assert next(q) == 0
+ assert next(q) == 5 | |
ce948382108303020069f8805c92a930c5b6c99a | data_text/parse_tafseer_text.py | data_text/parse_tafseer_text.py | from quran_text.models import Ayah
from quran_tafseer.models import TafseerText, Tafseer
def parse_tafseer_file(file_name, tafseer_name):
with open(file_name, 'r') as tafseer_file:
tafseer = Tafseer.objects.create(name=tafseer_name)
for line in tafseer_file:
sura, ayah, text = line.str... | Create code to parse Tafseer files fomr Tanzil.net | Create code to parse Tafseer files fomr Tanzil.net
| Python | mit | EmadMokhtar/tafseer_api | ---
+++
@@ -0,0 +1,24 @@
+from quran_text.models import Ayah
+from quran_tafseer.models import TafseerText, Tafseer
+
+
+def parse_tafseer_file(file_name, tafseer_name):
+ with open(file_name, 'r') as tafseer_file:
+ tafseer = Tafseer.objects.create(name=tafseer_name)
+ for line in tafseer_file:
+ ... | |
074730f14d3b04305b67baf2e6bc853c13c9bdd8 | training/get_metrics.py | training/get_metrics.py | import pickle
import os
import argparse
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn.cluster import AgglomerativeClustering, KMeans
from sklearn.metrics import v_measure_score
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--exp-name', '-e', ty... | Add script to get metrics from BERT models | Add script to get metrics from BERT models
| Python | apache-2.0 | googleinterns/smart-news-query-embeddings,googleinterns/smart-news-query-embeddings | ---
+++
@@ -0,0 +1,49 @@
+import pickle
+import os
+import argparse
+import numpy as np
+import pandas as pd
+import tensorflow as tf
+from sklearn.cluster import AgglomerativeClustering, KMeans
+from sklearn.metrics import v_measure_score
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ par... | |
ae1a84df1bdbdbd6b92ba4210cc0d630981bc26c | kolibri/core/content/migrations/0026_contentnode_options.py | kolibri/core/content/migrations/0026_contentnode_options.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-05-20 14:56
from __future__ import unicode_literals
from django.db import migrations
import kolibri.core.fields
class Migration(migrations.Migration):
dependencies = [
('content', '0025_add_h5p_kind'),
]
operations = [
migrat... | Add migration that got removed during re-generation. | Add migration that got removed during re-generation.
| Python | mit | learningequality/kolibri,mrpau/kolibri,indirectlylit/kolibri,learningequality/kolibri,learningequality/kolibri,indirectlylit/kolibri,indirectlylit/kolibri,mrpau/kolibri,mrpau/kolibri,mrpau/kolibri,learningequality/kolibri,indirectlylit/kolibri | ---
+++
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.28 on 2020-05-20 14:56
+from __future__ import unicode_literals
+
+from django.db import migrations
+import kolibri.core.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('content', '0025_add_h5p_kind'),
+... | |
7047c48d0772fe61b2ba9ed9e7f2992712a63700 | tests/test_linting.py | tests/test_linting.py | import sys
import subprocess
def test_pep8():
result = subprocess.call(['pep8', '--statistics', '--show-source'])
assert result == 0
def test_pypi():
result = subprocess.call(['python',
'setup.py',
'check',
'--rest... | Add linting tests (PEP8 and PyPi) | Add linting tests (PEP8 and PyPi)
| Python | mit | Kromey/pynano | ---
+++
@@ -0,0 +1,19 @@
+import sys
+import subprocess
+
+
+def test_pep8():
+ result = subprocess.call(['pep8', '--statistics', '--show-source'])
+ assert result == 0
+
+
+def test_pypi():
+ result = subprocess.call(['python',
+ 'setup.py',
+ 'check... | |
926d1cea1a0c52325cc66dc51dd8b941a0dfa783 | scripts/angle_deqp_test_merge.py | scripts/angle_deqp_test_merge.py | #!/usr/bin/env python
#
# Copyright 2021 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Merges dEQP sharded test results in the ANGLE testing infrastucture."""
import os
import sys
d = os.path.dirname
THIS_DIR =... | Add dEQP test merge script. | testing: Add dEQP test merge script.
This script will allow ANGLE to process custom logic when we complete
a suite of dEQP tests on the bots. The first customization step we
can do is merge the myriad batch QPA files into one master QPA file.
This script is currently a no-op and will let us set up the merge st... | Python | bsd-3-clause | ppy/angle,ppy/angle,ppy/angle,ppy/angle | ---
+++
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+#
+# Copyright 2021 The ANGLE Project Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+""" Merges dEQP sharded test results in the ANGLE testing infrastucture."""
+
+import os
+import... | |
046ca6c16b60c787e3dc865b3080a65d74ee437b | exploratory_analysis/author_scan.py | exploratory_analysis/author_scan.py | import os
from utils import Reader
import code
import sys
author_dict = dict()
def extract_authors(tweets):
# code.interact(local=dict(globals(), **locals()))
for t in tweets:
if t.is_post():
actor = t.actor()
create_key(actor['id'])
increment_author(actor, t.is_p... | Add code to see what authors there are in the dataset | Add code to see what authors there are in the dataset
| Python | apache-2.0 | chuajiesheng/twitter-sentiment-analysis | ---
+++
@@ -0,0 +1,66 @@
+import os
+from utils import Reader
+import code
+import sys
+
+author_dict = dict()
+
+
+def extract_authors(tweets):
+ # code.interact(local=dict(globals(), **locals()))
+
+ for t in tweets:
+ if t.is_post():
+ actor = t.actor()
+ create_key(actor['id'])
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.