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 |
|---|---|---|---|---|---|---|---|---|---|---|
ce54b2e002a46f3abecccbd7cdd591c1ec4c7074 | beetsplug/embedcoverart.py | beetsplug/embedcoverart.py | from beets.plugins import BeetsPlugin
from beets import mediafile
import os, logging
from email.mime.image import MIMEImage
log = logging.getLogger('beets')
log.addHandler(logging.StreamHandler())
class EmbedAlbumartPlugin(BeetsPlugin):
'''Allows albumart to be embedded into the actual files'''
def __init... | Add initial version of the embed coverart plugin. | Add initial version of the embed coverart plugin.
This plugin allows users to embed the cover into the audio file.
Probaly still has a few bugs but it should work in most cases right
now.
| Python | mit | google-code-export/beets,google-code-export/beets,google-code-export/beets | ---
+++
@@ -0,0 +1,45 @@
+from beets.plugins import BeetsPlugin
+from beets import mediafile
+
+import os, logging
+
+from email.mime.image import MIMEImage
+
+log = logging.getLogger('beets')
+log.addHandler(logging.StreamHandler())
+
+
+class EmbedAlbumartPlugin(BeetsPlugin):
+ '''Allows albumart to be embedded ... | |
c62dfb75477f5a641a2a9fd2de16d96cc2638e5f | migrations/versions/ebcc92fc4d27_remove_tag_table.py | migrations/versions/ebcc92fc4d27_remove_tag_table.py | """Remove tag table
Revision ID: ebcc92fc4d27
Revises: 444c69da7c45
Create Date: 2017-05-08 01:01:48.865909
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ebcc92fc4d27'
down_revision = '444c69da7c45'
branch_labels = None
depends_on = None
def upgrade():
... | Remove tags field from user Model | [Chore] Migrate: Remove tags field from user Model
| Python | mit | andela-wcyn/bucketlist | ---
+++
@@ -0,0 +1,41 @@
+"""Remove tag table
+
+Revision ID: ebcc92fc4d27
+Revises: 444c69da7c45
+Create Date: 2017-05-08 01:01:48.865909
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = 'ebcc92fc4d27'
+down_revision = '444c69da7c45'
+branch_labels = N... | |
299882e55ea82d8c442b51b243caf63707befe4c | xoinvader/tests/test_utils.py | xoinvader/tests/test_utils.py | import sys
import unittest
import pprint
from xoinvader.utils import create_logger
from xoinvader.utils import InfiniteList
from xoinvader.utils import Point
class TestUtils(unittest.TestCase):
def test_create_logger(self):
logger = create_logger("test", "test.log")
self.assertTrue(logger)
d... | Add tests for utils module. | Add tests for utils module.
| Python | mit | pkulev/xoinvader,pankshok/xoinvader | ---
+++
@@ -0,0 +1,62 @@
+import sys
+import unittest
+import pprint
+
+from xoinvader.utils import create_logger
+from xoinvader.utils import InfiniteList
+from xoinvader.utils import Point
+
+
+class TestUtils(unittest.TestCase):
+ def test_create_logger(self):
+ logger = create_logger("test", "test.log")... | |
9ac9f94f3b1409ae3a47c8a9e890f578a69b020f | test/requests/test_forgot_password.py | test/requests/test_forgot_password.py | import requests
from wqflask import user_manager
from utility.elasticsearch_tools import get_user_by_unique_column
from parameterized import parameterized
from parametrized_test import ParametrizedTest
passwork_reset_link = ''
forgot_password_page = None
class TestForgotPassword(ParametrizedTest):
def setUp(self... | Add tests for Forgot Password feature | Add tests for Forgot Password feature
* Add tests to ensure the "Forgot Password" feature works appropriately.
| Python | agpl-3.0 | zsloan/genenetwork2,pjotrp/genenetwork2,DannyArends/genenetwork2,DannyArends/genenetwork2,DannyArends/genenetwork2,zsloan/genenetwork2,DannyArends/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,DannyArends/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,zsloan/genenetwork2,genenetwor... | ---
+++
@@ -0,0 +1,52 @@
+import requests
+from wqflask import user_manager
+from utility.elasticsearch_tools import get_user_by_unique_column
+from parameterized import parameterized
+from parametrized_test import ParametrizedTest
+
+passwork_reset_link = ''
+forgot_password_page = None
+
+class TestForgotPassword(P... | |
42b50470458d91cd0882f927ed83ba267ab78764 | zinnia_wymeditor/__init__.py | zinnia_wymeditor/__init__.py | """WYMeditor for Django-blog-zinnia"""
__version__ = '1.0'
__license__ = 'BSD License'
__author__ = 'Fantomas42'
__email__ = 'fantomas42@gmail.com'
__url__ = 'https://github.com/django-blog-zinnia/zinnia-wysiwyg-wymeditor'
| Create zinnia_wymeditor module with his metadatas | Create zinnia_wymeditor module with his metadatas
| Python | bsd-3-clause | layar/zinnia-wysiwyg-wymeditor,django-blog-zinnia/zinnia-wysiwyg-wymeditor,django-blog-zinnia/zinnia-wysiwyg-wymeditor,layar/zinnia-wysiwyg-wymeditor,django-blog-zinnia/zinnia-wysiwyg-wymeditor,layar/zinnia-wysiwyg-wymeditor,django-blog-zinnia/zinnia-wysiwyg-wymeditor,layar/zinnia-wysiwyg-wymeditor | ---
+++
@@ -0,0 +1,8 @@
+"""WYMeditor for Django-blog-zinnia"""
+__version__ = '1.0'
+__license__ = 'BSD License'
+
+__author__ = 'Fantomas42'
+__email__ = 'fantomas42@gmail.com'
+
+__url__ = 'https://github.com/django-blog-zinnia/zinnia-wysiwyg-wymeditor' | |
435cc2548b38d92f8ffdc4bee8845f5a58d655ce | ocrsite/ocrlab/management/commands/runfilescript.py | ocrsite/ocrlab/management/commands/runfilescript.py | """
Run a script that takes a file input/output.
"""
import os
import sys
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured
from django.utils import simplejson as json
... | Add a management command that runs a given script taking an input file and an output file as args. | Add a management command that runs a given script taking an input file and an output file as args.
| Python | mit | mikesname/python-ocrlab | ---
+++
@@ -0,0 +1,49 @@
+"""
+Run a script that takes a file input/output.
+"""
+
+import os
+import sys
+from optparse import make_option
+
+from django.core.management.base import BaseCommand, CommandError
+from django.contrib.auth.models import User
+from django.core.exceptions import ImproperlyConfigured
+from d... | |
862753353a09400d0d99960ef2cd6d70fb9b4a7e | tests/top_destinations_tests.py | tests/top_destinations_tests.py | import unittest
import datetime
import json
import sys
sys.path.append('..')
import sabre_dev_studio
import sabre_dev_studio.sabre_exceptions as sabre_exceptions
'''
requires config.json in the same directory for api authentication
{
"sabre_client_id": -----,
"sabre_client_secret": -----
}
'''
class TestBasicTopD... | Add tests for top destinations | Add tests for top destinations
| Python | mit | Jamil/sabre_dev_studio | ---
+++
@@ -0,0 +1,61 @@
+import unittest
+import datetime
+import json
+import sys
+
+sys.path.append('..')
+import sabre_dev_studio
+import sabre_dev_studio.sabre_exceptions as sabre_exceptions
+
+'''
+requires config.json in the same directory for api authentication
+
+{
+ "sabre_client_id": -----,
+ "sabre_client... | |
6825c853892c263a3c193490ee1f620b303aa79d | translate_labels.py | translate_labels.py | """Find known body parts in sentences with predicted label 'Lichaamsdeel'.
Extended body parts are saved to new text files.
Usage: python classify_body_parts.py <json file with body part mapping> <dir
with input texts> <dir for output texts>
"""
import os
import codecs
import argparse
import json
from count_labels im... | Add script to translate labels | Add script to translate labels
| Python | apache-2.0 | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | ---
+++
@@ -0,0 +1,45 @@
+"""Find known body parts in sentences with predicted label 'Lichaamsdeel'.
+
+Extended body parts are saved to new text files.
+
+Usage: python classify_body_parts.py <json file with body part mapping> <dir
+with input texts> <dir for output texts>
+"""
+import os
+import codecs
+import argp... | |
14bc31730b783b1a6649c97a51d1ef9ae2053b42 | tests/asttools/test_compiler.py | tests/asttools/test_compiler.py | """Test suite for asttools.compiler."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import pytest
from pycc.asttools import parse
from pycc.asttools import compiler
source = """
x = True
for y in range(10):
... | Add simple tests for asttools.compiler module | Add simple tests for asttools.compiler module
These tests don't do anything except ensure that exceptions aren't
thrown during compiling.
Signed-off-by: Kevin Conway <3473c1f185ca03eadc40ad288d84425b54fd7d57@gmail.com>
| Python | apache-2.0 | kevinconway/pycc,kevinconway/pycc | ---
+++
@@ -0,0 +1,33 @@
+"""Test suite for asttools.compiler."""
+
+from __future__ import division
+from __future__ import absolute_import
+from __future__ import print_function
+from __future__ import unicode_literals
+
+import pytest
+
+from pycc.asttools import parse
+from pycc.asttools import compiler
+
+source... | |
b7274e91bc2fe6a8059ce7e65e02c20d000322b1 | tests/thread/mutate_instance.py | tests/thread/mutate_instance.py | # test concurrent mutating access to a shared user instance
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
import _thread
# the shared user class and instance
class User:
def __init__(self):
self.a = 'A'
self.b = 'B'
self.c = 'C'
user = User()
# main thread fu... | Add test for concurrent mutating of user instance. | tests/thread: Add test for concurrent mutating of user instance.
| Python | mit | mhoffma/micropython,ryannathans/micropython,deshipu/micropython,HenrikSolver/micropython,jmarcelino/pycom-micropython,adafruit/micropython,bvernoux/micropython,TDAbboud/micropython,oopy/micropython,emfcamp/micropython,swegener/micropython,Timmenem/micropython,bvernoux/micropython,alex-robbins/micropython,lowRISC/microp... | ---
+++
@@ -0,0 +1,43 @@
+# test concurrent mutating access to a shared user instance
+#
+# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+
+import _thread
+
+# the shared user class and instance
+class User:
+ def __init__(self):
+ self.a = 'A'
+ self.b = 'B'
+ self.... | |
05084740393180994ea0b330c7f91a148a5d7d86 | util/checkZscale.py | util/checkZscale.py | # Copyright 2014 Open Connectome Project (http://openconnecto.me)
#
# 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 app... | Check the zscale and cubedims for a given database | [util] Check the zscale and cubedims for a given database
| Python | apache-2.0 | openconnectome/open-connectome,openconnectome/open-connectome,neurodata/ndstore,openconnectome/open-connectome,openconnectome/open-connectome,neurodata/ndstore,neurodata/ndstore,openconnectome/open-connectome,neurodata/ndstore,openconnectome/open-connectome | ---
+++
@@ -0,0 +1,40 @@
+# Copyright 2014 Open Connectome Project (http://openconnecto.me)
+#
+# 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/LICE... | |
59f40f5b7683d60264f5c38a5e0da7810fa67fd8 | cross-multinomial/cross_multinomial_predict.py | cross-multinomial/cross_multinomial_predict.py | import sys
import numpy as np
import numpy.random as npr
from calculate_phist import read_counts
from calculate_phist import normalize_haplotypes
from scipy.special import gammaln
import matplotlib.pyplot as plt
def log_factorial(n):
return gammaln(n+1)
def log_multinomial(xs, ps):
n = np.sum(xs)
log_prob = log_fa... | Add prediction script for cross multinomial | Add prediction script for cross multinomial
| Python | apache-2.0 | rnowling/pop-gen-models | ---
+++
@@ -0,0 +1,53 @@
+import sys
+import numpy as np
+import numpy.random as npr
+from calculate_phist import read_counts
+from calculate_phist import normalize_haplotypes
+from scipy.special import gammaln
+import matplotlib.pyplot as plt
+
+def log_factorial(n):
+ return gammaln(n+1)
+
+def log_multinomial(xs, ... | |
0ffeb772e52c2af555c5fe65f4763059edb31148 | tensor2tensor/models/research/transformer_vae_test.py | tensor2tensor/models/research/transformer_vae_test.py | # coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | Add a test for transformer_vae | Add a test for transformer_vae
PiperOrigin-RevId: 190462534
| Python | apache-2.0 | tensorflow/tensor2tensor,tensorflow/tensor2tensor,vthorsteinsson/tensor2tensor,tensorflow/tensor2tensor,vthorsteinsson/tensor2tensor,tensorflow/tensor2tensor,tensorflow/tensor2tensor,vthorsteinsson/tensor2tensor,vthorsteinsson/tensor2tensor | ---
+++
@@ -0,0 +1,59 @@
+# coding=utf-8
+# Copyright 2018 The Tensor2Tensor 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.... | |
3ab745087ef563e30f86fdeed09b12868095f85d | tests/test_classifierbase.py | tests/test_classifierbase.py | from itertools import izip, cycle
from unittest import TestCase
class TestClassifierBase(TestCase):
def _training(self, classification_type, classifier, alphabet,
reversed_alphabet):
reversed_alphabet = reversed(alphabet)
messagePairs = izip(alphabet, reversed_alphabet)
... | Add a base class for certain types of tests | Add a base class for certain types of tests
This is so training data can be reused across classes.
In fact nonsensefilter's test have been using this for quite some time
but this was not committed. Oops!
| Python | mpl-2.0 | mozilla/spicedham,mozilla/spicedham | ---
+++
@@ -0,0 +1,13 @@
+from itertools import izip, cycle
+
+from unittest import TestCase
+
+
+class TestClassifierBase(TestCase):
+
+ def _training(self, classification_type, classifier, alphabet,
+ reversed_alphabet):
+ reversed_alphabet = reversed(alphabet)
+ messagePairs = izi... | |
1e3d9f01d25d89ac6167226a24e03b79d0c34a3c | test/trainer_test.py | test/trainer_test.py | import theanets
import util
class TestTrainer(util.MNIST):
def setUp(self):
super(TestTrainer, self).setUp()
self.exp = theanets.Experiment(
theanets.Autoencoder,
layers=(self.DIGIT_SIZE, 10, self.DIGIT_SIZE))
def assert_progress(self, *args, **kwargs):
self.e... | Add basic "does this even run" test for trainers. | Add basic "does this even run" test for trainers.
| Python | mit | lmjohns3/theanets,chrinide/theanets,devdoer/theanets | ---
+++
@@ -0,0 +1,39 @@
+import theanets
+
+import util
+
+
+class TestTrainer(util.MNIST):
+ def setUp(self):
+ super(TestTrainer, self).setUp()
+ self.exp = theanets.Experiment(
+ theanets.Autoencoder,
+ layers=(self.DIGIT_SIZE, 10, self.DIGIT_SIZE))
+
+ def assert_progres... | |
916053366034f857ad431bff069121e56c4e027b | pylearn2/scripts/tests/test_show_examples.py | pylearn2/scripts/tests/test_show_examples.py | """
Tests for the show_examples.py script
"""
import os
from pylearn2.testing.skip import skip_if_no_matplotlib, skip_if_no_data
from pylearn2.scripts.show_examples import show_examples
def test_show_examples():
"""
Create a YAML file of the MNIST dataset and show examples
"""
skip_if_no_matplotlib()... | Add unit test for show_examples.py | Add unit test for show_examples.py
| Python | bsd-3-clause | cosmoharrigan/pylearn2,skearnes/pylearn2,matrogers/pylearn2,ashhher3/pylearn2,w1kke/pylearn2,JesseLivezey/plankton,CIFASIS/pylearn2,lancezlin/pylearn2,alexjc/pylearn2,jamessergeant/pylearn2,theoryno3/pylearn2,ashhher3/pylearn2,Refefer/pylearn2,lamblin/pylearn2,alexjc/pylearn2,nouiz/pylearn2,fishcorn/pylearn2,msingh172/... | ---
+++
@@ -0,0 +1,23 @@
+"""
+Tests for the show_examples.py script
+"""
+import os
+
+from pylearn2.testing.skip import skip_if_no_matplotlib, skip_if_no_data
+from pylearn2.scripts.show_examples import show_examples
+
+
+def test_show_examples():
+ """
+ Create a YAML file of the MNIST dataset and show examp... | |
9dcb5ee0738e339f3d17876d5470b6627393862c | tensorflow_cloud/python/tests/integration/on_script_call_test.py | tensorflow_cloud/python/tests/integration/on_script_call_test.py | # Copyright 2020 Google 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 by applicable law or a... | Add details to integration test as a template | Add details to integration test as a template
| Python | apache-2.0 | tensorflow/cloud,tensorflow/cloud | ---
+++
@@ -0,0 +1,71 @@
+# Copyright 2020 Google 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
+#
+# Un... | |
e09dc29716f65b5e36436538df211363c9d874ab | vm_server/send/compile_proto.py | vm_server/send/compile_proto.py | #!/usr/bin/python
"""Script to create the protofile
It compiles the proto definition and
then creates the proto file from the text specified
in query1.txt, query2.txt etc
"""
import logging
import os
import sys
def compile_proto():
"""Executes commands to compile a proto file"""
logging.debug("Compile... | Add code to compile proto | Add code to compile proto
| Python | apache-2.0 | googleinterns/automated-windows-vms,googleinterns/automated-windows-vms | ---
+++
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+"""Script to create the protofile
+
+ It compiles the proto definition and
+ then creates the proto file from the text specified
+ in query1.txt, query2.txt etc
+"""
+import logging
+import os
+import sys
+
+def compile_proto():
+ """Executes commands to compile ... | |
3cc76b052ea7a49ad50247bff218f34056470f31 | accelerator/migrations/0033_migrate_gender_data.py | accelerator/migrations/0033_migrate_gender_data.py | # Generated by Django 2.2.10 on 2021-01-22 12:13
from django.db import migrations
# gender identity
GENDER_MALE = "Male"
GENDER_FEMALE = "Female"
GENDER_PREFER_TO_SELF_DESCRIBE = "I Prefer To Self-describe"
GENDER_PREFER_NOT_TO_SAY = "I Prefer Not To Say"
# gender
MALE_CHOICE = "m"
FEMALE_CHOICE = "f"
OTHER_CHOICE = ... | Merge remote-tracking branch 'origin' into AC-8354 | [AC-8354] Merge remote-tracking branch 'origin' into AC-8354
| Python | mit | masschallenge/django-accelerator,masschallenge/django-accelerator | ---
+++
@@ -0,0 +1,65 @@
+# Generated by Django 2.2.10 on 2021-01-22 12:13
+from django.db import migrations
+
+# gender identity
+GENDER_MALE = "Male"
+GENDER_FEMALE = "Female"
+GENDER_PREFER_TO_SELF_DESCRIBE = "I Prefer To Self-describe"
+GENDER_PREFER_NOT_TO_SAY = "I Prefer Not To Say"
+
+# gender
+MALE_CHOICE = "... | |
8c47266c9bf8f91e03a0770befced1eef443b055 | problem4.py | problem4.py | """
Given: Positive integers n>=40 and k<=5.
Return: The total number of rabbit pairs that will be present after n months if we begin with 1 pair and in
each generation, every pair of reproduction-age rabbits produces a litter of k rabbit pairs
(instead of only 1 pair).
"""
# Based off a fibonnaci sequence with rabb... | Add solution to Rabbits and Recurrence Relations | Add solution to Rabbits and Recurrence Relations
| Python | mit | MichaelAquilina/rosalind-solutions | ---
+++
@@ -0,0 +1,19 @@
+"""
+Given: Positive integers n>=40 and k<=5.
+
+Return: The total number of rabbit pairs that will be present after n months if we begin with 1 pair and in
+each generation, every pair of reproduction-age rabbits produces a litter of k rabbit pairs
+(instead of only 1 pair).
+"""
+
+
+# Bas... | |
32a1ccc5856fd58e841a3960dbe17ceb029eb8d8 | examples/test_parse_bool.py | examples/test_parse_bool.py | def test_parse_bool(wish):
parse_bool = wish
assert not parse_bool('false')
assert not parse_bool('FALSE')
assert not parse_bool('0')
assert parse_bool('true')
assert parse_bool('TRUE')
assert parse_bool('1')
| Add test file use in the docs. | Add test file use in the docs.
| Python | mit | alexamici/pytest-wish,alexamici/pytest-nodev,nodev-io/pytest-nodev | ---
+++
@@ -0,0 +1,8 @@
+def test_parse_bool(wish):
+ parse_bool = wish
+ assert not parse_bool('false')
+ assert not parse_bool('FALSE')
+ assert not parse_bool('0')
+ assert parse_bool('true')
+ assert parse_bool('TRUE')
+ assert parse_bool('1') | |
bc551c0d46c63ed688184e45e3211e29a30214d7 | dbaas/workflow/steps/util/resize/check_database_status.py | dbaas/workflow/steps/util/resize/check_database_status.py | # -*- coding: utf-8 -*-
import logging
from ...util.base import BaseStep
LOG = logging.getLogger(__name__)
class CheckDatabaseStatus(BaseStep):
def __unicode__(self):
return "Checking database status..."
def do(self, workflow_dict):
try:
if not 'database' in workflow_dict:
... | Add check db status step | Add check db status step
| 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,37 @@
+# -*- coding: utf-8 -*-
+import logging
+from ...util.base import BaseStep
+
+LOG = logging.getLogger(__name__)
+
+
+class CheckDatabaseStatus(BaseStep):
+
+ def __unicode__(self):
+ return "Checking database status..."
+
+ def do(self, workflow_dict):
+ try:
+ ... | |
2399f02a08f06aa120aae351aad7a4402aca8eb4 | climate_data/migrations/0021_auto_20170619_2053.py | climate_data/migrations/0021_auto_20170619_2053.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-06-19 20:53
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('climate_data', '0020_annotation'),
]
operations = ... | Move data type field from sensor model to station-sensor link model to make sensors more 'global'. | Move data type field from sensor model to station-sensor link model to make sensors more 'global'.
| Python | apache-2.0 | qubs/climate-data-api,qubs/data-centre,qubs/climate-data-api,qubs/data-centre | ---
+++
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.6 on 2017-06-19 20:53
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('climate_data', '0020... | |
9ee332f6f0af3d632860581971446f9edf4f74be | changetext/WIKIXML2TW.py | changetext/WIKIXML2TW.py |
def WIKIXML2TW(inputfilename, outputfilename):
"Convert Wikimedia XML dump to TiddlyWiki import file"
inputfile = open(inputfilename, "r")
xmlinput = unicode(inputfile.read(), errors='ignore')
outputfilemenu = open(outputfilename + '.menu', "w")
outputfile = open(outputfilename, "w")
outputfile.w... | Convert wiki XML to Tiddlywiki import format | Convert wiki XML to Tiddlywiki import format
| Python | mit | cottley/moruga | ---
+++
@@ -0,0 +1,38 @@
+
+def WIKIXML2TW(inputfilename, outputfilename):
+ "Convert Wikimedia XML dump to TiddlyWiki import file"
+ inputfile = open(inputfilename, "r")
+ xmlinput = unicode(inputfile.read(), errors='ignore')
+ outputfilemenu = open(outputfilename + '.menu', "w")
+ outputfile = open(ou... | |
2f508798b0a5f78ef6c04302e6983e4b824a2df0 | exercises/chapter_02/exercise_02_10/exercise_02_10.py | exercises/chapter_02/exercise_02_10/exercise_02_10.py | # 2-10 Adding Comments
# Below follows the code from exercise 2-3 and 2-4 again but now with (more) comments
# 2-3 Personal Message
name = "Henrik" # variable for storing user name
# concatenate the user name with some strings to form a personal message
print("Hello " + name + ", lets learn some Python today!") #
... | Add solution to exercise 2-10. | Add solution to exercise 2-10.
| Python | mit | HenrikSamuelsson/python-crash-course | ---
+++
@@ -0,0 +1,15 @@
+# 2-10 Adding Comments
+
+# Below follows the code from exercise 2-3 and 2-4 again but now with (more) comments
+
+# 2-3 Personal Message
+name = "Henrik" # variable for storing user name
+
+# concatenate the user name with some strings to form a personal message
+print("Hello " + name + ",... | |
ac8c5a878c8ef05c139ce3d86378b3c9ca4845d3 | tools/bbox_post_process.py | tools/bbox_post_process.py | #!/usr/bin/env python
import init
import caffe
import numpy as np
import argparse
import cPickle
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('net_def')
parser.add_argument('net_param')
parser.add_argument('save_file')
parser.add_argument('--bbox_means', default... | Add a script for process trained models using bbox means and stds. | Add a script for process trained models using bbox means and stds.
| Python | mit | myfavouritekk/TPN | ---
+++
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+import init
+import caffe
+import numpy as np
+import argparse
+import cPickle
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument('net_def')
+ parser.add_argument('net_param')
+ parser.add_argument('save_file')
+ par... | |
e00936dda07b53c22f66897d7e487d12374172e7 | corehq/apps/cleanup/management/commands/get_doc_domains.py | corehq/apps/cleanup/management/commands/get_doc_domains.py | import os
from optparse import make_option
from django.core.management.base import BaseCommand
from couchdbkit.exceptions import ResourceNotFound
from dimagi.utils.couch.database import get_db
# possible expansion: allow this to accept doc ids on the command line
# for use like `cat doc_ids.txt | ./manage.py get_do... | Add management command to get domains from doc ids | Add management command to get domains from doc ids
| Python | bsd-3-clause | gmimano/commcaretest,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,gmimano/commcaretest,dimagi/commcare-hq,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,gmimano/... | ---
+++
@@ -0,0 +1,44 @@
+import os
+from optparse import make_option
+
+from django.core.management.base import BaseCommand
+
+from couchdbkit.exceptions import ResourceNotFound
+from dimagi.utils.couch.database import get_db
+
+
+# possible expansion: allow this to accept doc ids on the command line
+# for use like... | |
24f6ebb4218f3fc1858c6100c78c41c9744b55ec | migrations/versions/0186_rename_is_active_columns.py | migrations/versions/0186_rename_is_active_columns.py | """
Revision ID: 0186_rename_is_active_columns
Revises: 0185_add_is_active_to_reply_tos
Create Date: 2018-04-27 16:35:41.824981
"""
from alembic import op
import sqlalchemy as sa
revision = '0186_rename_is_active_columns'
down_revision = '0185_add_is_active_to_reply_tos'
def upgrade():
op.alter_column('servic... | Change 'is_active' column names to 'archived' | Change 'is_active' column names to 'archived'
Changed the name of the `is_active` columns to `archived` in these
tables:
* `service_email_reply_to`
* `service_sms_senders`
* `service_letter_contacts`
These columns were not being used yet, but because we describe Templates as
'archived', this keeps the names consisten... | Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,33 @@
+"""
+
+Revision ID: 0186_rename_is_active_columns
+Revises: 0185_add_is_active_to_reply_tos
+Create Date: 2018-04-27 16:35:41.824981
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+revision = '0186_rename_is_active_columns'
+down_revision = '0185_add_is_active_to_reply_tos'
+
+
... | |
2774139f64f83e5b173a5acb67f986648b52dd6f | error-propagation/error-propagation.py | error-propagation/error-propagation.py | #!/usr/bin/env python3
import numpy
import random
random.seed(54864218)
def f(a, b):
coefficients = numpy.array([[2*a + b, a + b], [a - b, a - 2*b]])
inv_coefficients = numpy.linalg.inv(coefficients)
vars = numpy.array([2.5306, 10.1])
elements = numpy.matmul(inv_coefficients, vars)
return elem... | Add a basic error propagation example. | Add a basic error propagation example.
| Python | mpl-2.0 | DanielBrookRoberge/MonteCarloExamples | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/bin/env python3
+
+import numpy
+import random
+
+random.seed(54864218)
+
+def f(a, b):
+ coefficients = numpy.array([[2*a + b, a + b], [a - b, a - 2*b]])
+ inv_coefficients = numpy.linalg.inv(coefficients)
+
+ vars = numpy.array([2.5306, 10.1])
+
+ elements = numpy.matmul... | |
22c668a74682769fd6c41709630047e07f6d8915 | example/NaCl/NaCl-gv.py | example/NaCl/NaCl-gv.py | import numpy as np
from phonopy import Phonopy
from phonopy.interface.vasp import read_vasp
from phonopy.file_IO import parse_FORCE_SETS, parse_BORN
import matplotlib.pyplot as plt
unitcell = read_vasp("POSCAR")
phonon = Phonopy(unitcell,
[[2, 0, 0],
[0, 2, 0],
[0, ... | Add an API example for NaCl | Add an API example for NaCl
| Python | bsd-3-clause | atztogo/phonopy,atztogo/phonopy,atztogo/phonopy,atztogo/phonopy | ---
+++
@@ -0,0 +1,32 @@
+import numpy as np
+from phonopy import Phonopy
+from phonopy.interface.vasp import read_vasp
+from phonopy.file_IO import parse_FORCE_SETS, parse_BORN
+import matplotlib.pyplot as plt
+
+unitcell = read_vasp("POSCAR")
+phonon = Phonopy(unitcell,
+ [[2, 0, 0],
+ ... | |
1c951a5aa3ff604177087e847faaeca1570bd898 | experiments/keras_tensorflow/kuza55/original_examples/kuza55_blog_example.py | experiments/keras_tensorflow/kuza55/original_examples/kuza55_blog_example.py | # Multi-GPU Keras training.
# Captured from https://github.com/kuza55/keras-extras and
# https://medium.com/@kuza55/transparent-multi-gpu-training-on-tensorflow-with-keras-8b0016fd9012.
from keras.layers import merge
from keras.layers.core import Lambda
from keras.models import Model
import tensorflow as tf
def make... | Add an example from kuza55. | Add an example from kuza55.
| Python | mit | rossumai/keras-multi-gpu,rossumai/keras-multi-gpu | ---
+++
@@ -0,0 +1,68 @@
+# Multi-GPU Keras training.
+# Captured from https://github.com/kuza55/keras-extras and
+# https://medium.com/@kuza55/transparent-multi-gpu-training-on-tensorflow-with-keras-8b0016fd9012.
+
+from keras.layers import merge
+from keras.layers.core import Lambda
+from keras.models import Model
... | |
e6cf9cb9d27523fd72242f6ea137d14bff5f2039 | interface/plugin/farmanager/02title/__init__.py | interface/plugin/farmanager/02title/__init__.py | """
Gets plugin info from global fields
Low-level Far Manager API is here:
* https://api.farmanager.com/en/exported_functions/getglobalinfow.html
"""
__title__ = "02fields"
__author__ = "anatoly techtonik <techtonik@gmail.com>"
__license__ = "Public Domain"
# --- utility functions ---
import hashlib
def getu... | Add 02title/ plugin that gets own info from global fields | Add 02title/ plugin that gets own info from global fields
| Python | unlicense | techtonik/discovery,techtonik/discovery,techtonik/discovery | ---
+++
@@ -0,0 +1,46 @@
+"""
+Gets plugin info from global fields
+
+Low-level Far Manager API is here:
+
+ * https://api.farmanager.com/en/exported_functions/getglobalinfow.html
+
+"""
+
+__title__ = "02fields"
+__author__ = "anatoly techtonik <techtonik@gmail.com>"
+__license__ = "Public Domain"
+
+
+# --- utili... | |
2bfe7b5324ef79cc60b81ffc392bd2dd1b7b2bc5 | src/tests/templateedit.py | src/tests/templateedit.py | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import unittest
from oabot.main import *
class TemplateEditTests(unittest.TestCase):
def propose_change(self, text, page_name='Test page'):
wikicode = mwparserfromhell.parse(text)
for template in wikicode.filter_templates():
... | Add test utilities for proposed changes - feel free to add other cases | Add test utilities for proposed changes - feel free to add other cases
| Python | mit | dissemin/oabot,dissemin/oabot,dissemin/oabot | ---
+++
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+from __future__ import unicode_literals
+
+import unittest
+
+from oabot.main import *
+
+class TemplateEditTests(unittest.TestCase):
+
+ def propose_change(self, text, page_name='Test page'):
+ wikicode = mwparserfromhell.parse(text)
+ for templat... | |
52accd6f82893fe167a78eabe8cdf30dfa0bc841 | glance/tests/unit/test_data_migration_version.py | glance/tests/unit/test_data_migration_version.py | # Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | Add test for data migration version | Add test for data migration version
Detect when the CURRENT_VERSION constant used by the database
migration code is out of sync with the version number of the
current release.
Change-Id: I9e8b5ee98c6c111aaf065cb310906d6442f5f79a
| Python | apache-2.0 | openstack/glance,openstack/glance,openstack/glance | ---
+++
@@ -0,0 +1,59 @@
+# Copyright 2019 Red Hat, Inc.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LI... | |
11d39551f85a1490ebe370b97ed729d85df06b0b | shuup/xtheme/migrations/0004_convert_shop_themes.py | shuup/xtheme/migrations/0004_convert_shop_themes.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-12-07 23:22
from __future__ import unicode_literals
from django.db.transaction import atomic
from django.db import migrations
from shuup.core.models import Shop
from shuup.xtheme.models import SavedViewConfig, ThemeSettings
@atomic
def convert_shop_themes... | Add migration to add shop information | Xtheme: Add migration to add shop information
Add shop information in ThemeSettings and SavedViewConfig
The process will clone every settings for each existent shop
| Python | agpl-3.0 | shoopio/shoop,shoopio/shoop,shoopio/shoop | ---
+++
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.11 on 2016-12-07 23:22
+from __future__ import unicode_literals
+
+from django.db.transaction import atomic
+from django.db import migrations
+
+from shuup.core.models import Shop
+from shuup.xtheme.models import SavedViewConfig, ThemeSettin... | |
b055b5094eaca3191d066749ea6aff16dd6b9867 | nova/tests/unit/policies/test_console_auth_tokens.py | nova/tests/unit/policies/test_console_auth_tokens.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | Add test coverage of existing os-console-auth-tokens policies | Add test coverage of existing os-console-auth-tokens policies
Current tests do not have good test coverage of existing policies.
Either tests for policies do not exist or if they exist then they
do not cover the actual negative and positive testing.
For Example, if any policy with default rule as admin only then
test... | Python | apache-2.0 | mahak/nova,openstack/nova,mahak/nova,openstack/nova,klmitch/nova,openstack/nova,klmitch/nova,klmitch/nova,mahak/nova,klmitch/nova | ---
+++
@@ -0,0 +1,69 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agr... | |
babbc80437df31b61973576065296b4eb749e243 | src/analyses/migrations/0002_auto_20160616_1724.py | src/analyses/migrations/0002_auto_20160616_1724.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-16 17:24
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('analyses', '0001_initial'),
]
operations = [
... | Update genome reference model migration | Update genome reference model migration
| Python | mit | ccwang002/biocloud-server-kai,ccwang002/biocloud-server-kai,ccwang002/biocloud-server-kai | ---
+++
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-06-16 17:24
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('analyses', '0001_init... | |
39327cb18d3551618e84aaa2f70f5e3baaf734de | tests/terminal_tests/CorrectGrammarHandlingTest.py | tests/terminal_tests/CorrectGrammarHandlingTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase
from grammpy import Terminal
class TempClass:
pass
class CorrectGrammarHandlingTest(TestCase):
def test_sameNumber(self):
ter1 = Terminal(0, 1)
ter2 =... | Add test for correct handling of grammar in terminal | Add test for correct handling of grammar in terminal
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 23.06.2017 16:39
+:Licence GNUv3
+Part of grammpy
+
+"""
+from unittest import TestCase
+from grammpy import Terminal
+
+
+class TempClass:
+ pass
+
+
+class CorrectGrammarHandlingTest(TestCase):
+ def test_sameNumber(self):... | |
42851304fecec95c32eebd618aae192743aab5d4 | src/ggrc_risk_assessment_v2/migrations/versions/20141121231826_1347acbb4dc2_add_unique_constraint_to_threat_actors.py | src/ggrc_risk_assessment_v2/migrations/versions/20141121231826_1347acbb4dc2_add_unique_constraint_to_threat_actors.py |
"""Add unique constraint to threat actors
Revision ID: 1347acbb4dc2
Revises: 5ada65dc60b3
Create Date: 2014-11-21 23:18:26.689048
"""
# revision identifiers, used by Alembic.
revision = '1347acbb4dc2'
down_revision = '5ada65dc60b3'
from alembic import op
def upgrade():
op.create_unique_constraint('uq_t_actors'... | Add unique constraint on Threat Actor title | Add unique constraint on Threat Actor title
| Python | apache-2.0 | prasannav7/ggrc-core,kr41/ggrc-core,andrei-karalionak/ggrc-core,NejcZupec/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,j0gurt/ggrc-core,prasannav7/ggrc-core,selahssea/ggrc-core,hyperNURb/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,kr41/ggrc-core,AleksNeStu/ggrc-core,hasanalom/ggrc-core,j0... | ---
+++
@@ -0,0 +1,22 @@
+
+"""Add unique constraint to threat actors
+
+Revision ID: 1347acbb4dc2
+Revises: 5ada65dc60b3
+Create Date: 2014-11-21 23:18:26.689048
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '1347acbb4dc2'
+down_revision = '5ada65dc60b3'
+
+from alembic import op
+
+
+def upgrade():... | |
66e6ba2988aee0cf9301f735e170b7f74ca310ac | qcfractal/alembic/versions/4bb79efa9855_add_queue_manager_id_to_base_results.py | qcfractal/alembic/versions/4bb79efa9855_add_queue_manager_id_to_base_results.py | """Add queue_manager id to Base_results
Revision ID: 4bb79efa9855
Revises: 26cfd7b0439e
Create Date: 2019-07-26 15:31:14.811337
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4bb79efa9855'
down_revision = '26cfd7b0439e'
branch_labels = None
depends_on = None
... | Add db migration to add manager_id to base_results | Add db migration to add manager_id to base_results
| Python | bsd-3-clause | psi4/mongo_qcdb,psi4/DatenQM,psi4/mongo_qcdb,psi4/DatenQM | ---
+++
@@ -0,0 +1,30 @@
+"""Add queue_manager id to Base_results
+
+Revision ID: 4bb79efa9855
+Revises: 26cfd7b0439e
+Create Date: 2019-07-26 15:31:14.811337
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = '4bb79efa9855'
+down_revision = '26cfd7b0439e... | |
807bb8425665e1cdd9040dfdd830603b95e9ab0a | tests/test_inheritance.py | tests/test_inheritance.py | from dtest import *
from dtest.util import *
# Define setUpClass/tearDownClass/setUp/tearDown for inheritance
class TestInheritanceBase(DTestCase):
class_setup = None
instance_setup = None
@classmethod
def setUpClass(cls):
assert_is_none(cls.class_setup)
cls.class_setup = True
@c... | Test that inheritance of setUp/tearDown/setUpClass/tearDownClass works as expected | Test that inheritance of setUp/tearDown/setUpClass/tearDownClass works
as expected
| Python | apache-2.0 | klmitch/dtest,klmitch/dtest | ---
+++
@@ -0,0 +1,34 @@
+from dtest import *
+from dtest.util import *
+
+
+# Define setUpClass/tearDownClass/setUp/tearDown for inheritance
+class TestInheritanceBase(DTestCase):
+ class_setup = None
+ instance_setup = None
+
+ @classmethod
+ def setUpClass(cls):
+ assert_is_none(cls.class_setup)... | |
eda80dd9a903a7baaddad123978981352de6d337 | project/app/migrations/0003_auto_20170311_0837.py | project/app/migrations/0003_auto_20170311_0837.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-11 16:37
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0002_auto_20170311_0811'),
]
operations = [
migrations.AlterUniqueTogether(
... | Remove constraint on Session model | Remove constraint on Session model
| Python | bsd-2-clause | barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore-django,barberscore/barberscore-api,dbinetti/barberscore,dbinetti/barberscore,dbinetti/barberscore-django,barberscore/barberscore-api | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.6 on 2017-03-11 16:37
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('app', '0002_auto_20170311_0811'),
+ ]
+
+ operations = [... | |
03f9355de0c25f41fa5ed78b81b0fd0ee988a117 | py/kth-largest-element-in-an-array.py | py/kth-largest-element-in-an-array.py | import random
class Solution(object):
def findKthLargest(self, nums, k, start=0, end=None):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
l = len(nums)
if end is None:
end = l
if end == start + 1:
return nums[start]
... | Add py solution for 215. Kth Largest Element in an Array | Add py solution for 215. Kth Largest Element in an Array
215. Kth Largest Element in an Array: https://leetcode.com/problems/kth-largest-element-in-an-array/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,35 @@
+import random
+class Solution(object):
+ def findKthLargest(self, nums, k, start=0, end=None):
+ """
+ :type nums: List[int]
+ :type k: int
+ :rtype: int
+ """
+ l = len(nums)
+ if end is None:
+ end = l
+
+ if end == star... | |
28208126b532edb64c97c63a8cbff841c8da3c4f | scripts/officediff/xlsx-dump.py | scripts/officediff/xlsx-dump.py | from io import StringIO
import sys
import pandas as pd
for sheet_name in pd.ExcelFile(sys.argv[1]).sheet_names:
output = StringIO()
print('Sheet: %s' % sheet_name)
pd.read_excel(sys.argv[1], sheet_name=sheet_name)\
.to_csv(output,
header=True,
index=False)
print(outp... | Add Python script for powerpoint file diffs | Add Python script for powerpoint file diffs
| Python | mit | Stratus3D/dotfiles,Stratus3D/dotfiles,Stratus3D/dotfiles | ---
+++
@@ -0,0 +1,14 @@
+from io import StringIO
+import sys
+
+import pandas as pd
+
+
+for sheet_name in pd.ExcelFile(sys.argv[1]).sheet_names:
+ output = StringIO()
+ print('Sheet: %s' % sheet_name)
+ pd.read_excel(sys.argv[1], sheet_name=sheet_name)\
+ .to_csv(output,
+ header=True,
+ ... | |
8ea2670402812738e41400e5b513bd902757635e | ideascube/conf/idb_sen_fap.py | ideascube/conf/idb_sen_fap.py | # -*- coding: utf-8 -*-
"""Ideaxbox for FAP in Sénégal"""
from .idb import * # noqa
from django.utils.translation import ugettext_lazy as _
IDEASCUBE_NAME = u"Futur au Présent"
IDEASCUBE_PLACE_NAME = _("city")
COUNTRIES_FIRST = ['SN']
TIME_ZONE = None
LANGUAGE_CODE = 'fr'
LOAN_DURATION = 14
MONITORING_ENTRY_EXPORT_FI... | Add conf file for Ideasbox in Sénégal | Add conf file for Ideasbox in Sénégal
| Python | agpl-3.0 | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ---
+++
@@ -0,0 +1,81 @@
+# -*- coding: utf-8 -*-
+"""Ideaxbox for FAP in Sénégal"""
+from .idb import * # noqa
+from django.utils.translation import ugettext_lazy as _
+
+IDEASCUBE_NAME = u"Futur au Présent"
+IDEASCUBE_PLACE_NAME = _("city")
+COUNTRIES_FIRST = ['SN']
+TIME_ZONE = None
+LANGUAGE_CODE = 'fr'
+LOAN_DU... | |
0f16c249f048e27a67f14ff834c690fc2434b55f | admin/common_auth/migrations/0006_auto_20170130_1611.py | admin/common_auth/migrations/0006_auto_20170130_1611.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-01-30 22:11
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('common_auth', '0005_auto_20170111_1513'),
]
operations = [
migrations.AlterModelOption... | Add migration that adds permission for spam, metrics and prereg | Add migration that adds permission for spam, metrics and prereg
| Python | apache-2.0 | CenterForOpenScience/osf.io,monikagrabowska/osf.io,Nesiehr/osf.io,adlius/osf.io,caseyrollins/osf.io,brianjgeiger/osf.io,Nesiehr/osf.io,acshi/osf.io,laurenrevere/osf.io,pattisdr/osf.io,binoculars/osf.io,CenterForOpenScience/osf.io,mfraezz/osf.io,felliott/osf.io,mattclark/osf.io,cslzchen/osf.io,brianjgeiger/osf.io,caseyr... | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9 on 2017-01-30 22:11
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('common_auth', '0005_auto_20170111_1513'),
+ ]
+
+ operation... | |
7e04bc41e977ef7304972cfc630cd9bf9d2c0aa2 | examples/anonymized-real-case.py | examples/anonymized-real-case.py | #!/usr/bin/env python2
# coding: utf-8
# this example is used in production, it is depending on private libraries
# to communicate with internal APIs, but it can help you build your own
# production company-specific hook.
import sys
import json
import pprint
pp = pprint.PrettyPrinter(indent=4)
sys.path.insert(0, '/o... | Add anonymzed real case example | Add anonymzed real case example
| Python | mit | moul/ssh2docker,moul/ssh2docker | ---
+++
@@ -0,0 +1,95 @@
+#!/usr/bin/env python2
+# coding: utf-8
+
+# this example is used in production, it is depending on private libraries
+# to communicate with internal APIs, but it can help you build your own
+# production company-specific hook.
+
+import sys
+import json
+import pprint
+pp = pprint.PrettyPri... | |
cee56f48a8ad726498c75b38cf39e4c83ceeb359 | analyze.py | analyze.py | import os
import pickle
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
def load_data(data_path):
'''Return dictionary `data` from string `data_path`
'''
os.path.join(data_path, '1.dat')
data = pickle.load(open(data_path, 'rb'))
return data
def get_baseline(data... | Add helper functions for analyzing data | Add helper functions for analyzing data
| Python | mit | JustinShenk/sensei | ---
+++
@@ -0,0 +1,50 @@
+import os
+import pickle
+import numpy as np
+import matplotlib.pyplot as plt
+
+from datetime import datetime
+
+
+def load_data(data_path):
+ '''Return dictionary `data` from string `data_path`
+ '''
+ os.path.join(data_path, '1.dat')
+ data = pickle.load(open(data_path, 'rb'))... | |
5811966fa895669aa13395a8247e966f4b957ab2 | CodeFights/isDigit.py | CodeFights/isDigit.py | #!/usr/local/bin/python
# Code Fights Is Digit Problem
import re
def isDigit(symbol):
return bool(re.search(r'\d', symbol))
def main():
tests = [
["0", True],
["-", False],
["o", False],
["1", True],
["2", True],
["!", False],
["@", False],
["... | Solve Code Fights is digit problem | Solve Code Fights is digit problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,38 @@
+#!/usr/local/bin/python
+# Code Fights Is Digit Problem
+
+import re
+
+
+def isDigit(symbol):
+ return bool(re.search(r'\d', symbol))
+
+
+def main():
+ tests = [
+ ["0", True],
+ ["-", False],
+ ["o", False],
+ ["1", True],
+ ["2", True],
+ [... | |
71b9ae31e34504b5805d37e72f7161aaa56ad5f8 | pyconcz_2016/cfp/migrations/0002_auto_20160716_2222.py | pyconcz_2016/cfp/migrations/0002_auto_20160716_2222.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-07-16 20:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('cfp', '0001_initial'),
]
operations = [
migrati... | Add migrations for previous commit | Add migrations for previous commit
| Python | mit | benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,pyvec/cz.pycon.org-2016,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2016,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,pyvec/cz.pycon.org-2016 | ---
+++
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.3 on 2016-07-16 20:22
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('cfp', '0001_initial'),
+ ... | |
d94ab69dff6fc950b27105bf334454fcee83a1b8 | create_properties.py | create_properties.py | import enki
e = enki.Enki('a', 'http://localhost:5001', 'translationsvoting')
e.get_all()
lines = []
for t in e.tasks:
msgstr = e.task_runs_df[t.id]['msgstr'].describe()['top']
var_id = t.info['var_id']
line = "%s= %s\n" % (var_id, msgstr)
lines.append(line)
file = open('/tmp/file.properties', 'w')
... | Create properties files from votes. | Create properties files from votes.
| Python | agpl-3.0 | PyBossa/app-translations | ---
+++
@@ -0,0 +1,17 @@
+import enki
+
+e = enki.Enki('a', 'http://localhost:5001', 'translationsvoting')
+
+e.get_all()
+
+lines = []
+for t in e.tasks:
+ msgstr = e.task_runs_df[t.id]['msgstr'].describe()['top']
+ var_id = t.info['var_id']
+ line = "%s= %s\n" % (var_id, msgstr)
+ lines.append(line)
+
+... | |
e7caa52ffdc547c66454a200e5e9901d6015bb3e | hunittest/test/test_stopwatch.py | hunittest/test/test_stopwatch.py | # -*- encoding: utf-8 -*-
"""Test 'stopwath' module.
"""
import unittest
import time
from datetime import timedelta
from hunittest.stopwatch import StopWatch
class TestStopWatch(unittest.TestCase):
def assertTimedeltaAlmostEqual(self, td1, td2, prec=1e-3):
return abs(td1 - td2).total_seconds <= prec
... | Add unit test for StopWatch. | Add unit test for StopWatch.
| Python | bsd-2-clause | nicolasdespres/hunittest | ---
+++
@@ -0,0 +1,73 @@
+# -*- encoding: utf-8 -*-
+"""Test 'stopwath' module.
+"""
+
+
+import unittest
+import time
+from datetime import timedelta
+
+from hunittest.stopwatch import StopWatch
+
+
+class TestStopWatch(unittest.TestCase):
+
+ def assertTimedeltaAlmostEqual(self, td1, td2, prec=1e-3):
+ re... | |
b246723d837cddde898316b67ab5af1feba67817 | zerver/migrations/0279_message_recipient_subject_indexes.py | zerver/migrations/0279_message_recipient_subject_indexes.py | # Generated by Django 2.2.12 on 2020-04-30 00:35
from django.db import migrations
class Migration(migrations.Migration):
atomic = False
dependencies = [
('zerver', '0278_remove_userprofile_alert_words'),
]
operations = [
migrations.RunSQL("""
CREATE INDEX CONCURRENTLY IF NOT... | Add Message indexes on (recipient_id, subject). | migrations: Add Message indexes on (recipient_id, subject).
Our previous set of indexes for the Message table did not contain
anything to optimize queries for all the messages in a topic in an
organization where the same topic name might appear in 10,000s of
messages in many streams.
We add two indexes here to suppor... | Python | apache-2.0 | andersk/zulip,timabbott/zulip,rht/zulip,zulip/zulip,synicalsyntax/zulip,showell/zulip,kou/zulip,rht/zulip,eeshangarg/zulip,brainwane/zulip,andersk/zulip,zulip/zulip,kou/zulip,timabbott/zulip,zulip/zulip,eeshangarg/zulip,andersk/zulip,eeshangarg/zulip,timabbott/zulip,showell/zulip,showell/zulip,hackerkid/zulip,shubhamdh... | ---
+++
@@ -0,0 +1,20 @@
+# Generated by Django 2.2.12 on 2020-04-30 00:35
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ atomic = False
+
+ dependencies = [
+ ('zerver', '0278_remove_userprofile_alert_words'),
+ ]
+
+ operations = [
+ migrations.RunSQL("""... | |
da596f8c04cb96355a12087eabea7151eb8771a3 | osf_tests/test_maintenance.py | osf_tests/test_maintenance.py | import unittest
from datetime import timedelta
import pytest
from django.utils import timezone
from website import maintenance
from osf.models import MaintenanceState
pytestmark = pytest.mark.django_db
class TestMaintenance(unittest.TestCase):
def tearDown(self):
MaintenanceState.objects.all().delete... | Add tests for maintenance functions | Add tests for maintenance functions
| Python | apache-2.0 | erinspace/osf.io,cslzchen/osf.io,saradbowman/osf.io,Johnetordoff/osf.io,adlius/osf.io,adlius/osf.io,erinspace/osf.io,caseyrollins/osf.io,laurenrevere/osf.io,sloria/osf.io,pattisdr/osf.io,icereval/osf.io,baylee-d/osf.io,binoculars/osf.io,crcresearch/osf.io,icereval/osf.io,caneruguz/osf.io,chrisseto/osf.io,TomBaxter/osf.... | ---
+++
@@ -0,0 +1,65 @@
+import unittest
+from datetime import timedelta
+
+import pytest
+from django.utils import timezone
+
+from website import maintenance
+from osf.models import MaintenanceState
+
+
+pytestmark = pytest.mark.django_db
+
+
+class TestMaintenance(unittest.TestCase):
+
+ def tearDown(self):
+ ... | |
7079c8d78256bb24608f8a74c26273ab653c886a | pal/grammars/test_grammars.py | pal/grammars/test_grammars.py | import re
from collections import defaultdict
from pal.grammars.grammars import make_chomsky_normal_form
from pal.grammars.grammars import parse_grammar_from_file
from pal.grammars.parser import generate_grammar_features
from pal.grammars.parser import parse
_GRAMMARS_DIR = 'pal/grammars/services'
_EXAMPLES_FILE = '... | Add test for service grammars: hit rate against example queries | Add test for service grammars: hit rate against example queries
| Python | bsd-3-clause | Machyne/pal,Machyne/pal,Machyne/pal,Machyne/pal | ---
+++
@@ -0,0 +1,58 @@
+import re
+from collections import defaultdict
+
+from pal.grammars.grammars import make_chomsky_normal_form
+from pal.grammars.grammars import parse_grammar_from_file
+from pal.grammars.parser import generate_grammar_features
+from pal.grammars.parser import parse
+
+
+_GRAMMARS_DIR = 'pal/... | |
470b217e8ca8687414ff4cad39ca7cfe4710d956 | tests/functional/test_pip_runner_script.py | tests/functional/test_pip_runner_script.py | import os
from pathlib import Path
from pip import __version__
from tests.lib import PipTestEnvironment
def test_runner_work_in_environments_with_no_pip(
script: PipTestEnvironment, pip_src: Path
) -> None:
runner = pip_src / "src" / "pip" / "__pip-runner__.py"
# Ensure there's no pip installed in the e... | Add a test that the runner script works in environments without pip | Add a test that the runner script works in environments without pip
This ensures that the runner script can be used in environments where
pip is not installed.
| Python | mit | sbidoul/pip,pypa/pip,pradyunsg/pip,pfmoore/pip,pradyunsg/pip,pypa/pip,sbidoul/pip,pfmoore/pip | ---
+++
@@ -0,0 +1,20 @@
+import os
+from pathlib import Path
+
+from pip import __version__
+from tests.lib import PipTestEnvironment
+
+
+def test_runner_work_in_environments_with_no_pip(
+ script: PipTestEnvironment, pip_src: Path
+) -> None:
+ runner = pip_src / "src" / "pip" / "__pip-runner__.py"
+
+ # ... | |
34c9dbb30a731643b6a8747995fbf760dbd5377c | tests/header_test.py | tests/header_test.py | #! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
import pycurl
import unittest
from . import appmanager
from . import util
setup_module, teardown_module = appmanager.setup(('app', 8380))
class HeaderTest(unittest.TestCase):
def setUp(self):
self.curl = pycurl.Curl()
def tearDown... | Add a test for sending unicode data in http headers | Add a test for sending unicode data in http headers
| Python | lgpl-2.1 | pycurl/pycurl,pycurl/pycurl,pycurl/pycurl | ---
+++
@@ -0,0 +1,41 @@
+#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
+# vi:ts=4:et
+
+import pycurl
+import unittest
+
+from . import appmanager
+from . import util
+
+setup_module, teardown_module = appmanager.setup(('app', 8380))
+
+class HeaderTest(unittest.TestCase):
+ def setUp(self):
+ self.... | |
a205fbc29d2c6c8004b91c3fed5b2a03427e62a4 | locations/spiders/victra.py | locations/spiders/victra.py | # -*- coding: utf-8 -*-
import json
import re
import scrapy
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
class VictraSpider(scrapy.Spider):
name = "victra"
allowed_domains = []
start_urls = [
'https://victra.com/Handlers/LocationData.ashx',
]
def ... | Add spider for Victra mobile phone stores | Add spider for Victra mobile phone stores
| Python | mit | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | ---
+++
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+import json
+import re
+
+import scrapy
+
+from locations.items import GeojsonPointItem
+from locations.hours import OpeningHours
+
+class VictraSpider(scrapy.Spider):
+ name = "victra"
+ allowed_domains = []
+ start_urls = [
+ 'https://victra.com/Han... | |
6edadb2fe75345d24f5fec26bd4e519611f651f8 | integration_tests/test_s3_deletion.py | integration_tests/test_s3_deletion.py | #!/usr/bin/env python
"""
Test S3 directory deletion functionality.
Uses the lsst-the-docs-test bucket in lsst-sqre's account. Also assumes that
credentials for that account are in the ltd-dev profile of ~/.aws/credentials.
"""
import sys
import os.path
app_path = os.path.abspath(os.path.join(os.path.dirname(__file__... | Add integration test for S3 object deletion | Add integration test for S3 object deletion
By default, uses the test bucket 'lsst-the-docs-test' and assumes
credentials for the lsst-sqre account are in 'ltd-dev' profile of
~/.aws/credentials.
For DM-4951.
| Python | mit | lsst-sqre/ltd-keeper,lsst-sqre/ltd-keeper | ---
+++
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+"""
+Test S3 directory deletion functionality.
+
+Uses the lsst-the-docs-test bucket in lsst-sqre's account. Also assumes that
+credentials for that account are in the ltd-dev profile of ~/.aws/credentials.
+"""
+
+import sys
+import os.path
+app_path = os.path.abspath... | |
15a9ec59e698a16cc37c3e0b430a376e3e73bd04 | tests/test_parser.py | tests/test_parser.py | import unittest
from unittest.mock import patch, call
import whitepy.lexer as lexer
from whitepy.parser import Parser
class TestParser(unittest.TestCase):
def _get_tokens(self, filename):
with open(filename, 'r') as f:
lines = f.read()
item = lexer.Lexer(line=lines)
i... | Add new test for Parser | Add new test for Parser
Tests the main Parser.parse() function with hello world and Fibonacci whitespace
samples
| Python | apache-2.0 | yasn77/whitepy | ---
+++
@@ -0,0 +1,61 @@
+import unittest
+from unittest.mock import patch, call
+
+import whitepy.lexer as lexer
+from whitepy.parser import Parser
+
+
+class TestParser(unittest.TestCase):
+
+ def _get_tokens(self, filename):
+ with open(filename, 'r') as f:
+ lines = f.read()
+ item... | |
dc10584666199797b77a759696c56e179ef8ca21 | billjobs/serializers.py | billjobs/serializers.py | from django.contrib.auth.models import User, Group
from rest_framework import serializers
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'username', 'email', 'groups')
| Add serializer for User model | Add serializer for User model
| Python | mit | ioO/billjobs | ---
+++
@@ -0,0 +1,9 @@
+from django.contrib.auth.models import User, Group
+from rest_framework import serializers
+
+
+class UserSerializer(serializers.HyperlinkedModelSerializer):
+ class Meta:
+ model = User
+ fields = ('url', 'username', 'email', 'groups')
+ | |
1c3082e18b63ef0ba7fb73dd69544980da7ad16c | zinnia/migrations/0003_publication_date.py | zinnia/migrations/0003_publication_date.py | from django.db import models
from django.db import migrations
from django.utils import timezone
def fill_publication_date(apps, schema_editor):
Entry = apps.get_model('zinnia', 'Entry')
for entry in Entry.objects.all():
entry.publication_date = entry.creation_date
entry.save()
def unfill_pub... | Add migration for publication_date field | Add migration for publication_date field
| Python | bsd-3-clause | ghachey/django-blog-zinnia,dapeng0802/django-blog-zinnia,petecummings/django-blog-zinnia,aorzh/django-blog-zinnia,extertioner/django-blog-zinnia,Zopieux/django-blog-zinnia,bywbilly/django-blog-zinnia,extertioner/django-blog-zinnia,marctc/django-blog-zinnia,bywbilly/django-blog-zinnia,marctc/django-blog-zinnia,extertion... | ---
+++
@@ -0,0 +1,69 @@
+from django.db import models
+from django.db import migrations
+from django.utils import timezone
+
+
+def fill_publication_date(apps, schema_editor):
+ Entry = apps.get_model('zinnia', 'Entry')
+ for entry in Entry.objects.all():
+ entry.publication_date = entry.creation_date
+... | |
e9f6031f9368cd036826f40c113e5ca9d420409a | lily/contacts/migrations/0013_auto_20170717_2005.py | lily/contacts/migrations/0013_auto_20170717_2005.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('contacts', '0012_remove_contact_preposition'),
]
operations = [
migrations.AlterField(
... | Add extra migration for the manager field | Add extra migration for the manager field
| Python | agpl-3.0 | HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('contacts', '0012_remove_contact_preposition'),
+ ]
+
+ operation... | |
b2635fd52aa474e6dd375ad804f46a16945962a4 | lib/svtplay/service/hbo.py | lib/svtplay/service/hbo.py | class Hbo():
def handle(self, url):
return "hbo.com" in url
def get(self, url):
parse = urlparse(url)
try:
other = parse[5]
except KeyError:
log.error("Something wrong with that url")
sys.exit(2)
match = re.search("^/(.*).html", other)... | class Hbo():
def handle(self, url):
return "hbo.com" in url
def get(self, options, url):
parse = urlparse(url)
try:
other = parse[5]
except KeyError:
log.error("Something wrong with that url")
sys.exit(2)
match = re.search("^/(.*).html... | Add options argument to get() | HBO: Add options argument to get()
| Python | mit | qnorsten/svtplay-dl,dalgr/svtplay-dl,olof/svtplay-dl,leakim/svtplay-dl,spaam/svtplay-dl,selepo/svtplay-dl,OakNinja/svtplay-dl,iwconfig/svtplay-dl,dalgr/svtplay-dl,spaam/svtplay-dl,OakNinja/svtplay-dl,leakim/svtplay-dl,iwconfig/svtplay-dl,qnorsten/svtplay-dl,selepo/svtplay-dl,OakNinja/svtplay-dl,leakim/svtplay-dl,olof/s... | ---
+++
@@ -2,7 +2,7 @@
def handle(self, url):
return "hbo.com" in url
- def get(self, url):
+ def get(self, options, url):
parse = urlparse(url)
try:
other = parse[5] |
c2817959fea63db83a328a8ce61b95031b04c4bd | mopidy/frontends/mpd/__init__.py | mopidy/frontends/mpd/__init__.py | from mopidy.frontends.mpd.dispatcher import MpdDispatcher
from mopidy.frontends.mpd.process import MpdProcess
class MpdFrontend(object):
"""
The MPD frontend.
"""
def __init__(self):
self.server = None
self.dispatcher = None
def start_server(self, core_queue):
"""
... | from mopidy.frontends.mpd.dispatcher import MpdDispatcher
from mopidy.frontends.mpd.process import MpdProcess
class MpdFrontend(object):
"""
The MPD frontend.
"""
def __init__(self):
self.process = None
self.dispatcher = None
def start_server(self, core_queue):
"""
... | Initialize the correct variable in init | Initialize the correct variable in init
| Python | apache-2.0 | dbrgn/mopidy,dbrgn/mopidy,ali/mopidy,diandiankan/mopidy,kingosticks/mopidy,SuperStarPL/mopidy,abarisain/mopidy,pacificIT/mopidy,kingosticks/mopidy,tkem/mopidy,bacontext/mopidy,pacificIT/mopidy,SuperStarPL/mopidy,ali/mopidy,vrs01/mopidy,quartz55/mopidy,quartz55/mopidy,tkem/mopidy,tkem/mopidy,mopidy/mopidy,dbrgn/mopidy,g... | ---
+++
@@ -7,7 +7,7 @@
"""
def __init__(self):
- self.server = None
+ self.process = None
self.dispatcher = None
def start_server(self, core_queue): |
df810f11409212edce61263205288cfbb7221a2d | scripts/evaluation/process_api_performance_files.py | scripts/evaluation/process_api_performance_files.py | import sys
import os
output_dir = sys.argv[1]
def filename(num_duplications):
return os.path.join(output_dir, "output_%s.csv" % (str(num_duplications),))
def time_for_method(fname):
with open(fname) as f:
lines = f.readlines()[1:]
lines = [line.replace("\n", "").split(", ") for line in lines]... | Write script to parse API performance data | Write script to parse API performance data
| Python | mit | mitdbg/modeldb,mitdbg/modeldb,mitdbg/modeldb,mitdbg/modeldb,mitdbg/modeldb | ---
+++
@@ -0,0 +1,27 @@
+import sys
+import os
+
+output_dir = sys.argv[1]
+
+def filename(num_duplications):
+ return os.path.join(output_dir, "output_%s.csv" % (str(num_duplications),))
+
+def time_for_method(fname):
+ with open(fname) as f:
+ lines = f.readlines()[1:]
+ lines = [line.replace("... | |
d44dd85a1020da3971a50ceb1c0c8150b05d5334 | scripts/utils/shape-to-csv.py | scripts/utils/shape-to-csv.py | #!/usr/bin/env python3
import csv
import ogr
import osr
import sys
import unicodedata
def usage():
print('shape-to-csv.py PATH_TO_INPUT_SHAPE PATH_TO_OUTPUT_CSV')
def main():
# Inspired by http://gis.stackexchange.com/a/19178
# This is design to work with the places.shp from Swisstzerland.
shpfile ... | Add script to convert ShapeFile to CSV for search | Add script to convert ShapeFile to CSV for search
Used by customer infra to have search.
| Python | agpl-3.0 | ioda-net/geo-infra,ioda-net/geo-infra,ioda-net/geo-infra,ioda-net/geo-infra | ---
+++
@@ -0,0 +1,72 @@
+#!/usr/bin/env python3
+
+import csv
+import ogr
+import osr
+import sys
+import unicodedata
+
+
+def usage():
+ print('shape-to-csv.py PATH_TO_INPUT_SHAPE PATH_TO_OUTPUT_CSV')
+
+
+def main():
+ # Inspired by http://gis.stackexchange.com/a/19178
+ # This is design to work with the ... | |
ddc0b056af46bf50f3e5c4213f7598d645d378f7 | openprescribing/matrixstore/tests/test_cachelib.py | openprescribing/matrixstore/tests/test_cachelib.py | from mock import Mock
import warnings
from django.core.cache import CacheKeyWarning
from django.test import SimpleTestCase, override_settings
from matrixstore.cachelib import memoize
# The local memory cache backend we use in testing warns that our binary cache
# keys won't be compatible with memcached, but we reall... | Add tests for cachelib decorator | Add tests for cachelib decorator
| Python | mit | ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc,annapowellsmith/openpresc,annapowellsmith/openpresc,ebmdatalab/openprescribing,ebmdatalab/openprescribing,ebmdatalab/openprescribing | ---
+++
@@ -0,0 +1,66 @@
+from mock import Mock
+import warnings
+
+from django.core.cache import CacheKeyWarning
+from django.test import SimpleTestCase, override_settings
+
+from matrixstore.cachelib import memoize
+
+# The local memory cache backend we use in testing warns that our binary cache
+# keys won't be co... | |
e02679577219cea30896532be9ba6aea457e2454 | mixpanel_query/paginator.py | mixpanel_query/paginator.py | import math
import itertools
from multiprocessing.pool import ThreadPool
class ConcurrentPaginator(object):
"""
Concurrently fetches all pages in a paginated collection.
Currently, only the people API (`/api/2.0/engage`) supports pagination.
This class is designed to support the people API's implement... | Add ConcurrentPaginator (for the engage API) | Add ConcurrentPaginator (for the engage API)
| Python | mit | cooncesean/mixpanel-query-py | ---
+++
@@ -0,0 +1,59 @@
+import math
+import itertools
+from multiprocessing.pool import ThreadPool
+
+class ConcurrentPaginator(object):
+ """
+ Concurrently fetches all pages in a paginated collection.
+
+ Currently, only the people API (`/api/2.0/engage`) supports pagination.
+ This class is designed ... | |
b224a281a11cdc4d0c632e451c217be34dccadcc | app/main/forms/suppliers.py | app/main/forms/suppliers.py | from flask.ext.wtf import Form
from wtforms import IntegerField, StringField, FieldList
from wtforms.validators import DataRequired, Email
class EditSupplierForm(Form):
description = StringField()
clients = FieldList(StringField(), max_entries=10)
class EditContactInformationForm(Form):
id = IntegerFiel... | Add forms for supplier and contact information | Add forms for supplier and contact information
Forms allow us to validate basic field requirements before making
a request to the API, since the API doesn't return per-field errors
at the moment.
Supplier and contact information have separate forms, since they
require separate API requests to save the data and might ... | Python | mit | mtekel/digitalmarketplace-supplier-frontend,mtekel/digitalmarketplace-supplier-frontend,mtekel/digitalmarketplace-supplier-frontend,mtekel/digitalmarketplace-supplier-frontend,alphagov/digitalmarketplace-supplier-frontend,alphagov/digitalmarketplace-supplier-frontend,alphagov/digitalmarketplace-supplier-frontend,alphag... | ---
+++
@@ -0,0 +1,28 @@
+from flask.ext.wtf import Form
+from wtforms import IntegerField, StringField, FieldList
+from wtforms.validators import DataRequired, Email
+
+
+class EditSupplierForm(Form):
+ description = StringField()
+ clients = FieldList(StringField(), max_entries=10)
+
+
+class EditContactInfor... | |
48a03c6e593e647e52a96aabcfc8ac02d7c93773 | tfx/examples/imdb/imdb_fetch_data.py | tfx/examples/imdb/imdb_fetch_data.py | import os
import pandas as pd
import tensorflow_datasets as tfds
# Example use in another file of this directory:
# import imdb_fetch_data as full_data
# full_data.fetch_data()
def fetch_data():
"""This downloads the full dataset to pwd/data/imdb.csv"""
ds = tfds.load('imdb_reviews', split='train+... | Add fetch data py script | Add fetch data py script
Add .py file with code to fetch data defined in function fetch_data() | Python | apache-2.0 | tensorflow/tfx,tensorflow/tfx | ---
+++
@@ -0,0 +1,22 @@
+import os
+import pandas as pd
+import tensorflow_datasets as tfds
+
+
+# Example use in another file of this directory:
+# import imdb_fetch_data as full_data
+# full_data.fetch_data()
+
+
+def fetch_data():
+ """This downloads the full dataset to pwd/data/imdb.csv"""
+
+ ds = tfds.load('... | |
4d14acb3f805c26f1d917639f82974a006df9d4a | 2048/test_2048.py | 2048/test_2048.py | from __future__ import print_function
import numpy as np
import math
np.random.seed(1337) # for reproducibility
from keras.datasets import mnist
from keras.models import Sequential, model_from_json
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, ... | Test qlearning4k result for 2048 | Test qlearning4k result for 2048
| Python | mit | choupi/NDHUDLWorkshop | ---
+++
@@ -0,0 +1,46 @@
+from __future__ import print_function
+import numpy as np
+import math
+np.random.seed(1337) # for reproducibility
+
+from keras.datasets import mnist
+from keras.models import Sequential, model_from_json
+from keras.layers.core import Dense, Dropout, Activation, Flatten
+from keras.layers.... | |
70c3fbbd4aee9a5dfd75c6891fe479ba894ace38 | strategic_form.py | strategic_form.py | from numpy import array
def transpose(payoff_matrix):
return array(payoff_matrix).transpose().tolist()
def get_best_responses(payoff_matrix):
# Select argmax from each row, and return the result as a list
return list(map(lambda x: (payoff_matrix.index(x), x.index(max(x))), payoff_matrix))
def solve_psne_2(payo... | Add algorithm for finding PSNE in two-player simultaneous-move games | Add algorithm for finding PSNE in two-player simultaneous-move games
| Python | mit | kubkon/py-game-theory | ---
+++
@@ -0,0 +1,52 @@
+from numpy import array
+
+def transpose(payoff_matrix):
+ return array(payoff_matrix).transpose().tolist()
+
+def get_best_responses(payoff_matrix):
+ # Select argmax from each row, and return the result as a list
+ return list(map(lambda x: (payoff_matrix.index(x), x.index(max(x))), pay... | |
1c10d27733c5448aaf9aa47c19ff3b279b3f0174 | yahoo_historical/tests/test_fetch.py | yahoo_historical/tests/test_fetch.py | from yahoo_historical import Fetcher
def test_get_historical():
data = Fetcher("AAPL", [2007, 1, 1], [2017, 1, 1]).get_historical()
assert len(data) > 0
def test_get_dividends():
data = Fetcher("AAPL", [2007, 1, 1], [2017, 1, 1]).get_dividends()
assert len(data) > 0
def test_get_splits():
data... | Add basic unit tests for CI job | Add basic unit tests for CI job
| Python | mit | AndrewRPorter/yahoo-historical | ---
+++
@@ -0,0 +1,26 @@
+from yahoo_historical import Fetcher
+
+
+def test_get_historical():
+ data = Fetcher("AAPL", [2007, 1, 1], [2017, 1, 1]).get_historical()
+ assert len(data) > 0
+
+
+def test_get_dividends():
+ data = Fetcher("AAPL", [2007, 1, 1], [2017, 1, 1]).get_dividends()
+ assert len(data)... | |
da005126cdc6ac78a464ac55ae50f15c99c90b4a | bin/crosswalk_msa_county.py | bin/crosswalk_msa_county.py | """build_2000_msa.py
Extract a usable crosswalk between 2000 Metropolitan areas and counties.
Reconstitute a shapefile for the 2000 MSAs from the counties.
Parameters
----------
99mfips.txt: Delineation of the 2000 Metropolitan Statistical Areas
Returns
-------
crosswalk_msa_county.csv
msa.shp
"""
#
# Parse the ... | Add script to extract the 2000 MSA to county correspondence | Add script to extract the 2000 MSA to county correspondence
| Python | bsd-3-clause | rlouf/patterns-of-segregation | ---
+++
@@ -0,0 +1,76 @@
+"""build_2000_msa.py
+
+Extract a usable crosswalk between 2000 Metropolitan areas and counties.
+Reconstitute a shapefile for the 2000 MSAs from the counties.
+
+Parameters
+----------
+
+99mfips.txt: Delineation of the 2000 Metropolitan Statistical Areas
+
+Returns
+-------
+
+crosswalk_ms... | |
8054c9e06511041c0834f901e2e515e58100e8f7 | bindings/const_generator.py | bindings/const_generator.py | import sys, re
INCL_DIR = '../include'
include = [
('/arm.h', 'ARM_'),
('/arm64.h', 'ARM64_'),
('/x86.h', 'X86_'),
('/mips.h', 'MIPS_'),
]
template = {
'java': {
'header': "// AUTOGENRATED FILE, DO NOT EDIT\npackage capstone;\n\npublic class %sconst {\n",
'footer': "}",
... | Add a script to generate constant for binding | Add a script to generate constant for binding
| Python | bsd-3-clause | dynm/capstone,07151129/capstone,nplanel/capstone,nplanel/capstone,bughoho/capstone,krytarowski/capstone,angelabier1/capstone,nplanel/capstone,07151129/capstone,bigendiansmalls/capstone,bowlofstew/capstone,pranith/capstone,code4bones/capstone,sigma-random/capstone,sephiroth99/capstone,NeilBryant/capstone,fvrmatteo/capst... | ---
+++
@@ -0,0 +1,73 @@
+import sys, re
+
+INCL_DIR = '../include'
+
+include = [
+ ('/arm.h', 'ARM_'),
+ ('/arm64.h', 'ARM64_'),
+ ('/x86.h', 'X86_'),
+ ('/mips.h', 'MIPS_'),
+]
+
+template = {
+ 'java': {
+ 'header': "// AUTOGENRATED FILE, DO NOT EDIT\npackage capstone;\n\npublic class %s... | |
0eac761535f959a07acb0e611b415e2cbccd9a97 | tests/sentry/web/frontend/test_organization_settings.py | tests/sentry/web/frontend/test_organization_settings.py | from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.models import Organization
from sentry.testutils import TestCase
class OrganizationSettingsTest(TestCase):
def test_renders_with_context(self):
organization = self.create_organization(name='foo', owner=self.u... | Add test for organization settings | Add test for organization settings
| Python | bsd-3-clause | songyi199111/sentry,JackDanger/sentry,mvaled/sentry,jokey2k/sentry,felixbuenemann/sentry,drcapulet/sentry,Kryz/sentry,fotinakis/sentry,kevinastone/sentry,gencer/sentry,looker/sentry,kevinlondon/sentry,boneyao/sentry,mvaled/sentry,jean/sentry,llonchj/sentry,BuildingLink/sentry,gencer/sentry,korealerts1/sentry,vperron/se... | ---
+++
@@ -0,0 +1,43 @@
+from __future__ import absolute_import
+
+from django.core.urlresolvers import reverse
+
+from sentry.models import Organization
+from sentry.testutils import TestCase
+
+
+class OrganizationSettingsTest(TestCase):
+ def test_renders_with_context(self):
+ organization = self.create... | |
e29962ede32106984b41454b7cbfbf0217bef7fe | tools/rebuild_all.py | tools/rebuild_all.py | import os
import shutil
import subprocess
import sys
from contextlib import contextmanager
@contextmanager
def ignore_no_file():
try:
yield
except FileNotFoundError:
pass
os.chdir(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
with ignore_no_file():
print('Removing @Pythi... | Add a script to simplify building releases | Add a script to simplify building releases
| Python | mit | overfl0/Pythia,overfl0/Pythia,overfl0/Pythia,overfl0/Pythia | ---
+++
@@ -0,0 +1,39 @@
+import os
+import shutil
+import subprocess
+import sys
+from contextlib import contextmanager
+
+
+@contextmanager
+def ignore_no_file():
+ try:
+ yield
+ except FileNotFoundError:
+ pass
+
+
+os.chdir(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
+
+with... | |
1621e19c5bf6deacc54a017115c47175a6e52765 | tests/test_api.py | tests/test_api.py | """Tests the isort API module"""
import pytest
from isort import api, exceptions
def test_sort_file_invalid_syntax(tmpdir) -> None:
"""Test to ensure file encoding is respected"""
tmp_file = tmpdir.join(f"test_bad_syntax.py")
tmp_file.write_text("""print('mismathing quotes")""", "utf8")
with pytest.w... | Add initial testing module for api.py | Add initial testing module for api.py
| Python | mit | PyCQA/isort,PyCQA/isort | ---
+++
@@ -0,0 +1,12 @@
+"""Tests the isort API module"""
+import pytest
+
+from isort import api, exceptions
+
+
+def test_sort_file_invalid_syntax(tmpdir) -> None:
+ """Test to ensure file encoding is respected"""
+ tmp_file = tmpdir.join(f"test_bad_syntax.py")
+ tmp_file.write_text("""print('mismathing q... | |
51ab60836c58c7d0d10c637482919a9acbc31efe | scripts/create_database.py | scripts/create_database.py | #!/usr/bin/env python
"""Create the initial database structure.
Existing tables will be ignored, and those not existing will be created.
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import click
from byceps.database import db
from byceps.util.system import get_con... | Add script to create initial database structure | Add script to create initial database structure
| Python | bsd-3-clause | homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps | ---
+++
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+"""Create the initial database structure.
+
+Existing tables will be ignored, and those not existing will be created.
+
+:Copyright: 2006-2018 Jochen Kupperschmidt
+:License: Modified BSD, see LICENSE for details.
+"""
+
+import click
+
+from byceps.database import d... | |
7855f7ca4f7ea96bf8bf85a5d3fb49a666ddc6cc | src/python/QueryParuetFile.py | src/python/QueryParuetFile.py | # Finds the names of people who like pandas from a parquet file
# consisting of name & favouriteAnimal.
# For input you can use the result of MakeParquetFile
from pyspark import SparkContext
from pyspark.sql import SQLContext
import json
import sys
if __name__ == "__main__":
if len(sys.argv) != 4:
print "E... | Add a python parquet file query example | Add a python parquet file query example
| Python | mit | zaxliu/learning-spark,bhagatsingh/learning-spark,bhagatsingh/learning-spark,XiaoqingWang/learning-spark,kpraveen420/learning-spark,holdenk/learning-spark-examples,zaxliu/learning-spark,diogoaurelio/learning-spark,ellis429/learning-spark-examples,huixiang/learning-spark,concerned3rdparty/learning-spark,zaxliu/learning-s... | ---
+++
@@ -0,0 +1,23 @@
+# Finds the names of people who like pandas from a parquet file
+# consisting of name & favouriteAnimal.
+# For input you can use the result of MakeParquetFile
+from pyspark import SparkContext
+from pyspark.sql import SQLContext
+import json
+import sys
+
+if __name__ == "__main__":
+ if... | |
65eaffabe9927d17847a6a8ce9f39e92e130ab6b | Challenge2.py | Challenge2.py | #Program to find the n largest lines in a file
import operator
import sys
#Read the file from terminal
test_cases = open(sys_argv[1],'r')
#Remove white spaces and empty lines and make a list for all the test in test_cases
tests = [test_cases.strip() for test in test_cases if not test == '\n']
#The first element in t... | Read file and print n largest lines | Read file and print n largest lines
| Python | mit | mailpraveens/Python-Experiments | ---
+++
@@ -0,0 +1,24 @@
+#Program to find the n largest lines in a file
+import operator
+import sys
+
+#Read the file from terminal
+test_cases = open(sys_argv[1],'r')
+
+#Remove white spaces and empty lines and make a list for all the test in test_cases
+tests = [test_cases.strip() for test in test_cases if not te... | |
09eea0de71ac2f2c4f9cee040a14874638dcb097 | bin/neighbourhoods_categories.py | bin/neighbourhoods_categories.py | """neighbourhoods_categories.py
Find the tracts where each category is over-represented or all cities in the
dataset.
"""
import csv
import marble as mb
#
# Import a list of MSA
#
msa = {}
with open('data/names/msa.csv', 'r') as source:
reader = csv.reader(source, delimiter='\t')
reader.next()
for rows i... | Add script to find areal units where each category is represented (and test marble) | Add script to find areal units where each category is represented (and test marble)
| Python | bsd-3-clause | rlouf/patterns-of-segregation | ---
+++
@@ -0,0 +1,45 @@
+"""neighbourhoods_categories.py
+
+Find the tracts where each category is over-represented or all cities in the
+dataset.
+"""
+import csv
+import marble as mb
+
+
+#
+# Import a list of MSA
+#
+msa = {}
+with open('data/names/msa.csv', 'r') as source:
+ reader = csv.reader(source, delimi... | |
3777358287dd4f2ec485d7d53c29d83bf6f56974 | migrations/versions/0368_move_orgs_to_nhs_branding_.py | migrations/versions/0368_move_orgs_to_nhs_branding_.py | """
Revision ID: 0368_move_orgs_to_nhs_branding
Revises: 0367_add_reach
Create Date: 2022-04-12 18:22:12.069016
"""
from alembic import op
revision = '0368_move_orgs_to_nhs_branding'
down_revision = '0367_add_reach'
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.execute("""... | Move existing nhs orgs without branding onto nhs branding | Move existing nhs orgs without branding onto nhs branding
This is done to make self-service branding easier to implement,
and also because NHS branding makes much more sense for services
in those orgs than GOV.UK branding.
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,32 @@
+"""
+
+Revision ID: 0368_move_orgs_to_nhs_branding
+Revises: 0367_add_reach
+Create Date: 2022-04-12 18:22:12.069016
+
+"""
+from alembic import op
+
+revision = '0368_move_orgs_to_nhs_branding'
+down_revision = '0367_add_reach'
+
+
+def upgrade():
+ # ### commands auto generated by Alemb... | |
87e3e6b4930b73563027cb0e125ddd9b9c787d6d | api_tests/requests/views/test_request_action_list.py | api_tests/requests/views/test_request_action_list.py | import pytest
from api.base.settings.defaults import API_BASE
from api_tests.requests.mixins import PreprintRequestTestMixin
@pytest.mark.django_db
class TestPreprintRequestActionList(PreprintRequestTestMixin):
def url(self, request):
return '/{}requests/{}/actions/'.format(API_BASE, request._id)
def... | Add action list permissions tests | Add action list permissions tests
| Python | apache-2.0 | erinspace/osf.io,caseyrollins/osf.io,pattisdr/osf.io,erinspace/osf.io,aaxelb/osf.io,CenterForOpenScience/osf.io,HalcyonChimera/osf.io,CenterForOpenScience/osf.io,baylee-d/osf.io,HalcyonChimera/osf.io,felliott/osf.io,Johnetordoff/osf.io,pattisdr/osf.io,brianjgeiger/osf.io,brianjgeiger/osf.io,baylee-d/osf.io,Johnetordoff... | ---
+++
@@ -0,0 +1,26 @@
+import pytest
+
+from api.base.settings.defaults import API_BASE
+from api_tests.requests.mixins import PreprintRequestTestMixin
+
+@pytest.mark.django_db
+class TestPreprintRequestActionList(PreprintRequestTestMixin):
+ def url(self, request):
+ return '/{}requests/{}/actions/'.fo... | |
8aa9ea4d0c19a0ec5eb0312bc29a0fa00439c335 | tests/formatter/test_xmler.py | tests/formatter/test_xmler.py | import unittest, argparse
from echolalia.formatter.xmler import Formatter
class XmlerTestCase(unittest.TestCase):
def setUp(self):
self.parser = argparse.ArgumentParser()
self.data = [{'char': chr(i), 'order': i - 96} for i in xrange(97, 100)]
self.formatter = Formatter()
def test_add_args(self):
... | Add tests for formatter xml | Add tests for formatter xml
| Python | mit | eiri/echolalia-prototype | ---
+++
@@ -0,0 +1,31 @@
+import unittest, argparse
+from echolalia.formatter.xmler import Formatter
+
+class XmlerTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.parser = argparse.ArgumentParser()
+ self.data = [{'char': chr(i), 'order': i - 96} for i in xrange(97, 100)]
+ self.formatter = Formatt... | |
96d556edf9c736f6c7e9deb70753762230933bc0 | kargtom/twodim/LongestChain/longestChain_001.py | kargtom/twodim/LongestChain/longestChain_001.py | def longestChain(words):
if words == []:
return 0
lendict = {}
lenlist = []
# build the dictory where
# the key is the length of a word,
# and the value is the set of words with the length
for word in words:
l = len(word)
if len(word) in lendict:
lendict[... | Create the bottom-up version of longestPath | Create the bottom-up version of longestPath | Python | mit | Chasego/codi,cc13ny/algo,cc13ny/Allin,Chasego/cod,Chasego/codirit,Chasego/cod,cc13ny/algo,Chasego/cod,Chasego/codi,Chasego/codirit,cc13ny/Allin,Chasego/cod,Chasego/cod,cc13ny/Allin,cc13ny/algo,Chasego/codi,Chasego/codi,cc13ny/Allin,cc13ny/algo,Chasego/codirit,Chasego/codirit,Chasego/codi,cc13ny/algo,cc13ny/Allin,Chaseg... | ---
+++
@@ -0,0 +1,38 @@
+def longestChain(words):
+ if words == []:
+ return 0
+ lendict = {}
+ lenlist = []
+
+ # build the dictory where
+ # the key is the length of a word,
+ # and the value is the set of words with the length
+ for word in words:
+ l = len(word)
+ if len... | |
f3c4cb70d1f9fab3b7cb497faa2cbe2350e2f116 | axelrod/tests/unit/test_deterministic_cache.py | axelrod/tests/unit/test_deterministic_cache.py | import unittest
class TestDeterministicCache(unittest.TestCase):
def test_init(self):
pass
def test_setitem(self):
pass
def test_save(self):
pass
def test_load(self):
pass
| Add stubs for deterministic cache tests | Add stubs for deterministic cache tests
| Python | mit | marcharper/Axelrod,ranjinidas/Axelrod,marcharper/Axelrod,ranjinidas/Axelrod | ---
+++
@@ -0,0 +1,16 @@
+import unittest
+
+
+class TestDeterministicCache(unittest.TestCase):
+
+ def test_init(self):
+ pass
+
+ def test_setitem(self):
+ pass
+
+ def test_save(self):
+ pass
+
+ def test_load(self):
+ pass | |
cb2c7126e1682c38a4efc92a1b89c04498d1926f | clsimplex.py | clsimplex.py | import pyopencl as cl
import numpy
import sys
import datetime
class NoiseGenerator(object):
def __init__(self, block_dim=None):
self.ctx = cl.create_some_context()
self.queue = cl.CommandQueue(self.ctx)
if block_dim: self.block_dim = block_dim
else: self.block_dim = 256, 256, 256
... | Add python host code using pyopencl | Add python host code using pyopencl
| Python | mit | jakogut/clsimplex,jakogut/clsimplex | ---
+++
@@ -0,0 +1,57 @@
+import pyopencl as cl
+import numpy
+import sys
+import datetime
+
+class NoiseGenerator(object):
+ def __init__(self, block_dim=None):
+ self.ctx = cl.create_some_context()
+ self.queue = cl.CommandQueue(self.ctx)
+
+ if block_dim: self.block_dim = block_dim
+ ... | |
16b6a285e933313625da0b3c71455a3506081d0b | qthread.py | qthread.py | import sys
from queue import Queue
from PyQt4.QtCore import *
from PyQt4.QtGui import *
# The new Stream Object which replaces the default stream associated with sys.stdout
# This object just puts data in a queue!
class WriteStream(object):
def __init__(self,queue):
self.queue = queue
def write(self, ... | Copy QThread code from stackoverflow | Copy QThread code from stackoverflow
| Python | bsd-3-clause | torebutlin/cued_datalogger | ---
+++
@@ -0,0 +1,80 @@
+import sys
+from queue import Queue
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+# The new Stream Object which replaces the default stream associated with sys.stdout
+# This object just puts data in a queue!
+class WriteStream(object):
+ def __init__(self,queue):
+ sel... | |
15c799f29652d85fd6957ac0166ffe8590680f33 | froide/account/migrations/0027_auto_20210412_1518.py | froide/account/migrations/0027_auto_20210412_1518.py | # Generated by Django 3.1.8 on 2021-04-12 13:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('account', '0026_auto_20201221_1953'),
]
operations = [
migrations.AddField(
model_name='application',
name='algorith... | Add migration for oauth application | Add migration for oauth application | Python | mit | fin/froide,fin/froide,fin/froide,fin/froide | ---
+++
@@ -0,0 +1,23 @@
+# Generated by Django 3.1.8 on 2021-04-12 13:18
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('account', '0026_auto_20201221_1953'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name=... | |
173aba72cad0c6c3602b2ae4e1b8bd4e5773bd3b | pyservice/context.py | pyservice/context.py | """
RequestContext stores state relevant to the current request, as well as
keeping track of the plugin execution order and providing a simple method
`advance` for calling the next plugin in the chain.
"""
import collections
class Container(collections.defaultdict):
DEFAULT_FACTORY = lambda: None
def __init_... | Add building blocks Container, Context | Add building blocks Container, Context
These will be used for request/response dicts, as well as
containers for plugins to pass functions and values to the
operation function or other plugins.
| Python | mit | numberoverzero/pyservice | ---
+++
@@ -0,0 +1,28 @@
+"""
+RequestContext stores state relevant to the current request, as well as
+keeping track of the plugin execution order and providing a simple method
+`advance` for calling the next plugin in the chain.
+"""
+import collections
+
+
+class Container(collections.defaultdict):
+ DEFAULT_FA... | |
b98fe743844973b2b03dd128fc906cfd4cfa9728 | solutions/uri/1036/1036.py | solutions/uri/1036/1036.py | import math
a, b, c = map(float, input().split())
delta = math.pow(b, 2) - 4 * a * c
if delta >= 0 and a != 0:
print(f'R1 = {((b * -1) + math.sqrt(delta)) / (2 * a):.5f}')
print(f'R2 = {((b * -1) - math.sqrt(delta)) / (2 * a):.5f}')
else:
print('Impossivel calcular')
| Solve Bhaskara's Formula in python | Solve Bhaskara's Formula in python
| Python | mit | deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playgr... | ---
+++
@@ -0,0 +1,11 @@
+import math
+
+a, b, c = map(float, input().split())
+
+delta = math.pow(b, 2) - 4 * a * c
+
+if delta >= 0 and a != 0:
+ print(f'R1 = {((b * -1) + math.sqrt(delta)) / (2 * a):.5f}')
+ print(f'R2 = {((b * -1) - math.sqrt(delta)) / (2 * a):.5f}')
+else:
+ print('Impossivel calcular') | |
dba4c700d0fbc68e853718d27471b4dd7ed21253 | scripts/set_product_info.py | scripts/set_product_info.py | #!/usr/bin/python
#
# Copyright (c) SAS Institute, Inc.
#
"""
Script to set product info on a group.
"""
import sys
import epdb
sys.excepthook = epdb.excepthook()
import json
from conary import trove
from conary import conarycfg
from conary import conaryclient
from conary.conaryclient import cmdline
def setProduct... | Add metadata example code APPENG-3048 | Add metadata example code APPENG-3048
| Python | apache-2.0 | sassoftware/mirrorball,sassoftware/mirrorball | ---
+++
@@ -0,0 +1,66 @@
+#!/usr/bin/python
+#
+# Copyright (c) SAS Institute, Inc.
+#
+
+"""
+Script to set product info on a group.
+"""
+
+import sys
+import epdb
+sys.excepthook = epdb.excepthook()
+
+import json
+
+from conary import trove
+from conary import conarycfg
+from conary import conaryclient
+from cona... | |
1c856409149ce1523dbe080717465e1985f778f7 | scripts/find-skeletons-with-no-treenodes.py | scripts/find-skeletons-with-no-treenodes.py | #!/usr/bin/python
# This script checks your database for some common
# inconsistencies or errors that may have arisen from
# past bugs.
# You may need to install psycopg2, e.g. with:
# sudo apt-get install python-psycopg2
# Requires the file .catmaid-db to be present in your
# home directory, with the following fo... | Add a script to find "empty" skeletons | Add a script to find "empty" skeletons
| Python | agpl-3.0 | htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID,fzadow/CATMAID,htem/CATMAID,htem/CATMAID | ---
+++
@@ -0,0 +1,55 @@
+#!/usr/bin/python
+
+# This script checks your database for some common
+# inconsistencies or errors that may have arisen from
+# past bugs.
+
+# You may need to install psycopg2, e.g. with:
+# sudo apt-get install python-psycopg2
+
+# Requires the file .catmaid-db to be present in your
+#... | |
6276e1ad6e74874cdc2ab8e84608d02edbf6b587 | unify/framework/jasyscript.py | unify/framework/jasyscript.py | # Unify project builder
# Copyright 2012 Sebastian Fastner, Mainz, Germany
import webbrowser
@task("Open help in browser")
def help():
# Clearing cache
webbrowser.open("http://unify-training.com/")
| Add initial unify bould script | Add initial unify bould script
| Python | mit | unify/unify,unify/unify,unify/unify,unify/unify,unify/unify,unify/unify | ---
+++
@@ -0,0 +1,9 @@
+# Unify project builder
+# Copyright 2012 Sebastian Fastner, Mainz, Germany
+
+import webbrowser
+
+@task("Open help in browser")
+def help():
+ # Clearing cache
+ webbrowser.open("http://unify-training.com/") | |
be1430571bb043bc397e73873a61908d40a2bda1 | scratchpad/nano-i2c-test.py | scratchpad/nano-i2c-test.py | #!/usr/bin/env python3
import smbus
import time
# for RPI version 1, use “bus = smbus.SMBus(0)”
bus = smbus.SMBus(1)
# This is the address we setup in the Arduino Program
address = 0x04
cmd_read_analog = 1
while True:
number = bus.read_word_data(address, cmd_read_analog)
print("analog value =", "{0:4X}".f... | Read value from nano via i2c | Read value from nano via i2c
| Python | mit | gizmo-cda/g2x,gizmo-cda/g2x,gizmo-cda/g2x,thelonious/g2x,gizmo-cda/g2x,thelonious/g2x | ---
+++
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+
+import smbus
+import time
+
+# for RPI version 1, use “bus = smbus.SMBus(0)”
+bus = smbus.SMBus(1)
+
+# This is the address we setup in the Arduino Program
+address = 0x04
+cmd_read_analog = 1
+
+
+while True:
+ number = bus.read_word_data(address, cmd_read_analo... | |
89f4f16e3ec8b6018c9ef487ae4059271e1829df | tests/functional/test_new_resolver.py | tests/functional/test_new_resolver.py | import json
from tests.lib import create_basic_wheel_for_package
def assert_installed(script, **kwargs):
ret = script.pip('list', '--format=json')
installed = set(
(val['name'], val['version'])
for val in json.loads(ret.stdout)
)
assert set(kwargs.items()) <= installed
def te... | Add some functional tests for the new resolver | Add some functional tests for the new resolver
| Python | mit | pfmoore/pip,pypa/pip,sbidoul/pip,pypa/pip,pfmoore/pip,pradyunsg/pip,sbidoul/pip,pradyunsg/pip | ---
+++
@@ -0,0 +1,81 @@
+import json
+from tests.lib import create_basic_wheel_for_package
+
+
+def assert_installed(script, **kwargs):
+ ret = script.pip('list', '--format=json')
+ installed = set(
+ (val['name'], val['version'])
+ for val in json.loads(ret.stdout)
+ )
+ assert set(kwargs.... | |
5c45586ed1c90c72620738420d37a444647fe186 | code/supervise_acronym_gene_mentions.py | code/supervise_acronym_gene_mentions.py | #! /usr/bin/env pyton3
import fileinput
import json
# Process the input
with fileinput.input() as input_files:
for line in input_files:
mention = json.loads(line)
mention.is_correct = False
print(json.dumps(mention))
| Add script to supervise acronyms | Add script to supervise acronyms
| Python | apache-2.0 | HazyResearch/dd-genomics,HazyResearch/dd-genomics,amwenger/dd-genomics,rionda/dd-genomics,rionda/dd-genomics,HazyResearch/dd-genomics,HazyResearch/dd-genomics,HazyResearch/dd-genomics,amwenger/dd-genomics,amwenger/dd-genomics | ---
+++
@@ -0,0 +1,12 @@
+#! /usr/bin/env pyton3
+
+import fileinput
+import json
+
+# Process the input
+with fileinput.input() as input_files:
+ for line in input_files:
+ mention = json.loads(line)
+ mention.is_correct = False
+ print(json.dumps(mention))
+ | |
fef62c34be24ac2027d89ffc0c3926b89ad7625d | tools/data/change_window_file_nums.py | tools/data/change_window_file_nums.py | #!/usr/bin/env python
import argparse
import scipy.io as sio
import os
import os.path as osp
import numpy as np
from vdetlib.vdet.dataset import index_det_to_vdet
if __name__ == '__main__':
parser = argparse.ArgumentParser('Change window file numbers.')
parser.add_argument('window_file')
parser.add_argumen... | Add script to change starting index in window file. | Add script to change starting index in window file.
| Python | mit | myfavouritekk/TPN | ---
+++
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+import argparse
+import scipy.io as sio
+import os
+import os.path as osp
+import numpy as np
+from vdetlib.vdet.dataset import index_det_to_vdet
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser('Change window file numbers.')
+ parser.add_argument... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.