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 |
|---|---|---|---|---|---|---|---|---|---|---|
9623a504b1856116c096fbdeedd8555dc6423549 | candidates/tests/test_validators.py | candidates/tests/test_validators.py | from django.test import TestCase
from ..forms import BasePersonForm
class TestValidators(TestCase):
def test_twitter_bad_url(self):
form = BasePersonForm({
'name': 'John Doe',
'twitter_username': 'http://example.org/blah',
})
self.assertFalse(form.is_valid())
... | Add tests for the twitter_username validator | Add tests for the twitter_username validator
| Python | agpl-3.0 | neavouli/yournextrepresentative,mysociety/yournextrepresentative,datamade/yournextmp-popit,mysociety/yournextrepresentative,mysociety/yournextrepresentative,neavouli/yournextrepresentative,neavouli/yournextrepresentative,openstate/yournextrepresentative,YoQuieroSaber/yournextrepresentative,openstate/yournextrepresentat... | ---
+++
@@ -0,0 +1,44 @@
+from django.test import TestCase
+
+from ..forms import BasePersonForm
+
+class TestValidators(TestCase):
+
+ def test_twitter_bad_url(self):
+ form = BasePersonForm({
+ 'name': 'John Doe',
+ 'twitter_username': 'http://example.org/blah',
+ })
+ ... | |
ccd19cb7676d073c771fedbf644b794ac02dd70c | pgallery/migrations/0005_auto_20200412_1111.py | pgallery/migrations/0005_auto_20200412_1111.py | # Generated by Django 2.2.12 on 2020-04-12 11:11
import django.contrib.postgres.fields.hstore
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('pgallery', '0004_auto_20160416_2351'),
]
operations = [
migrations.AlterField(
model_name=... | Add missing migration file for exif change. | Add missing migration file for exif change.
| Python | mit | zsiciarz/django-pgallery,zsiciarz/django-pgallery | ---
+++
@@ -0,0 +1,19 @@
+# Generated by Django 2.2.12 on 2020-04-12 11:11
+
+import django.contrib.postgres.fields.hstore
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('pgallery', '0004_auto_20160416_2351'),
+ ]
+
+ operations = [
+ migra... | |
93dcc1d93c8ecf17b9c07fc88b670ca1bd7e115b | 01_challenge/test_solution.py | 01_challenge/test_solution.py | import unittest
from solution import body_mass_index, shape_of
class TestBodyMassIndex(unittest.TestCase):
def test_body_mass_index(self):
self.assertEqual(body_mass_index(90, 2), 22.5)
self.assertEqual(body_mass_index(90, 1.88), 25.5)
class TestShapeOf(unittest.TestCase):
def test_shape_of_... | Add tests for 01 challenge. | Add tests for 01 challenge.
| Python | mit | pepincho/Python-Course-FMI | ---
+++
@@ -0,0 +1,46 @@
+import unittest
+from solution import body_mass_index, shape_of
+
+
+class TestBodyMassIndex(unittest.TestCase):
+ def test_body_mass_index(self):
+ self.assertEqual(body_mass_index(90, 2), 22.5)
+ self.assertEqual(body_mass_index(90, 1.88), 25.5)
+
+
+class TestShapeOf(unit... | |
777ac84471f3baf02dbe49ca93dc2f45433a3967 | CodeFights/removeArrayPart.py | CodeFights/removeArrayPart.py | #!/usr/local/bin/python
# Code Fights Remove Array Part Problem
def removeArrayPart(inputArray, l, r):
return inputArray[:l] + inputArray[r + 1:]
def main():
tests = [
[[2, 3, 2, 3, 4, 5], 2, 4, [2, 3, 5]],
[[2, 4, 10, 1], 0, 2, [1]],
[[5, 3, 2, 3, 4], 1, 1, [5, 2, 3, 4]]
]
... | Solve Code Fights remove array part problem | Solve Code Fights remove array part problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/local/bin/python
+# Code Fights Remove Array Part Problem
+
+
+def removeArrayPart(inputArray, l, r):
+ return inputArray[:l] + inputArray[r + 1:]
+
+
+def main():
+ tests = [
+ [[2, 3, 2, 3, 4, 5], 2, 4, [2, 3, 5]],
+ [[2, 4, 10, 1], 0, 2, [1]],
+ [[5, 3, 2... | |
845700256b6e33d35d49fce1fca57c0fd95a9947 | examples/slow_task.py | examples/slow_task.py | from unreal_engine import FSlowTask
import time
# Create an FSlowTask object, defining the amount of work that
# will be done, and the initial message.
t = FSlowTask(10, "Doing Something")
t.initialize()
# Make the dialog, and include a Cancel button (default is not to
# allow a cancel button).
t.make_dialog(True)
t... | Add usage example for FSlowTask | Add usage example for FSlowTask
| Python | mit | 20tab/UnrealEnginePython,getnamo/UnrealEnginePython,kitelightning/UnrealEnginePython,20tab/UnrealEnginePython,20tab/UnrealEnginePython,getnamo/UnrealEnginePython,kitelightning/UnrealEnginePython,kitelightning/UnrealEnginePython,20tab/UnrealEnginePython,getnamo/UnrealEnginePython,getnamo/UnrealEnginePython,kitelightning... | ---
+++
@@ -0,0 +1,28 @@
+from unreal_engine import FSlowTask
+import time
+
+# Create an FSlowTask object, defining the amount of work that
+# will be done, and the initial message.
+t = FSlowTask(10, "Doing Something")
+t.initialize()
+
+# Make the dialog, and include a Cancel button (default is not to
+# allow a c... | |
10118cdd99a0e7b11c266ded5491099b82f5634c | src/cloudant/design_document.py | src/cloudant/design_document.py | #!/usr/bin/env python
"""
_design_document_
Class representing a Cloudant design document
"""
from .document import Document
from .views import View
class DesignDocument(Document):
"""
_DesignDocument_
Specialisation of a document to be a design doc containing
the various views, shows, lists etc.
... | Copy DesignDocument class to its own module | Copy DesignDocument class to its own module
| Python | apache-2.0 | cloudant/python-cloudant | ---
+++
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+"""
+_design_document_
+
+Class representing a Cloudant design document
+
+"""
+from .document import Document
+from .views import View
+
+
+class DesignDocument(Document):
+ """
+ _DesignDocument_
+
+ Specialisation of a document to be a design doc containin... | |
08b90a093d900576f1f6f11d288335e37cecda3d | umibukela/migrations/0012_surveykoboproject.py | umibukela/migrations/0012_surveykoboproject.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('umibukela', '0011_cycleresultset_published'),
]
operations = [
migrations.CreateModel(
name='SurveyKoboProject',... | Add SurveyKoboProject which optionally indicates a form/submission origin | Add SurveyKoboProject which optionally indicates a form/submission origin
| Python | mit | Code4SA/umibukela,Code4SA/umibukela,Code4SA/umibukela,Code4SA/umibukela | ---
+++
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('umibukela', '0011_cycleresultset_published'),
+ ]
+
+ operations = [
+ migrations.CreateMod... | |
ebee9620201ad9609e8b6d6a5322672d4bd52479 | tests/help_test.py | tests/help_test.py | import os
import subprocess
import sys
import unittest
import mopidy
class HelpTest(unittest.TestCase):
def test_help_has_mopidy_options(self):
mopidy_dir = os.path.dirname(mopidy.__file__)
args = [sys.executable, mopidy_dir, '--help']
process = subprocess.Popen(args, stdout=subprocess.PIP... | Test that --help returns the options we expect it to | Test that --help returns the options we expect it to
| Python | apache-2.0 | hkariti/mopidy,glogiotatidis/mopidy,tkem/mopidy,tkem/mopidy,ZenithDK/mopidy,mokieyue/mopidy,vrs01/mopidy,tkem/mopidy,jmarsik/mopidy,pacificIT/mopidy,jodal/mopidy,vrs01/mopidy,swak/mopidy,rawdlite/mopidy,ali/mopidy,quartz55/mopidy,bacontext/mopidy,bacontext/mopidy,glogiotatidis/mopidy,priestd09/mopidy,kingosticks/mopidy... | ---
+++
@@ -0,0 +1,19 @@
+import os
+import subprocess
+import sys
+import unittest
+
+import mopidy
+
+class HelpTest(unittest.TestCase):
+ def test_help_has_mopidy_options(self):
+ mopidy_dir = os.path.dirname(mopidy.__file__)
+ args = [sys.executable, mopidy_dir, '--help']
+ process = subpr... | |
d5f34e856d492fbc670eb3020bf2dcaef298cfdb | get_percentage_of_unmergeable_PRs.py | get_percentage_of_unmergeable_PRs.py | #!/usr/bin/env python3
"""Print the percentage of unmergeable PRs and some associated stats."""
import github_tools
Repo = github_tools.get_repo()
merge_true = 0
merge_false = 0
nr_prs = 0
pulls = Repo.get_pulls('open')
for p in pulls:
nr_prs += 1
print("nr " + str(p.number) + ", mergeable:" + str(p.mergeab... | Add first version of percent unmergeable PRs script. | Add first version of percent unmergeable PRs script. | Python | mit | bilderbuchi/OF_repo_utilities | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+
+"""Print the percentage of unmergeable PRs and some associated stats."""
+
+import github_tools
+
+Repo = github_tools.get_repo()
+merge_true = 0
+merge_false = 0
+nr_prs = 0
+
+pulls = Repo.get_pulls('open')
+for p in pulls:
+ nr_prs += 1
+ print("nr " + str(... | |
3b7dd989f8b2366a47810e0c1cb6daf76a3c806c | opps/core/tests/test_cache.py | opps/core/tests/test_cache.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from unittest import TestCase
from django.http import HttpRequest
from opps.core.cache import cache_page
class DecoratorsTest(TestCase):
def test_cache_page_new_style(self):
"""
Test that we can call cache_page the new way
"""
def my_... | Create test cache page new style | Create test cache page new style
| Python | mit | opps/opps,williamroot/opps,opps/opps,jeanmask/opps,opps/opps,YACOWS/opps,jeanmask/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,YACOWS/opps,williamroot/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,opps/opps | ---
+++
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+from unittest import TestCase
+from django.http import HttpRequest
+
+from opps.core.cache import cache_page
+
+
+class DecoratorsTest(TestCase):
+
+ def test_cache_page_new_style(self):
+ """
+ Test that we can call cache_page... | |
85359a24d844c19db9d07c268185c9a0310a181d | nova/db/sqlalchemy/migrate_repo/versions/178_add_index_to_compute_node_stats.py | nova/db/sqlalchemy/migrate_repo/versions/178_add_index_to_compute_node_stats.py | # Copyright 2013 Rackspace Hosting
# 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 require... | Add an index to compute_node_stats | Add an index to compute_node_stats
This will improve the performance of scheduler lookups of compute nodes
and their associated stats.
bug 1177487
Change-Id: I0e04849543916e874ea0ddfc76c3d70ff71c09d0
| Python | apache-2.0 | ntt-sic/nova,tianweizhang/nova,raildo/nova,mmnelemane/nova,cyx1231st/nova,affo/nova,double12gzh/nova,alvarolopez/nova,rrader/nova-docker-plugin,CEG-FYP-OpenStack/scheduler,mikalstill/nova,DirectXMan12/nova-hacking,shahar-stratoscale/nova,akash1808/nova_test_latest,OpenAcademy-OpenStack/nova-scheduler,Juniper/nova,Twink... | ---
+++
@@ -0,0 +1,37 @@
+# Copyright 2013 Rackspace Hosting
+# 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/license... | |
d23e5e4cde838c1aa46b0e085955cdb959e6755a | tools/win32build/doall.py | tools/win32build/doall.py | import subprocess
import os
PYVER = "2.5"
# Bootstrap
subprocess.check_call(['python', 'prepare_bootstrap.py'])
# Build binaries
subprocess.check_call(['python', 'build.py', '-p', PYVER], cwd = 'bootstrap-%s' % PYVER)
# Build installer using nsis
subprocess.check_call(['makensis', 'numpy-superinstaller.... | Add top script to generate binaries from scratch. | Add top script to generate binaries from scratch.
| Python | bsd-3-clause | dato-code/numpy,pbrod/numpy,madphysicist/numpy,Srisai85/numpy,MaPePeR/numpy,MaPePeR/numpy,dimasad/numpy,rhythmsosad/numpy,astrofrog/numpy,andsor/numpy,seberg/numpy,Anwesh43/numpy,mathdd/numpy,behzadnouri/numpy,matthew-brett/numpy,BMJHayward/numpy,Eric89GXL/numpy,jorisvandenbossche/numpy,ekalosak/numpy,naritta/numpy,ESS... | ---
+++
@@ -0,0 +1,13 @@
+import subprocess
+import os
+
+PYVER = "2.5"
+
+# Bootstrap
+subprocess.check_call(['python', 'prepare_bootstrap.py'])
+
+# Build binaries
+subprocess.check_call(['python', 'build.py', '-p', PYVER], cwd = 'bootstrap-%s' % PYVER)
+
+# Build installer using nsis
+subprocess.check_call(['maken... | |
58c64960b1ea646138b0a423cce14bbd86c18391 | choose_rand_packages.py | choose_rand_packages.py | import argparse
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument("package_list", help="List of packages you want to " +
"choose from")
parser.add_argument("output_file")
parser.add_argument("-n", type=int)
args = parser.parse_args()
packages = [package.strip() for package i... | Add script to randomly choose n packages | Add script to randomly choose n packages
Signed-off-by: Harsh Gupta <c4bd8559369e527b4bb1785ff84e8ff50fde87c0@gmail.com>
| Python | bsd-3-clause | ContinuumIO/pypi-conda-builds | ---
+++
@@ -0,0 +1,18 @@
+import argparse
+import numpy as np
+parser = argparse.ArgumentParser()
+parser.add_argument("package_list", help="List of packages you want to " +
+ "choose from")
+parser.add_argument("output_file")
+parser.add_argument("-n", type=int)
+args = parser.parse_args()
+
+pack... | |
7c3cf6ca93e4d234b9766a5c1eafbf0fe4d1104c | liblinesdk/api/permissions.py | liblinesdk/api/permissions.py | # coding: utf-8
import requests
def get(access_token):
h={'Authorization': 'Bearer ' + access_token}
r=requests.get('https://api.line.me/v1/permissions', headers=h)
print 'status code: ', r.status_code
print 'headers: ', r.headers
print 'content: ', r.content
| Add permission list checking feature | feat: Add permission list checking feature
| Python | mit | mrexmelle/liblinesdk-py | ---
+++
@@ -0,0 +1,10 @@
+# coding: utf-8
+
+import requests
+
+def get(access_token):
+ h={'Authorization': 'Bearer ' + access_token}
+ r=requests.get('https://api.line.me/v1/permissions', headers=h)
+ print 'status code: ', r.status_code
+ print 'headers: ', r.headers
+ print 'content: ', r.content | |
532b4f9ff9b32ba0b427f015b9a18ebce0b1e91b | cms/plugins/snippet/models.py | cms/plugins/snippet/models.py | from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin
from django.conf import settings
if 'reversion' in settings.INSTALLED_APPS:
import reversion
# Stores the actual data
class Snippet(models.Model):
"""
A snippet of HTML or a Django templat... | from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin
from django.conf import settings
if 'reversion' in settings.INSTALLED_APPS:
import reversion
# Stores the actual data
class Snippet(models.Model):
"""
A snippet of HTML or a Django templat... | Use max_length=255 instead of 256 to be nice to MySQL indexing | Use max_length=255 instead of 256 to be nice to MySQL indexing
Signed-off-by: Patrick Lauber <13f2d5de65599746f4871ec052d451e6ee4f4f27@divio.ch> | Python | bsd-3-clause | vad/django-cms,SachaMPS/django-cms,chkir/django-cms,philippze/django-cms,vxsx/django-cms,intip/django-cms,donce/django-cms,benzkji/django-cms,AlexProfi/django-cms,rsalmaso/django-cms,foobacca/django-cms,memnonila/django-cms,robmagee/django-cms,evildmp/django-cms,ScholzVolkmer/django-cms,donce/django-cms,saintbird/djang... | ---
+++
@@ -11,7 +11,7 @@
"""
A snippet of HTML or a Django template
"""
- name = models.CharField(_("name"), max_length=256, unique=True)
+ name = models.CharField(_("name"), max_length=255, unique=True)
html = models.TextField(_("HTML"), blank=True)
def __unicode__(self): |
31292e0648cd8c22011de5051030927579b794c8 | qtpy/tests/test_sip.py | qtpy/tests/test_sip.py | import pytest
def test_sip():
"""Test the qtpy.sip namespace"""
sip = pytest.importorskip("qtpy.sip")
assert sip.assign is not None
assert sip.cast is not None
assert sip.delete is not None
assert sip.dump is not None
assert sip.enableautoconversion is not None
assert sip.isdeleted is ... | Add tests for sip module | Add tests for sip module
| Python | mit | spyder-ide/qtpy | ---
+++
@@ -0,0 +1,24 @@
+import pytest
+
+def test_sip():
+ """Test the qtpy.sip namespace"""
+ sip = pytest.importorskip("qtpy.sip")
+
+ assert sip.assign is not None
+ assert sip.cast is not None
+ assert sip.delete is not None
+ assert sip.dump is not None
+ assert sip.enableautoconversion is... | |
d5392679e7ee3aa22b44a5553cca69b632bf5991 | server/tests/forms/test_RegistrationForm.py | server/tests/forms/test_RegistrationForm.py | import wtforms_json
import pytest
from forms.RegistrationForm import RegistrationForm
wtforms_json.init()
class TestRegistrationForm:
def test_valid(self):
json = {
'username': 'someusername',
'password': 'password',
'confirm': 'confirm',
'email': 'someem... | Add test for valid registration form | Add test for valid registration form
| Python | mit | ganemone/ontheside,ganemone/ontheside,ganemone/ontheside | ---
+++
@@ -0,0 +1,20 @@
+import wtforms_json
+import pytest
+
+from forms.RegistrationForm import RegistrationForm
+
+wtforms_json.init()
+
+
+class TestRegistrationForm:
+
+ def test_valid(self):
+ json = {
+ 'username': 'someusername',
+ 'password': 'password',
+ 'confirm... | |
d4d3f51482c8422f26317b99378aae90196b3fe5 | plugins/camera/take_photo.py | plugins/camera/take_photo.py | outputs = []
files = []
def process_message(data):
if data['channel'].startswith("D"):
outputs.append([data['channel'], "I shall send you an image!" ])
files.append([data['channel'], "image.png" ])
| Add start of photo plugin | Add start of photo plugin
| Python | mit | martinpeck/peckbot | ---
+++
@@ -0,0 +1,7 @@
+outputs = []
+files = []
+
+def process_message(data):
+ if data['channel'].startswith("D"):
+ outputs.append([data['channel'], "I shall send you an image!" ])
+ files.append([data['channel'], "image.png" ]) | |
b43b085b14c1d6f9fc07bf8c4ef6c3dca3c1041f | glaciercmd/command_delete_archive_from_vault.py | glaciercmd/command_delete_archive_from_vault.py | import boto
from boto.glacier.exceptions import UnexpectedHTTPResponseError
class CommandDeleteArchiveFromVault(object):
def execute(self, args, config):
glacier_connection = boto.connect_glacier(aws_access_key_id=config.get('configuration', 'aws_key'), aws_secret_access_key=config.get('configuration', 'aws_sec... | Add command to delete archives | Add command to delete archives
| Python | mit | carsonmcdonald/glacier-cmd | ---
+++
@@ -0,0 +1,27 @@
+import boto
+from boto.glacier.exceptions import UnexpectedHTTPResponseError
+
+class CommandDeleteArchiveFromVault(object):
+
+ def execute(self, args, config):
+ glacier_connection = boto.connect_glacier(aws_access_key_id=config.get('configuration', 'aws_key'), aws_secret_access_key=co... | |
1696a97a735b3eb26ddaf445c4258e0faac880a4 | lintcode/Medium/098_Sort_List.py | lintcode/Medium/098_Sort_List.py | """
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param head: The first node of the linked list.
@return: You should return the head of the sorted linked list,
using constant ... | Add solution to lintcode question 98 | Add solution to lintcode question 98
| Python | mit | Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode | ---
+++
@@ -0,0 +1,87 @@
+"""
+Definition of ListNode
+class ListNode(object):
+
+ def __init__(self, val, next=None):
+ self.val = val
+ self.next = next
+"""
+class Solution:
+ """
+ @param head: The first node of the linked list.
+ @return: You should return the head of the sorted linked ... | |
b2f27b6186c118887c42d4bf5834e869dacf6a66 | galaxy/main/migrations/0058_stargazer_role_not_null.py | galaxy/main/migrations/0058_stargazer_role_not_null.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0057_stargazer_role_reference'),
]
operations = [
migrations.AlterField(
model_name='stargazer',
... | Make model field `Stargazer.role` not nullable | Make model field `Stargazer.role` not nullable
| Python | apache-2.0 | chouseknecht/galaxy,chouseknecht/galaxy,chouseknecht/galaxy,chouseknecht/galaxy | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('main', '0057_stargazer_role_reference'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ ... | |
a9d263f1d8e30f1bc93b51a29679039e76fede9d | common/djangoapps/student/management/commands/edraak_migrate_userprofile_name_en.py | common/djangoapps/student/management/commands/edraak_migrate_userprofile_name_en.py | from __future__ import print_function
from django.core.management.base import BaseCommand
from django.db import connection, migrations
from django.db.utils import OperationalError
from student.models import UserProfile
def check_name_en():
"""
Check whether (name_en) exists or not. This is helpful when migra... | Add a Command to Migrate UserProfile.name_en | Add a Command to Migrate UserProfile.name_en
| Python | agpl-3.0 | Edraak/edraak-platform,Edraak/edraak-platform,Edraak/edraak-platform,Edraak/edraak-platform | ---
+++
@@ -0,0 +1,54 @@
+from __future__ import print_function
+
+from django.core.management.base import BaseCommand
+from django.db import connection, migrations
+from django.db.utils import OperationalError
+from student.models import UserProfile
+
+
+def check_name_en():
+ """
+ Check whether (name_en) exi... | |
9a32463bd0ee5f90b004fac3cb53a0adfd9b4534 | src/ggrc/migrations/versions/20160414223705_7a9b715ec504_add_slug_to_assessment_template.py | src/ggrc/migrations/versions/20160414223705_7a9b715ec504_add_slug_to_assessment_template.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: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
"""
Add slug to assessment template
Create Date: 2016-04-14 22:37:05.135072
"""... | Add slug column to assessment template table | Add slug column to assessment template table
| Python | apache-2.0 | NejcZupec/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,selahssea/ggrc-core,edofic/ggrc-core,AleksNeStu/ggrc-core,kr41/ggrc-core,andrei-karalionak/ggrc-core,j0gurt/ggrc-core,NejcZupec/ggrc-core,josthkko/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core... | ---
+++
@@ -0,0 +1,49 @@
+# 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: miha@reciprocitylabs.com
+# Maintained By: miha@reciprocitylabs.com
+
+"""
+Add slug to assessment template
+
+Create ... | |
22abc8c12bea0202fede404c81a6218100e6d0aa | src/ggrc/migrations/versions/20160417113424_4f0077b3393f_add_commentable_for_assessments.py | src/ggrc/migrations/versions/20160417113424_4f0077b3393f_add_commentable_for_assessments.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: dan@reciprocitylabs.com
# Maintained By: peter@reciprocitylabs.com
"""Request comment notifications.
Create Date: 2016-03-21 11:07:07.327760
"""
#... | Add comment columns to assessments table | Add comment columns to assessments table
| Python | apache-2.0 | j0gurt/ggrc-core,josthkko/ggrc-core,NejcZupec/ggrc-core,plamut/ggrc-core,josthkko/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,andrei-karalionak/ggrc-core,j0gurt/ggrc-core,andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,prasannav7/ggrc-core,edofic/ggrc-core,selahssea/ggrc-core,edofic/ggrc-core,AleksNeStu... | ---
+++
@@ -0,0 +1,37 @@
+# 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: dan@reciprocitylabs.com
+# Maintained By: peter@reciprocitylabs.com
+
+"""Request comment notifications.
+
+Create Dat... | |
0c08e612be2516c3a9b53a641b1a982c609d3913 | dipy/core/tests/test_qball.py | dipy/core/tests/test_qball.py | """ Testing qball
"""
import numpy as np
import dipy.core.qball as qball
from nose.tools import assert_true, assert_false, \
assert_equal, assert_raises
from numpy.testing import assert_array_equal, assert_array_almost_equal
from dipy.testing import parametric
@parametric
def test_real_sph_harm():
rea... | TEST - skeleton of tests for qball | TEST - skeleton of tests for qball
| Python | bsd-3-clause | sinkpoint/dipy,matthieudumont/dipy,rfdougherty/dipy,maurozucchelli/dipy,FrancoisRheaultUS/dipy,Messaoud-Boudjada/dipy,jyeatman/dipy,mdesco/dipy,maurozucchelli/dipy,maurozucchelli/dipy,samuelstjean/dipy,beni55/dipy,Messaoud-Boudjada/dipy,StongeEtienne/dipy,villalonreina/dipy,JohnGriffiths/dipy,jyeatman/dipy,beni55/dipy,... | ---
+++
@@ -0,0 +1,21 @@
+""" Testing qball
+
+"""
+
+import numpy as np
+
+import dipy.core.qball as qball
+
+from nose.tools import assert_true, assert_false, \
+ assert_equal, assert_raises
+
+from numpy.testing import assert_array_equal, assert_array_almost_equal
+
+from dipy.testing import parametric
+
+
+@... | |
10c6add532215a8acb1a690010298c4c7c91517c | find_dups.py | find_dups.py | import sys, os, urllib, StringIO, traceback, cgi, binascii, getopt
import store, config
try:
config = config.Config(sys.argv[1], 'webui')
except IndexError:
print "Usage: find_dups.py config.ini"
raise SystemExit
store = store.Store(config)
store.open()
def owner_email(p):
result = set()
for r,u ... | Add script to email users of name-conflicting packages. | Add script to email users of name-conflicting packages.
| Python | bsd-3-clause | pydotorg/pypi,pydotorg/pypi,pydotorg/pypi,pydotorg/pypi | ---
+++
@@ -0,0 +1,46 @@
+import sys, os, urllib, StringIO, traceback, cgi, binascii, getopt
+import store, config
+
+try:
+ config = config.Config(sys.argv[1], 'webui')
+except IndexError:
+ print "Usage: find_dups.py config.ini"
+ raise SystemExit
+
+store = store.Store(config)
+store.open()
+
+def owner_e... | |
ee8067047e86b8f6aa8581b8b8f18e45383ce03e | talkoohakemisto/migrations/versions/1ef4e5f61dac_add_finnish_collations_to_all_text_columns.py | talkoohakemisto/migrations/versions/1ef4e5f61dac_add_finnish_collations_to_all_text_columns.py | """Add Finnish collations to all text columns
Revision ID: 1ef4e5f61dac
Revises: 485b2296735
Create Date: 2014-02-09 21:51:35.842781
"""
# revision identifiers, used by Alembic.
revision = '1ef4e5f61dac'
down_revision = '485b2296735'
from alembic import op
def upgrade():
op.execute(
'''
ALTER ... | Add Finnish collation to all text columns | Add Finnish collation to all text columns
| Python | mit | talkoopaiva/talkoohakemisto-api | ---
+++
@@ -0,0 +1,126 @@
+"""Add Finnish collations to all text columns
+
+Revision ID: 1ef4e5f61dac
+Revises: 485b2296735
+Create Date: 2014-02-09 21:51:35.842781
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '1ef4e5f61dac'
+down_revision = '485b2296735'
+
+from alembic import op
+
+
+def upgrade()... | |
0d979e1ea235014470f1357331130da46488eb66 | test_against_full_data_set.py | test_against_full_data_set.py | from csvreader import read_patient_csv
from patient_solver import solve_for_patient
from patient_state import PatientState
def test_against_real_data():
patients = read_patient_csv();
params = PatientState.schnider_params()
for patient in patients[6:7]:
results = solve_for_patient(patient, params... | Add a test which compares the schnider params against the full data set | Add a test which compares the schnider params against the full data set
| Python | mit | JMathiszig-Lee/Propofol | ---
+++
@@ -0,0 +1,16 @@
+from csvreader import read_patient_csv
+from patient_solver import solve_for_patient
+from patient_state import PatientState
+
+def test_against_real_data():
+ patients = read_patient_csv();
+
+ params = PatientState.schnider_params()
+
+ for patient in patients[6:7]:
+ resul... | |
9763156fbf2ccfbc5679c2264593917aa416bc24 | tests/unit/test_soundcloud_track.py | tests/unit/test_soundcloud_track.py | from nose.tools import * # noqa
import datetime
from pmg.models.soundcloud_track import SoundcloudTrack
from pmg.models import db, File, Event, EventFile
from tests import PMGTestCase
class TestUser(PMGTestCase):
def test_get_unstarted_query(self):
event = Event(
date=datetime.datetime.today... | Add unit test for Soundcloud get_unstarted_query function | Add unit test for Soundcloud get_unstarted_query function
| Python | apache-2.0 | Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2 | ---
+++
@@ -0,0 +1,36 @@
+from nose.tools import * # noqa
+import datetime
+
+from pmg.models.soundcloud_track import SoundcloudTrack
+from pmg.models import db, File, Event, EventFile
+from tests import PMGTestCase
+
+
+class TestUser(PMGTestCase):
+ def test_get_unstarted_query(self):
+ event = Event(
+ ... | |
3c8e0de0c5e39ee773ff4860d5dff651741e31fa | plugin/tests/test_mockcontext.py | plugin/tests/test_mockcontext.py | from cloudify.mocks import (MockCloudifyContext,
MockNodeInstanceContext,
)
class MockNodeInstanceContextRelationships(MockNodeInstanceContext):
def __init__(self, id=None, runtime_properties=None, relationships=None):
super(MockNodeInstanceContextRe... | ADD (94) class MockCloudifyContextRelationships to mock relationships behaviour | ADD (94) class MockCloudifyContextRelationships to mock relationships behaviour
| Python | apache-2.0 | fastconnect/cloudify-azure-plugin | ---
+++
@@ -0,0 +1,113 @@
+from cloudify.mocks import (MockCloudifyContext,
+ MockNodeInstanceContext,
+ )
+
+
+class MockNodeInstanceContextRelationships(MockNodeInstanceContext):
+
+ def __init__(self, id=None, runtime_properties=None, relationships=None):
+ ... | |
28cc02a3b2918cf7baca36e15749fce57a76ea66 | website/management/commands/delete_documents.py | website/management/commands/delete_documents.py | from django.core.management.base import BaseCommand
from document.models import Document, Kamerstuk
import scraper.documents
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('dossier_id', nargs='+', type=int)
def handle(self, *args, **options):
# dossier_id =... | Create command to delete documents of a given dossier | Create command to delete documents of a given dossier
| Python | mit | openkamer/openkamer,openkamer/openkamer,openkamer/openkamer,openkamer/openkamer | ---
+++
@@ -0,0 +1,17 @@
+from django.core.management.base import BaseCommand
+
+from document.models import Document, Kamerstuk
+import scraper.documents
+
+
+class Command(BaseCommand):
+
+ def add_arguments(self, parser):
+ parser.add_argument('dossier_id', nargs='+', type=int)
+
+ def handle(self, *a... | |
927396038d147b633bee31988cf1e016258c5320 | scripts/diff_incar.py | scripts/diff_incar.py | #!/usr/bin/env python
'''
Created on Nov 12, 2011
'''
__author__="Shyue Ping Ong"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Nov 12, 2011"
import sys
import itertools
from pymatgen.io.vaspio import Incar
from p... | Add a script for easy diffing of two Incars. | Add a script for easy diffing of two Incars.
| Python | mit | rousseab/pymatgen,Bismarrck/pymatgen,migueldiascosta/pymatgen,ctoher/pymatgen,Dioptas/pymatgen,Bismarrck/pymatgen,Bismarrck/pymatgen,rousseab/pymatgen,rousseab/pymatgen,yanikou19/pymatgen,sonium0/pymatgen,yanikou19/pymatgen,migueldiascosta/pymatgen,Dioptas/pymatgen,Bismarrck/pymatgen,ctoher/pymatgen,sonium0/pymatgen,so... | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+'''
+Created on Nov 12, 2011
+'''
+
+__author__="Shyue Ping Ong"
+__copyright__ = "Copyright 2011, The Materials Project"
+__version__ = "0.1"
+__maintainer__ = "Shyue Ping Ong"
+__email__ = "shyue@mit.edu"
+__date__ = "Nov 12, 2011"
+
+import sys
+import itertools
+... | |
e6d4bc772098fb8a1c0948889c05d51f0cc3a101 | examples/tests/test_satellites.py | examples/tests/test_satellites.py | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... | Test the satellites notebook specifically (though no satellite-specific tests yet). | Test the satellites notebook specifically (though no satellite-specific tests yet).
| Python | apache-2.0 | probcomp/bdbcontrib,probcomp/bdbcontrib | ---
+++
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
+#
+# 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
+#
+# h... | |
59399420a415c3cb890936dcc499ddf81ef0f438 | features/memberships/querysets.py | features/memberships/querysets.py | from django.db import models
from django.db.models import Case, When, Value, IntegerField, Sum
from django.utils.timezone import now, timedelta
class MembershipQuerySet(models.QuerySet):
def order_by_gestalt_activity(self, gestalt):
a_week_ago = now() - timedelta(days=7)
a_month_ago = now() - time... | Add queryset for ordering memberships by activity | Add queryset for ordering memberships by activity
| Python | agpl-3.0 | stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten | ---
+++
@@ -0,0 +1,55 @@
+from django.db import models
+from django.db.models import Case, When, Value, IntegerField, Sum
+from django.utils.timezone import now, timedelta
+
+
+class MembershipQuerySet(models.QuerySet):
+ def order_by_gestalt_activity(self, gestalt):
+ a_week_ago = now() - timedelta(days=7)... | |
3c2f0786d7d092c2e1a57036c93e92ea6d67fe7c | gen_homebrew_formula.py | gen_homebrew_formula.py | #!/usr/bin/env python
# encoding: utf-8
'''
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
'''
from __future__ import print_function, unicode_literals
import io
import os
import sys
from textwrap import indent
import sqlitebiter
from subprocrunner import SubprocessRunner
def main():
formula_b... | Add a script to create homebrew formula | Add a script to create homebrew formula
| Python | mit | thombashi/sqlitebiter,thombashi/sqlitebiter | ---
+++
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+'''
+.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
+'''
+
+from __future__ import print_function, unicode_literals
+
+import io
+import os
+import sys
+from textwrap import indent
+
+import sqlitebiter
+from subprocrunner import S... | |
338217886caebbc34150b1c7575aa3ee845ed5cd | IPython/lib/tests/test_pretty.py | IPython/lib/tests/test_pretty.py | """Tests for IPython.lib.pretty.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2011, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#---------... | Add test for the indentation fix. | Add test for the indentation fix.
| Python | bsd-3-clause | ipython/ipython,ipython/ipython | ---
+++
@@ -0,0 +1,49 @@
+"""Tests for IPython.lib.pretty.
+"""
+#-----------------------------------------------------------------------------
+# Copyright (c) 2011, the IPython Development Team.
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distrib... | |
2571453a54b195adc6a961b20d798e95ab885f67 | selfdrive/debug/filter_log_message.py | selfdrive/debug/filter_log_message.py | #!/usr/bin/env python3
import os
import argparse
import json
import cereal.messaging as messaging
LEVELS = {
"DEBUG": 10,
"INFO": 20,
"WARNING": 30,
"ERROR": 40,
"CRITICAL": 50,
}
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--level', default='DEBUG')
parser.a... | Add script to nicely print logMessages | Add script to nicely print logMessages
| Python | mit | commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot | ---
+++
@@ -0,0 +1,42 @@
+#!/usr/bin/env python3
+import os
+import argparse
+import json
+
+import cereal.messaging as messaging
+
+
+LEVELS = {
+ "DEBUG": 10,
+ "INFO": 20,
+ "WARNING": 30,
+ "ERROR": 40,
+ "CRITICAL": 50,
+}
+
+
+if __name__ == "__main__":
+
+ parser = argparse.ArgumentParser()
+ parser.add... | |
737dd2fdcfc097ed367fecbd83ded37807f2d1d7 | tools/parse_shadertoy_json.py | tools/parse_shadertoy_json.py | # parse_shadertoy_json.py
from __future__ import print_function
import json
import os
from PIL import Image
jsonfile = "ldXXDj.txt"
#jsonfile = "4lX3RB.txt"
j = json.loads(open(jsonfile).read())
#print(json.dumps(j,indent=1))
info = j['Shader']['info']
print("Title: " + info['name'])
print("Author: " + info['usernam... | Add a python script to pull relevant fields out of Shadertoy json. | Add a python script to pull relevant fields out of Shadertoy json.
| Python | mit | jimbo00000/kinderegg | ---
+++
@@ -0,0 +1,35 @@
+# parse_shadertoy_json.py
+
+from __future__ import print_function
+import json
+import os
+from PIL import Image
+
+jsonfile = "ldXXDj.txt"
+#jsonfile = "4lX3RB.txt"
+j = json.loads(open(jsonfile).read())
+
+#print(json.dumps(j,indent=1))
+info = j['Shader']['info']
+print("Title: " + info[... | |
51b38b4b8d56f5d8fca186646b30831c12e92c7a | lbuild/buildlog.py | lbuild/buildlog.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016, Fabian Greif
# All Rights Reserved.
#
# The file is part of the lbuild project and is released under the
# 2-clause BSD license. See the file `LICENSE.txt` for the full license
# governing this code.
import logging
from .exception import BlobExcept... | Prepare class for collecting build operations. | Prepare class for collecting build operations.
| Python | bsd-2-clause | dergraaf/library-builder,dergraaf/library-builder | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2016, Fabian Greif
+# All Rights Reserved.
+#
+# The file is part of the lbuild project and is released under the
+# 2-clause BSD license. See the file `LICENSE.txt` for the full license
+# governing this code.
+
+import log... | |
fd060b61a61b0918ff2e7ebb978f2210f9e0678b | ctypeslib/test/test_toolchain.py | ctypeslib/test/test_toolchain.py | import unittest
import sys
from ctypeslib import h2xml, xml2py
class ToolchainTest(unittest.TestCase):
if sys.platform == "win32":
def test(self):
h2xml.main(["h2xml", "-q",
"-D WIN32_LEAN_AND_MEAN",
"-D _UNICODE", "-D UNICODE",
... | Test the complete h2xml and xml2py toolchain on Windows by running it over 'windows.h'. | Test the complete h2xml and xml2py toolchain on Windows by running it
over 'windows.h'.
git-svn-id: ac2c3632cb6543e7ab5fafd132c7fe15057a1882@60459 6015fed2-1504-0410-9fe1-9d1591cc4771
| Python | mit | luzfcb/ctypeslib,trolldbois/ctypeslib,trolldbois/ctypeslib,luzfcb/ctypeslib,luzfcb/ctypeslib,trolldbois/ctypeslib | ---
+++
@@ -0,0 +1,18 @@
+import unittest
+import sys
+from ctypeslib import h2xml, xml2py
+
+class ToolchainTest(unittest.TestCase):
+ if sys.platform == "win32":
+ def test(self):
+ h2xml.main(["h2xml", "-q",
+ "-D WIN32_LEAN_AND_MEAN",
+ "-D _UNICO... | |
04211395630cd42c0f9033b162791515bdf918dd | karspexet/venue/management/commands/build_seats.py | karspexet/venue/management/commands/build_seats.py | import csv
from django.core.management.base import BaseCommand
from karspexet.venue.models import Seat, SeatingGroup, Venue
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument("venue-id", type=int)
parser.add_argument("file")
def handle(self, *args, **options):
... | Add a management command for adding seats based on a seatmap file | Add a management command for adding seats based on a seatmap file
This can be used to import seats and pricing groups from text-files
| Python | mit | Karspexet/Karspexet,Karspexet/Karspexet,Karspexet/Karspexet,Karspexet/Karspexet,Karspexet/Karspexet | ---
+++
@@ -0,0 +1,34 @@
+import csv
+
+from django.core.management.base import BaseCommand
+
+from karspexet.venue.models import Seat, SeatingGroup, Venue
+
+
+class Command(BaseCommand):
+ def add_arguments(self, parser):
+ parser.add_argument("venue-id", type=int)
+ parser.add_argument("file")
+
+... | |
ca427f926e7298442aa9a1481d59aa003cd7f0bb | indra/tests/test_reading_files.py | indra/tests/test_reading_files.py | from os import path
from indra.tools.reading.read_files import read_files, get_readers
from nose.plugins.attrib import attr
@attr('slow', 'nonpublic')
def test_read_files():
"Test that the system can read files."
# Create the test files.
example_files = []
# Get txt content
abstract_txt = ("This... | Add test for read_files, removed from indra_db. | Add test for read_files, removed from indra_db.
| Python | bsd-2-clause | johnbachman/belpy,sorgerlab/indra,bgyori/indra,sorgerlab/belpy,bgyori/indra,johnbachman/belpy,pvtodorov/indra,johnbachman/indra,sorgerlab/indra,sorgerlab/belpy,sorgerlab/belpy,johnbachman/belpy,johnbachman/indra,pvtodorov/indra,johnbachman/indra,pvtodorov/indra,pvtodorov/indra,bgyori/indra,sorgerlab/indra | ---
+++
@@ -0,0 +1,33 @@
+from os import path
+from indra.tools.reading.read_files import read_files, get_readers
+
+from nose.plugins.attrib import attr
+
+
+@attr('slow', 'nonpublic')
+def test_read_files():
+ "Test that the system can read files."
+ # Create the test files.
+ example_files = []
+
+ # G... | |
b6ac7ed0f8318cb708b3e49a7019891f702d7f4a | h2o-py/tests/testdir_algos/deepwater/pyunit_multiclass_deepwater.py | h2o-py/tests/testdir_algos/deepwater/pyunit_multiclass_deepwater.py | from __future__ import print_function
import sys, os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from tests import pyunit_utils
from h2o.estimators.deepwater import H2ODeepWaterEstimator
def deepwater_multi():
print("Test checks if Deep Water works fine with a multiclass image dataset")
frame = h2... | Add PyUnit for DeepWater cat/dog/mouse image classification. | Add PyUnit for DeepWater cat/dog/mouse image classification.
| Python | apache-2.0 | h2oai/h2o-3,mathemage/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,spennihana/h2o-3,spennihana/h2o-3,mathemage/h2o-3,h2oai/h2o-dev,h2oai/h2o-3,jangorecki/h2o-3,spennihana/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,jangorecki/h2o-3,jangorecki/h2o-3,jangorecki/h2o-3,h2oai/h2o-dev,h2oai/h2o-3,mathemage/h2o-3... | ---
+++
@@ -0,0 +1,22 @@
+from __future__ import print_function
+import sys, os
+sys.path.insert(1, os.path.join("..","..",".."))
+import h2o
+from tests import pyunit_utils
+from h2o.estimators.deepwater import H2ODeepWaterEstimator
+
+def deepwater_multi():
+ print("Test checks if Deep Water works fine with a mult... | |
2f41b1b9441700eb68331927ded7ef6f25e192bb | test/test_orphaned.py | test/test_orphaned.py | #!/usr/bin/env python2.6
#Copyright (C) 2009-2010 :
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
#This file is part of Shinken.
#
#Shinken is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Fr... | Add : first orphaned test. | Add : first orphaned test.
| Python | agpl-3.0 | tal-nino/shinken,Aimage/shinken,staute/shinken_package,KerkhoffTechnologies/shinken,savoirfairelinux/shinken,tal-nino/shinken,lets-software/shinken,Simage/shinken,fpeyre/shinken,fpeyre/shinken,h4wkmoon/shinken,Aimage/shinken,rledisez/shinken,claneys/shinken,baloo/shinken,Alignak-monitoring/alignak,fpeyre/shinken,Simage... | ---
+++
@@ -0,0 +1,76 @@
+#!/usr/bin/env python2.6
+#Copyright (C) 2009-2010 :
+# Gabes Jean, naparuba@gmail.com
+# Gerhard Lausser, Gerhard.Lausser@consol.de
+#
+#This file is part of Shinken.
+#
+#Shinken is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Pu... | |
812402088f8df8b3ba20fb8ee041b6779f2b5171 | Orange/tests/test_widgets_outputs.py | Orange/tests/test_widgets_outputs.py | import re
import unittest
import importlib.util
from Orange.canvas.registry import global_registry
class TestWidgetOutputs(unittest.TestCase):
def test_outputs(self):
re_send = re.compile('\\n\s+self.send\("([^"]*)"')
registry = global_registry()
errors = []
for desc in registry.w... | Add tests for declarations of widget outputs | Add tests for declarations of widget outputs
| Python | bsd-2-clause | qPCR4vir/orange3,cheral/orange3,qPCR4vir/orange3,qPCR4vir/orange3,kwikadi/orange3,marinkaz/orange3,kwikadi/orange3,kwikadi/orange3,cheral/orange3,cheral/orange3,cheral/orange3,kwikadi/orange3,marinkaz/orange3,qPCR4vir/orange3,kwikadi/orange3,cheral/orange3,marinkaz/orange3,marinkaz/orange3,qPCR4vir/orange3,marinkaz/ora... | ---
+++
@@ -0,0 +1,25 @@
+import re
+import unittest
+import importlib.util
+
+from Orange.canvas.registry import global_registry
+
+
+class TestWidgetOutputs(unittest.TestCase):
+ def test_outputs(self):
+ re_send = re.compile('\\n\s+self.send\("([^"]*)"')
+ registry = global_registry()
+ err... | |
337aacb65af7db9fe5f80ac0058560d465fbe103 | planetstack/model_policies/model_policy_Network.py | planetstack/model_policies/model_policy_Network.py | from core.models import *
def handle(network):
# network deployments are not visible to users. We must ensure
# networks are deployed at all deploymets available to their slices.
slice_deployments = SliceDeployments.objects.all()
slice_deploy_lookup = defaultdict(list)
for slice_deployment in slice_deployments:
... | Add new network objects to all deployments | Policy: Add new network objects to all deployments
| Python | apache-2.0 | opencord/xos,cboling/xos,zdw/xos,xmaruto/mcord,xmaruto/mcord,cboling/xos,jermowery/xos,open-cloud/xos,zdw/xos,wathsalav/xos,xmaruto/mcord,zdw/xos,jermowery/xos,open-cloud/xos,cboling/xos,jermowery/xos,wathsalav/xos,jermowery/xos,opencord/xos,cboling/xos,xmaruto/mcord,wathsalav/xos,open-cloud/xos,wathsalav/xos,cboling/x... | ---
+++
@@ -0,0 +1,21 @@
+from core.models import *
+
+def handle(network):
+ # network deployments are not visible to users. We must ensure
+ # networks are deployed at all deploymets available to their slices.
+ slice_deployments = SliceDeployments.objects.all()
+ slice_deploy_lookup = defaultdict(list)
+ for slice... | |
799ee0bcc52a345116375650da86e714dea612cf | bin/MongoInsert.py | bin/MongoInsert.py | from py2neo import Graph
import os.path
from flask import Flask
app = Flask(__name__)
from pymongo import MongoClient
#TODO: delete document before entry
graph = Graph(os.environ['neoURL'])
MONGO_URL = os.environ['connectURL']
connection = MongoClient(MONGO_URL)
db = connection.githublive.pusheventCapped
def Simila... | Insert similar repositories in Mongo | Insert similar repositories in Mongo
| Python | mit | harishvc/githubanalytics,harishvc/githubanalytics,harishvc/githubanalytics | ---
+++
@@ -0,0 +1,51 @@
+from py2neo import Graph
+import os.path
+from flask import Flask
+app = Flask(__name__)
+from pymongo import MongoClient
+
+
+#TODO: delete document before entry
+
+graph = Graph(os.environ['neoURL'])
+MONGO_URL = os.environ['connectURL']
+connection = MongoClient(MONGO_URL)
+db = connectio... | |
07b6af42f90958e95b570a31d5e9cd3ecc8e2901 | examples/widgets/errors_table.py | examples/widgets/errors_table.py | """
Show the use of the ErrorsTable widget.
"""
import sys
from pyqode.qt import QtWidgets
from pyqode.core.modes import CheckerMessage, CheckerMessages
from pyqode.core.widgets import ErrorsTable
app = QtWidgets.QApplication(sys.argv)
table = ErrorsTable()
table.add_message(CheckerMessage(
'A fake error message',... | Add an example for ErrorsTable | Add an example for ErrorsTable
| Python | mit | pyQode/pyqode.core,pyQode/pyqode.core,zwadar/pyqode.core | ---
+++
@@ -0,0 +1,16 @@
+"""
+Show the use of the ErrorsTable widget.
+"""
+import sys
+from pyqode.qt import QtWidgets
+from pyqode.core.modes import CheckerMessage, CheckerMessages
+from pyqode.core.widgets import ErrorsTable
+
+app = QtWidgets.QApplication(sys.argv)
+table = ErrorsTable()
+table.add_message(Check... | |
ec0105955da05dce211be720b1d68479b5b7ed30 | config_files.py | config_files.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import argparse
import glob
import os
def rewrite(fobj):
text = json.load(fobj)
clean = json.dumps(text, indent=4, sort_keys=True, separators=(',', ': ')) + '\n'
fobj.seek(0)
fobj.write(clean)
fobj.truncate()
if __name__ == '__main__':
... | Add script to rewrite config files so travis is happy. | Add script to rewrite config files so travis is happy.
| Python | agpl-3.0 | certtools/intelmq,aaronkaplan/intelmq,aaronkaplan/intelmq,certtools/intelmq,aaronkaplan/intelmq,certtools/intelmq | ---
+++
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import json
+import argparse
+import glob
+import os
+
+
+def rewrite(fobj):
+ text = json.load(fobj)
+ clean = json.dumps(text, indent=4, sort_keys=True, separators=(',', ': ')) + '\n'
+ fobj.seek(0)
+ fobj.write(clean)
+ fobj... | |
1f0b6333d5b5f3c29e377904d4a2f2a30ed5a787 | src/waldur_mastermind/marketplace_openstack/migrations/0012_drop_offering_components.py | src/waldur_mastermind/marketplace_openstack/migrations/0012_drop_offering_components.py | from django.db import migrations
TENANT_TYPE = 'Packages.Template'
STORAGE_MODE_FIXED = 'fixed'
def drop_offering_components(apps, schema_editor):
"""
Drop offering components for volume types if storage mode is fixed.
"""
OfferingComponent = apps.get_model('marketplace', 'OfferingComponent')
Off... | Drop offering components related to volume types if storage mode is fixed. | Drop offering components related to volume types if storage mode is fixed.
| Python | mit | opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind | ---
+++
@@ -0,0 +1,25 @@
+from django.db import migrations
+
+TENANT_TYPE = 'Packages.Template'
+STORAGE_MODE_FIXED = 'fixed'
+
+
+def drop_offering_components(apps, schema_editor):
+ """
+ Drop offering components for volume types if storage mode is fixed.
+ """
+ OfferingComponent = apps.get_model('mark... | |
2426ef33097a8d50148ba473bb131e98ee6879eb | migrations/versions/460_add_audit_events_for_g4_and_g5_frameworks.py | migrations/versions/460_add_audit_events_for_g4_and_g5_frameworks.py | """Add additional indexes for audit_events
Revision ID: 460
Revises: 450
Create Date: 2016-01-13 16:45:18.621169
"""
revision = '460'
down_revision = '450'
from alembic import op
def upgrade():
# G-Cloud 4
op.execute("""
INSERT INTO audit_events
("type", "created_at", "user", "data", "... | Add migration for G4 expiry | Add migration for G4 expiry
| Python | mit | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | ---
+++
@@ -0,0 +1,29 @@
+"""Add additional indexes for audit_events
+
+Revision ID: 460
+Revises: 450
+Create Date: 2016-01-13 16:45:18.621169
+
+"""
+
+revision = '460'
+down_revision = '450'
+
+from alembic import op
+
+
+def upgrade():
+ # G-Cloud 4
+ op.execute("""
+ INSERT INTO audit_events
+ ... | |
6d8796f3ed68c03010fc87468e40530d35402d91 | samples/veh_segv.py | samples/veh_segv.py | import ctypes
import windows
from windows.vectored_exception import VectoredException
import windows.generated_def.windef as windef
from windows.generated_def.winstructs import *
@VectoredException
def handler(exc):
print("POUET")
if exc[0].ExceptionRecord[0].ExceptionCode == EXCEPTION_ACCESS_VIOLATION:
... | Add LdrLoadDLL + Fix winproxy.VirtualProtect + add a first draft on veh sample | Add LdrLoadDLL + Fix winproxy.VirtualProtect + add a first draft on veh sample
| Python | bsd-3-clause | hakril/PythonForWindows | ---
+++
@@ -0,0 +1,47 @@
+import ctypes
+import windows
+from windows.vectored_exception import VectoredException
+import windows.generated_def.windef as windef
+from windows.generated_def.winstructs import *
+
+
+@VectoredException
+def handler(exc):
+ print("POUET")
+ if exc[0].ExceptionRecord[0].ExceptionCod... | |
e9d84efc328107e51129ed71686c8ee08b09fb99 | apps/front/migrations/0002_auto_20200119_1707.py | apps/front/migrations/0002_auto_20200119_1707.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-01-19 17:07
from __future__ import unicode_literals
import django.contrib.auth.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('front', '0001_initial'),
]
operations = [
... | Add migration for Django 1.11 | Add migration for Django 1.11
| Python | agpl-3.0 | studentenportal/web,studentenportal/web,studentenportal/web,studentenportal/web,studentenportal/web | ---
+++
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.27 on 2020-01-19 17:07
+from __future__ import unicode_literals
+
+import django.contrib.auth.validators
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('front', '0001_... | |
d2ef0ef1ffc5d5bba495c18d070ee953e25cd176 | scripts/clean_failed_archives.py | scripts/clean_failed_archives.py | # -*- coding: utf-8 -*-
"""One-off script to clear out a few registrations that failed during archiving."""
import logging
import sys
from framework.transactions.context import TokuTransaction
from website.app import init_app
from website.archiver import ARCHIVER_FAILURE, ARCHIVER_INITIATED
from website.archiver.model... | Add script to clean out failed archive | Add script to clean out failed archive
[skip ci]
OSF-5632
| Python | apache-2.0 | monikagrabowska/osf.io,DanielSBrown/osf.io,rdhyee/osf.io,sloria/osf.io,emetsger/osf.io,leb2dg/osf.io,acshi/osf.io,mluke93/osf.io,mattclark/osf.io,billyhunt/osf.io,cslzchen/osf.io,mfraezz/osf.io,cwisecarver/osf.io,sloria/osf.io,doublebits/osf.io,zamattiac/osf.io,HalcyonChimera/osf.io,mluo613/osf.io,cslzchen/osf.io,SSJoh... | ---
+++
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+"""One-off script to clear out a few registrations that failed during archiving."""
+import logging
+import sys
+
+from framework.transactions.context import TokuTransaction
+from website.app import init_app
+from website.archiver import ARCHIVER_FAILURE, ARCHIVER_IN... | |
966000605c76be9d9c2a9e931e298785b5adbb76 | contentcuration/contentcuration/tests/test_public_api.py | contentcuration/contentcuration/tests/test_public_api.py | from base import BaseAPITestCase
from django.core.urlresolvers import reverse
class PublicAPITestCase(BaseAPITestCase):
"""
IMPORTANT: These tests are to never be changed. They are enforcing a
public API contract. If the tests fail, then the implementation needs
to be changed, and not the tests themse... | Add minimal test for info endpoint | Add minimal test for info endpoint
| Python | mit | DXCanas/content-curation,fle-internal/content-curation,fle-internal/content-curation,DXCanas/content-curation,jayoshih/content-curation,jayoshih/content-curation,fle-internal/content-curation,DXCanas/content-curation,jayoshih/content-curation,DXCanas/content-curation,fle-internal/content-curation,jayoshih/content-curat... | ---
+++
@@ -0,0 +1,18 @@
+from base import BaseAPITestCase
+from django.core.urlresolvers import reverse
+
+
+class PublicAPITestCase(BaseAPITestCase):
+ """
+ IMPORTANT: These tests are to never be changed. They are enforcing a
+ public API contract. If the tests fail, then the implementation needs
+ to ... | |
8ac37d84cf01f879652cb455c925bb75bee0bc34 | tools/heapcheck/PRESUBMIT.py | tools/heapcheck/PRESUBMIT.py | # Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit API built into gcl.
"""
def CheckChang... | Add presubmit checks for suppressions. | Heapchecker: Add presubmit checks for suppressions.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3197014
git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@57132 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
| Python | bsd-3-clause | wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser | ---
+++
@@ -0,0 +1,43 @@
+# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
+for more details on the presubmit API b... | |
45f4e85065c9d0fcd3638ff95ae46cd4231c106c | Python/002_AC_AddTwoNumbers.py | Python/002_AC_AddTwoNumbers.py | # Author: Jerry C. Wang <jcpwang@gmail.com>
# File: AC_AddTwoNumbers.py
lass Solution(object):
def addTwoNumbers(self, l1, l2):
tmp = ListNode(0)
head = tmp
flag = 0
while flag or l1 or l2:
newNode = ListNode(flag)
if l1:
newNode.val +=... | Add Solution to Add Two Numbers | [Python] LeetCode: Add Solution to Add Two Numbers
Python Solution for 02 Add Two Numbers
[Link]: https://leetcode.com/problems/add-two-numbers
[Complexity]:
Signed-off-by: Jerry C Wang <398b9cc4b6d7225db629d423b2c3e64586a4df74@gmail.com>
| Python | mit | jcpwang/LeetCode | ---
+++
@@ -0,0 +1,22 @@
+# Author: Jerry C. Wang <jcpwang@gmail.com>
+# File: AC_AddTwoNumbers.py
+
+lass Solution(object):
+ def addTwoNumbers(self, l1, l2):
+ tmp = ListNode(0)
+ head = tmp
+ flag = 0
+
+ while flag or l1 or l2:
+ newNode = ListNode(flag)
+ ... | |
66b17fbc9666b150c71bb94f2492fd880b2641e4 | numpy/typing/tests/test_isfile.py | numpy/typing/tests/test_isfile.py | import os
from pathlib import Path
import numpy as np
from numpy.testing import assert_
ROOT = Path(np.__file__).parents[0]
FILES = [
ROOT / "py.typed",
ROOT / "__init__.pyi",
ROOT / "char.pyi",
ROOT / "ctypeslib.pyi",
ROOT / "emath.pyi",
ROOT / "rec.pyi",
ROOT / "version.pyi",
ROOT / ... | Validate the existence of `.pyi` stub files | TST: Validate the existence of `.pyi` stub files
| Python | bsd-3-clause | anntzer/numpy,jakirkham/numpy,simongibbons/numpy,madphysicist/numpy,charris/numpy,mattip/numpy,grlee77/numpy,jakirkham/numpy,anntzer/numpy,grlee77/numpy,rgommers/numpy,seberg/numpy,grlee77/numpy,pdebuyl/numpy,rgommers/numpy,simongibbons/numpy,pdebuyl/numpy,anntzer/numpy,simongibbons/numpy,pbrod/numpy,charris/numpy,nump... | ---
+++
@@ -0,0 +1,34 @@
+import os
+from pathlib import Path
+
+import numpy as np
+from numpy.testing import assert_
+
+ROOT = Path(np.__file__).parents[0]
+FILES = [
+ ROOT / "py.typed",
+ ROOT / "__init__.pyi",
+ ROOT / "char.pyi",
+ ROOT / "ctypeslib.pyi",
+ ROOT / "emath.pyi",
+ ROOT / "rec.py... | |
0db9864c62de4cfa556c9c8f6915750d23a4b2c8 | scripts/user_groups_geolocator.py | scripts/user_groups_geolocator.py | from os import path
import geocoder
from ruamel import yaml
data_folder = path.join(path.dirname(__file__), "../data")
data_file = path.join(data_folder, "user-groups.yml")
with open(data_file, encoding="utf-8") as points_file:
sections = yaml.load(points_file, yaml.RoundTripLoader)
for n, section in enumerate(... | Add a script for filling user group locations | KT-47068: Add a script for filling user group locations
| Python | apache-2.0 | hltj/kotlin-web-site-cn,JetBrains/kotlin-web-site,JetBrains/kotlin-web-site,JetBrains/kotlin-web-site,hltj/kotlin-web-site-cn,JetBrains/kotlin-web-site,hltj/kotlin-web-site-cn,hltj/kotlin-web-site-cn,hltj/kotlin-web-site-cn,JetBrains/kotlin-web-site,JetBrains/kotlin-web-site,hltj/kotlin-web-site-cn | ---
+++
@@ -0,0 +1,44 @@
+from os import path
+
+import geocoder
+from ruamel import yaml
+
+data_folder = path.join(path.dirname(__file__), "../data")
+data_file = path.join(data_folder, "user-groups.yml")
+
+with open(data_file, encoding="utf-8") as points_file:
+ sections = yaml.load(points_file, yaml.RoundTrip... | |
533b4c090547389054934ea88388512399b568c9 | filter_plugins/custom_plugins.py | filter_plugins/custom_plugins.py | #
# Usage: {{ foo | vault }}
#
def vault(encrypted, env):
method = """
from keyczar import keyczar
import os.path
import sys
keydir = '.vault'
if not os.path.isdir(keydir):
keydir = os.path.expanduser('~/.decrypted_openconext_keystore_{env}')
crypter = keyczar.Crypter.Read(keydir)
sys.stdout.write(crypter.Decrypt(... | #
# Usage: {{ foo | vault }}
#
def vault(encrypted, env):
method = """
from keyczar import keyczar
import os.path
import sys
keydir = '.vault'
if not os.path.isdir(keydir):
keydir = os.path.expanduser('~/.decrypted_openconext_keystore_{env}')
crypter = keyczar.Crypter.Read(keydir)
sys.stdout.write(crypter.Decrypt(... | Use simpler invocation that actually fails. Leave it to @thijskh to use Popen-type of invocation | Use simpler invocation that actually fails. Leave it to @thijskh to use Popen-type of invocation
| Python | apache-2.0 | baszoetekouw/OpenConext-deploy,remold/OpenConext-deploy,OpenConext/OpenConext-deploy,baszoetekouw/OpenConext-deploy,baszoetekouw/OpenConext-deploy,OpenConext/OpenConext-deploy,OpenConext/OpenConext-deploy,remold/OpenConext-deploy,remold/OpenConext-deploy,baszoetekouw/OpenConext-deploy,OpenConext/OpenConext-deploy,baszo... | ---
+++
@@ -13,14 +13,9 @@
crypter = keyczar.Crypter.Read(keydir)
sys.stdout.write(crypter.Decrypt("%s"))
""".format(env=env) % encrypted
- import subprocess
- from ansible import errors
+ from subprocess import check_output
+ return check_output(["python", "-c", method])
- (out, err) = subprocess.Popen([... |
4a5dd598f689425aa89541ce890ec15aa7592543 | dragonfire/tts/__init__.py | dragonfire/tts/__init__.py | import csv
class Synthesizer():
def __init__(self):
self.word_map = {}
filename = "../../dictionaries/VoxForgeDict"
for line in csv.reader(open(filename), delimiter=' ', skipinitialspace=True):
if len(line) > 2:
self.word_map[line[0]] = line[2:]
print ... | Add the function for parsing strings to phonemes | Add the function for parsing strings to phonemes
| Python | mit | DragonComputer/Dragonfire,DragonComputer/Dragonfire,DragonComputer/Dragonfire,mertyildiran/Dragonfire,mertyildiran/Dragonfire | ---
+++
@@ -0,0 +1,23 @@
+import csv
+
+
+class Synthesizer():
+
+ def __init__(self):
+ self.word_map = {}
+
+ filename = "../../dictionaries/VoxForgeDict"
+ for line in csv.reader(open(filename), delimiter=' ', skipinitialspace=True):
+ if len(line) > 2:
+ self.word... | |
e5a46876e55344f54e205a76b5f16db07d099fa0 | examples/4-resistors.py | examples/4-resistors.py | #!/usr/bin/env python3
# Copyright (c) 2015 Matthew Earl
#
# 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 without limitation the rights
# to use, copy, modify... | Add a 4 resistors example | Add a 4 resistors example
| Python | mit | matthewearl/strippy | ---
+++
@@ -0,0 +1,53 @@
+#!/usr/bin/env python3
+# Copyright (c) 2015 Matthew Earl
+#
+# 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 without limitation ... | |
25494622a88f172fb14abf10eb5936246d475066 | other/wrapping-cpp/swig/cpointerproblem/test_examples.py | other/wrapping-cpp/swig/cpointerproblem/test_examples.py | """
The code this example is all based on is from http://tinyurl.com/pmmnbxv
Some notes on this in the oommf-devnotes repo
"""
import os
import pytest
#print("pwd:")
#os.system('pwd')
#import subprocess
#subprocess.check_output('pwd')
os.system('make all')
import example1
def test_f():
assert example1.f(1) -... | """
The code this example is all based on is from http://tinyurl.com/pmmnbxv
Some notes on this in the oommf-devnotes repo
"""
import os
import pytest
# Need to call Makefile in directory where this test file is
def call_make(target):
# where is this file
this_file = os.path.realpath(__file__)
this_dir ... | Modify testing code to work if executed from above its own directory | Modify testing code to work if executed from above its own directory
| Python | bsd-2-clause | ryanpepper/oommf-python,ryanpepper/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,fangohr/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python | ---
+++
@@ -7,13 +7,20 @@
import pytest
-#print("pwd:")
-#os.system('pwd')
-#import subprocess
-#subprocess.check_output('pwd')
+
+# Need to call Makefile in directory where this test file is
+def call_make(target):
+ # where is this file
+ this_file = os.path.realpath(__file__)
+ this_dir = os.path.spl... |
10641e60bf3e99efdc919f122ee911c05da1c873 | src/copyListWithRandomPointer.py | src/copyListWithRandomPointer.py | # Definition for singly-linked list with a random pointer.
# class RandomListNode:
# def __init__(self, x):
# self.label = x
# self.next = None
# self.random = None
class Solution:
# @param head, a RandomListNode
# @return a RandomListNode
def copyRandomList(self, head):
... | Copy List with Random Pointer | Copy List with Random Pointer
| Python | mit | zhyu/leetcode,zhyu/leetcode | ---
+++
@@ -0,0 +1,30 @@
+# Definition for singly-linked list with a random pointer.
+# class RandomListNode:
+# def __init__(self, x):
+# self.label = x
+# self.next = None
+# self.random = None
+
+
+class Solution:
+ # @param head, a RandomListNode
+ # @return a RandomListNode
+
+ ... | |
c59b10aa48640d445082b2951fc3bd80cae5816c | examples/feature_select.py | examples/feature_select.py | """
An example showing feature selection.
"""
import numpy as np
import pylab as pl
################################################################################
# import some data to play with
# The IRIS dataset
from scikits.learn.datasets.iris import load
SP, SW, PL, PW, LABELS = load()
# Some noisy data not ... | Add an example of feature selection. | DOC: Add an example of feature selection.
git-svn-id: a2d1b0e147e530765aaf3e1662d4a98e2f63c719@458 22fbfee3-77ab-4535-9bad-27d1bd3bc7d8
| Python | bsd-3-clause | ogrisel/scikit-learn,altairpearl/scikit-learn,beepee14/scikit-learn,ashhher3/scikit-learn,jm-begon/scikit-learn,hsiaoyi0504/scikit-learn,huobaowangxi/scikit-learn,jkarnows/scikit-learn,spallavolu/scikit-learn,zaxtax/scikit-learn,hugobowne/scikit-learn,nesterione/scikit-learn,Vimos/scikit-learn,adamgreenhall/scikit-lear... | ---
+++
@@ -0,0 +1,50 @@
+"""
+An example showing feature selection.
+"""
+
+import numpy as np
+import pylab as pl
+
+
+################################################################################
+# import some data to play with
+
+# The IRIS dataset
+from scikits.learn.datasets.iris import load
+SP, SW, PL, PW... | |
76b75ac9ae8a1456962ed9cf70024628be27d371 | corehq/apps/reminders/management/commands/find_ivr_usage.py | corehq/apps/reminders/management/commands/find_ivr_usage.py | from __future__ import absolute_import
from collections import defaultdict
from corehq.apps.reminders.models import CaseReminderHandler, METHOD_IVR_SURVEY
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, **options):
handlers = CaseReminderHandler.view(
... | Add script to find projects using IVR | Add script to find projects using IVR
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,31 @@
+from __future__ import absolute_import
+from collections import defaultdict
+from corehq.apps.reminders.models import CaseReminderHandler, METHOD_IVR_SURVEY
+from django.core.management.base import BaseCommand
+
+
+class Command(BaseCommand):
+
+ def handle(self, **options):
+ hand... | |
2e713f4f2f5cc206c5029bb00db0fa10f428fafc | geolang/__init__.py | geolang/__init__.py | from geolang.geolang import (
__author__,
__version__,
KA2LAT,
LAT2KA,
UNI2LAT,
_2KA,
_2LAT,
encode_slugify,
GeoLangToolKit,
unicode,
)
# from geolang.geolang import *
from .uni2lat import * | Initialize the geolang toolkit package | Initialize the geolang toolkit package
| Python | mit | Lh4cKg/simple-geolang-toolkit | ---
+++
@@ -0,0 +1,14 @@
+from geolang.geolang import (
+ __author__,
+ __version__,
+ KA2LAT,
+ LAT2KA,
+ UNI2LAT,
+ _2KA,
+ _2LAT,
+ encode_slugify,
+ GeoLangToolKit,
+ unicode,
+ )
+# from geolang.geolang import *
+from .uni2lat import * | |
41caf18a4885f3e53078ff4d0f6efb570ab8c239 | fileshack/management.py | fileshack/management.py | """
Creates the default Site object.
"""
# Modelled after django.contrib.sites.management.
from django.db.models import signals
from django.db import router
import models as fileshack_app
from models import Store
def create_default_store(app, created_models, verbosity, db, **kwargs):
# Only create the default s... | Create a default store on syncdb. | Create a default store on syncdb.
This is done by a hook to post_syncdb.
| Python | mit | peterkuma/fileshackproject,peterkuma/fileshackproject,peterkuma/fileshackproject | ---
+++
@@ -0,0 +1,20 @@
+"""
+Creates the default Site object.
+"""
+
+# Modelled after django.contrib.sites.management.
+
+from django.db.models import signals
+from django.db import router
+
+import models as fileshack_app
+from models import Store
+
+def create_default_store(app, created_models, verbosity, db, **... | |
c2961fbe1746ba61707fb9fc9a0a9873a4abbf33 | folium/elements.py | folium/elements.py | from branca.element import Figure, Element, JavascriptLink, CssLink
class JSCSSMixin(Element):
"""Render links to external Javascript and CSS resources."""
default_js = []
default_css = []
def render(self, **kwargs):
figure = self.get_root()
assert isinstance(figure, Figure), ('You c... | Add mixin to render JS and CSS links | Add mixin to render JS and CSS links
| Python | mit | python-visualization/folium,ocefpaf/folium,python-visualization/folium,ocefpaf/folium | ---
+++
@@ -0,0 +1,21 @@
+from branca.element import Figure, Element, JavascriptLink, CssLink
+
+
+class JSCSSMixin(Element):
+ """Render links to external Javascript and CSS resources."""
+
+ default_js = []
+ default_css = []
+
+ def render(self, **kwargs):
+ figure = self.get_root()
+ ass... | |
d9818f1fd05a1b308ef0b4675e4ce4553f1d2291 | third_party/chromium_browser_clang/get_latest.py | third_party/chromium_browser_clang/get_latest.py | #!/usr/bin/python3 -u
'''Download the prebuilt clang binary built by chromium and is used by chromium.'''
import os
import os.path
import subprocess
UPDATE_SH_URL = 'https://chromium.googlesource.com/chromium/src/+/master/tools/clang/scripts/update.sh'
CLANG_REVISION = 238013
CLANG_SUB_REVISION = 1
CDS_URL = 'https:... | Add script to download chromium prebuilt clang for Linux. | Add script to download chromium prebuilt clang for Linux.
| Python | apache-2.0 | duanguoxue/trunk,duanguoxue/trunk,mzhaom/trunk,bazelment/trunk,bazelment/trunk,mzhaom/trunk,bazelment/trunk,bazelment/trunk,mzhaom/trunk,duanguoxue/trunk | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/python3 -u
+
+'''Download the prebuilt clang binary built by chromium and is used by chromium.'''
+
+import os
+import os.path
+import subprocess
+
+UPDATE_SH_URL = 'https://chromium.googlesource.com/chromium/src/+/master/tools/clang/scripts/update.sh'
+CLANG_REVISION = 238013
+CL... | |
ab92b41d0bbb1a6befbc7d34225a9cf84d088e30 | bin/set-paypal-email.py | bin/set-paypal-email.py | #!/usr/bin/env python
"""Set the PayPal email address for a user.
Usage:
[gittip] $ heroku config -s -a gittip | foreman run -e /dev/stdin ./env/bin/python ./bin/set-paypal-email.py username user@example.com [first-eight-of-api-key] [overwrite]
"""
from __future__ import print_function
import sys
from gittip i... | Add a script to setup a PayPal email address | Add a script to setup a PayPal email address
| Python | mit | gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,eXcomm/gratipay.com,eXcomm/gratipay.com,studio666/gratipay.com,mccolgst/www.gittip.com,eXcomm/gratipay.com,studio666/gratipay.com,studio666/gratipay.com,gratipay/gratipay.com,eXcomm/gratipay.com,studio666/gratipay.com,mccolgst/www.gittip.com,mccolgst/www... | ---
+++
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+"""Set the PayPal email address for a user.
+
+Usage:
+
+ [gittip] $ heroku config -s -a gittip | foreman run -e /dev/stdin ./env/bin/python ./bin/set-paypal-email.py username user@example.com [first-eight-of-api-key] [overwrite]
+
+"""
+from __future__ import print... | |
6f8ea15058161bd9735c37cda5f09d4bd9db7514 | doc/deployer/set_prior_nodes_from_collection_set.py | doc/deployer/set_prior_nodes_from_collection_set.py | def set_prior_nodes_from_collection_set(node_obj):
print "\n Name : ", node_obj.name, " -- ", node_obj.member_of_names_list , " --- ", node_obj._id
if node_obj.collection_set:
for each in node_obj.collection_set:
each_obj = node_collection.one({'_id': ObjectId(each)})
# if "Page" in each_obj.member_of_names_l... | Add prior node i.e unit id in course's resources | Add prior node i.e unit id in course's resources
| Python | agpl-3.0 | gnowledge/gstudio,gnowledge/gstudio,AvadootNachankar/gstudio,gnowledge/gstudio,AvadootNachankar/gstudio,AvadootNachankar/gstudio,gnowledge/gstudio,AvadootNachankar/gstudio,gnowledge/gstudio | ---
+++
@@ -0,0 +1,18 @@
+def set_prior_nodes_from_collection_set(node_obj):
+ print "\n Name : ", node_obj.name, " -- ", node_obj.member_of_names_list , " --- ", node_obj._id
+ if node_obj.collection_set:
+ for each in node_obj.collection_set:
+ each_obj = node_collection.one({'_id': ObjectId(each)})
+ # if "Pa... | |
ab12cb56a0d91384c1e80f20618025b3ec3e94a3 | kimochiconsumer/kimochi.py | kimochiconsumer/kimochi.py | import requests
class Kimochi:
def __init__(self, url, api_key, site_key = None):
if not url.endswith('/'):
url += '/'
if site_key:
self.url = url + 'sites/' + site_key + '/'
self.api_key = api_key
def page(self, page_id):
return self._get('pages/' + s... | Add initial framework for Kimochi client | Add initial framework for Kimochi client
| Python | mit | matslindh/kimochi-consumer | ---
+++
@@ -0,0 +1,24 @@
+import requests
+
+class Kimochi:
+ def __init__(self, url, api_key, site_key = None):
+ if not url.endswith('/'):
+ url += '/'
+
+ if site_key:
+ self.url = url + 'sites/' + site_key + '/'
+
+ self.api_key = api_key
+
+ def page(self, page_id... | |
88e5f659e12a6be46246bbf36b59b73bad167b0b | syntacticframes_project/syntacticframes/settings/test.py | syntacticframes_project/syntacticframes/settings/test.py | from __future__ import absolute_import
from .base import *
########## IN-MEMORY TEST DATABASE
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
"USER": "",
"PASSWORD": "",
"HOST": "",
"PORT": "",
},
}
PASSWORD_HASHERS = (
... | Test using sqlite in production | Test using sqlite in production
This lets Django create a new database for every test run, which should be done
via the admin interface for PostgreSQL databases
| Python | mit | aymara/verbenet-editor,aymara/verbenet-editor,aymara/verbenet-editor | ---
+++
@@ -0,0 +1,19 @@
+from __future__ import absolute_import
+
+from .base import *
+
+########## IN-MEMORY TEST DATABASE
+DATABASES = {
+ "default": {
+ "ENGINE": "django.db.backends.sqlite3",
+ "NAME": ":memory:",
+ "USER": "",
+ "PASSWORD": "",
+ "HOST": "",
+ "PORT... | |
32fe5e192ed7b74812a2d117cc8f6374d139948d | sherlock.stanford.edu.run_gpaw.py | sherlock.stanford.edu.run_gpaw.py | #!/usr/bin/env python
from sys import argv
import os
job = argv[1]
nodes = argv[2]
time = argv[3] + ":00"
if len(argv) > 4:
gpaw_options = ' '.join(argv[4:])
else:
gpaw_options = ' '
#options = '-l nodes=' + nodes +':ppn=2' + ' -l' +' walltime=' + time + ' -m abe'
#options = '-N ' + nodes +' -t ' + time + ' ... | Add the submission script for GPAW on Sherlock at Stanford | Add the submission script for GPAW on Sherlock at Stanford
| Python | mit | RKBK/gpaw-customize-files,RKBK/gpaw-customize-files | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+from sys import argv
+import os
+
+job = argv[1]
+nodes = argv[2]
+time = argv[3] + ":00"
+
+if len(argv) > 4:
+ gpaw_options = ' '.join(argv[4:])
+else:
+ gpaw_options = ' '
+#options = '-l nodes=' + nodes +':ppn=2' + ' -l' +' walltime=' + time + ' -m abe'
+#opt... | |
acead95a46db9f7228fd44f439e50eaa37f0a288 | kirppuauth/migrations/0005_alter_user_first_name.py | kirppuauth/migrations/0005_alter_user_first_name.py | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('kirppuauth', '0004_auto_20180703_1615'),
]
operations = [
migrations.AlterField(
model_name='user',
name='first_name',
field=models.CharField(blank=True,... | Add missing Django 3.1 migration. | Add missing Django 3.1 migration.
Missing from d9890245e30bf7036c05f2359cc48d89b5361ba5.
| Python | mit | jlaunonen/kirppu,jlaunonen/kirppu,jlaunonen/kirppu,jlaunonen/kirppu | ---
+++
@@ -0,0 +1,16 @@
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('kirppuauth', '0004_auto_20180703_1615'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='user',
+ name='first_name',
+ ... | |
f89ba25232d9a8e5f47a2e5cbc210afeda40210e | submissions/generate_all_fours.py | submissions/generate_all_fours.py | """Generate all_threes.dta submission file with every rating as 3.0
.. moduleauthor:: Quinn Osha stolen from Jan Van Bruggen <jancvanbruggen@gmail.com>
"""
def run():
fours = ['4.0\n'] * 2749898
with open('all_fours.dta', 'w+') as all_fours_submission_file:
all_fours_submission_file.writelines(fours)... | Add all fours submission generation | Add all fours submission generation
| Python | mit | jvanbrug/netflix,jvanbrug/netflix | ---
+++
@@ -0,0 +1,14 @@
+"""Generate all_threes.dta submission file with every rating as 3.0
+
+.. moduleauthor:: Quinn Osha stolen from Jan Van Bruggen <jancvanbruggen@gmail.com>
+"""
+
+
+def run():
+ fours = ['4.0\n'] * 2749898
+ with open('all_fours.dta', 'w+') as all_fours_submission_file:
+ all_fo... | |
19ea035e68fbec2b39420b5bfd3ab340b3d14d78 | i3pystatus/dpms.py | i3pystatus/dpms.py | from i3pystatus import IntervalModule
from i3pystatus.core.command import run_through_shell
class DPMS(IntervalModule):
"""
Shows and toggles status of DPMS which prevents screen from blanking.
.. rubric:: Available formatters
* `{status}` — the current status of DPMS
@author Georg Sieber <g.sie... | Add module for DPMS state | Add module for DPMS state
| Python | mit | fmarchenko/i3pystatus,yang-ling/i3pystatus,drwahl/i3pystatus,eBrnd/i3pystatus,juliushaertl/i3pystatus,drwahl/i3pystatus,onkelpit/i3pystatus,richese/i3pystatus,Elder-of-Ozone/i3pystatus,opatut/i3pystatus,eBrnd/i3pystatus,richese/i3pystatus,m45t3r/i3pystatus,claria/i3pystatus,facetoe/i3pystatus,juliushaertl/i3pystatus,pa... | ---
+++
@@ -0,0 +1,44 @@
+from i3pystatus import IntervalModule
+from i3pystatus.core.command import run_through_shell
+
+class DPMS(IntervalModule):
+ """
+ Shows and toggles status of DPMS which prevents screen from blanking.
+
+
+ .. rubric:: Available formatters
+
+ * `{status}` — the current status o... | |
70d8e6a050b3e88de5da47f30d3fb16664cd690c | main.py | main.py | import argparse
from uncertainty.classifier import Classifier
def train(args):
classifier = Classifier(
granularity=args.granularity, binary=not args.multiclass
)
classifier.train(args.filepath)
def predict(args):
classifier = Classifier(
granularity=args.granularity, bi... | Add command line access to uncertainty classifier | Add command line access to uncertainty classifier
| Python | mit | meyersbs/uncertainty | ---
+++
@@ -0,0 +1,68 @@
+import argparse
+
+from uncertainty.classifier import Classifier
+
+
+def train(args):
+ classifier = Classifier(
+ granularity=args.granularity, binary=not args.multiclass
+ )
+ classifier.train(args.filepath)
+
+
+def predict(args):
+ classifier = Classifier(
+ ... | |
45229754b77e457866b6c700174a8c4f7dfde58a | audio_pipeline/tb_ui/util/Resources.py | audio_pipeline/tb_ui/util/Resources.py | import uuid
mbid_directory = "Ready To Filewalk"
picard_directory = "Picard Me!"
def has_mbid(track):
"""
Check whether or not the given track has an MBID.
"""
if track.mbid.value:
try:
id = uuid.UUID(track.mbid.value)
good = True
except ValueError as e:
... | Add move file after TomatoBanana; ctrl-z for one cell in Meta Entr; updated commands in help | Add move file after TomatoBanana; ctrl-z for one cell in Meta Entr; updated commands in help
| Python | mit | hidat/audio_pipeline | ---
+++
@@ -0,0 +1,22 @@
+import uuid
+
+
+mbid_directory = "Ready To Filewalk"
+picard_directory = "Picard Me!"
+
+
+def has_mbid(track):
+ """
+ Check whether or not the given track has an MBID.
+ """
+
+ if track.mbid.value:
+ try:
+ id = uuid.UUID(track.mbid.value)
+ g... | |
30e18ffea7885f5708c751d8a7e8783bfea3260b | src/python/parse_csv.py | src/python/parse_csv.py | import csv
def csv_as_list(csv_file_name, delim = ';'):
with open(csv_file_name, 'rb') as csv_file:
data = csv.DictReader(csv_file, delimiter = delim)
csv_list = []
for item in data:
csv_list.append(item)
return csv_list
| Implement simple CSV parsing utility | Implement simple CSV parsing utility
| Python | mit | vjuranek/rg-offline-plotting,vjuranek/rg-offline-plotting | ---
+++
@@ -0,0 +1,10 @@
+import csv
+
+def csv_as_list(csv_file_name, delim = ';'):
+ with open(csv_file_name, 'rb') as csv_file:
+ data = csv.DictReader(csv_file, delimiter = delim)
+ csv_list = []
+ for item in data:
+ csv_list.append(item)
+ return csv_list
+ | |
0af033308873038a8d10d5348a63aa4c6fab3033 | main_withoutGUI.py | main_withoutGUI.py | # -*- coding:utf-8 -*-
# This version is mainly used for a test. It doesn't have a GUI yet.
import shelve
from getIntern import get_sxs
# Use shelve to get parameter changing rules.
with shelve.open("shelve/para_change_dict") as slvFile:
city_dict = slvFile["city"]
salary_dict = slvFile["salary"]
degree_di... | Add a classification about page numbers of searching results to the get_sxs function. | Add a classification about page numbers of searching results to the get_sxs function.
| Python | mit | HutchinHuang/New_Intern_Reminder | ---
+++
@@ -0,0 +1,62 @@
+# -*- coding:utf-8 -*-
+# This version is mainly used for a test. It doesn't have a GUI yet.
+import shelve
+from getIntern import get_sxs
+
+# Use shelve to get parameter changing rules.
+with shelve.open("shelve/para_change_dict") as slvFile:
+ city_dict = slvFile["city"]
+ salary_di... | |
850a9951580cd21c27f5f992d8c907057b1eb1b1 | tests/test_wb2k.py | tests/test_wb2k.py | from wb2k.__main__ import bail
def test_bail():
msg_type = 'fatal'
color = 'red'
text = "It doesn't go beyond 11."
given = bail(msg_type, color, text)
expected = "\x1b[31mfatal\x1b[0m: It doesn't go beyond 11."
assert given == expected
| Add initial test for bail | Add initial test for bail
| Python | isc | reillysiemens/wb2k | ---
+++
@@ -0,0 +1,12 @@
+from wb2k.__main__ import bail
+
+
+def test_bail():
+ msg_type = 'fatal'
+ color = 'red'
+ text = "It doesn't go beyond 11."
+
+ given = bail(msg_type, color, text)
+ expected = "\x1b[31mfatal\x1b[0m: It doesn't go beyond 11."
+
+ assert given == expected | |
01e69806d0f0e196e7e832c0473a9f70725911e8 | tests/test_yaml.py | tests/test_yaml.py | from . import IpynbTest, RmdTest
yaml_source = """---
title: Test document
author: foobar <foo@bar.tld>
date: 1970-01-01T00:00:00+0000
output:
html_document:
toc: true
ünicode: £¼±å
---
lorem ipsum
```{r}
1+1
```
"""
class TestYAMLHeader(RmdTest):
source = yaml_source
def test_header_in_ipynb(self... | Add some tests for yaml header handling | Add some tests for yaml header handling
| Python | mit | chronitis/ipyrmd | ---
+++
@@ -0,0 +1,59 @@
+from . import IpynbTest, RmdTest
+
+yaml_source = """---
+title: Test document
+author: foobar <foo@bar.tld>
+date: 1970-01-01T00:00:00+0000
+output:
+ html_document:
+ toc: true
+ünicode: £¼±å
+---
+lorem ipsum
+```{r}
+1+1
+```
+"""
+class TestYAMLHeader(RmdTest):
+ source = y... | |
f2266ab12794c1035980c9ef7483356ae9036ba8 | lexgen/utils.py | lexgen/utils.py | import math
def percentile(values, percent, key=lambda x: x):
"""
Find the percentile of a list of values.
Params:
values (list): Sorted list of values.
percent (float): A value from 0.0 to 1.0.
key (function): Optional key function to compute value from each value on list.
R... | Add two functions to calculate percentiles and filter a dict using IQR | Add two functions to calculate percentiles and filter a dict using IQR
The idea is to get a dictionary with a tweets count for each user and filter that users whose number of tweets is not inside the interquartile range.
| Python | mit | davidmogar/lexgen,davidmogar/lexgen | ---
+++
@@ -0,0 +1,51 @@
+import math
+
+
+def percentile(values, percent, key=lambda x: x):
+ """
+ Find the percentile of a list of values.
+
+ Params:
+ values (list): Sorted list of values.
+ percent (float): A value from 0.0 to 1.0.
+ key (function): Optional key function to compute... | |
1160b792eb4f6b14cb01680ffadaaa3886098d1c | util/test_graph.py | util/test_graph.py | import urllib2
token = 'test_token'
channel = 'test_channel'
graphtype = 'test'
url = 'http://{}/ocpgraph/{}/{}/{}/'.format('localhost:8000', token, channel, graphtype)
try:
req = urllib2.Request(url)
resposne = urllib2.urlopen(req)
except Exception, e:
raise
| Test file for Graph code | [util] Test file for Graph code
| Python | apache-2.0 | openconnectome/open-connectome,openconnectome/open-connectome,neurodata/ndstore,neurodata/ndstore,openconnectome/open-connectome,openconnectome/open-connectome,openconnectome/open-connectome,neurodata/ndstore,neurodata/ndstore,openconnectome/open-connectome | ---
+++
@@ -0,0 +1,12 @@
+import urllib2
+
+token = 'test_token'
+channel = 'test_channel'
+graphtype = 'test'
+
+url = 'http://{}/ocpgraph/{}/{}/{}/'.format('localhost:8000', token, channel, graphtype)
+try:
+ req = urllib2.Request(url)
+ resposne = urllib2.urlopen(req)
+except Exception, e:
+ raise | |
b647505a585a35e5f069d5a58524eaf6e25681d4 | analysis/opensimulator-stats-analyzer/src/osta.py | analysis/opensimulator-stats-analyzer/src/osta.py | #!/usr/bin/python
import pprint
import re
import sys
if len(sys.argv) <= 1:
print "Usage: %s <stats-log-path>"
sys.exit(1)
lineRe = re.compile("(.* .*) - (.*) : (\d+)[ ,]([^:]*)")
data = {}
with open(sys.argv[1]) as f:
for line in f:
match = lineRe.match(line)
if match != No... | Add first draft of opensim statistics file analyzer | Add first draft of opensim statistics file analyzer
| Python | bsd-3-clause | justinccdev/opensimulator-tools,justinccdev/opensimulator-tools,justinccdev/opensimulator-tools,justinccdev/opensimulator-tools | ---
+++
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+
+import pprint
+import re
+import sys
+
+if len(sys.argv) <= 1:
+ print "Usage: %s <stats-log-path>"
+ sys.exit(1)
+
+lineRe = re.compile("(.* .*) - (.*) : (\d+)[ ,]([^:]*)")
+data = {}
+
+with open(sys.argv[1]) as f:
+ for line in f:
+ match = lineRe.... | |
507a52905164d2814b0b43a6d61eb002dfe0662a | enerdata/datetime/work_and_holidays.py | enerdata/datetime/work_and_holidays.py | import calendar
from datetime import timedelta
def get_num_of_workdays_holidays(init_date, end_date, holidays_list):
workdays = 0
holidays = 0
_date = end_date
while _date <= init_date:
if (calendar.weekday(_date.year, _date.month, _date.day) in (5, 6)
) or (_date.date() in holidays_l... | Add work and holidays get | Add work and holidays get
| Python | mit | gisce/enerdata | ---
+++
@@ -0,0 +1,18 @@
+import calendar
+from datetime import timedelta
+
+
+def get_num_of_workdays_holidays(init_date, end_date, holidays_list):
+ workdays = 0
+ holidays = 0
+
+ _date = end_date
+ while _date <= init_date:
+ if (calendar.weekday(_date.year, _date.month, _date.day) in (5, 6)
+ ... | |
59e78c024af6bdf62e9d4e2ed374a727362d3a28 | doc/add_dash_anchors.py | doc/add_dash_anchors.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Add Dash-style anchors to already-generated HTML documentation.
This script iterates over pre-specified HTML files generated via
sphinx-build, finds all of the sections, and adds Dash-style anchors
so that when those HTML files are displayed in the Dash macOS app,
th... | Add script to insert Dash TOC anchors in HTML files. | Add script to insert Dash TOC anchors in HTML files.
| Python | apache-2.0 | EducationalTestingService/rsmtool | ---
+++
@@ -0,0 +1,87 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+"""
+Add Dash-style anchors to already-generated HTML documentation.
+
+This script iterates over pre-specified HTML files generated via
+sphinx-build, finds all of the sections, and adds Dash-style anchors
+so that when those HTML files are... | |
42301c24aa05c048e14c0f5c3ec42b13211d1e59 | tests/unit/test_model_core.py | tests/unit/test_model_core.py | # -*- coding: UTF-8 -*-
"""
(Additional) Unit tests for :mod:`behave.model_core` module.
"""
from __future__ import print_function
from behave.model_core import Status
import pytest
# -----------------------------------------------------------------------------
# TESTS:
# --------------------------------------------... | Add missing test for Status compatibility | Add missing test for Status compatibility
| Python | bsd-2-clause | jenisys/behave,Abdoctor/behave,jenisys/behave,Abdoctor/behave | ---
+++
@@ -0,0 +1,56 @@
+# -*- coding: UTF-8 -*-
+"""
+(Additional) Unit tests for :mod:`behave.model_core` module.
+"""
+
+from __future__ import print_function
+from behave.model_core import Status
+import pytest
+
+
+# -----------------------------------------------------------------------------
+# TESTS:
+# ----... | |
1721d2badb2168f79587d8c018ca65d89733da88 | tests/test_keras.py | tests/test_keras.py | from __future__ import print_function
import numpy as np
np.random.seed(1337)
import keras.backend as K
from keras.models import Sequential
from keras.layers.core import Dense
from keras.layers.wrappers import TimeDistributed
from keras.layers.recurrent import LSTM
from keras.layers.normalization import BatchNormaliz... | Add simple test for Keras | Add simple test for Keras
| Python | bsd-3-clause | mcf06/theano_ctc | ---
+++
@@ -0,0 +1,56 @@
+from __future__ import print_function
+
+import numpy as np
+np.random.seed(1337)
+
+import keras.backend as K
+from keras.models import Sequential
+from keras.layers.core import Dense
+from keras.layers.wrappers import TimeDistributed
+from keras.layers.recurrent import LSTM
+from keras.lay... | |
9548c4411938397b4f2d8a7b49b46cdc6aca0a3b | powerline/segments/i3wm.py | powerline/segments/i3wm.py | # vim:fileencoding=utf-8:noet
from powerline.theme import requires_segment_info
import i3
def calcgrp( w ):
group = ["workspace"]
if w['urgent']: group.append( 'w_urgent' )
if w['visible']: group.append( 'w_visible' )
if w['focused']: return "w_focused"
return group
def workspaces( pl ):
'''Return workspace li... | # vim:fileencoding=utf-8:noet
from powerline.theme import requires_segment_info
import i3
def calcgrp( w ):
group = []
if w['focused']: group.append( 'w_focused' )
if w['urgent']: group.append( 'w_urgent' )
if w['visible']: group.append( 'w_visible' )
group.append( 'workspace' )
return group
def workspaces( pl... | Fix highlighting groups for workspaces segment | Fix highlighting groups for workspaces segment
| Python | mit | Luffin/powerline,Luffin/powerline,areteix/powerline,cyrixhero/powerline,darac/powerline,russellb/powerline,bezhermoso/powerline,QuLogic/powerline,xfumihiro/powerline,prvnkumar/powerline,lukw00/powerline,bartvm/powerline,wfscheper/powerline,xxxhycl2010/powerline,s0undt3ch/powerline,blindFS/powerline,areteix/powerline,ke... | ---
+++
@@ -4,10 +4,11 @@
import i3
def calcgrp( w ):
- group = ["workspace"]
+ group = []
+ if w['focused']: group.append( 'w_focused' )
if w['urgent']: group.append( 'w_urgent' )
if w['visible']: group.append( 'w_visible' )
- if w['focused']: return "w_focused"
+ group.append( 'workspace' )
return group
... |
b9c2043489541c0eb55c171201f2908068f761fe | tests/test_schema_keywords.py | tests/test_schema_keywords.py | from . import PREFIX, CONN_INFO
import datajoint as dj
from nose.tools import assert_true
schema = dj.schema(PREFIX + '_keywords', locals(), connection=dj.conn(**CONN_INFO))
class A(dj.Manual):
definition = """
a_id: int # a id
"""
class B(dj.Manual):
source = None
definition = """
-> self... | Add tests for use of keywords in definition and using inherited Part table | Add tests for use of keywords in definition and using inherited Part table
| Python | lgpl-2.1 | dimitri-yatsenko/datajoint-python,eywalker/datajoint-python,datajoint/datajoint-python,fabiansinz/datajoint-python | ---
+++
@@ -0,0 +1,45 @@
+from . import PREFIX, CONN_INFO
+import datajoint as dj
+from nose.tools import assert_true
+
+
+schema = dj.schema(PREFIX + '_keywords', locals(), connection=dj.conn(**CONN_INFO))
+
+class A(dj.Manual):
+ definition = """
+ a_id: int # a id
+ """
+
+class B(dj.Manual):
+ sourc... | |
75043e0b91fe89d9be064ec65b7870f58f273c3d | python/simpleaudio_test.py | python/simpleaudio_test.py | import simpleaudio as sa
import time
import sys
wave_obj = sa.WaveObject.from_wave_file(sys.argv[1])
#for i in range(1000):
#play_obj = wave_obj.play()
#time.sleep(0.001)
play_obj = wave_obj.play()
play_obj.wait_done()
| Add simpleaudio test play script | Add simpleaudio test play script
| Python | mit | aapris/CernWall,aapris/CernWall | ---
+++
@@ -0,0 +1,11 @@
+import simpleaudio as sa
+import time
+import sys
+
+wave_obj = sa.WaveObject.from_wave_file(sys.argv[1])
+#for i in range(1000):
+ #play_obj = wave_obj.play()
+ #time.sleep(0.001)
+
+play_obj = wave_obj.play()
+play_obj.wait_done() | |
6c0b0ea9b6e8ecf8ea1b1185ce7d17d12e9d6976 | samples/scheduled_poweroff.py | samples/scheduled_poweroff.py | #!/usr/bin/env python
"""
Written by Gaël Berthaud-Müller
Github : https://github.com/blacksponge
This code is released under the terms of the Apache 2
http://www.apache.org/licenses/LICENSE-2.0.html
Example code for using the task scheduler.
"""
import atexit
import argparse
import getpass
from datetime import date... | Add sample for using the task scheduler | Add sample for using the task scheduler
| Python | apache-2.0 | pathcl/pyvmomi-community-samples,vmware/pyvmomi-community-samples,prziborowski/pyvmomi-community-samples,jm66/pyvmomi-community-samples | ---
+++
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+"""
+Written by Gaël Berthaud-Müller
+Github : https://github.com/blacksponge
+
+This code is released under the terms of the Apache 2
+http://www.apache.org/licenses/LICENSE-2.0.html
+
+Example code for using the task scheduler.
+"""
+
+import atexit
+import argparse
... | |
bae0666e929918923843995d56782baa5d7c5c33 | overlay/DataManager.py | overlay/DataManager.py | import sqlite3
from DataRegion import DataRegion
SELECT_DEPTH = """
select
date, property, value
from
readings
where
device='Pressure/Temperature' and
property in ('running','depth_feet')
"""
SELECT_TEMPERATURE = """
select
date, property, value
from
readings
where
device='Pressure/Tempera... | Create class to manage data regions | Create class to manage data regions
This currently manages depth and temperature data only
| Python | mit | thelonious/g2x,gizmo-cda/g2x,thelonious/g2x,gizmo-cda/g2x,gizmo-cda/g2x,gizmo-cda/g2x | ---
+++
@@ -0,0 +1,66 @@
+import sqlite3
+from DataRegion import DataRegion
+
+SELECT_DEPTH = """
+select
+ date, property, value
+from
+ readings
+where
+ device='Pressure/Temperature' and
+ property in ('running','depth_feet')
+"""
+
+SELECT_TEMPERATURE = """
+select
+ date, property, value
+from
+ ... | |
1dcb41ba6444665a661fa425f07f3c1d2882d22f | src/python/BasicMapPartitions.py | src/python/BasicMapPartitions.py | """
>>> from pyspark.context import SparkContext
>>> sc = SparkContext('local', 'test')
>>> b = sc.parallelize(["KK6JKQ", "Ve3UoW", "kk6jlk", "W6BB"])
>>> fetchCallSigns(b).size()
4
"""
import sys
import urllib3
from pyspark import SparkContext
def processCallSigns(signs):
"""Process call signs"""
http = url... | Add a basic map partitions examples for python | Add a basic map partitions examples for python
| Python | mit | noprom/learning-spark,feynman0825/learning-spark,qingkaikong/learning-spark-examples,jindalcastle/learning-spark,mohitsh/learning-spark,ramyasrigangula/learning-spark,SunGuo/learning-spark,mmirolim/learning-spark,junwucs/learning-spark,tengteng/learning-spark,ellis429/learning-spark,asarraf/learning-spark,shimizust/lea... | ---
+++
@@ -0,0 +1,33 @@
+"""
+>>> from pyspark.context import SparkContext
+>>> sc = SparkContext('local', 'test')
+>>> b = sc.parallelize(["KK6JKQ", "Ve3UoW", "kk6jlk", "W6BB"])
+>>> fetchCallSigns(b).size()
+4
+"""
+
+import sys
+import urllib3
+
+from pyspark import SparkContext
+
+def processCallSigns(signs):
+ ... | |
e100e6be59d5c78a600637d89399c55f39242918 | examples/XArray_Projections.py | examples/XArray_Projections.py | # Copyright (c) 2018 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
XArray Projection Handling
==========================
Use MetPy's XArray accessors to simplify opening a data file and plotting
data on a map using CartoPy.
"""
import cartopy.f... | Add example of using xarray projection info | ENH: Add example of using xarray projection info
| Python | bsd-3-clause | Unidata/MetPy,ShawnMurd/MetPy,dopplershift/MetPy,jrleeman/MetPy,dopplershift/MetPy,ahaberlie/MetPy,ahaberlie/MetPy,jrleeman/MetPy,Unidata/MetPy | ---
+++
@@ -0,0 +1,35 @@
+# Copyright (c) 2018 MetPy Developers.
+# Distributed under the terms of the BSD 3-Clause License.
+# SPDX-License-Identifier: BSD-3-Clause
+"""
+XArray Projection Handling
+==========================
+
+Use MetPy's XArray accessors to simplify opening a data file and plotting
+data on a map... | |
76a9ffd876a7bd678e64c5c0055a020cf775137d | random_walks.py | random_walks.py | import numpy as np
from matplotlib import pylab as plt
np.random.seed(31415926) # Set a seed for reproducibility
N_STEPS = 1000
random_data = np.random.randint(0, 2, N_STEPS)
# A symmetric random walk
random_walk = np.where(random_data > 0, 1, -1).cumsum()
N_WALKS = 1000
random_data_matrix = np.random.randint(0, 2... | Add a symmetric random walk script | Add a symmetric random walk script
| Python | mit | yassineAlouini/ml-experiments,yassineAlouini/ml-experiments | ---
+++
@@ -0,0 +1,16 @@
+import numpy as np
+from matplotlib import pylab as plt
+
+np.random.seed(31415926) # Set a seed for reproducibility
+
+N_STEPS = 1000
+random_data = np.random.randint(0, 2, N_STEPS)
+# A symmetric random walk
+random_walk = np.where(random_data > 0, 1, -1).cumsum()
+
+
+N_WALKS = 1000
+ran... | |
9aba00c3a2b89170585bb8741da43bf1a1874d2e | pydbus/exitable.py | pydbus/exitable.py | import inspect
class Exitable(object):
__slots__ = ("_at_exit_cbs")
def _at_exit(self, cb):
try:
self._at_exit_cbs
except AttributeError:
self._at_exit_cbs = []
self._at_exit_cbs.append(cb)
def __enter__(self):
return self
def __exit__(self, exc_type = None, exc_value = None, traceback = None):
... | Add Exitable - a tool to simplify context managers. | Add Exitable - a tool to simplify context managers.
| Python | lgpl-2.1 | LEW21/pydbus,LEW21/pydbus | ---
+++
@@ -0,0 +1,43 @@
+import inspect
+
+class Exitable(object):
+ __slots__ = ("_at_exit_cbs")
+
+ def _at_exit(self, cb):
+ try:
+ self._at_exit_cbs
+ except AttributeError:
+ self._at_exit_cbs = []
+
+ self._at_exit_cbs.append(cb)
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exc_type = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.