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 |
|---|---|---|---|---|---|---|---|---|---|---|
4587ca62906c668d17356b12c96c89a302f6df4f | examples/text_diff_reporter_example.py | examples/text_diff_reporter_example.py | from approvaltests import Approvals
from approvaltests.TextDiffReporter import TextDiffReporter
import os
import unittest
class Test(unittest.TestCase):
def test(self):
# This environment variable should be set somewhere outside of the test
# but is here to make the example clearer.
os.env... | Add an example of how to use the TextDiffReporter. | Add an example of how to use the TextDiffReporter.
| Python | apache-2.0 | approvals/ApprovalTests.Python,approvals/ApprovalTests.Python,approvals/ApprovalTests.Python,tdpreece/ApprovalTests.Python | ---
+++
@@ -0,0 +1,16 @@
+from approvaltests import Approvals
+from approvaltests.TextDiffReporter import TextDiffReporter
+import os
+import unittest
+
+
+class Test(unittest.TestCase):
+ def test(self):
+ # This environment variable should be set somewhere outside of the test
+ # but is here to mak... | |
6844f4e3c526ad10df7777c6cef79c32a78b7f23 | datapipe/denoising/cdf/__init__.py | datapipe/denoising/cdf/__init__.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Jérémie DECOCK (http://www.jdhp.org)
# This script is provided under the terms and conditions of the MIT license:
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (th... | Simplify the usage of CDF files. | Simplify the usage of CDF files.
| Python | mit | jdhp-sap/sap-cta-data-pipeline,jdhp-sap/sap-cta-data-pipeline,jdhp-sap/data-pipeline-standalone-scripts,jdhp-sap/data-pipeline-standalone-scripts | ---
+++
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2017 Jérémie DECOCK (http://www.jdhp.org)
+
+# This script is provided under the terms and conditions of the MIT license:
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and... | |
eac58dcfede3b17163ca625813f55dbaf1d72d38 | tests/test-icon-layout.py | tests/test-icon-layout.py | #!/usr/bin/python
import pygtk
pygtk.require('2.0')
from sugar.session.UITestSession import UITestSession
session = UITestSession()
session.start()
import sys
import random
import gtk
import goocanvas
from view.home.IconLayout import IconLayout
from sugar.canvas import IconColor
from sugar.canvas.IconItem import I... | Add test for icon layout | Add test for icon layout
| Python | lgpl-2.1 | puneetgkaur/sugar-toolkit-gtk3,puneetgkaur/backup_sugar_sugartoolkit,tchx84/sugar-toolkit-gtk3,sugarlabs/sugar-toolkit-gtk3,i5o/sugar-toolkit-gtk3,sugarlabs/sugar-toolkit,gusDuarte/sugar-toolkit-gtk3,ceibal-tatu/sugar-toolkit-gtk3,godiard/sugar-toolkit-gtk3,ceibal-tatu/sugar-toolkit-gtk3,gusDuarte/sugar-toolkit-gtk3,Da... | ---
+++
@@ -0,0 +1,49 @@
+#!/usr/bin/python
+import pygtk
+pygtk.require('2.0')
+
+from sugar.session.UITestSession import UITestSession
+
+session = UITestSession()
+session.start()
+
+import sys
+import random
+
+import gtk
+import goocanvas
+
+from view.home.IconLayout import IconLayout
+from sugar.canvas import I... | |
3bfc26205ea6ebc36a54991472e8c495430af0d3 | test/test_git_utilities.py | test/test_git_utilities.py | """Test group class"""
import unittest
from clowder.utility.git_utilities import (
git_ref_type,
git_truncate_ref
)
class GroupTest(unittest.TestCase):
"""group test subclass"""
def setUp(self):
self.branch_ref = 'refs/heads/master'
self.tag_ref = 'refs/tags/v1.0'
self.sha_ref =... | Add unit tests for git_utilities | Add unit tests for git_utilities
| Python | mit | JrGoodle/clowder,JrGoodle/clowder,JrGoodle/clowder | ---
+++
@@ -0,0 +1,45 @@
+"""Test group class"""
+import unittest
+from clowder.utility.git_utilities import (
+ git_ref_type,
+ git_truncate_ref
+)
+
+class GroupTest(unittest.TestCase):
+ """group test subclass"""
+ def setUp(self):
+ self.branch_ref = 'refs/heads/master'
+ self.tag_ref = ... | |
ab158de23187fd0ca838d7f89c2be81cab0cb0a2 | tools/compare_resample.py | tools/compare_resample.py | # Script to plot original wav file against wav file resampled at 16 kHz
# Licensed under Apache v2 (see LICENSE)
from __future__ import division
import sys
import os
import glob
import numpy as np
import matplotlib.pyplot as plt
from numpy.random import randint
from scipy.signal import resample
# Problems doing th... | Add script to check resampling of wav files | Add script to check resampling of wav files
| Python | apache-2.0 | voicesauce/opensauce-python,voicesauce/opensauce-python,voicesauce/opensauce-python | ---
+++
@@ -0,0 +1,59 @@
+# Script to plot original wav file against wav file resampled at 16 kHz
+
+# Licensed under Apache v2 (see LICENSE)
+
+from __future__ import division
+
+import sys
+import os
+import glob
+import numpy as np
+import matplotlib.pyplot as plt
+
+from numpy.random import randint
+from scipy.si... | |
10b163de791495f89367be979a724cce95f4915d | logger/pattern.py | logger/pattern.py | #!/usr/bin/env python3
"""Patterns and parsers for various purposes."""
__all__ = ["FormatSpecifierParser"]
import re
class FormatSpecifierParser:
"""Parser for the format specifiers used in the Interpolater."""
parse_format_spec = re.compile(
r"""
\A
(?:
(?P<fill>.)?
(?P<align... | Add first draft of FormatSpecifierParser | Add first draft of FormatSpecifierParser
| Python | bsd-2-clause | Vgr255/logging | ---
+++
@@ -0,0 +1,78 @@
+#!/usr/bin/env python3
+
+"""Patterns and parsers for various purposes."""
+
+__all__ = ["FormatSpecifierParser"]
+
+import re
+
+class FormatSpecifierParser:
+ """Parser for the format specifiers used in the Interpolater."""
+
+ parse_format_spec = re.compile(
+
+ r"""
+ \A
+ ... | |
5ca652d1f04a629c78ee3345c79dbded898a83dd | tests/test_cli.py | tests/test_cli.py | from click.testing import CliRunner
from webstore_deployer.deployer import init
def test_init():
runner = CliRunner()
result = runner.invoke(init, ['testing_client_ID'])
assert result.exit_code == 0
assert result.output.find('testing_client_ID') != -1
assert result.output.find('testing_client_IDn... | Add basic test for init | Add basic test for init
| Python | mit | melkamar/webstore-manager,melkamar/webstore-manager | ---
+++
@@ -0,0 +1,11 @@
+from click.testing import CliRunner
+from webstore_deployer.deployer import init
+
+
+def test_init():
+ runner = CliRunner()
+ result = runner.invoke(init, ['testing_client_ID'])
+
+ assert result.exit_code == 0
+ assert result.output.find('testing_client_ID') != -1
+ assert ... | |
e07c2f1c27e3d10e0a660e1434e66d8b26ad0810 | openedx/core/djangoapps/schedules/migrations/0009_schedule_copy_column_values.py | openedx/core/djangoapps/schedules/migrations/0009_schedule_copy_column_values.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.26 on 2019-11-24 20:52
from __future__ import unicode_literals
from django.db import migrations, transaction
def copy_column_value_forwards(apps, schema_editor):
"""
Copy the start field into start_date field
This table has around 25 million rows, we'll... | Copy values from old to new field in Schedules Model | Copy values from old to new field in Schedules Model
| Python | agpl-3.0 | appsembler/edx-platform,msegado/edx-platform,EDUlib/edx-platform,arbrandes/edx-platform,eduNEXT/edunext-platform,stvstnfrd/edx-platform,EDUlib/edx-platform,edx-solutions/edx-platform,edx/edx-platform,appsembler/edx-platform,edx-solutions/edx-platform,appsembler/edx-platform,EDUlib/edx-platform,msegado/edx-platform,apps... | ---
+++
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.26 on 2019-11-24 20:52
+from __future__ import unicode_literals
+
+from django.db import migrations, transaction
+
+
+def copy_column_value_forwards(apps, schema_editor):
+ """
+ Copy the start field into start_date field
+
+ This ... | |
0d7e851f4acb609b55c162b772e41293b7f00b17 | syntacticframes_project/syntacticframes/migrations/0002_auto_20140929_1135.py | syntacticframes_project/syntacticframes/migrations/0002_auto_20140929_1135.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('syntacticframes', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='levinclass',
... | Add migration for Levin class order | Add migration for Levin class order
| Python | mit | aymara/verbenet-editor,aymara/verbenet-editor,aymara/verbenet-editor | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('syntacticframes', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+... | |
9e5ec6fc67c863dea2de26ce742f0940ad43562c | Communication/benchPrototypeAPI.py | Communication/benchPrototypeAPI.py | import sys
sys.path.append('/home/bat/Python-Arduino-Proto-API-v2/arduino')
import time
locations = ['/dev/ttyACM0','/dev/ttyACM1','/dev/ttyACM2','/dev/ttyACM3','/dev/ttyACM4','/dev/ttyACM5','/dev/ttyUSB0','/dev/ttyUSB1','/dev/ttyUSB2','/dev/ttyUSB3','/dev/ttyS0','/dev/ttyS1','/dev/ttyS2','/dev/ttyS3']
from firmata im... | Add a script to benchmark python to arduino libraries | Add a script to benchmark python to arduino libraries
| Python | mit | baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite | ---
+++
@@ -0,0 +1,60 @@
+import sys
+sys.path.append('/home/bat/Python-Arduino-Proto-API-v2/arduino')
+import time
+locations = ['/dev/ttyACM0','/dev/ttyACM1','/dev/ttyACM2','/dev/ttyACM3','/dev/ttyACM4','/dev/ttyACM5','/dev/ttyUSB0','/dev/ttyUSB1','/dev/ttyUSB2','/dev/ttyUSB3','/dev/ttyS0','/dev/ttyS1','/dev/ttyS2'... | |
b8dd154c6f5d808d4b8916266fa43ca54c37851e | pybloom/hashfilter.py | pybloom/hashfilter.py | import time
class HashFilter(object):
'''
Plain Hash Filter for testing purposes
'''
def __init__(self, expiration):
self.expiration = expiration
self.unique_items = {}
def add(self, key):
if key in self.unique_items:
timestamp = time.time()
self.uni... | Add plain hash filter for testing | Add plain hash filter for testing
| Python | mit | Parsely/python-bloomfilter | ---
+++
@@ -0,0 +1,29 @@
+import time
+
+class HashFilter(object):
+ '''
+ Plain Hash Filter for testing purposes
+ '''
+ def __init__(self, expiration):
+ self.expiration = expiration
+ self.unique_items = {}
+
+ def add(self, key):
+ if key in self.unique_items:
+ time... | |
ad7c88acd0ff74f4dbd2d751d07c63abbbb9db44 | script_example.py | script_example.py | ## This is an example of how to set up a script to run against a database, should you need to do so.
## It should have everything you need to get started
from uber.config import c
from uber.models import Attendee, initialize_db, Session
with Session() as session:
initialize_db()
session = Session().session | Add example script This will give future-me a jumping off point for writing scripts to run against the DB for special cases. | Add example script
This will give future-me a jumping off point for writing scripts to run against the DB for special cases.
| Python | agpl-3.0 | magfest/ubersystem,magfest/ubersystem,magfest/ubersystem,magfest/ubersystem | ---
+++
@@ -0,0 +1,9 @@
+## This is an example of how to set up a script to run against a database, should you need to do so.
+## It should have everything you need to get started
+
+from uber.config import c
+from uber.models import Attendee, initialize_db, Session
+
+with Session() as session:
+ initialize_db()
... | |
b8d824b5355bcabd6a1bdcf7d8af39076ce75bb6 | examples/workspace_renumber.py | examples/workspace_renumber.py | #!/usr/bin/env python3
import i3ipc
# make connection to i3 ipc
i3 = i3ipc.Connection()
# check if workspaces are all in order
def workspaces_ordered(i3conn):
last_workspace_number = 0
for i in sorted(i3conn.get_workspaces(), key=lambda x: x['num']):
if i['num'] != last_workspace_number+1:
... | Add script that makes sure workspace numbers are always in consecutive order by moving windows on out of order workspaces to the appropriate workspace | Add script that makes sure workspace numbers are always in consecutive
order by moving windows on out of order workspaces to the appropriate
workspace
| Python | bsd-3-clause | acrisci/i3ipc-python | ---
+++
@@ -0,0 +1,53 @@
+#!/usr/bin/env python3
+
+import i3ipc
+
+# make connection to i3 ipc
+i3 = i3ipc.Connection()
+
+# check if workspaces are all in order
+def workspaces_ordered(i3conn):
+ last_workspace_number = 0
+ for i in sorted(i3conn.get_workspaces(), key=lambda x: x['num']):
+ if i['num'... | |
bf16ff8622049a29e2013266d7bb2ac7f5c3a84d | designate/backend/impl_powerdns/migrate_repo/versions/017_records_drop_duped_index.py | designate/backend/impl_powerdns/migrate_repo/versions/017_records_drop_duped_index.py | # Copyright 2015 NetEase, Inc.
#
# Author: Zhang Gengyuan <stanzgy@gmail.com>
#
# 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 re... | Remove duplicated index on table 'records' of pDNS backend | Remove duplicated index on table 'records' of pDNS backend
Remove duplicated index `rec_name_index` on table 'records' of pDNS backend.
Change-Id: I9e8723b464522a588f0e0ef6ff261b71609b0726
Closes-Bug: 1446980
| Python | apache-2.0 | grahamhayes/designate,tonyli71/designate,cneill/designate-testing,tonyli71/designate,kiall/designate-py3,ionrock/designate,kiall/designate-py3,openstack/designate,kiall/designate-py3,cneill/designate,muraliselva10/designate,cneill/designate-testing,kiall/designate-py3,muraliselva10/designate,muraliselva10/designate,ope... | ---
+++
@@ -0,0 +1,38 @@
+# Copyright 2015 NetEase, Inc.
+#
+# Author: Zhang Gengyuan <stanzgy@gmail.com>
+#
+# 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.or... | |
6156181b6635a7dd6cdd8f699a2e5570cb42e89c | website/tests/views/test_pathway.py | website/tests/views/test_pathway.py | from database import db
from models import Pathway, Gene, GeneList, GeneListEntry
from view_testing import ViewTest
def create_pathways():
# not necessarily true ;)
genes = [Gene(name=name) for name in 'KRAS NRAS AKAP13 NF1 BCR'.split()]
significant_genes = [Gene(name=name) for name in 'TP53 AKT1 TXN GPI... | Add tests for pathways details and significant pathways | Add tests for pathways details and significant pathways
| Python | lgpl-2.1 | reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/Visual... | ---
+++
@@ -0,0 +1,69 @@
+from database import db
+from models import Pathway, Gene, GeneList, GeneListEntry
+from view_testing import ViewTest
+
+
+def create_pathways():
+
+ # not necessarily true ;)
+ genes = [Gene(name=name) for name in 'KRAS NRAS AKAP13 NF1 BCR'.split()]
+ significant_genes = [Gene(name... | |
63cd90c4179f0b68c1af0a174e30b25906e6319e | taiga/projects/management/commands/change_project_slug.py | taiga/projects/management/commands/change_project_slug.py | # -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | Create command to change project slug | Create command to change project slug
| Python | agpl-3.0 | taigaio/taiga-back,taigaio/taiga-back,dayatz/taiga-back,dayatz/taiga-back,taigaio/taiga-back,dayatz/taiga-back | ---
+++
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
+# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
+# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
+# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
+# This pr... | |
512f98053fbc8df5ac08312e950ef3042fa5a864 | reverse_complement.py | reverse_complement.py | import sys
from argparse import ArgumentParser, FileType
from Bio.Seq import Seq
def reverse_complement(seq):
return str(Seq(seq.strip()).reverse_complement())
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument("infile", nargs="?", type=FileType('r'), default=sys.stdin)
args = pa... | Add script to reverse complement a set of sequences. | Add script to reverse complement a set of sequences.
| Python | mit | roryk/junkdrawer,roryk/junkdrawer | ---
+++
@@ -0,0 +1,14 @@
+import sys
+from argparse import ArgumentParser, FileType
+from Bio.Seq import Seq
+
+def reverse_complement(seq):
+ return str(Seq(seq.strip()).reverse_complement())
+
+if __name__ == "__main__":
+ parser = ArgumentParser()
+ parser.add_argument("infile", nargs="?", type=FileType('... | |
e7bceb26566265c19009a5be68e3fe744a38176b | TWLight/applications/migrations/0022_auto_20181209_1315.py | TWLight/applications/migrations/0022_auto_20181209_1315.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2018-12-09 13:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('applications', '0021_application_hidden'),
]
operations = [
migrations.Alt... | Add migration for previous commit | Add migration for previous commit
| Python | mit | WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.17 on 2018-12-09 13:15
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('applications', '0021_application_hidden'),
+ ]
+
+... | |
93ba1d34e51a9b959b63e77eae78845dd86203ed | camera-capture-test.py | camera-capture-test.py | #! /usr/bin/env python
# -*- coding:utf-8 -*-
#
# Application to capture images synchronously
# from two AVT Manta cameras with the Vimba SDK
#
# External dependencies
import collections, cv2, time
import Vimba
# Number of images saved
image_count = 0
# Frame per second counter
counter = 0
fps_counter = 0
fps_bu... | Test to use the new Vimba module. | Test to use the new Vimba module.
| Python | mit | microy/VisionToolkit,microy/StereoVision,microy/VisionToolkit,microy/PyStereoVisionToolkit,microy/PyStereoVisionToolkit,microy/StereoVision | ---
+++
@@ -0,0 +1,91 @@
+#! /usr/bin/env python
+# -*- coding:utf-8 -*-
+
+
+#
+# Application to capture images synchronously
+# from two AVT Manta cameras with the Vimba SDK
+#
+
+
+# External dependencies
+import collections, cv2, time
+import Vimba
+
+# Number of images saved
+image_count = 0
+
+# Frame per seco... | |
03a4dde5c9abebec27ac4ce38b2bfefd5c661274 | classify_body_parts.py | classify_body_parts.py | """Find known body parts in sentences with predicted label 'Lichaamsdeel'.
Extended body parts are saved to new text files.
Usage: python classify_body_parts.py <json file with body part mapping> <dir
with input texts> <dir for output texts>
"""
import os
import codecs
import argparse
import json
from count_labels im... | Add script to expand body parts | Add script to expand body parts
The script looks for words indicating body parts in sentences with
predicted label Lichaamsdeel and adds the appropriate body part terms to
the labels per sentence. The results are written to text files in a new
directory.
| Python | apache-2.0 | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | ---
+++
@@ -0,0 +1,86 @@
+"""Find known body parts in sentences with predicted label 'Lichaamsdeel'.
+
+Extended body parts are saved to new text files.
+
+Usage: python classify_body_parts.py <json file with body part mapping> <dir
+with input texts> <dir for output texts>
+"""
+import os
+import codecs
+import argp... | |
fca3c0d7ce33dde19191f6c193344ee888b9c97a | geotrek/land/tests/test_models.py | geotrek/land/tests/test_models.py | from django.test import TestCase
from geotrek.land.models import LandType, PhysicalType
class TestModelLand(TestCase):
def test_physicaltype_value_no_structure(self):
pt = PhysicalType.objects.create(name='PhysicalType_1', structure=None)
self.assertEqual(str(pt), 'PhysicalType_1')
def test_... | Add tests model land values | Add tests model land values
| Python | bsd-2-clause | makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek | ---
+++
@@ -0,0 +1,21 @@
+from django.test import TestCase
+
+from geotrek.land.models import LandType, PhysicalType
+
+
+class TestModelLand(TestCase):
+ def test_physicaltype_value_no_structure(self):
+ pt = PhysicalType.objects.create(name='PhysicalType_1', structure=None)
+ self.assertEqual(str(p... | |
f18e08afb49724c01d84e36779eb6662631c5485 | hoomd/md/pytest/test_integrate.py | hoomd/md/pytest/test_integrate.py | import pytest
import hoomd
import hoomd.md as md
def make_simulation(simulation_factory, two_particle_snapshot_factory):
def sim_factory(particle_types=['A'], dimensions=3, d=1, L=20):
return simulation_factory(
two_particle_snapshot_factory(particle_types, dimensions, d, L))
return sim... | Add basic integrator attaching/detaching tests | Add basic integrator attaching/detaching tests
| Python | bsd-3-clause | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | ---
+++
@@ -0,0 +1,50 @@
+import pytest
+
+import hoomd
+import hoomd.md as md
+
+
+def make_simulation(simulation_factory, two_particle_snapshot_factory):
+
+ def sim_factory(particle_types=['A'], dimensions=3, d=1, L=20):
+ return simulation_factory(
+ two_particle_snapshot_factory(particle_typ... | |
cc358ae9d62e2a0fd6ebca99c410d0c2ce517d87 | aospy/test/test_timedate.py | aospy/test/test_timedate.py | #!/usr/bin/env python
"""Test suite for aospy.utils module."""
import sys
import unittest
import numpy as np
import xarray as xr
from datetime import datetime
from aospy.timedate import TimeManager
class AospyTimeManagerTestCase(unittest.TestCase):
def setUp(self):
# self.tm = TimeManager()
pass
... | TEST Added tests of TimeManager | TEST Added tests of TimeManager
| Python | apache-2.0 | spencerahill/aospy,spencerkclark/aospy | ---
+++
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+"""Test suite for aospy.utils module."""
+import sys
+import unittest
+
+import numpy as np
+import xarray as xr
+from datetime import datetime
+
+from aospy.timedate import TimeManager
+
+
+class AospyTimeManagerTestCase(unittest.TestCase):
+ def setUp(self):
+# ... | |
ba09a243a37db3ef8b587f92d258a60047a4c2c7 | python/rds_desired_instance_type-triggered.py | python/rds_desired_instance_type-triggered.py | #
# This file made available under CC0 1.0 Universal (https://creativecommons.org/publicdomain/zero/1.0/legalcode)
#
# Ensure all RDS DB Instances are of a Given Type
# Description: Checks that all RDS DB instances are of the type specified
#
# Trigger Type: Change Triggered
# Scope of Changes: RDS::DBInstance
# Requir... | Add RDS instance Type Config Rule. | Add RDS instance Type Config Rule.
Requirements: comma separated DBInstance Class named "DBInstance" as Key on Rule parameters. | Python | cc0-1.0 | awslabs/aws-config-rules,awslabs/aws-config-rules,awslabs/aws-config-rules | ---
+++
@@ -0,0 +1,56 @@
+#
+# This file made available under CC0 1.0 Universal (https://creativecommons.org/publicdomain/zero/1.0/legalcode)
+#
+# Ensure all RDS DB Instances are of a Given Type
+# Description: Checks that all RDS DB instances are of the type specified
+#
+# Trigger Type: Change Triggered
+# Scope o... | |
b463737daffac786354bee8c49bd11dbed3a8064 | examples/arlo-adjustbrightness.py | examples/arlo-adjustbrightness.py | from Arlo import Arlo
USERNAME = 'user@example.com'
PASSWORD = 'supersecretpassword'
try:
# Instantiating the Arlo object automatically calls Login(), which returns an oAuth token that gets cached.
# Subsequent successful calls to login will update the oAuth token.
arlo = Arlo(USERNAME, PASSWORD)
# At this point ... | Add example script for adjusting live camera feed brightness. | Add example script for adjusting live camera feed brightness.
| Python | apache-2.0 | jeffreydwalter/arlo | ---
+++
@@ -0,0 +1,36 @@
+from Arlo import Arlo
+
+USERNAME = 'user@example.com'
+PASSWORD = 'supersecretpassword'
+
+try:
+ # Instantiating the Arlo object automatically calls Login(), which returns an oAuth token that gets cached.
+ # Subsequent successful calls to login will update the oAuth token.
+ arlo = Arlo(U... | |
4084fba3d438da4a4133dfafec985d8dd4191a3a | examples/demo/basic/scatter_1d.py | examples/demo/basic/scatter_1d.py | """
Scatter plot with auxilliary 1d plots
Shows a scatter plot of a set of random points,
with auxilliary 1d plots of the data.
"""
# Major library imports
from numpy import sort
from numpy.random import random, randint
# Enthought library imports
from enable.api import Component, ComponentEditor
from traits.api im... | Add example showing 1d scatter plots. | Add example showing 1d scatter plots.
| Python | bsd-3-clause | tommy-u/chaco,tommy-u/chaco,tommy-u/chaco | ---
+++
@@ -0,0 +1,123 @@
+"""
+Scatter plot with auxilliary 1d plots
+
+Shows a scatter plot of a set of random points,
+with auxilliary 1d plots of the data.
+
+"""
+
+# Major library imports
+from numpy import sort
+from numpy.random import random, randint
+
+# Enthought library imports
+from enable.api import Com... | |
4b6a9d9a7aa45271d2f5e001f06a2fde115bf677 | migrations/versions/2d257d93329_remove_booksales_tables.py | migrations/versions/2d257d93329_remove_booksales_tables.py | """Remove booksales tables
Revision ID: 2d257d93329
Revises: 3ee07cd6b53
Create Date: 2016-04-09 13:04:55.562530
"""
# revision identifiers, used by Alembic.
revision = '2d257d93329'
down_revision = '3ee07cd6b53'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
... | Add a migration to remove booksales tables | Add a migration to remove booksales tables
| Python | mit | viaict/viaduct,viaict/viaduct,viaict/viaduct,viaict/viaduct,viaict/viaduct | ---
+++
@@ -0,0 +1,60 @@
+"""Remove booksales tables
+
+Revision ID: 2d257d93329
+Revises: 3ee07cd6b53
+Create Date: 2016-04-09 13:04:55.562530
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '2d257d93329'
+down_revision = '3ee07cd6b53'
+
+from alembic import op
+import sqlalchemy as sa
+from sqlalchem... | |
c0f410237bf97585de1e42a37e54e30775c40d33 | installscanners/installscanners.py | installscanners/installscanners.py |
import subprocess
SCANNER_INSTALLATION_INSTRUCTIONS = {
"safesql":"github.com/stripe/safesql",
"gas":"github.com/GoASTScanner/gas"
}
GO_CMD = "go"
class InstallGOScanners:
'''Install the scanners as ne... | Install scanners that are not installed based on user selection | Install scanners that are not installed based on user selection
| Python | mit | gaurabb/pygosec | ---
+++
@@ -0,0 +1,26 @@
+
+import subprocess
+
+
+SCANNER_INSTALLATION_INSTRUCTIONS = {
+ "safesql":"github.com/stripe/safesql",
+ "gas":"github.com/GoASTScanner/gas"
+ }
+GO_CMD = "go"
+
+class InstallGOScanne... | |
002c5c2523a1f5da665a58c5b574d743c2b25218 | python/testData/inspections/PyStringFormatInspection/IndexElementWithPackedDictLiteralInsideDictLiteralArg.py | python/testData/inspections/PyStringFormatInspection/IndexElementWithPackedDictLiteralInsideDictLiteralArg.py | # "{d[1]}".format(d={2: a, **{1: b}})
<warning descr="Too few arguments for format string">"{d[3]}"</warning>.format(d={2: a, **{1: b}}) | "{d[1]}".format(d={2: a, **{1: b}})
<warning descr="Too few arguments for format string">"{d[3]}"</warning>.format(d={2: a, **{1: b}}) | Fix test: uncomment test commented by mistake | Fix test: uncomment test commented by mistake
| Python | apache-2.0 | vvv1559/intellij-community,allotria/intellij-community,semonte/intellij-community,da1z/intellij-community,suncycheng/intellij-community,asedunov/intellij-community,suncycheng/intellij-community,ThiagoGarciaAlves/intellij-community,ThiagoGarciaAlves/intellij-community,apixandru/intellij-community,FHannes/intellij-commun... | ---
+++
@@ -1,2 +1,2 @@
-# "{d[1]}".format(d={2: a, **{1: b}})
+"{d[1]}".format(d={2: a, **{1: b}})
<warning descr="Too few arguments for format string">"{d[3]}"</warning>.format(d={2: a, **{1: b}}) |
d07d19a2d88762d9483dad07a432329759e51e67 | stack/database.py | stack/database.py | from troposphere import (
rds,
Ref,
AWS_STACK_NAME,
)
from .template import template
from .vpc import (
container_a_subnet,
container_b_subnet,
)
db_subnet_group = rds.DBSubnetGroup(
"DatabaseSubnetGroup",
template=template,
DBSubnetGroupDescription="Subnets available for the RDS DB I... | Add a multi AZ PostgreSQL `RDS` instance bound to container subnets | Add a multi AZ PostgreSQL `RDS` instance bound to container subnets
| Python | mit | caktus/aws-web-stacks,tobiasmcnulty/aws-container-basics | ---
+++
@@ -0,0 +1,32 @@
+from troposphere import (
+ rds,
+ Ref,
+ AWS_STACK_NAME,
+)
+
+from .template import template
+from .vpc import (
+ container_a_subnet,
+ container_b_subnet,
+)
+
+
+db_subnet_group = rds.DBSubnetGroup(
+ "DatabaseSubnetGroup",
+ template=template,
+ DBSubnetGroupDes... | |
19cdcd64c2172e4ef5877e2f331b03671091c1e2 | tests/test_connect.py | tests/test_connect.py | import pytest
from pypuppetdb.errors import UnsupportedVersionError
from pypuppetdb import connect
pytestmark = pytest.mark.unit
def test_connect_unknown_api_version():
with pytest.raises(UnsupportedVersionError):
connect(api_version=1)
| Add a basic test for connect(). | tests: Add a basic test for connect().
| Python | apache-2.0 | voxpupuli/pypuppetdb,puppet-community/pypuppetdb,vicinus/pypuppetdb,dforste/pypuppetdb,amwilson/pypuppetdb,jcastillocano/pypuppetdb,jcastillocano/pypuppetdb,jorik041/pypuppetdb | ---
+++
@@ -0,0 +1,10 @@
+import pytest
+from pypuppetdb.errors import UnsupportedVersionError
+from pypuppetdb import connect
+
+pytestmark = pytest.mark.unit
+
+
+def test_connect_unknown_api_version():
+ with pytest.raises(UnsupportedVersionError):
+ connect(api_version=1) | |
3cefb683ee51fb9821a7a47013ca18db5429b4a9 | tests/test_jupyter.py | tests/test_jupyter.py | import mock
import pytest
try:
import ipywidgets
except ImportError:
ipywidgets = None
@pytest.mark.skipif(ipywidgets is None, reason='ipywidgets is not installed')
class TestExperimentWidget(object):
@pytest.fixture
def exp(self):
from dallinger.experiment import Experiment
return Ex... | Add tests for jupyter widget | Add tests for jupyter widget
| Python | mit | Dallinger/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,jcpeterson/Dallinger,Dallinger/Dallinger | ---
+++
@@ -0,0 +1,34 @@
+import mock
+import pytest
+try:
+ import ipywidgets
+except ImportError:
+ ipywidgets = None
+
+
+@pytest.mark.skipif(ipywidgets is None, reason='ipywidgets is not installed')
+class TestExperimentWidget(object):
+
+ @pytest.fixture
+ def exp(self):
+ from dallinger.exper... | |
e6ddd127f906f383fedcdecd9b0eaefb55aba54c | tests/conftest.py | tests/conftest.py | from pytest import Item
def pytest_assertion_pass(item: Item,
lineno: int,
orig: str,
expl: str) -> None:
'''
Log every assertion, in case we later need to audit a run.
Excessive in most cases.
Use with pytest -rP.
'''... | Add optional actual asserted values logging | Add optional actual asserted values logging
| Python | isc | pilona/RPN,pilona/RPN | ---
+++
@@ -0,0 +1,21 @@
+from pytest import Item
+
+
+def pytest_assertion_pass(item: Item,
+ lineno: int,
+ orig: str,
+ expl: str) -> None:
+ '''
+ Log every assertion, in case we later need to audit a run.
+
+ Excessive in most ca... | |
8458efcd6acec59971271d3b0391732022c66412 | metpy/plots/tests/test_skewt.py | metpy/plots/tests/test_skewt.py | import tempfile
import numpy as np
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg
from metpy.plots.skewt import * # noqa
# TODO: Need at some point to do image-based comparison, but that's a lot to
# bite off right now
class TestSkewT(object):
def test_api(self):... | Add API test for SkewT. | Add API test for SkewT.
This does no checking for the output being correct, but at least checks
that the code doesn't fire an exception on normal use.
| Python | bsd-3-clause | Unidata/MetPy,ahaberlie/MetPy,ahill818/MetPy,dopplershift/MetPy,jrleeman/MetPy,ShawnMurd/MetPy,deeplycloudy/MetPy,dopplershift/MetPy,ahaberlie/MetPy,jrleeman/MetPy,Unidata/MetPy | ---
+++
@@ -0,0 +1,30 @@
+import tempfile
+import numpy as np
+from matplotlib.figure import Figure
+from matplotlib.backends.backend_agg import FigureCanvasAgg
+from metpy.plots.skewt import * # noqa
+
+
+# TODO: Need at some point to do image-based comparison, but that's a lot to
+# bite off right now
+class TestS... | |
bfcab239099e2e2ad28dde3cab886e0081664868 | unlock/admin/hello.py | unlock/admin/hello.py | from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
@app.route("/hitmehard")
def ttol():
import pyaudio
import unlock
# yous a do your business here...
return str(dir(unlock))
if __name__ == "__main__":
app.run() | Put together a basic flask for Dante. The start of the admin page. | Put together a basic flask for Dante. The start of the admin page.
| Python | bsd-3-clause | NeuralProsthesisLab/unlock,NeuralProsthesisLab/unlock,NeuralProsthesisLab/unlock,NeuralProsthesisLab/unlock,NeuralProsthesisLab/unlock,NeuralProsthesisLab/unlock,NeuralProsthesisLab/unlock | ---
+++
@@ -0,0 +1,17 @@
+from flask import Flask
+app = Flask(__name__)
+
+@app.route("/")
+def hello():
+ return "Hello World!"
+
+@app.route("/hitmehard")
+def ttol():
+ import pyaudio
+ import unlock
+ # yous a do your business here...
+ return str(dir(unlock))
+
+
+if __name__ == "__main__":
+ app.run() | |
eccf9607fae71c4fe955f1b71b1090882b6bae82 | sage-equations.py | sage-equations.py | #!/usr/bin/python
#
# Write equations needed to feed into sage in alpha-numeric form
#
# Cahlen Humphreys (2015)
fo = open("anf.txt", "wb")
ptext = "01100010100101110000101011100011"
ctext = "01101000110010010100101001111001"
key = "00110100110111111001011000011100"
ptextl = list(ptext)
ctextl = list(ctext)
keyl = ... | Write equations for sage to convert to CNF | Write equations for sage to convert to CNF | Python | mit | cahlen/keeloq-python | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+#
+# Write equations needed to feed into sage in alpha-numeric form
+#
+# Cahlen Humphreys (2015)
+fo = open("anf.txt", "wb")
+
+ptext = "01100010100101110000101011100011"
+ctext = "01101000110010010100101001111001"
+key = "00110100110111111001011000011100"
+
+ptextl = l... | |
3e50ff3074f1734db165ad9a601aa8177f97a068 | linkedin_scraper/spiders/search.py | linkedin_scraper/spiders/search.py | import scrapy
class SearchSpider(scrapy.Spider):
name = 'search'
allowed_domains = ['linkedin.com']
start_urls = ['http://linkedin.com/']
def parse(self, response):
pass
| Add SearchSpider generated by `scrapy genspider` command | Add SearchSpider generated by `scrapy genspider` command
| Python | mit | nihn/linkedin-scraper,nihn/linkedin-scraper | ---
+++
@@ -0,0 +1,10 @@
+import scrapy
+
+
+class SearchSpider(scrapy.Spider):
+ name = 'search'
+ allowed_domains = ['linkedin.com']
+ start_urls = ['http://linkedin.com/']
+
+ def parse(self, response):
+ pass | |
602676fbdde3fc7bdf8203159a96215cc91dc340 | src/ig.py | src/ig.py | from scipy import stats
from math import log2
import numpy as np
def majority_value(binary_targets):
mode = stats.mode(binary_targets)
return tuple(map(lambda x: x[0], mode))
def entropy(binary_targets):
size, _ = binary_targets.shape
_, mode_size = majority_value(binary_targets)
majority_propo... | Implement information gain related functions (untested). | Implement information gain related functions (untested).
| Python | mit | MLNotWar/decision-trees-algorithm,MLNotWar/decision-trees-algorithm | ---
+++
@@ -0,0 +1,50 @@
+from scipy import stats
+from math import log2
+import numpy as np
+
+
+def majority_value(binary_targets):
+ mode = stats.mode(binary_targets)
+ return tuple(map(lambda x: x[0], mode))
+
+
+def entropy(binary_targets):
+ size, _ = binary_targets.shape
+ _, mode_size = majority_v... | |
e5b112169653322eaf6d7e8a7816753f919bf0f9 | skia/PRESUBMIT.py | skia/PRESUBMIT.py | # Copyright 2013 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.
"""Top-level presubmit script for skia/
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API... | Add extra bots to the default set of try bots for changes in skia/ | skia: Add extra bots to the default set of try bots for changes in skia/
This adds linux_layout_rel, win_gpu, linux_gpu, mac_gpu, and
mac_gpu_retina to the default set of bots to run on patches that touch
skia/ when doing "git cl try".
This has no effect on the commit queue bot set which is maintained
elsewhere by th... | Python | bsd-3-clause | Jonekee/chromium.src,anirudhSK/chromium,crosswalk-project/chromium-crosswalk-efl,markYoungH/chromium.src,dednal/chromium.src,dednal/chromium.src,M4sse/chromium.src,hgl888/chromium-crosswalk-efl,axinging/chromium-crosswalk,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk,krieger-od/nwjs_chromium.src,Fireblend/chro... | ---
+++
@@ -0,0 +1,18 @@
+# Copyright 2013 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.
+
+"""Top-level presubmit script for skia/
+
+See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
+for m... | |
edf9101eae52ce0a3f87b8f233e3f8ba1dcbbee0 | src/helper_sql.py | src/helper_sql.py | import shared
def sqlQuery(sqlStatement, *args):
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(sqlStatement)
if args == ():
shared.sqlSubmitQueue.put('')
else:
shared.sqlSubmitQueue.put(args)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
retu... | Move duplicated sql code into helper | Move duplicated sql code into helper
| Python | mit | Erkan-Yilmaz/PyBitmessage,debguy0x/PyBitmessage,domob1812/PyBitmessage,tigerbunny/bitmessage,hb9kns/PyBitmessage,timothyparez/PyBitmessage,bmng-dev/PyBitmessage,tigerbunny/bitmessage,mailchuck/PyBitmessage,lightrabbit/PyBitmessage,gnu3ra/PyBitmessage,hb9kns/PyBitmessage,xeddmc/PyBitmessage,rzr/PyBitmessage,torifier/PyB... | ---
+++
@@ -0,0 +1,33 @@
+import shared
+
+def sqlQuery(sqlStatement, *args):
+ shared.sqlLock.acquire()
+ shared.sqlSubmitQueue.put(sqlStatement)
+
+ if args == ():
+ shared.sqlSubmitQueue.put('')
+ else:
+ shared.sqlSubmitQueue.put(args)
+
+ queryreturn = shared.sqlReturnQueue.get()... | |
74acd01d0997924944fdf4c9d7833c08b42c7004 | phylogenetics/exttools/taxonomy.py | phylogenetics/exttools/taxonomy.py | """Ping the NCBI Taxonomy web service and retrieve data about a sequence.
Stupidly simple module... probably needs more intelligent/safe parsing of data.
"""
import re
import requests
def query(keyword, type="name", **kwargs):
"""Send a query to retrieve taxonomic data about a set of sequences.
"""
main_u... | Add module for pulling taxonomic data from BLAST | Add module for pulling taxonomic data from BLAST
| Python | unlicense | Zsailer/phylogenetics,Zsailer/phylo_tools_2 | ---
+++
@@ -0,0 +1,51 @@
+"""Ping the NCBI Taxonomy web service and retrieve data about a sequence.
+
+Stupidly simple module... probably needs more intelligent/safe parsing of data.
+"""
+import re
+import requests
+
+def query(keyword, type="name", **kwargs):
+ """Send a query to retrieve taxonomic data about a ... | |
191e041239378583040596f8fe08b37e95ebd31c | osf/migrations/0117_set_is_root.py | osf/migrations/0117_set_is_root.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-07-11 18:05
from __future__ import unicode_literals
from django.db import migrations
def set_is_root(state, *args, **kwargs):
OsfStorageFolder = state.get_model('osf', 'osfstoragefolder')
OsfStorageFolder.objects.filter(nodesettings__isnull=False,... | Set is_root=True for old folders set as root_node for existing NodeSettings | Set is_root=True for old folders set as root_node for existing NodeSettings
[#PLAT-578]
| Python | apache-2.0 | mfraezz/osf.io,felliott/osf.io,saradbowman/osf.io,mattclark/osf.io,brianjgeiger/osf.io,pattisdr/osf.io,mattclark/osf.io,felliott/osf.io,HalcyonChimera/osf.io,erinspace/osf.io,Johnetordoff/osf.io,caseyrollins/osf.io,felliott/osf.io,brianjgeiger/osf.io,mfraezz/osf.io,adlius/osf.io,cslzchen/osf.io,caseyrollins/osf.io,bayl... | ---
+++
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.13 on 2018-07-11 18:05
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+def set_is_root(state, *args, **kwargs):
+ OsfStorageFolder = state.get_model('osf', 'osfstoragefolder')
+ OsfStorageFolder.objec... | |
71c47c8374cf6c5f53cdfbb71763f165bcd6c013 | oneflow/base/tests/__init__.py | oneflow/base/tests/__init__.py | # -*- coding: utf-8 -*-
import redis
from mongoengine.connection import connect, disconnect
from django.conf import settings
TEST_REDIS = redis.StrictRedis(host=settings.REDIS_TEST_HOST,
port=settings.REDIS_TEST_PORT,
db=settings.REDIS_TEST_DB)
def con... | # -*- coding: utf-8 -*-
import redis
from mongoengine.connection import connect, disconnect
from django.conf import settings
TEST_REDIS = redis.StrictRedis(host=settings.REDIS_TEST_HOST,
port=settings.REDIS_TEST_PORT,
db=settings.REDIS_TEST_DB)
def con... | Make the test MongoDB database TZ aware like the production one, else some date comparisons fail, whereas they succeed in production. | Make the test MongoDB database TZ aware like the production one, else some date comparisons fail, whereas they succeed in production.
| Python | agpl-3.0 | 1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow | ---
+++
@@ -13,7 +13,8 @@
def connect_mongodb_testsuite():
disconnect()
- connect('{0}_testsuite'.format(settings.MONGODB_NAME))
+ connect('{0}_testsuite'.format(settings.MONGODB_NAME),
+ tz_aware=settings.USE_TZ)
__all__ = ('TEST_REDIS', 'connect_mongodb_testsuite', ) |
23c368e149d1cdb49f67a92d020f5eabc8527dd0 | base.py | base.py | import abc
from PyQt5 import QtWidgets
class BaseWidgetView(QtWidgets.QWidget):
__metaclass__ = abc.ABCMeta
def notify(self, kwargs):
u"""
Name based notification with callable() validation
"""
func_name = kwargs.pop('func')
func = getattr(self, func_name)
if no... | Refactor of controllers and views into heritage from abstract classes | Refactor of controllers and views into heritage from abstract classes
| Python | mit | PereBal/advanced-algorithms | ---
+++
@@ -0,0 +1,45 @@
+import abc
+from PyQt5 import QtWidgets
+class BaseWidgetView(QtWidgets.QWidget):
+ __metaclass__ = abc.ABCMeta
+
+ def notify(self, kwargs):
+ u"""
+ Name based notification with callable() validation
+ """
+ func_name = kwargs.pop('func')
+ func = g... | |
cf5a47dde195152a3f414e20e075694c7bf5e70e | examples/concurrent.py | examples/concurrent.py | try:
import _path
except NameError:
pass
import spyral
import sys
SIZE = (600, 600)
BG_COLOR = (0, 0, 0)
class StupidSprite(spyral.Sprite, spyral.Actor):
def __init__(self, camera):
spyral.Sprite.__init__(self, camera)
spyral.Actor.__init__(self)
self.image = spyral.Im... | Add a simple actor example. | Add a simple actor example.
Signed-off-by: Robert Deaton <eb00a885478926d5d594195591fb94a03acb1062@udel.edu>
| Python | lgpl-2.1 | platipy/spyral | ---
+++
@@ -0,0 +1,62 @@
+try:
+ import _path
+except NameError:
+ pass
+import spyral
+import sys
+
+SIZE = (600, 600)
+BG_COLOR = (0, 0, 0)
+
+class StupidSprite(spyral.Sprite, spyral.Actor):
+ def __init__(self, camera):
+ spyral.Sprite.__init__(self, camera)
+ spyral.Actor.__init__(self... | |
6c7f0006fd6324c544eda48fb9d7dd1316d39e7a | samples/forms.py | samples/forms.py | import datetime #for checking renewal date range.
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from .models import (Patient, AdmissionNote, FluVaccine,
CollectionType, CollectedSample,
Symptom, ObservedSymptom,
)
class Ad... | import datetime #for checking renewal date range.
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from .models import (Patient, AdmissionNote, FluVaccine,
CollectionType, CollectedSample,
Symptom, ObservedSymptom,
)
class Ad... | Change Vaccine was_applied widget to RadioSelect | :rocket: Change Vaccine was_applied widget to RadioSelect
| Python | mit | gems-uff/labsys,gcrsaldanha/fiocruz,gcrsaldanha/fiocruz,gems-uff/labsys,gems-uff/labsys | ---
+++
@@ -32,3 +32,10 @@
fields = [
'was_applied',
]
+ widgets = {
+ 'was_applied': forms.RadioSelect(
+ choices=(
+ (True, "Sim"), (False, "Não"), (None, "Ignorado"),
+ ),
+ ),
+ } |
6523578278f93a549b37ca448d7e5140337c1e8d | contentcuration/contentcuration/migrations/0103_auto_20190905_0408.py | contentcuration/contentcuration/migrations/0103_auto_20190905_0408.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-09-05 04:08
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('contentcuration', '0102_auto_20190904_1627'),
]
operations = ... | Add migration for le-utils update. | Add migration for le-utils update.
| Python | mit | DXCanas/content-curation,DXCanas/content-curation,DXCanas/content-curation,DXCanas/content-curation | ---
+++
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.20 on 2019-09-05 04:08
+from __future__ import unicode_literals
+
+from django.db import migrations
+from django.db import models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('contentcuration', '0102_auto_20... | |
0bd2d9c3bcbb1471208d2d05a6fb50137d6ad89b | sli/config/scripts/index-misses.py | sli/config/scripts/index-misses.py | # use sli
# db.system.profile.drop()
# db.createCollection("system.profile", {capped:true, size:1024000000});
# db.setProfilingLevel(2)
#
# mongodump --db sli --collection system.profile
# bsondump dump/sli/system.profile.bson > system.profile.json
# python index-misses.py system.profile.json
import sys
import json
im... | Add script to analyze mongo profile and determine index misses. | Add script to analyze mongo profile and determine index misses.
| Python | apache-2.0 | inbloom/secure-data-service,inbloom/secure-data-service,inbloom/secure-data-service,inbloom/secure-data-service,inbloom/secure-data-service | ---
+++
@@ -0,0 +1,43 @@
+# use sli
+# db.system.profile.drop()
+# db.createCollection("system.profile", {capped:true, size:1024000000});
+# db.setProfilingLevel(2)
+#
+# mongodump --db sli --collection system.profile
+# bsondump dump/sli/system.profile.bson > system.profile.json
+# python index-misses.py system.prof... | |
2c83148a2de978382875e6b474c0b3d899a7c5dc | swift/__init__.py | swift/__init__.py | import gettext
class Version(object):
def __init__(self, canonical_version, final):
self.canonical_version = canonical_version
self.final = final
@property
def pretty_version(self):
if self.final:
return self.canonical_version
else:
return '%s-dev' ... | import gettext
class Version(object):
def __init__(self, canonical_version, final):
self.canonical_version = canonical_version
self.final = final
@property
def pretty_version(self):
if self.final:
return self.canonical_version
else:
return '%s-dev' ... | Switch trunk to 1.4.3 development | Switch trunk to 1.4.3 development | Python | apache-2.0 | mja054/swift_plugin,clayg/swift,notmyname/swift,clayg/swift,thiagodasilva/swift,Triv90/SwiftUml,aerwin3/swift,nadeemsyed/swift,Khushbu27/Tutorial,nadeemsyed/swift,tsli/test,ceph/swift,notmyname/swift,dpgoetz/swift,revoer/keystone-8.0.0,revoer/keystone-8.0.0,eatbyte/Swift,aerwin3/swift,SUSE/swift,tsli/test,thiagodasilva... | ---
+++
@@ -14,7 +14,7 @@
return '%s-dev' % (self.canonical_version,)
-_version = Version('1.4.2', False)
+_version = Version('1.4.3', False)
__version__ = _version.pretty_version
__canonical_version__ = _version.canonical_version
|
7930fd15a3077764be4b7f1ab7953dba1a97905e | event/example/linkevent.py | event/example/linkevent.py | #! /usr/local/bin/python
import sys
import time
sys.path.append("/usr/testbed/lib")
from tbevent import *
server = "event-server"
port = None
keyfile = "/proj/emulab-ops/exp/one-node/tbdata/eventkey"
# Construct a regular client. Do this only once.
ec = EventClient(server=server, port=port, url=None, keyfile... | Add an example of sending a link event written in python. | Add an example of sending a link event written in python.
| Python | agpl-3.0 | nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome | ---
+++
@@ -0,0 +1,40 @@
+#! /usr/local/bin/python
+
+import sys
+import time
+sys.path.append("/usr/testbed/lib")
+
+from tbevent import *
+
+server = "event-server"
+port = None
+keyfile = "/proj/emulab-ops/exp/one-node/tbdata/eventkey"
+
+# Construct a regular client. Do this only once.
+ec = EventClient(se... | |
90d4128a13029ca56901e901d381d6fadfd376f5 | tools/json2csv.py | tools/json2csv.py | #!/usr/bin/env python
from pathlib import Path
from collections import defaultdict
import json
import numpy as np
import pandas as pd
def get_parser():
"""Build parser object"""
from argparse import ArgumentParser
from argparse import RawTextHelpFormatter
parser = ArgumentParser(description='MRIQ... | Add a script to generate csv files | [ENH] Add a script to generate csv files
First, convert bson to json using mongodb's tool. Second, use this
script to generate csv tables.
| Python | apache-2.0 | poldracklab/mriqcwebapi | ---
+++
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+from pathlib import Path
+from collections import defaultdict
+import json
+
+import numpy as np
+import pandas as pd
+
+def get_parser():
+ """Build parser object"""
+ from argparse import ArgumentParser
+ from argparse import RawTextHelpFormatter
+
+ ... | |
54551601b9b89e41760110dbf6351f94db633f95 | startup/GafferOSL/oslHideShaders.py | startup/GafferOSL/oslHideShaders.py | ##########################################################################
#
# Copyright (c) 2019, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | Hide deprecated shaders used by old OSLObject | Hide deprecated shaders used by old OSLObject
| Python | bsd-3-clause | hradec/gaffer,hradec/gaffer,GafferHQ/gaffer,appleseedhq/gaffer,johnhaddon/gaffer,boberfly/gaffer,johnhaddon/gaffer,andrewkaufman/gaffer,hradec/gaffer,GafferHQ/gaffer,andrewkaufman/gaffer,lucienfostier/gaffer,ImageEngine/gaffer,appleseedhq/gaffer,lucienfostier/gaffer,hradec/gaffer,lucienfostier/gaffer,andrewkaufman/gaff... | ---
+++
@@ -0,0 +1,42 @@
+##########################################################################
+#
+# Copyright (c) 2019, Image Engine Design Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions... | |
ca08020793926adad524ddab6ccb5dee8d3e2cc5 | tw-cover-comp.py | tw-cover-comp.py | #!/usr/bin/env python3
import sys
from PIL import Image
COVER_HEIGHT = 480
BORDER_WIDTH = 10
BACKGROUND_COLOR = (39, 46, 111, 0)
def gather_covers(input_files):
'''Given a list of files, return a list of resized RGB images'''
result = []
for input_file in sys.argv[1:]:
img = Image.open(input_f... | Add script to create cover composite images for Twitter posts | Add script to create cover composite images for Twitter posts
| Python | mit | Backlist/backlist-workflows | ---
+++
@@ -0,0 +1,71 @@
+#!/usr/bin/env python3
+
+import sys
+
+from PIL import Image
+
+COVER_HEIGHT = 480
+BORDER_WIDTH = 10
+BACKGROUND_COLOR = (39, 46, 111, 0)
+
+
+def gather_covers(input_files):
+ '''Given a list of files, return a list of resized RGB images'''
+ result = []
+
+ for input_file in sys... | |
082f515391f116728c892389d594521520fe2f1a | firecares/firestation/migrations/0014_auto_20150901_1052.py | firecares/firestation/migrations/0014_auto_20150901_1052.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('firestation', '0013_populationclass0quartile_populationclass1quartile_populationclass2quartile_populationclass3... | Add migration to fix misspelling in verbose name. | Add migration to fix misspelling in verbose name.
| Python | mit | HunterConnelly/firecares,garnertb/firecares,garnertb/firecares,ROGUE-JCTD/vida,meilinger/firecares,ROGUE-JCTD/vida,ROGUE-JCTD/vida,meilinger/firecares,FireCARES/firecares,ROGUE-JCTD/vida,garnertb/firecares,ROGUE-JCTD/vida,HunterConnelly/firecares,HunterConnelly/firecares,FireCARES/firecares,FireCARES/firecares,meilinge... | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import django.core.validators
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('firestation', '0013_populationclass0quartile_populationclass1quartile_pop... | |
c35bee6ee578dd2bdd2673887eaac81d4c5c87c0 | jsonmat2h5.py | jsonmat2h5.py | import json
import h5py
import numpy as np
import scipy.io
jdata = json.load(open("flickr8k/dataset.json"))
features_struct = scipy.io.loadmat('flickr8k/vgg_feats.mat')['feats']
h5output = h5py.File("flickr8k.h5", "w")
# The HDF5 file will contain a top-level group for each split
train = h5output.create_group("train... | Convert a JSON dataset file and a MATLAB visual features file into a single H5 file. | Convert a JSON dataset file and a MATLAB visual features file into a single H5 file.
| Python | bsd-3-clause | elliottd/GroundedTranslation,elliottd/GroundedTranslation,elliottd/GroundedTranslation | ---
+++
@@ -0,0 +1,55 @@
+import json
+import h5py
+import numpy as np
+import scipy.io
+
+jdata = json.load(open("flickr8k/dataset.json"))
+features_struct = scipy.io.loadmat('flickr8k/vgg_feats.mat')['feats']
+
+h5output = h5py.File("flickr8k.h5", "w")
+
+# The HDF5 file will contain a top-level group for each spli... | |
0f174aac0b8fc99e7c7666f4a2958ae048ef62cb | py/maximum-length-of-pair-chain.py | py/maximum-length-of-pair-chain.py | class Solution(object):
def findLongestChain(self, pairs):
"""
:type pairs: List[List[int]]
:rtype: int
"""
pairs.sort()
LIS = []
for p in pairs:
L, U = -1, len(LIS)
while L + 1 < U:
mid = (L + U) / 2
if ... | Add py solution for 646. Maximum Length of Pair Chain | Add py solution for 646. Maximum Length of Pair Chain
646. Maximum Length of Pair Chain: https://leetcode.com/problems/maximum-length-of-pair-chain/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,21 @@
+class Solution(object):
+ def findLongestChain(self, pairs):
+ """
+ :type pairs: List[List[int]]
+ :rtype: int
+ """
+ pairs.sort()
+ LIS = []
+ for p in pairs:
+ L, U = -1, len(LIS)
+ while L + 1 < U:
+ ... | |
6dd32078aa461488872745bcbc7c43cd3988ed53 | tests/api/benchmark/test_order.py | tests/api/benchmark/test_order.py | import pytest
from tests.api.utils import get_graphql_content
@pytest.mark.django_db
@pytest.mark.count_queries(autouse=False)
def test_user_order_details(user_api_client, order_with_lines, count_queries):
query = """
fragment OrderPrice on TaxedMoney {
gross {
amount
cu... | Add test for order history view | Add test for order history view
| Python | bsd-3-clause | mociepka/saleor,mociepka/saleor,mociepka/saleor | ---
+++
@@ -0,0 +1,118 @@
+import pytest
+
+from tests.api.utils import get_graphql_content
+
+
+@pytest.mark.django_db
+@pytest.mark.count_queries(autouse=False)
+def test_user_order_details(user_api_client, order_with_lines, count_queries):
+ query = """
+ fragment OrderPrice on TaxedMoney {
+ gr... | |
d009c998007fe3bd4a8d3134499e3fde99513381 | pyimgaug/test2.py | pyimgaug/test2.py | from __future__ import print_function, division
import augmenters2 as iaa
import parameters as iap
#from skimage import
import numpy as np
import time
def main():
seq = iaa.Sequence([iaa.Fliplr(0.5), iaa.Flipud(0.5)])
imgs = np.zeros((1, 2, 2, 1), dtype=np.uint8)
imgs[0, 0, :, 0] = 255
imgs[0, 1, 1, 0]... | Refactor tests for current version | Refactor tests for current version
| Python | mit | aleju/ImageAugmenter,nektor211/imgaug,aleju/imgaug,aleju/imgaug | ---
+++
@@ -0,0 +1,57 @@
+from __future__ import print_function, division
+import augmenters2 as iaa
+import parameters as iap
+#from skimage import
+import numpy as np
+import time
+
+def main():
+ seq = iaa.Sequence([iaa.Fliplr(0.5), iaa.Flipud(0.5)])
+ imgs = np.zeros((1, 2, 2, 1), dtype=np.uint8)
+ imgs[... | |
fff7b3bd57fe94d7ac450da89d9a241ddc5c2f06 | ipmi_syncexample.py | ipmi_syncexample.py | #!/usr/bin/env python
from ipmi_command import ipmi_command
import os
import sys
password=os.environ['IPMIPASSWORD']
os.environ['IPMIPASSWORD']=""
if (len(sys.argv) < 3):
print "Usage:"
print " IPMIPASSWORD=password %s bmc username <cmd> <optarg>"%sys.argv[0]
sys.exit(1)
bmc=sys.argv[1]
userid=sys.argv[2]
c... | Add an example chunk of code showing how to code in a synchronous way to the python library | Add an example chunk of code showing how to code in a synchronous way to the python library
| Python | apache-2.0 | stackforge/pyghmi,benoit-canet/pyghmi,openstack/pyghmi,openstack/pyghmi | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+from ipmi_command import ipmi_command
+import os
+import sys
+password=os.environ['IPMIPASSWORD']
+os.environ['IPMIPASSWORD']=""
+if (len(sys.argv) < 3):
+ print "Usage:"
+ print " IPMIPASSWORD=password %s bmc username <cmd> <optarg>"%sys.argv[0]
+ sys.exit(1)... | |
59da29fac5e232fce0d4bf15704c976175527750 | src/users/migrations/0010_cocrecord.py | src/users/migrations/0010_cocrecord.py | # Generated by Django 3.0.2 on 2020-02-23 12:28
import core.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('users', '0009_auto_20160227_1656'),
]
operations = [
mi... | Add migration file for the model of CoC record | Add migration file for the model of CoC record
| Python | mit | pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016 | ---
+++
@@ -0,0 +1,24 @@
+# Generated by Django 3.0.2 on 2020-02-23 12:28
+
+import core.models
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('users', '0009_auto_20160227_1656'... | |
18327e959a2e6c5cadbe63a7071bba8df478276a | tests/startsymbol_tests/SettingTest.py | tests/startsymbol_tests/SettingTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 10.08.2017 23:00
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase, main
from grammpy import *
class SettingTest(TestCase):
pass
if __name__ == '__main__':
main()
| Add file fot test of start symbol setting | Add file fot test of start symbol setting
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 10.08.2017 23:00
+:Licence GNUv3
+Part of grammpy
+
+"""
+
+from unittest import TestCase, main
+from grammpy import *
+
+
+class SettingTest(TestCase):
+ pass
+
+
+if __name__ == '__main__':
+ main() | |
f771a1fa3bc7cdaeb2ef5e09d3a01701b166a009 | atoman/filtering/filters/tests/test_species.py | atoman/filtering/filters/tests/test_species.py |
"""
Unit tests for the species filter
"""
import unittest
import numpy as np
from ....system import lattice
from .. import speciesFilter
from .. import base
################################################################################
class TestSpeciesFilter(unittest.TestCase):
"""
Test species filter... | Add test for species filter. | Add test for species filter.
| Python | mit | chrisdjscott/Atoman,chrisdjscott/Atoman,chrisdjscott/Atoman,chrisdjscott/Atoman,chrisdjscott/Atoman | ---
+++
@@ -0,0 +1,94 @@
+
+"""
+Unit tests for the species filter
+
+"""
+import unittest
+
+import numpy as np
+
+from ....system import lattice
+from .. import speciesFilter
+from .. import base
+
+
+################################################################################
+
+class TestSpeciesFilter(unittes... | |
875ef1e4b07944b9f18d65253d1a7380bb8023e1 | jsonify.py | jsonify.py | """Convert files to json."""
def to_json(file):
"""Convert ini to JSON like thing."""
ini = open(file, 'r')
ini = ini.readlines()
settings_file = open('settings.json', 'w')
settings_file.write("{")
# import pdb; pdb.set_trace()
for line in ini:
if '[' == line[0]:
settin... | Add josnify file. Correct format, needs tweaks | Add josnify file. Correct format, needs tweaks
| Python | mpl-2.0 | flegald/Gameini,flegald/Gameini,flegald/Gameini | ---
+++
@@ -0,0 +1,20 @@
+"""Convert files to json."""
+
+
+def to_json(file):
+ """Convert ini to JSON like thing."""
+ ini = open(file, 'r')
+ ini = ini.readlines()
+ settings_file = open('settings.json', 'w')
+ settings_file.write("{")
+ # import pdb; pdb.set_trace()
+ for line in ini:
+ ... | |
d0a7b697ab1517e071c70d5904f96f85fe12ac89 | mainapp/management/commands/repair-file-index.py | mainapp/management/commands/repair-file-index.py | from typing import Set
from django.core.management.base import BaseCommand
from mainapp.functions.minio import minio_client, minio_file_bucket
from mainapp.models import File
class Command(BaseCommand):
help = "Marks files as missing in the database that are deleted in minio"
def handle(self, *args, **opti... | Add command to repair the file index | Add command to repair the file index
| Python | mit | meine-stadt-transparent/meine-stadt-transparent,meine-stadt-transparent/meine-stadt-transparent,meine-stadt-transparent/meine-stadt-transparent,meine-stadt-transparent/meine-stadt-transparent | ---
+++
@@ -0,0 +1,25 @@
+from typing import Set
+
+from django.core.management.base import BaseCommand
+
+from mainapp.functions.minio import minio_client, minio_file_bucket
+from mainapp.models import File
+
+
+class Command(BaseCommand):
+ help = "Marks files as missing in the database that are deleted in minio... | |
e561c1354d2f9a550f2b27bb88d8e4d0f3f76203 | common/djangoapps/student/management/commands/recover_truncated_anonymous_ids.py | common/djangoapps/student/management/commands/recover_truncated_anonymous_ids.py | """
Generate sql commands to fix truncated anonymous student ids in the ORA database
"""
import sys
from django.core.management.base import NoArgsCommand
from student.models import AnonymousUserId, anonymous_id_for_user
class Command(NoArgsCommand):
help = __doc__
def handle_noargs(self, **options):
... | Add managemant command to generate sql to clean up tp truncated student ids in ORA db | Add managemant command to generate sql to clean up tp truncated student ids in ORA db
| Python | agpl-3.0 | openfun/edx-platform,synergeticsedx/deployment-wipro,shashank971/edx-platform,bigdatauniversity/edx-platform,shabab12/edx-platform,philanthropy-u/edx-platform,openfun/edx-platform,motion2015/edx-platform,ubc/edx-platform,jolyonb/edx-platform,cognitiveclass/edx-platform,ferabra/edx-platform,jswope00/griffinx,proversity-... | ---
+++
@@ -0,0 +1,69 @@
+"""
+Generate sql commands to fix truncated anonymous student ids in the ORA database
+"""
+import sys
+
+from django.core.management.base import NoArgsCommand
+
+from student.models import AnonymousUserId, anonymous_id_for_user
+
+
+class Command(NoArgsCommand):
+ help = __doc__
+
+ d... | |
be8b7c89160f4aa8b0415f673629cd80d97a13f0 | robCRSdkt.py | robCRSdkt.py | import numpy as np
def robCRSdkt(robot, pos):
T = np.eye(4)
pos = np.array(pos) / 180.0 * np.pi
for i in range(6):
tz = np.eye(4)
tz[2,3] = robot.d[i]
rz = np.eye(4)
o = -robot.offset[i]
rz[:2, :2] = np.array([[np.cos(o+pos[i]), -np.sin(o+pos[i])],
... | Create direct kinematic function for CRS robot. | Create direct kinematic function for CRS robot.
| Python | mit | petroolg/robo-spline | ---
+++
@@ -0,0 +1,27 @@
+import numpy as np
+
+def robCRSdkt(robot, pos):
+ T = np.eye(4)
+ pos = np.array(pos) / 180.0 * np.pi
+
+ for i in range(6):
+ tz = np.eye(4)
+ tz[2,3] = robot.d[i]
+ rz = np.eye(4)
+ o = -robot.offset[i]
+ rz[:2, :2] = np.array([[np.cos(o+pos[i])... | |
3443496bac4b313b1d4603086eb434459a092238 | tools/convertPunchCardToToml.py | tools/convertPunchCardToToml.py | import argparse
def parseDay(weekDay, sunday):
daysOfTheWeek = {'S': 'saturday', 'S2': 'sunday', 'M': 'monday', 'T': 'tuesday',
'W': 'wednesday', 'R': 'thursday', 'F': 'friday'}
splitDay = weekDay.split(',')
if sunday:
day = 'S2'
splitDay.pop(0)
else:
day... | Create tools directory and add convert tool | Create tools directory and add convert tool
| Python | mit | NLSteveO/PunchCard,NLSteveO/PunchCard | ---
+++
@@ -0,0 +1,65 @@
+import argparse
+
+
+def parseDay(weekDay, sunday):
+ daysOfTheWeek = {'S': 'saturday', 'S2': 'sunday', 'M': 'monday', 'T': 'tuesday',
+ 'W': 'wednesday', 'R': 'thursday', 'F': 'friday'}
+
+ splitDay = weekDay.split(',')
+
+ if sunday:
+ day = 'S2'
+ ... | |
5d0738f256339844acfb633e3c4277f6ea17ac30 | cleaning_scripts/remove_leading_slashes_212.py | cleaning_scripts/remove_leading_slashes_212.py | # This software and any associated files are copyright 2010 Brian Carver and
# Michael Lissner.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | Fix script for cases with leading slashes. | Fix script for cases with leading slashes.
| Python | agpl-3.0 | brianwc/courtlistener,wmbutler/courtlistener,Andr3iC/courtlistener,voutilad/courtlistener,brianwc/courtlistener,wmbutler/courtlistener,brianwc/courtlistener,Andr3iC/courtlistener,shashi792/courtlistener,wmbutler/courtlistener,wmbutler/courtlistener,shashi792/courtlistener,wmbutler/courtlistener,voutilad/courtlistener,A... | ---
+++
@@ -0,0 +1,77 @@
+# This software and any associated files are copyright 2010 Brian Carver and
+# Michael Lissner.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either v... | |
4eeab8ad7c1d4cdbda68222f94b23a62337570c6 | pywikibot/families/commons_family.py | pywikibot/families/commons_family.py | # -*- coding: utf-8 -*-
__version__ = '$Id$'
from pywikibot import family
# The Wikimedia Commons family
class Family(family.WikimediaFamily):
def __init__(self):
super(Family, self).__init__()
self.name = 'commons'
self.langs = {
'commons': 'commons.wikimedia.org',
... | # -*- coding: utf-8 -*-
__version__ = '$Id$'
from pywikibot import family
# The Wikimedia Commons family
class Family(family.WikimediaFamily):
def __init__(self):
super(Family, self).__init__()
self.name = 'commons'
self.langs = {
'commons': 'commons.wikimedia.org',
... | Add Wikidata as shared data repository for Commons. | Add Wikidata as shared data repository for Commons.
Change-Id: Ie79e3157d016fc74e400ddc618c04f2d1d39f17d
| Python | mit | TridevGuha/pywikibot-core,darthbhyrava/pywikibot-local,xZise/pywikibot-core,wikimedia/pywikibot-core,hasteur/g13bot_tools_new,Darkdadaah/pywikibot-core,hasteur/g13bot_tools_new,happy5214/pywikibot-core,magul/pywikibot-core,wikimedia/pywikibot-core,PersianWikipedia/pywikibot-core,npdoty/pywikibot,trishnaguha/pywikibot-c... | ---
+++
@@ -38,3 +38,6 @@
def ssl_pathprefix(self, code):
return "/wikipedia/commons"
+
+ def shared_data_repository(self, code, transcluded=False):
+ return ('wikidata', 'wikidata') |
47699ec789c4a8cf47d07a9ea2955bf220c14e69 | tests/test_vector2_substraction.py | tests/test_vector2_substraction.py | import pytest
from ppb_vector import Vector2
def test_substraction_vectors():
test_vector1 = Vector2(0, 1)
test_vector2 = Vector2(0, 1)
result = test_vector1 - test_vector2
assert result == Vector2(0, 0)
def test_substraction_vector_tuple():
test_vector = Vector2(4, 6)
test_tuple = (1, 1)
... | Add vector2 substraction unit tests | Add vector2 substraction unit tests
| Python | artistic-2.0 | ppb/ppb-vector,ppb/ppb-vector | ---
+++
@@ -0,0 +1,48 @@
+import pytest
+from ppb_vector import Vector2
+
+
+def test_substraction_vectors():
+ test_vector1 = Vector2(0, 1)
+ test_vector2 = Vector2(0, 1)
+ result = test_vector1 - test_vector2
+ assert result == Vector2(0, 0)
+
+
+def test_substraction_vector_tuple():
+ test_vector = ... | |
3ec5c0a742054177be525182f42b69d48f837aff | rache/utils.py | rache/utils.py | import os
try:
from urllib import parse
except ImportError:
import urlparse as parse
def parse_redis_url():
config = {
'host': 'localhost',
'port': 6379,
'password': None,
'db': 0,
}
parsed_redis = parse.urlparse(
os.environ.get('REDIS_URL', 'redis://localh... | import os
try:
from urllib import parse
except ImportError:
import urlparse as parse
def parse_redis_url():
config = {
'host': 'localhost',
'port': 6379,
'password': None,
'db': 0,
}
parsed_redis = parse.urlparse(
os.environ.get('REDIS_URL', 'redis://localh... | Support unix sockets in the Redis URL parser. | Support unix sockets in the Redis URL parser.
| Python | bsd-3-clause | brutasse/rache | ---
+++
@@ -20,17 +20,28 @@
path, q, querystring = parsed_redis.path.partition('?')
else:
path, q, querystring = parsed_redis.path, None, parsed_redis.query
- if path[1:]:
- config['db'] = int(path[1:])
- querystring = parse.parse_qs(querystring)
- for key in querystring.keys():... |
cf3b675913e584f0a3dd54fceb6d14ff85bbbad4 | tools/sofa-edr.py | tools/sofa-edr.py | #!/usr/bin/env python3
import subprocess
import time
import argparse
if __name__ == '__main__':
bwa_is_recorded = False
smb_is_recorded = False
htvc_is_recorded = False
parser = argparse.ArgumentParser(description='A SOFA wrapper which supports event-driven recording.')
parser.add_argument('--trac... | Add an event-driven recording tool | Add an event-driven recording tool
| Python | apache-2.0 | cyliustack/sofa,cyliustack/sofa,cyliustack/sofa,cyliustack/sofa,cyliustack/sofa | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python3
+import subprocess
+import time
+import argparse
+
+if __name__ == '__main__':
+ bwa_is_recorded = False
+ smb_is_recorded = False
+ htvc_is_recorded = False
+
+ parser = argparse.ArgumentParser(description='A SOFA wrapper which supports event-driven record... | |
7482de022b8876df8d8c49f2cb4586496ec4549e | yatsm/regression/numba_accel.py | yatsm/regression/numba_accel.py | """ Regression related functions optimized using Numba, if available
If Numba is not avaiable, functions are still usable as not JIT'd functions
"""
# @nb.jit()
def rmse(y, yhat):
""" Calculate and return Root Mean Squared Error (RMSE)
Args:
y (np.ndarray): known values
yhat (np.ndarray): pr... | Add faster RMSE via numba | Add faster RMSE via numba
| Python | mit | ceholden/yatsm,c11/yatsm,valpasq/yatsm,c11/yatsm,ceholden/yatsm,valpasq/yatsm | ---
+++
@@ -0,0 +1,27 @@
+""" Regression related functions optimized using Numba, if available
+
+If Numba is not avaiable, functions are still usable as not JIT'd functions
+"""
+
+
+# @nb.jit()
+def rmse(y, yhat):
+ """ Calculate and return Root Mean Squared Error (RMSE)
+
+ Args:
+ y (np.ndarray): kno... | |
6cf9f9c83861e7e32f9ce90f2c35b5b73aa7fb10 | manila/db/sqlalchemy/migrate_repo/versions/010_change_project_user_quotas_deleted_column_type.py | manila/db/sqlalchemy/migrate_repo/versions/010_change_project_user_quotas_deleted_column_type.py | # Copyright 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | Change 'deleted' to Boolean in project_user_quotas | Change 'deleted' to Boolean in project_user_quotas
Change-Id: I7604ba4b938d5ff73bcf3b1f9152cc6aa4f1c0c8
Closes-Bug: #1274165
| Python | apache-2.0 | sajuptpm/manila,NetApp/manila,jcsp/manila,scality/manila,jcsp/manila,openstack/manila,NetApp/manila,weiting-chen/manila,weiting-chen/manila,vponomaryov/manila,vponomaryov/manila,bswartz/manila,bswartz/manila,redhat-openstack/manila,openstack/manila,sajuptpm/manila,redhat-openstack/manila,scality/manila | ---
+++
@@ -0,0 +1,44 @@
+# Copyright 2013 Mirantis Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unles... | |
99dd76aadea730c2b33fcaa435a0e3b6a0f67567 | IntegrationTestPreprocessingdMRI.py | IntegrationTestPreprocessingdMRI.py | # -*- coding: utf-8 -*-
import unittest
from os.path import expanduser, join, isdir
import numpy as np
from dipy.data.fetcher import fetch_scil_b0, read_siemens_scil_b0
from createBrainMask import createBrainMaskFromb0Data
class IntegrationTestPreprocessingdMRI(unittest.TestCase):
dataDirectory = None
def ... | Test that brain mask has plausible volume | Test that brain mask has plausible volume
| Python | bsd-3-clause | jsjol/GaussianProcessRegressionForDiffusionMRI,jsjol/GaussianProcessRegressionForDiffusionMRI | ---
+++
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+
+
+import unittest
+from os.path import expanduser, join, isdir
+import numpy as np
+from dipy.data.fetcher import fetch_scil_b0, read_siemens_scil_b0
+from createBrainMask import createBrainMaskFromb0Data
+
+
+class IntegrationTestPreprocessingdMRI(unittest.TestCas... | |
e5a269ab0eaea3052c76764c844233d06a10b422 | IPython/core/tests/test_callbacks.py | IPython/core/tests/test_callbacks.py | import unittest
try: # Python 3.3 +
from unittest.mock import Mock
except ImportError:
from mock import Mock
from IPython.core import callbacks
import IPython.testing.tools as tt
def ping_received():
pass
class CallbackTests(unittest.TestCase):
def setUp(self):
self.cbm = callbacks.CallbackM... | Add tests for callback infrastructure | Add tests for callback infrastructure
| Python | bsd-3-clause | ipython/ipython,ipython/ipython | ---
+++
@@ -0,0 +1,46 @@
+import unittest
+try: # Python 3.3 +
+ from unittest.mock import Mock
+except ImportError:
+ from mock import Mock
+
+from IPython.core import callbacks
+import IPython.testing.tools as tt
+
+def ping_received():
+ pass
+
+class CallbackTests(unittest.TestCase):
+ def setUp(self... | |
f5849aeb1c811c8f244b2ec1db3750bc8beea441 | bin/isbn_format.py | bin/isbn_format.py | #!/usr/bin/env python
import sys
import os
import yaml
import isbnlib
metafile = sys.argv[1]
metadata = open(metafile, 'r').read()
yamldata = yaml.load(metadata)
identifier = {}
for id in yamldata["identifier"]:
if "key" in id:
isbnlike = isbnlib.get_isbnlike(id["text"])[0]
if isbnlib.is_isbn13(... | Add python scipt for parsing meta data and extracting validated ISBNs | Add python scipt for parsing meta data and extracting validated ISBNs
| Python | agpl-3.0 | alerque/casile,alerque/casile,alerque/casile,alerque/casile,alerque/casile | ---
+++
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+import sys
+import os
+import yaml
+import isbnlib
+
+metafile = sys.argv[1]
+metadata = open(metafile, 'r').read()
+yamldata = yaml.load(metadata)
+
+identifier = {}
+
+for id in yamldata["identifier"]:
+ if "key" in id:
+ isbnlike = isbnlib.get_isbnlike(i... | |
6e425814bf24eb2f7e0d2ba6d3cce109426904f8 | analytics/tests/test_fixtures.py | analytics/tests/test_fixtures.py | from zerver.lib.test_classes import ZulipTestCase
from analytics.lib.counts import CountStat
from analytics.lib.fixtures import generate_time_series_data
# A very light test suite; the code being tested is not run in production.
class TestFixtures(ZulipTestCase):
def test_deterministic_settings(self):
# t... | Add a few tests for fixtures.py. | analytics: Add a few tests for fixtures.py.
The code in fixtures.py is only called from populate_analytics_db, and is
only used for generating pretty fixture data for manual testing. This commit
adds tests for a few things that were easy to add tests for, and provides
some minimal coverage of the file, but is not mean... | Python | apache-2.0 | rishig/zulip,showell/zulip,ryanbackman/zulip,mahim97/zulip,mahim97/zulip,timabbott/zulip,amanharitsh123/zulip,rht/zulip,shubhamdhama/zulip,jackrzhang/zulip,vabs22/zulip,brockwhittaker/zulip,zulip/zulip,punchagan/zulip,tommyip/zulip,vaidap/zulip,brainwane/zulip,timabbott/zulip,punchagan/zulip,andersk/zulip,eeshangarg/zu... | ---
+++
@@ -0,0 +1,31 @@
+from zerver.lib.test_classes import ZulipTestCase
+
+from analytics.lib.counts import CountStat
+from analytics.lib.fixtures import generate_time_series_data
+
+# A very light test suite; the code being tested is not run in production.
+class TestFixtures(ZulipTestCase):
+ def test_determ... | |
7a97694d14e9ed02ae38ab713267d4c722079c9c | kolibri/core/webpack/test/test_webpack_tags.py | kolibri/core/webpack/test/test_webpack_tags.py | from __future__ import absolute_import, print_function, unicode_literals
from django.test import TestCase
from ..hooks import WebpackBundleHook
class TestHook(WebpackBundleHook):
unique_slug = "non_default_frontend"
entry_file = "assets/src/kolibri_core_app.js"
class KolibriTagNavigationTestCase(TestCase)... | from __future__ import absolute_import, print_function, unicode_literals
import json
import tempfile
from django.test import TestCase
from ..hooks import WebpackBundleHook
TEST_STATS_FILE = None
class TestHook(WebpackBundleHook):
unique_slug = "non_default_frontend"
src_file = "assets/src/kolibri_core_a... | Create a faked hook that does not try to read a live stats file | Create a faked hook that does not try to read a live stats file
| Python | mit | jonboiser/kolibri,jtamiace/kolibri,66eli77/kolibri,66eli77/kolibri,mrpau/kolibri,rtibbles/kolibri,learningequality/kolibri,lyw07/kolibri,jtamiace/kolibri,jtamiace/kolibri,mrpau/kolibri,ralphiee22/kolibri,jayoshih/kolibri,learningequality/kolibri,DXCanas/kolibri,jonboiser/kolibri,benjaoming/kolibri,christianmemije/kolib... | ---
+++
@@ -1,19 +1,53 @@
from __future__ import absolute_import, print_function, unicode_literals
+
+import json
+import tempfile
+
from django.test import TestCase
from ..hooks import WebpackBundleHook
+TEST_STATS_FILE = None
+
+
class TestHook(WebpackBundleHook):
unique_slug = "non_default_fronten... |
a9595cff570efe78228d02c9dd05f7b10ccd30f7 | Python/demos/d11_PostProcessing.py | Python/demos/d11_PostProcessing.py | #%% Demo 11: Postprocessing
#
# This demo demonstrates the available postprocessing tools in TIGRE.by calling the "Measure_Quality.m" function with detailed description.
#
#
#--------------------------------------------------------------------------
#--------------------------------------------------------------------... | Add structure of demo 11 | Add structure of demo 11
| Python | bsd-3-clause | CERN/TIGRE,CERN/TIGRE,CERN/TIGRE,CERN/TIGRE | ---
+++
@@ -0,0 +1,48 @@
+#%% Demo 11: Postprocessing
+#
+# This demo demonstrates the available postprocessing tools in TIGRE.by calling the "Measure_Quality.m" function with detailed description.
+#
+#
+#--------------------------------------------------------------------------
+#----------------------------------... | |
8d4e705cec2592f9e5f3fa14b8a7ca9610a1f5cc | services/netflix.py | services/netflix.py | import foauth.providers
class Netflix(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'https://www.netflix.com/'
docs_url = 'http://developer.netflix.com/docs'
# URLs to interact with the API
request_token_url = 'http://api.netflix.com/oauth/request_token'
authorize... | Add Netflix back in ... maybe | Add Netflix back in ... maybe
| Python | bsd-3-clause | foauth/foauth.org,foauth/foauth.org,foauth/oauth-proxy,foauth/foauth.org | ---
+++
@@ -0,0 +1,17 @@
+import foauth.providers
+
+
+class Netflix(foauth.providers.OAuth1):
+ # General info about the provider
+ provider_url = 'https://www.netflix.com/'
+ docs_url = 'http://developer.netflix.com/docs'
+
+ # URLs to interact with the API
+ request_token_url = 'http://api.netflix.c... | |
d289f8ef30bf1657c8570252ac2361fade5c43ac | package/dataset.py | package/dataset.py | __author__ = 'luigolas'
from package.image_set import ImageSet
import re
# import numpy as np
# import package.image as image
# import package.evaluator as evaluator
# import itertools
# import cv2
class Dataset():
def __init__(self):
self.id_regex = "P[1-6]_[0-9]{3}"
self.probe = None
s... | Add basic Dataset. No ImgSet nor Preposcessing | Add basic Dataset. No ImgSet nor Preposcessing
| Python | mit | Luigolas/PyReID | ---
+++
@@ -0,0 +1,80 @@
+__author__ = 'luigolas'
+
+
+from package.image_set import ImageSet
+import re
+# import numpy as np
+# import package.image as image
+# import package.evaluator as evaluator
+# import itertools
+# import cv2
+
+
+class Dataset():
+ def __init__(self):
+ self.id_regex = "P[1-6]_[0-... | |
f3c30f2ef57411c466dfed0718873939e6bd3174 | ceph_deploy/tests/parser/test_mon.py | ceph_deploy/tests/parser/test_mon.py | import pytest
from ceph_deploy.cli import get_parser
SUBCMDS_WITH_ARGS = ['add', 'destroy']
SUBCMDS_WITHOUT_ARGS = ['create', 'create-initial']
class TestParserMON(object):
def setup(self):
self.parser = get_parser()
def test_mon_help(self, capsys):
with pytest.raises(SystemExit):
... | Add tests to for mon, mon create-initial | [RM-11742] Add tests to for mon, mon create-initial
Signed-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>
| Python | mit | codenrhoden/ceph-deploy,ceph/ceph-deploy,codenrhoden/ceph-deploy,imzhulei/ceph-deploy,branto1/ceph-deploy,SUSE/ceph-deploy,SUSE/ceph-deploy,osynge/ceph-deploy,osynge/ceph-deploy,trhoden/ceph-deploy,zhouyuan/ceph-deploy,SUSE/ceph-deploy-to-be-deleted,branto1/ceph-deploy,ghxandsky/ceph-deploy,ceph/ceph-deploy,isyippee/ce... | ---
+++
@@ -0,0 +1,59 @@
+import pytest
+
+from ceph_deploy.cli import get_parser
+
+SUBCMDS_WITH_ARGS = ['add', 'destroy']
+SUBCMDS_WITHOUT_ARGS = ['create', 'create-initial']
+
+
+class TestParserMON(object):
+
+ def setup(self):
+ self.parser = get_parser()
+
+ def test_mon_help(self, capsys):
+ ... | |
95bfc900e0ed45cb8cab6649def194dee2d694e3 | solarnmf_main_ts.py | solarnmf_main_ts.py | #solarnmf_main_ts.py
#Will Barnes
#31 March 2015
#Import needed modules
import solarnmf_functs as snf
import solarnmf_plot_routines as spr
#Read in and format the time series
results = snf.make_t_matrix("data",filename='/home/wtb2/Desktop/gaussian_test.dat')
#Get the dimensions of the T matrix
ny,nx = results['T'].... | Add main function to start needed functions for a time series run | Add main function to start needed functions for a time series run
| Python | mit | wtbarnes/solarnmf | ---
+++
@@ -0,0 +1,32 @@
+#solarnmf_main_ts.py
+
+#Will Barnes
+#31 March 2015
+
+#Import needed modules
+import solarnmf_functs as snf
+import solarnmf_plot_routines as spr
+
+#Read in and format the time series
+results = snf.make_t_matrix("data",filename='/home/wtb2/Desktop/gaussian_test.dat')
+
+#Get the dimensio... | |
ce53f3f7132c5b066d36f5e90d0b6c23c692fe9a | chapter03/maxProductOfTwoNumbers.py | chapter03/maxProductOfTwoNumbers.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
fourNumbers = input('Write four numbers separated by commas')
target = []
def multiplyToOthers(index):
results = [4]
for x in range(0,4):
if (index != x):
result = fourNumbers[index] * fourNumbers[x]
results.insert(x, result)
else:
... | Add multiplication between two numbers algorythm. Not optimized. | Add multiplication between two numbers algorythm. Not optimized.
| Python | apache-2.0 | MindCookin/python-exercises | ---
+++
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import math
+
+fourNumbers = input('Write four numbers separated by commas')
+target = []
+
+def multiplyToOthers(index):
+
+ results = [4]
+
+ for x in range(0,4):
+ if (index != x):
+ result = fourNumbers[index] * fourNumbers[x]
+... | |
d6ce90994b8ec0f8db6802adfdcafeea63c30419 | doc/examples/transform/plot_fundamental_matrix.py | doc/examples/transform/plot_fundamental_matrix.py | """
=============================
Fundamental matrix estimation
=============================
This example demonstrates how to robustly estimate epipolar geometry between two
views using sparse ORB feature correspondences.
The fundamental matrix relates corresponding points between a pair of
uncalibrated images. The ... | Add simple fundamental matrix example | Add simple fundamental matrix example
| Python | bsd-3-clause | paalge/scikit-image,paalge/scikit-image,paalge/scikit-image | ---
+++
@@ -0,0 +1,57 @@
+"""
+=============================
+Fundamental matrix estimation
+=============================
+
+This example demonstrates how to robustly estimate epipolar geometry between two
+views using sparse ORB feature correspondences.
+
+The fundamental matrix relates corresponding points between... | |
a99cf1ae28cb42f15ed57ed175162fdcfafe0198 | opps/articles/forms.py | opps/articles/forms.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from django.conf import settings
from .models import Post, Album, Link
from redactor.widgets import RedactorEditor
class PostAdminForm(forms.ModelForm):
class Meta:
model = Post
widgets = {'content': RedactorEditor()}
class... | Create articles form (to admin) | Create articles form (to admin)
| Python | mit | jeanmask/opps,YACOWS/opps,jeanmask/opps,opps/opps,williamroot/opps,opps/opps,williamroot/opps,opps/opps,YACOWS/opps,williamroot/opps,williamroot/opps,opps/opps,YACOWS/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps | ---
+++
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+from django import forms
+from django.conf import settings
+
+from .models import Post, Album, Link
+
+from redactor.widgets import RedactorEditor
+
+
+class PostAdminForm(forms.ModelForm):
+ class Meta:
+ model = Post
+ widget... | |
1bcc8afc27653b4fb712df5d741ec78c11229bb0 | benchmarks/benchmarks/bench_lib.py | benchmarks/benchmarks/bench_lib.py | """Benchmarks for `numpy.lib`."""
from __future__ import absolute_import, division, print_function
from .common import Benchmark
import numpy as np
class Pad(Benchmark):
"""Benchmarks for `numpy.pad`."""
param_names = ["shape", "pad_width", "mode"]
params = [
[(1000,), (10, 100), (10, 10, 10)... | Add basic benchmarks for numpy.pad | BENCH: Add basic benchmarks for numpy.pad
| Python | bsd-3-clause | WarrenWeckesser/numpy,seberg/numpy,jakirkham/numpy,WarrenWeckesser/numpy,gfyoung/numpy,shoyer/numpy,endolith/numpy,pbrod/numpy,simongibbons/numpy,madphysicist/numpy,mhvk/numpy,abalkin/numpy,Eric89GXL/numpy,mhvk/numpy,jorisvandenbossche/numpy,mhvk/numpy,rgommers/numpy,simongibbons/numpy,mattip/numpy,pizzathief/numpy,gfy... | ---
+++
@@ -0,0 +1,25 @@
+"""Benchmarks for `numpy.lib`."""
+
+
+from __future__ import absolute_import, division, print_function
+
+from .common import Benchmark
+
+import numpy as np
+
+
+class Pad(Benchmark):
+ """Benchmarks for `numpy.pad`."""
+
+ param_names = ["shape", "pad_width", "mode"]
+ params = [... | |
9151b60566d991e4bf0c9877de608fe88b3763fc | go_optouts/tests/test_server.py | go_optouts/tests/test_server.py | import yaml
from twisted.internet.defer import inlineCallbacks
from twisted.web.server import Site
from vumi.tests.helpers import VumiTestCase
from go_optouts.server import HealthResource, read_yaml_config, ApiSite
from go_optouts.tests.utils import SiteHelper
class TestHealthResource(VumiTestCase):
@inlineCa... | Add tests for server utilities. | Add tests for server utilities.
| Python | bsd-3-clause | praekelt/go-optouts-api,praekelt/go-optouts-api | ---
+++
@@ -0,0 +1,77 @@
+import yaml
+
+from twisted.internet.defer import inlineCallbacks
+from twisted.web.server import Site
+
+from vumi.tests.helpers import VumiTestCase
+
+from go_optouts.server import HealthResource, read_yaml_config, ApiSite
+from go_optouts.tests.utils import SiteHelper
+
+
+class TestHealt... | |
f50644484f4b05fbb25adfd6430b6207441d8b2e | src/ggrc_basic_permissions/migrations/versions/20131008124800_8f33d9bd2043_fix_system_roles.py | src/ggrc_basic_permissions/migrations/versions/20131008124800_8f33d9bd2043_fix_system_roles.py | """
Revision ID: 8f33d9bd2043
Revises: 758b4012b5f
Create Date: 2013-09-20 14:12:32.846302
"""
# revision identifiers, used by Alembic.
revision = '8f33d9bd2043'
down_revision = '758b4012b5f'
import json
import sqlalchemy as sa
from alembic import op
from datetime import datetime
from sqlalchemy.sql import table, c... | Add migration to fix system roles | Add migration to fix system roles
* `ObjectEditor` and `Reader` were missing `ProgramDirective`,
`ProgramControl`, and `Person` permissions (CRUD, except `Person`,
which is CRU.
* `ObjectControl` and `ObjectDocument` were combined due to a missing
comma in a previous migration.
| Python | apache-2.0 | hasanalom/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,hasanalom/ggrc-core,jmakov/ggrc-core,jmakov/ggrc-core,kr41/ggrc-core,AleksNeStu/ggrc-core,prasannav7/ggrc-core,hasanalom/ggrc-core,j0gurt/ggrc-core,uskudnik/ggrc-core,uskudnik/ggrc-core,hyperNURb/ggrc-core,jmakov/ggrc-core,prasannav7/ggrc-c... | ---
+++
@@ -0,0 +1,110 @@
+"""
+
+Revision ID: 8f33d9bd2043
+Revises: 758b4012b5f
+Create Date: 2013-09-20 14:12:32.846302
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '8f33d9bd2043'
+down_revision = '758b4012b5f'
+
+import json
+import sqlalchemy as sa
+from alembic import op
+from datetime import ... | |
f6b2e92328d6bc3fc01916ffd6fa872da7afeb4f | barbican/model/migration/alembic_migrations/versions/39a96e67e990_add_missing_constraints.py | barbican/model/migration/alembic_migrations/versions/39a96e67e990_add_missing_constraints.py | """Add missing constraints
Revision ID: 39a96e67e990
Revises: 4ecde3a3a72a
Create Date: 2016-01-26 13:18:06.113621
"""
# revision identifiers, used by Alembic.
revision = '39a96e67e990'
down_revision = '4ecde3a3a72a'
from alembic import op
import sqlalchemy as sa
def upgrade():
# Add missing projects table ke... | Add missing database constraints and defaults | Add missing database constraints and defaults
The project table was missing a constraint on the external_id column.
The secret and container ACLs tables were missing a default value of
True for the project_access column.
Change-Id: I5bd4bc9bca830a37d841434c07a80ce857b676bb
| Python | apache-2.0 | openstack/barbican,openstack/barbican | ---
+++
@@ -0,0 +1,34 @@
+"""Add missing constraints
+
+Revision ID: 39a96e67e990
+Revises: 4ecde3a3a72a
+Create Date: 2016-01-26 13:18:06.113621
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '39a96e67e990'
+down_revision = '4ecde3a3a72a'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def up... | |
35f7331a7086fe1598667ca4907feb7caca975a4 | py/arranging-coins.py | py/arranging-coins.py | class Solution(object):
def arrangeCoins(self, n):
"""
:type n: int
:rtype: int
"""
return int((-1 + int((1 + 8 * n + .5) ** .5)) / 2)
| Add py solution for 441. Arranging Coins | Add py solution for 441. Arranging Coins
441. Arranging Coins: https://leetcode.com/problems/arranging-coins/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,7 @@
+class Solution(object):
+ def arrangeCoins(self, n):
+ """
+ :type n: int
+ :rtype: int
+ """
+ return int((-1 + int((1 + 8 * n + .5) ** .5)) / 2) | |
45e78bd7cbfa93a96255df9b5144ce25a609eb9b | py/shopping-offers.py | py/shopping-offers.py | from collections import Counter
from operator import mul
class Solution(object):
def shoppingOffers(self, price, special, needs):
"""
:type price: List[int]
:type special: List[List[int]]
:type needs: List[int]
:rtype: int
"""
c = Counter()
c[tuple(nee... | Add py solution for 638. Shopping Offers | Add py solution for 638. Shopping Offers
638. Shopping Offers: https://leetcode.com/problems/shopping-offers/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,43 @@
+from collections import Counter
+from operator import mul
+class Solution(object):
+ def shoppingOffers(self, price, special, needs):
+ """
+ :type price: List[int]
+ :type special: List[List[int]]
+ :type needs: List[int]
+ :rtype: int
+ """
+ ... | |
a642619fa9b8b0ef7bb7dd66ecacf2d175494acd | tests/unit/returners/test_pgjsonb.py | tests/unit/returners/test_pgjsonb.py | # -*- coding: utf-8 -*-
'''
tests.unit.returners.pgjsonb_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unit tests for the PGJsonb returner (pgjsonb).
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt Testing libs
from tests.support.mixins impo... | Rename test pgjsonb returner test file to match naming convention | Rename test pgjsonb returner test file to match naming convention
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+'''
+tests.unit.returners.pgjsonb_test
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Unit tests for the PGJsonb returner (pgjsonb).
+'''
+
+# Import Python libs
+from __future__ import absolute_import, print_function, unicode_literals
+import logging
+
+# Import Salt Tes... | |
1c01ff6e4510abcb7a69fe61e1a5b8ef17818529 | demo/chaco_demo.py | demo/chaco_demo.py | # Copyright (c) 2015, Warren Weckesser. All rights reserved.
# This software is licensed according to the "BSD 2-clause" license.
#
# Use chaco to display the eye diagram computed by eyediagram.grid_count.
import numpy as np
# ETS imports...
from traits.api import HasTraits, Instance
from traitsui.api import Item, G... | Add a demo that uses chaco to plot the eye diagram. | ENH: Add a demo that uses chaco to plot the eye diagram.
| Python | bsd-2-clause | WarrenWeckesser/eyediagram | ---
+++
@@ -0,0 +1,91 @@
+# Copyright (c) 2015, Warren Weckesser. All rights reserved.
+# This software is licensed according to the "BSD 2-clause" license.
+#
+# Use chaco to display the eye diagram computed by eyediagram.grid_count.
+
+import numpy as np
+
+# ETS imports...
+from traits.api import HasTraits, Insta... | |
9b836c695ca6ab64031bdd3f55f42ee9fc7bbb20 | tests/curious_tests/test_api_batch.py | tests/curious_tests/test_api_batch.py | import json
from django.test import TestCase
from django.db import connection
from curious import model_registry
from curious_tests.models import Blog, Entry
import curious_tests.models
class TestBatchFetch(TestCase):
N = 20
def setUp(self):
blog = Blog(name='Databases')
blog.save()
self.blog = blog
... | Add test for batch fetch object API | Add test for batch fetch object API
| Python | mit | ginkgobioworks/curious,benjiec/curious,ginkgobioworks/curious,benjiec/curious,benjiec/curious,ginkgobioworks/curious | ---
+++
@@ -0,0 +1,34 @@
+import json
+from django.test import TestCase
+from django.db import connection
+from curious import model_registry
+from curious_tests.models import Blog, Entry
+import curious_tests.models
+
+class TestBatchFetch(TestCase):
+ N = 20
+
+ def setUp(self):
+ blog = Blog(name='Databases')... | |
480fda37fd552a756a4a0feaf061cc0794e33e65 | list.py | list.py | #!/usr/bin/python
import os
import json
import pprint
DATA_DIR = "data"
def load():
contents = {}
for filename in os.listdir(DATA_DIR):
if filename.startswith("."): continue
path = os.path.join(DATA_DIR, filename)
content = {}
for line in file(path).readlines():
... | Load analyzed mod content .csvs as json | Load analyzed mod content .csvs as json
| Python | bsd-3-clause | agaricusb/ModAnalyzer,agaricusb/ModAnalyzer | ---
+++
@@ -0,0 +1,41 @@
+#!/usr/bin/python
+
+import os
+import json
+import pprint
+
+DATA_DIR = "data"
+
+def load():
+ contents = {}
+ for filename in os.listdir(DATA_DIR):
+ if filename.startswith("."): continue
+
+ path = os.path.join(DATA_DIR, filename)
+
+ content = {}
+ for ... | |
6e9fada3539abca49579340e20b06fc19554e2a6 | sc2reader/__init__.py | sc2reader/__init__.py | from __future__ import absolute_import
from sc2reader import factories, log_utils
# setup the library logging
log_utils.setup()
# For backwards compatibility
SC2Reader = factories.SC2Factory
# Expose a nice module level interface
__defaultSC2Reader = factories.SC2Factory()
register_datapack = __defaultSC2Reader.re... | from __future__ import absolute_import
# import submodules
from sc2reader import listeners, data, scripts, processors
from sc2reader import factories, log_utils
# setup the library logging
log_utils.setup()
# For backwards compatibility
SC2Reader = factories.SC2Factory
# Expose a nice module level interface
__defa... | Add explicit submodule imports to resolve certain runtime import issues. | Add explicit submodule imports to resolve certain runtime import issues.
| Python | mit | GraylinKim/sc2reader,vlaufer/sc2reader,ggtracker/sc2reader,GraylinKim/sc2reader,StoicLoofah/sc2reader,ggtracker/sc2reader,StoicLoofah/sc2reader,vlaufer/sc2reader | ---
+++
@@ -1,4 +1,7 @@
from __future__ import absolute_import
+
+# import submodules
+from sc2reader import listeners, data, scripts, processors
from sc2reader import factories, log_utils
|
02197b1fcaafb3bec1437a093b1c4170c82b55de | scripts/vac-load.py | scripts/vac-load.py | from __future__ import print_function
import sys
from pyspark.sql import SparkSession
from pyspark.sql.functions import translate
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: vac-load.py <input> <output>", file=sys.stderr)
exit(-1)
spark = SparkSession.builder.appName('Load V... | Load Wright fiction JSON format. | Load Wright fiction JSON format.
| Python | apache-2.0 | ViralTexts/vt-passim,ViralTexts/vt-passim,ViralTexts/vt-passim | ---
+++
@@ -0,0 +1,18 @@
+from __future__ import print_function
+import sys
+from pyspark.sql import SparkSession
+from pyspark.sql.functions import translate
+
+if __name__ == "__main__":
+ if len(sys.argv) != 3:
+ print("Usage: vac-load.py <input> <output>", file=sys.stderr)
+ exit(-1)
+ spark =... | |
2ae585068ea0ba0501e28c27c56bf45359459540 | py/remove-boxes.py | py/remove-boxes.py | from collections import defaultdict, Counter
from itertools import groupby
class Solution(object):
def removeBoxes(self, boxes):
"""
:type boxes: List[int]
:rtype: int
"""
table = defaultdict(Counter)
table_max = Counter()
B = []
for k, l in groupby(bo... | Add py solution for 546. Remove Boxes | Add py solution for 546. Remove Boxes
546. Remove Boxes: https://leetcode.com/problems/remove-boxes/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,46 @@
+from collections import defaultdict, Counter
+from itertools import groupby
+class Solution(object):
+ def removeBoxes(self, boxes):
+ """
+ :type boxes: List[int]
+ :rtype: int
+ """
+ table = defaultdict(Counter)
+ table_max = Counter()
+ ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.