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 |
|---|---|---|---|---|---|---|---|---|---|---|
943c8bb558f0a951b190b598f12069d06b6e3041 | tests/sim/test_entities.py | tests/sim/test_entities.py | import unittest
from hunting.sim.entities import *
class TestFighter(unittest.TestCase):
def test_base_speed_must_be_positive(self):
with self.assertRaises(ValueError):
Fighter(1, 1, 1, 1, base_speed=-5)
with self.assertRaises(ValueError):
Fighter(1, 1, 1, 1, base_speed=0)... | Add test to constrain speed to positive | Add test to constrain speed to positive
| Python | mit | MoyTW/RL_Arena_Experiment | ---
+++
@@ -0,0 +1,19 @@
+import unittest
+from hunting.sim.entities import *
+
+
+class TestFighter(unittest.TestCase):
+ def test_base_speed_must_be_positive(self):
+ with self.assertRaises(ValueError):
+ Fighter(1, 1, 1, 1, base_speed=-5)
+
+ with self.assertRaises(ValueError):
+ ... | |
a3ac011c35fa8918a4828a2c6eb119d5ca18a857 | src/example/bench_wsh.py | src/example/bench_wsh.py | # Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | Add a handler for performing client load testing. | Add a handler for performing client load testing.
Review URL: http://codereview.appspot.com/3844044 | Python | bsd-3-clause | google/pywebsocket,googlearchive/pywebsocket,GoogleChromeLabs/pywebsocket3,google/pywebsocket,googlearchive/pywebsocket,GoogleChromeLabs/pywebsocket3,google/pywebsocket,GoogleChromeLabs/pywebsocket3,googlearchive/pywebsocket | ---
+++
@@ -0,0 +1,60 @@
+# Copyright 2011, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notic... | |
eafd68dd70d24f6e5551e2f59d7c13e4be6dce6e | testparser.py | testparser.py | #!/usr/bin/env python
import sys
import os
import subprocess
# ARGUMENTS:
# 1 - path to the parser executable
# 2 - path to the parser-lalr executable
# 3 - path to the source directory to look for *.rs files
parser = sys.argv[1]
parser_lalr = sys.argv[2]
# flex dies on multibyte characters
BLACKLIST = ['libstd/st... | Add a new test script to evaluate status of different parsers. | Add a new test script to evaluate status of different parsers.
| Python | mit | patperry/rust-grammar,bleibig/rust-grammar,patperry/rust-grammar,patperry/rust-grammar,bleibig/rust-grammar,bleibig/rust-grammar,patperry/rust-grammar,bleibig/rust-grammar | ---
+++
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+
+import sys
+
+import os
+import subprocess
+
+# ARGUMENTS:
+# 1 - path to the parser executable
+# 2 - path to the parser-lalr executable
+# 3 - path to the source directory to look for *.rs files
+
+parser = sys.argv[1]
+parser_lalr = sys.argv[2]
+
+# flex dies on m... | |
3cb168f79a5239068f5ed0c3fa51f530f4a37f05 | members/crm/migrations/0014_auto_20190117_0402.py | members/crm/migrations/0014_auto_20190117_0402.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2019-01-17 04:02
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('crm', '0013_profile_squashed'),
]
operations = [
migrations.RemoveField(
... | Remove profile until QBO integration gets merged in | Remove profile until QBO integration gets merged in
| Python | mit | ocwc/ocwc-members,ocwc/ocwc-members,ocwc/ocwc-members,ocwc/ocwc-members | ---
+++
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.14 on 2019-01-17 04:02
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('crm', '0013_profile_squashed'),
+ ]
+
+ operations = [
... | |
a7ff8375e945a7522ede57ef98c130b40aaf98b0 | helper_scripts/clean_tool_conf_xml.py | helper_scripts/clean_tool_conf_xml.py | #!/usr/bin/env python
## Example usage: python clean_tool_conf.py -i /galaxy/config/shed_tool_conf.xml -o clean_shed_tool_conf.xml
import xml.etree.ElementTree as ET
from os import path
from argparse import ArgumentParser
def check_child(root, children, tooldir, removed_tools = []):
"""
For each child in ch... | Add script that removes non-existent xml entries from shed_tool_conf.xml and migrated_tool_conf.xml | Add script that removes non-existent xml entries from shed_tool_conf.xml and migrated_tool_conf.xml
| Python | mit | ARTbio/tools-artbio,ARTbio/tools-artbio,mvdbeek/tools-artbio,JuPeg/tools-artbio,chamaelj/tools-artbio,JuPeg/tools-artbio,chamaelj/tools-artbio,drosofff/tools-artbio,ARTbio/tools-artbio,drosofff/tools-artbio,drosofff/tools-artbio,ARTbio/tools-artbio,mvdbeek/tools-artbio,drosofff/tools-artbio,chamaelj/tools-artbio | ---
+++
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+
+## Example usage: python clean_tool_conf.py -i /galaxy/config/shed_tool_conf.xml -o clean_shed_tool_conf.xml
+
+import xml.etree.ElementTree as ET
+from os import path
+from argparse import ArgumentParser
+
+
+def check_child(root, children, tooldir, removed_tools = ... | |
81e3e688aba1ec18b80188077b664e1a85d1e717 | src/events.py | src/events.py | # event system
EVENT_CALLBACKS = {}
def add_listener(event, callback, priority = 5):
if event not in EVENT_CALLBACKS:
EVENT_CALLBACKS[event] = []
if (priority, callback) not in EVENT_CALLBACKS[event]:
EVENT_CALLBACKS[event].append((priority, callback))
EVENT_CALLBACKS[event].sort(key ... | # event system
EVENT_CALLBACKS = {}
def add_listener(event, callback, priority = 5):
if event not in EVENT_CALLBACKS:
EVENT_CALLBACKS[event] = []
if (priority, callback) not in EVENT_CALLBACKS[event]:
EVENT_CALLBACKS[event].append((priority, callback))
EVENT_CALLBACKS[event].sort(key ... | Fix Event.dispatch to return True if execution is to proceed | Fix Event.dispatch to return True if execution is to proceed
| Python | bsd-2-clause | billion57/lykos,Agent-Isai/lykos,Cr0wb4r/lykos,Diitto/lykos | ---
+++
@@ -24,7 +24,7 @@
def dispatch(self, *args):
if self.name not in EVENT_CALLBACKS:
- return
+ return True
for item in list(EVENT_CALLBACKS[self.name]):
item[1](self, *args) |
8c54e99f0a53b678ea14a850bed8cf9f6dd3c8bb | metaci/build/tests/test_rq_tasks.py | metaci/build/tests/test_rq_tasks.py | # Lots of work to be done here!!!!
from unittest import mock
from django.test import TestCase
from metaci.build.tasks import check_queued_build
from metaci.conftest import (
BuildFactory,
OrgFactory,
PlanFactory,
PlanRepositoryFactory,
RepositoryFactory,
)
@mock.patch("metaci.build.tasks.reset_... | Test the RQ task as well. | Test the RQ task as well.
| Python | bsd-3-clause | SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci | ---
+++
@@ -0,0 +1,34 @@
+# Lots of work to be done here!!!!
+
+from unittest import mock
+
+from django.test import TestCase
+
+from metaci.build.tasks import check_queued_build
+from metaci.conftest import (
+ BuildFactory,
+ OrgFactory,
+ PlanFactory,
+ PlanRepositoryFactory,
+ RepositoryFactory,
+)... | |
dacbb2ea0b9090a4783253259dced055da05ef26 | journal_abbreviations.py | journal_abbreviations.py | """Some additional journal abbreviations which are not provided by Crossref."""
JOURNAL_ABBRVS = {
"American Journal of Mathematics": "Am. J. Math.",
"American Journal of Physics": "Am. J. Phys",
"Annals of Physics": "Ann. Phys.",
"Communications in Mathematical Physics": "Commun. Math. Phys.",
"Jo... | Refactor journal abbreviations into seperate file | Refactor journal abbreviations into seperate file
| Python | mit | teunzwart/latex-production-tools | ---
+++
@@ -0,0 +1,13 @@
+"""Some additional journal abbreviations which are not provided by Crossref."""
+
+JOURNAL_ABBRVS = {
+ "American Journal of Mathematics": "Am. J. Math.",
+ "American Journal of Physics": "Am. J. Phys",
+ "Annals of Physics": "Ann. Phys.",
+ "Communications in Mathematical Physic... | |
60d307ac3f4edf4eb47e0ff4d67347345a2965f3 | zerver/migrations/0257_fix_has_link_attribute.py | zerver/migrations/0257_fix_has_link_attribute.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.24 on 2019-10-07 05:25
from __future__ import unicode_literals
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
import lxml
def fix_has_link(apps: StateAp... | Add migrations to correct has_* fields. | message: Add migrations to correct has_* fields.
This follows up on changes to correctly set has_link, has_attachment,
and has_image when rendering messages.
Fixes #12912.
| Python | apache-2.0 | timabbott/zulip,hackerkid/zulip,punchagan/zulip,punchagan/zulip,showell/zulip,rht/zulip,andersk/zulip,synicalsyntax/zulip,andersk/zulip,showell/zulip,zulip/zulip,eeshangarg/zulip,synicalsyntax/zulip,showell/zulip,synicalsyntax/zulip,rht/zulip,timabbott/zulip,zulip/zulip,eeshangarg/zulip,brainwane/zulip,rht/zulip,rht/zu... | ---
+++
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.24 on 2019-10-07 05:25
+from __future__ import unicode_literals
+
+from django.db import migrations
+from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
+from django.db.migrations.state import StateApps
+
+import ... | |
91133ca23b6fb2ad1fc888742ea78be0f849290e | henrste/test-simple.py | henrste/test-simple.py | #!/usr/bin/env python3
from framework.test_framework import Testbed, TestEnv, require_on_aqm_node
from framework.test_utils import *
def test_simple():
def my_test(testcase):
testcase.run_greedy(node='a', tag='node-a')
testcase.run_greedy(node='b', tag='node-b')
testbed = Testbed()
test... | Add test for demonstrating new test utilities | Add test for demonstrating new test utilities
| Python | mit | henrist/aqmt,henrist/aqmt,henrist/aqmt,henrist/aqmt | ---
+++
@@ -0,0 +1,51 @@
+#!/usr/bin/env python3
+
+from framework.test_framework import Testbed, TestEnv, require_on_aqm_node
+from framework.test_utils import *
+
+def test_simple():
+
+ def my_test(testcase):
+ testcase.run_greedy(node='a', tag='node-a')
+ testcase.run_greedy(node='b', tag='node-b... | |
de974f7bef19dbddc046f07bb2a58b8afa3dba09 | spacy/tests/serialize/test_serialize_tokenizer.py | spacy/tests/serialize/test_serialize_tokenizer.py | # coding: utf-8
from __future__ import unicode_literals
from ..util import make_tempdir
import pytest
@pytest.mark.parametrize('text', ["I can't do this"])
def test_serialize_tokenizer_roundtrip_bytes(en_tokenizer, text):
tokenizer_b = en_tokenizer.to_bytes()
new_tokenizer = en_tokenizer.from_bytes(tokenize... | Add serializer tests for tokenizer | Add serializer tests for tokenizer
| Python | mit | recognai/spaCy,recognai/spaCy,spacy-io/spaCy,recognai/spaCy,aikramer2/spaCy,recognai/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,honnibal/spaCy,spacy-io/spaCy,recognai/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,aikramer2/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spa... | ---
+++
@@ -0,0 +1,25 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from ..util import make_tempdir
+
+import pytest
+
+
+@pytest.mark.parametrize('text', ["I can't do this"])
+def test_serialize_tokenizer_roundtrip_bytes(en_tokenizer, text):
+ tokenizer_b = en_tokenizer.to_bytes()
+ new_token... | |
99aadd5f7cc486f59c4f92f4987f0261c21590ce | download_data.py | download_data.py | from __future__ import print_function
import os
print('Making sure that you have the necessary Python libraries installed...\n')
try:
import wget
except:
try:
import pip
except:
os.system('easy_install pip')
os.system('pip install wget')
print('')
import wget
print('Downloadi... | Remove data files, add download script | Remove data files, add download script
This directory will become incredibly bloated if we add all of the data
here. Furthermore, it is not possible to upload large data sets into
GitHub repos. Thus, we will instead provide a script to download all of
the data sets from an external server.
| Python | mit | rhiever/sklearn-benchmarks | ---
+++
@@ -0,0 +1,57 @@
+from __future__ import print_function
+import os
+
+print('Making sure that you have the necessary Python libraries installed...\n')
+
+try:
+ import wget
+except:
+ try:
+ import pip
+ except:
+ os.system('easy_install pip')
+
+ os.system('pip install wget')
+ ... | |
50586ffe08473e5c7dc11b51f9b20923900e4f1c | tests/integration/cloudformation/test_connection.py | tests/integration/cloudformation/test_connection.py | #!/usr/bin/env python
import time
import json
from tests.unit import unittest
from boto.cloudformation.connection import CloudFormationConnection
BASIC_EC2_TEMPLATE = {
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS CloudFormation Sample Template EC2InstanceSample",
"Parameters": {
},... | Add failing integration test for sigv4 failure | Add failing integration test for sigv4 failure
This repros #1037.
| Python | mit | jotes/boto,revmischa/boto,trademob/boto,shaunbrady/boto,awatts/boto,darjus-amzn/boto,alex/boto,jindongh/boto,zzzirk/boto,jameslegg/boto,campenberger/boto,nexusz99/boto,acourtney2015/boto,garnaat/boto,s0enke/boto,lra/boto,ocadotechnology/boto,pfhayes/boto,nikhilraog/boto,clouddocx/boto,ryansb/boto,ekalosak/boto,vijaylba... | ---
+++
@@ -0,0 +1,110 @@
+#!/usr/bin/env python
+import time
+import json
+
+from tests.unit import unittest
+from boto.cloudformation.connection import CloudFormationConnection
+
+
+BASIC_EC2_TEMPLATE = {
+ "AWSTemplateFormatVersion": "2010-09-09",
+ "Description": "AWS CloudFormation Sample Template EC2Inst... | |
219133a80fe4f772f64846b985e891b9536c35ea | crawler.py | crawler.py | import sys
import click
import requests
from bs4 import BeautifulSoup
from crayons import green, red
from notary import LICENSE_DIR
BASE_URL = "https://choosealicense.com"
LICENSES_URL = "{0}/licenses/".format(BASE_URL)
class License(object):
def __init__(self, url, slug, name, content):
self.url = ur... | Add CLI tool that crawls choosealicense for OSS licenses. | Add CLI tool that crawls choosealicense for OSS licenses.
| Python | mit | sxn/notary | ---
+++
@@ -0,0 +1,80 @@
+import sys
+
+import click
+import requests
+from bs4 import BeautifulSoup
+from crayons import green, red
+
+from notary import LICENSE_DIR
+
+BASE_URL = "https://choosealicense.com"
+LICENSES_URL = "{0}/licenses/".format(BASE_URL)
+
+
+class License(object):
+
+ def __init__(self, url, ... | |
5e4f960e8caf488533eb38d943e1da8c4a260631 | bluebottle/funding/migrations/0062_auto_20201222_1241.py | bluebottle/funding/migrations/0062_auto_20201222_1241.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-11-11 12:19
from __future__ import unicode_literals
from django.db import migrations
from bluebottle.utils.utils import update_group_permissions
def add_group_permissions(apps, schema_editor):
group_perms = {
'Staff': {
'perms': (
... | Add migration that adds donor permission to staff | Add migration that adds donor permission to staff
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.15 on 2019-11-11 12:19
+from __future__ import unicode_literals
+
+from django.db import migrations
+from bluebottle.utils.utils import update_group_permissions
+
+
+def add_group_permissions(apps, schema_editor):
+ group_perms = {
+ ... | |
79c074133d51fa5ac1193756e01e26b5245a4b97 | source/harmony/schema/collector.py | source/harmony/schema/collector.py | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
from abc import ABCMeta, abstractmethod
class Collector(object):
'''Collect and return schemas.'''
__metaclass__ = ABCMeta
@abstractmethod
def collect(self):
'''Yield collected schemas.
... | Add standard interface for collecting schemas. | Add standard interface for collecting schemas.
| Python | apache-2.0 | 4degrees/harmony | ---
+++
@@ -0,0 +1,20 @@
+# :coding: utf-8
+# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
+# :license: See LICENSE.txt.
+
+from abc import ABCMeta, abstractmethod
+
+
+class Collector(object):
+ '''Collect and return schemas.'''
+
+ __metaclass__ = ABCMeta
+
+ @abstractmethod
+ def collect(sel... | |
fa2a7d10522233b7287dfda28854be961868a40f | CodeFights/increaseNumberRoundness.py | CodeFights/increaseNumberRoundness.py | #!/usr/local/bin/python
# Code Fights Increase Number Roundness Problem
import re
def increaseNumberRoundness(n):
pattern = re.compile(r'0+[1-9]+')
return bool(re.search(pattern, str(n)))
def main():
tests = [
[902200100, True],
[11000, False],
[99080, True],
[1022220, T... | Solve Code Fights increase number roundness problem | Solve Code Fights increase number roundness problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,38 @@
+#!/usr/local/bin/python
+# Code Fights Increase Number Roundness Problem
+
+import re
+
+
+def increaseNumberRoundness(n):
+ pattern = re.compile(r'0+[1-9]+')
+ return bool(re.search(pattern, str(n)))
+
+
+def main():
+ tests = [
+ [902200100, True],
+ [11000, False],
... | |
096fbae1461d66f84b203d8a49ea3ae65a3f4bd4 | alembic/versions/fa8cf884aa8e_migrate_to_jsonb.py | alembic/versions/fa8cf884aa8e_migrate_to_jsonb.py | """migrate to jsonb
Revision ID: fa8cf884aa8e
Revises: a7e8a70b1772
Create Date: 2018-02-05 16:13:38.229076
"""
# revision identifiers, used by Alembic.
revision = 'fa8cf884aa8e'
down_revision = 'a7e8a70b1772'
from alembic import op
import sqlalchemy as sa
tables = ['user', 'task', 'task_run', 'result']
def upgra... | Migrate info tables to JSONB format. | Migrate info tables to JSONB format.
NOTE: this will only delete the materialed view users_rank. If you have
your own leaderboards based on info keys of the user, then you will have
to delete them manually or it will fail. Then, your background jobs will
recreate them.
| Python | agpl-3.0 | Scifabric/pybossa,PyBossa/pybossa,Scifabric/pybossa,PyBossa/pybossa | ---
+++
@@ -0,0 +1,30 @@
+"""migrate to jsonb
+
+Revision ID: fa8cf884aa8e
+Revises: a7e8a70b1772
+Create Date: 2018-02-05 16:13:38.229076
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'fa8cf884aa8e'
+down_revision = 'a7e8a70b1772'
+
+from alembic import op
+import sqlalchemy as sa
+
+tables = ['user... | |
2aa977c55e59d9f92db31c773e6533537fad780b | fabfile.py | fabfile.py | from fabric.api import *
import os
import sys
import shutil
import SimpleHTTPServer
import SocketServer
# Local path configuration (can be absolute or relative to fabfile)
env.deploy_path = 'output'
DEPLOY_PATH = env.deploy_path
# Branch to push on GitHub
env.gp_branch = 'master'
env.msg = 'Update blog'
SERVER = '1... | Add fabric configuration for deploy | Add fabric configuration for deploy
| Python | mit | PythonNepal/pythonnepal.github.io | ---
+++
@@ -0,0 +1,73 @@
+from fabric.api import *
+import os
+import sys
+import shutil
+import SimpleHTTPServer
+import SocketServer
+
+# Local path configuration (can be absolute or relative to fabfile)
+env.deploy_path = 'output'
+DEPLOY_PATH = env.deploy_path
+
+# Branch to push on GitHub
+env.gp_branch = 'maste... | |
69dceca7d089b356a6a259592640aebf6cdeaece | tests/modules/test_cpu.py | tests/modules/test_cpu.py | # pylint: disable=C0103,C0111
import json
import unittest
import mock
import tests.mocks as mocks
from bumblebee.config import Config
from bumblebee.input import I3BarInput, LEFT_MOUSE
from bumblebee.modules.cpu import Module
class TestCPUModule(unittest.TestCase):
def setUp(self):
self._stdin, self._se... | Add unit tests for module cpu | [tests/cpu] Add unit tests for module cpu
| Python | mit | tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status | ---
+++
@@ -0,0 +1,61 @@
+# pylint: disable=C0103,C0111
+
+import json
+import unittest
+import mock
+
+import tests.mocks as mocks
+
+from bumblebee.config import Config
+from bumblebee.input import I3BarInput, LEFT_MOUSE
+from bumblebee.modules.cpu import Module
+
+class TestCPUModule(unittest.TestCase):
+ def s... | |
be55f40e56127e10779c0ec6ee2d628dbcf529ce | fabfile.py | fabfile.py | from fabric.api import cd, env, local, lcd, run
PUPPET_MASTER_IP = '192.168.33.10'
def puppet():
env.hosts = [
'vagrant@' + PUPPET_MASTER_IP + ':22',
]
env.passwords = {
'vagrant@' + PUPPET_MASTER_IP + ':22': 'vagrant'
}
def test():
with lcd('puppet/modules'):
with lcd(... | Use fabric to deploy Puppet modules | Use fabric to deploy Puppet modules
| Python | mit | zkan/puppet-untitled-2016,zkan/puppet-untitled-2016 | ---
+++
@@ -0,0 +1,32 @@
+from fabric.api import cd, env, local, lcd, run
+
+
+PUPPET_MASTER_IP = '192.168.33.10'
+
+
+def puppet():
+ env.hosts = [
+ 'vagrant@' + PUPPET_MASTER_IP + ':22',
+ ]
+ env.passwords = {
+ 'vagrant@' + PUPPET_MASTER_IP + ':22': 'vagrant'
+ }
+
+
+def test():
+ w... | |
b5cfe24ceba05aa9e94947f4a9a1223651095f98 | proselint/checks/mau_a_vs_an.py | proselint/checks/mau_a_vs_an.py | # -*- coding: utf-8 -*-
"""MAU100: a vs. an
---
layout: post
error_code: MAU101
source: Garner's Modern American Usage
source_url: http://amzn.to/15wF76r
title: a vs. an
date: 2014-06-10 12:31:19
categories: writing
---
The first line is always wrong.
"""
import re
from nltk.corpus import cmudict
... | Add 'a' vs. 'an' rule | Add 'a' vs. 'an' rule
#31
| Python | bsd-3-clause | amperser/proselint,amperser/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint,jstewmon/proselint,jstewmon/proselint | ---
+++
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+"""MAU100: a vs. an
+
+---
+layout: post
+error_code: MAU101
+source: Garner's Modern American Usage
+source_url: http://amzn.to/15wF76r
+title: a vs. an
+date: 2014-06-10 12:31:19
+categories: writing
+---
+
+The first line is always wrong.
+
+"""... | |
7a4dbefbd105653866cdbad85965c07e30716b77 | tests/test_wfgenerator.py | tests/test_wfgenerator.py | import pytest
from nlppln import WorkflowGenerator
class TestWFGenerator(object):
@pytest.fixture
def wf(self):
return WorkflowGenerator()
def test_steps_in_library(self, wf):
assert len(wf.steps_library) > 0
| Test that at least one step is loaded in the steps library | Test that at least one step is loaded in the steps library
| Python | apache-2.0 | WhatWorksWhenForWhom/nlppln,WhatWorksWhenForWhom/nlppln,WhatWorksWhenForWhom/nlppln | ---
+++
@@ -0,0 +1,12 @@
+import pytest
+
+from nlppln import WorkflowGenerator
+
+
+class TestWFGenerator(object):
+ @pytest.fixture
+ def wf(self):
+ return WorkflowGenerator()
+
+ def test_steps_in_library(self, wf):
+ assert len(wf.steps_library) > 0 | |
aedf8153750e0a45dd40fdc92e650ccaa944e22c | scripts/master/url_poller.py | scripts/master/url_poller.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This PollingChangeSource polls a URL for the change number.
Each change is submited to change master which triggers build steps.
Example:
To poll a ... | Add a URL poller for Chromebot. | Add a URL poller for Chromebot.
Specificly for Chromebot, it just need a simple way to trigger tests when 'http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux/LAST_CHANGE' changes.
Review URL: https://chromiumcodereview.appspot.com/12079048
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@18... | Python | bsd-3-clause | eunchong/build,eunchong/build,eunchong/build,eunchong/build | ---
+++
@@ -0,0 +1,64 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""This PollingChangeSource polls a URL for the change number.
+
+Each change is submited to change master which triggers... | |
b6eb492b9023c568ec493b2a1923ae41f79bb3c8 | mpdlcd/utils.py | mpdlcd/utils.py | # -*- coding: utf-8 -*-
# Copyright (c) 2011-2012 Raphaël Barrois
import functools
import logging
import time
class AutoRetryCandidate(object):
"""Base class for objects wishing to use the @auto_retry decorator.
Attributes:
_retry_logger (logging.Logger): where to log connection failures
ret... | Add a utility for auto-retrying connections. | Add a utility for auto-retrying connections.
Signed-off-by: Raphaël Barrois <8eb3b37a023209373fcd61a2fdc08256a14fb19c@polytechnique.org>
| Python | mit | rbarrois/mpdlcd,rbarrois/mpdlcd | ---
+++
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2011-2012 Raphaël Barrois
+
+import functools
+import logging
+import time
+
+
+class AutoRetryCandidate(object):
+ """Base class for objects wishing to use the @auto_retry decorator.
+
+ Attributes:
+ _retry_logger (logging.Logger): wher... | |
30c1ca3d17b677237eb822dba3d5d66bd8338b3c | pyplaybulb/playbulb.py | pyplaybulb/playbulb.py | from gatt import gattpy
class Playbulb:
hexa_name= '0x0003'
hexa_application_version = '0x0023'
hexa_microprocessor_version= '0x0021'
hexa_manufacturer= '0x0025'
hexa_brightness= '0x0010'
hexa_set_colour= ''
hexa_get_colour= ''
def __init__(self, mac_id):
self.mac_address... | Create parent class for bulbs | Create parent class for bulbs
| Python | mit | litobro/PyPlaybulb | ---
+++
@@ -0,0 +1,41 @@
+from gatt import gattpy
+
+class Playbulb:
+ hexa_name= '0x0003'
+ hexa_application_version = '0x0023'
+ hexa_microprocessor_version= '0x0021'
+ hexa_manufacturer= '0x0025'
+ hexa_brightness= '0x0010'
+ hexa_set_colour= ''
+ hexa_get_colour= ''
+
+ def __init__(... | |
240e7272a3e25abea3d7bf1e835f71e512967bd2 | python/face_compare.py | python/face_compare.py | import requests
import json
# Check whether the given faces belong to the same person or not.
# https://pixlab.io/#/cmd?id=facecompare for additional information.
src = 'https://static-secure.guim.co.uk/sys-images/Guardian/Pix/pictures/2012/7/9/1341860104423/obama_face.jpg'
target = 'https://static01.nyt.com/images/20... | Check whether the given faces belong to the same person or not | Check whether the given faces belong to the same person or not | Python | bsd-2-clause | symisc/pixlab,symisc/pixlab,symisc/pixlab | ---
+++
@@ -0,0 +1,22 @@
+import requests
+import json
+
+# Check whether the given faces belong to the same person or not.
+# https://pixlab.io/#/cmd?id=facecompare for additional information.
+src = 'https://static-secure.guim.co.uk/sys-images/Guardian/Pix/pictures/2012/7/9/1341860104423/obama_face.jpg'
+target = '... | |
96cba2528f4ef18635c04521415ab033878f07da | mfrc522/iso14443com.py | mfrc522/iso14443com.py | from .mfrc522 import *
SEL_CASCADE_1 = 0x93
SEL_CASCADE_2 = 0x95
SEL_CASCADE_3 = 0x97
def __perform_cascade(module, cascade_level):
if cascade_level != SEL_CASCADE_1 and \
cascade_level != SEL_CASCADE_2 and \
cascade_level != SEL_CASCADE_3:
return None
# print('Performing cascade... | Implement detecting iso14443a compliant cards | [WIP] Implement detecting iso14443a compliant cards
| Python | mit | fmfi-svt-deadlock/libmfrc522.py | ---
+++
@@ -0,0 +1,53 @@
+from .mfrc522 import *
+
+SEL_CASCADE_1 = 0x93
+SEL_CASCADE_2 = 0x95
+SEL_CASCADE_3 = 0x97
+
+def __perform_cascade(module, cascade_level):
+
+ if cascade_level != SEL_CASCADE_1 and \
+ cascade_level != SEL_CASCADE_2 and \
+ cascade_level != SEL_CASCADE_3:
+ retur... | |
98d22ffabc797935c03bda1b22d21ce0b81efc19 | misc/forceinventory.py | misc/forceinventory.py | import pyghmi.ipmi.command as cmd
import sys
import os
# alternatively, the following ipmi raw sequence:
# 0x3a 0xc4 0x3 0x0 0x21 0x1 0x9d 0x2f 0x76 0x32 0x2f 0x69 0x62 0x6d 0x63 0x2f 0x75 0x65 0x66 0x69 0x2f 0x66 0x6f 0x72 0x63 0x65 0x2d 0x69 0x6e 0x76 0x65 0x6e 0x74 0x6f 0x72 0x79 0x11 0x1
c = cmd.Command(sys.argv[1... | Add a utility to induce an inventory | Add a utility to induce an inventory
| Python | apache-2.0 | xcat2/confluent,xcat2/confluent,jjohnson42/confluent,xcat2/confluent,jjohnson42/confluent,jjohnson42/confluent,jjohnson42/confluent,jjohnson42/confluent,xcat2/confluent,xcat2/confluent | ---
+++
@@ -0,0 +1,9 @@
+import pyghmi.ipmi.command as cmd
+import sys
+import os
+# alternatively, the following ipmi raw sequence:
+# 0x3a 0xc4 0x3 0x0 0x21 0x1 0x9d 0x2f 0x76 0x32 0x2f 0x69 0x62 0x6d 0x63 0x2f 0x75 0x65 0x66 0x69 0x2f 0x66 0x6f 0x72 0x63 0x65 0x2d 0x69 0x6e 0x76 0x65 0x6e 0x74 0x6f 0x72 0x79 0x11 ... | |
b686bf04f64e1e907f6444233c6776458c02e120 | whatismyip.py | whatismyip.py | #! /usr/bin/python
import requests
from bs4 import BeautifulSoup
def main():
r = requests.get('http://www.whatismyip.com')
soup = BeautifulSoup(r.text)
ip_address = ''
for span in soup.find('div', 'the-ip'):
ip_address += span.text
print(ip_address)
if __name__ == '__main__':
ma... | Add script for checking your ip address | Add script for checking your ip address
| Python | apache-2.0 | MichaelAquilina/whatismyip | ---
+++
@@ -0,0 +1,21 @@
+#! /usr/bin/python
+
+import requests
+
+from bs4 import BeautifulSoup
+
+
+def main():
+ r = requests.get('http://www.whatismyip.com')
+
+ soup = BeautifulSoup(r.text)
+
+ ip_address = ''
+ for span in soup.find('div', 'the-ip'):
+ ip_address += span.text
+
+ print(ip_... | |
8a2d24856ba86dc807d91905fedc9af7faca99be | airflow/migrations/versions/d2ae31099d61_increase_text_size_for_mysql.py | airflow/migrations/versions/d2ae31099d61_increase_text_size_for_mysql.py | #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the ... | Increase text size for var field in variables for MySQL | [AIRFLOW-1522] Increase text size for var field in variables for MySQL
Closes #2535 from saguziel/aguziel-increase-text
| Python | apache-2.0 | subodhchhabra/airflow,Fokko/incubator-airflow,criccomini/airflow,gtoonstra/airflow,hgrif/incubator-airflow,apache/airflow,jfantom/incubator-airflow,zack3241/incubator-airflow,r39132/airflow,Twistbioscience/incubator-airflow,sergiohgz/incubator-airflow,Acehaidrey/incubator-airflow,CloverHealth/airflow,yk5/incubator-airf... | ---
+++
@@ -0,0 +1,41 @@
+#
+# 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... | |
e348c4620f6de3d70c0b7d71afcb00727339bfd4 | src/cli/_dbus/_properties.py | src/cli/_dbus/_properties.py | """
Properties interface.
"""
class Properties(object):
"""
Properties interface.
"""
_INTERFACE_NAME = 'org.freedesktop.DBus.Properties'
def __init__(self, dbus_object):
"""
Initializer.
:param dbus_object: the dbus object
"""
self._dbus_object = dbus_obj... | Add a class for the DBus.Properties interface. | Add a class for the DBus.Properties interface.
Signed-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>
| Python | apache-2.0 | stratis-storage/stratis-cli,stratis-storage/stratis-cli | ---
+++
@@ -0,0 +1,61 @@
+"""
+Properties interface.
+"""
+
+class Properties(object):
+ """
+ Properties interface.
+ """
+
+ _INTERFACE_NAME = 'org.freedesktop.DBus.Properties'
+
+ def __init__(self, dbus_object):
+ """
+ Initializer.
+
+ :param dbus_object: the dbus object
+ ... | |
0ab3ee0394af8aafe5d3815456ae2bc599c814b6 | tests/test_parsingapi.py | tests/test_parsingapi.py | from __future__ import unicode_literals, division, absolute_import
from flexget.plugin import get_plugin_by_name, get_plugins
from flexget.plugins.parsers import plugin_parsing
from tests import FlexGetBase
class TestParsingAPI(FlexGetBase):
def test_all_types_handled(self):
declared_types = set(plugin_p... | Add some tests to validate modular parsing api | Add some tests to validate modular parsing api
| Python | mit | Danfocus/Flexget,ianstalk/Flexget,Flexget/Flexget,poulpito/Flexget,grrr2/Flexget,antivirtel/Flexget,oxc/Flexget,camon/Flexget,poulpito/Flexget,ianstalk/Flexget,OmgOhnoes/Flexget,ratoaq2/Flexget,crawln45/Flexget,vfrc2/Flexget,ZefQ/Flexget,v17al/Flexget,jacobmetrick/Flexget,ratoaq2/Flexget,sean797/Flexget,thalamus/Flexge... | ---
+++
@@ -0,0 +1,19 @@
+from __future__ import unicode_literals, division, absolute_import
+
+from flexget.plugin import get_plugin_by_name, get_plugins
+from flexget.plugins.parsers import plugin_parsing
+from tests import FlexGetBase
+
+
+class TestParsingAPI(FlexGetBase):
+ def test_all_types_handled(self):
+... | |
a0bb9f02a3aa5e58cca3760ef219d170db853864 | ModelHandler/TestModels.py | ModelHandler/TestModels.py | import DatasetHandler.CreateDataset as CreateDataset
# Test functions to handle models
def DatasetTester(dataset, dataset_uid):
# Load dataset, report input sizes
# Cook features for various models
# Report feature output sizes
# Try top models - regular with fixed size or the "heatmap"
retu... | Structure of the test function for Dataset working - we will test various CNN models on it and attach to them various custom tops | Structure of the test function for Dataset working - we will test various CNN models on it and attach to them various custom tops
| Python | mit | previtus/MGR-Project-Code,previtus/MGR-Project-Code,previtus/MGR-Project-Code | ---
+++
@@ -0,0 +1,23 @@
+import DatasetHandler.CreateDataset as CreateDataset
+
+# Test functions to handle models
+
+def DatasetTester(dataset, dataset_uid):
+ # Load dataset, report input sizes
+
+
+ # Cook features for various models
+
+ # Report feature output sizes
+
+ # Try top models - regular wit... | |
8f3052a743a6be0c6191b47a3f9c3ee366c8fa58 | YouKnowShit/Save2BCloud.py | YouKnowShit/Save2BCloud.py | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
browser = webdriver.Firefox(webdriver.FirefoxProfile("C:\\Users\\jiang\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\5xd6vmv0.default-1480350130384"))
browser.get("http://www.baidu.com")
browser.get("http://pan.baidu.com/s/1i5D... | Save file to BD yun. | Save file to BD yun.
| Python | mit | jiangtianyu2009/PiSoftCake | ---
+++
@@ -0,0 +1,15 @@
+from selenium import webdriver
+from selenium.webdriver.common.keys import Keys
+import time
+
+browser = webdriver.Firefox(webdriver.FirefoxProfile("C:\\Users\\jiang\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\5xd6vmv0.default-1480350130384"))
+browser.get("http://www.baidu.com")
+browse... | |
ace8c1dfbb05c3ffcc577ac966822e1c2752d9ea | migrations/versions/bd22b917f9f7_update_histogram_menu_order.py | migrations/versions/bd22b917f9f7_update_histogram_menu_order.py | """Update Histogram menu order
Revision ID: bd22b917f9f7
Revises: c4b87364ce33
Create Date: 2021-10-09 00:07:26.892344
"""
from alembic import op
from sqlalchemy.sql import text
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'bd22b917f9f7'
down_revision = 'c4b87364ce33'
branch_labels = ... | Fix the menu order of histogram tabs | Fix the menu order of histogram tabs
| Python | apache-2.0 | eubr-bigsea/tahiti,eubr-bigsea/tahiti,eubr-bigsea/tahiti,eubr-bigsea/tahiti | ---
+++
@@ -0,0 +1,25 @@
+"""Update Histogram menu order
+
+Revision ID: bd22b917f9f7
+Revises: c4b87364ce33
+Create Date: 2021-10-09 00:07:26.892344
+
+"""
+from alembic import op
+from sqlalchemy.sql import text
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = 'bd22b917f9f7'
+down_... | |
7b09f0309460eb306ef74a0bedfcad82ae3d91a0 | regparser/web/jobs/migrations/0012_auto_20161012_2059.py | regparser/web/jobs/migrations/0012_auto_20161012_2059.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-10-12 20:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('jobs', '0011_auto_20161011_2135'),
]
operations = [
migrations.AlterField(
... | Remove default keyword from hexhash key for RegulationFile. | Remove default keyword from hexhash key for RegulationFile.
| Python | cc0-1.0 | eregs/regulations-parser,tadhg-ohiggins/regulations-parser,tadhg-ohiggins/regulations-parser,eregs/regulations-parser | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.10 on 2016-10-12 20:59
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('jobs', '0011_auto_20161011_2135'),
+ ]
+
+ opera... | |
f9b92cb7df1b5965fc14cefc423a8bbc664076b9 | avena/tests/test-interp.py | avena/tests/test-interp.py | #!/usr/bin/env python
from numpy import all, allclose, array, float32, max
from .. import interp
def test_interp2():
x = array([
[0, 1, 0],
[1, 1, 1],
[0, 1, 0],
], dtype=float32)
y = interp._interp2(1.0, x)
assert allclose(x, y)
if __name__ == '__main__':
pass
| Add a unit test for the interp module. | Add a unit test for the interp module.
| Python | isc | eliteraspberries/avena | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+from numpy import all, allclose, array, float32, max
+
+from .. import interp
+
+
+def test_interp2():
+ x = array([
+ [0, 1, 0],
+ [1, 1, 1],
+ [0, 1, 0],
+ ], dtype=float32)
+ y = interp._interp2(1.0, x)
+ assert allclose(x, y)
+
+
... | |
0d649b26e092f2678f2a39f9245568c9cf14b799 | tempest/tests/services/compute/test_extensions_client.py | tempest/tests/services/compute/test_extensions_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 tests for extensions_client | Add unit tests for extensions_client
This patch adds unit test for extensions_client.
Change-Id: I37ff50ff31ca9a2c4608f656247a0073fbfbfb61
| Python | apache-2.0 | flyingfish007/tempest,JioCloud/tempest,rakeshmi/tempest,manasi24/tempest,pczerkas/tempest,xbezdick/tempest,akash1808/tempest,roopali8/tempest,roopali8/tempest,Tesora/tesora-tempest,nunogt/tempest,JioCloud/tempest,cisco-openstack/tempest,xbezdick/tempest,manasi24/jiocloud-tempest-qatempest,dkalashnik/tempest,openstack/t... | ---
+++
@@ -0,0 +1,75 @@
+# 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... | |
cedf6f46768ee607b274bcb7fe10bb5042d5ef26 | run_tests.py | run_tests.py | import unittest
from src.convert import kilometers_to_miles, miles_to_kilometers, \
years_to_minutes, minutes_to_years
class TestConvert(unittest.TestCase):
def test_km_2_mi(self):
actual = kilometers_to_miles(1)
expected = 0.621 # From Brian, from Google
self.assertAlmostEqual(actual, expected, delta = 0.01)... | Test functions to convert units. | Test functions to convert units.
| Python | mit | RoyGBivDash/Unit_Conversions | ---
+++
@@ -0,0 +1,26 @@
+import unittest
+from src.convert import kilometers_to_miles, miles_to_kilometers, \
+ years_to_minutes, minutes_to_years
+
+class TestConvert(unittest.TestCase):
+
+ def test_km_2_mi(self):
+ actual = kilometers_to_miles(1)
+ expected = 0.621 # From Brian, from Google
+ self.assertAlmost... | |
07f70ec2011f676cdb30eb9e41fedbc2657cbea1 | insertfiles.py | insertfiles.py | #!/usr/bin/env python3
import filelister
import subprocess
subprocess.run(['tar', '-xzf', 'queue.tar.gz'], stdout=subprocess.PIPE)
subprocess.run(['mv', 'home/bread/winhome/pictures/anime/queue', 'bots'])
filelister.insertfiles('bots/a2c.json')
| Add functionality to insert files into the config file | Add functionality to insert files into the config file
| Python | mit | BradleyCai/breadbot | ---
+++
@@ -0,0 +1,8 @@
+#!/usr/bin/env python3
+import filelister
+import subprocess
+
+subprocess.run(['tar', '-xzf', 'queue.tar.gz'], stdout=subprocess.PIPE)
+subprocess.run(['mv', 'home/bread/winhome/pictures/anime/queue', 'bots'])
+filelister.insertfiles('bots/a2c.json')
+ | |
c03db0a196d04b26ac671b16cb57a0f9fdfea82e | gemini/annotation_provenance/make-ncbi-grc-patches.py | gemini/annotation_provenance/make-ncbi-grc-patches.py | #!/usr/bin/env python
"""Retrieve information on patches and fixes to GRCh37 from GRC website.
Converts information on these regions into a BED file for Gemini import.
http://www.ncbi.nlm.nih.gov/projects/genome/assembly/grc/human/
"""
import urllib2
from collections import namedtuple
from operator import attrgetter
... | Add download script to get GRC patch regions for annotation | Add download script to get GRC patch regions for annotation
| Python | mit | bgruening/gemini,bw2/gemini,heuermh/gemini,arq5x/gemini,xuzetan/gemini,bw2/gemini,bpow/gemini,arq5x/gemini,heuermh/gemini,bpow/gemini,bpow/gemini,bpow/gemini,arq5x/gemini,heuermh/gemini,bgruening/gemini,xuzetan/gemini,heuermh/gemini,bgruening/gemini,arq5x/gemini,bw2/gemini,bw2/gemini,udp3f/gemini,bgruening/gemini,udp3f... | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+"""Retrieve information on patches and fixes to GRCh37 from GRC website.
+
+Converts information on these regions into a BED file for Gemini import.
+
+http://www.ncbi.nlm.nih.gov/projects/genome/assembly/grc/human/
+"""
+import urllib2
+from collections import namedtu... | |
c99929e2aaa119104c20b0d865b8e42c0b15a03e | morse/morse_radio.py | morse/morse_radio.py | # Import modules
from microbit import *
import radio
# define morse code dictionary
morse = {
"a": ".-",
"b": "-...",
"c": "-.-.",
"d": "-..",
"e": ".",
"f": "..-.",
"g": "--.",
"h": "....",
"i": "..",
"j": ".---",
"k": "-.-",
"l": ".-..",
"m": "--",
"n": "-.",
... | Add ability to send morse code via radio | Add ability to send morse code via radio
| Python | mit | OiNutter/microbit-scripts | ---
+++
@@ -0,0 +1,113 @@
+# Import modules
+from microbit import *
+import radio
+
+# define morse code dictionary
+morse = {
+ "a": ".-",
+ "b": "-...",
+ "c": "-.-.",
+ "d": "-..",
+ "e": ".",
+ "f": "..-.",
+ "g": "--.",
+ "h": "....",
+ "i": "..",
+ "j": ".---",
+ "k": "-.-",
+ ... | |
7ed12facca2f94eb8bba721e9b11882ea24726fe | crmapp/subscribers/views.py | crmapp/subscribers/views.py | from django.shortcuts import render
from django.contrib.auth.models import User
from django.http import HttpResponseRedirect
from .forms import SubscriberForm
def subscriber_new(request, template='subscribers/subscriber_new.html'):
if request.method == 'POST':
form = SubscriberForm(request.POST)
i... | from django.shortcuts import render
from django.contrib.auth.models import User
from django.http import HttpResponseRedirect
from .forms import SubscriberForm
from .models import Subscriber
def subscriber_new(request, template='subscribers/subscriber_new.html'):
if request.method == 'POST':
form = Subscri... | Create the Subscriber Form - Part II > Update the View | Create the Subscriber Form - Part II > Update the View
| Python | mit | deenaariff/Django,tabdon/crmeasyapp,tabdon/crmeasyapp | ---
+++
@@ -3,6 +3,7 @@
from django.http import HttpResponseRedirect
from .forms import SubscriberForm
+from .models import Subscriber
def subscriber_new(request, template='subscribers/subscriber_new.html'):
if request.method == 'POST':
@@ -12,11 +13,21 @@
username = form.cleaned_data['userna... |
872159c61ee20be1befdfa21e42c54f2b420c7b8 | qiita_ware/commands.py | qiita_ware/commands.py | # -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | Add library code for ebi functions | Add library code for ebi functions
| Python | bsd-3-clause | squirrelo/qiita,ElDeveloper/qiita,wasade/qiita,RNAer/qiita,squirrelo/qiita,antgonza/qiita,adamrp/qiita,adamrp/qiita,antgonza/qiita,antgonza/qiita,adamrp/qiita,biocore/qiita,wasade/qiita,josenavas/QiiTa,ElDeveloper/qiita,antgonza/qiita,RNAer/qiita,squirrelo/qiita,wasade/qiita,RNAer/qiita,josenavas/QiiTa,RNAer/qiita,jose... | ---
+++
@@ -0,0 +1,66 @@
+# -----------------------------------------------------------------------------
+# Copyright (c) 2014--, The Qiita Development Team.
+#
+# Distributed under the terms of the BSD 3-clause License.
+#
+# The full license is in the file LICENSE, distributed with this software.
+# --------------... | |
7589f2364a73d75711b596ce8ab9581986bd4129 | radio/management/commands/set_default_access_tg.py | radio/management/commands/set_default_access_tg.py | import sys
import datetime
import csv
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.utils import timezone
from radio.models import *
class Command(BaseCommand):
help = 'Helper for new TalkGroup Access'
def add_arguments(self, parser):
p... | Add utility to setup TalkGroupAccess talkgroups | Add utility to setup TalkGroupAccess talkgroups
The utility will add all TalkGroups that are marked as public into the specivied specified TalkGroup Access list
| Python | mit | ScanOC/trunk-player,ScanOC/trunk-player,ScanOC/trunk-player,ScanOC/trunk-player | ---
+++
@@ -0,0 +1,38 @@
+import sys
+import datetime
+import csv
+
+from django.core.management.base import BaseCommand, CommandError
+from django.conf import settings
+from django.utils import timezone
+from radio.models import *
+
+class Command(BaseCommand):
+ help = 'Helper for new TalkGroup Access'
+
+ de... | |
b0783691bc0855ad154b649ddfabe7572f79f7fd | ordering/__init__.py | ordering/__init__.py | from fractions import Fraction
class Ordering:
_start = object()
_end = object()
def __init__(self):
self._labels = {
self._start: Fraction(0),
self._end: Fraction(1)
}
self._successors = {
self._start: self._end
}
self._predeces... | Add class representing an ordering on elements | Add class representing an ordering on elements
| Python | mit | madman-bob/python-order-maintenance | ---
+++
@@ -0,0 +1,38 @@
+from fractions import Fraction
+
+
+class Ordering:
+ _start = object()
+ _end = object()
+
+ def __init__(self):
+ self._labels = {
+ self._start: Fraction(0),
+ self._end: Fraction(1)
+ }
+ self._successors = {
+ self._start: s... | |
ff4f9810e3cccf89858f62bf1e6a3d060f7168ad | mapit/management/commands/mapit_UK_fix_2013-10-south-tynedale.py | mapit/management/commands/mapit_UK_fix_2013-10-south-tynedale.py | # This script is to be run as a one-off to fix up a specific boundary that
# the Ordnance survey gave the wrong code too in the 2013-10 edition of the
# boundary line. It must be run *before* importing the 2014-05 edition.
from optparse import make_option
from django.core.management.base import NoArgsCommand
from djan... | Add a command to fix South Tynedale's GSS code from 2013-10 | Add a command to fix South Tynedale's GSS code from 2013-10
South Tynedale UTE was given the wrong GSS code in the last Ordnance
Survey boundary line update in November 2013. They corrected this in
the May 2014 edition, but we need to fix up our historical version of
the area in order to be able to import that.
| Python | agpl-3.0 | chris48s/mapit,Sinar/mapit,opencorato/mapit,chris48s/mapit,opencorato/mapit,Code4SA/mapit,opencorato/mapit,chris48s/mapit,Code4SA/mapit,Sinar/mapit,Code4SA/mapit | ---
+++
@@ -0,0 +1,27 @@
+# This script is to be run as a one-off to fix up a specific boundary that
+# the Ordnance survey gave the wrong code too in the 2013-10 edition of the
+# boundary line. It must be run *before* importing the 2014-05 edition.
+
+from optparse import make_option
+from django.core.management.ba... | |
40438912639ea20614b7957443450463f6519c0b | clusto_query/test/test_lexer.py | clusto_query/test/test_lexer.py | import unittest
import clusto_query.lexer
class LexerTest(unittest.TestCase):
def test_consume(self):
self.assertEqual(clusto_query.lexer.consume('nom', 'nomnomnom'),
'nomnom')
def test_lex_string_inner_quoted_basic(self):
self.assertEqual(clusto_query.lexer.lex_strin... | Add some tests for lexer.py | Add some tests for lexer.py
| Python | isc | uber/clusto-query,uber/clusto-query | ---
+++
@@ -0,0 +1,24 @@
+import unittest
+import clusto_query.lexer
+
+
+class LexerTest(unittest.TestCase):
+ def test_consume(self):
+ self.assertEqual(clusto_query.lexer.consume('nom', 'nomnomnom'),
+ 'nomnom')
+
+ def test_lex_string_inner_quoted_basic(self):
+ self.as... | |
4d5c9066b9fba17cd484ecfafc646989e4828a87 | connectionless_client_2.py | connectionless_client_2.py | """
A simple connectionless client. It is for studying purposes only.
"""
import socket
__author__ = "Facundo Victor"
__license__ = "MIT"
__email__ = "facundovt@gmail.com"
def do_some_messaging(host, port):
"""
Handle a simple UDP client. Ask for stdinput data and send it to the UDP
server.
:param... | Add a basic UDP client | Add a basic UDP client
| Python | mit | facundovictor/non-blocking-socket-samples | ---
+++
@@ -0,0 +1,42 @@
+"""
+A simple connectionless client. It is for studying purposes only.
+"""
+
+import socket
+
+
+__author__ = "Facundo Victor"
+__license__ = "MIT"
+__email__ = "facundovt@gmail.com"
+
+
+def do_some_messaging(host, port):
+ """
+ Handle a simple UDP client. Ask for stdinput data and ... | |
5da2c5406daf31cb4f0c310abd56c1173609c549 | join_clips.py | join_clips.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from moviepy.editor import VideoFileClip, clips_array
import argparse
def main(args):
print(args)
clips = map(VideoFileClip, args.file)
final_clip = clips_array([clips])
final_clip.write_videofile(args.output, fps=15)
if __name__ == '__main__':
parser... | Add script to create single movie file from others horizontally | Add script to create single movie file from others horizontally
| Python | mit | NGTS/frame-movies,NGTS/frame-movies | ---
+++
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from moviepy.editor import VideoFileClip, clips_array
+import argparse
+
+def main(args):
+ print(args)
+ clips = map(VideoFileClip, args.file)
+ final_clip = clips_array([clips])
+ final_clip.write_videofile(args.output, fps=15)
... | |
5cb6057240fd296dbce36829366611b30cdaab29 | gem/migrations/0027_set_site_settings_correctly.py | gem/migrations/0027_set_site_settings_correctly.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from molo.profiles.models import UserProfilesSettings
from wagtail.wagtailcore.models import Site
def set_site_settings(apps, schema_editor):
for site in Site.objects.all():
settings = UserProfilesSettings.... | Add migration to set UserProfilesSettings correctly | Add migration to set UserProfilesSettings correctly
| Python | bsd-2-clause | praekelt/molo-gem,praekelt/molo-gem,praekelt/molo-gem | ---
+++
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+from molo.profiles.models import UserProfilesSettings
+
+from wagtail.wagtailcore.models import Site
+
+
+def set_site_settings(apps, schema_editor):
+ for site in Site.objects.all():
+... | |
383882ff8078efa3e368cde1bde96279eb0b3b5d | apps/gallery/migrations/0003_auto_20151015_0005.py | apps/gallery/migrations/0003_auto_20151015_0005.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('gallery', '0002_auto_20150916_1953'),
]
operations = [
migrations.AlterModelOptions(
name='responsiveimage',
... | Add meta class migration for responsiveimage | Add meta class migration for responsiveimage
| Python | mit | dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4 | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('gallery', '0002_auto_20150916_1953'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions... | |
3edef1b1876014298d53f7ac667af46b841432c5 | sift/concerts/management/commands/add_artists.py | sift/concerts/management/commands/add_artists.py | """
management/commands/add_artists.py
Add artist(s) to database.
"""
from datetime import datetime
import os, sys
from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError
from concerts.models import Artist
from concerts.utils import FIXTURE_DIRS
class Comman... | Add mgmt command to add artists to DB | Add mgmt command to add artists to DB
| Python | mit | industryjhr/sift_app,industryjhr/sift_app,jravesloot/sift_app,jravesloot/sift_app | ---
+++
@@ -0,0 +1,60 @@
+"""
+management/commands/add_artists.py
+
+Add artist(s) to database.
+"""
+from datetime import datetime
+import os, sys
+
+from django.core.management import call_command
+from django.core.management.base import BaseCommand, CommandError
+
+from concerts.models import Artist
+from concerts... | |
bd609e591f8eac5bf50221b41df37da27e026afb | pymetabiosis/bindings.py | pymetabiosis/bindings.py | from cffi import FFI
import sys
ffi = FFI()
ffi.cdef("""
typedef ... PyObject;
void Py_Initialize();
void Py_Finalize();
int PyRun_SimpleString(const char *command);
void Py_INCREF(PyObject *o);
void Py_XINCREF(PyObject *o);
void Py_DECREF(PyObject *o)... | Add the binding to the C API | Add the binding to the C API
| Python | mit | prabhuramachandran/pymetabiosis,rguillebert/pymetabiosis | ---
+++
@@ -0,0 +1,30 @@
+from cffi import FFI
+import sys
+
+ffi = FFI()
+
+ffi.cdef("""
+ typedef ... PyObject;
+
+ void Py_Initialize();
+ void Py_Finalize();
+
+ int PyRun_SimpleString(const char *command);
+
+ void Py_INCREF(PyObject *o);
+ void Py_XINCREF(PyObject... | |
400369a4905876bc523631dfd75518a04dab069c | senlin/tests/tempest/api/policies/test_policy_validate.py | senlin/tests/tempest/api/policies/test_policy_validate.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Add API tests for policy validation | Add API tests for policy validation
Add API tests for policy validation
Change-Id: Id3c0bc4280f1c76d4fc085ed8c292c99b4db334b
| Python | apache-2.0 | openstack/senlin,stackforge/senlin,stackforge/senlin,openstack/senlin,openstack/senlin | ---
+++
@@ -0,0 +1,44 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writi... | |
e76553404834de2f1123bd545922caab28e16375 | src/examples/tutorial/example_rhythmtransform.py | src/examples/tutorial/example_rhythmtransform.py | import sys
from essentia.standard import *
from essentia import Pool
try:
input_file = sys.argv[1]
except:
print "usage:", sys.argv[0], "<input_file>"
sys.exit()
sampleRate = 22050
frameSize = 8192
hopSize = 1024
rmsFrameSize = 256
rmsHopSize = 32
loader = MonoLoader(filename=input_file, sam... | Add python example for RhythmTransform | Add python example for RhythmTransform
| Python | agpl-3.0 | MTG/essentia,carthach/essentia,arseneyr/essentia,MTG/essentia,carthach/essentia,arseneyr/essentia,MTG/essentia,MTG/essentia,carthach/essentia,arseneyr/essentia,MTG/essentia,carthach/essentia,arseneyr/essentia,carthach/essentia,arseneyr/essentia | ---
+++
@@ -0,0 +1,44 @@
+import sys
+from essentia.standard import *
+from essentia import Pool
+
+try:
+ input_file = sys.argv[1]
+except:
+ print "usage:", sys.argv[0], "<input_file>"
+ sys.exit()
+
+sampleRate = 22050
+frameSize = 8192
+hopSize = 1024
+rmsFrameSize = 256
+rmsHopSize = 32
+
+
... | |
aac06331f2879cc8d39d5512c84da91f2832ff20 | apps/authentication/migrations/0007_onlineuser_bio.py | apps/authentication/migrations/0007_onlineuser_bio.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('authentication', '0006_jobmail_set_true'),
]
operations = [
migrations.AddField(
model_name='onlineuser',
... | Add migration for bio user field | Add migration for bio user field
| Python | mit | dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4 | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('authentication', '0006_jobmail_set_true'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ ... | |
1d95063d1416f82115fa26d72d548ada0616e239 | gensabenchmarks/go_func_utils.py | gensabenchmarks/go_func_utils.py | import sys
import contextlib
import inspect
import gensabenchmarks.go_benchmark_functions as gbf
def goclass():
"""
Generator to get global optimization test classes/functions
defined in SciPy
"""
bench_members = inspect.getmembers(gbf, inspect.isclass)
benchmark_functions = [item for item in b... | Fix import with full path | Fix import with full path
| Python | bsd-2-clause | sgubianpm/gensabench,sgubianpm/gensabench,sgubianpm/pygensa,sgubianpm/HyGSA,sgubianpm/pygensa,sgubianpm/HyGSA | ---
+++
@@ -0,0 +1,30 @@
+import sys
+import contextlib
+import inspect
+import gensabenchmarks.go_benchmark_functions as gbf
+
+def goclass():
+ """
+ Generator to get global optimization test classes/functions
+ defined in SciPy
+ """
+ bench_members = inspect.getmembers(gbf, inspect.isclass)
+ be... | |
ebfa9187f086cf905371f0e364aed534f535aff7 | examples/lvm_non_linear.py | examples/lvm_non_linear.py | import os
from examples.common import print_devices
import blivet
from blivet.size import Size
from blivet.util import set_up_logging, create_sparse_tempfile
set_up_logging()
b = blivet.Blivet() # create an instance of Blivet (don't add system devices)
# create a disk image file on which to create new devices
dis... | Add an example of non-linear LV creation | Add an example of non-linear LV creation
Useful for some manual testing as well as for people wondering how to do
something like that.
| Python | lgpl-2.1 | vojtechtrefny/blivet,rhinstaller/blivet,jkonecny12/blivet,vpodzime/blivet,vpodzime/blivet,jkonecny12/blivet,rhinstaller/blivet,vojtechtrefny/blivet,rvykydal/blivet,AdamWill/blivet,AdamWill/blivet,rvykydal/blivet | ---
+++
@@ -0,0 +1,64 @@
+import os
+
+from examples.common import print_devices
+
+import blivet
+from blivet.size import Size
+from blivet.util import set_up_logging, create_sparse_tempfile
+
+set_up_logging()
+b = blivet.Blivet() # create an instance of Blivet (don't add system devices)
+
+# create a disk image ... | |
961817824ea3d030bc2fb50a0b97f76a525ffeb9 | Examples/ParallelProcessing/MPI/Python/ParallelCone.py | Examples/ParallelProcessing/MPI/Python/ParallelCone.py | from vtk import *
import sys
import os
import time
myProcId = 0
numProcs = 1
compManager = vtkCompositeManager()
if compManager.GetController():
myProcId = compManager.GetController().GetLocalProcessId()
numProcs = compManager.GetController().GetNumberOfProcesses()
try:
v = vtkMesaRenderer()
if myPro... | Add example of parallel processing using python | Add example of parallel processing using python
| Python | bsd-3-clause | johnkit/vtk-dev,jmerkow/VTK,SimVascular/VTK,spthaolt/VTK,keithroe/vtkoptix,msmolens/VTK,cjh1/VTK,gram526/VTK,mspark93/VTK,sgh/vtk,arnaudgelas/VTK,collects/VTK,keithroe/vtkoptix,sgh/vtk,gram526/VTK,Wuteyan/VTK,sankhesh/VTK,sankhesh/VTK,keithroe/vtkoptix,aashish24/VTK-old,johnkit/vtk-dev,sankhesh/VTK,sankhesh/VTK,collect... | ---
+++
@@ -0,0 +1,85 @@
+from vtk import *
+import sys
+import os
+import time
+
+myProcId = 0
+numProcs = 1
+
+compManager = vtkCompositeManager()
+if compManager.GetController():
+ myProcId = compManager.GetController().GetLocalProcessId()
+ numProcs = compManager.GetController().GetNumberOfProcesses()
+
+tr... | |
9d105a62b29f0cd170343705bbe20c509d523e46 | osf_tests/test_handlers.py | osf_tests/test_handlers.py | import pytest
from nose.tools import assert_raises
from framework.celery_tasks import handlers
from website.project.tasks import on_node_updated
class TestCeleryHandlers:
@pytest.fixture()
def queue(self):
return handlers.queue()
def test_get_task_from_queue_not_there(self):
task = hand... | Add tests for new get_task_from_queue celery helper | Add tests for new get_task_from_queue celery helper
| Python | apache-2.0 | cslzchen/osf.io,caseyrollins/osf.io,mattclark/osf.io,aaxelb/osf.io,Johnetordoff/osf.io,pattisdr/osf.io,erinspace/osf.io,erinspace/osf.io,sloria/osf.io,pattisdr/osf.io,mfraezz/osf.io,caseyrollins/osf.io,cslzchen/osf.io,mattclark/osf.io,cslzchen/osf.io,felliott/osf.io,felliott/osf.io,brianjgeiger/osf.io,Johnetordoff/osf.... | ---
+++
@@ -0,0 +1,42 @@
+import pytest
+from nose.tools import assert_raises
+
+from framework.celery_tasks import handlers
+from website.project.tasks import on_node_updated
+
+
+class TestCeleryHandlers:
+
+ @pytest.fixture()
+ def queue(self):
+ return handlers.queue()
+
+ def test_get_task_from_q... | |
8d08a7caeb4da705b2ab5a6f55528d1beae5bedb | menpofit/clm/expert/base.py | menpofit/clm/expert/base.py | import numpy as np
from menpofit.math.correlationfilter import mccf, imccf
# TODO: document me!
class IncrementalCorrelationFilterThinWrapper(object):
r"""
"""
def __init__(self, cf_callable=mccf, icf_callable=imccf):
self.cf_callable = cf_callable
self.icf_callable = icf_callable
def... | Add dummy wrapper for correlation filters | Add dummy wrapper for correlation filters
| Python | bsd-3-clause | yuxiang-zhou/menpofit,yuxiang-zhou/menpofit,grigorisg9gr/menpofit,grigorisg9gr/menpofit | ---
+++
@@ -0,0 +1,28 @@
+import numpy as np
+from menpofit.math.correlationfilter import mccf, imccf
+
+
+# TODO: document me!
+class IncrementalCorrelationFilterThinWrapper(object):
+ r"""
+ """
+ def __init__(self, cf_callable=mccf, icf_callable=imccf):
+ self.cf_callable = cf_callable
+ sel... | |
f41e79f52a136eb9685a028e31628766015834b0 | twilio/rest/pricing/__init__.py | twilio/rest/pricing/__init__.py | from twilio.rest.base import TwilioClient
from twilio.rest.resources import UNSET_TIMEOUT
from .phone_numbers import PhoneNumbers
from .voice import Voice
class TwilioPricingClient(TwilioClient):
"""
A client for accessing the Twilio Pricing API.
:param str account: Your Account SID from `your dashboard
... | Move pricing client into pricing init | Move pricing client into pricing init
| Python | mit | tysonholub/twilio-python,twilio/twilio-python | ---
+++
@@ -0,0 +1,28 @@
+from twilio.rest.base import TwilioClient
+from twilio.rest.resources import UNSET_TIMEOUT
+from .phone_numbers import PhoneNumbers
+from .voice import Voice
+
+
+class TwilioPricingClient(TwilioClient):
+ """
+ A client for accessing the Twilio Pricing API.
+
+ :param str account: ... | |
48ba0b266d7c87473e2813d56cdc2fd33e8e85df | txircd/modules/test/testserv.py | txircd/modules/test/testserv.py | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData
from txircd.service import Service
from zope.interface import implements
class TestServ(Service):
implements(IPlugin, IModuleData)
name = "TestServ"
help = "A test service."
user_cmd_aliases = {
"TEST": (20, "T... | Create a test service testing basic service functionality | Create a test service testing basic service functionality
Put it under a new test/ directory for all such basic test modules.
| Python | bsd-3-clause | ElementalAlchemist/txircd,Heufneutje/txircd | ---
+++
@@ -0,0 +1,27 @@
+from twisted.plugin import IPlugin
+from txircd.module_interface import IModuleData
+from txircd.service import Service
+from zope.interface import implements
+
+
+class TestServ(Service):
+ implements(IPlugin, IModuleData)
+
+ name = "TestServ"
+ help = "A test service."
+ user_... | |
fdec47174afa276d3d173567bef62eb9b31cd5d0 | alembic/versions/4e1d46e710a2_use_jsonb_for_strokes.py | alembic/versions/4e1d46e710a2_use_jsonb_for_strokes.py | """use jsonb for strokes
Revision ID: 4e1d46e710a2
Revises: 5a7ec3d139df
Create Date: 2015-05-25 19:47:45.924915
"""
from alembic.op import execute
# revision identifiers, used by Alembic.
revision = '4e1d46e710a2'
down_revision = '5a7ec3d139df'
branch_labels = None
depends_on = None
def upgrade():
execute('A... | Use JSONB for storing strokes | Use JSONB for storing strokes
| Python | agpl-3.0 | favien/favien,favien/favien,favien/favien | ---
+++
@@ -0,0 +1,23 @@
+"""use jsonb for strokes
+
+Revision ID: 4e1d46e710a2
+Revises: 5a7ec3d139df
+Create Date: 2015-05-25 19:47:45.924915
+
+"""
+from alembic.op import execute
+
+
+# revision identifiers, used by Alembic.
+revision = '4e1d46e710a2'
+down_revision = '5a7ec3d139df'
+branch_labels = None
+depends... | |
5ce0e1a3320ac994737436803b8bd0923142e0af | htdocs/json/vtec_events.py | htdocs/json/vtec_events.py | #!/usr/bin/env python
"""Listing of VTEC events for a WFO and year"""
import cgi
import sys
import json
def report(wfo, year):
"""Generate a report of VTEC ETNs used for a WFO and year
Args:
wfo (str): 3 character WFO identifier
year (int): year to run for
"""
import psycopg2
pgcon... | Add quick hack of a VTEC listing, will make JSON when time permits | Add quick hack of a VTEC listing, will make JSON when time permits | Python | mit | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | ---
+++
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+"""Listing of VTEC events for a WFO and year"""
+import cgi
+import sys
+import json
+
+def report(wfo, year):
+ """Generate a report of VTEC ETNs used for a WFO and year
+
+ Args:
+ wfo (str): 3 character WFO identifier
+ year (int): year to run fo... | |
d31e468de531b4d9ccb1eba871d0d9b458f6dc4f | CheckVulnerableEntries.py | CheckVulnerableEntries.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import json
import os
import sys
def checkVulnerableEntries(dbFile):
if not os.path.isfile(dbFile):
sys.exit("JSON database %s does not exist!" % (dbFile))
with open(dbFile) as db:
issuesJSON = json.load(db)
... | Add a tool to list pending issues | Add a tool to list pending issues
| Python | mpl-2.0 | rgacogne/ArchCVEToJSON | ---
+++
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from __future__ import print_function
+import json
+import os
+import sys
+
+def checkVulnerableEntries(dbFile):
+ if not os.path.isfile(dbFile):
+ sys.exit("JSON database %s does not exist!" % (dbFile))
+
+ with open(dbFile) as ... | |
853caeba0d11b7ecf10ad74e19cd8b3cd3c82084 | Sketches/RJL/Torrent/Examples/example2.py | Sketches/RJL/Torrent/Examples/example2.py | from Kamaelia.Util.PipelineComponent import pipeline
from Kamaelia.Util.Console import ConsoleReader, ConsoleEchoer
import sys ; sys.path.append("/home/ryan/kamaelia/Sketches/RJL/")
from TriggeredFileReader import TriggeredFileReader
from DataSource import DataSource
from HTTPClient import HTTPClient
from btkam impor... | Test and example for new btkam.py TorrentClient. | Test and example for new btkam.py TorrentClient.
| Python | apache-2.0 | sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia | ---
+++
@@ -0,0 +1,20 @@
+from Kamaelia.Util.PipelineComponent import pipeline
+from Kamaelia.Util.Console import ConsoleReader, ConsoleEchoer
+
+import sys ; sys.path.append("/home/ryan/kamaelia/Sketches/RJL/")
+
+from TriggeredFileReader import TriggeredFileReader
+from DataSource import DataSource
+from HTTPClient... | |
5f7bc24308bd9e3098612813ba4d5da0cd532cb6 | python/testdata/counter.py | python/testdata/counter.py | from peer import begin_tran, end_tran, shared
begin_tran()
num = shared.setdefault('num', 0) + 1
end_tran()
print('My unique number is', num)
| Add a very simple test program for distributed Python. | Add a very simple test program for distributed Python.
| Python | apache-2.0 | snyderek/floating_temple,snyderek/floating_temple,snyderek/floating_temple | ---
+++
@@ -0,0 +1,7 @@
+from peer import begin_tran, end_tran, shared
+
+begin_tran()
+num = shared.setdefault('num', 0) + 1
+end_tran()
+
+print('My unique number is', num) | |
d9c1b22ede009c4d75827232dd32fbf31f96ca67 | chnnlsdmo/chnnlsdmo/migrations/0002_vote_created.py | chnnlsdmo/chnnlsdmo/migrations/0002_vote_created.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-08 02:43
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('chnnlsdmo', '0001_initial'),
]
... | Add migration to provide Vote timestamp column | Add migration to provide Vote timestamp column
| Python | bsd-3-clause | shearichard/django-channels-demo,shearichard/django-channels-demo,shearichard/django-channels-demo | ---
+++
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.5 on 2016-04-08 02:43
+from __future__ import unicode_literals
+
+import datetime
+from django.db import migrations, models
+from django.utils.timezone import utc
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ (... | |
14d19d4d515ad5d181cc7e0bebd3929b22b82972 | backend/breach/migrations/0018_target_samplesize.py | backend/breach/migrations/0018_target_samplesize.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-06-06 14:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('breach', '0017_auto_20160530_1450'),
]
operations = [
migrations.AddField(
... | Add migration for Target samplesize | Add migration for Target samplesize
| Python | mit | dimkarakostas/rupture,dimriou/rupture,esarafianou/rupture,dionyziz/rupture,dionyziz/rupture,dimkarakostas/rupture,dionyziz/rupture,dimkarakostas/rupture,dionyziz/rupture,dimriou/rupture,dimkarakostas/rupture,dionyziz/rupture,dimriou/rupture,esarafianou/rupture,dimriou/rupture,dimkarakostas/rupture,dimriou/rupture,esara... | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.2 on 2016-06-06 14:16
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('breach', '0017_auto_20160530_1450'),
+ ]
+
+ oper... | |
a803b54a588e5e96b7c1fd4877117dabd0facdf9 | mediacloud/mediawords/util/sitemap/test_helpers.py | mediacloud/mediawords/util/sitemap/test_helpers.py | import datetime
from mediawords.util.sitemap.helpers import html_unescape_ignore_none, parse_sitemap_publication_date
def test_html_unescape_ignore_none():
assert html_unescape_ignore_none("test & test") == "test & test"
assert html_unescape_ignore_none(None) is None
def test_parse_sitemap_publication_... | Add some tests for sitemap parsing helpers | Add some tests for sitemap parsing helpers
| Python | agpl-3.0 | berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud | ---
+++
@@ -0,0 +1,24 @@
+import datetime
+
+from mediawords.util.sitemap.helpers import html_unescape_ignore_none, parse_sitemap_publication_date
+
+
+def test_html_unescape_ignore_none():
+ assert html_unescape_ignore_none("test & test") == "test & test"
+ assert html_unescape_ignore_none(None) is None
+
... | |
cfb17cb9f7c72908b5bc915d8f0e2e465358c45f | thinc/neural/affine.py | thinc/neural/affine.py | from .base import Model
from .exceptions import ShapeError
class Affine(Model):
name = 'affine'
@property
def describe_params(self):
yield 'W-%s' % self.name, (self.nr_out, self.nr_in), self.ops.xavier_uniform_init
yield 'b-%s' % self.name, (self.nr_out,), None
@property
def ... | Move Affine to its own module | Move Affine to its own module
| Python | mit | spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc | ---
+++
@@ -0,0 +1,81 @@
+from .base import Model
+from .exceptions import ShapeError
+
+
+class Affine(Model):
+ name = 'affine'
+
+ @property
+ def describe_params(self):
+ yield 'W-%s' % self.name, (self.nr_out, self.nr_in), self.ops.xavier_uniform_init
+ yield 'b-%s' % self.name, (self.... | |
2311673478616bf16b4411772511e301e82b9860 | misc/cairo-group-pdf-bug.py | misc/cairo-group-pdf-bug.py | import cairo
import math
def fill_background(cr):
cr.set_source_rgb(0, 0, 1)
cr.paint()
def paint_from_image(cr, src):
cr.set_operator(cairo.OPERATOR_SATURATE)
cr.set_source_surface(src, 0, 0)
cr.paint()
cr.set_source_surface(src, 100, 0)
cr.paint()
cr.set_source_surface(src, 200, 0... | Add python program to illustrate strange cairo bug with group and pdf | Add python program to illustrate strange cairo bug with group and pdf
| Python | lgpl-2.1 | openslide/openslide,openslide/openslide,openslide/openslide,openslide/openslide | ---
+++
@@ -0,0 +1,89 @@
+import cairo
+import math
+
+def fill_background(cr):
+ cr.set_source_rgb(0, 0, 1)
+ cr.paint()
+
+def paint_from_image(cr, src):
+ cr.set_operator(cairo.OPERATOR_SATURATE)
+
+ cr.set_source_surface(src, 0, 0)
+ cr.paint()
+
+ cr.set_source_surface(src, 100, 0)
+ cr.pain... | |
08362c2f45f749f1942d3317ce8b64f64abca23f | mods/Autopilot0/__init__.py | mods/Autopilot0/__init__.py | import util
util.Moniker.CmdWarpToStuffAutopilot = lambda s, x: (uicore.uilib.RegisterAppEventTime(), s.CmdWarpToStuff("item", x, minRange = 0)) | Add mod: Autopilot to 0 | Add mod: Autopilot to 0
| Python | mit | EVEModX/Mods | ---
+++
@@ -0,0 +1,2 @@
+import util
+util.Moniker.CmdWarpToStuffAutopilot = lambda s, x: (uicore.uilib.RegisterAppEventTime(), s.CmdWarpToStuff("item", x, minRange = 0)) | |
17462a888a8ea5c2f7fdfa25cdb0ae07054c0753 | taiga/projects/management/commands/change_project_slug.py | taiga/projects/management/commands/change_project_slug.py | # -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | Create command to change project slug | [Backport] Create command to change project slug
| Python | agpl-3.0 | xdevelsistemas/taiga-back-community,dayatz/taiga-back,xdevelsistemas/taiga-back-community,dayatz/taiga-back,taigaio/taiga-back,taigaio/taiga-back,dayatz/taiga-back,taigaio/taiga-back,xdevelsistemas/taiga-back-community | ---
+++
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
+# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
+# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
+# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
+# This pr... | |
73c4c6fb87f33dadd9220e2ebca3ed5d275be47d | Tools/scripts/cvsfiles.py | Tools/scripts/cvsfiles.py | #! /usr/bin/env python
"""Create a list of files that are mentioned in CVS directories."""
import os
import sys
import string
def main():
args = sys.argv[1:]
if args:
for arg in args:
process(arg)
else:
process(".")
def process(dir):
cvsdir = 0
subdirs = []
files = []
names = os.l... | Print a list of files under CVS. | Print a list of files under CVS.
| Python | mit | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | ---
+++
@@ -0,0 +1,42 @@
+#! /usr/bin/env python
+
+"""Create a list of files that are mentioned in CVS directories."""
+
+import os
+import sys
+import string
+
+def main():
+ args = sys.argv[1:]
+ if args:
+ for arg in args:
+ process(arg)
+ else:
+ process(".")
+
+def process(dir):
+ cvsdir = 0
+ ... | |
7d65295224fbeb61ae4116e67ab8f2b704112480 | kolibri/auth/migrations/0003_classroom_facility_learnergroup.py | kolibri/auth/migrations/0003_classroom_facility_learnergroup.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-03 23:46
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('kolibriauth', '0002_auto_20160203_1516'),
]
operations = [
migrations.CreateModel(
... | Create Collection proxy model migration | Create Collection proxy model migration
| Python | mit | jtamiace/kolibri,indirectlylit/kolibri,benjaoming/kolibri,66eli77/kolibri,mrpau/kolibri,christianmemije/kolibri,benjaoming/kolibri,rtibbles/kolibri,mrpau/kolibri,aronasorman/kolibri,66eli77/kolibri,benjaoming/kolibri,indirectlylit/kolibri,aronasorman/kolibri,jayoshih/kolibri,christianmemije/kolibri,indirectlylit/kolibr... | ---
+++
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.1 on 2016-02-03 23:46
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('kolibriauth', '0002_auto_20160203_1516'),
+ ]
+
+ operati... | |
ebc708440cdf2ed46863cbe4ed595e2689f8fe71 | corehq/apps/groups/management/commands/touch_group_docs.py | corehq/apps/groups/management/commands/touch_group_docs.py | from django.core.management.base import LabelCommand
from dimagi.utils.couch.database import iter_docs
from dimagi.utils.chunked import chunked
from corehq.apps.groups.models import Group
class Command(LabelCommand):
def handle(self, *args, **options):
db = Group.get_db()
def get_doc_ids():
... | Add management command to touch all group docs | Add management command to touch all group docs
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qe... | ---
+++
@@ -0,0 +1,23 @@
+from django.core.management.base import LabelCommand
+
+from dimagi.utils.couch.database import iter_docs
+from dimagi.utils.chunked import chunked
+
+from corehq.apps.groups.models import Group
+
+
+class Command(LabelCommand):
+
+ def handle(self, *args, **options):
+ db = Group.... | |
7428906683d179de61537f68d63e7b44438d687d | network_conflict_creator.py | network_conflict_creator.py | #!/usr/bin/env python
from base import Base
from argparse import ArgumentParser
from sys import exit
from scapy.all import sniff, Ether, ARP, sendp
from logging import getLogger, ERROR
getLogger("scapy.runtime").setLevel(ERROR)
Base.check_user()
parser = ArgumentParser(description='DHCP Starvation attack script')
pa... | Add network conflict creator script. | Add network conflict creator script.
| Python | mit | Vladimir-Ivanov-Git/raw-packet,Vladimir-Ivanov-Git/raw-packet | ---
+++
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+
+from base import Base
+from argparse import ArgumentParser
+from sys import exit
+from scapy.all import sniff, Ether, ARP, sendp
+from logging import getLogger, ERROR
+getLogger("scapy.runtime").setLevel(ERROR)
+
+Base.check_user()
+
+parser = ArgumentParser(descript... | |
3a696d6646d2000997632aa2df15a254209977da | py/sliding-window-median.py | py/sliding-window-median.py | import heapq
from collections import Counter
class Solution(object):
def insertElement(self, value):
if self.minHeapSize < self.maxHeapSize:
heapq.heappush(self.maxHeap, -value)
m = self.maxHeapPop()
heapq.heappush(self.minHeap, m)
self.minHeapSize += 1
... | Add py solution for Sliding Window Median | Add py solution for Sliding Window Median
480. Sliding Window Median: https://leetcode.com/problems/sliding-window-median/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,77 @@
+import heapq
+from collections import Counter
+
+class Solution(object):
+ def insertElement(self, value):
+ if self.minHeapSize < self.maxHeapSize:
+ heapq.heappush(self.maxHeap, -value)
+ m = self.maxHeapPop()
+ heapq.heappush(self.minHeap, m)
+ ... | |
5ad4d9e38a7f5c86a499dfad9c6abef2d3697e7e | libpanel-applet/test-dbus-applet.py | libpanel-applet/test-dbus-applet.py | #!/usr/bin/env python
from gi.repository import Gtk
from gi.repository import PanelApplet
def applet_fill(applet):
label = Gtk.Label("My applet in Python")
applet.add(label)
applet.show_all()
def applet_factory(applet, iid, data):
if iid != "TestApplet":
return False
applet_fill(applet)
... | Add test applet in python | libpanel-applet: Add test applet in python
This is an example of how to use libpanel-applet from introspection
data.
| Python | lgpl-2.1 | GNOME/gnome-panel,GNOME/gnome-panel | ---
+++
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+from gi.repository import Gtk
+from gi.repository import PanelApplet
+
+def applet_fill(applet):
+ label = Gtk.Label("My applet in Python")
+ applet.add(label)
+ applet.show_all()
+
+def applet_factory(applet, iid, data):
+ if iid != "TestApplet":
+ ... | |
6187f8ac6cf1637b160b47bba55113490f5abf20 | Python/lambda_awejob.py | Python/lambda_awejob.py | # coding: utf-8
import json
import urllib.request
import boto3
def lambda_handler(event, context):
with urllib.request.urlopen("https://api.github.com/repos/awesome-jobs/vietnam/issues") as resp: # NOQA
data = resp.read()
d = json.loads(data.decode())
# ff = open('/tmp/issues')
# d = json.lo... | Add lambda code for gen site from awesome job repo | Add lambda code for gen site from awesome job repo
http://www.familug.org/2017/08/serverless.html
| Python | bsd-2-clause | familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG | ---
+++
@@ -0,0 +1,53 @@
+# coding: utf-8
+import json
+import urllib.request
+import boto3
+
+
+def lambda_handler(event, context):
+ with urllib.request.urlopen("https://api.github.com/repos/awesome-jobs/vietnam/issues") as resp: # NOQA
+ data = resp.read()
+ d = json.loads(data.decode())
+
+ # ff ... | |
135021ff2c64d2bd8e1122f657228e5eb8826196 | genome_designer/debug/2015_03_02_get_histo_files.py | genome_designer/debug/2015_03_02_get_histo_files.py | """
Script to get all histo files.
"""
import os
import shutil
import sys
# Setup Django environment.
sys.path.append(
os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from main.model_utils import get_dataset_with_type
from main.models impor... | Debug script to aggregate lumpy histogram files. | Debug script to aggregate lumpy histogram files.
| Python | mit | woodymit/millstone,churchlab/millstone,woodymit/millstone_accidental_source,woodymit/millstone,churchlab/millstone,woodymit/millstone,woodymit/millstone,churchlab/millstone,woodymit/millstone_accidental_source,woodymit/millstone_accidental_source,churchlab/millstone,woodymit/millstone_accidental_source | ---
+++
@@ -0,0 +1,40 @@
+"""
+Script to get all histo files.
+"""
+
+import os
+import shutil
+import sys
+
+# Setup Django environment.
+sys.path.append(
+ os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))
+os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
+
+
+from main.model_utils import ge... | |
b8dd5d1caff7a47f28e1f24a5a20cdd13a795830 | barsystem_base/management/commands/undo_transaction.py | barsystem_base/management/commands/undo_transaction.py | from django.core.management.base import BaseCommand
from barsystem_base.models import Person, Journal
class Command(BaseCommand):
def handle(self, *args, **kwargs):
while True:
try:
person_id = input('Enter user ID (or enter to exit): ')
except EOFError:
... | Add management command to undo transactions. | Add management command to undo transactions.
| Python | mit | TkkrLab/barsystem,TkkrLab/barsystem,TkkrLab/barsystem | ---
+++
@@ -0,0 +1,47 @@
+from django.core.management.base import BaseCommand
+from barsystem_base.models import Person, Journal
+
+class Command(BaseCommand):
+ def handle(self, *args, **kwargs):
+ while True:
+ try:
+ person_id = input('Enter user ID (or enter to exit): ')
+ ... | |
d468d6a24eb7573163911eee8094c5cc47d1a08f | polling_stations/apps/data_collection/management/commands/import_south_cambridge.py | polling_stations/apps/data_collection/management/commands/import_south_cambridge.py | """
Import South Cambridge
"""
import sys
from data_collection.management.commands import BaseShpShpImporter
class Command(BaseShpShpImporter):
"""
Imports the Polling Station data from South Cambridge
"""
srid = 4326
council_id = 'E07000012'
districts_name = 'Polling Districts for Twitter... | Add importer for South Cambridgeshire. | Add importer for South Cambridgeshire.
refs #82
| Python | bsd-3-clause | chris48s/UK-Polling-Stations,andylolz/UK-Polling-Stations,andylolz/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,andylolz/UK-Polling-Stations | ---
+++
@@ -0,0 +1,29 @@
+"""
+Import South Cambridge
+"""
+import sys
+
+from data_collection.management.commands import BaseShpShpImporter
+
+class Command(BaseShpShpImporter):
+ """
+ Imports the Polling Station data from South Cambridge
+ """
+ srid = 4326
+ council_id = 'E07000012'
+ distri... | |
20d50e4b5a3500865d97f12f2c48c72f558d170d | landlab/grid/tests/test_raster_grid/test_BC_updates.py | landlab/grid/tests/test_raster_grid/test_BC_updates.py | import numpy as np
from numpy.testing import assert_array_equal
from nose.tools import with_setup, assert_true, assert_equal, assert_not_equal
from landlab import FIXED_GRADIENT_BOUNDARY, CLOSED_BOUNDARY, INACTIVE_LINK, \
FIXED_LINK
from landlab import RasterModelGrid
def setup_grid():
globals().update({
... | Add tests for BC changes | Add tests for BC changes
Some elementary tests for BC changes on a raster. Tests would be
equivalent on an irregular grid.
| Python | mit | Carralex/landlab,RondaStrauch/landlab,ManuSchmi88/landlab,RondaStrauch/landlab,amandersillinois/landlab,ManuSchmi88/landlab,SiccarPoint/landlab,cmshobe/landlab,laijingtao/landlab,amandersillinois/landlab,RondaStrauch/landlab,Carralex/landlab,cmshobe/landlab,landlab/landlab,csherwood-usgs/landlab,landlab/landlab,Carrale... | ---
+++
@@ -0,0 +1,38 @@
+import numpy as np
+from numpy.testing import assert_array_equal
+from nose.tools import with_setup, assert_true, assert_equal, assert_not_equal
+
+from landlab import FIXED_GRADIENT_BOUNDARY, CLOSED_BOUNDARY, INACTIVE_LINK, \
+ FIXED_LINK
+from landlab import RasterModelGrid
+
+
+def set... | |
54368e90a67c73450bb10607f9566b88db1d97f4 | migrations/versions/740_migrate_supplier_frameworks_to_.py | migrations/versions/740_migrate_supplier_frameworks_to_.py | """migrate supplier_frameworks to framework_agreements
Revision ID: 740
Revises: 730
Create Date: 2016-09-14 14:23:56.196966
For supplier_framework rows that contain details of returning a framework agreement (indicated
by non null `agreement_details` or `agreement_returned_at`) and do not yet have a
corresponding r... | Migrate framework agreements to `framework_agreements` | Migrate framework agreements to `framework_agreements`
For supplier_framework rows that contain details of returning a framework agreement (indicated
by non null `agreement_details` or `agreement_returned_at`) and do not yet have a
corresponding row in the `framework_agreements` table.
Note, we are moving framework a... | Python | mit | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | ---
+++
@@ -0,0 +1,38 @@
+"""migrate supplier_frameworks to framework_agreements
+
+Revision ID: 740
+Revises: 730
+Create Date: 2016-09-14 14:23:56.196966
+
+For supplier_framework rows that contain details of returning a framework agreement (indicated
+by non null `agreement_details` or `agreement_returned_at`) and... | |
068a066e0bc89fb1476db5d24ceeb6b6b57f78a0 | mysite/engage/migrations/0002_auto_20141218_0750.py | mysite/engage/migrations/0002_auto_20141218_0750.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def create_features(apps, schema_editor):
Feature = apps.get_model("engage", "Feature")
Permission = apps.get_model("auth", "Permission")
for slug, name, perms in (
('blog', 'Blog', [
... | Add example features and permissions | Add example features and permissions
| Python | bsd-3-clause | Kvoti/ditto,Kvoti/ditto,Kvoti/ditto,Kvoti/ditto,Kvoti/ditto | ---
+++
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+def create_features(apps, schema_editor):
+ Feature = apps.get_model("engage", "Feature")
+ Permission = apps.get_model("auth", "Permission")
+ for slug, name, perms in ... | |
6b0f2e47ee249e9923539b07ca31629b11ce5d73 | studygroups/migrations/0094_update_venue_website.py | studygroups/migrations/0094_update_venue_website.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-07-24 11:42
from __future__ import unicode_literals
from django.db import migrations
def prepend_http(apps, schema_editor):
StudyGroup = apps.get_model("studygroups", "StudyGroup")
study_groups = StudyGroup.objects.all().exclude(venue_website='')
... | Add migration to fix URLs for studygroup venue websites | Add migration to fix URLs for studygroup venue websites
| Python | mit | p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles | ---
+++
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.6 on 2018-07-24 11:42
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+def prepend_http(apps, schema_editor):
+ StudyGroup = apps.get_model("studygroups", "StudyGroup")
+ study_groups = StudyGroup.object... | |
9ba8756648a1c9ab322f417e9d2ab1aa75d0a2ea | reg/migrations/0006_auto_20151023_1826.py | reg/migrations/0006_auto_20151023_1826.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('reg', '0005_auto_20150420_2353'),
]
operations = [
migrations.AlterField(
model_name='team',
name='l... | Make migrations for leader_email field of Team model | Make migrations for leader_email field of Team model
| Python | bsd-3-clause | stefantsov/blackbox3,stefantsov/blackbox3,stefantsov/blackbox3 | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('reg', '0005_auto_20150420_2353'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ ... | |
339a25141532b0831a2fcfb621a1a7b1d6e88ac8 | scripts/ingestors/rwis/archive_process_traffic.py | scripts/ingestors/rwis/archive_process_traffic.py | # Need something to process the archived monthly RWIS file provided by Tina
"""
Site number,sensor ID,lane ID,local date/time,2-minute av speed,total
vol,normal vol,long vol,headway (null),occupancy,
"""
import glob
import os
import mx.DateTime
import StringIO
from pyIEM import mesonet
import iemdb
RWIS = iemdb.connec... | Add an archive traffic processor, yippee | Add an archive traffic processor, yippee
| Python | mit | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | ---
+++
@@ -0,0 +1,72 @@
+# Need something to process the archived monthly RWIS file provided by Tina
+"""
+Site number,sensor ID,lane ID,local date/time,2-minute av speed,total
+vol,normal vol,long vol,headway (null),occupancy,
+"""
+
+import glob
+import os
+import mx.DateTime
+import StringIO
+from pyIEM import me... | |
dc181cd45adba6433c2422b9550e398c6385bca5 | shop/serializers/catalog.py | shop/serializers/catalog.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from cms.utils import get_current_site
from cms.utils.page import get_page_from_path
from django.core.urlresolvers import reverse
from filer.models.imagemodels import Image
from rest_framework import serializers
class CMSPagesField(serializers.Field):
... | Create M2M serializers for export/import of products | Create M2M serializers for export/import of products
| Python | bsd-3-clause | awesto/django-shop,divio/django-shop,divio/django-shop,awesto/django-shop,awesto/django-shop,divio/django-shop | ---
+++
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from cms.utils import get_current_site
+from cms.utils.page import get_page_from_path
+from django.core.urlresolvers import reverse
+from filer.models.imagemodels import Image
+from rest_framework import serializers
+
+
+cla... | |
0c69ade79a3e83024c69698a0cb3eae775d8082d | dbaas/workflow/steps/util/region_migration/check_instances_status.py | dbaas/workflow/steps/util/region_migration/check_instances_status.py | # -*- coding: utf-8 -*-
import logging
from util import full_stack
from workflow.steps.util.base import BaseStep
from workflow.exceptions.error_codes import DBAAS_0020
LOG = logging.getLogger(__name__)
class DecreaseTTL(BaseStep):
def __unicode__(self):
return "Checking instances status..."
def do(... | Remove unused imports and change exception handling | Remove unused imports and change exception handling
| Python | bsd-3-clause | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | ---
+++
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+import logging
+from util import full_stack
+from workflow.steps.util.base import BaseStep
+from workflow.exceptions.error_codes import DBAAS_0020
+
+LOG = logging.getLogger(__name__)
+
+
+class DecreaseTTL(BaseStep):
+
+ def __unicode__(self):
+ return "Ch... | |
0451142ecede6f899b97b28114843413332e3f0b | scripts/nplm-training/averageNullEmbedding_baseline.py | scripts/nplm-training/averageNullEmbedding_baseline.py | #!/usr/bin/env python2
import sys
import numpy
import optparse
#sys.path.append('/data/tools/nplm/python')
parser = optparse.OptionParser("%prog [options]")
parser.add_option("-p", "--nplm-python-path", type="string", dest="nplm_python_path")
parser.add_option("-i", "--input-model", type="string", dest="input_model")
... | Add null token normalization for models to be used with the chart decoder. | Add null token normalization for models to be used with the chart decoder.
| Python | lgpl-2.1 | alvations/mosesdecoder,emjotde/mosesdecoder_nmt,moses-smt/mosesdecoder,alvations/mosesdecoder,moses-smt/mosesdecoder,KonceptGeek/mosesdecoder,moses-smt/mosesdecoder,KonceptGeek/mosesdecoder,KonceptGeek/mosesdecoder,hychyc07/mosesdecoder,KonceptGeek/mosesdecoder,moses-smt/mosesdecoder,alvations/mosesdecoder,tofula/moses... | ---
+++
@@ -0,0 +1,44 @@
+#!/usr/bin/env python2
+import sys
+import numpy
+import optparse
+#sys.path.append('/data/tools/nplm/python')
+
+parser = optparse.OptionParser("%prog [options]")
+parser.add_option("-p", "--nplm-python-path", type="string", dest="nplm_python_path")
+parser.add_option("-i", "--input-model",... | |
983085ed78b157b5c1c2e525506a3221c7a3881a | problem_34.py | problem_34.py | from problem_20 import factorial
from time import time
def calculate_digit_factorials(start, end):
known_factorials = {}
digit_factorials = []
for num in range(start, end):
factorial_sum = 0
for digit in str(num):
if digit not in known_factorials:
known_factoria... | Add problem 34, digit factorials | Add problem 34, digit factorials
| Python | mit | dimkarakostas/project-euler | ---
+++
@@ -0,0 +1,23 @@
+from problem_20 import factorial
+from time import time
+
+
+def calculate_digit_factorials(start, end):
+ known_factorials = {}
+ digit_factorials = []
+ for num in range(start, end):
+ factorial_sum = 0
+ for digit in str(num):
+ if digit not in known_fact... | |
3dbc4715cba02850b8062c9db4d954cc913b7492 | blog/migrations/0008_remove_commenters_without_posts.py | blog/migrations/0008_remove_commenters_without_posts.py | from django.db import migrations
def remove_commenters_without_post(apps, schema_editor):
Commenter = apps.get_model('blog', 'Commenter')
Commenter.objects.filter(comments__isnull=True).delete()
class Migration(migrations.Migration):
dependencies = [
('blog', '0007_protect_articles_from_user_d... | Add a migration to remove garbage commenter objects | Add a migration to remove garbage commenter objects
| Python | bsd-2-clause | w0rp/w0rpzone,w0rp/w0rpzone,w0rp/w0rpzone,w0rp/w0rpzone | ---
+++
@@ -0,0 +1,22 @@
+from django.db import migrations
+
+
+def remove_commenters_without_post(apps, schema_editor):
+ Commenter = apps.get_model('blog', 'Commenter')
+
+ Commenter.objects.filter(comments__isnull=True).delete()
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('b... | |
24dd968202329c5f524645e764b9ad0c84324cdb | webapp/apps/taxbrain/migrations/0014_auto_20151124_2029.py | webapp/apps/taxbrain/migrations/0014_auto_20151124_2029.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import webapp.apps.taxbrain.models
class Migration(migrations.Migration):
dependencies = [
('taxbrain', '0013_auto_20151120_2141'),
]
operations = [
migrations.AddField(
... | Add migration for new field in TaxSaveInputs | Add migration for new field in TaxSaveInputs
| Python | mit | zrisher/webapp-public,zrisher/webapp-public,OpenSourcePolicyCenter/webapp-public,OpenSourcePolicyCenter/webapp-public,zrisher/webapp-public,OpenSourcePolicyCenter/PolicyBrain,OpenSourcePolicyCenter/PolicyBrain,OpenSourcePolicyCenter/webapp-public,OpenSourcePolicyCenter/PolicyBrain,zrisher/webapp-public,OpenSourcePolicy... | ---
+++
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import webapp.apps.taxbrain.models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('taxbrain', '0013_auto_20151120_2141'),
+ ]
+
+ operations = [
... | |
8c1785e9df05c4c37a66efa12919e59eefb08672 | client/comet/server.py | client/comet/server.py | #!/usr/bin/python
import httplib
con = httplib.HTTPConnection("kevinwells.homeip.net", 8082)
con.connect()
params = {
"Host": "kevinwells.homeip.net:8082",
"User-Agent": "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12",
"Accept": "text/html,application/xhtml+... | Add simple client that gets a url from Etherpad. | Add simple client that gets a url from Etherpad.
Signed-off-by: Kevin Wells <ddbad7bcca2214e131304d62ab73c459da56f690@rose-hulman.edu>
| Python | apache-2.0 | PolicyStat/PolicyPad,PolicyStat/PolicyPad,PolicyStat/PolicyPad | ---
+++
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+
+import httplib
+
+con = httplib.HTTPConnection("kevinwells.homeip.net", 8082)
+con.connect()
+params = {
+"Host": "kevinwells.homeip.net:8082",
+"User-Agent": "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12",
+"A... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.