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 |
|---|---|---|---|---|---|---|---|---|---|---|
dec55dcd877f026ce38c728df0bdcb26ac89f361 | tests/test_dtool_dataset_copy.py | tests/test_dtool_dataset_copy.py | """Test the ``dtool dataset copy`` command."""
import os
from click.testing import CliRunner
from dtoolcore import DataSet, ProtoDataSet
from . import chdir_fixture, tmp_dir_fixture # NOQA
def test_dataset_copy_functional(chdir_fixture): # NOQA
from dtool_create.dataset import create, freeze, add, copy
... | Add 'dtool copy' functional test | Add 'dtool copy' functional test
| Python | mit | jic-dtool/dtool-create | ---
+++
@@ -0,0 +1,55 @@
+"""Test the ``dtool dataset copy`` command."""
+
+import os
+
+from click.testing import CliRunner
+
+from dtoolcore import DataSet, ProtoDataSet
+
+from . import chdir_fixture, tmp_dir_fixture # NOQA
+
+
+def test_dataset_copy_functional(chdir_fixture): # NOQA
+ from dtool_create.datas... | |
7f0086f966a2403fb8c653b5f897b73ab1fc4b88 | tests/integration/test_sts.py | tests/integration/test_sts.py | # Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | Add integration test for sts regionalization | Add integration test for sts regionalization
| Python | apache-2.0 | pplu/botocore,boto/botocore | ---
+++
@@ -0,0 +1,31 @@
+# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
+# the License is located at
+#
+# http://aws.amazon.com/apache2.0/
+#... | |
35f267249955b4c09cbf4432e452dc987488454e | tests/test_session.py | tests/test_session.py | #!/usr/bin/env python
# coding=utf-8
try:
import unittest.mock as mock
except ImportError:
import mock
import unittest
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from nessusapi.session import Session
from nessusapi.session import Request
class SessionTestCase(unit... | Add basic tests for session | Add basic tests for session
| Python | mit | sait-berkeley-infosec/pynessus-api | ---
+++
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+# coding=utf-8
+
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
+import unittest
+try:
+ from StringIO import StringIO
+except ImportError:
+ from io import StringIO
+
+from nessusapi.session import Session
+from nessusapi.session ... | |
11f78d16c22a3bdf56ffaf87f68eb226e418140d | examples/aws_product_advertising.py | examples/aws_product_advertising.py | #!/usr/bin/env python3
'''
Amazon Product Advertising API Client
'''
from xml.etree import ElementTree
import urllib.parse
import dewpoint.aws
import sys
def camel_case(name):
parts = []
for part in name.split('_'):
parts.append(part[0].upper() + part[1:])
return ''.join(parts)
class ProductAdve... | Add example for AWS Product Advertising API | Add example for AWS Product Advertising API
| Python | bsd-2-clause | JeremyGrosser/dewpoint | ---
+++
@@ -0,0 +1,70 @@
+#!/usr/bin/env python3
+'''
+Amazon Product Advertising API Client
+'''
+from xml.etree import ElementTree
+import urllib.parse
+import dewpoint.aws
+import sys
+
+
+def camel_case(name):
+ parts = []
+ for part in name.split('_'):
+ parts.append(part[0].upper() + part[1:])
+ ... | |
a97371e013a8907c2f3c79303197aeb149402ba6 | ideascube/conf/idb_fra_sarcelles.py | ideascube/conf/idb_fra_sarcelles.py | # -*- coding: utf-8 -*-
"""Ideaxbox for Sarcelles, France"""
from .idb import * # noqa
from django.utils.translation import ugettext_lazy as _
IDEASCUBE_NAME = u"Sarcelles"
IDEASCUBE_PLACE_NAME = _("city")
COUNTRIES_FIRST = ['FR']
TIME_ZONE = None
LANGUAGE_CODE = 'fr'
LOAN_DURATION = 14
MONITORING_ENTRY_EXPORT_FIELDS... | Add conf file for Sarcelles, FR. | Add conf file for Sarcelles, FR.
| Python | agpl-3.0 | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ---
+++
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+"""Ideaxbox for Sarcelles, France"""
+from .idb import * # noqa
+from django.utils.translation import ugettext_lazy as _
+
+IDEASCUBE_NAME = u"Sarcelles"
+IDEASCUBE_PLACE_NAME = _("city")
+COUNTRIES_FIRST = ['FR']
+TIME_ZONE = None
+LANGUAGE_CODE = 'fr'
+LOAN_DURATI... | |
80ea3719a01f8e3017796fbcb075fc5d21ed8bc5 | cla_public/apps/base/tests/test_healthchecks.py | cla_public/apps/base/tests/test_healthchecks.py | import unittest
import mock
from cla_public.apps.base import healthchecks
class DiskSpaceHealthcheckTest(unittest.TestCase):
@mock.patch('os.statvfs')
def test_disk_space_check_reports_on_available_and_total_space(self, stat_mock):
stat_mock.return_value.f_bavail = 50 * 1024
stat_mock.return_... | Add disk space healthcheck test | Add disk space healthcheck test
| Python | mit | ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public | ---
+++
@@ -0,0 +1,36 @@
+import unittest
+import mock
+
+from cla_public.apps.base import healthchecks
+
+
+class DiskSpaceHealthcheckTest(unittest.TestCase):
+ @mock.patch('os.statvfs')
+ def test_disk_space_check_reports_on_available_and_total_space(self, stat_mock):
+ stat_mock.return_value.f_bavail ... | |
2cbf4c844bb2fc92504aa60a448265fc5c291e9f | sauna/plugins/ext/apt.py | sauna/plugins/ext/apt.py | from sauna.plugins import Plugin, PluginRegister
my_plugin = PluginRegister('Apt')
@my_plugin.plugin()
class AptPlugin(Plugin):
def __init__(self, config):
super().__init__(config)
try:
import apt
self._apt = apt
except ImportError:
from ... import Dep... | Add APT plugin to alert of Debian security updates | Add APT plugin to alert of Debian security updates
| Python | bsd-2-clause | NicolasLM/sauna,NicolasLM/sauna | ---
+++
@@ -0,0 +1,76 @@
+from sauna.plugins import Plugin, PluginRegister
+
+my_plugin = PluginRegister('Apt')
+
+
+@my_plugin.plugin()
+class AptPlugin(Plugin):
+
+ def __init__(self, config):
+ super().__init__(config)
+ try:
+ import apt
+ self._apt = apt
+ except Imp... | |
04c786d973bdeb99e0e327ec1f0ebb377fb139e0 | run_server.py | run_server.py | # -*- coding: UTF-8 -*-
from picar import app
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=8080, master=True, processes=1)
| Add script to run server | Add script to run server
| Python | apache-2.0 | lukaszo/picar_worhshop,lukaszo/picar_worhshop,lukaszo/picar_worhshop,lukaszo/picar_worhshop | ---
+++
@@ -0,0 +1,6 @@
+# -*- coding: UTF-8 -*-
+from picar import app
+
+
+if __name__ == '__main__':
+ app.run(debug=True, host='0.0.0.0', port=8080, master=True, processes=1) | |
c8c439b92e3f466da58ab1a0c2b8ff3bf9242bf4 | mqtt/tests/test_client.py | mqtt/tests/test_client.py | import time
from django.test import TestCase
from django.contrib.auth.models import User
from django.conf import settings
from rest_framework.renderers import JSONRenderer
from rest_framework.parsers import JSONParser
from io import BytesIO
import json
from login.models import Profile, AmbulancePermission, HospitalP... | Add more time to mqtt.test.client | Add more time to mqtt.test.client
| Python | bsd-3-clause | EMSTrack/WebServerAndClient,EMSTrack/WebServerAndClient,EMSTrack/WebServerAndClient | ---
+++
@@ -0,0 +1,36 @@
+import time
+from django.test import TestCase
+
+from django.contrib.auth.models import User
+from django.conf import settings
+
+from rest_framework.renderers import JSONRenderer
+from rest_framework.parsers import JSONParser
+from io import BytesIO
+import json
+
+from login.models import ... | |
7dd898309e81feb686220757a740b6b7b934462d | pipelines/genome_merge.py | pipelines/genome_merge.py | import os
import luigi
import json
import subprocess
from support import merge_fasta as mf
# add parent directory to path
if __name__ == '__main__' and __package__ is None:
os.sys.path.append(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# ----------------------------------TASKS----------... | Add first version of genome merge pipeline | Add first version of genome merge pipeline
| Python | apache-2.0 | Rfam/rfam-production,Rfam/rfam-production,Rfam/rfam-production | ---
+++
@@ -0,0 +1,91 @@
+import os
+import luigi
+import json
+import subprocess
+
+from support import merge_fasta as mf
+
+# add parent directory to path
+if __name__ == '__main__' and __package__ is None:
+ os.sys.path.append(
+ os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+# ---------... | |
b7fac69907e004d02554ccf0f151c7247d464c1b | src/TinyIDS/collector.py | src/TinyIDS/collector.py | # -*- coding: utf-8 -*-
#
# This file is part of TinyIDS.
#
# TinyIDS is a distributed Intrusion Detection System (IDS) for Unix systems.
#
# Project development web site:
#
# http://www.codetrax.org/projects/tinyids
#
# Copyright (c) 2010 George Notaras, G-Loaded.eu, CodeTRAX.org
#
# Licensed under the Apac... | Define a first concept of the backend API | Define a first concept of the backend API
| Python | apache-2.0 | rafaelang/tinyids | ---
+++
@@ -0,0 +1,79 @@
+# -*- coding: utf-8 -*-
+#
+# This file is part of TinyIDS.
+#
+# TinyIDS is a distributed Intrusion Detection System (IDS) for Unix systems.
+#
+# Project development web site:
+#
+# http://www.codetrax.org/projects/tinyids
+#
+# Copyright (c) 2010 George Notaras, G-Loaded.eu, Cod... | |
4a7f47bec8c3089df988ffcf03a27fb2225b2259 | services/migrations/0008_auto_20170505_1805.py | services/migrations/0008_auto_20170505_1805.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-05-05 18:05
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('services', '0007_auto_20161112_1406'),
]
operation... | Set up edit service serializers | Set up edit service serializers
| Python | mit | Semillas/semillas_backend,Semillas/semillas_platform,Semillas/semillas_platform,Semillas/semillas_backend,Semillas/semillas_backend,Semillas/semillas_platform,Semillas/semillas_backend,Semillas/semillas_platform | ---
+++
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.6 on 2017-05-05 18:05
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('services', '0007_aut... | |
85015343fd99885ec00db86b4e3705bcc25e62f1 | test/requests/run-integration-tests.py | test/requests/run-integration-tests.py | import sys
from test_login_local import TestLoginLocal
from test_registration import TestRegistration
from unittest import TestSuite, TextTestRunner, TestLoader
test_cases = [
TestLoginLocal,
TestRegistration
]
def suite(gn2_url, es_url):
the_suite = TestSuite()
for case in test_cases:
the_sui... | Add a runner for all integration tests. | Add a runner for all integration tests.
| Python | agpl-3.0 | zsloan/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,DannyArends/genenetwork2,DannyArends/genenetwork2,genenetwork/genenetwork2,zsloan/genenetwork2,DannyArends/genenetwork2,genenetwork/genenetwork2,DannyArends/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,DannyArends/genenetwork2,pjotrp/genenetwork2,zsloa... | ---
+++
@@ -0,0 +1,30 @@
+import sys
+from test_login_local import TestLoginLocal
+from test_registration import TestRegistration
+from unittest import TestSuite, TextTestRunner, TestLoader
+
+test_cases = [
+ TestLoginLocal,
+ TestRegistration
+]
+
+def suite(gn2_url, es_url):
+ the_suite = TestSuite()
+ ... | |
ff3a6b35e85058c711a056401b7c3e2d7c7b1260 | crmapp/accounts/forms.py | crmapp/accounts/forms.py | from django import forms
from .models import Account
class AccountForm(forms.ModelForm):
class Meta:
model = Account
fields = ('name', 'desc', 'address_one',
'address_two', 'city', 'state', 'phone',
)
widgets = {
'name': forms.TextInput(
... | Create the Account Detail Page - Part II > New Account - Create Form | Create the Account Detail Page - Part II > New Account - Create Form
| Python | mit | deenaariff/Django,tabdon/crmeasyapp,tabdon/crmeasyapp | ---
+++
@@ -0,0 +1,54 @@
+from django import forms
+
+from .models import Account
+
+class AccountForm(forms.ModelForm):
+ class Meta:
+ model = Account
+ fields = ('name', 'desc', 'address_one',
+ 'address_two', 'city', 'state', 'phone',
+ )
+ widgets = {
+ ... | |
6a605b47ef4170dcb35040cac9c18c5407f041ae | erpnext/patches/remove_extra_button_from_email_digest.py | erpnext/patches/remove_extra_button_from_email_digest.py | def execute():
import webnotes
webnotes.conn.sql("""
DELETE FROM tabDocField
WHERE parent = 'Email Digest'
AND label = 'Add Recipients'
AND fieldtype = 'Button'""")
| Patch to remove 'Add Recipients' button from Email Digest form | Patch to remove 'Add Recipients' button from Email Digest form
| Python | agpl-3.0 | indictranstech/reciphergroup-erpnext,Tejal011089/osmosis_erpnext,susuchina/ERPNEXT,SPKian/Testing,mbauskar/sapphire-erpnext,Suninus/erpnext,gangadharkadam/johnerp,SPKian/Testing,treejames/erpnext,Tejal011089/fbd_erpnext,Yellowen/Owrang,suyashphadtare/gd-erp,gangadharkadam/verveerp,gangadhar-kadam/hrerp,4commerce-techno... | ---
+++
@@ -0,0 +1,8 @@
+def execute():
+ import webnotes
+ webnotes.conn.sql("""
+ DELETE FROM tabDocField
+ WHERE parent = 'Email Digest'
+ AND label = 'Add Recipients'
+ AND fieldtype = 'Button'""")
+ | |
d230a6bdb62a5c6e70dbc57921478f7fb224b534 | tests/profile/test_SampleExpectationsDatasetProfiler.py | tests/profile/test_SampleExpectationsDatasetProfiler.py | import json
import os
from collections import OrderedDict
import pytest
from six import PY2
import great_expectations as ge
from great_expectations.data_context.util import file_relative_path
from great_expectations.dataset.pandas_dataset import PandasDataset
from great_expectations.datasource import PandasDatasource... | Add test module for SampleExpectationsDatasetProfiler | Add test module for SampleExpectationsDatasetProfiler
- add test__find_next_low_card_column
| Python | apache-2.0 | great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations | ---
+++
@@ -0,0 +1,34 @@
+import json
+import os
+from collections import OrderedDict
+
+import pytest
+from six import PY2
+
+import great_expectations as ge
+from great_expectations.data_context.util import file_relative_path
+from great_expectations.dataset.pandas_dataset import PandasDataset
+from great_expectati... | |
3850f29d7dc53ffa53a7f08e0ea96d174259273f | examples/offline_examples/load_html_test.py | examples/offline_examples/load_html_test.py | import pytest
from seleniumbase import BaseCase
@pytest.mark.offline # Can be run with: "pytest -m offline"
class OfflineTests(BaseCase):
def test_load_html_string(self):
html = "<h2>Hello</h2><p><input /> <button>OK!</button></p>"
self.load_html_string(html) # Open "data:te... | Add example tests for "load_html_string()" and "set_content()" | Add example tests for "load_html_string()" and "set_content()"
| Python | mit | mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase | ---
+++
@@ -0,0 +1,21 @@
+import pytest
+from seleniumbase import BaseCase
+
+
+@pytest.mark.offline # Can be run with: "pytest -m offline"
+class OfflineTests(BaseCase):
+
+ def test_load_html_string(self):
+ html = "<h2>Hello</h2><p><input /> <button>OK!</button></p>"
+ self.load_html_s... | |
f9efd374d11faf709e37bbee05d4735ab94c4b46 | tests/strings/string_format_combined_simple.py | tests/strings/string_format_combined_simple.py | a = "well"
b = "seems to work"
c = "something else"
d = 10
f = 15
s = "%s: %d, %s: %d, %s: %d" % (a, d, b, f, c, d)
print s
| Add combined string formatting test | Add combined string formatting test
| Python | mit | mattpap/py2js,buchuki/pyjaco,chrivers/pyjaco,buchuki/pyjaco,buchuki/pyjaco,mattpap/py2js,qsnake/py2js,chrivers/pyjaco,chrivers/pyjaco,qsnake/py2js | ---
+++
@@ -0,0 +1,8 @@
+a = "well"
+b = "seems to work"
+c = "something else"
+d = 10
+f = 15
+
+s = "%s: %d, %s: %d, %s: %d" % (a, d, b, f, c, d)
+print s | |
eba23f8dc96e9f14a27b813313f579b6b9146f09 | senlin/tests/functional/test_profile_type.py | senlin/tests/functional/test_profile_type.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 functional test for listing profile_type | Add functional test for listing profile_type
This patch adds a functional test case for listing Senlin profile
types.
Change-Id: I2510e3d0d7d3b9a216019dc1fda6aebe4a25e2fd
| Python | apache-2.0 | openstack/senlin,Alzon/senlin,Alzon/senlin,openstack/senlin,stackforge/senlin,tengqm/senlin-container,stackforge/senlin,openstack/senlin,tengqm/senlin-container | ---
+++
@@ -0,0 +1,27 @@
+# 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... | |
e01eb8dd1fa7e79a176cc1017cff0e3b2e619540 | algorithms/a_star_tree_manhattan_distance.py | algorithms/a_star_tree_manhattan_distance.py | """
pynpuzzle - Solve n-puzzle with Python
A* tree search algorithm using manhattan distance heuristic
Version : 1.0.0
Author : Hamidreza Mahdavipanah
Repository: http://github.com/mahdavipanah/pynpuzzle
License : MIT License
"""
import heapq
from .util import best_first_seach as bfs
def search(state, goal_state):
... | Add a* tree search algorithm using manhattan distance heuristic | Add a* tree search algorithm using manhattan distance heuristic
| Python | mit | mahdavipanah/pynpuzzle | ---
+++
@@ -0,0 +1,38 @@
+"""
+pynpuzzle - Solve n-puzzle with Python
+
+A* tree search algorithm using manhattan distance heuristic
+
+Version : 1.0.0
+Author : Hamidreza Mahdavipanah
+Repository: http://github.com/mahdavipanah/pynpuzzle
+License : MIT License
+"""
+import heapq
+from .util import best_first_seach a... | |
bef7208ea4bbaa26638f8ab22148b2c63fed5a2a | blast-search.py | blast-search.py | import os
import re
import sets
import glob
import logging
import MySQLdb
import library.genbank
logging.basicConfig(level=logging.INFO)
from Bio import Entrez, SeqIO, SearchIO
from Bio.Blast import NCBIWWW, NCBIXML
### A few import static variables
library.genbank.email = 'me@my.address.com'
print "\n\nGetting a... | Split the blast search functionality from the compare feature to compartmentalize time heavy features. | Split the blast search functionality from the compare feature to compartmentalize time heavy features.
| Python | bsd-3-clause | lcoghill/phyloboost,lcoghill/phyloboost,lcoghill/phyloboost | ---
+++
@@ -0,0 +1,50 @@
+import os
+import re
+import sets
+import glob
+import logging
+import MySQLdb
+import library.genbank
+logging.basicConfig(level=logging.INFO)
+from Bio import Entrez, SeqIO, SearchIO
+from Bio.Blast import NCBIWWW, NCBIXML
+
+### A few import static variables
+library.genbank.email = 'me@m... | |
d4522ad74add7848cfddb25bfcab656a7d47730e | src/auditlog/migrations/0003_logentry_detailed_object_repr.py | src/auditlog/migrations/0003_logentry_detailed_object_repr.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('auditlog', '0002_auto_support_long_primary_keys'),
]
operations = [
migrations.AddField(
... | Add migration for detailed_object_repr field | Add migration for detailed_object_repr field
| Python | mit | jjkester/django-auditlog,johnrtipton/django-auditlog,rauleb/django-auditlog,chris-griffin/django-auditlog,robmagee/django-auditlog,Zmeylol/auditlog,kbussell/django-auditlog | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import jsonfield.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('auditlog', '0002_auto_support_long_primary_keys'),
+ ]
+
+ operations = [... | |
29467c4a52bb5caf492460b70cb58caf5fe8f728 | calaccess_processed/management/commands/loadocdmodels.py | calaccess_processed/management/commands/loadocdmodels.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Load data extracted from scrape and raw data snapshot into OCD models.
"""
from django.apps import apps
from django.utils.timezone import now
from django.core.management import call_command
from calaccess_processed.models import ProcessedDataVersion
from calaccess_proce... | Create ProcessedDataModels for OCD models, group loading into one cmd | Create ProcessedDataModels for OCD models, group loading into one cmd
| Python | mit | california-civic-data-coalition/django-calaccess-processed-data,california-civic-data-coalition/django-calaccess-processed-data | ---
+++
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+Load data extracted from scrape and raw data snapshot into OCD models.
+"""
+from django.apps import apps
+from django.utils.timezone import now
+from django.core.management import call_command
+from calaccess_processed.models import Proc... | |
af6f37dd7ccc38d788614a033440a9dafdabb884 | nysa/ibuilder/lib/gen_scripts/gen_sim_tb.py | nysa/ibuilder/lib/gen_scripts/gen_sim_tb.py | import sys
import os
import string
import copy
from string import Template
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
import sim_utils as sutils
import gen_sim_top
from gen import Gen
class GenSimTop(Gen):
def __init__(self):
return
def get_name (self):
print "gene... | ADD script to generate test bench | ADD script to generate test bench
| Python | mit | CospanDesign/nysa,CospanDesign/nysa | ---
+++
@@ -0,0 +1,26 @@
+import sys
+import os
+import string
+import copy
+from string import Template
+
+sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
+import sim_utils as sutils
+
+import gen_sim_top
+
+from gen import Gen
+
+class GenSimTop(Gen):
+
+ def __init__(self):
+ return
+... | |
5e1ec7c300126ddec9976c7441cb255d36c36904 | tools/rename_code.py | tools/rename_code.py | #!/bin/env python3
import os
import re
import sys
if len(sys.argv) < 2 :#or sys.argv[1] == "--help":
print("rename_code.py <source_code_directory>")
print("Update python code to new style.")
sys.exit(0)
old_names = set()
class_names = set()
for (dir, dirs, files) in os.walk(sys.argv[1]):
if dir == ".... | Add tool to update method names. | Add tool to update method names.
| Python | apache-2.0 | google/ci_edit,google/ci_edit,google/ci_edit | ---
+++
@@ -0,0 +1,58 @@
+#!/bin/env python3
+
+import os
+import re
+import sys
+
+if len(sys.argv) < 2 :#or sys.argv[1] == "--help":
+ print("rename_code.py <source_code_directory>")
+ print("Update python code to new style.")
+ sys.exit(0)
+
+old_names = set()
+class_names = set()
+for (dir, dirs, files) ... | |
1738872044ce26576b50895bee32a9933a5787cc | tools/touch_all_files.py | tools/touch_all_files.py | #!/usr/bin/python
"""
This script touches all files known to the database, creating a skeletal
mirror for local development.
"""
import sys, os
import store
def get_paths(cursor, prefix=None):
store.safe_execute(cursor, "SELECT python_version, name, filename FROM release_files")
for type, name, filename in c... | Add script to synthesize all uploaded files. Patch by Dan Callahan. | Add script to synthesize all uploaded files.
Patch by Dan Callahan.
| Python | bsd-3-clause | pydotorg/pypi,pydotorg/pypi,pydotorg/pypi,pydotorg/pypi | ---
+++
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+"""
+This script touches all files known to the database, creating a skeletal
+mirror for local development.
+"""
+
+import sys, os
+import store
+
+def get_paths(cursor, prefix=None):
+ store.safe_execute(cursor, "SELECT python_version, name, filename FROM release_file... | |
2263af5f5aad3c787e566a629bf8ab6b1a1a36d6 | generate-abuse.py | generate-abuse.py | #!/usr/bin/env python
import sys
import random
from abuse.parse import parse
from abuse.generate import generate
from abuse.generate import RuleSet
class RandomSelector(object):
def select(self, lower, upper):
return random.randint(lower, upper - 1)
rule_set = RuleSet()
parse(open(sys.argv[1]).read(), r... | Add script to read file and generate abuse | Add script to read file and generate abuse
| Python | bsd-2-clause | mwilliamson/abuse,mwilliamson/abuse | ---
+++
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+
+import sys
+import random
+
+from abuse.parse import parse
+from abuse.generate import generate
+from abuse.generate import RuleSet
+
+class RandomSelector(object):
+ def select(self, lower, upper):
+ return random.randint(lower, upper - 1)
+
+rule_set = Ru... | |
13b5e76f80bf3364e1609e97970117c7b980c359 | usability/codefolding/codefoldingpreprocessor.py | usability/codefolding/codefoldingpreprocessor.py | """This preprocessor removes lines in code cells that have been marked as `folded`
by the codefolding extension
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2014, Juergen Hasch
#
# Distributed under the terms of the Modified BSD License.
#
#------------------------... | Add preprocessor for codefolding extension | Add preprocessor for codefolding extension
Thes preprocessor removes folded lines in codecells as defined by the
cell metadata
| Python | bsd-3-clause | andyneff/IPython-notebook-extensions,benvarkey/IPython-notebook-extensions,juhasch/IPython-notebook-extensions,davande/IPython-notebook-extensions,jbn/IPython-notebook-extensions,jcb91/IPython-notebook-extensions,motleytech/IPython-notebook-extensions,Konubinix/IPython-notebook-extensions,andyneff/IPython-notebook-exte... | ---
+++
@@ -0,0 +1,61 @@
+"""This preprocessor removes lines in code cells that have been marked as `folded`
+by the codefolding extension
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2014, Juergen Hasch
+#
+# Distributed under the terms of the Modified BSD L... | |
306d4a11681ac34e5241059dc165d69725f46472 | tests/functional/preview_and_dev/test_notify_api_letter.py | tests/functional/preview_and_dev/test_notify_api_letter.py | from retry.api import retry_call
from config import Config
from tests.postman import (
send_notification_via_api,
get_notification_by_id_via_api,
NotificationStatuses
)
from tests.test_utils import assert_notification_body, recordtime
@recordtime
def test_send_letter_notification_via_api(profile, seeded... | Test creating letter notification via API | Test creating letter notification via API
| Python | mit | alphagov/notifications-functional-tests,alphagov/notifications-functional-tests | ---
+++
@@ -0,0 +1,26 @@
+from retry.api import retry_call
+from config import Config
+
+from tests.postman import (
+ send_notification_via_api,
+ get_notification_by_id_via_api,
+ NotificationStatuses
+)
+
+from tests.test_utils import assert_notification_body, recordtime
+
+
+@recordtime
+def test_send_le... | |
c0d2550e4cfb647b21e6fdde9705fe6e4a76a2df | Lambda/Functions/TagEC2Dependencies/tag_ec2_dependencies.py | Lambda/Functions/TagEC2Dependencies/tag_ec2_dependencies.py | '''
Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
http://aws.amazon.com/apache2.0/
or in the "license" file accompanying t... | Add tag EC2 dependencies Lambda Python code. | Add tag EC2 dependencies Lambda Python code.
| Python | apache-2.0 | rsavordelli/aws-support-tools,rsavordelli/aws-support-tools,rsavordelli/aws-support-tools,rsavordelli/aws-support-tools,rsavordelli/aws-support-tools,rsavordelli/aws-support-tools | ---
+++
@@ -0,0 +1,78 @@
+'''
+Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
+
+ http://aws.amazon.com/apache2.0/
+
+or ... | |
944379d74969a17fa85cb05c5541d3d569764097 | studygroups/management/commands/fix_course_created_by.py | studygroups/management/commands/fix_course_created_by.py | from django.core.management.base import BaseCommand, CommandError
from studygroups.models import Course
from django.contrib.auth.models import User
class Command(BaseCommand):
help = 'Add a created_by field to all courses'
def handle(self, *args, **options):
user1 = User.objects.get(pk=1324)
... | Add task to fix created_by for courses without it | Add task to fix created_by for courses without it
| Python | mit | p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles | ---
+++
@@ -0,0 +1,14 @@
+from django.core.management.base import BaseCommand, CommandError
+
+from studygroups.models import Course
+from django.contrib.auth.models import User
+
+class Command(BaseCommand):
+ help = 'Add a created_by field to all courses'
+
+ def handle(self, *args, **options):
+ user1... | |
bf7f3dfa737c01a441064d4dad0be3978fe1e2c5 | jetson/networkTable.py | jetson/networkTable.py | import time
from networktables import NetworkTables
rioIP = '10.58.06.2' #this shouldn't change
tableName = 'JetsonToRio' #should be same in rio's java NT program
updateRateSecs = 1
#initialize Jetson as client to the roborio server
NetworkTables.initialize(server=rioIP)
table = NetworkTables.getTable(tableName)
w... | Add @njk345's initial work on networktables | Add @njk345's initial work on networktables
| Python | mit | frc5806/Steamworks,frc5806/Steamworks,frc5806/Steamworks,frc5806/Steamworks | ---
+++
@@ -0,0 +1,25 @@
+import time
+from networktables import NetworkTables
+
+rioIP = '10.58.06.2' #this shouldn't change
+tableName = 'JetsonToRio' #should be same in rio's java NT program
+updateRateSecs = 1
+
+#initialize Jetson as client to the roborio server
+NetworkTables.initialize(server=rioIP)
+
+table ... | |
16104da5676ea7f62bd85c69df9afe5305125c79 | kitnirc/contrib/freenode.py | kitnirc/contrib/freenode.py | import logging
from kitnirc.modular import Module
_log = logging.getLogger(__name__)
class FreenodeModule(Module):
"""A KitnIRC module which provides Freenode-specific functionality.
Freenode is irc.freenode.net and runs ircd-seven, a Freenode-specific
branch of the charybdis ircd. Functionality provi... | Add the Freenode module to contrib. | Add the Freenode module to contrib.
| Python | mit | ayust/kitnirc | ---
+++
@@ -0,0 +1,42 @@
+import logging
+
+from kitnirc.modular import Module
+
+
+_log = logging.getLogger(__name__)
+
+
+class FreenodeModule(Module):
+ """A KitnIRC module which provides Freenode-specific functionality.
+
+ Freenode is irc.freenode.net and runs ircd-seven, a Freenode-specific
+ branch of... | |
81467f6cfd238dcfea5b4c60954bb8584f5d659d | files/scripts/replacefilesinalfresco.py | files/scripts/replacefilesinalfresco.py | import os, shutil
def copyFile(src, dest):
try:
shutil.copy(src, dest)
# eg. src and dest are the same file
except shutil.Error as e:
print('Error: %s' % e)
# eg. source or destination doesn't exist
except IOError as e:
print('Error: %s' % e.strerror)
sourcefavicon = "/opt/... | Add script to sort graphics | Add script to sort graphics
| Python | mit | marsbard/puppet-alfresco,marsbard/puppet-alfresco,digcat/puppet-alfresco,digcat/puppet-alfresco,marsbard/puppet-alfresco,marsbard/puppet-alfresco,digcat/puppet-alfresco,digcat/puppet-alfresco,marsbard/puppet-alfresco,digcat/puppet-alfresco | ---
+++
@@ -0,0 +1,36 @@
+import os, shutil
+
+def copyFile(src, dest):
+ try:
+ shutil.copy(src, dest)
+ # eg. src and dest are the same file
+ except shutil.Error as e:
+ print('Error: %s' % e)
+ # eg. source or destination doesn't exist
+ except IOError as e:
+ print('Error: %s'... | |
9f087d3a25839719b080ed1170084196a8e476bd | main.py | main.py | from ctypes import *
SOFT_DOG_DATA_SIZE = 256
SOFT_DOG_LIBRARY = "win32dll.dll"
def LOGE(message):
print message
def LOGI(message):
print message
def checkSoftDogLibraryIsExist():
LOGI(SOFT_DOG_LIBRARY + " is exist.")
return True
def _readSoftDogData(outBuffer):
# TODO
# Check SOFT_DOG_LIBRARY if is exits.
... | Add read soft dog data function. | Add read soft dog data function.
Signed-off-by: Yunchao Chen <c67c666c8087d4aedc12b7d32092a3c04fc5fd4b@xiaoyezi.com>
| Python | mit | iiiCode/network-diagnostic-tools | ---
+++
@@ -0,0 +1,58 @@
+from ctypes import *
+
+SOFT_DOG_DATA_SIZE = 256
+SOFT_DOG_LIBRARY = "win32dll.dll"
+
+def LOGE(message):
+ print message
+
+def LOGI(message):
+ print message
+
+def checkSoftDogLibraryIsExist():
+ LOGI(SOFT_DOG_LIBRARY + " is exist.")
+ return True
+
+def _readSoftDogData(outBuffer):
+
+ #... | |
3512a5cf05a1063375ad394d79ce6824fe4c66ef | src/ggrc/migrations/versions/20150611124244_1d1e9807c46c_drop_is_enabled_column.py | src/ggrc/migrations/versions/20150611124244_1d1e9807c46c_drop_is_enabled_column.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
"""Drop is_enabled column
Revision ID: 1d1e9807c46c
Revises: 3261848aaa2b
Creat... | Drop is_enabled column from people table | Drop is_enabled column from people table
| Python | apache-2.0 | andrei-karalionak/ggrc-core,hyperNURb/ggrc-core,andrei-karalionak/ggrc-core,edofic/ggrc-core,AleksNeStu/ggrc-core,prasannav7/ggrc-core,prasannav7/ggrc-core,NejcZupec/ggrc-core,selahssea/ggrc-core,jmakov/ggrc-core,hyperNURb/ggrc-core,selahssea/ggrc-core,hasanalom/ggrc-core,josthkko/ggrc-core,andrei-karalionak/ggrc-core,... | ---
+++
@@ -0,0 +1,32 @@
+# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
+# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
+# Created By: anze@reciprocitylabs.com
+# Maintained By: anze@reciprocitylabs.com
+
+"""Drop is_enabled column
+
+Revision ID: 1d1e9... | |
bb1ce3c92de3ad1390034db2c916d1b82e65c70c | project/user/tests/test_login_manager.py | project/user/tests/test_login_manager.py | # !/usr/bin/python
# -*- coding: utf-8 -*-
from project.tests.base import UtilsTestCase
import base64
import project.home.login_manager as lm
class LoginManagerUtilsTestCase(UtilsTestCase):
def setUp(self):
super(LoginManagerUtilsTestCase, self).setUp()
self.user = self.create_user(is_admin=True)... | Refactor location of tests for login_manager.py | Refactor location of tests for login_manager.py
| Python | mit | andreffs18/flask-template-project,andreffs18/flask-template-project,andreffs18/flask-template-project | ---
+++
@@ -0,0 +1,58 @@
+# !/usr/bin/python
+# -*- coding: utf-8 -*-
+from project.tests.base import UtilsTestCase
+import base64
+import project.home.login_manager as lm
+
+
+class LoginManagerUtilsTestCase(UtilsTestCase):
+
+ def setUp(self):
+ super(LoginManagerUtilsTestCase, self).setUp()
+ self... | |
39b771089507b6c510837808018125f0e6adf611 | opps/images/widgets.py | opps/images/widgets.py | from django import forms
from django.conf import settings
from django.template.loader import render_to_string
class MultipleUpload(forms.FileInput):
def render(self, name, value, attrs=None):
_value = ""
if value:
_value = "{0}{1}".format(settings.MEDIA_URL, value)
return rend... | Create form widget multiple upload | Create form widget multiple upload
| Python | mit | jeanmask/opps,opps/opps,jeanmask/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,opps/opps,opps/opps,YACOWS/opps,williamroot/opps,williamroot/opps,opps/opps,jeanmask/opps | ---
+++
@@ -0,0 +1,14 @@
+from django import forms
+from django.conf import settings
+from django.template.loader import render_to_string
+
+
+class MultipleUpload(forms.FileInput):
+
+ def render(self, name, value, attrs=None):
+ _value = ""
+ if value:
+ _value = "{0}{1}".format(settings... | |
47ea6eab0d224f80caad1cf2bc0cec7081562b52 | stdnum/us/atin.py | stdnum/us/atin.py | # atin.py - functions for handling ATINs
#
# Copyright (C) 2013 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) ... | Add a United States ATIN module | Add a United States ATIN module
An Adoption Taxpayer Identification Number (ATIN) is a temporary
nine-digit number issued by the United States IRS for a child for whom
the adopting parents cannot obtain a Social Security Number.
| Python | lgpl-2.1 | arthurdejong/python-stdnum,dchoruzy/python-stdnum,t0mk/python-stdnum,tonyseek/python-stdnum,holvi/python-stdnum,arthurdejong/python-stdnum,holvi/python-stdnum,holvi/python-stdnum,arthurdejong/python-stdnum | ---
+++
@@ -0,0 +1,75 @@
+# atin.py - functions for handling ATINs
+#
+# Copyright (C) 2013 Arthur de Jong
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 o... | |
dee765818c054959a663f31c82ac34bcc908739f | cla_public/apps/checker/tests/test_review_page.py | cla_public/apps/checker/tests/test_review_page.py | from collections import defaultdict
import logging
import unittest
from bs4 import BeautifulSoup
from cla_public.app import create_app
from cla_public.apps.checker.constants import YES, NO
logging.getLogger('MARKDOWN').setLevel(logging.WARNING)
class TestReviewPage(unittest.TestCase):
def setUp(self):
... | Add failing test for missing About You section on review page when on passported benefits | Add failing test for missing About You section on review page when on passported benefits
| Python | mit | ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public | ---
+++
@@ -0,0 +1,59 @@
+from collections import defaultdict
+import logging
+import unittest
+
+from bs4 import BeautifulSoup
+
+from cla_public.app import create_app
+from cla_public.apps.checker.constants import YES, NO
+
+
+logging.getLogger('MARKDOWN').setLevel(logging.WARNING)
+
+
+class TestReviewPage(unittes... | |
1a8e623e13323187dc6b40a7358d6293d4f39706 | github2jenkins.py | github2jenkins.py | #!/usr/bin/env python
"""
Create Jenkins job corresponding to each Github repository.
"""
import os
import getpass
import github3
import jenkinsapi
# Github user(s) which repositories are to be created in Jenkins
GITHUB_USERS = ["taverna"]
# Branches which existance means a corresponding Jenkins job is
# created. T... | Create Jenkins jobs per Github repository | Create Jenkins jobs per Github repository
| Python | mit | stain/github2jenkins | ---
+++
@@ -0,0 +1,93 @@
+#!/usr/bin/env python
+
+"""
+Create Jenkins job corresponding to each Github repository.
+"""
+
+import os
+import getpass
+import github3
+import jenkinsapi
+
+# Github user(s) which repositories are to be created in Jenkins
+GITHUB_USERS = ["taverna"]
+
+# Branches which existance means a... | |
a91523943d6fb6790e91c3b348ab665c9b63c608 | apps/network/tests/test_routes/test_setup.py | apps/network/tests/test_routes/test_setup.py |
def test_initial_setup(client):
result = client.post("/setup/", data={"setup": "setup_configs_sample"})
assert result.status_code == 200
assert result.get_json() == {"msg": "Running initial setup!"}
def test_get_setup(client):
result = client.get("/setup/")
assert result.status_code == 200
as... | ADD Network setup unit tests | ADD Network setup unit tests
| Python | apache-2.0 | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | ---
+++
@@ -0,0 +1,11 @@
+
+
+def test_initial_setup(client):
+ result = client.post("/setup/", data={"setup": "setup_configs_sample"})
+ assert result.status_code == 200
+ assert result.get_json() == {"msg": "Running initial setup!"}
+
+def test_get_setup(client):
+ result = client.get("/setup/")
+ as... | |
971958a489f61920911b5d44f9491fa163017069 | py/find-k-closest-elements.py | py/find-k-closest-elements.py | class Solution(object):
def findClosestElements(self, arr, k, x):
"""
:type arr: List[int]
:type k: int
:type x: int
:rtype: List[int]
"""
larr = len(arr)
L, U = -1, larr
while L + 1 < U:
mid = L + (U - L) / 2
if arr[mid... | Add py solution for 658. Find K Closest Elements | Add py solution for 658. Find K Closest Elements
658. Find K Closest Elements: https://leetcode.com/problems/find-k-closest-elements/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,37 @@
+class Solution(object):
+ def findClosestElements(self, arr, k, x):
+ """
+ :type arr: List[int]
+ :type k: int
+ :type x: int
+ :rtype: List[int]
+ """
+ larr = len(arr)
+ L, U = -1, larr
+ while L + 1 < U:
+ mid =... | |
311a952851e9d2f859607060c387df8079b8ecce | txircd/modules/core/channellevel.py | txircd/modules/core/channellevel.py | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
class ChannelLevel(ModuleData):
implements(IModuleData)
name = "ChannelLevel"
core = True
def actions(self):
return [ ("checkchannellevel", 1, self.levelCheck),
("ch... | Implement a consistent way to check channel rank requirements | Implement a consistent way to check channel rank requirements
| Python | bsd-3-clause | ElementalAlchemist/txircd,Heufneutje/txircd | ---
+++
@@ -0,0 +1,35 @@
+from twisted.plugin import IPlugin
+from txircd.module_interface import IModuleData, ModuleData
+from zope.interface import implements
+
+class ChannelLevel(ModuleData):
+ implements(IModuleData)
+
+ name = "ChannelLevel"
+ core = True
+
+ def actions(self):
+ return [ ("checkchannellevel... | |
07b2fa2df9fb23dc1e3bdd56609b596555644d29 | murano/tests/unit/packages/test_exceptions.py | murano/tests/unit/packages/test_exceptions.py | # Copyright (c) 2016 AT&T Corp
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | Increase unit test coverage for exceptions in Packages API. | Increase unit test coverage for exceptions in Packages API.
Implements bp: murano-unit-test-coverage
Co-Authored-By: David Purcell <david.purcell@att.com>
Co-Authored-By: Samantha Blanco <samantha.blanco@att.com>
Co-Authored-By: Julian Sy <julian.sy@att.com>
Change-Id: Idabe7f63135766c57ed30e5988b71a756671999e
| Python | apache-2.0 | openstack/murano,openstack/murano | ---
+++
@@ -0,0 +1,58 @@
+# Copyright (c) 2016 AT&T Corp
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LI... | |
87afc656e837d1d48fe050d69e793caa5f4a674d | sts/util/socket_mux/pox_monkeypatcher.py | sts/util/socket_mux/pox_monkeypatcher.py |
from server_socket_multiplexer import ServerMultiplexedSelect,ServerMockSocket
import select
import socket
# Note: Make sure that this module is loaded after all other modules except
# of_01
def launch():
# Server side:
# - Instantiate ServerMultipexedSelect (this will create a true
# socket for the pinger... | Implement monkey patching. It works! | Implement monkey patching. It works!
Needed to fix a few bugs along the way:
- make sure bind() isn't called twice -- need to be careful about the order
we load POX modules
- need to actually send data in send() [even if non-blocking]
- don't assume that only MockSockets are passed into select. The client can
... | Python | apache-2.0 | ucb-sts/sts,jmiserez/sts,ucb-sts/sts,jmiserez/sts | ---
+++
@@ -0,0 +1,34 @@
+
+from server_socket_multiplexer import ServerMultiplexedSelect,ServerMockSocket
+import select
+import socket
+
+# Note: Make sure that this module is loaded after all other modules except
+# of_01
+
+def launch():
+ # Server side:
+ # - Instantiate ServerMultipexedSelect (this will crea... | |
da95ece4472c1988ec8fe9056c8d5b91c79da322 | server/user/changes.py | server/user/changes.py | from collections import defaultdict
from proposal.models import Change, Proposal
from proposal.views import proposal_json
from proposal.query import build_proposal_query
def find_updates(subscriptions, since):
change_summary = defaultdict(dict)
for subscription in subscriptions:
query_dict = subscri... | Change summary map for generating notification emails | Change summary map for generating notification emails
| Python | mit | cityofsomerville/citydash,cityofsomerville/cornerwise,cityofsomerville/citydash,codeforboston/cornerwise,cityofsomerville/cornerwise,codeforboston/cornerwise,cityofsomerville/citydash,cityofsomerville/cornerwise,codeforboston/cornerwise,cityofsomerville/citydash,cityofsomerville/cornerwise,codeforboston/cornerwise | ---
+++
@@ -0,0 +1,45 @@
+from collections import defaultdict
+
+from proposal.models import Change, Proposal
+from proposal.views import proposal_json
+from proposal.query import build_proposal_query
+
+
+def find_updates(subscriptions, since):
+ change_summary = defaultdict(dict)
+
+ for subscription in subsc... | |
e793c88f68429718c8293225c7099dcb31635d3d | accelerator/migrations/0022_add_meeting_info_on_office_hour_model.py | accelerator/migrations/0022_add_meeting_info_on_office_hour_model.py | # Generated by Django 2.2.10 on 2020-05-21 18:52
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accelerator', '0021_add_nullable_startup_and_program_fields'),
]
operations = [
... | Add a migration to add meeting_info | [AC-7818] Add a migration to add meeting_info
| Python | mit | masschallenge/django-accelerator,masschallenge/django-accelerator | ---
+++
@@ -0,0 +1,19 @@
+# Generated by Django 2.2.10 on 2020-05-21 18:52
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ('accelerator', '0021_add_nullable_startup_and_program_f... | |
8c8dd6930a7e9ae983dbc28a095767157ced70bd | src/conditionals/exercise6.py | src/conditionals/exercise6.py | # Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error message. If the
# score is between 0.0 and 1.0, print a grade using the following table
score = raw_input('Type the score: ')
try:
score = float(score)
except:
print 'Bad Score'
if( score >=0... | Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error message. If the score is between 0.0 and 1.0, print a grade using the following table | Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error message. If the
score is between 0.0 and 1.0, print a grade using the following table
| Python | mit | let42/python-course | ---
+++
@@ -0,0 +1,25 @@
+# Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error message. If the
+# score is between 0.0 and 1.0, print a grade using the following table
+
+
+
+score = raw_input('Type the score: ')
+try:
+ score = float(score)
+except:
+ print ... | |
19ff1e1999a5132ba7dd84baf446023870620ee9 | python/download_fungi_genomes_refseq.py | python/download_fungi_genomes_refseq.py | #!/usr/bin/env python
from __future__ import print_function
import ftplib
import sys
genome_list_fh = open("downloaded_genomes.txt","w")
ftp = ftplib.FTP("ftp.ncbi.nlm.nih.gov")
ftp.connect()
ftp.login()
base_path="/genomes/refseq/fungi"
ftp.cwd(base_path)
#Get species
species_list = ftp.nlst()
#for each species
for ... | Add script to download refseq fungal genomes via FTP | Add script to download refseq fungal genomes via FTP
| Python | apache-2.0 | maubarsom/biotico-tools,maubarsom/biotico-tools,maubarsom/biotico-tools,maubarsom/biotico-tools,maubarsom/biotico-tools | ---
+++
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+from __future__ import print_function
+import ftplib
+import sys
+
+genome_list_fh = open("downloaded_genomes.txt","w")
+
+ftp = ftplib.FTP("ftp.ncbi.nlm.nih.gov")
+ftp.connect()
+ftp.login()
+base_path="/genomes/refseq/fungi"
+ftp.cwd(base_path)
+#Get species
+species... | |
23bc365763b0d07d80015b72d43e12a4d0d91bc7 | keylime/migrations/versions/8da20383f6e1_extend_ip_field.py | keylime/migrations/versions/8da20383f6e1_extend_ip_field.py | """extend_ip_field
Revision ID: 8da20383f6e1
Revises: eeb702f77d7d
Create Date: 2021-01-14 10:50:56.275257
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8da20383f6e1'
down_revision = 'eeb702f77d7d'
branch_labels = None
depends_on = None
def upgrade(engine_... | Extend capacity of verifiermain.ip field | Extend capacity of verifiermain.ip field
Add migration script to extend the ip field capacity to hold up
to 255 characters.
Resolves: #498
Signed-off-by: Kaifeng Wang <5bfbeb450d06b1aa9e4417d3c7676f1231c80181@gmail.com>
| Python | bsd-2-clause | mit-ll/python-keylime,mit-ll/python-keylime,mit-ll/python-keylime,mit-ll/python-keylime | ---
+++
@@ -0,0 +1,42 @@
+"""extend_ip_field
+
+Revision ID: 8da20383f6e1
+Revises: eeb702f77d7d
+Create Date: 2021-01-14 10:50:56.275257
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = '8da20383f6e1'
+down_revision = 'eeb702f77d7d'
+branch_labels = No... | |
229dd6c82e38237e0948b9e5091647990fc11af4 | src/ggrc/migrations/versions/20170130060409_57940269e30_migrate_requests_change_logs.py | src/ggrc/migrations/versions/20170130060409_57940269e30_migrate_requests_change_logs.py | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Migrate requests change logs
Create Date: 2017-01-30 06:04:09.538516
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name
from alembic impo... | Migrate Request revisions to Assessment revisions | Migrate Request revisions to Assessment revisions
| Python | apache-2.0 | plamut/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,plamut/ggrc-core | ---
+++
@@ -0,0 +1,34 @@
+# Copyright (C) 2017 Google Inc.
+# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
+
+"""
+Migrate requests change logs
+
+Create Date: 2017-01-30 06:04:09.538516
+"""
+# disable Invalid constant name pylint warning for mandatory Alembic variables.
+# pylint: di... | |
da0a626ca6e05d918381653d7c219300d2e12ece | mosqito/tests/loudness/test_loudness_ecma.py | mosqito/tests/loudness/test_loudness_ecma.py | # -*- coding: utf-8 -*-
# Third party imports
import pytest
from numpy import mean
# Local application imports
from mosqito.functions.hearing_model.sine_wave_generator import sine_wave_generator
from mosqito.functions.hearing_model.comp_loudness import comp_loudness
from mosqito.functions.hearing_model.sone2phone imp... | Test for ECMA loudness computation | [NF] Test for ECMA loudness computation
| Python | apache-2.0 | Eomys/MoSQITo | ---
+++
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+
+# Third party imports
+import pytest
+from numpy import mean
+
+# Local application imports
+from mosqito.functions.hearing_model.sine_wave_generator import sine_wave_generator
+from mosqito.functions.hearing_model.comp_loudness import comp_loudness
+from mosqito.f... | |
9564848e61df038396fbab95995a40f2e5a5970a | l10n_br_zip/__openerp__.py | l10n_br_zip/__openerp__.py | # -*- coding: utf-8 -*-
# Copyright (C) 2009 Renato Lima - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
'name': 'Brazilian Localisation ZIP Codes',
'license': 'AGPL-3',
'author': 'Akretion, Odoo Community Association (OCA)',
'version': '8.0.1.0.1',
'depends': [
... | # -*- coding: utf-8 -*-
# Copyright (C) 2009 Renato Lima - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
'name': 'Brazilian Localisation ZIP Codes',
'license': 'AGPL-3',
'author': 'Akretion, Odoo Community Association (OCA)',
'version': '9.0.1.0.0',
'depends': [
... | Change the version of module. | [MIG] Change the version of module.
| Python | agpl-3.0 | kmee/l10n-brazil,kmee/l10n-brazil | ---
+++
@@ -6,7 +6,7 @@
'name': 'Brazilian Localisation ZIP Codes',
'license': 'AGPL-3',
'author': 'Akretion, Odoo Community Association (OCA)',
- 'version': '8.0.1.0.1',
+ 'version': '9.0.1.0.0',
'depends': [
'l10n_br_base',
],
@@ -18,7 +18,9 @@
'wizard/l10n_br_zip_se... |
5190338818e6eac093525bc2b188070105ce7891 | django_project/localities/tests/test_managementcommands.py | django_project/localities/tests/test_managementcommands.py | # -*- coding: utf-8 -*-
from django.test import TestCase
from django.core.management import call_command
from django.core.management.base import CommandError
from .model_factories import AttributeF, DomainSpecification3AF
from ..models import Locality, Value
class TestManagementCommands(TestCase):
def test_impo... | Add tests for Locality management commands | Add tests for Locality management commands
| Python | bsd-2-clause | ismailsunni/healthsites,ismailsunni/healthsites,ismailsunni/healthsites,ismailsunni/healthsites | ---
+++
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+from django.test import TestCase
+from django.core.management import call_command
+from django.core.management.base import CommandError
+
+from .model_factories import AttributeF, DomainSpecification3AF
+
+from ..models import Locality, Value
+
+
+class TestManagemen... | |
128d16d236a6e02218b9e3d9212d9f7d37fc99e3 | scripts/registration_trends.py | scripts/registration_trends.py | from competition.models import Competition
import collections
import csv
import datetime
import itertools
import json
import StringIO
def daterange(start_date, end_date):
num_days = int((end_date - start_date).days) + 1
for n in range(num_days + 1):
yield start_date + datetime.timedelta(days=n)
def... | Add script to calculate registration trends | Add script to calculate registration trends
| Python | bsd-3-clause | siggame/webserver,siggame/webserver,siggame/webserver | ---
+++
@@ -0,0 +1,37 @@
+from competition.models import Competition
+
+import collections
+import csv
+import datetime
+import itertools
+import json
+import StringIO
+
+
+def daterange(start_date, end_date):
+ num_days = int((end_date - start_date).days) + 1
+ for n in range(num_days + 1):
+ yield star... | |
14d9f4c6cdea8b2bac1ea199509a5da49ae3d85a | osf/migrations/0037_remove_emails_for_unconfirmed_users.py | osf/migrations/0037_remove_emails_for_unconfirmed_users.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-16 19:59
"""Removes Email objects that associated with unconfirmed users. These
were incorrectly created in 0033_user_emails_to_fk.
"""
from __future__ import unicode_literals
from django.db import migrations
def remove_emails(state, *args, **kwargs):
... | Add migration to remove Emails associated with unconfirmed users | Add migration to remove Emails associated with unconfirmed users
There should not be any Email records for unconfirmed users.
These users would not be able to log in nor confirm their email
| Python | apache-2.0 | felliott/osf.io,chrisseto/osf.io,leb2dg/osf.io,cslzchen/osf.io,pattisdr/osf.io,erinspace/osf.io,caneruguz/osf.io,sloria/osf.io,chrisseto/osf.io,baylee-d/osf.io,brianjgeiger/osf.io,HalcyonChimera/osf.io,pattisdr/osf.io,mattclark/osf.io,adlius/osf.io,brianjgeiger/osf.io,mfraezz/osf.io,cslzchen/osf.io,TomBaxter/osf.io,Hal... | ---
+++
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.1 on 2017-06-16 19:59
+"""Removes Email objects that associated with unconfirmed users. These
+were incorrectly created in 0033_user_emails_to_fk.
+"""
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+def re... | |
7a3f15c011447374dcd782a7eb5953534c25f09f | test/acceptance/test_cli_vital.py | test/acceptance/test_cli_vital.py | import unittest
from pathlib import Path
import subprocess
class TestVintDoNotDiedWhenLintingVital(unittest.TestCase):
def assertVintStillAlive(self, cmd):
try:
got_output = subprocess.check_output(cmd,
stderr=subprocess.STDOUT,
... | Add acceptance test for vital | Add acceptance test for vital
| Python | mit | Kuniwak/vint,RianFuro/vint,Kuniwak/vint,RianFuro/vint | ---
+++
@@ -0,0 +1,37 @@
+import unittest
+from pathlib import Path
+import subprocess
+
+
+class TestVintDoNotDiedWhenLintingVital(unittest.TestCase):
+ def assertVintStillAlive(self, cmd):
+ try:
+ got_output = subprocess.check_output(cmd,
+ stder... | |
f5ac5b27f1c586e0f3e65ceab633fdae0b040454 | tests/test_compound.py | tests/test_compound.py | # -*- coding: utf-8 -*-
import unittest
from formencode import compound, Invalid
from formencode.validators import DictConverter
class TestAllCompoundValidator(unittest.TestCase):
def setUp(self):
self.validator = compound.All(
validators=[DictConverter({2:1}), DictConverter({3:2})])
d... | Add some basic tests for compound validators which can be expanded upon later. | Add some basic tests for compound validators which can be expanded upon later.
| Python | mit | formencode/formencode,formencode/formencode,systemctl/formencode,jvanasco/formencode,formencode/formencode,jvanasco/formencode,genixpro/formencode,genixpro/formencode,genixpro/formencode,systemctl/formencode,jvanasco/formencode,systemctl/formencode | ---
+++
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+
+import unittest
+
+from formencode import compound, Invalid
+from formencode.validators import DictConverter
+
+
+class TestAllCompoundValidator(unittest.TestCase):
+
+ def setUp(self):
+ self.validator = compound.All(
+ validators=[DictConvert... | |
25669d7946c5c9faa5f07348580809b33d9ee1d2 | tests/test_settings.py | tests/test_settings.py | from flask import url_for
import pytest
import roomcontrol.utils.localstorage as ls
TEST_FILE = """
[settings]
serverip=0.0.0.0
notify=False
sendpic=True
"""
@pytest.fixture
def storage_file(tmpdir):
p = tmpdir.join('test_storage.in')
p.write(TEST_FILE)
ls.set_storage_file(str(p))
def test_response_... | Add tests for settings handlers | Add tests for settings handlers
| Python | mit | miguelfrde/roomcontrol_backend | ---
+++
@@ -0,0 +1,81 @@
+from flask import url_for
+
+import pytest
+
+import roomcontrol.utils.localstorage as ls
+
+
+TEST_FILE = """
+[settings]
+serverip=0.0.0.0
+notify=False
+sendpic=True
+"""
+
+
+@pytest.fixture
+def storage_file(tmpdir):
+ p = tmpdir.join('test_storage.in')
+ p.write(TEST_FILE)
+ l... | |
d15472fec9b3bbc589099409376191eb7a93eac6 | src/diamond/handler/zmq_pubsub.py | src/diamond/handler/zmq_pubsub.py | """
Output the collected values to . Zer0MQ pub/sub channel
"""
from Handler import Handler
import zmq
class zmqHandler ( Handler ):
"""
Implements the abstract Handler class, sending data to a Zer0MQ pub channel
"""
def __init__( self, config=None ):
"""
Create a new instance of zmqHandler c... | """
Output the collected values to . Zer0MQ pub/sub channel
"""
from Handler import Handler
import zmq
class zmqHandler ( Handler ):
"""
Implements the abstract Handler class, sending data to a Zer0MQ pub channel
"""
def __init__( self, config=None ):
"""
Create a new instance of zmqHandler c... | Fix typo. contact should be context | Fix typo. contact should be context
| Python | mit | works-mobile/Diamond,signalfx/Diamond,Ssawa/Diamond,Ensighten/Diamond,h00dy/Diamond,janisz/Diamond-1,thardie/Diamond,Ssawa/Diamond,saucelabs/Diamond,Basis/Diamond,Ensighten/Diamond,Netuitive/Diamond,cannium/Diamond,zoidbergwill/Diamond,bmhatfield/Diamond,datafiniti/Diamond,metamx/Diamond,mzupan/Diamond,cannium/Diamond,... | ---
+++
@@ -35,7 +35,7 @@
Create PUB socket and bind
"""
self.context = zmq.Context()
- self.socket = self.contact.socket(zmq.PUB)
+ self.socket = self.context.socket(zmq.PUB)
self.socket.bind("tcp://*:%i" % self.port )
|
d62072cd1e01dc37563934cb1b87161ea06ebbaf | scripts/osfstorage/migrate_deleted_files.py | scripts/osfstorage/migrate_deleted_files.py | import logging
from modularodm import Q
from website.app import init_app
from website.addons.osfstorage.model import OsfStorageFileNode
from scripts import utils as scripts_utils
logger = logging.getLogger(__name__)
def main():
for file in OsfStorageFileNode.find(Q('is_deleted', 'eq', True)):
file.delet... | Add migration script for deleted osfstorage | Add migration script for deleted osfstorage
| Python | apache-2.0 | zachjanicki/osf.io,arpitar/osf.io,chennan47/osf.io,bdyetton/prettychart,DanielSBrown/osf.io,billyhunt/osf.io,alexschiller/osf.io,mfraezz/osf.io,chrisseto/osf.io,caseyrygt/osf.io,RomanZWang/osf.io,bdyetton/prettychart,lyndsysimon/osf.io,cldershem/osf.io,ZobairAlijan/osf.io,binoculars/osf.io,asanfilippo7/osf.io,Ghalko/os... | ---
+++
@@ -0,0 +1,20 @@
+import logging
+from modularodm import Q
+from website.app import init_app
+from website.addons.osfstorage.model import OsfStorageFileNode
+from scripts import utils as scripts_utils
+
+
+logger = logging.getLogger(__name__)
+
+
+def main():
+ for file in OsfStorageFileNode.find(Q('is_del... | |
414f70d3c378353fb29664db3b4c980c664b2f60 | txircd/modules/extra/conn_join.py | txircd/modules/extra/conn_join.py | from twisted.plugin import IPlugin
from txircd.channel import IRCChannel
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
class AutoJoin(ModuleData):
implements(IPlugin, IModuleData)
name = "AutoJoin"
def hookIRCd(self, ircd):
self.ircd = ircd
... | Implement the autojoin on connect module | Implement the autojoin on connect module
| Python | bsd-3-clause | ElementalAlchemist/txircd,Heufneutje/txircd | ---
+++
@@ -0,0 +1,27 @@
+from twisted.plugin import IPlugin
+from txircd.channel import IRCChannel
+from txircd.module_interface import IModuleData, ModuleData
+from zope.interface import implements
+
+class AutoJoin(ModuleData):
+ implements(IPlugin, IModuleData)
+
+ name = "AutoJoin"
+
+ def hookIRCd(self... | |
50536bd56904158d0a5c5587c62b76a6ce8745be | tests.py | tests.py | import requests
from tornalet import tornalet
from trequests import setup_session
from tornado.ioloop import IOLoop
from tornado.escape import json_decode
from tornado.testing import AsyncHTTPTestCase
from tornado.web import Application, RequestHandler
setup_session()
class TestUtil(object):
def send(self, data... | Add a basic unit test | Add a basic unit test
| Python | bsd-3-clause | isaacnotnwton/trequests,1stvamp/trequests,pandada8/trequests | ---
+++
@@ -0,0 +1,59 @@
+import requests
+from tornalet import tornalet
+from trequests import setup_session
+from tornado.ioloop import IOLoop
+from tornado.escape import json_decode
+from tornado.testing import AsyncHTTPTestCase
+from tornado.web import Application, RequestHandler
+
+setup_session()
+
+
+class Tes... | |
20f255e5065d40be35228ca97244e19c5473ebe4 | tests/unit/test_commands.py | tests/unit/test_commands.py | from django.core.management import call_command
from django.test import TestCase
try:
from unittest.mock import patch
except ImportError:
from mock import patch
class SuspenderTestCase(TestCase):
@patch('hastexo.jobs.SuspenderJob')
def test_start_suspender(self, mock_suspender):
# We need to... | Add minimal unit tests for the manage.py commands | Add minimal unit tests for the manage.py commands
| Python | agpl-3.0 | hastexo/hastexo-xblock,hastexo/hastexo-xblock,hastexo/hastexo-xblock,hastexo/hastexo-xblock | ---
+++
@@ -0,0 +1,31 @@
+from django.core.management import call_command
+from django.test import TestCase
+
+try:
+ from unittest.mock import patch
+except ImportError:
+ from mock import patch
+
+
+class SuspenderTestCase(TestCase):
+
+ @patch('hastexo.jobs.SuspenderJob')
+ def test_start_suspender(sel... | |
c00187d36ff625e7b78861d326452efb97fb2498 | utils/validator_all.py | utils/validator_all.py | import re
import os
import sys
import subprocess
from natsort import natsort_keygen, ns
if len(sys.argv) < 2:
print('python3 validator_all.py testbenchDir')
exit(0)
solver = './yasat' if len(sys.argv)<3 else sys.argv[2]
SAT = 0
UNSAT = 0
ERROR = 0
TIMEOUT = 0
def check(cnfFile, result):
assignment = s... | Add validator for all testcase in dir | Add validator for all testcase in dir
| Python | mit | sunset1995/YA-SAT,sunset1995/YA-SAT,sunset1995/YA-SAT | ---
+++
@@ -0,0 +1,79 @@
+import re
+import os
+import sys
+import subprocess
+from natsort import natsort_keygen, ns
+
+if len(sys.argv) < 2:
+ print('python3 validator_all.py testbenchDir')
+ exit(0)
+
+solver = './yasat' if len(sys.argv)<3 else sys.argv[2]
+
+SAT = 0
+UNSAT = 0
+ERROR = 0
+TIMEOUT = 0
+
+
+d... | |
bf616f52a2a90fc04921e22a530ab1038eb15b4b | python/02-2.py | python/02-2.py | #!/usr/bin/env python
import re
total = 0
with open('../inputs/02.txt') as f:
for line in f:
# data is like "1x2x3"
matches = re.split("(\d+)", line)
# 7 = 3 matches + 2 empty matches + 2 x characters
# The empty matches are because of the expression matches the begin and
# end of t... | Add day 2 part 2 solution. | Add day 2 part 2 solution.
| Python | mit | opello/adventofcode | ---
+++
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+import re
+
+total = 0
+
+with open('../inputs/02.txt') as f:
+ for line in f:
+ # data is like "1x2x3"
+ matches = re.split("(\d+)", line)
+
+ # 7 = 3 matches + 2 empty matches + 2 x characters
+ # The empty matches are because of the expressio... | |
3c9fc65fefb21d5022c27a3321a930b8e7fff923 | shapely/tests/test_collection.py | shapely/tests/test_collection.py | import unittest
from shapely.geometry.collection import GeometryCollection
class CollectionTestCase(unittest.TestCase):
def test_array_interface(self):
m = GeometryCollection()
self.failUnlessEqual(len(m), 0)
def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(CollectionTestCa... | Add test of empty geometry collection creation. | Add test of empty geometry collection creation.
| Python | bsd-3-clause | abali96/Shapely,mouadino/Shapely,mindw/shapely,jdmcbr/Shapely,abali96/Shapely,mindw/shapely,mouadino/Shapely,jdmcbr/Shapely | ---
+++
@@ -0,0 +1,10 @@
+import unittest
+from shapely.geometry.collection import GeometryCollection
+
+class CollectionTestCase(unittest.TestCase):
+ def test_array_interface(self):
+ m = GeometryCollection()
+ self.failUnlessEqual(len(m), 0)
+
+def test_suite():
+ return unittest.TestLoader().l... | |
67326682df2efaf013830df5985f479e5d0ce19c | datasciencebox/tests/salt/test_mesos_spark.py | datasciencebox/tests/salt/test_mesos_spark.py | import pytest
from hdfs.client import Client
import utils
def setup_module(module):
utils.invoke('install', 'spark')
@utils.vagranttest
def test_salt_formulas():
project = utils.get_test_project()
kwargs = {'test': 'true', '--out': 'json', '--out-indent': '-1'}
out = project.salt('state.sls', arg... | Add simple spark on mesos test | Add simple spark on mesos test
| Python | apache-2.0 | danielfrg/datasciencebox,danielfrg/datasciencebox,danielfrg/datasciencebox,danielfrg/datasciencebox | ---
+++
@@ -0,0 +1,43 @@
+import pytest
+
+from hdfs.client import Client
+
+import utils
+
+
+def setup_module(module):
+ utils.invoke('install', 'spark')
+
+
+@utils.vagranttest
+def test_salt_formulas():
+ project = utils.get_test_project()
+
+ kwargs = {'test': 'true', '--out': 'json', '--out-indent': '-... | |
0701fae308161caf92ac89b8d8fc765258c6f38f | actions/cloudbolt_plugins/aws/spending_anomaly_detection/hourly_spending_anomaly_detection.py | actions/cloudbolt_plugins/aws/spending_anomaly_detection/hourly_spending_anomaly_detection.py | """
Checks the last hour of AWS Billing Data from S3 buckets, and sends an alert if
any servers have exceeded the specified threshold.
Note: This Action assumes that you have one or more configured Alert Channels
that can be used for notifying the appropraite users. These channels must
be listed in ALERT_CHANN... | Add AWS Hourly Spending Anomaly Detection | Add AWS Hourly Spending Anomaly Detection
New plugin checks hourly spending data for all AWS instances and sends
an alert if the cost threshold has been exceeded.
[DEV-13347]
| Python | apache-2.0 | CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge | ---
+++
@@ -0,0 +1,76 @@
+"""
+Checks the last hour of AWS Billing Data from S3 buckets, and sends an alert if
+any servers have exceeded the specified threshold.
+
+Note: This Action assumes that you have one or more configured Alert Channels
+ that can be used for notifying the appropraite users. These channels ... | |
db8b342e999cc75cd776d8ca1821522145610d1d | ratechecker/migrations/0002_remove_fee_loader.py | ratechecker/migrations/0002_remove_fee_loader.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.22 on 2019-10-31 16:33
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ratechecker', '0001_initial'),
]
operations = [
migrations.AlterUniqueTogether(
... | Add ratechecker migration to remove_fee_loader | Add ratechecker migration to remove_fee_loader
| Python | cc0-1.0 | cfpb/owning-a-home-api | ---
+++
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.22 on 2019-10-31 16:33
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('ratechecker', '0001_initial'),
+ ]
+
+ operations = [
+... | |
f03f5522fc8e57b2801f967c93b7e0de60688801 | src/test/test_findlines.py | src/test/test_findlines.py | #-------------------------------------------------------------------------------
# Copyright (c) 2011 Anton Golubkov.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU Lesser Public License v2.1
# which accompanies this distribution, and is available at
#... | Add test case for FindLines block | Add test case for FindLines block
| Python | lgpl-2.1 | anton-golubkov/Garland,anton-golubkov/Garland | ---
+++
@@ -0,0 +1,57 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2011 Anton Golubkov.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the GNU Lesser Public License v2.1
+# which accompanies this dis... | |
1ff90eec99c1d0f8130552c9f4323f3b099a8231 | CodeFights/pressureGauges.py | CodeFights/pressureGauges.py | #!/usr/local/bin/python
# Code Fights Pressure Gauges Problem
def pressureGauges(morning, evening):
return [list(map(min, zip(morning, evening))),
list(map(max, zip(morning, evening)))]
def main():
tests = [
[[3, 5, 2, 6], [1, 6, 6, 6], [[1, 5, 2, 6], [3, 6, 6, 6]]],
[[0, 12, 478... | Solve Code Fights pressure gauges problem | Solve Code Fights pressure gauges problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,35 @@
+#!/usr/local/bin/python
+# Code Fights Pressure Gauges Problem
+
+
+def pressureGauges(morning, evening):
+ return [list(map(min, zip(morning, evening))),
+ list(map(max, zip(morning, evening)))]
+
+
+def main():
+ tests = [
+ [[3, 5, 2, 6], [1, 6, 6, 6], [[1, 5, 2, 6... | |
2570564f9b6334a14e1b06c3cc71afa3576f6e22 | notifications/alliance_selections.py | notifications/alliance_selections.py | from consts.notification_type import NotificationType
from helpers.model_to_dict import ModelToDict
from notifications.base_notification import BaseNotification
class AllianceSelectionNotification(BaseNotification):
def __init__(self, event):
self.event = event
def _build_dict(self):
data = ... | Add notification for alliance selections | Add notification for alliance selections
| Python | mit | phil-lopreiato/the-blue-alliance,josephbisch/the-blue-alliance,bdaroz/the-blue-alliance,josephbisch/the-blue-alliance,jaredhasenklein/the-blue-alliance,fangeugene/the-blue-alliance,jaredhasenklein/the-blue-alliance,bdaroz/the-blue-alliance,nwalters512/the-blue-alliance,nwalters512/the-blue-alliance,bvisness/the-blue-al... | ---
+++
@@ -0,0 +1,16 @@
+from consts.notification_type import NotificationType
+from helpers.model_to_dict import ModelToDict
+from notifications.base_notification import BaseNotification
+
+
+class AllianceSelectionNotification(BaseNotification):
+
+ def __init__(self, event):
+ self.event = event
+
+ ... | |
f9524d36fa2b43a71726b7935af5d8d57c88a426 | kirppu/management/commands/accounting_data.py | kirppu/management/commands/accounting_data.py | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from django.utils.translation import activate
from kirppu.accounting import accounting_receipt
class Command(BaseCommand):
help = 'Dump accounting CSV to standard output'
def add_arguments(self, parser):
parser.add_argument(... | Add commandline command for creating accounting data. | Add commandline command for creating accounting data.
| Python | mit | jlaunonen/kirppu,jlaunonen/kirppu,jlaunonen/kirppu,jlaunonen/kirppu | ---
+++
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+from django.core.management.base import BaseCommand
+from django.utils.translation import activate
+
+from kirppu.accounting import accounting_receipt
+
+
+class Command(BaseCommand):
+ help = 'Dump accounting CSV to standard output'
+
+ def add_arguments(self,... | |
f674dcc0aa16753a3cc26bdd3fa1087f7277a9ed | python-real-one-liner/abcdefghppp.py | python-real-one-liner/abcdefghppp.py | #!/usr/bin/env pypy3
from itertools import permutations as p
print([i for i in p(set(range(10)) - {1}, 8) if all([i[j] != 0 for j in range(0, 7, 2)]) and (i[0] * 10 + i[1])-(i[2] * 10 + i[3]) == i[4] * 10 + i[5] and (i[4] * 10 + i[5]) + (i[6] * 10 + i[7]) == 111])
| Add a real python one-liner | Add a real python one-liner
| Python | mit | phiSgr/ABCDEFGHPPP,phiSgr/ABCDEFGHPPP,phiSgr/ABCDEFGHPPP,phiSgr/ABCDEFGHPPP,mingchuno/ABCDEFGHPPP,phiSgr/ABCDEFGHPPP,mingchuno/ABCDEFGHPPP,phiSgr/ABCDEFGHPPP,dng8888/ABCDEFGHPPP,mingchuno/ABCDEFGHPPP,dng8888/ABCDEFGHPPP,dng8888/ABCDEFGHPPP,dng8888/ABCDEFGHPPP,dng8888/ABCDEFGHPPP,dng8888/ABCDEFGHPPP,mingchuno/ABCDEFGHPP... | ---
+++
@@ -0,0 +1,4 @@
+#!/usr/bin/env pypy3
+from itertools import permutations as p
+
+print([i for i in p(set(range(10)) - {1}, 8) if all([i[j] != 0 for j in range(0, 7, 2)]) and (i[0] * 10 + i[1])-(i[2] * 10 + i[3]) == i[4] * 10 + i[5] and (i[4] * 10 + i[5]) + (i[6] * 10 + i[7]) == 111]) | |
871cba8009b383c89023dbc39db75be27bad0ee0 | utils/stats.py | utils/stats.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including witho... | Add a script to display statistics about games result. | Add a script to display statistics about games result.
| Python | mit | jeremiedecock/tictactoe-py,jeremiedecock/tictactoe-py | ---
+++
@@ -0,0 +1,52 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software w... | |
16311a8288eefe00ccb5bfce736ab7e211a0a905 | migrations/versions/0247_another_letter_org.py | migrations/versions/0247_another_letter_org.py | """empty message
Revision ID: 0247_another_letter_org
Revises: 0246_notifications_index
"""
# revision identifiers, used by Alembic.
revision = '0247_another_letter_org'
down_revision = '0246_notifications_index'
from alembic import op
NEW_ORGANISATIONS = [
('520', 'Neath Port Talbot Council', 'npt'),
]
def... | Add letter logo for Neath Port Talbot Council | Add letter logo for Neath Port Talbot Council
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,35 @@
+"""empty message
+
+Revision ID: 0247_another_letter_org
+Revises: 0246_notifications_index
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '0247_another_letter_org'
+down_revision = '0246_notifications_index'
+
+from alembic import op
+
+
+NEW_ORGANISATIONS = [
+ ('520', '... | |
89b3097e13c8241b26cacde615b792c75524d3d5 | testcases/PetitbootMMU.py | testcases/PetitbootMMU.py | #!/usr/bin/env python2
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2019
# [+] International Business Machines Corp.
#
#
# 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 Lic... | Add check for the MMU type under petitboot | Add check for the MMU type under petitboot
We expect the petitboot kernel to always use radix MMU on Power9. This
test case will also test that Power8 is using hash.
It uses /proc/cpuinfo while booted into the petitboot environment.
Signed-off-by: Joel Stanley <4816dabf8db1bc6cac35b3a24cab2ff844b5b0c7@jms.id.au>
| Python | apache-2.0 | open-power/op-test-framework,open-power/op-test-framework,open-power/op-test-framework | ---
+++
@@ -0,0 +1,60 @@
+#!/usr/bin/env python2
+# OpenPOWER Automated Test Project
+#
+# Contributors Listed Below - COPYRIGHT 2019
+# [+] International Business Machines Corp.
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License... | |
4756856a1f146b39103e50abcda41c5ecf8e89e9 | tests/test_middlewares.py | tests/test_middlewares.py | from django.http.response import HttpResponse
from django.test import TestCase
from mock import MagicMock
from rewrite_external_links.middleware import RewriteExternalLinksMiddleware
class TestRewriteExternalLinksMiddleware(TestCase):
def setUp(self):
self.middleware = RewriteExternalLinksMiddleware()
... | Add basic tests for middleware | Add basic tests for middleware
| Python | bsd-2-clause | incuna/django-rewrite-external-links,incuna/django-rewrite-external-links | ---
+++
@@ -0,0 +1,43 @@
+from django.http.response import HttpResponse
+from django.test import TestCase
+from mock import MagicMock
+
+from rewrite_external_links.middleware import RewriteExternalLinksMiddleware
+
+
+class TestRewriteExternalLinksMiddleware(TestCase):
+ def setUp(self):
+ self.middleware ... | |
5c9ffdb83bbc2796acc520365f6ce854d39a4c14 | makeul4represcapes.py | makeul4represcapes.py | lastback = False
startback = 0
unprintable = []
for i in range(0x7f, 0x10001):
c = chr(i)
thisback = repr(c)[1] == "\\"
if thisback != lastback:
# print("{:08x}|{!r}: {}".format(i, c, thisback))
if thisback:
startback = i
else:
end = i-1
if startback == end:
unprintable.append("\\u{:04x}".format... | Add script for generating the regexp for which chars to escape. | Add script for generating the regexp for which chars to escape.
| Python | mit | LivingLogic/LivingLogic.Javascript.ul4,LivingLogic/LivingLogic.Javascript.ul4,doerwalter/LivingLogic.Javascript.ul4,doerwalter/LivingLogic.Javascript.ul4 | ---
+++
@@ -0,0 +1,20 @@
+lastback = False
+startback = 0
+
+unprintable = []
+
+for i in range(0x7f, 0x10001):
+ c = chr(i)
+ thisback = repr(c)[1] == "\\"
+ if thisback != lastback:
+ # print("{:08x}|{!r}: {}".format(i, c, thisback))
+ if thisback:
+ startback = i
+ else:
+ end = i-1
+ if startback == end:... | |
f6ca3abbcb621135acd39c0556df2b5f672cc286 | CodeFights/replaceMiddle.py | CodeFights/replaceMiddle.py | #!/usr/local/bin/python
# Code Fights Replace Middle Problem
def replaceMiddle(arr):
n = len(arr)
if n % 2 == 1:
return arr
else:
mid = arr[n // 2 - 1] + arr[n // 2]
arr[n // 2 - 1: n // 2 + 1] = [mid]
return arr
def main():
tests = [
[[7, 2, 2, 5, 10, 7], [7,... | Solve Code Fights replace middle problem | Solve Code Fights replace middle problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/local/bin/python
+# Code Fights Replace Middle Problem
+
+
+def replaceMiddle(arr):
+ n = len(arr)
+ if n % 2 == 1:
+ return arr
+ else:
+ mid = arr[n // 2 - 1] + arr[n // 2]
+ arr[n // 2 - 1: n // 2 + 1] = [mid]
+ return arr
+
+
+def main():
+ ... | |
a35c7023adbe1aeabce62f02d390f934741cb392 | examples/multimailboxsearch.py | examples/multimailboxsearch.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Use IMAP CLI to search trhough every mailbox on an account."""
import argparse
import getpass
import logging
import os
import sys
import imap_cli
from imap_cli import search
app_name = os.path.splitext(os.path.basename(__file__))[0]
log = logging.getLogger(app_na... | Add an example script to search through every mailbox | Add an example script to search through every mailbox
| Python | mit | Gentux/imap-cli,Gentux/imap-cli | ---
+++
@@ -0,0 +1,73 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+
+
+"""Use IMAP CLI to search trhough every mailbox on an account."""
+
+
+import argparse
+import getpass
+import logging
+import os
+import sys
+
+import imap_cli
+from imap_cli import search
+
+
+app_name = os.path.splitext(os.path.basename... | |
ce1941a06b37f1273618822212e9570c9ca57f2f | ws-tests/test_valid_study_put_override_author.py | ws-tests/test_valid_study_put_override_author.py | #!/usr/bin/env python
from opentreetesting import test_http_json_method, config
import datetime
import codecs
import json
import sys
import os
DOMAIN = config('host', 'apihost')
SUBMIT_URI = DOMAIN + '/v1/study/1003'
inpf = codecs.open('../nexson-validator/tests/single/input/1003.json', 'rU', encoding='utf-8')
n = jso... | Add a test for over-riding author info | Add a test for over-riding author info
| Python | bsd-2-clause | OpenTreeOfLife/phylesystem-api,OpenTreeOfLife/phylesystem-api,OpenTreeOfLife/phylesystem-api | ---
+++
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+from opentreetesting import test_http_json_method, config
+import datetime
+import codecs
+import json
+import sys
+import os
+
+DOMAIN = config('host', 'apihost')
+SUBMIT_URI = DOMAIN + '/v1/study/1003'
+inpf = codecs.open('../nexson-validator/tests/single/input/1003.... | |
dccc851f34eebe2e74efcce5141ced166a9baa04 | bluebottle/notifications/tests/test_admin.py | bluebottle/notifications/tests/test_admin.py | # -*- coding: utf-8 -*-
from django.urls import reverse
from bluebottle.notifications.models import MessageTemplate
from bluebottle.test.utils import BluebottleAdminTestCase
class TestMessageTemplateAdmin(BluebottleAdminTestCase):
def setUp(self):
super(TestMessageTemplateAdmin, self).setUp()
se... | Add tests for message template admin | Add tests for message template admin
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+from django.urls import reverse
+
+from bluebottle.notifications.models import MessageTemplate
+from bluebottle.test.utils import BluebottleAdminTestCase
+
+
+class TestMessageTemplateAdmin(BluebottleAdminTestCase):
+
+ def setUp(self):
+ super(TestMessageT... | |
830888cb9c795313917e6540f11b411ea002b6b6 | comics/comics/kalscartoon.py | comics/comics/kalscartoon.py | from dateutil.parser import parse
from comics.aggregator.crawler import CrawlerBase, CrawlerResult
from comics.meta.base import MetaBase
class Meta(MetaBase):
name = "KAL's Cartoon"
language = 'en'
url = 'http://www.economist.com'
start_date = '2006-01-05'
rights = 'Kevin Kallaugher'
class Crawle... | Add crawler for KAL's cartoon | Add crawler for KAL's cartoon
| Python | agpl-3.0 | klette/comics,jodal/comics,datagutten/comics,jodal/comics,jodal/comics,jodal/comics,klette/comics,datagutten/comics,datagutten/comics,datagutten/comics,klette/comics | ---
+++
@@ -0,0 +1,33 @@
+from dateutil.parser import parse
+
+from comics.aggregator.crawler import CrawlerBase, CrawlerResult
+from comics.meta.base import MetaBase
+
+class Meta(MetaBase):
+ name = "KAL's Cartoon"
+ language = 'en'
+ url = 'http://www.economist.com'
+ start_date = '2006-01-05'
+ rig... | |
832b22df0dc8cc7d9b4a3ae4095d5508b732978f | uoftscrapers/scrapers/food/__init__.py | uoftscrapers/scrapers/food/__init__.py | import requests
from bs4 import BeautifulSoup
from collections import OrderedDict
import json
from ..scraper import Scraper
class Food(Scraper):
"""A scraper for UofT restaurants.
UofT Food data is located at http://map.utoronto.ca
"""
def __init__(self, output_location='.'):
super().__init_... | Initialize Food scraper, add timing scraper | Initialize Food scraper, add timing scraper
| Python | mit | kshvmdn/uoft-scrapers,cobalt-uoft/uoft-scrapers,arkon/uoft-scrapers,g3wanghc/uoft-scrapers | ---
+++
@@ -0,0 +1,56 @@
+import requests
+from bs4 import BeautifulSoup
+from collections import OrderedDict
+import json
+from ..scraper import Scraper
+
+
+class Food(Scraper):
+ """A scraper for UofT restaurants.
+
+ UofT Food data is located at http://map.utoronto.ca
+ """
+
+ def __init__(self, outp... | |
c0f7dc1dcfdbabff116f8d7132b191397fd9007f | src/sentry/api/serializers/models/filechange.py | src/sentry/api/serializers/models/filechange.py | from __future__ import absolute_import
import six
from sentry.api.serializers import Serializer, register
from sentry.models import Commit, CommitFileChange
from sentry.api.serializers.models.release import get_users_for_commits
@register(CommitFileChange)
class CommitFileChangeSerializer(Serializer):
def get_a... | from __future__ import absolute_import
import six
from sentry.api.serializers import Serializer, register
from sentry.models import Commit, CommitFileChange
from sentry.api.serializers.models.release import get_users_for_commits
@register(CommitFileChange)
class CommitFileChangeSerializer(Serializer):
def get_a... | Use dictionary lookup only once | Use dictionary lookup only once
| Python | bsd-3-clause | looker/sentry,JackDanger/sentry,mvaled/sentry,gencer/sentry,beeftornado/sentry,jean/sentry,jean/sentry,BuildingLink/sentry,ifduyue/sentry,mvaled/sentry,ifduyue/sentry,BuildingLink/sentry,looker/sentry,JamesMura/sentry,looker/sentry,jean/sentry,gencer/sentry,JamesMura/sentry,ifduyue/sentry,JamesMura/sentry,BuildingLink/... | ---
+++
@@ -15,9 +15,10 @@
commits_by_id = {commit.id: commit for commit in commits}
result = {}
for item in item_list:
+ commit = commits_by_id[item.commit_id]
result[item] = {
- 'user': author_objs.get(commits_by_id[item.commit_id].author_id, {}),
- ... |
98b317f0727b53cee2faefb0a7eaa977bceb13d5 | src/ggrc/migrations/versions/20160317173315_3715694bd315_rename_date_columns_in_requests.py | src/ggrc/migrations/versions/20160317173315_3715694bd315_rename_date_columns_in_requests.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: samo@reciprocitylabs.com
# Maintained By: samo@reciprocitylabs.com
"""
Rename date columns in requests
Create Date: 2016-03-17 17:33:15.817255
"""... | Rename relevant columns on the requests table | Rename relevant columns on the requests table
| Python | apache-2.0 | edofic/ggrc-core,kr41/ggrc-core,j0gurt/ggrc-core,selahssea/ggrc-core,josthkko/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,josthkko/ggrc-core,NejcZupec/ggrc-core,josthkko/ggrc-core,NejcZupec/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,kr41/ggrc-core,VinnieJohns... | ---
+++
@@ -0,0 +1,34 @@
+# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
+# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
+# Created By: samo@reciprocitylabs.com
+# Maintained By: samo@reciprocitylabs.com
+
+"""
+Rename date columns in requests
+
+Create ... | |
c0ad7a6e3048b7691daabeef7779f044709d6a81 | admin/simpleloadtest.py | admin/simpleloadtest.py | # A simple loadtest using locust.
# launch using: locust -f simpleloadtest.py --host=http://pencilcode.net
from locust import HttpLocust, TaskSet, task
import simplejson, random
class MyTaskSet(TaskSet):
def userbase(self, user):
return self.client.base_url.replace('//', '//' + user + '.')
def topget(s... | Add a simple load test. | Add a simple load test.
| Python | mit | davidbau/pencilcode,davidbau/pencilcode,sakagg/pencilcode,dweintrop/pencilcode,cacticouncil/pencilcode,sakagg/pencilcode,Dinuka2013513/pencilcode,davidbau/pencilcode,davidbau/pencilcode,Dinuka2013513/pencilcode,xinan/pencilcode,davidbau/pencilcode,PencilCode/pencilcode,cacticouncil/pencilcode,cacticouncil/pencilcode,dw... | ---
+++
@@ -0,0 +1,71 @@
+# A simple loadtest using locust.
+# launch using: locust -f simpleloadtest.py --host=http://pencilcode.net
+
+from locust import HttpLocust, TaskSet, task
+import simplejson, random
+
+class MyTaskSet(TaskSet):
+ def userbase(self, user):
+ return self.client.base_url.replace('//', ... | |
78ebafc9364fac9bdad3ba3172c645f35673bec7 | examples/gui_example.py | examples/gui_example.py |
from topo.inputsheet import *
from topo.kernelfactory import *
from topo.simulator import *
from topo.rfsom import RFSOM
from topo.image import ImageSaver
from math import pi
from topo.params import Dynamic
import random
import pdb #debugger
###########################################
# Set parameters
print "Setti... | Copy of rfsom_example.py except with 200 steps instead of 10000, and a topo.gui.link_to_sim() call | Copy of rfsom_example.py except with 200 steps instead of 10000, and a topo.gui.link_to_sim() call
| Python | bsd-3-clause | ioam/svn-history,ioam/svn-history,ioam/svn-history,ioam/svn-history,ioam/svn-history | ---
+++
@@ -0,0 +1,69 @@
+
+
+from topo.inputsheet import *
+from topo.kernelfactory import *
+from topo.simulator import *
+from topo.rfsom import RFSOM
+from topo.image import ImageSaver
+from math import pi
+from topo.params import Dynamic
+import random
+import pdb #debugger
+
+
+#################################... | |
ff3ba46f20ec06c5362b948019530fa6ffb43475 | mzalendo/core/management/commands/core_check_mp_aspirants.py | mzalendo/core/management/commands/core_check_mp_aspirants.py | from core.models import *
from django.core.management.base import NoArgsCommand, CommandError
class Command(NoArgsCommand):
help = "Go through people who are MP aspirants, and check that they're associated with a 2013 constituency"
def handle_noargs(self, **options):
next_session = ParliamentarySess... | Add a script to check the aspirant MPs | Add a script to check the aspirant MPs
| Python | agpl-3.0 | ken-muturi/pombola,mysociety/pombola,geoffkilpin/pombola,ken-muturi/pombola,hzj123/56th,patricmutwiri/pombola,mysociety/pombola,geoffkilpin/pombola,hzj123/56th,ken-muturi/pombola,mysociety/pombola,mysociety/pombola,hzj123/56th,geoffkilpin/pombola,geoffkilpin/pombola,geoffkilpin/pombola,patricmutwiri/pombola,mysociety/p... | ---
+++
@@ -0,0 +1,30 @@
+from core.models import *
+
+from django.core.management.base import NoArgsCommand, CommandError
+
+class Command(NoArgsCommand):
+
+ help = "Go through people who are MP aspirants, and check that they're associated with a 2013 constituency"
+
+ def handle_noargs(self, **options):
+ ... | |
e5dad84c986e94fe85c5923130ecc9e379ae2c93 | camoco/cli/commands/Analysis.py | camoco/cli/commands/Analysis.py | import camoco as co
class Analysis(object):
'''
Perform an analysis based on CLI arguments:
set up, event loop, tear down
'''
def __init__(self):
# Init needs to just store args and other analysis level data
self.args = args
self.tag = "Analysis"
def __call__(se... | Add stub class for future analysis class | Add stub class for future analysis class
| Python | mit | schae234/Camoco,schae234/Camoco | ---
+++
@@ -0,0 +1,44 @@
+import camoco as co
+
+class Analysis(object):
+ '''
+ Perform an analysis based on CLI arguments:
+ set up, event loop, tear down
+ '''
+ def __init__(self):
+ # Init needs to just store args and other analysis level data
+ self.args = args
+ self... | |
e83a58de8b0ac7c2d8ed001d5d4d609d2005d7d8 | approximate_patern_count.py | approximate_patern_count.py | from hamming_distance import hamming_distance
def approximate_pattern_count(text, pattern, d):
count = 0
pattern_length = len(pattern)
for i in range(0, len(text) - pattern_length + 1):
_pattern = text[i:i + pattern_length]
if (hamming_distance(pattern, _pattern) <= d):
count += 1
return count
... | Add aproximate pattern count algorithm | Add aproximate pattern count algorithm
| Python | mit | dennis95stumm/bioinformatics_algorithms,dennis95stumm/bioinformatics_algorithms | ---
+++
@@ -0,0 +1,17 @@
+from hamming_distance import hamming_distance
+
+def approximate_pattern_count(text, pattern, d):
+ count = 0
+ pattern_length = len(pattern)
+ for i in range(0, len(text) - pattern_length + 1):
+ _pattern = text[i:i + pattern_length]
+ if (hamming_distance(pattern, _pattern) <= d):... | |
4153237428b73c85062d1842aecc96c8ca42d06e | mainapp/migrations/0010_auto_20170911_1858.py | mainapp/migrations/0010_auto_20170911_1858.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-11 16:58
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0009_auto_20170911_1201'),
]
operations = [
migrations.RenameField(
... | Fix naming of location in meeting | Fix naming of location in meeting
| Python | mit | meine-stadt-transparent/meine-stadt-transparent,meine-stadt-transparent/meine-stadt-transparent,meine-stadt-transparent/meine-stadt-transparent,meine-stadt-transparent/meine-stadt-transparent | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.5 on 2017-09-11 16:58
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('mainapp', '0009_auto_20170911_1201'),
+ ]
+
+ operations... | |
d5950a23679753e5cfb70b4955b45dcf9298faec | corehq/apps/accounting/tests/test_wire_invoice.py | corehq/apps/accounting/tests/test_wire_invoice.py | from decimal import Decimal
from django.core import mail
from corehq.apps.accounting.tests.test_invoicing import BaseInvoiceTestCase
from corehq.apps.accounting import generator, utils, tasks
from corehq.apps.accounting.invoicing import DomainWireInvoiceFactory
from corehq.apps.accounting.models import Invoice, WireIn... | Test for wire invoice factory | Test for wire invoice factory
| Python | bsd-3-clause | dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq | ---
+++
@@ -0,0 +1,35 @@
+from decimal import Decimal
+from django.core import mail
+
+from corehq.apps.accounting.tests.test_invoicing import BaseInvoiceTestCase
+from corehq.apps.accounting import generator, utils, tasks
+from corehq.apps.accounting.invoicing import DomainWireInvoiceFactory
+from corehq.apps.accoun... | |
d421a51be6b8bc0cc30228f26e3e22ea62814efa | bmi_ilamb/tests/test_bmi.py | bmi_ilamb/tests/test_bmi.py | from nose.tools import assert_is, assert_equal
from bmi_ilamb import BmiIlamb
def test_component_name():
component = BmiIlamb()
name = component.get_component_name()
assert_equal(name, 'ILAMB')
assert_is(component.get_component_name(), name)
def test_start_time():
component = BmiIlamb()
asser... | Add nose tests for BMI methods | Add nose tests for BMI methods
| Python | mit | permamodel/bmi-ilamb | ---
+++
@@ -0,0 +1,46 @@
+from nose.tools import assert_is, assert_equal
+from bmi_ilamb import BmiIlamb
+
+def test_component_name():
+ component = BmiIlamb()
+ name = component.get_component_name()
+ assert_equal(name, 'ILAMB')
+ assert_is(component.get_component_name(), name)
+
+
+def test_start_time()... | |
53718f877a97fdff6e2a0862f6f6313c5ece5593 | src/ggrc/migrations/versions/20140930092005_53bb0f4f6ec8_switch_fulltext_record_properties.py | src/ggrc/migrations/versions/20140930092005_53bb0f4f6ec8_switch_fulltext_record_properties.py |
"""Switch fulltext_record_properties to innodb
Revision ID: 53bb0f4f6ec8
Revises: 63fc392c91a
Create Date: 2014-09-30 09:20:05.884100
"""
# revision identifiers, used by Alembic.
revision = '53bb0f4f6ec8'
down_revision = '63fc392c91a'
from alembic import op
def upgrade():
op.drop_index('fulltext_record_propert... | Switch myisam to innodb for fulltext_record_properties | Switch myisam to innodb for fulltext_record_properties
This change was made because fulltext record properties table
crashed on grc-dev and grc-test. The issue was resolved with
REPAIR TABLE clause. Running the reindex script did not help.
Based on https://cloud.google.com/sql/faq#innodb myisam should
only be used fo... | Python | apache-2.0 | uskudnik/ggrc-core,NejcZupec/ggrc-core,jmakov/ggrc-core,hyperNURb/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,hyperNURb/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,edofic/ggrc-core,josthkko/ggrc-core,josthkko/ggrc-core,kr41/ggrc-core,josthkko/ggrc-co... | ---
+++
@@ -0,0 +1,28 @@
+
+"""Switch fulltext_record_properties to innodb
+
+Revision ID: 53bb0f4f6ec8
+Revises: 63fc392c91a
+Create Date: 2014-09-30 09:20:05.884100
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '53bb0f4f6ec8'
+down_revision = '63fc392c91a'
+
+from alembic import op
+
+
+def upgrade... | |
f4c4ceb7eb3dcdc80c343ef53d9146a664fb6107 | site/api/migrations/0009_load_pos_fixture_data.py | site/api/migrations/0009_load_pos_fixture_data.py | # -*- coding: utf-8 -*-
from django.db import models, migrations
from django.core.management import call_command
app_name = 'api'
fixture = model_name = 'PartOfSpeech'
def load_fixture(apps, schema_editor):
call_command('loaddata', fixture, app_label=app_name)
def unload_fixture(apps, schema_editor):
"Dele... | Create migration to load POS fixture data | Create migration to load POS fixture data | Python | mit | LitPalimpsest/parser-api-search,LitPalimpsest/parser-api-search,LitPalimpsest/parser-api-search | ---
+++
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+from django.db import models, migrations
+from django.core.management import call_command
+
+app_name = 'api'
+fixture = model_name = 'PartOfSpeech'
+
+
+def load_fixture(apps, schema_editor):
+ call_command('loaddata', fixture, app_label=app_name)
+
+
+def unload... | |
c32fdfa008d89cdbab7bd06529647958224a4e49 | migrations/versions/0253_set_template_postage_.py | migrations/versions/0253_set_template_postage_.py | """
Revision ID: 0253_set_template_postage
Revises: 0252_letter_branding_table
Create Date: 2019-01-30 16:47:08.599448
"""
from alembic import op
import sqlalchemy as sa
revision = '0253_set_template_postage'
down_revision = '0252_letter_branding_table'
def upgrade():
# ### commands auto generated by Alembic ... | Set postage for all existing templates to service default | Set postage for all existing templates to service default
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,28 @@
+"""
+
+Revision ID: 0253_set_template_postage
+Revises: 0252_letter_branding_table
+Create Date: 2019-01-30 16:47:08.599448
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+revision = '0253_set_template_postage'
+down_revision = '0252_letter_branding_table'
+
+
+def upgrade():
+ ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.