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 |
|---|---|---|---|---|---|---|---|---|---|---|
886dae7cbf433f2b0d65016164db62883cae0925 | tests/unit/spec_tests.py | tests/unit/spec_tests.py | # -*- coding: utf8 -*-
"""
Tests for pika.spec
"""
import unittest
from pika import spec
class BasicPropertiesTests(unittest.TestCase):
def test_equality(self):
a = spec.BasicProperties(content_type='text/plain')
self.assertEqual(a, a)
self.assertNotEqual(a, None)
b = spec.Basic... | Add explicit BasicProperties equality test | Add explicit BasicProperties equality test
In Python equality of objects, if not defined otherwise, is based on the
objects hash.
By extending amqp_objects with an __eq__ method we can now test equality
of two BasicProperties objects and can expect True if their internal
__dict__'s are equal.
| Python | bsd-3-clause | pika/pika | ---
+++
@@ -0,0 +1,26 @@
+# -*- coding: utf8 -*-
+"""
+Tests for pika.spec
+
+"""
+import unittest
+
+from pika import spec
+
+
+class BasicPropertiesTests(unittest.TestCase):
+ def test_equality(self):
+ a = spec.BasicProperties(content_type='text/plain')
+ self.assertEqual(a, a)
+ self.asser... | |
27b74424e6a9193636bc533dbf758d40b5dc0d3e | lazyblacksmith/utils/crestutils.py | lazyblacksmith/utils/crestutils.py | # -*- encoding: utf-8 -*-
import pycrest
import config
def get_crest():
""" Return a CREST object initialized """
crest = pycrest.EVE()
crest()
return crest
def get_by_attr(objlist, attr, val):
''' Searches list of dicts for a dict with dict[attr] == val '''
matches = [getattr(obj, attr) == ... | Add utils functions for the crest api | Add utils functions for the crest api
| Python | bsd-3-clause | Kyria/LazyBlacksmith,Kyria/LazyBlacksmith,Kyria/LazyBlacksmith,Kyria/LazyBlacksmith | ---
+++
@@ -0,0 +1,25 @@
+# -*- encoding: utf-8 -*-
+import pycrest
+import config
+
+
+def get_crest():
+ """ Return a CREST object initialized """
+ crest = pycrest.EVE()
+ crest()
+ return crest
+
+
+def get_by_attr(objlist, attr, val):
+ ''' Searches list of dicts for a dict with dict[attr] == val ... | |
b0cf9904023c5ee20c5f29b3e88899420405550b | examples/puttiff.py | examples/puttiff.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 ... | Migrate this version to new workstation. | Migrate this version to new workstation.
| Python | apache-2.0 | neurodata/ndstore,openconnectome/open-connectome,openconnectome/open-connectome,openconnectome/open-connectome,neurodata/ndstore,openconnectome/open-connectome,neurodata/ndstore,openconnectome/open-connectome,openconnectome/open-connectome,neurodata/ndstore | ---
+++
@@ -0,0 +1,55 @@
+# 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/LI... | |
01d35d13aaedea0ef87ae1d78ee1368e5e0f407c | corehq/apps/locations/management/commands/set_location_id.py | corehq/apps/locations/management/commands/set_location_id.py | from django.core.management.base import BaseCommand
from dimagi.utils.couch.database import iter_docs
from corehq.apps.users.models import CouchUser, CommCareUser
class Command(BaseCommand):
help = ''
def handle(self, *args, **options):
self.stdout.write("Population location_id field...\n")
... | Move migration into main branch | Move migration into main branch
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq | ---
+++
@@ -0,0 +1,31 @@
+from django.core.management.base import BaseCommand
+from dimagi.utils.couch.database import iter_docs
+from corehq.apps.users.models import CouchUser, CommCareUser
+
+
+class Command(BaseCommand):
+ help = ''
+
+ def handle(self, *args, **options):
+ self.stdout.write("Populati... | |
1b28330beda151cc2660143926a9bf9178b6af2b | openfisca_france_data/tests/test_fake_survey_simulation.py | openfisca_france_data/tests/test_fake_survey_simulation.py | # -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify... | Move fake survey simulation to a separate file | Move fake survey simulation to a separate file
| Python | agpl-3.0 | adrienpacifico/openfisca-france-data,openfisca/openfisca-france-data,LouisePaulDelvaux/openfisca-france-data,openfisca/openfisca-france-data,LouisePaulDelvaux/openfisca-france-data,benjello/openfisca-france-data,MalkIPP/openfisca-france-data,benjello/openfisca-france-data,openfisca/openfisca-france-data,adrienpacifico/... | ---
+++
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+
+
+# OpenFisca -- A versatile microsimulation software
+# By: OpenFisca Team <contact@openfisca.fr>
+#
+# Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team
+# https://github.com/openfisca
+#
+# This file is part of OpenFisca.
+#
+# OpenFisca is free software... | |
420a1a76c7c9460768e6d41e7508f36d3215fbfb | kolibri/core/exams/migrations/0003_auto_20190426_1015.py | kolibri/core/exams/migrations/0003_auto_20190426_1015.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-26 17:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('exams', '0002_update_exam_data_model'),
]
operations = [
migrations.AlterF... | Add migration for new Exam data_model_version default | Add migration for new Exam data_model_version default
| Python | mit | learningequality/kolibri,indirectlylit/kolibri,lyw07/kolibri,learningequality/kolibri,mrpau/kolibri,lyw07/kolibri,lyw07/kolibri,learningequality/kolibri,indirectlylit/kolibri,mrpau/kolibri,indirectlylit/kolibri,mrpau/kolibri,learningequality/kolibri,mrpau/kolibri,lyw07/kolibri,indirectlylit/kolibri | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.20 on 2019-04-26 17:15
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('exams', '0002_update_exam_data_model'),
+ ]
+
+ ... | |
f84284b14d21669f9a9aae5d482f1e626f42df03 | src/clincoded/upgrade/pathogenicity.py | src/clincoded/upgrade/pathogenicity.py | from contentbase.upgrader import upgrade_step
@upgrade_step('pathogenicity', '1', '2')
def pathogenicity_1_2(value, system):
# https://github.com/ClinGen/clincoded/issues/1507
# Add affiliation property and update schema version
return
| Add affiliation property and update schema version | Add affiliation property and update schema version
| Python | mit | ClinGen/clincoded,ClinGen/clincoded,ClinGen/clincoded,ClinGen/clincoded,ClinGen/clincoded | ---
+++
@@ -0,0 +1,8 @@
+from contentbase.upgrader import upgrade_step
+
+
+@upgrade_step('pathogenicity', '1', '2')
+def pathogenicity_1_2(value, system):
+ # https://github.com/ClinGen/clincoded/issues/1507
+ # Add affiliation property and update schema version
+ return | |
2355ebd04ed8b5c14c42966b71415ae638c50551 | app/models/datastore_adapter.py | app/models/datastore_adapter.py | from flask_user import DBAdapter
class DataStoreAdapter(DBAdapter):
""" An Wrapper to be use by Flask User to interact with
the database in this case, the DataStore """
def __init__(self, db, objMOdel):
super().__init__(db, objMOdel)
def get_object(self, ObjectClass, pk):
""" Ret... | Create a datastore adapter to use by flask user | Create a datastore adapter to use by flask user
| Python | mit | oldani/nanodegree-blog,oldani/nanodegree-blog,oldani/nanodegree-blog | ---
+++
@@ -0,0 +1,67 @@
+from flask_user import DBAdapter
+
+
+class DataStoreAdapter(DBAdapter):
+ """ An Wrapper to be use by Flask User to interact with
+ the database in this case, the DataStore """
+
+ def __init__(self, db, objMOdel):
+ super().__init__(db, objMOdel)
+
+ def get_object(s... | |
6d46c1beb8f5f916e3fb2e08d086e5b4167383be | ftfy/test_unicode.py | ftfy/test_unicode.py | # -*- coding: utf-8 -*-
from ftfy import fix_bad_encoding, WINDOWS_1252_GREMLINS
import unicodedata
# Most single-character strings which have been misencoded should be restored.
def test_all_bmp_characters():
for index in xrange(0xa0, 0xfffd):
char = unichr(index)
# Exclude code points that are no... | Move this test from metanl. | Move this test from metanl.
| Python | mit | rspeer/python-ftfy | ---
+++
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+from ftfy import fix_bad_encoding, WINDOWS_1252_GREMLINS
+import unicodedata
+
+# Most single-character strings which have been misencoded should be restored.
+def test_all_bmp_characters():
+ for index in xrange(0xa0, 0xfffd):
+ char = unichr(index)
+ ... | |
d07dfe5392a0ea9bde4bff174c4dc4e4fdba33be | tests/rest/client/v2_alpha/__init__.py | tests/rest/client/v2_alpha/__init__.py | # -*- coding: utf-8 -*-
# Copyright 2015 OpenMarket Ltd
#
# 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 la... | Create (empty) v2_alpha REST tests directory | Create (empty) v2_alpha REST tests directory
| Python | apache-2.0 | rzr/synapse,TribeMedia/synapse,matrix-org/synapse,illicitonion/synapse,howethomas/synapse,howethomas/synapse,TribeMedia/synapse,howethomas/synapse,illicitonion/synapse,illicitonion/synapse,matrix-org/synapse,iot-factory/synapse,rzr/synapse,matrix-org/synapse,rzr/synapse,TribeMedia/synapse,iot-factory/synapse,matrix-org... | ---
+++
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+# Copyright 2015 OpenMarket Ltd
+#
+# 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
+... | |
955856171a4d689d1db68eb46c17d6b3fe92c2fc | examples/halt_asset.py | examples/halt_asset.py | from grapheneapi.grapheneclient import GrapheneClient
import json
symbol = "TOKEN"
class Config():
wallet_host = "localhost"
wallet_port = 8092
wallet_user = ""
wallet_password = ""
## no edits below this line #####################
perm = {}
perm["charge_market_fee... | Halt an asset, prevent people from transfers and trading | [example] Halt an asset, prevent people from transfers and trading
| Python | mit | xeroc/python-graphenelib | ---
+++
@@ -0,0 +1,46 @@
+from grapheneapi.grapheneclient import GrapheneClient
+import json
+
+symbol = "TOKEN"
+
+class Config():
+ wallet_host = "localhost"
+ wallet_port = 8092
+ wallet_user = ""
+ wallet_password = ""
+
+## no edits below this line ################... | |
801c8c7463811af88f232e23d8496180d7b413ad | python/extract_duplicate_sets.py | python/extract_duplicate_sets.py | """
Copyright 2016 Ronald J. Nowling
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, softw... | Add script for extracting duplicate sets from SOLR dump | Add script for extracting duplicate sets from SOLR dump
| Python | apache-2.0 | rnowling/article-deduplication,rnowling/article-deduplication | ---
+++
@@ -0,0 +1,90 @@
+"""
+Copyright 2016 Ronald J. Nowling
+
+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 applicab... | |
7a3e7365569c18c971db9698cd7cdd1a82756463 | table.py | table.py | import csv
class Table():
'''A Table is an object which represents a 2-dimensional CSV file. Both rows
and columns can be accessed via their key as in a dictionary. This means that
keys cannot appear as both a row and column label.'''
def __init__(self, filename):
self._internal_table = self.l... | Create Table object for representing phonetic inventory | Create Table object for representing phonetic inventory
| Python | mit | kdelwat/LangEvolve,kdelwat/LangEvolve,kdelwat/LangEvolve | ---
+++
@@ -0,0 +1,52 @@
+import csv
+
+class Table():
+ '''A Table is an object which represents a 2-dimensional CSV file. Both rows
+ and columns can be accessed via their key as in a dictionary. This means that
+ keys cannot appear as both a row and column label.'''
+
+ def __init__(self, filename):
+ ... | |
cdaeb420e0cd817ebf570d5eda46362f4c61c691 | tests/chainer_tests/functions_tests/utils_tests/test_forget.py | tests/chainer_tests/functions_tests/utils_tests/test_forget.py | import unittest
import numpy
import chainer
from chainer import functions
from chainer import gradient_check
from chainer import testing
class TestForget(unittest.TestCase):
def setUp(self):
self.x = numpy.random.uniform(-1, 1, (3, 4)).astype(numpy.float32)
self.y = numpy.random.uniform(-1, 1, ... | Add test for forget function | Add test for forget function
| Python | mit | wkentaro/chainer,keisuke-umezawa/chainer,okuta/chainer,wkentaro/chainer,hvy/chainer,niboshi/chainer,hvy/chainer,niboshi/chainer,hvy/chainer,niboshi/chainer,kiyukuta/chainer,okuta/chainer,okuta/chainer,cupy/cupy,keisuke-umezawa/chainer,ronekko/chainer,ktnyt/chainer,jnishi/chainer,hvy/chainer,tkerola/chainer,keisuke-umez... | ---
+++
@@ -0,0 +1,56 @@
+import unittest
+
+import numpy
+
+import chainer
+from chainer import functions
+from chainer import gradient_check
+from chainer import testing
+
+
+class TestForget(unittest.TestCase):
+
+ def setUp(self):
+ self.x = numpy.random.uniform(-1, 1, (3, 4)).astype(numpy.float32)
+ ... | |
d01ad432080446d94028f3d1de76692354871a77 | bin/change-version.py | bin/change-version.py | #!/usr/bin/env python
import glob
import shutil
import sys
def change(filename, oldversion, newversion):
tempfile = filename + '.tmp'
fi = open(filename, 'r')
fo = open(tempfile, 'w')
for line in fi:
nl = line.replace(oldversion, newversion)
fo.write(nl)
fo.close()
fi.close()
... | Add script to change versions of all components | Add script to change versions of all components
| Python | apache-2.0 | zafarella/PredictionIO,dszeto/incubator-predictionio,net-shell/PredictionIO,alex9311/PredictionIO,arudenko/PredictionIO,thiagoveras/PredictionIO,himanshudhami/PredictionIO,jasonchaffee/PredictionIO,akaash-nigam/PredictionIO,wangmiao1981/PredictionIO,jlegendary/PredictionIO,tuxdna/PredictionIO,thiagoveras/PredictionIO,m... | ---
+++
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+import glob
+import shutil
+import sys
+
+def change(filename, oldversion, newversion):
+ tempfile = filename + '.tmp'
+ fi = open(filename, 'r')
+ fo = open(tempfile, 'w')
+ for line in fi:
+ nl = line.replace(oldversion, newversion)
+ fo.w... | |
f3b57ef7713086a86f51a8ed98d52367b02c8959 | project_fish/whats_fresh/test_models.py | project_fish/whats_fresh/test_models.py | from django.test import TestCase
from django.conf import settings
from whats_fresh.models import *
from django.contrib.gis.db import models
import os
import time
import sys
import datetime
class ImageTestCase(TestCase):
def setUp(self):
# Set MEDIA ROOT to sample data for this test
TEST_ROOT = os... | Make preparation model tests actually work | Make preparation model tests actually work
| Python | apache-2.0 | iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,osu-cass/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,iCHAIT/whats-fresh-api | ---
+++
@@ -0,0 +1,79 @@
+from django.test import TestCase
+from django.conf import settings
+
+from whats_fresh.models import *
+from django.contrib.gis.db import models
+
+import os
+import time
+import sys
+import datetime
+
+class ImageTestCase(TestCase):
+ def setUp(self):
+ # Set MEDIA ROOT to sample ... | |
7106568947142b472498def88d8cef59dd296934 | ureport/contacts/migrations/0006_auto_20151007_1358.py | ureport/contacts/migrations/0006_auto_20151007_1358.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.core.cache import cache
def clear_contacts(apps, schema_editor):
Contact = apps.get_model('contacts', 'Contact')
# delete fetched contacts
Contact.objects.all().delete()
# clear redi... | Add migrations to clear current contacts objects, and their redis keys | Add migrations to clear current contacts objects, and their redis keys
| Python | agpl-3.0 | xkmato/ureport,auduaboki/ureport,Ilhasoft/ureport,eHealthAfrica/ureport,Ilhasoft/ureport,xkmato/ureport,eHealthAfrica/ureport,rapidpro/ureport,rapidpro/ureport,auduaboki/ureport,Ilhasoft/ureport,eHealthAfrica/ureport,rapidpro/ureport,auduaboki/ureport,Ilhasoft/ureport,rapidpro/ureport,xkmato/ureport | ---
+++
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+from django.core.cache import cache
+
+
+def clear_contacts(apps, schema_editor):
+ Contact = apps.get_model('contacts', 'Contact')
+
+ # delete fetched contacts
+ Contact.o... | |
a2565d27a8fcfd4c1bfa414a39d7f90b99f5ece3 | top40.py | top40.py | import click
import requests
url = 'http://ben-major.co.uk/labs/top40/api/singles/'
response = requests.get(url)
print response.json()
| Print basic json chart on command line | Print basic json chart on command line
| Python | mit | kevgathuku/top40,andela-kndungu/top40 | ---
+++
@@ -0,0 +1,8 @@
+import click
+import requests
+
+url = 'http://ben-major.co.uk/labs/top40/api/singles/'
+
+response = requests.get(url)
+
+print response.json() | |
1ba3c03e6e68596dd969980af2c07d1d90ba83f6 | examples/scf/16-h2_scan.py | examples/scf/16-h2_scan.py | #!/usr/bin/env python
'''
Scan H2 molecule dissociation curve.
'''
import numpy
from pyscf import scf
from pyscf import gto
ehf = []
dm = None
for b in numpy.arange(0.7, 4.01, 0.1):
mol = gto.M(atom=[["H", 0., 0., 0.],
["H", 0., 0., b ]], basis='ccpvdz', verbose=0)
mf = scf.RHF(mol)
... | Add example of HF PES scanning | Add example of HF PES scanning
| Python | apache-2.0 | sunqm/pyscf,sunqm/pyscf,gkc1000/pyscf,gkc1000/pyscf,gkc1000/pyscf,gkc1000/pyscf,sunqm/pyscf,gkc1000/pyscf,sunqm/pyscf | ---
+++
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+'''
+Scan H2 molecule dissociation curve.
+'''
+
+import numpy
+from pyscf import scf
+from pyscf import gto
+
+ehf = []
+dm = None
+
+for b in numpy.arange(0.7, 4.01, 0.1):
+ mol = gto.M(atom=[["H", 0., 0., 0.],
+ ["H", 0., 0., b ]], basis='c... | |
442e141ba3695e32d19cb6a263c63a4d6c31de90 | examples/todo_app/setup.py | examples/todo_app/setup.py | from distutils.core import setup
import sys
import os
import shutil
def tree(src):
return [(root, map(lambda f: os.path.join(root, f), filter(lambda f: os.path.splitext(f)[1] != ".map", files))) for (root, dirs, files) in os.walk(os.path.normpath(src))]
APP = ['index.py']
DATA_FILES = tree('assets')
OPTIONS_OS... | Add py2app script to todos_app | Add py2app script to todos_app
| Python | bsd-3-clause | shivaprsdv/pywebview,shivaprsdv/pywebview,r0x0r/pywebview,shivaprsdv/pywebview,r0x0r/pywebview,shivaprsdv/pywebview,r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview | ---
+++
@@ -0,0 +1,32 @@
+from distutils.core import setup
+
+import sys
+import os
+import shutil
+
+
+def tree(src):
+ return [(root, map(lambda f: os.path.join(root, f), filter(lambda f: os.path.splitext(f)[1] != ".map", files))) for (root, dirs, files) in os.walk(os.path.normpath(src))]
+
+
+APP = ['index.py']... | |
d3bbdce883b2a3880970f1923367ca8498b34a8d | tempest/tests/services/compute/test_floating_ip_pools_client.py | tempest/tests/services/compute/test_floating_ip_pools_client.py | # Copyright 2015 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | Add unit test for floating_ip_pools_client | Add unit test for floating_ip_pools_client
This patch adds unit test for floating_ip_pools_client.
Change-Id: Iba1dc372867f70742b73b5f4502bb7e94e4dc312
| Python | apache-2.0 | bigswitch/tempest,izadorozhna/tempest,xbezdick/tempest,openstack/tempest,Tesora/tesora-tempest,LIS/lis-tempest,sebrandon1/tempest,vedujoshi/tempest,zsoltdudas/lis-tempest,cisco-openstack/tempest,masayukig/tempest,flyingfish007/tempest,tonyli71/tempest,masayukig/tempest,xbezdick/tempest,Tesora/tesora-tempest,openstack/t... | ---
+++
@@ -0,0 +1,47 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/L... | |
dd7d3f77b691922c44c489844b1f278d58a790f4 | xorry.py | xorry.py | #!/usr/bin/python
import optparse
import sys
def xorobfuscator(plaintext, keyid):
'''XOR Operation on a plaintext using keyid'''
encoded = ""
for i in range(0, len(plaintext), len(keyid)):
start = i
end = i + len(keyid)
for x, y in zip(plaintext[start:end], keyid):
... | Refactor code - PEP8 Style. | Refactor code - PEP8 Style.
| Python | cc0-1.0 | JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology | ---
+++
@@ -0,0 +1,78 @@
+#!/usr/bin/python
+
+import optparse
+import sys
+
+
+def xorobfuscator(plaintext, keyid):
+ '''XOR Operation on a plaintext using keyid'''
+
+ encoded = ""
+
+ for i in range(0, len(plaintext), len(keyid)):
+ start = i
+ end = i + len(keyid)
+
+ for x, y in zip... | |
f367df8baa9deba3c361620f87c98eb88c2e234c | alerts/ldap_password_spray.py | alerts/ldap_password_spray.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2014 Mozilla Corporation
from lib.alerttask import AlertTask
from mozdef_util.qu... | Add prototype LDAP password spray alert | Add prototype LDAP password spray alert
| Python | mpl-2.0 | mpurzynski/MozDef,mozilla/MozDef,mpurzynski/MozDef,mpurzynski/MozDef,mozilla/MozDef,jeffbryner/MozDef,jeffbryner/MozDef,jeffbryner/MozDef,mpurzynski/MozDef,mozilla/MozDef,jeffbryner/MozDef,mozilla/MozDef | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+# Copyright (c) 2014 Mozilla Corporation
+
+
+from lib.alerttask ... | |
58a3c9e6cbddba664c1c89c6039d9cc72fac526f | grader/grader/test/test_new.py | grader/grader/test/test_new.py | import os
import pytest
import yaml
def test_new_without_repo(parse_and_run):
"""Test vanilla assignment initialization
"""
path = parse_and_run(["init", "cpl"])
parse_and_run(["new", "assignment1"])
a_path = os.path.join(path, "assignments", "assignment1")
gs_path = os.path.join(a_path, "gra... | Add some tests for new assignments | Add some tests for new assignments
| Python | mit | redkyn/grader,grade-it/grader,redkyn/grader | ---
+++
@@ -0,0 +1,67 @@
+import os
+import pytest
+import yaml
+
+
+def test_new_without_repo(parse_and_run):
+ """Test vanilla assignment initialization
+ """
+ path = parse_and_run(["init", "cpl"])
+ parse_and_run(["new", "assignment1"])
+
+ a_path = os.path.join(path, "assignments", "assignment1")
... | |
509d4f1e6d22a373cfa20944ef388f7155443d4a | monroe/api.py | monroe/api.py | from flask import Flask
import monroe
api = Flask(__name__)
@api.route('/')
def aping():
return 'v0.1'
@api.route('/start')
def start_monroe():
monroe.main()
| ADD Flask based RESTful API | ADD Flask based RESTful API
| Python | apache-2.0 | ecelis/monroe | ---
+++
@@ -0,0 +1,13 @@
+from flask import Flask
+import monroe
+
+api = Flask(__name__)
+
+@api.route('/')
+def aping():
+ return 'v0.1'
+
+
+@api.route('/start')
+def start_monroe():
+ monroe.main() | |
ce43d38cccd44464b1c777e99af540133033a3fc | pygraphc/clustering/MaxCliquesPercolationSA.py | pygraphc/clustering/MaxCliquesPercolationSA.py | from MaxCliquesPercolation import MaxCliquesPercolationWeighted
class MaxCliquesPercolationSA(MaxCliquesPercolationWeighted):
def __init__(self, graph, edges_weight, nodes_id, k, threshold):
super(MaxCliquesPercolationSA, self).__init__(graph, edges_weight, nodes_id, k, threshold)
def get_maxcliques_... | Add file for maximal cliques percolation using sa | Add file for maximal cliques percolation using sa
| Python | mit | studiawan/pygraphc | ---
+++
@@ -0,0 +1,9 @@
+from MaxCliquesPercolation import MaxCliquesPercolationWeighted
+
+
+class MaxCliquesPercolationSA(MaxCliquesPercolationWeighted):
+ def __init__(self, graph, edges_weight, nodes_id, k, threshold):
+ super(MaxCliquesPercolationSA, self).__init__(graph, edges_weight, nodes_id, k, thr... | |
83f1dab96d5e9f82137dbe4142ed415a3e3e3f48 | biobox_cli/biobox_file.py | biobox_cli/biobox_file.py | import os
import yaml
def generate(args):
output = {"version" : "0.9.0", "arguments" : args}
return yaml.safe_dump(output, default_flow_style = False)
def get_biobox_file_contents(dir_):
with open(os.path.join(dir_, 'biobox.yaml'), 'r') as f:
return yaml.load(f.read())
def fastq_arguments(args):
... | import os
import yaml
def generate(args):
output = {"version" : "0.9.0", "arguments" : args}
return yaml.safe_dump(output, default_flow_style = False)
def get_biobox_file_contents(dir_):
with open(os.path.join(dir_, 'biobox.yaml'), 'r') as f:
return yaml.load(f.read())
def fastq_arguments(args):
... | Remove no longer needed biobox_directory function | Remove no longer needed biobox_directory function
| Python | mit | michaelbarton/command-line-interface,michaelbarton/command-line-interface,bioboxes/command-line-interface,bioboxes/command-line-interface | ---
+++
@@ -24,10 +24,3 @@
def entry(id_, value, type_):
return {"id" : id_, "value" : value, "type" : type_}
-
-def create_biobox_directory(content):
- import tempfile as tmp
- dir_ = tmp.mkdtemp()
- with open(os.path.join(dir_, "biobox.yaml"), "w") as f:
- f.write(content)
- return dir_ |
d5beeaa933b08f80ce2b0d8b56e022cd5b23397c | mysql_test.py | mysql_test.py | #!/usr/bin/env python
# blogware - a python blogging system
# Copyright (C) 2016-2017 izrik
#
# This file is a part of blogware.
#
# Blogware is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either vers... | Include a simple mysql connection diagnostic tool. | Include a simple mysql connection diagnostic tool.
| Python | agpl-3.0 | izrik/wikiware,izrik/blogware,izrik/wikiware,izrik/blogware,izrik/blogware,izrik/wikiware | ---
+++
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+
+# blogware - a python blogging system
+# Copyright (C) 2016-2017 izrik
+#
+# This file is a part of blogware.
+#
+# Blogware is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the ... | |
8486d506ac619b2bb6caceb435c20047d7398603 | stacked_generalization/example/joblibed_classification.py | stacked_generalization/example/joblibed_classification.py | import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from sklearn import datasets
from sklearn.cross_validation import StratifiedKFold
from sklearn.ensemble import RandomForestClassifier
from sklearn.utils.validation import check_random_state
from stacked_g... | Add example of joblibed classifier | Add example of joblibed classifier
| Python | apache-2.0 | fukatani/stacked_generalization | ---
+++
@@ -0,0 +1,41 @@
+import os
+import sys
+sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
+
+from sklearn import datasets
+from sklearn.cross_validation import StratifiedKFold
+from sklearn.ensemble import RandomForestClassifier
+from sklearn.utils.validation impor... | |
bdbbddf86a6137c1edf96ab8505611a4fc2ab30e | sunbrella.py | sunbrella.py | import urllib2
import json
import yaml
from os.path import expanduser, isfile
import datetime
from dateutil import parser
from pytz import reference
CACHE_PATH = expanduser('~/.sunbrella_cache.json')
def get_cache(api_key, latitude, longitude):
if isfile(CACHE_PATH):
try:
cache = json.load(op... | Make working cached API call | Make working cached API call
Signed-off-by: Adam Obeng <64b2b6d12bfe4baae7dad3d018f8cbf6b0e7a044@binaryeagle.com>
| Python | mit | adamobeng/sunbrella | ---
+++
@@ -0,0 +1,49 @@
+import urllib2
+import json
+import yaml
+from os.path import expanduser, isfile
+import datetime
+from dateutil import parser
+from pytz import reference
+
+CACHE_PATH = expanduser('~/.sunbrella_cache.json')
+
+
+def get_cache(api_key, latitude, longitude):
+ if isfile(CACHE_PATH):
+ ... | |
82da46fd16b89839036195ce862167f98c880f1f | github2fedmsg/custom_openid.py | github2fedmsg/custom_openid.py | import velruse.api
import velruse.providers.openid as vr
from pyramid.security import NO_PERMISSION_REQUIRED
def add_openid_login(config, realm, identity_provider):
provider = SingleOpenIDConsumer(
'openid', 'openid',
realm=realm,
identity_provider=identity_provider,
storage=None,... | Add forgotten custom openid plugin to velruse. | Add forgotten custom openid plugin to velruse.
| Python | agpl-3.0 | pombredanne/github2fedmsg,fedora-infra/github2fedmsg,pombredanne/github2fedmsg,fedora-infra/github2fedmsg | ---
+++
@@ -0,0 +1,38 @@
+import velruse.api
+import velruse.providers.openid as vr
+
+from pyramid.security import NO_PERMISSION_REQUIRED
+
+
+def add_openid_login(config, realm, identity_provider):
+ provider = SingleOpenIDConsumer(
+ 'openid', 'openid',
+ realm=realm,
+ identity_provider=id... | |
d5b155f51eb4b204e5812e8339579e9d91066103 | configstore/tests/test_docker_secret.py | configstore/tests/test_docker_secret.py | import os
from unittest import TestCase
try:
from unittest import mock
except ImportError:
import mock
from configstore.backends.docker_secret import DockerSecretBackend
from .test_data import DEFAULT_KEY, DEFAULT_VALUE, CUSTOM_PATH
class TestDockerSecretBackend(TestCase):
def test_get_secret(self):
... | Add unittests for docker_secret backend | Add unittests for docker_secret backend
| Python | mit | caravancoop/configstore | ---
+++
@@ -0,0 +1,32 @@
+import os
+from unittest import TestCase
+try:
+ from unittest import mock
+except ImportError:
+ import mock
+
+from configstore.backends.docker_secret import DockerSecretBackend
+from .test_data import DEFAULT_KEY, DEFAULT_VALUE, CUSTOM_PATH
+
+
+class TestDockerSecretBackend(TestCas... | |
bcb30dbad2f86781ddd1ee9f38b16c4d68ac57da | maxwellbloch/ob_solve.py | maxwellbloch/ob_solve.py | # -*- coding: utf-8 -*-
import os
import sys
import json
import qutip as qu
from maxwellbloch import ob_atom
# Main
class OBSolve(object):
"""docstring for OBSolve"""
def __init__(self, ob_atom={}, t_min=0.0, t_max=1.0, t_steps=100,
method='mesolve', opts={}):
self.build_ob... | Add OBSolve class and from_json methods | Add OBSolve class and from_json methods
| Python | mit | tommyogden/maxwellbloch,tommyogden/maxwellbloch | ---
+++
@@ -0,0 +1,86 @@
+# -*- coding: utf-8 -*-
+
+import os
+import sys
+
+import json
+
+import qutip as qu
+
+from maxwellbloch import ob_atom
+
+# Main
+
+class OBSolve(object):
+ """docstring for OBSolve"""
+
+ def __init__(self, ob_atom={}, t_min=0.0, t_max=1.0, t_steps=100,
+ method='m... | |
1e3853c231facac6e590b66de8d9c2cc37e7f540 | download_and_unzip_files.py | download_and_unzip_files.py | import os
import datetime
current_year = datetime.datetime.now().year
years_with_data = range(2011, current_year + 1)
remote_path = "https://ssl.netfile.com/pub2/excel/COAKBrowsable/"
for year in years_with_data:
print "Downloading " + str(year) + " data..."
filename_for_year = "efile_newest_COAK_" + str(year) + ... | Add script to download and unzip files for all years | Add script to download and unzip files for all years
| Python | bsd-3-clause | daguar/netfile-etl,daguar/netfile-etl | ---
+++
@@ -0,0 +1,13 @@
+import os
+import datetime
+
+current_year = datetime.datetime.now().year
+years_with_data = range(2011, current_year + 1)
+remote_path = "https://ssl.netfile.com/pub2/excel/COAKBrowsable/"
+
+for year in years_with_data:
+ print "Downloading " + str(year) + " data..."
+ filename_for_year ... | |
97074e1bf452f12821058c035aca15c692092074 | src/circus/module/set_metrics.py | src/circus/module/set_metrics.py | #!/usr/bin/env python
__cmdname__ = 'set_metrics'
__cmdopts__ = ''
import re
import sys
import log
import util
class Module(object):
def __init__(self, api, account):
self.api = api
self.account = account
def command(self, opts, pattern, *metrics_to_enable):
"""Set the active metrics... | Set metrics command (regex based metric enabling) | Set metrics command (regex based metric enabling)
| Python | isc | omniti-labs/circus,omniti-labs/circus | ---
+++
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+__cmdname__ = 'set_metrics'
+__cmdopts__ = ''
+
+import re
+import sys
+
+import log
+import util
+
+class Module(object):
+ def __init__(self, api, account):
+ self.api = api
+ self.account = account
+
+ def command(self, opts, pattern, *metrics_to... | |
5535fa4d9c5b70347bf16931887e3c5141698e31 | languages/python/linux-info.py | languages/python/linux-info.py | #!/usr/bin/env python
#
# Print information about the current computer.
#
import os
import re
from socket import gethostname
from platform import linux_distribution
def gethost():
'''Extract host name'''
try:
return gethostname()
except:
return "NA"
def processor():
'''Extract first pr... | Add python script to print Linux information. | Add python script to print Linux information.
| Python | apache-2.0 | sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-opensource,sergev/vak-o... | ---
+++
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+#
+# Print information about the current computer.
+#
+import os
+import re
+from socket import gethostname
+from platform import linux_distribution
+
+def gethost():
+ '''Extract host name'''
+ try:
+ return gethostname()
+ except:
+ return "NA"... | |
05dd74f3721cb1997f45e3931d50329473b62df3 | web/users/migrations/0003_alter_user.py | web/users/migrations/0003_alter_user.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.core.validators
import django.contrib.auth.models
class Migration(migrations.Migration):
dependencies = [
('users', '0002_auto_20150814_0805'),
]
operations = [
migrati... | Add a migration for users.User model | Add a migration for users.User model
| Python | agpl-3.0 | matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo | ---
+++
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.core.validators
+import django.contrib.auth.models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('users', '0002_auto_20150814_0805'),
+ ... | |
d216f2c2f6f6a8e94dbe0c79dafe03f1a4f9a886 | tests/test_rest_track_history.py | tests/test_rest_track_history.py | """
.. Copyright 2017 EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applic... | Test for ensuring that the history functions are able to return | Test for ensuring that the history functions are able to return
| Python | apache-2.0 | Multiscale-Genomics/mg-rest-dm | ---
+++
@@ -0,0 +1,63 @@
+"""
+.. Copyright 2017 EMBL-European Bioinformatics Institute
+
+ 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/LICENS... | |
e095cbdc5f6c74b54a518131692d5ab993c4fc9c | repo_to_submodule.py | repo_to_submodule.py | #!/usr/bin/python
import os
import sys
import xml.etree.ElementTree as ET
from termcolor import colored
def repo_to_submodule(superproject):
# FIXME remove this line
os.system("rm " + superproject + " -rf")
os.mkdir(superproject)
MANIFEST_XML = "manifest.xml"
# 1. Create a manifest from repo
... | Create a git superproject and add submodules | Create a git superproject and add submodules
It does the following in order:
1. Generate a manifest.xml for repo
2. Create a git superproject
3. Add repo project as git submodules
| Python | apache-2.0 | clarkli86/repo_to_submodule | ---
+++
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+
+import os
+import sys
+import xml.etree.ElementTree as ET
+from termcolor import colored
+
+def repo_to_submodule(superproject):
+ # FIXME remove this line
+ os.system("rm " + superproject + " -rf")
+ os.mkdir(superproject)
+
+ MANIFEST_XML = "manifest.xml"
+... | |
077699976adb8a6a25f5cb8c4ff3cbb1ae95440c | tools/database_dump_converter.py | tools/database_dump_converter.py | from sys import argv
from xml.dom.minidom import parse
from base64 import b64decode
def Escape(text):
text = text.replace('\\', '\\\\')
for sample, replace in {'\'': '\\\'', '"': '\\"', '\n': '\\n', '\r': '\\r', '\x00': '\\0', '\x1a': '\\Z'}.iteritems():
text = text.replace(sample, replace);
return text
if len(... | Add database dump convert tool. | Add database dump convert tool.
| Python | mit | thewizardplusplus/wizard-diary,thewizardplusplus/wizard-diary,thewizardplusplus/wizard-diary,thewizardplusplus/wizard-diary,thewizardplusplus/wizard-diary | ---
+++
@@ -0,0 +1,37 @@
+from sys import argv
+from xml.dom.minidom import parse
+from base64 import b64decode
+
+def Escape(text):
+ text = text.replace('\\', '\\\\')
+ for sample, replace in {'\'': '\\\'', '"': '\\"', '\n': '\\n', '\r': '\\r', '\x00': '\\0', '\x1a': '\\Z'}.iteritems():
+ text = text.replace(sampl... | |
87818a138408752217d6a90041db5273116db228 | python/opencv/opencv_2/image_precessing/hough_circle_transform.py | python/opencv/opencv_2/image_precessing/hough_circle_transform.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
"""
OpenCV - Hough Circle Transform: find circles in an image.
Required: opencv library (Debian: aptitude install python-opencv)
See: https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_imgpr... | Add a snippet (Python OpenCV). | Add a snippet (Python OpenCV).
| Python | mit | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | ---
+++
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
+
+"""
+OpenCV - Hough Circle Transform: find circles in an image.
+
+Required: opencv library (Debian: aptitude install python-opencv)
+
+See: https://opencv-python-tutroals.readthedo... | |
042844d918d34a16f18ea9ab2c09694e81c25623 | bluebottle/categories/migrations/0008_authenticated-permissions.py | bluebottle/categories/migrations/0008_authenticated-permissions.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2019-02-22 08:58
from __future__ import unicode_literals
from django.db import migrations
from bluebottle.utils.utils import update_group_permissions
def add_group_permissions(apps, schema_editor):
group_perms = {
'Authenticated': {
'pe... | Add read categories permission to authenticated users | Add read categories permission to authenticated users
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.8 on 2019-02-22 08:58
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+from bluebottle.utils.utils import update_group_permissions
+
+
+def add_group_permissions(apps, schema_editor):
+ group_perms = {
+ ... | |
388ca425168572cbcbaa3638d78e5f9933380fb7 | tests/test_config.py | tests/test_config.py | import logging
import socket
import pytest
from uvicorn import protocols
from uvicorn.config import Config
from uvicorn.middleware.debug import DebugMiddleware
from uvicorn.middleware.wsgi import WSGIMiddleware
async def asgi_app():
pass
def wsgi_app():
pass
def test_debug_app():
config = Config(app... | Add tests for most of Config class | Add tests for most of Config class
| Python | bsd-3-clause | encode/uvicorn,encode/uvicorn | ---
+++
@@ -0,0 +1,67 @@
+import logging
+import socket
+
+import pytest
+
+from uvicorn import protocols
+from uvicorn.config import Config
+from uvicorn.middleware.debug import DebugMiddleware
+from uvicorn.middleware.wsgi import WSGIMiddleware
+
+
+async def asgi_app():
+ pass
+
+
+def wsgi_app():
+ pass
+
+... | |
41f6dd8259a8e56a157930e809426f5e0e8113eb | tests/test_config.py | tests/test_config.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import os
import binascii
import shutil
import tempfile
from timebook.config import parse_config
def test_parse_config(capsys):
seed = binascii.hexlify(os.urandom(4))
fname = os.path.join(tempfile.gettempdir(), 'test-%s' % seed, 'test_timebook_con... | Add config file parse test | Add config file parse test
Increases coverage to 73% on Python 2.x and 74% on Python 3.x.
| Python | mit | imiric/timebook | ---
+++
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+from __future__ import print_function
+
+import os
+import binascii
+import shutil
+import tempfile
+
+from timebook.config import parse_config
+
+def test_parse_config(capsys):
+ seed = binascii.hexlify(os.urandom(4))
+ fname = os.path.join(tempfile.gettempdir... | |
de44f28e266a9e8a730030029d47d6a262e7cf3c | utils/h5tobigfile.py | utils/h5tobigfile.py | import h5py
import bigfile
import logging
import argparse
ap = argparse.ArgumentParser('h5tobigfile')
ap.add_argument("hdf5")
ap.add_argument("bigfile")
ap.add_argument("--verify", action='store_true', default=False)
ap.add_argument("--include", action="append")
ap.add_argument("--exclude", action="append")
def trave... | Add a tool to convert hdf5 to bigfile. | Add a tool to convert hdf5 to bigfile.
This shall work for a lot of cases but not all. It's incomplete.
| Python | bsd-2-clause | rainwoodman/bigfile,rainwoodman/bigfile,rainwoodman/bigfile | ---
+++
@@ -0,0 +1,60 @@
+import h5py
+import bigfile
+import logging
+import argparse
+
+ap = argparse.ArgumentParser('h5tobigfile')
+ap.add_argument("hdf5")
+ap.add_argument("bigfile")
+ap.add_argument("--verify", action='store_true', default=False)
+ap.add_argument("--include", action="append")
+ap.add_argument("-... | |
6b4489e9e0362b75433f8a75fcfd041bab4e8a08 | problem_3/solution2.py | problem_3/solution2.py | roots = []; product = 1; x = 2; n = 600851475143; y = n;
while product != n:
while (y % x == 0):
roots.append(x)
y /= x
product *= roots[-1]
x += 1
print max(roots)
| Add a second python implementation for problem 3 | Add a second python implementation for problem 3
| Python | mit | mdsrosa/project_euler,mdsrosa/project_euler,mdsrosa/project_euler,mdsrosa/project_euler,mdsrosa/project_euler,mdsrosa/project_euler,mdsrosa/project_euler,mdsrosa/project_euler | ---
+++
@@ -0,0 +1,8 @@
+roots = []; product = 1; x = 2; n = 600851475143; y = n;
+while product != n:
+ while (y % x == 0):
+ roots.append(x)
+ y /= x
+ product *= roots[-1]
+ x += 1
+print max(roots) | |
a4f9f724e1a9b292abd9df46293d14759b864dc4 | Send_Stack.py | Send_Stack.py | __author__ = 'ayost'
import os
import re
import sys
from time import sleep
import boto.cloudformation
import boto.cloudformation.stack
SCRIPT_LOCATION = os.path.abspath(os.path.dirname(sys.argv[0]))
def send(stacks):
regions = []
for r in boto.cloudformation.regions():
regions.append(r.name.upper())... | Build stacks, wait for completion, show status of each | Build stacks, wait for completion, show status of each
| Python | apache-2.0 | careerbuilder/CloudSeed,careerbuilder/CloudSeed,careerbuilder/CloudSeed,careerbuilder/CloudSeed | ---
+++
@@ -0,0 +1,74 @@
+__author__ = 'ayost'
+
+import os
+import re
+import sys
+from time import sleep
+import boto.cloudformation
+import boto.cloudformation.stack
+
+SCRIPT_LOCATION = os.path.abspath(os.path.dirname(sys.argv[0]))
+
+
+def send(stacks):
+ regions = []
+ for r in boto.cloudformation.regions... | |
258bf91456db1f9c5c2b90bfdaf32a4af13de7df | states/common/bootstrap/bootstrap.dir/modules/utils/salt_output.py | states/common/bootstrap/bootstrap.dir/modules/utils/salt_output.py | #!/usr/bin/env python
#
import sys
import yaml
import logging
###############################################################################
def load_yaml_data(file_path):
"""
Load YAML formated data from file_path.
"""
with open(file_path, 'r') as yaml_file:
loaded_data = yaml.load(yaml_... | Add initial version of Salt output analyzer script | Add initial version of Salt output analyzer script
| Python | apache-2.0 | uvsmtid/common-salt-states,uvsmtid/common-salt-states,uvsmtid/common-salt-states,uvsmtid/common-salt-states | ---
+++
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+#
+
+import sys
+import yaml
+import logging
+
+###############################################################################
+
+def load_yaml_data(file_path):
+
+ """
+ Load YAML formated data from file_path.
+ """
+
+ with open(file_path, 'r') as yaml... | |
91f90d5edd89a10cb652af001d6c076fdcf557d8 | chapter3/collatzSequence.py | chapter3/collatzSequence.py | # Collatz Sequence practice project from Automate Boring Stuff - Chapter 3
# https://automatetheboringstuff.com/chapter3/
def collatz(number):
if number%2==0:
print(number//2)
return number//2
else:
output = 3*number+1
print(output)
return output
print("Enter a number")
try:
inputNumber = int(input())
r... | Add solution to chapter-3 collatzsequence | Add solution to chapter-3 collatzsequence
| Python | mit | anirudhvarma12/learning-python | ---
+++
@@ -0,0 +1,23 @@
+# Collatz Sequence practice project from Automate Boring Stuff - Chapter 3
+# https://automatetheboringstuff.com/chapter3/
+
+def collatz(number):
+ if number%2==0:
+ print(number//2)
+ return number//2
+ else:
+ output = 3*number+1
+ print(output)
+ return output
+
+print("Enter a numb... | |
bb3fa58481d58ac7fe9a55e7fabd2b37ce9df7ac | tests/test_android.py | tests/test_android.py | # MIT licensed
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
import pytest
pytestmark = pytest.mark.asyncio
async def test_android_addon(get_version):
assert await get_version("android-google-play-apk-expansion", {"android_sdk": "extras;google;market_apk_expansion", "repo": "addon"}) == "1.r03"
... | Add tests for Android SDK packages | Add tests for Android SDK packages
| Python | mit | lilydjwg/nvchecker | ---
+++
@@ -0,0 +1,11 @@
+# MIT licensed
+# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
+
+import pytest
+pytestmark = pytest.mark.asyncio
+
+async def test_android_addon(get_version):
+ assert await get_version("android-google-play-apk-expansion", {"android_sdk": "extras;google;market_apk_expans... | |
e084f83aea9c89b5fff0289dedf7bd6cd7434dcf | firecares/firestation/management/commands/update-erf-areas.py | firecares/firestation/management/commands/update-erf-areas.py | import os
import argparse
from django.core.management.base import BaseCommand
from firecares.firestation.models import FireDepartment
from firecares.tasks.update import update_parcel_department_effectivefirefighting_rollup
class Command(BaseCommand):
help = """Updates the Effective Response Force (ERF) areas for t... | Add django command for updating ERF areas | Add django command for updating ERF areas
| Python | mit | FireCARES/firecares,FireCARES/firecares,FireCARES/firecares,FireCARES/firecares,FireCARES/firecares | ---
+++
@@ -0,0 +1,20 @@
+import os
+import argparse
+from django.core.management.base import BaseCommand
+from firecares.firestation.models import FireDepartment
+from firecares.tasks.update import update_parcel_department_effectivefirefighting_rollup
+
+class Command(BaseCommand):
+ help = """Updates the Effecti... | |
1293b101683462225f7c5f150b3c98767d032639 | app/models.py | app/models.py | # models.py
#
# Copyright(c) Exequiel Ceasar Navarrete <esnavarrete1@up.edu.ph>
# Licensed under MIT
# Version 0.0.0
from app import db
from slugify import slugify
class Crop(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), unique=False)
crop_type = db.Column(db.String(80)... | Create crop and region model | Create crop and region model
| Python | mit | ecsnavarretemit/sarai-interactive-maps-backend,ecsnavarretemit/sarai-interactive-maps-backend | ---
+++
@@ -0,0 +1,46 @@
+# models.py
+#
+# Copyright(c) Exequiel Ceasar Navarrete <esnavarrete1@up.edu.ph>
+# Licensed under MIT
+# Version 0.0.0
+
+from app import db
+from slugify import slugify
+
+class Crop(db.Model):
+ id = db.Column(db.Integer, primary_key=True)
+ name = db.Column(db.String(80), unique=False... | |
e6ceac9c547c9fae78d6cac57d62a510fddc9096 | scripts/traces/merge_traces.py | scripts/traces/merge_traces.py | #!/usr/bin/python
# Converts a bunch of processedTrace files from Second Life into a
# single trace file, where all coordinates have been converted
# properly. This assumes that the traces are laid out in a square
# grid, that each server is 256m x 256m.
if __name__ == "__main__":
trace_file_fmt = '4x4/processe... | Add a script to merge a bunch of quake style traces and write some summary statistics. | Add a script to merge a bunch of quake style traces and write some summary statistics.
| Python | bsd-3-clause | sirikata/sirikata,sirikata/sirikata,sirikata/sirikata,sirikata/sirikata,sirikata/sirikata,sirikata/sirikata,sirikata/sirikata,sirikata/sirikata | ---
+++
@@ -0,0 +1,41 @@
+#!/usr/bin/python
+
+# Converts a bunch of processedTrace files from Second Life into a
+# single trace file, where all coordinates have been converted
+# properly. This assumes that the traces are laid out in a square
+# grid, that each server is 256m x 256m.
+
+
+if __name__ == "__main__"... | |
dd30a2c655e1f0fca4be0de8de1775b7ab5c8b85 | handle_quit_player.py | handle_quit_player.py | import pygame
import sys
from pygame.locals import *
from variables import *
from Player import *
from Card import *
from create_board import *
from create_game_options import *
from create_player_info import *
from handle_mouse_event import *
from update_game_dice import *
from handle_game import *
# handles all th... | Handle withdrawal of a player | Handle withdrawal of a player
Added function to handle all the changes after a player quits withdraws
from the game
| Python | mit | idnaninitesh/monopoly_python | ---
+++
@@ -0,0 +1,48 @@
+import pygame
+import sys
+from pygame.locals import *
+
+from variables import *
+from Player import *
+from Card import *
+from create_board import *
+from create_game_options import *
+from create_player_info import *
+from handle_mouse_event import *
+from update_game_dice import *
+from... | |
84d8cc4d41ce6ff18f1f96f21749332e980a86f0 | zipline/examples/buy_and_hold.py | zipline/examples/buy_and_hold.py | #!/usr/bin/env python
#
# Copyright 2015 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | Add simple buy and hold example. | DOC: Add simple buy and hold example.
| Python | apache-2.0 | nborggren/zipline,alphaBenj/zipline,quantopian/zipline,umuzungu/zipline,humdings/zipline,Scapogo/zipline,magne-max/zipline-ja,florentchandelier/zipline,enigmampc/catalyst,umuzungu/zipline,nborggren/zipline,bartosh/zipline,enigmampc/catalyst,bartosh/zipline,grundgruen/zipline,wilsonkichoi/zipline,grundgruen/zipline,alph... | ---
+++
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+#
+# Copyright 2015 Quantopian, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.... | |
8261098405f4279209388f91e6fbc0d48600b129 | scripts/cscap/wx/extract_colin.py | scripts/cscap/wx/extract_colin.py | """ Extract some data for Colin
1951-2010 Annual GDDs by climate district Apr 1 - Oct 31
1951-2010 Frost-free days ...
"""
import psycopg2
import pandas as pd
pgconn = psycopg2.connect(database='coop', host='iemdb', user='nobody')
cursor = pgconn.cursor()
from pyiem.network import Table as NetworkTable
nt = Networ... | Add extraction script as per request | Add extraction script as per request | Python | mit | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | ---
+++
@@ -0,0 +1,44 @@
+""" Extract some data for Colin
+
+1951-2010 Annual GDDs by climate district Apr 1 - Oct 31
+1951-2010 Frost-free days ...
+
+"""
+import psycopg2
+import pandas as pd
+pgconn = psycopg2.connect(database='coop', host='iemdb', user='nobody')
+cursor = pgconn.cursor()
+from pyiem.network imp... | |
356d11b5bce94e356fa39c6709375655cae105b7 | scripts/file_to_string_literal.py | scripts/file_to_string_literal.py | #!/usr/bin/env python
import sys
with open(sys.argv[1], 'w') as outfile:
with open(sys.argv[2], 'r') as infile:
outfile.write('namespace {0} {{\n'.format(sys.argv[3]))
outfile.write('char const* {0} =\n'.format(sys.argv[4]))
outfile.write('"SHADER(\n')
outfile.write(infile.read())
... | Add script for generating headers from glsl | Add script for generating headers from glsl
| Python | bsd-3-clause | mikezackles/gn_build | ---
+++
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+
+import sys
+
+with open(sys.argv[1], 'w') as outfile:
+ with open(sys.argv[2], 'r') as infile:
+ outfile.write('namespace {0} {{\n'.format(sys.argv[3]))
+ outfile.write('char const* {0} =\n'.format(sys.argv[4]))
+ outfile.write('"SHADER(\n')
+... | |
7e3811666e224dc2030f625f04db8a4e55529322 | create.py | create.py | #!/usr/local/bin/python3
from argparse import ArgumentParser
from argparse import ArgumentTypeError
import itertools
import os
import string
from shutil import copyfile
import pathlib
def validateProblemCount(value):
ivalue = int(value)
if ivalue < 1 or ivalue > 25:
raise ArgumentTypeError(str(value) + " is not w... | Add script to generate templates | Add script to generate templates
| Python | mit | szekizoli/GoogleCodeJamPractice,szekizoli/GoogleCodeJamPractice,szekizoli/GoogleCodeJamPractice | ---
+++
@@ -0,0 +1,41 @@
+#!/usr/local/bin/python3
+
+from argparse import ArgumentParser
+from argparse import ArgumentTypeError
+import itertools
+import os
+import string
+from shutil import copyfile
+import pathlib
+
+def validateProblemCount(value):
+ ivalue = int(value)
+ if ivalue < 1 or ivalue > 25:
+ raise ... | |
a7ce715d184e11f7fe6d20bc22cd8b9a4733e04d | tests/test_image_xpress.py | tests/test_image_xpress.py | from microscopium.screens import image_xpress
import collections as coll
def test_ix_semantic_filename():
test_fn = "./Week1_22123/G10_s2_w11C3B9BCC-E48F-4C2F-9D31-8F46D8B5B972.tif"
expected = coll.OrderedDict([('directory', './Week1_22123'),
('prefix', ''),
... | Add tests to image_xpress module | Add tests to image_xpress module
| Python | bsd-3-clause | jni/microscopium,Don86/microscopium,microscopium/microscopium,Don86/microscopium,jni/microscopium,starcalibre/microscopium,microscopium/microscopium | ---
+++
@@ -0,0 +1,16 @@
+from microscopium.screens import image_xpress
+import collections as coll
+
+
+def test_ix_semantic_filename():
+ test_fn = "./Week1_22123/G10_s2_w11C3B9BCC-E48F-4C2F-9D31-8F46D8B5B972.tif"
+ expected = coll.OrderedDict([('directory', './Week1_22123'),
+ ('pr... | |
8760c50de32353664bb5291ac24205186e557de4 | binterpret.py | binterpret.py | import sys
import traceback
import argparse
from PIL import Image
def binterpret(filename, abx, aby):
try:
img = Image.open(filename)
except IOError:
traceback.print_exc(file=sys.stdout)
exit(3)
blockx = img.size[0]/abx
blocky = img.size[1]/aby
print blockx, blocky
if __nam... | Set up command with arguments | Set up command with arguments
| Python | apache-2.0 | flammified/binterpret | ---
+++
@@ -0,0 +1,30 @@
+import sys
+import traceback
+import argparse
+from PIL import Image
+
+def binterpret(filename, abx, aby):
+ try:
+ img = Image.open(filename)
+ except IOError:
+ traceback.print_exc(file=sys.stdout)
+ exit(3)
+ blockx = img.size[0]/abx
+ blocky = img.size[1... | |
9f11190cbd7ac97ab5e57c3af8c23b9884279cfa | lesson5/catch_multiple.py | lesson5/catch_multiple.py | def take_beer(fridge, number=1):
if not isinstance(fridge, dict):
raise TypeError("Invalid fridge")
if "beer" not in fridge:
raise ValueError("No more beer:(")
if number > fridge["beer"]:
raise ValueError("Not enough beer:(")
fridge["beer"] -= number
if __name__ == "__main__... | Add script for demostrating cathicng multiple exceptions | Add script for demostrating cathicng multiple exceptions
| Python | bsd-2-clause | drednout/letspython,drednout/letspython | ---
+++
@@ -0,0 +1,25 @@
+def take_beer(fridge, number=1):
+ if not isinstance(fridge, dict):
+ raise TypeError("Invalid fridge")
+
+ if "beer" not in fridge:
+ raise ValueError("No more beer:(")
+
+ if number > fridge["beer"]:
+ raise ValueError("Not enough beer:(")
+
+ fridge["beer"... | |
40b704b64ca1a4bf6f686710586c0856e9a8cf94 | addons/response-encoding-converter-addon/__init__.py | addons/response-encoding-converter-addon/__init__.py | # -*- coding:utf-8 -*-
from owlmixin import OwlMixin
from modules.models import ResponseAddOnPayload
import logging
logger = logging.getLogger(__name__)
class Config(OwlMixin):
def __init__(self, encoding):
self.encoding: str = encoding
def main(payload: ResponseAddOnPayload, config_dict: dict):
c... | Add change encoding add on | :new: Add change encoding add on
| Python | mit | tadashi-aikawa/gemini | ---
+++
@@ -0,0 +1,22 @@
+# -*- coding:utf-8 -*-
+
+from owlmixin import OwlMixin
+from modules.models import ResponseAddOnPayload
+import logging
+
+logger = logging.getLogger(__name__)
+
+
+class Config(OwlMixin):
+ def __init__(self, encoding):
+ self.encoding: str = encoding
+
+
+def main(payload: Respo... | |
8ee17bf5a070c22700061198a7ecde01adaef3a9 | tests/tests_tags/tests_spoiler.py | tests/tests_tags/tests_spoiler.py | """
SkCode spoiler tag test code.
"""
import unittest
from skcode.etree import TreeNode
from skcode.tags import (SpoilerTagOptions,
DEFAULT_RECOGNIZED_TAGS)
class HorizontalLineTagTestCase(unittest.TestCase):
""" Tests suite for the spoiler tag module. """
def test_tag_and_aliases_... | Add tests suite for spoiler tag. | Add tests suite for spoiler tag.
| Python | agpl-3.0 | TamiaLab/PySkCode | ---
+++
@@ -0,0 +1,46 @@
+"""
+SkCode spoiler tag test code.
+"""
+
+import unittest
+
+from skcode.etree import TreeNode
+from skcode.tags import (SpoilerTagOptions,
+ DEFAULT_RECOGNIZED_TAGS)
+
+
+class HorizontalLineTagTestCase(unittest.TestCase):
+ """ Tests suite for the spoiler tag mo... | |
5a0e28212e186b61138fa725cd2c22f475b245d7 | ch7/atomic.py | ch7/atomic.py | '''
Listing 7.8: Testing atomic operations
'''
import numpy as np
import pyopencl as cl
import utility
kernel_src = '''
__kernel void atomic(__global int* x) {
__local int a, b;
a = 0;
b = 0;
/* Increment without atomic add */
a++;
/* Increment with atomic add */
atomic_inc(&b);
x[0] = a;... | Add example from listing 7.8 | Add example from listing 7.8
| Python | mit | oysstu/pyopencl-in-action | ---
+++
@@ -0,0 +1,60 @@
+'''
+Listing 7.8: Testing atomic operations
+'''
+
+import numpy as np
+import pyopencl as cl
+import utility
+
+kernel_src = '''
+__kernel void atomic(__global int* x) {
+
+ __local int a, b;
+
+ a = 0;
+ b = 0;
+
+ /* Increment without atomic add */
+ a++;
+
+ /* Increment with... | |
811d3e3c13cac36b6dd16e49690fca4a31a74266 | tests/test_cython_funcs.py | tests/test_cython_funcs.py | from unittest import TestCase
import numpy as np
import numpy.testing as npt
from nimble import Events
import nimble.cyfunc.debounce as cy
class TestAsArrayMethod(TestCase):
def setUp(self):
conditional_array = np.array([0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1])
events = Events((conditional_array > 0))
... | Add unit tests for Cython functions that mirror pure Python tests | Add unit tests for Cython functions that mirror pure Python tests
| Python | mit | rwhitt2049/trouve,rwhitt2049/nimble | ---
+++
@@ -0,0 +1,38 @@
+from unittest import TestCase
+import numpy as np
+import numpy.testing as npt
+from nimble import Events
+import nimble.cyfunc.debounce as cy
+
+
+class TestAsArrayMethod(TestCase):
+ def setUp(self):
+ conditional_array = np.array([0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1])
+ event... | |
498637bc947eb0e68b4a153fb5fa859bfa52ff75 | acquisition/devops/deploy_adapter.py | acquisition/devops/deploy_adapter.py | import requests
import json
import argparse
import uuid
import pprint
def main():
parser = argparse.ArgumentParser(
description='Deploy adapter to Tomviz acquisition server ( the server '
'must be running with the --dev option.')
parser.add_argument('-u', '--url', help='the base url to the ser... | Add script to dynamically deploy adapters | Add script to dynamically deploy adapters
| Python | bsd-3-clause | OpenChemistry/tomviz,mathturtle/tomviz,OpenChemistry/tomviz,thewtex/tomviz,cryos/tomviz,thewtex/tomviz,OpenChemistry/tomviz,cjh1/tomviz,cjh1/tomviz,cryos/tomviz,thewtex/tomviz,mathturtle/tomviz,cjh1/tomviz,OpenChemistry/tomviz,mathturtle/tomviz,cryos/tomviz | ---
+++
@@ -0,0 +1,42 @@
+import requests
+import json
+import argparse
+import uuid
+import pprint
+
+
+def main():
+ parser = argparse.ArgumentParser(
+ description='Deploy adapter to Tomviz acquisition server ( the server '
+ 'must be running with the --dev option.')
+ parser.add_argument('-u',... | |
f16eb9e0dea35a2cb49c1e9cb879af1faa1f0c6a | PyGoogleMap.py | PyGoogleMap.py | import dpkt, socket, pygeoip, optparse
def banner():
print "#### Use Python to build a Google Map #####"
print ""
def retKML(ip):
rec = gi.record_by_name(ip)
try:
longitude = rec['longitude']
latitude = rec['latitude']
kml = (
'<Placemark>\n'
'<name>&s</name\n'
'<Point>\n'
'<coordinates>%6f.... | DEBUG and TEST. Plenty of Typos | DEBUG and TEST. Plenty of Typos
| Python | mit | n1cfury/ViolentPython | ---
+++
@@ -0,0 +1,56 @@
+import dpkt, socket, pygeoip, optparse
+
+
+def banner():
+ print "#### Use Python to build a Google Map #####"
+ print ""
+
+def retKML(ip):
+ rec = gi.record_by_name(ip)
+ try:
+ longitude = rec['longitude']
+ latitude = rec['latitude']
+ kml = (
+ '<Placemark>\n'
+ '<name>&s</na... | |
422057651acf510f6c4c5ccb54781a9b85d4a5ad | airflow/migrations/versions/1968acfc09e3_add_is_encrypted_column_to_variable_.py | airflow/migrations/versions/1968acfc09e3_add_is_encrypted_column_to_variable_.py | """add is_encrypted column to variable table
Revision ID: 1968acfc09e3
Revises: bba5a7cfc896
Create Date: 2016-02-02 17:20:55.692295
"""
# revision identifiers, used by Alembic.
revision = '1968acfc09e3'
down_revision = 'bba5a7cfc896'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy a... | Add missing migration needed to support Variable value encryption | Add missing migration needed to support Variable value encryption
| Python | apache-2.0 | caseyching/incubator-airflow,N3da/incubator-airflow,gtoonstra/airflow,owlabs/incubator-airflow,lyft/incubator-airflow,dmitry-r/incubator-airflow,ty707/airflow,modsy/incubator-airflow,sdiazb/airflow,nathanielvarona/airflow,adamhaney/airflow,dgies/incubator-airflow,gtoonstra/airflow,jwi078/incubator-airflow,dhuang/incuba... | ---
+++
@@ -0,0 +1,24 @@
+"""add is_encrypted column to variable table
+
+Revision ID: 1968acfc09e3
+Revises: bba5a7cfc896
+Create Date: 2016-02-02 17:20:55.692295
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '1968acfc09e3'
+down_revision = 'bba5a7cfc896'
+branch_labels = None
+depends_on = None
+
+... | |
594c9d8320b1eaac87b10fe9c93fbb1ce652799e | pydbus/tests/gnome_music.py | pydbus/tests/gnome_music.py | from pydbus import SessionBus
from gi.repository import GObject, GLib
import subprocess
from time import sleep
loop = GObject.MainLoop()
subprocess.Popen("gnome-music")
sleep(5)
print("Waiting for GNOME Music to start...")
b = SessionBus()
m = b.get("org.mpris.MediaPlayer2.GnomeMusic", "/org/mpris/MediaPlayer2")
m.... | Add a trivial GNOME Music test. | Add a trivial GNOME Music test.
| Python | lgpl-2.1 | LEW21/pydbus,LEW21/pydbus | ---
+++
@@ -0,0 +1,50 @@
+from pydbus import SessionBus
+from gi.repository import GObject, GLib
+import subprocess
+from time import sleep
+
+loop = GObject.MainLoop()
+
+subprocess.Popen("gnome-music")
+sleep(5)
+print("Waiting for GNOME Music to start...")
+
+b = SessionBus()
+m = b.get("org.mpris.MediaPlayer2.Gno... | |
a64f3cf9c10d79576cc70d385f9124b7beda040e | nubank.py | nubank.py | import json
import requests
class NuException(BaseException):
pass
class Nubank:
headers = {
'Content-Type': 'application/json',
'X-Correlation-Id': 'WEB-APP.pewW9',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
... | Add Nubank class for handling the requests | Add Nubank class for handling the requests
| Python | mit | andreroggeri/pynubank | ---
+++
@@ -0,0 +1,42 @@
+import json
+import requests
+
+
+class NuException(BaseException):
+ pass
+
+
+class Nubank:
+ headers = {
+ 'Content-Type': 'application/json',
+ 'X-Correlation-Id': 'WEB-APP.pewW9',
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (K... | |
fa23f66fcae37731672f4cf646ad52964b4b206a | table/migrations/0001_initial.py | table/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | Add migration for Receipt model | Add migration for Receipt model
| Python | mit | trimailov/finance,trimailov/finance,trimailov/finance | ---
+++
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+from django.conf import settings
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ ... | |
89f75bb894a6dee2d53708b8f4f5f3302d54a010 | neblinaCore.py | neblinaCore.py | #!/usr/bin/env python
###################################################################################
#
# Copyright (c) 2010-2016 Motsai
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softwa... | Create NeblinaCore to handle sending and receiving packet. | Create NeblinaCore to handle sending and receiving packet.
| Python | mit | Motsai/neblina-python,Motsai/neblina-python | ---
+++
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+###################################################################################
+#
+# Copyright (c) 2010-2016 Motsai
+#
+# The MIT License (MIT)
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associa... | |
1fd87ad0cab5d45602192c83681340d5da27a6db | examples/custom_context.py | examples/custom_context.py | import random
import discord
from discord.ext import commands
class MyContext(commands.Context):
async def tick(self, value):
# reacts to the message with an emoji
# depending on whether value is True or False
# if its True, it'll add a green check mark
# otherwise, it'll add a re... | Add example on subclassing commands.Context | Add example on subclassing commands.Context
| Python | mit | Rapptz/discord.py,Harmon758/discord.py,khazhyk/discord.py,rapptz/discord.py,Harmon758/discord.py | ---
+++
@@ -0,0 +1,51 @@
+import random
+
+import discord
+from discord.ext import commands
+
+
+class MyContext(commands.Context):
+ async def tick(self, value):
+ # reacts to the message with an emoji
+ # depending on whether value is True or False
+ # if its True, it'll add a green check ma... | |
ae9532fe2cf76a8d3f219093f373c05dc2eafc1d | benchexec/tools/abc.py | benchexec/tools/abc.py | # This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import re
import logging
import benchexec.result as result
import benchexec.tools.templat... | Add a tool-info moduel for ABC | Add a tool-info moduel for ABC
| Python | apache-2.0 | sosy-lab/benchexec,dbeyer/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,sosy-lab/benchexec,sosy-lab/benchexec | ---
+++
@@ -0,0 +1,46 @@
+# This file is part of BenchExec, a framework for reliable benchmarking:
+# https://github.com/sosy-lab/benchexec
+#
+# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
+#
+# SPDX-License-Identifier: Apache-2.0
+
+import re
+import logging
+
+import benchexec.result as... | |
3663a732727d2a2198b2fe1c77a3d73abb531d8e | pyfibot/util/twitter_application_auth.py | pyfibot/util/twitter_application_auth.py | import requests
import base64
import sys
if len(sys.argv) < 3:
print "Usage: twitter_application_auth.py <consumer key> <consumer secret>"
sys.exit(1)
consumer_key = sys.argv[1]
consumer_secret = sys.argv[2]
token = consumer_key+":"+consumer_secret
encoded_token = base64.b64encode(token)
payload = {'grant_ty... | Add utility to generate bearer keys for twitter | Add utility to generate bearer keys for twitter
| Python | bsd-3-clause | huqa/pyfibot,aapa/pyfibot,huqa/pyfibot,EArmour/pyfibot,lepinkainen/pyfibot,EArmour/pyfibot,rnyberg/pyfibot,lepinkainen/pyfibot,rnyberg/pyfibot,aapa/pyfibot | ---
+++
@@ -0,0 +1,22 @@
+import requests
+import base64
+import sys
+
+if len(sys.argv) < 3:
+ print "Usage: twitter_application_auth.py <consumer key> <consumer secret>"
+ sys.exit(1)
+
+consumer_key = sys.argv[1]
+consumer_secret = sys.argv[2]
+token = consumer_key+":"+consumer_secret
+encoded_token = base64... | |
75aec1cbc64c667b0528cfc66ed087d7ea84db20 | bin/process_coca_ngrams.py | bin/process_coca_ngrams.py | from data import data, process_common
UNIGRAM_REFERENCE = 'data/g1m_1gram.txt'
SRCS_PATTERN = 'data/corpus/coca/w%s_.txt'
OUTS_PATTERN = 'data/coca_%sgram.txt'
REFERENCE = {}
def load_reference() -> None:
with data.open_project_path(UNIGRAM_REFERENCE, mode='r') as src:
for line in src:
word, score = line... | Add script for processing COCA ngrams. | Add script for processing COCA ngrams.
| Python | mit | PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge | ---
+++
@@ -0,0 +1,50 @@
+from data import data, process_common
+
+UNIGRAM_REFERENCE = 'data/g1m_1gram.txt'
+SRCS_PATTERN = 'data/corpus/coca/w%s_.txt'
+OUTS_PATTERN = 'data/coca_%sgram.txt'
+REFERENCE = {}
+
+
+def load_reference() -> None:
+ with data.open_project_path(UNIGRAM_REFERENCE, mode='r') as src:
+ for... | |
f7be5699265e123866f2e43e3e2920b39495dd80 | tests/test_entities.py | tests/test_entities.py | from __future__ import unicode_literals
from ftfy import fix_text, fix_text_segment
from nose.tools import eq_
def test_entities():
example = '&\n<html>\n&'
eq_(fix_text(example), '&\n<html>\n&')
eq_(fix_text_segment(example), '&\n<html>\n&')
eq_(fix_text(example, fix_entities=True... | Add tests for the fix_entities parameter | Add tests for the fix_entities parameter
| Python | mit | LuminosoInsight/python-ftfy | ---
+++
@@ -0,0 +1,18 @@
+from __future__ import unicode_literals
+from ftfy import fix_text, fix_text_segment
+from nose.tools import eq_
+
+def test_entities():
+ example = '&\n<html>\n&'
+ eq_(fix_text(example), '&\n<html>\n&')
+ eq_(fix_text_segment(example), '&\n<html>\n&')
+
+ eq... | |
c9ce5f7eafcfc3d15c9ff3d7c72b44d0192fd452 | tests/test_handlers.py | tests/test_handlers.py | from __future__ import print_function
import unittest
import teres
import teres.handlers
import logging
import os.path
import shutil
import StringIO
import tempfile
class LoggingHandlerSetUp(unittest.TestCase):
def setUp(self):
self.reporter = teres.Reporter.get_reporter()
self.logger = logging.... | Add basic tests for LoggingHandler. | Add basic tests for LoggingHandler.
| Python | lgpl-2.1 | tlamer/teres,tlamer/teres | ---
+++
@@ -0,0 +1,91 @@
+from __future__ import print_function
+import unittest
+
+import teres
+import teres.handlers
+import logging
+import os.path
+import shutil
+import StringIO
+import tempfile
+
+
+class LoggingHandlerSetUp(unittest.TestCase):
+ def setUp(self):
+ self.reporter = teres.Reporter.get_... | |
a209ee1f7ab3be06d03e0eaa926dca5e4811ecc6 | lesion/tests/test_lifio.py | lesion/tests/test_lifio.py | import os
from lesion import lifio
from numpy.testing.decorators import skipif
from numpy.testing import assert_equal, assert_allclose
currdir = os.path.abspath(os.path.dirname(__file__))
test_lif = os.path.join(currdir, 'mouse-kidney.lif')
test_lif_unavailable = not os.path.isfile(test_lif)
@skipif(test_lif_unavai... | Add functions to test LIF IO | Add functions to test LIF IO
| Python | bsd-3-clause | jni/lesion | ---
+++
@@ -0,0 +1,26 @@
+import os
+from lesion import lifio
+
+from numpy.testing.decorators import skipif
+from numpy.testing import assert_equal, assert_allclose
+
+currdir = os.path.abspath(os.path.dirname(__file__))
+
+test_lif = os.path.join(currdir, 'mouse-kidney.lif')
+test_lif_unavailable = not os.path.isfi... | |
4b193e59a53717c80c6835374048ba71c5bfa208 | tests/test_cli_common.py | tests/test_cli_common.py | from __future__ import absolute_import
import unittest
import os
from mciutil.cli.common import get_config_filename
class CliCommonTests(unittest.TestCase):
def test_get_config_filename(self):
"""
check that package default config exists, otherwise fail
this will show up on remote build w... | Check that mideu package config exists (assumes that home and current dir do not have config present) | Check that mideu package config exists (assumes that home and current dir do not have config present)
| Python | bsd-3-clause | adelosa/mciutil | ---
+++
@@ -0,0 +1,19 @@
+from __future__ import absolute_import
+import unittest
+import os
+
+from mciutil.cli.common import get_config_filename
+
+
+class CliCommonTests(unittest.TestCase):
+ def test_get_config_filename(self):
+ """
+ check that package default config exists, otherwise fail
+ ... | |
9d02b311504c8babf876ce8c45262b7394650d14 | tests/test_symmetrize.py | tests/test_symmetrize.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
"""
Tests for the 'symmetrize' method.
"""
import copy
import pytest
import tbmodels
@pytest.fixture
def input_model(sample):
return tbmodels.io.load(sample("In... | Add test for 'position_tolerance' when symmetrizing. | Add test for 'position_tolerance' when symmetrizing.
| Python | apache-2.0 | Z2PackDev/TBmodels,Z2PackDev/TBmodels | ---
+++
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik
+# Author: Dominik Gresch <greschd@gmx.ch>
+"""
+Tests for the 'symmetrize' method.
+"""
+import copy
+
+import pytest
+
+import tbmodels
+
+
+@pytest.fixture
+def input_model(sam... | |
cd6efedc59924cef44dbddaa304483e09fe62d4e | testci/test_featureproducer.py | testci/test_featureproducer.py | import collections
import datetime
import pytest
import numpy as np
from PIL import Image
#from pelops.datasets.chip import ChipDataset, Chip
from pelops.datasets.featuredataset import FeatureDataset
from pelops.features.feature_producer import FeatureProducer
@pytest.fixture
def chip_producer():
Chip = collecti... | Add first tests for `FeatureProducer()` | Add first tests for `FeatureProducer()`
These tests do not test all code paths, but it is a start. We still need
to add a test file to read.
| Python | apache-2.0 | dave-lab41/pelops,dave-lab41/pelops,Lab41/pelops,Lab41/pelops,d-grossman/pelops,d-grossman/pelops | ---
+++
@@ -0,0 +1,61 @@
+import collections
+import datetime
+import pytest
+import numpy as np
+from PIL import Image
+
+#from pelops.datasets.chip import ChipDataset, Chip
+from pelops.datasets.featuredataset import FeatureDataset
+from pelops.features.feature_producer import FeatureProducer
+
+
+@pytest.fixture
+... | |
ea1b55dcd3d174888b7d0214fb1fa780cb9a4ebe | chstrings/chstrings_test.py | chstrings/chstrings_test.py | import chstrings
import config
import unittest
class CHStringsTest(unittest.TestCase):
@classmethod
def add_smoke_test(cls, cfg):
def test(self):
# We just want to see if this will blow up
chstrings.get_localized_strings(cfg, cfg.lang_code)
name = 'test_' + cfg.lang_cod... | Add a quick check that we can preprocess strings. | Add a quick check that we can preprocess strings.
| Python | mit | guilherme-pg/citationhunt,eggpi/citationhunt,eggpi/citationhunt,eggpi/citationhunt,guilherme-pg/citationhunt,guilherme-pg/citationhunt,eggpi/citationhunt,guilherme-pg/citationhunt | ---
+++
@@ -0,0 +1,19 @@
+import chstrings
+import config
+
+import unittest
+
+class CHStringsTest(unittest.TestCase):
+ @classmethod
+ def add_smoke_test(cls, cfg):
+ def test(self):
+ # We just want to see if this will blow up
+ chstrings.get_localized_strings(cfg, cfg.lang_code)... | |
05db0c76a2eefd2a490573973d417f29eb1303c9 | testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py | testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py | """
Description:
This file include basis functions
lanqinglong@huawei.com
"""
import logging
import os
import time
class foundation:
def __init__(self):
self.dir = os.path.join( os.getcwd(), 'log' )
def log (self, loginfo):
"""
Record log in log directory for deploying test e... | Write a simple adapter in functest project to run TESTON JIRA:FUNCTEST-46 | Write a simple adapter in functest project to run TESTON
JIRA:FUNCTEST-46
Change-Id: I146ec926da6cbbd2535d0997326a13bd545f42c6
Signed-off-by: Qinglong Lan <0cd11e1cd771fa5a3124ae83fdff3084638adefb@huawei.com>
| Python | apache-2.0 | opnfv/functest,mywulin/functest,mywulin/functest,opnfv/functest | ---
+++
@@ -0,0 +1,32 @@
+"""
+Description:
+ This file include basis functions
+ lanqinglong@huawei.com
+"""
+
+import logging
+import os
+import time
+
+class foundation:
+
+ def __init__(self):
+ self.dir = os.path.join( os.getcwd(), 'log' )
+
+ def log (self, loginfo):
+ """
+ Rec... | |
46b7667bf704e98c52dbd9eb41a7ccbf6de9229e | trump/tools/tests/test_sqla.py | trump/tools/tests/test_sqla.py | from ...orm import SetupTrump, SymbolManager
class TestToolsSQLA(object):
def setup_method(self, test_method):
self.eng = SetupTrump()
self.sm = SymbolManager(self.eng)
def test_repr_mixin(self):
sym = self.sm.create("testsym", overwrite=True)
assert repr(sym) == """Symbol... | Add test for repr mixin | TST: Add test for repr mixin
| Python | bsd-3-clause | Equitable/trump,Asiant/trump,jnmclarty/trump | ---
+++
@@ -0,0 +1,12 @@
+from ...orm import SetupTrump, SymbolManager
+
+class TestToolsSQLA(object):
+
+ def setup_method(self, test_method):
+ self.eng = SetupTrump()
+ self.sm = SymbolManager(self.eng)
+
+ def test_repr_mixin(self):
+ sym = self.sm.create("testsym", overwrite=True)
... | |
af5b12f4fdda3f9ccfee19d2a7589fed6a7faee5 | news/migrations/0004_auto_20160301_2235.py | news/migrations/0004_auto_20160301_2235.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def make_articles_boring(apps, schema_editor):
Article = apps.get_model("news", "Article")
for article in Article.objects.filter(url__contains='http://www.nu.nl/gadgets/'):
for version in article.... | Add migrations for boring articles. | Add migrations for boring articles.
| Python | mit | flupzor/newsdiffs,flupzor/newsdiffs,flupzor/newsdiffs,flupzor/bijgeschaafd,flupzor/bijgeschaafd,flupzor/bijgeschaafd,flupzor/bijgeschaafd,flupzor/newsdiffs | ---
+++
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+def make_articles_boring(apps, schema_editor):
+ Article = apps.get_model("news", "Article")
+
+ for article in Article.objects.filter(url__contains='http://www.nu.nl/gadgets... | |
fb0e9e0d6de608a255cac00acbecdc445b2da93c | examples/act_experience_update.py | examples/act_experience_update.py | # Copyright 2020 Tensorforce Team. 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 la... | Update last commit: add act-experience-update example | Update last commit: add act-experience-update example
| Python | apache-2.0 | reinforceio/tensorforce | ---
+++
@@ -0,0 +1,63 @@
+# Copyright 2020 Tensorforce Team. 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
+#... | |
8ac380905f969eab9be64cc97d8e5ec4d7c53e26 | sorting/merge_sort.py | sorting/merge_sort.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Merge Sort.
Best, Average, Worst: O(nlogn).
'''
def merge_sort(array, result, left, right, order):
if right - left < 2:
return
if (right - left) == 2:
if order == 'asc':
if result[left] > result[right-1]:
result[... | Implement the merge sort algorithm. | Implement the merge sort algorithm.
| Python | mit | weichen2046/algorithm-study,weichen2046/algorithm-study | ---
+++
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+'''
+Merge Sort.
+
+Best, Average, Worst: O(nlogn).
+'''
+
+
+def merge_sort(array, result, left, right, order):
+
+ if right - left < 2:
+ return
+
+ if (right - left) == 2:
+ if order == 'asc':
+ if result[lef... | |
bfbeee63deecb424a528b44225b2dd4c67bbbc23 | manage.py | manage.py | from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from app import db, create_app
from app.models import User, BucketList, Item
app = create_app("development")
manager = Manager(app)
migrate = Migrate(app, db)
@manager.command
def createdb():
db.create_all()
print("database ta... | Add database migrations and creation script | Add database migrations and creation script
| Python | mit | brayoh/bucket-list-api | ---
+++
@@ -0,0 +1,23 @@
+from flask_script import Manager
+from flask_migrate import Migrate, MigrateCommand
+
+from app import db, create_app
+from app.models import User, BucketList, Item
+
+app = create_app("development")
+manager = Manager(app)
+migrate = Migrate(app, db)
+
+@manager.command
+def createdb():
+ ... | |
77917be83586e1963fb3b11cdb9631a766acb294 | pyagg/tests/test_canvas.py | pyagg/tests/test_canvas.py | import numpy as np
from numpy.testing import assert_equal
from pyagg import GraphicsState, Color, ndarray_canvas_rgb24
def test_line():
expected = np.zeros((100, 100, 3), dtype=np.uint8)
buffer = np.zeros((100, 100, 3), dtype=np.uint8)
canvas = ndarray_canvas_rgb24(buffer)
gs = GraphicsState()
g... | Add a test module where canvas unit tests will go | Add a test module where canvas unit tests will go
Only a simple line drawing test there for now...
| Python | mit | celiagg/celiagg,celiagg/celiagg,celiagg/celiagg,celiagg/celiagg,celiagg/celiagg | ---
+++
@@ -0,0 +1,26 @@
+import numpy as np
+from numpy.testing import assert_equal
+
+from pyagg import GraphicsState, Color, ndarray_canvas_rgb24
+
+
+def test_line():
+ expected = np.zeros((100, 100, 3), dtype=np.uint8)
+ buffer = np.zeros((100, 100, 3), dtype=np.uint8)
+ canvas = ndarray_canvas_rgb24(bu... | |
f118339ae2e55ed5d07480094f5706eef6ed858d | pmdarima/preprocessing/endog/tests/test_log.py | pmdarima/preprocessing/endog/tests/test_log.py | # -*- coding: utf-8 -*-
import numpy as np
from numpy.testing import assert_array_almost_equal
from scipy import stats
import pytest
from pmdarima.preprocessing import LogEndogTransformer
from pmdarima.preprocessing import BoxCoxEndogTransformer
def test_same():
y = [1, 2, 3]
trans = BoxCoxEndogTransformer()... | Add test for empty LogEndogTransformer | Add test for empty LogEndogTransformer
| Python | mit | tgsmith61591/pyramid,tgsmith61591/pyramid,alkaline-ml/pmdarima,alkaline-ml/pmdarima,tgsmith61591/pyramid,alkaline-ml/pmdarima | ---
+++
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+
+import numpy as np
+from numpy.testing import assert_array_almost_equal
+from scipy import stats
+import pytest
+
+from pmdarima.preprocessing import LogEndogTransformer
+from pmdarima.preprocessing import BoxCoxEndogTransformer
+
+def test_same():
+ y = [1, 2, ... | |
099c0af192cabb11fad220296c327654b4c10b3e | tools/upload_build.py | tools/upload_build.py | """This script upload a newly-build version of CocoMUD for Windows.
The Download wiki page on Redmine are updated.
Requirements:
This script needs 'python-redmine', which you can obtain with
pip install python-redmine
"""
import argparse
from json import dumps
import os
import re
import sys
import urll... | Add a tool to upload a build | Add a tool to upload a build
| Python | bsd-3-clause | vlegoff/cocomud | ---
+++
@@ -0,0 +1,85 @@
+"""This script upload a newly-build version of CocoMUD for Windows.
+
+The Download wiki page on Redmine are updated.
+
+Requirements:
+ This script needs 'python-redmine', which you can obtain with
+ pip install python-redmine
+
+"""
+
+import argparse
+from json import dumps
+im... | |
911cb1838dcb974dfa1e28712a1f884c89c2b600 | migrations/versions/577ad345788e_.py | migrations/versions/577ad345788e_.py | """empty message
Revision ID: 577ad345788e
Revises: 3b655c2d1a85
Create Date: 2015-11-17 11:18:22.685983
"""
# revision identifiers, used by Alembic.
revision = '577ad345788e'
down_revision = '3b655c2d1a85'
from alembic import op
import sqlalchemy as sa
def upgrade():
command = """
ALTER TABLE auth_provid... | Add cascade for easier deletion of users from database. | Add cascade for easier deletion of users from database.
| Python | bsd-3-clause | uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal | ---
+++
@@ -0,0 +1,35 @@
+"""empty message
+
+Revision ID: 577ad345788e
+Revises: 3b655c2d1a85
+Create Date: 2015-11-17 11:18:22.685983
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '577ad345788e'
+down_revision = '3b655c2d1a85'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade():
+... | |
e8844c62571e85b38287048bac9666972ae674de | migrations/versions/888b56ed5dcb_.py | migrations/versions/888b56ed5dcb_.py | """Add table for additional user attributes
Revision ID: 888b56ed5dcb
Revises: d5870fd2f2a4
Create Date: 2021-02-10 12:17:40.880224
"""
# revision identifiers, used by Alembic.
revision = '888b56ed5dcb'
down_revision = 'd5870fd2f2a4'
from alembic import op
import sqlalchemy as sa
def upgrade():
try:
o... | Add DB migration script for attributes table | Add DB migration script for attributes table
| Python | agpl-3.0 | privacyidea/privacyidea,privacyidea/privacyidea,privacyidea/privacyidea,privacyidea/privacyidea,privacyidea/privacyidea,privacyidea/privacyidea | ---
+++
@@ -0,0 +1,41 @@
+"""Add table for additional user attributes
+
+Revision ID: 888b56ed5dcb
+Revises: d5870fd2f2a4
+Create Date: 2021-02-10 12:17:40.880224
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '888b56ed5dcb'
+down_revision = 'd5870fd2f2a4'
+
+from alembic import op
+import sqlalchemy ... | |
067c256fb9df4170c129b2bc36d1b1323fad6d25 | generate_PSC.py | generate_PSC.py | from datetime import datetime as dt
from datetime import timedelta as tdelta
import numpy as np
from astropy.io import fits
import astropy.units as u
from astropy.coordinates import SkyCoord
sky_background = 1000.
sky_sigma = 5.
nx = 12
ny = 16
nt = 42
data_cube = np.random.normal(sky_background, sky_sigma, (nt,ny,nx)... | Add quick and dirty script to generate a fake postage stamp cue (PSC). | Add quick and dirty script to generate a fake postage stamp cue (PSC).
| Python | mit | panoptes/PIAA | ---
+++
@@ -0,0 +1,42 @@
+from datetime import datetime as dt
+from datetime import timedelta as tdelta
+import numpy as np
+from astropy.io import fits
+import astropy.units as u
+from astropy.coordinates import SkyCoord
+
+sky_background = 1000.
+sky_sigma = 5.
+nx = 12
+ny = 16
+nt = 42
+data_cube = np.random.norm... | |
a4aea5e34f44d5f9183258978c85e20fb0fbc0b7 | SMSFlyCRM/SMSApp/management/commands/sms_campaign_scheduler.py | SMSFlyCRM/SMSApp/management/commands/sms_campaign_scheduler.py | from datetime import datetime
from django.core.management.base import BaseCommand
from SMSFlyCRM.SMSApp.tasks import scheduleRecurringCampaignTasksFor
class Command(BaseCommand):
help = 'Schedules campaign sending for specified interval'
def add_arguments(self, parser):
parser.add_argument('min_inte... | Add django command for triggering campaigns scheduler | Add django command for triggering campaigns scheduler
| Python | mit | wk-tech/crm-smsfly,wk-tech/crm-smsfly,wk-tech/crm-smsfly | ---
+++
@@ -0,0 +1,17 @@
+from datetime import datetime
+from django.core.management.base import BaseCommand
+
+from SMSFlyCRM.SMSApp.tasks import scheduleRecurringCampaignTasksFor
+
+
+class Command(BaseCommand):
+ help = 'Schedules campaign sending for specified interval'
+
+ def add_arguments(self, parser):
... | |
9515bf68e15099582946f9765b2fa081d2570701 | course_discovery/apps/course_metadata/migrations/0220_leveltype_remove_order.py | course_discovery/apps/course_metadata/migrations/0220_leveltype_remove_order.py | from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('course_metadata', '0219_leveltype_ordering'),
]
operations = [
migrations.RemoveField(
model_name='leveltype',
name='order',
... | Rename order field in LevelType (3/3) | Rename order field in LevelType (3/3)
Stage 3: ONLY remove the old column via a migration.
DE-1829
| Python | agpl-3.0 | edx/course-discovery,edx/course-discovery,edx/course-discovery,edx/course-discovery | ---
+++
@@ -0,0 +1,17 @@
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('course_metadata', '0219_leveltype_ordering'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='leve... | |
302e267c0f1374a11a661418c49aa63f25a38bf9 | corehq/apps/export/migrations/0006_delete_dailysavedexportnotification.py | corehq/apps/export/migrations/0006_delete_dailysavedexportnotification.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-10-09 19:24
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('export', '0005_datafile_blobmeta'),
]
operations = [
migrations.DeleteModel(
... | Revert "Hold off on migration" | Revert "Hold off on migration"
This reverts commit d0cd939e90917bc06b71fb6a6a5aedd881f24840.
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.14 on 2018-10-09 19:24
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('export', '0005_datafile_blobmeta'),
+ ]
+
+ operations ... | |
5e19645b4917bf2f0bc9c987ef6148a5833ff05c | aioriak/tests/test_datatypes.py | aioriak/tests/test_datatypes.py | import unittest
from aioriak.bucket import Bucket, BucketType
from aioriak import datatypes
from aioriak.tests.base import IntegrationTest, AsyncUnitTestCase
class DatatypeUnitTestBase:
dtype = None
bucket = Bucket(None, 'test', BucketType(None, 'datatypes'))
def op(self, dtype):
raise NotImpleme... | Add Riak counter datatype tests | Add Riak counter datatype tests
| Python | mit | rambler-digital-solutions/aioriak | ---
+++
@@ -0,0 +1,73 @@
+import unittest
+from aioriak.bucket import Bucket, BucketType
+from aioriak import datatypes
+from aioriak.tests.base import IntegrationTest, AsyncUnitTestCase
+
+
+class DatatypeUnitTestBase:
+ dtype = None
+ bucket = Bucket(None, 'test', BucketType(None, 'datatypes'))
+
+ def op(... | |
342da37f14c6ac991bd3f7c904bd5b7f1196493a | src/sentry/digests/backends/dummy.py | src/sentry/digests/backends/dummy.py | from __future__ import absolute_import
from contextlib import contextmanager
from sentry.digests.backends.base import Backend
class DummyBackend(Backend):
def add(self, key, record):
pass
@contextmanager
def digest(self, key):
yield []
def schedule(self, deadline):
return
... | from __future__ import absolute_import
from contextlib import contextmanager
from sentry.digests.backends.base import Backend
class DummyBackend(Backend):
def add(self, key, record, increment_delay=None, maximum_delay=None):
pass
@contextmanager
def digest(self, key, minimum_delay=None):
... | Fix digests `DummyBackend` method signatures. | Fix digests `DummyBackend` method signatures.
This makes them consistent with the base backend API.
RIP @tkaemming, stung by dynamic typing.
| Python | bsd-3-clause | looker/sentry,mvaled/sentry,JamesMura/sentry,mvaled/sentry,zenefits/sentry,zenefits/sentry,fotinakis/sentry,alexm92/sentry,JamesMura/sentry,BuildingLink/sentry,mvaled/sentry,jean/sentry,JamesMura/sentry,BuildingLink/sentry,JackDanger/sentry,gencer/sentry,fotinakis/sentry,gencer/sentry,daevaorn/sentry,JackDanger/sentry,... | ---
+++
@@ -6,11 +6,11 @@
class DummyBackend(Backend):
- def add(self, key, record):
+ def add(self, key, record, increment_delay=None, maximum_delay=None):
pass
@contextmanager
- def digest(self, key):
+ def digest(self, key, minimum_delay=None):
yield []
def schedule... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.