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 |
|---|---|---|---|---|---|---|---|---|---|---|
532e84e2dedb83c2584fcd4122f0f3f905413b63 | data/vcfClean.py | data/vcfClean.py | #!/usr/bin/env python2.7
"""
The 1000 Genomes VCF files have some SNPs which are not congruant with
the fasta sequence. This script simply deletes such cases so they
don't cause trouble down the road
"""
import argparse, sys, os, os.path, random, subprocess, shutil, itertools
from Bio import SeqIO
from Bio.Seq ... | Add vcf clean script to take out variants from vcf that dont match fasta | Add vcf clean script to take out variants from vcf that dont match fasta
| Python | mit | glennhickey/vg2sg,glennhickey/vg2sg,glennhickey/vg2sg,glennhickey/vg2sg | ---
+++
@@ -0,0 +1,66 @@
+#!/usr/bin/env python2.7
+
+"""
+ The 1000 Genomes VCF files have some SNPs which are not congruant with
+ the fasta sequence. This script simply deletes such cases so they
+ don't cause trouble down the road
+"""
+
+
+import argparse, sys, os, os.path, random, subprocess, shutil, itertool... | |
e75860ada9b64054c9f45e1af2ddf485e5efb6d0 | latlng2utm/detect-utm-zone.py | latlng2utm/detect-utm-zone.py | # modified code from https://pcjericks.github.io/py-gdalogr-cookbook/
# vector_layers.html
import os
from osgeo import ogr
from sys import argv
import math
script, daShapefile = argv
# /Users/jbranigan/Documents/phila-city_limits_shp
def check_latlng(bbox):
for i in bbox:
if i < -180 or i > 180:
... | Add script that detects a shapefile UTM zone | Add script that detects a shapefile UTM zone
| Python | mit | jbranigan/geo-scripts-python | ---
+++
@@ -0,0 +1,54 @@
+# modified code from https://pcjericks.github.io/py-gdalogr-cookbook/
+# vector_layers.html
+
+import os
+from osgeo import ogr
+from sys import argv
+import math
+
+script, daShapefile = argv
+
+# /Users/jbranigan/Documents/phila-city_limits_shp
+
+def check_latlng(bbox):
+ for i in bbox... | |
2998801fa337a6f89093380d5d05c5299e3617b1 | migrations/versions/f092dbba3026_.py | migrations/versions/f092dbba3026_.py | """empty message
Revision ID: f092dbba3026
Revises: ad8c63f1135e
Create Date: 2018-11-20 13:01:18.328112
"""
# revision identifiers, used by Alembic.
revision = 'f092dbba3026'
down_revision = 'ad8c63f1135e'
from alembic import op
import sqlalchemy as sa
def upgrade():
# commands auto generated by Alembic - pl... | Add new field for email - migration file | Add new field for email - migration file
| Python | mit | CSC-IT-Center-for-Science/pouta-blueprints,CSC-IT-Center-for-Science/pouta-blueprints,CSC-IT-Center-for-Science/pouta-blueprints,CSC-IT-Center-for-Science/pouta-blueprints | ---
+++
@@ -0,0 +1,28 @@
+"""empty message
+
+Revision ID: f092dbba3026
+Revises: ad8c63f1135e
+Create Date: 2018-11-20 13:01:18.328112
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'f092dbba3026'
+down_revision = 'ad8c63f1135e'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade():
+... | |
a926e216426c66dd93ea2e2ac5bad4aedd0c13b9 | lintcode/Easy/174_Remove_nth_Node_from_End_of_List.py | lintcode/Easy/174_Remove_nth_Node_from_End_of_List.py | """
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param head: The first node of linked list.
@param n: An integer.
@return: The head of linked list.
"""
def removeNthFromEnd(self, h... | Add solution to lintcode question 174 | Add solution to lintcode question 174
| Python | mit | Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode | ---
+++
@@ -0,0 +1,42 @@
+"""
+Definition of ListNode
+class ListNode(object):
+
+ def __init__(self, val, next=None):
+ self.val = val
+ self.next = next
+"""
+class Solution:
+ """
+ @param head: The first node of linked list.
+ @param n: An integer.
+ @return: The head of linked list.
... | |
13fb6dda7ba7dfc63a54cf8368216c6dfe3d20c9 | src/scripts/create_conll.py | src/scripts/create_conll.py | #!/usr/bin/env python3
""""Create a CoNLL corpus from FrameNet fulltext data tokens
This CoNLL corpus will then be lemmatized using WordNet, and parsed using
TurboParser.
"""
from pathlib import Path
from xml.etree import ElementTree as ET
import os
from nltk.corpus import wordnet
from paths import FRAMENET_FULLTE... | Add script to create CoNLL corpus from FN fulltext | Add script to create CoNLL corpus from FN fulltext
| Python | agpl-3.0 | aymara/knowledgesrl,aymara/knowledgesrl | ---
+++
@@ -0,0 +1,41 @@
+#!/usr/bin/env python3
+
+""""Create a CoNLL corpus from FrameNet fulltext data tokens
+
+This CoNLL corpus will then be lemmatized using WordNet, and parsed using
+TurboParser.
+"""
+
+from pathlib import Path
+from xml.etree import ElementTree as ET
+import os
+
+from nltk.corpus import wo... | |
523447ef1bd8c0af785c382975ef61c0a374a833 | testinfra/mon/test_ossec_ruleset.py | testinfra/mon/test_ossec_ruleset.py | import re
alert_level_regex = re.compile(r"Level: '(\d+)'")
def test_grsec_denied_rwx_mapping_produces_alert(Command, Sudo):
"""Check that a denied RWX mmaping produces an OSSEC alert"""
test_alert = ("Feb 10 23:34:40 app kernel: [ 124.188641] grsec: denied "
"RWX mmap of <anonymous mappi... | Add initial automated test for OSSEC alert using ossec-logtest | Add initial automated test for OSSEC alert using ossec-logtest
Verify that the log event describes in PR #871 (grsec denying RWX
mmap) produces an OSSEC alert of level 7.
Note: The rule added in PR #871 was later reverted, which is why
current SecureDrop produces OSSEC alerts for this kind of log
event.
| Python | agpl-3.0 | ehartsuyker/securedrop,ehartsuyker/securedrop,heartsucker/securedrop,heartsucker/securedrop,heartsucker/securedrop,conorsch/securedrop,conorsch/securedrop,conorsch/securedrop,conorsch/securedrop,ehartsuyker/securedrop,micahflee/securedrop,garrettr/securedrop,garrettr/securedrop,conorsch/securedrop,micahflee/securedrop,... | ---
+++
@@ -0,0 +1,21 @@
+import re
+
+
+alert_level_regex = re.compile(r"Level: '(\d+)'")
+
+
+def test_grsec_denied_rwx_mapping_produces_alert(Command, Sudo):
+ """Check that a denied RWX mmaping produces an OSSEC alert"""
+ test_alert = ("Feb 10 23:34:40 app kernel: [ 124.188641] grsec: denied "
+ ... | |
f5fb79cc637aa0305b4cbea144330208d2da0378 | tests/test_cmd.py | tests/test_cmd.py | from tornado.ioloop import IOLoop
from tests.helper import ExternalVersionTestCase
class CMDTest(ExternalVersionTestCase):
def get_new_ioloop(self):
return IOLoop.instance()
def test_cmd(self):
self.assertEqual(self.sync_get_version("example", {"cmd": "echo Meow"}), "Meow")
| Add a testcase for Command | Add a testcase for Command
| Python | mit | lilydjwg/nvchecker | ---
+++
@@ -0,0 +1,10 @@
+from tornado.ioloop import IOLoop
+from tests.helper import ExternalVersionTestCase
+
+
+class CMDTest(ExternalVersionTestCase):
+ def get_new_ioloop(self):
+ return IOLoop.instance()
+
+ def test_cmd(self):
+ self.assertEqual(self.sync_get_version("example", {"cmd": "ech... | |
5b70b4a04fe7d6eb9d5836bef297647dee85124a | zephyr/management/commands/create_user.py | zephyr/management/commands/create_user.py | import sys
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ValidationError
from django.db.utils import IntegrityError
from django.utils.timezone import now
from django.core import validators
from zephyr.models import Realm, do_create_user
from zephyr.views import d... | Introduce new manage.py command which creates users with default passwords. | Introduce new manage.py command which creates users with default passwords.
(imported from commit ba5ed9cb6ee91435b184845019391e5dc38fc3aa)
| Python | apache-2.0 | Gabriel0402/zulip,j831/zulip,swinghu/zulip,sup95/zulip,tiansiyuan/zulip,krtkmj/zulip,yuvipanda/zulip,Batterfii/zulip,kou/zulip,ashwinirudrappa/zulip,Batterfii/zulip,levixie/zulip,he15his/zulip,dotcool/zulip,kokoar/zulip,KJin99/zulip,lfranchi/zulip,itnihao/zulip,grave-w-grave/zulip,vaidap/zulip,niftynei/zulip,rht/zulip,... | ---
+++
@@ -0,0 +1,48 @@
+import sys
+
+from django.core.management.base import BaseCommand, CommandError
+from django.core.exceptions import ValidationError
+from django.db.utils import IntegrityError
+from django.utils.timezone import now
+from django.core import validators
+
+from zephyr.models import Realm, do_cr... | |
04a46726e95b42d3566456338df04c222d5a2863 | core/main.py | core/main.py | import time
import RPi.GPIO as io
from urllib.parse import urlencode
from urllib.request import Request, urlopen
io.setmode(io.BCM)
contact_pin = 7
vibration_pin = 11
sound_pin = 13
pins_array = [contact_pin, vibration_pin, sound_pin]
url = 'http://localhost:8000/triggers'
def setup_door():
# So, that input p... | Add some pseudo core for the core | Add some pseudo core for the core
| Python | mit | arnaudoff/watcher,arnaudoff/watcher,arnaudoff/watcher | ---
+++
@@ -0,0 +1,45 @@
+import time
+import RPi.GPIO as io
+
+from urllib.parse import urlencode
+from urllib.request import Request, urlopen
+
+io.setmode(io.BCM)
+
+contact_pin = 7
+vibration_pin = 11
+sound_pin = 13
+
+pins_array = [contact_pin, vibration_pin, sound_pin]
+
+url = 'http://localhost:8000/triggers'... | |
628e571d3c29f806ac98154f68c428a05c43e8e2 | gaphor/diagram/tests/test_inlineeditors.py | gaphor/diagram/tests/test_inlineeditors.py | import pytest
from gaphas.painter import BoundingBoxPainter
from gaphas.view import GtkView
from gaphor import UML
from gaphor.diagram.inlineeditors import named_item_inline_editor
from gaphor.diagram.painter import ItemPainter
from gaphor.diagram.selection import Selection
@pytest.fixture
def view(diagram):
vie... | Add some inline editor tests | Add some inline editor tests
| Python | lgpl-2.1 | amolenaar/gaphor,amolenaar/gaphor | ---
+++
@@ -0,0 +1,45 @@
+import pytest
+from gaphas.painter import BoundingBoxPainter
+from gaphas.view import GtkView
+
+from gaphor import UML
+from gaphor.diagram.inlineeditors import named_item_inline_editor
+from gaphor.diagram.painter import ItemPainter
+from gaphor.diagram.selection import Selection
+
+
+@pyt... | |
9c11b014e1dc5e93cf3df2b074b27ceab1edf0ef | tests/test_connection_timeout.py | tests/test_connection_timeout.py | # -*- coding: utf-8 -*-
import time
import pytest
import pymssql
def test_connect_timeout():
for to in range(2,20,2):
t = time.time()
try:
pymssql.connect(server="www.google.com", port=81, user='username', password='password',
login_timeout=to)
... | Add test for connection timeout. | Add test for connection timeout.
| Python | lgpl-2.1 | pymssql/pymssql,pymssql/pymssql | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+
+import time
+import pytest
+import pymssql
+
+
+def test_connect_timeout():
+
+ for to in range(2,20,2):
+ t = time.time()
+ try:
+ pymssql.connect(server="www.google.com", port=81, user='username', password='password',
+ ... | |
c6113680e79ba076e4de06396ba75c18db4c98d0 | scratch_test.py | scratch_test.py | from bluesky import RunEngine
RE = RunEngine({})
from ophyd.sim import det
from bluesky.plans import count
from suitcase.jsonl import Serializer
serializer = Serializer('')
RE(count([det]), serializer)
serializer.close()
serializer = Serializer('')
RE(count([det]), serializer)
serializer.close()
| Add temporary scratch test for dev. | TMP: Add temporary scratch test for dev.
| Python | bsd-3-clause | ericdill/databroker,ericdill/databroker | ---
+++
@@ -0,0 +1,11 @@
+from bluesky import RunEngine
+RE = RunEngine({})
+from ophyd.sim import det
+from bluesky.plans import count
+from suitcase.jsonl import Serializer
+serializer = Serializer('')
+RE(count([det]), serializer)
+serializer.close()
+serializer = Serializer('')
+RE(count([det]), serializer)
+seri... | |
1ff0b5fe7651b836ac9010b2970ad6b45a0739e7 | tools/verify_simulator_result.py | tools/verify_simulator_result.py | #! /usr/bin/env python
import os
import os.path
import sys
import json
success = 0
def _extractGenome(header):
headers = header.split('|')
genome = headers[4].strip()
pos = genome.find(",")
if pos > 0:
genome = genome[:pos]
pos = genome.find(" chromosome")
if pos > 0:
... | Add simulator result parser tool | Add simulator result parser tool
| Python | apache-2.0 | iychoi/biospectra,iychoi/biospectra,iychoi/biospectra | ---
+++
@@ -0,0 +1,100 @@
+#! /usr/bin/env python
+
+import os
+import os.path
+import sys
+import json
+
+success = 0
+
+def _extractGenome(header):
+ headers = header.split('|')
+ genome = headers[4].strip()
+ pos = genome.find(",")
+ if pos > 0:
+ genome = genome[:pos]
+
+ pos = genom... | |
f3d00e7f0b76db522e55ed0f1988dfdf7e5cf3ff | bin/contig_statistics.py | bin/contig_statistics.py | #! /usr/bin/env python3
import argparse
import statistics
parser = argparse.ArgumentParser(description='Input Newick tree.')
parser.add_argument(
'-k',
type=int,
metavar='int',
dest='k',
required=True,
help='k-mer length',
)
parser.add_argument(
'-f','--fai',
type=str,
metavar='str',
dest='fai_fn... | Add script for contig statistics for FAI | Add script for contig statistics for FAI
Former-commit-id: e7b46625514f8db9b99d474ad181629e483ecbf7 | Python | mit | karel-brinda/prophyle,karel-brinda/prophyle,karel-brinda/prophyle,karel-brinda/prophyle | ---
+++
@@ -0,0 +1,48 @@
+#! /usr/bin/env python3
+
+import argparse
+import statistics
+
+parser = argparse.ArgumentParser(description='Input Newick tree.')
+parser.add_argument(
+ '-k',
+ type=int,
+ metavar='int',
+ dest='k',
+ required=True,
+ help='k-mer length',
+ )
+parser.add_argument(
+ '-f','--fai',
... | |
7ef79a8e434593612a223be0f40173639acc8a1c | scripts/read_in_lines.py | scripts/read_in_lines.py | from image_process.hough_transform import get_hough_lines
from lines.line import Point, LineSegment
import matplotlib.pyplot as plt
import os
image_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'data', 'hough_test', 'Test_Set_1', 'PNGs',
'C(C)C(CCCC)(C)C.png')
lines = get_h... | Add Script for Testing Line Segment Features | Add Script for Testing Line Segment Features
| Python | mit | Molecular-Image-Recognition/Molecular-Image-Recognition | ---
+++
@@ -0,0 +1,46 @@
+from image_process.hough_transform import get_hough_lines
+from lines.line import Point, LineSegment
+import matplotlib.pyplot as plt
+import os
+
+image_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'data', 'hough_test', 'Test_Set_1', 'PNGs',
+ 'C(... | |
aead6b8dab78056e0034ef21ea82d9151123f8a3 | scripts/create_shop_sequences.py | scripts/create_shop_sequences.py | #!/usr/bin/env python
"""Create article and order sequences for a party's shop.
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import click
from byceps.services.shop.sequence.models import Purpose
from byceps.services.shop.sequence.service import create_party_sequenc... | Add script to create party sequences for a shop | Add script to create party sequences for a shop
| Python | bsd-3-clause | m-ober/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps | ---
+++
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+"""Create article and order sequences for a party's shop.
+
+:Copyright: 2006-2018 Jochen Kupperschmidt
+:License: Modified BSD, see LICENSE for details.
+"""
+
+import click
+
+from byceps.services.shop.sequence.models import Purpose
+from byceps.services.shop.seque... | |
c8f53c175b948b771c7d1eee7d1156f76287ca97 | vezilka/lib/pygments_rst.py | vezilka/lib/pygments_rst.py | # -*- coding: utf-8 -*-
"""
The Pygments reStructuredText directive
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This fragment is a Docutils_ 0.4 directive that renders source code
(to HTML only, currently) via Pygments.
To use it, adjust the options below and copy the code into a module
that you i... | Add pygments rst support plugin (from zine) | Add pygments rst support plugin (from zine)
| Python | mit | gdamjan/vezilka | ---
+++
@@ -0,0 +1,77 @@
+# -*- coding: utf-8 -*-
+"""
+ The Pygments reStructuredText directive
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ This fragment is a Docutils_ 0.4 directive that renders source code
+ (to HTML only, currently) via Pygments.
+
+ To use it, adjust the options below and copy t... | |
22656ecba485c56b654cf4b57b2906a7f0e7effc | mapApp/migrations/0005_auto_20150819_1829.py | mapApp/migrations/0005_auto_20150819_1829.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mapApp', '0004_auto_20150806_1426'),
]
operations = [
migrations.CreateModel(
name='Weather',
fields... | Migrate datbase to add Weather model and delete weather field from Incident model | Migrate datbase to add Weather model and delete weather field from Incident model
| Python | mit | SPARLab/BikeMaps,SPARLab/BikeMaps,SPARLab/BikeMaps | ---
+++
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('mapApp', '0004_auto_20150806_1426'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ ... | |
7219cea7d4480739e39ac3e4c3c431002b786241 | vumi/workers/vas2nets/workers.py | vumi/workers/vas2nets/workers.py | # -*- test-case-name: vumi.workers.vas2nets.test_vas2nets -*-
# -*- encoding: utf-8 -*-
from twisted.python import log
from twisted.internet.defer import inlineCallbacks, Deferred
from vumi.message import Message
from vumi.service import Worker
class EchoWorker(Worker):
@inlineCallbacks
def startWorker(sel... | Test worker (replies with received content) for vas2nets transport. | Test worker (replies with received content) for vas2nets transport.
| Python | bsd-3-clause | harrissoerja/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix,harrissoerja/vumi,harrissoerja/vumi,TouK/vumi,TouK/vumi | ---
+++
@@ -0,0 +1,37 @@
+# -*- test-case-name: vumi.workers.vas2nets.test_vas2nets -*-
+# -*- encoding: utf-8 -*-
+
+from twisted.python import log
+from twisted.internet.defer import inlineCallbacks, Deferred
+
+from vumi.message import Message
+from vumi.service import Worker
+
+
+class EchoWorker(Worker):
+
+ ... | |
6342fb6890ad4966b655ccfcea1b585dac155729 | modules/testing/test_database_reference.py | modules/testing/test_database_reference.py | #!/usr/bin/env python
"""
Created by: Lee Bergstrand (2017)
Description: A simple unittest for testing the database reference module.
"""
import unittest
from modules.database_reference import parse_database_references
class TestDatabaseReference(unittest.TestCase):
"""A unit testing class for testing the data... | Add automated tests for database references. | Add automated tests for database references.
| Python | apache-2.0 | LeeBergstrand/pygenprop | ---
+++
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+
+"""
+Created by: Lee Bergstrand (2017)
+
+Description: A simple unittest for testing the database reference module.
+"""
+
+import unittest
+from modules.database_reference import parse_database_references
+
+
+class TestDatabaseReference(unittest.TestCase):
+ """... | |
3aa6135d8104cac474326d915f290ecbb5014fde | tests/block/test_block_3.py | tests/block/test_block_3.py | import lz4.block
import pytest
test_data = [
(b'a' * 1024 * 1024),
]
@pytest.fixture(
params=test_data,
ids=[
'data' + str(i) for i in range(len(test_data))
]
)
def data(request):
return request.param
def test_block_decompress_mem_usage(data):
tracemalloc = pytest.importorskip('tra... | Add test which checks for growing memory usage for block funcs | Add test which checks for growing memory usage for block funcs
| Python | bsd-3-clause | python-lz4/python-lz4,python-lz4/python-lz4 | ---
+++
@@ -0,0 +1,38 @@
+import lz4.block
+import pytest
+
+
+test_data = [
+ (b'a' * 1024 * 1024),
+]
+
+
+@pytest.fixture(
+ params=test_data,
+ ids=[
+ 'data' + str(i) for i in range(len(test_data))
+ ]
+)
+def data(request):
+ return request.param
+
+
+def test_block_decompress_mem_usage(da... | |
bd94cd20c3021e7fef470963b67164f431ec86fa | PyFVCOM/current_tools.py | PyFVCOM/current_tools.py | """
Tools to work with current data. Reuses some functions from tide_tools.
"""
from tide_tools import addHarmonicResults, getObservedData, getObservedMetadata, getHarmonics, TAPPy
def scalar2vector(direction, speed):
"""
Convert arrays of two scalars into the corresponding vector components.
This is ma... | Add new tools for working with current data. | Add new tools for working with current data.
| Python | mit | pwcazenave/PyFVCOM | ---
+++
@@ -0,0 +1,55 @@
+"""
+Tools to work with current data. Reuses some functions from tide_tools.
+
+"""
+
+from tide_tools import addHarmonicResults, getObservedData, getObservedMetadata, getHarmonics, TAPPy
+
+
+def scalar2vector(direction, speed):
+ """
+ Convert arrays of two scalars into the correspon... | |
789e6c43c03d9d0c238919fd85a48f4d9b37cabd | classify_vgg.py | classify_vgg.py | # Xiang Xiang (eglxiang@gmail.com), March 2016, MIT license.
import numpy as np
import cv2
import caffe
import time
img = caffe.io.load_image( "ak.png" )
img = img[:,:,::-1]*255.0 # convert RGB->BGR
avg = np.array([129.1863,104.7624,93.5940])
img = img - avg # subtract mean (numpy takes care of dimensions :)
img = ... | Add Python script for running VGG_Face demo. | Add Python script for running VGG_Face demo. | Python | mit | eglxiang/vgg_face,eglxiang/vgg_face,eglxiang/vgg_face | ---
+++
@@ -0,0 +1,22 @@
+# Xiang Xiang (eglxiang@gmail.com), March 2016, MIT license.
+
+import numpy as np
+import cv2
+import caffe
+import time
+
+img = caffe.io.load_image( "ak.png" )
+img = img[:,:,::-1]*255.0 # convert RGB->BGR
+avg = np.array([129.1863,104.7624,93.5940])
+img = img - avg # subtract mean (num... | |
bc857e06d5f464647bb0297006975f4132dbea8d | link_analysis/experiment_parser_temp_big.py | link_analysis/experiment_parser_temp_big.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Niklas Hauser
# All rights reserved.
#
# The file is part of my bachelor thesis and is released under the 3-clause BSD
# license. See the file `LICENSE` for the full license governing this code.
# -------------------------------------------------------... | Add log splitter for 8mote experiment. | Add log splitter for 8mote experiment. | Python | bsd-2-clause | salkinium/bachelor,salkinium/bachelor,salkinium/bachelor | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (c) 2014, Niklas Hauser
+# All rights reserved.
+#
+# The file is part of my bachelor thesis and is released under the 3-clause BSD
+# license. See the file `LICENSE` for the full license governing this code.
+# --------------------... | |
b0a0154b93cf536ece580ba96fdf3251788c29dc | src/tests/test_reduce_framerate.py | src/tests/test_reduce_framerate.py | try:
from unittest import mock
except ImportError:
import mock
from sensor_msgs.msg import Image
from reduce_framerate import FramerateReducer
def test_callback():
r = FramerateReducer()
with mock.patch.object(r, "image_publisher", autospec=True) as mock_pub:
for i in range(16):
... | Write test for reduced framerate. | Write test for reduced framerate.
| Python | mit | masasin/spirit,masasin/spirit | ---
+++
@@ -0,0 +1,16 @@
+try:
+ from unittest import mock
+except ImportError:
+ import mock
+
+from sensor_msgs.msg import Image
+
+from reduce_framerate import FramerateReducer
+
+
+def test_callback():
+ r = FramerateReducer()
+ with mock.patch.object(r, "image_publisher", autospec=True) as mock_pub:
... | |
3a436f9345a8b6773ddac4198b33be563b66113d | Tools/set_source_default_svnprops.py | Tools/set_source_default_svnprops.py | #
# Run in source directory to change all file eol-style's
#
import os, sys, os.path
pj = os.path.join
def isSourceFile(fname):
if fname in ["SConstruct","SConscript","build.info"]:
return True
ext = os.path.splitext(fname)[1]
return ext in [".c",".cpp",".h",".inl",".ins",".fcd",".yy",".ll",".py"]
def... | Add script to set default svn properties on source files. | Add script to set default svn properties on source files.
git-svn-id: 6c7e10cdde2c115f53707ba8ec4efe535f92d362@263 4683daeb-ad0f-0410-a623-93161e962ae5
| Python | lgpl-2.1 | jondo2010/OpenSG,jondo2010/OpenSG,jondo2010/OpenSG,jondo2010/OpenSG,jondo2010/OpenSG | ---
+++
@@ -0,0 +1,46 @@
+#
+# Run in source directory to change all file eol-style's
+#
+
+import os, sys, os.path
+pj = os.path.join
+
+def isSourceFile(fname):
+ if fname in ["SConstruct","SConscript","build.info"]:
+ return True
+ ext = os.path.splitext(fname)[1]
+ return ext in [".c",".cpp",".h",".inl... | |
4fb4ce10862ad03bb889b6e8deae4a1e09a9685c | tests/test_depthmap.py | tests/test_depthmap.py | from __future__ import division, absolute_import, print_function
from past.builtins import xrange
import unittest
import numpy.testing as testing
import numpy as np
import healpy as hp
import fitsio
from redmapper import DepthMap
from redmapper import Configuration
class DepthMapTestCase(unittest.TestCase):
def ... | Test for reading the depth map | Test for reading the depth map
| Python | apache-2.0 | erykoff/redmapper,erykoff/redmapper | ---
+++
@@ -0,0 +1,53 @@
+from __future__ import division, absolute_import, print_function
+from past.builtins import xrange
+
+import unittest
+import numpy.testing as testing
+import numpy as np
+import healpy as hp
+import fitsio
+
+from redmapper import DepthMap
+from redmapper import Configuration
+
+class Depth... | |
c881dbef22ac7ca26ad6abceb3c2e02d0b759040 | yutu/bot.py | yutu/bot.py | import discord
from discord.ext import commands
from pony import orm
DESCRIPTION = """
Hi, I'm Yutu!
I'm the bot for the Velvet fan discord.
I'm still learning so sorry if I do something wrong.
You can ask my programmer @Harkonen if you want to know more about me.
"""
class Yutu(commands.Bot):
def __init__(self)... | import discord
from discord.ext import commands
from pony import orm
DESCRIPTION = """
Hi, I'm Yutu!
I'm the bot for the Velvet fan discord.
I'm still learning so sorry if I do something wrong.
You can ask my programmer @Harkonen if you want to know more about me.
"""
class Yutu(commands.Bot):
def __init__(self)... | Make Yutu acknowledge pm'ed help commands | Make Yutu acknowledge pm'ed help commands
| Python | mit | HarkonenBade/yutu | ---
+++
@@ -17,6 +17,10 @@
description=DESCRIPTION,
pm_help=None)
self.db = orm.Database()
+ self.get_command('help').after_invoke(self.post_help)
+
+ async def post_help(self, ctx: commands.Context):
+ await ctx.message.add_reaction("✅")
... |
868c9bf69a04be5aa62d0796daf8dc0e06b2401f | lumisAndFiles.py | lumisAndFiles.py | #!/usr/bin/env python
# Before running:
# source /cvmfs/cms.cern.ch/crab3/crab.sh
import pprint
from dbs.apis.dbsClient import DbsApi
url="https://cmsweb.cern.ch/dbs/prod/global/DBSReader"
api=DbsApi(url=url)
f = api.listFiles(run_num='296075', dataset='/ExpressPhysics/Run2017A-Express-v1/FEVT')
lumis = [api.listFil... | Add lumi for file for dataset tool | Add lumi for file for dataset tool
| Python | mit | rovere/utilities,rovere/utilities,rovere/utilities,rovere/utilities | ---
+++
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+
+# Before running:
+# source /cvmfs/cms.cern.ch/crab3/crab.sh
+
+import pprint
+from dbs.apis.dbsClient import DbsApi
+
+url="https://cmsweb.cern.ch/dbs/prod/global/DBSReader"
+api=DbsApi(url=url)
+f = api.listFiles(run_num='296075', dataset='/ExpressPhysics/Run2017A-... | |
6c1f5364a3a8862b54121ab28ade5d41c101c056 | landlab/_info.py | landlab/_info.py | version = '1.0.2'
name = 'landlab'
cite_as = [
"""@article{hobley2017creative,
title={Creative computing with Landlab: an open-source toolkit
for building, coupling, and exploring two-dimensional
numerical models of Earth-surface dynamics},
author={Hobley, Daniel EJ and Adams, Jordan M and N... | Add private module with landlab info. | Add private module with landlab info.
| Python | mit | landlab/landlab,landlab/landlab,cmshobe/landlab,amandersillinois/landlab,cmshobe/landlab,amandersillinois/landlab,landlab/landlab,cmshobe/landlab | ---
+++
@@ -0,0 +1,18 @@
+version = '1.0.2'
+name = 'landlab'
+cite_as = [
+ """@article{hobley2017creative,
+ title={Creative computing with Landlab: an open-source toolkit
+ for building, coupling, and exploring two-dimensional
+ numerical models of Earth-surface dynamics},
+ author={Hobley, ... | |
d6050249f44304813d2bba120f9c232c0f158a34 | bioagents/tests/test_model_diagnoser.py | bioagents/tests/test_model_diagnoser.py | from indra.statements import *
from bioagents.mra.model_diagnoser import ModelDiagnoser
drug = Agent('PLX4720')
raf = Agent('RAF')
mek = Agent('MEK')
erk = Agent('ERK')
def test_missing_activity1():
stmts = [Activation(raf, mek), Phosphorylation(mek, erk)]
md = ModelDiagnoser(stmts)
suggs = md.get_missing... | Test suggestions for missing activity | Test suggestions for missing activity
| Python | bsd-2-clause | bgyori/bioagents,sorgerlab/bioagents | ---
+++
@@ -0,0 +1,33 @@
+from indra.statements import *
+from bioagents.mra.model_diagnoser import ModelDiagnoser
+
+drug = Agent('PLX4720')
+raf = Agent('RAF')
+mek = Agent('MEK')
+erk = Agent('ERK')
+
+def test_missing_activity1():
+ stmts = [Activation(raf, mek), Phosphorylation(mek, erk)]
+ md = ModelDiagn... | |
c9b844ca7a5693de59cca2e4c3d5e1cdf4b13270 | py/detect-capital.py | py/detect-capital.py | class Solution(object):
def detectCapitalUse(self, word):
"""
:type word: str
:rtype: bool
"""
if word.islower():
return True
if word.isupper():
return True
if word[1:].islower():
return True
return False
| Add py solution for 520. Detect Capital | Add py solution for 520. Detect Capital
520. Detect Capital: https://leetcode.com/problems/detect-capital/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,13 @@
+class Solution(object):
+ def detectCapitalUse(self, word):
+ """
+ :type word: str
+ :rtype: bool
+ """
+ if word.islower():
+ return True
+ if word.isupper():
+ return True
+ if word[1:].islower():
+ retur... | |
427ee2412af3143b3808e18a26ed2079b510ee43 | tests/webcam_read_qr.py | tests/webcam_read_qr.py | #!/usr/bin/env python
"""
This module sets up a video stream from internal or connected webcam using Gstreamer.
You can then take snapshots.
import qrtools
qr = qrtools.QR()
qr.decode("cam.jpg")
print qr.data
"""
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gst', '1.0')
from gi.repository import Gt... | Put gst code into Avocado test format. Needs to be edited to take a snapshot and read the qr code. | Put gst code into Avocado test format. Needs to be edited to take a snapshot and read the qr code.
| Python | mit | daveol/Fedora-Test-Laptop,daveol/Fedora-Test-Laptop | ---
+++
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+
+"""
+This module sets up a video stream from internal or connected webcam using Gstreamer.
+You can then take snapshots.
+
+import qrtools
+qr = qrtools.QR()
+qr.decode("cam.jpg")
+print qr.data
+
+"""
+import gi
+gi.require_version('Gtk', '3.0')
+gi.require_version(... | |
26a66b90f3e1a63ae91eb2eac08a580b4be6a3c4 | counting/mapper.py | counting/mapper.py | from contextlib import closing
import subprocess
import logging
import do
logger = logging.getLogger("Main")
def g37_map(out_fn):
url_map = "http://ftp.ncbi.nlm.nih.gov/genomes/Homo_sapiens/ARCHIVE/ANNOTATION_RELEASE.105/Assembled_chromosomes/chr_accessions_GRCh37.p13"
url_ann = "http://ftp.ncbi.nlm.nih.gov/... | Add smart functions to get the correct gene annotation | Add smart functions to get the correct gene annotation
| Python | cc0-1.0 | NCBI-Hackathons/rnaseqview,NCBI-Hackathons/rnaseqview,NCBI-Hackathons/rnaseqview,NCBI-Hackathons/rnaseqview,NCBI-Hackathons/rnaseqview | ---
+++
@@ -0,0 +1,42 @@
+from contextlib import closing
+import subprocess
+import logging
+
+import do
+
+logger = logging.getLogger("Main")
+
+def g37_map(out_fn):
+ url_map = "http://ftp.ncbi.nlm.nih.gov/genomes/Homo_sapiens/ARCHIVE/ANNOTATION_RELEASE.105/Assembled_chromosomes/chr_accessions_GRCh37.p13"
+ u... | |
fe4f86b9635fadd6a0c79065e4c9888327e31b80 | DeleteDataFromUrlTest.py | DeleteDataFromUrlTest.py | __author__ = 'chuqiao'
import script
# DELETE ALL DATA
script.deleteDataInSolr()
# ADD DATA FROM 2 SORCES
script.addDataToSolrFromUrl("http://www.elixir-europe.org:8080/events", "http://www.elixir-europe.org:8080/events");
script.addDataToSolrFromUrl("http://localhost/ep/events?state=published&field_type_tid=All", "htt... | Create delete data from url test script | Create delete data from url test script
| Python | mit | elixirhub/events-portal-scraping-scripts | ---
+++
@@ -0,0 +1,12 @@
+__author__ = 'chuqiao'
+import script
+# DELETE ALL DATA
+script.deleteDataInSolr()
+# ADD DATA FROM 2 SORCES
+script.addDataToSolrFromUrl("http://www.elixir-europe.org:8080/events", "http://www.elixir-europe.org:8080/events");
+script.addDataToSolrFromUrl("http://localhost/ep/events?state=p... | |
b88118fb323625f0571961b7f8ac40294c85b741 | examples/volume_by_process_example.py | examples/volume_by_process_example.py | """
Mutes the volume of all processes, but unmutes chrome.exe process.
"""
from pycaw import AudioUtilities
def main():
sessions = AudioUtilities.GetAllSessions()
for session in sessions:
volume = session.SimpleAudioVolume
if session.Process and session.Process.name() == "chrome.exe":
... | Change volume per process example | Change volume per process example
Mutes the volume of all processes, but unmutes chrome.exe process.
| Python | mit | AndreMiras/pycaw | ---
+++
@@ -0,0 +1,18 @@
+"""
+Mutes the volume of all processes, but unmutes chrome.exe process.
+"""
+from pycaw import AudioUtilities
+
+
+def main():
+ sessions = AudioUtilities.GetAllSessions()
+ for session in sessions:
+ volume = session.SimpleAudioVolume
+ if session.Process and session.Pr... | |
e50d37fb89fc9bd80499b2db282afa310965017d | tests/unit/boundary/measurement_get_test.py | tests/unit/boundary/measurement_get_test.py | #!/usr/bin/env python
#
# Copyright 2014-2015 Boundary, 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 applica... | Add test class for MeasurementGet | Add test class for MeasurementGet
| Python | apache-2.0 | boundary/pulse-api-cli,jdgwartney/boundary-api-cli,boundary/pulse-api-cli,boundary/boundary-api-cli,jdgwartney/boundary-api-cli,jdgwartney/pulse-api-cli,boundary/boundary-api-cli,wcainboundary/boundary-api-cli,jdgwartney/pulse-api-cli,wcainboundary/boundary-api-cli | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+#
+# Copyright 2014-2015 Boundary, 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/LICENS... | |
a993765b8ebb02baf64c3fdd13406734f8ae9136 | print_results.py | print_results.py | from __future__ import division
import argparse
import h5py
def main():
parser = argparse.ArgumentParser()
parser.add_argument('results_hdf5_fname', type=str)
parser.add_argument('dset_keys', nargs='*', type=str, default=[])
args = parser.parse_args()
f = h5py.File(args.results_hdf5_fname, 'r')
... | Add script to print results. | Add script to print results.
| Python | mit | alexlee-gk/visual_dynamics | ---
+++
@@ -0,0 +1,26 @@
+from __future__ import division
+
+import argparse
+import h5py
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('results_hdf5_fname', type=str)
+ parser.add_argument('dset_keys', nargs='*', type=str, default=[])
+
+ args = parser.parse_args()
+
+ f = ... | |
dbfdeea5f080c444a4d4abf6bdf81632bbab917a | IPython/core/tests/test_shellapp.py | IPython/core/tests/test_shellapp.py | # -*- coding: utf-8 -*-
"""Tests for shellapp module.
Authors
-------
* Bradley Froehle
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2012 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING... | Add test for `__file__` behavior in `ipython <file>` | Add test for `__file__` behavior in `ipython <file>`
| Python | bsd-3-clause | ipython/ipython,ipython/ipython | ---
+++
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+"""Tests for shellapp module.
+
+Authors
+-------
+* Bradley Froehle
+"""
+#-----------------------------------------------------------------------------
+# Copyright (C) 2012 The IPython Development Team
+#
+# Distributed under the terms of the BSD License. The ... | |
4486009178284e83fdcae7b7a6e6b755a74f22a7 | alg_cartesian_product.py | alg_cartesian_product.py | """Cartesian product of same numbers with repeated times."""
class CartesianProduct(object):
def _product_two(self, nums1, nums2):
two_products = []
for i in range(len(nums1)):
for j in range(len(nums2)):
if isinstance(nums1[0], list):
# nums1[i] is ... | Complete cartesian product for repeated | Complete cartesian product for repeated
| Python | bsd-2-clause | bowen0701/algorithms_data_structures | ---
+++
@@ -0,0 +1,36 @@
+"""Cartesian product of same numbers with repeated times."""
+
+class CartesianProduct(object):
+ def _product_two(self, nums1, nums2):
+ two_products = []
+
+ for i in range(len(nums1)):
+ for j in range(len(nums2)):
+ if isinstance(nums1[0], list)... | |
d18d85f85f91440a886969bdbd20bf4578e6b9e7 | tests/devices_test/stratis_test.py | tests/devices_test/stratis_test.py | import test_compat # pylint: disable=unused-import
import unittest
import blivet
from blivet.devices import StorageDevice
from blivet.devices import StratisPoolDevice
from blivet.devices import StratisFilesystemDevice
from blivet.size import Size
DEVICE_CLASSES = [
StratisPoolDevice,
StratisFilesystemDevi... | Add simple test case for Stratis | Add simple test case for Stratis
| Python | lgpl-2.1 | vojtechtrefny/blivet,rvykydal/blivet,vojtechtrefny/blivet,rvykydal/blivet | ---
+++
@@ -0,0 +1,37 @@
+import test_compat # pylint: disable=unused-import
+
+import unittest
+
+import blivet
+
+from blivet.devices import StorageDevice
+from blivet.devices import StratisPoolDevice
+from blivet.devices import StratisFilesystemDevice
+from blivet.size import Size
+
+
+DEVICE_CLASSES = [
+ Str... | |
e412a68afe691913525245d2a8a3a8e9e3ba532d | python/xicore.py | python/xicore.py | #!/usr/bin/env python
# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | #!/usr/bin/env python
# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | Replace tab indentation with 4 spaces | Replace tab indentation with 4 spaces | Python | apache-2.0 | google/xi-editor,google/xi-editor,fuchsia-mirror/third_party-xi-editor,modelorganism/xi-editor,modelorganism/xi-editor,fuchsia-mirror/third_party-xi-editor,fuchsia-mirror/third_party-xi-editor,google/xi-editor,google/xi-editor,fuchsia-mirror/third_party-xi-editor,modelorganism/xi-editor | ---
+++
@@ -19,9 +19,9 @@
import json
def sendraw(buf):
- sys.stdout.write(struct.pack("<q", len(buf)))
- sys.stdout.write(buf)
- sys.stdout.flush()
+ sys.stdout.write(struct.pack("<q", len(buf)))
+ sys.stdout.write(buf)
+ sys.stdout.flush()
def send(obj):
sendraw(json.dumps(obj)) |
c5433454a14f4dd6c3d84735e920144914ca6f2d | salt/beacons/twilio_txt_msg.py | salt/beacons/twilio_txt_msg.py | # -*- coding: utf-8 -*-
'''
Beacon to emit Twilio text messages
'''
# Import Python libs
from __future__ import absolute_import
from datetime import datetime
import logging
# Import 3rd Party libs
try:
from twilio.rest import TwilioRestClient
HAS_TWILIO = True
except ImportError:
HAS_TWILIO = False
log =... | Add Twilio text message beacon | Add Twilio text message beacon
This beacon will poll a Twilio account for text messages
and emit an event on Salt's event bus as texts are received.
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+'''
+Beacon to emit Twilio text messages
+'''
+
+# Import Python libs
+from __future__ import absolute_import
+from datetime import datetime
+import logging
+
+# Import 3rd Party libs
+try:
+ from twilio.rest import TwilioRestClient
+ HAS_TWILIO = True
+except ... | |
70705f896aa5f45c6365f9c584982289b0711030 | tools/extract_from_multialign.py | tools/extract_from_multialign.py | #
# Copyright (c) 2017 Tuukka Norri
# This code is licensed under MIT license (see LICENSE for details).
#
import argparse
import os
import sys
# Read from file into a buffer.
# Used the idea from https://stackoverflow.com/a/26209275/856976
def chunks(fp, bufsize):
while True:
chunk = fp.read(bufsize)
if not ch... | Add a tool for extracting subsequences from vcf2multialign output | Add a tool for extracting subsequences from vcf2multialign output
| Python | mit | tsnorri/vcf2multialign,tsnorri/vcf2multialign,tsnorri/vcf2multialign,tsnorri/vcf2multialign | ---
+++
@@ -0,0 +1,76 @@
+#
+# Copyright (c) 2017 Tuukka Norri
+# This code is licensed under MIT license (see LICENSE for details).
+#
+
+import argparse
+import os
+import sys
+
+# Read from file into a buffer.
+# Used the idea from https://stackoverflow.com/a/26209275/856976
+def chunks(fp, bufsize):
+ while True... | |
a4e77ce700a1d54d97dd9ddd4de73e5bfb6edf61 | Python/189_Rotate_Array.py | Python/189_Rotate_Array.py | class Solution(object):
def rotate(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: void Do not return anything, modify nums in-place instead.
"""
for i in xrange(k):
nums.insert(0,nums.pop())
if __name__ == '__main__':
nums = [-1,2,3,4,5]
k... | Add two methods for rotating an array. | Add two methods for rotating an array.
| Python | mit | comicxmz001/LeetCode,comicxmz001/LeetCode | ---
+++
@@ -0,0 +1,16 @@
+class Solution(object):
+ def rotate(self, nums, k):
+ """
+ :type nums: List[int]
+ :type k: int
+ :rtype: void Do not return anything, modify nums in-place instead.
+ """
+ for i in xrange(k):
+ nums.insert(0,nums.pop())
+
+
+if __name__... | |
9c9cdd1f1979aa880726fc0039255ed7f7ea2f6d | tests/test_simpleflow/swf/test_task.py | tests/test_simpleflow/swf/test_task.py | from sure import expect
from simpleflow import activity
from simpleflow.swf.task import ActivityTask
@activity.with_attributes()
def show_context_func():
return show_context_func.context
@activity.with_attributes()
class ShowContextCls(object):
def execute(self):
return self.context
def test_tas... | Add tests to ensure ActivityTask attaches the context | Add tests to ensure ActivityTask attaches the context
| Python | mit | botify-labs/simpleflow,botify-labs/simpleflow | ---
+++
@@ -0,0 +1,33 @@
+from sure import expect
+
+from simpleflow import activity
+from simpleflow.swf.task import ActivityTask
+
+
+
+@activity.with_attributes()
+def show_context_func():
+ return show_context_func.context
+
+
+@activity.with_attributes()
+class ShowContextCls(object):
+ def execute(self):
... | |
6594eee668a563d73237669b0dd05a84fbe1e5fb | zooq_main.py | zooq_main.py | #!/usr/bin/env python3
#
#
from zooq import ZooQ
from zooqdb_sqlite import ZooQDB_SQLite
import time
from argparse import ArgumentParser
ap = ArgumentParser(description="Example main service for a ZooQ")
ap.add_argument('-d', '--dir', required=False, default='.', action='store',
help='Root folder for Z... | Add args to main code, and make executable | Add args to main code, and make executable
| Python | mit | ckane/zooq,ckane/zooq | ---
+++
@@ -0,0 +1,24 @@
+#!/usr/bin/env python3
+#
+#
+from zooq import ZooQ
+from zooqdb_sqlite import ZooQDB_SQLite
+import time
+from argparse import ArgumentParser
+
+ap = ArgumentParser(description="Example main service for a ZooQ")
+ap.add_argument('-d', '--dir', required=False, default='.', action='store',
+ ... | |
9e1b9086fb699fa79c38d3f57f2ea76d3ea9d09c | Python/232_ImplementStackUsingQueue.py | Python/232_ImplementStackUsingQueue.py | class Stack(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.__queue = []
def push(self, x):
"""
:type x: int
:rtype: nothing
"""
self.__queue.append(x)
def pop(self):
"""
:rtype: nothing
... | Add solution for 232, implement stack using queue.? | Add solution for 232, implement stack using queue.?
| Python | mit | comicxmz001/LeetCode,comicxmz001/LeetCode | ---
+++
@@ -0,0 +1,53 @@
+class Stack(object):
+ def __init__(self):
+ """
+ initialize your data structure here.
+ """
+ self.__queue = []
+
+ def push(self, x):
+ """
+ :type x: int
+ :rtype: nothing
+ """
+ self.__queue.append(x)
+
+ def pop(s... | |
f2cbc1a1b23f182730ccc5f4fc9f71ad15f3e188 | conda_env/specs/yaml_file.py | conda_env/specs/yaml_file.py | from .. import env
from ..exceptions import EnvironmentFileNotFound
class YamlFileSpec(object):
_environment = None
def __init__(self, filename=None, **kwargs):
self.filename = filename
self.msg = None
def can_handle(self):
try:
self._environment = env.from_file(self.... | from .. import env
from ..exceptions import EnvironmentFileNotFound
class YamlFileSpec(object):
_environment = None
def __init__(self, filename=None, **kwargs):
self.filename = filename
self.msg = None
def can_handle(self):
try:
self._environment = env.from_file(self.... | Fix exception to work with py3 | Fix exception to work with py3
| Python | bsd-3-clause | mikecroucher/conda-env,mikecroucher/conda-env,dan-blanchard/conda-env,conda/conda-env,phobson/conda-env,conda/conda-env,isaac-kit/conda-env,nicoddemus/conda-env,nicoddemus/conda-env,asmeurer/conda-env,ESSS/conda-env,asmeurer/conda-env,dan-blanchard/conda-env,isaac-kit/conda-env,phobson/conda-env,ESSS/conda-env | ---
+++
@@ -14,7 +14,7 @@
self._environment = env.from_file(self.filename)
return True
except EnvironmentFileNotFound as e:
- self.msg = e.message
+ self.msg = str(e)
return False
@property |
65a156201dc91b54d8edd7d45689eb920ec0dbe3 | UnitaryTests/SCardGetStatusChange2.py | UnitaryTests/SCardGetStatusChange2.py | #! /usr/bin/env python
# SCardGetStatusChange2.py : Unitary test for SCardGetStatusChange()
# Copyright (C) 2011 Ludovic Rousseau
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; ei... | Check the return value of SCardGetStatusChange() for unknown readers | Check the return value of SCardGetStatusChange() for unknown readers
git-svn-id: f2d781e409b7e36a714fc884bb9b2fc5091ddd28@5882 0ce88b0d-b2fd-0310-8134-9614164e65ea
| Python | bsd-3-clause | vicamo/pcsc-lite-android,vicamo/pcsc-lite-android,vicamo/pcsc-lite-android,vicamo/pcsc-lite-android,vicamo/pcsc-lite-android | ---
+++
@@ -0,0 +1,50 @@
+#! /usr/bin/env python
+
+# SCardGetStatusChange2.py : Unitary test for SCardGetStatusChange()
+# Copyright (C) 2011 Ludovic Rousseau
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+#... | |
779f9868cd348cdbe24255d52bc2ce21c4ca85bd | Tests/test_process2.py | Tests/test_process2.py |
"""
Test 2
======
- Separation between Mscthesis and pySpatialTools
"""
## Mscthesis application
##########################
from Mscthesis.IO.clean_module import clean
from Mscthesis.IO import Firms_Parser
from Mscthesis.Preprocess import Firms_Preprocessor
## Define parameters and info needed
logfile = 'Data/Output... | Test for the whole process with separated modules. | Test for the whole process with separated modules.
| Python | mit | tgquintela/Mscthesis | ---
+++
@@ -0,0 +1,73 @@
+
+"""
+Test 2
+======
+- Separation between Mscthesis and pySpatialTools
+"""
+
+## Mscthesis application
+##########################
+from Mscthesis.IO.clean_module import clean
+from Mscthesis.IO import Firms_Parser
+from Mscthesis.Preprocess import Firms_Preprocessor
+
+## Define paramete... | |
59d92d862d5e744a11a59b41ca8e01acd6c2b105 | tests/test_command_cluster.py | tests/test_command_cluster.py | import os
import tempfile
from buddy.command.cluster import cli
import pytest
import vcr
import yaml
import boto3
def teardown():
ecs_client = boto3.client('ecs')
ecs_client.delete_service(cluster='CLUSTERNAME', service='SERVICENAME')
ecs_client.delete_cluster(cluster='CLUSTERNAME')
def setup():
ec... | Add a test for cluster command using VCR | Add a test for cluster command using VCR
| Python | mit | pior/buddy | ---
+++
@@ -0,0 +1,111 @@
+import os
+import tempfile
+
+from buddy.command.cluster import cli
+import pytest
+import vcr
+import yaml
+import boto3
+
+
+def teardown():
+ ecs_client = boto3.client('ecs')
+ ecs_client.delete_service(cluster='CLUSTERNAME', service='SERVICENAME')
+ ecs_client.delete_cluster(cl... | |
804a91299c97a8008633d6e61b68b7923c804152 | lesion/stats.py | lesion/stats.py | """
Compute statistics from linear traces of embryos. The most basic
statistic is min/max, but others will be compiled here.
"""
import numpy as np
from scipy import ndimage as nd
def min_max(tr):
"""Return the ratio of minimum to maximum of a trace.
Parameters
----------
tr : 1D array of float
... | Add statistics computation from traces | Add statistics computation from traces
| Python | bsd-3-clause | jni/lesion | ---
+++
@@ -0,0 +1,54 @@
+"""
+Compute statistics from linear traces of embryos. The most basic
+statistic is min/max, but others will be compiled here.
+"""
+
+import numpy as np
+from scipy import ndimage as nd
+
+
+def min_max(tr):
+ """Return the ratio of minimum to maximum of a trace.
+
+ Parameters
+ -... | |
268f9c7d7354fef5a87b8a56282aad617c5953f4 | ci/copy-release.py | ci/copy-release.py | #!/usr/bin/env python3
import os
import pathlib
import sys
import boto3
import requests
tag_name = os.environ.get("TAG_NAME")
dcos_version = os.environ.get("DCOS_VERSION")
if not tag_name:
print("Missing TAG_NAME.", file=sys.stderr)
sys.exit(1)
if not dcos_version:
print("Missing DCOS_VERSION.", file=s... | Add a CI script to copy the CLI release | Add a CI script to copy the CLI release
This moves the script out of the core CLI.
https://github.com/dcos/dcos-core-cli/pull/66
https://jira.mesosphere.com/browse/DCOS_OSS-4278
| Python | apache-2.0 | kensipe/dcos-cli,dcos/dcos-cli,dcos/dcos-cli,kensipe/dcos-cli,dcos/dcos-cli,dcos/dcos-cli,kensipe/dcos-cli,dcos/dcos-cli,kensipe/dcos-cli,kensipe/dcos-cli | ---
+++
@@ -0,0 +1,61 @@
+#!/usr/bin/env python3
+
+import os
+import pathlib
+import sys
+
+import boto3
+import requests
+
+tag_name = os.environ.get("TAG_NAME")
+dcos_version = os.environ.get("DCOS_VERSION")
+
+if not tag_name:
+ print("Missing TAG_NAME.", file=sys.stderr)
+ sys.exit(1)
+
+if not dcos_versio... | |
fb3fc2bd34fd9ad8f5e8ad088fb1db35a1a1ceb6 | chrome/browser/extensions/PRESUBMIT.py | chrome/browser/extensions/PRESUBMIT.py | # Copyright (c) 2011 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.
"""Chromium presubmit script for src/chrome/browser/extensions.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more det... | Add aura compile testing by default to likely areas (4). | Add aura compile testing by default to likely areas (4).
BUG=chromium:107599
TEST=None
Review URL: http://codereview.chromium.org/8907044
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@114847 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | adobe/chromium,ropik/chromium,gavinp/chromium,adobe/chromium,ropik/chromium,ropik/chromium,yitian134/chromium,yitian134/chromium,gavinp/chromium,gavinp/chromium,adobe/chromium,gavinp/chromium,ropik/chromium,gavinp/chromium,ropik/chromium,adobe/chromium,yitian134/chromium,yitian134/chromium,yitian134/chromium,adobe/chro... | ---
+++
@@ -0,0 +1,12 @@
+# Copyright (c) 2011 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.
+
+"""Chromium presubmit script for src/chrome/browser/extensions.
+
+See http://dev.chromium.org/developers/how-tos/depotto... | |
5da5b3426ab6134d1a2e08ce5b57a63a32493178 | prototypes/nrel_polymer_converter.py | prototypes/nrel_polymer_converter.py | #!/usr/bin/env python
import sys
import os
import json
def main(argv):
path = len(argv) == 2 and os.path.dirname(argv[0]) or "/Users/mo/Documents/MDF"
filename = len(argv) == 2 and os.path.basename(argv[0]) or "NREL_polymer_export.txt"
output = len(argv) == 2 and argv[1] or "NREL_polymer_output.txt"
... | Read line by line from the NREL polymer text file and create list of dictionaries using the header keys. | Read line by line from the NREL polymer text file and create list of dictionaries using the header keys. | Python | apache-2.0 | materials-data-facility/forge | ---
+++
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+
+import sys
+import os
+import json
+
+
+def main(argv):
+ path = len(argv) == 2 and os.path.dirname(argv[0]) or "/Users/mo/Documents/MDF"
+ filename = len(argv) == 2 and os.path.basename(argv[0]) or "NREL_polymer_export.txt"
+ output = len(argv) == 2 and arg... | |
7946b8fe8a8cddeef675cc60b5ebb64a250ea2c4 | smugmug_test.py | smugmug_test.py | import smugmug
import unittest
class MockNode(object):
def __init__(self):
self._reset_times = 0
def reset_cache(self):
self._reset_times += 1
class TestChildCacheGarbageCollector(unittest.TestCase):
def test_clears_child_cache(self):
gc = smugmug.ChildCacheGarbageCollector(3)
nodes = [MockNo... | Add a unit test for the ChildCacheGarbageColleector class. | Add a unit test for the ChildCacheGarbageColleector class.
| Python | mit | graveljp/smugcli | ---
+++
@@ -0,0 +1,40 @@
+import smugmug
+import unittest
+
+class MockNode(object):
+ def __init__(self):
+ self._reset_times = 0
+
+ def reset_cache(self):
+ self._reset_times += 1
+
+
+class TestChildCacheGarbageCollector(unittest.TestCase):
+
+ def test_clears_child_cache(self):
+ gc = smugmug.ChildCa... | |
27d9b013f05d3fb2ef3cfdfe23af506743fb12ed | tests/test_ast.py | tests/test_ast.py | import unittest
import sure
from compiler import parse, lex, error, ast, type
class TestAST(unittest.TestCase):
def test_eq(self):
ast.Constructor("foo", []).should.be.equal(ast.Constructor("foo", []))
ast.Constructor("foo", []).shouldnt.be.equal(ast.Constructor("bar", []))
| Add an example test checking that ast equality works | Add an example test checking that ast equality works
| Python | mit | dionyziz/llama,Renelvon/llama,Renelvon/llama,dionyziz/llama | ---
+++
@@ -0,0 +1,11 @@
+import unittest
+
+import sure
+
+from compiler import parse, lex, error, ast, type
+
+
+class TestAST(unittest.TestCase):
+ def test_eq(self):
+ ast.Constructor("foo", []).should.be.equal(ast.Constructor("foo", []))
+ ast.Constructor("foo", []).shouldnt.be.equal(ast.Constru... | |
b2bcbcedccffba4dce7b5c2d391de6444520f177 | devil/devil/utils/signal_handler.py | devil/devil/utils/signal_handler.py | # Copyright 2016 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.
import contextlib
import signal
@contextlib.contextmanager
def AddSignalHandler(signalnum, additional_handler):
"""Adds a signal handler for the given si... | Add signal handler context manager. | [devil] Add signal handler context manager.
BUG=chromium:620723
Review-Url: https://codereview.chromium.org/2069133005
| Python | bsd-3-clause | sahiljain/catapult,catapult-project/catapult-csm,sahiljain/catapult,catapult-project/catapult-csm,benschmaus/catapult,catapult-project/catapult-csm,benschmaus/catapult,catapult-project/catapult,sahiljain/catapult,catapult-project/catapult,catapult-project/catapult-csm,benschmaus/catapult,catapult-project/catapult,bensc... | ---
+++
@@ -0,0 +1,30 @@
+# Copyright 2016 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.
+
+import contextlib
+import signal
+
+
+@contextlib.contextmanager
+def AddSignalHandler(signalnum, additional_handler):
+ """... | |
b2b75a41f661b7945a3e1bca632aef13e8a9a70d | src/reviews/migrations/0010_auto_20160319_0758.py | src/reviews/migrations/0010_auto_20160319_0758.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-03-19 07:58
from __future__ import unicode_literals
from django.db import migrations
def migrate_score(apps, schema_editor):
Review = apps.get_model('reviews', 'Review')
Review.objects.filter(score=2).update(vote='+1')
Review.objects.filter(scor... | Add data migrations for vote | Add data migrations for vote
| Python | mit | pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016 | ---
+++
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.3 on 2016-03-19 07:58
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+def migrate_score(apps, schema_editor):
+ Review = apps.get_model('reviews', 'Review')
+ Review.objects.filter(score=2).update(vote... | |
5df378c356d22cd1e668ba8e591ef61bb2da324b | plugins/CoD_MW3.py | plugins/CoD_MW3.py | import os
from lib.base_plugin import BasePlugin
from lib.paths import SteamGamesPath
class CoDMW3Plugin(BasePlugin):
Name = "Call of Duty: Modern Warfare 3"
support_os = ["Windows"]
def backup(self, _):
_.add_folder('Profiles', os.path.join(SteamGamesPath, 'call of duty modern warfare 3'), 'play... | Call of Duty: Modern Warfare 3 plugin | Call of Duty: Modern Warfare 3 plugin
| Python | mit | Pr0Ger/SGSB | ---
+++
@@ -0,0 +1,19 @@
+import os
+from lib.base_plugin import BasePlugin
+from lib.paths import SteamGamesPath
+
+
+class CoDMW3Plugin(BasePlugin):
+ Name = "Call of Duty: Modern Warfare 3"
+ support_os = ["Windows"]
+
+ def backup(self, _):
+ _.add_folder('Profiles', os.path.join(SteamGamesPath, '... | |
c365bbd6cb1dad50a2084356e6f1ba3fa4575d00 | fpsd/test/test_evaluation.py | fpsd/test/test_evaluation.py | import unittest
from evaluation import precision_recall_at_x_proportion
class EvaluationTest(unittest.TestCase):
"""Most evaluation methods are from scikit-learn and are thus tested
however some of our preprocessing is custom and should be tested"""
def test_precision_recall_f1_perfect(self):
te... | Add tests for custom evaluation code | Add tests for custom evaluation code
| Python | agpl-3.0 | freedomofpress/fingerprint-securedrop,freedomofpress/FingerprintSecureDrop,freedomofpress/fingerprint-securedrop,freedomofpress/fingerprint-securedrop,freedomofpress/FingerprintSecureDrop | ---
+++
@@ -0,0 +1,35 @@
+import unittest
+
+from evaluation import precision_recall_at_x_proportion
+
+
+class EvaluationTest(unittest.TestCase):
+ """Most evaluation methods are from scikit-learn and are thus tested
+ however some of our preprocessing is custom and should be tested"""
+
+ def test_precisio... | |
4a8bba2e2354ec3a73c01c8183d100254e1314df | utils/resolve-crashes.py | utils/resolve-crashes.py | #!/usr/bin/python
# A small utility to take the output of a Swift validation test run
# where some compiler crashers have been fixed, and move them into the
# "fixed" testsuite, removing the "--crash" in the process.
import re
import sys
import os
def execute_cmd(cmd):
print(cmd)
os.system(cmd)
# The regul... | Add a little utility to help update resolved crashers. | Add a little utility to help update resolved crashers.
Swift SVN r28923
| Python | apache-2.0 | shahmishal/swift,karwa/swift,devincoughlin/swift,xwu/swift,jopamer/swift,benlangmuir/swift,mightydeveloper/swift,stephentyrone/swift,dduan/swift,emilstahl/swift,dduan/swift,tkremenek/swift,shajrawi/swift,amraboelela/swift,ahoppen/swift,nathawes/swift,practicalswift/swift,kstaring/swift,parkera/swift,harlanhaskins/swift... | ---
+++
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+
+# A small utility to take the output of a Swift validation test run
+# where some compiler crashers have been fixed, and move them into the
+# "fixed" testsuite, removing the "--crash" in the process.
+
+import re
+import sys
+import os
+
+def execute_cmd(cmd):
+ pri... | |
c66eba027465779938f6ca211595982526d05cac | CodeFights/countSumOfTwoRepresentations2.py | CodeFights/countSumOfTwoRepresentations2.py | #!/usr/local/bin/python
# Code Fights Count of Two Representations 2 Problem
def countSumOfTwoRepresentations2(n, l, r):
return sum(1 for x in range(l, r + 1) if x <= n - x <= r)
def main():
tests = [
[6, 2, 4, 2],
[6, 3, 3, 1],
[10, 9, 11, 0],
[24, 8, 16, 5],
[24, 12... | Solve Code Fights sum of two representations 2 problem | Solve Code Fights sum of two representations 2 problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,32 @@
+#!/usr/local/bin/python
+# Code Fights Count of Two Representations 2 Problem
+
+
+def countSumOfTwoRepresentations2(n, l, r):
+ return sum(1 for x in range(l, r + 1) if x <= n - x <= r)
+
+
+def main():
+ tests = [
+ [6, 2, 4, 2],
+ [6, 3, 3, 1],
+ [10, 9, 11, 0],... | |
14ccbca8b2cb7318bd1dd11970cd359b36ce9b8e | corehq/apps/userreports/reports/builder/columns.py | corehq/apps/userreports/reports/builder/columns.py | class ColumnOption(object):
"""
This class represents column options in the report builder.
"""
aggregation_map = {
'simple': 'simple',
'Count per Choice': 'expand',
'Sum': 'sum',
'Average': 'avg'
}
def __init__(self, id, display, indicator_id, is_non_numeric):
... | Add classes representing column options | Add classes representing column options
We will use these instances of these classes, instead of the
DataSourceProperty named tuples to represent the available columns
in the report.
| Python | bsd-3-clause | qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,48 @@
+class ColumnOption(object):
+ """
+ This class represents column options in the report builder.
+ """
+ aggregation_map = {
+ 'simple': 'simple',
+ 'Count per Choice': 'expand',
+ 'Sum': 'sum',
+ 'Average': 'avg'
+ }
+
+ def __init__(self, id, di... | |
936523ae5212791337a852060052bc5f379ffaf7 | modules/python/test/test_copytomask.py | modules/python/test/test_copytomask.py | #!/usr/bin/env python
'''
Test for copyto with mask
'''
# Python 2/3 compatibility
from __future__ import print_function
import cv2 as cv
import numpy as np
import sys
from tests_common import NewOpenCVTests
class copytomask_test(NewOpenCVTests):
def test_copytomask(self):
img = self.get_sample('pytho... | Add python test for copyto with mask | Add python test for copyto with mask
| Python | apache-2.0 | opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+'''
+Test for copyto with mask
+'''
+
+# Python 2/3 compatibility
+from __future__ import print_function
+
+import cv2 as cv
+import numpy as np
+import sys
+
+from tests_common import NewOpenCVTests
+
+class copytomask_test(NewOpenCVTests):
+ def test_copytomask(... | |
003e1b5c25b5a5515f9938871516c8607a560643 | project/api/migrations/0002_auto_20180224_1322.py | project/api/migrations/0002_auto_20180224_1322.py | # Generated by Django 2.0.2 on 2018-02-24 21:22
from django.db import migrations
import django.db.models.manager
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AlterModelManagers(
name='member',
manage... | Complete members bypass for larger than chorus | Complete members bypass for larger than chorus
| Python | bsd-2-clause | dbinetti/barberscore-django,dbinetti/barberscore-django,barberscore/barberscore-api,dbinetti/barberscore,barberscore/barberscore-api,dbinetti/barberscore,barberscore/barberscore-api,barberscore/barberscore-api | ---
+++
@@ -0,0 +1,20 @@
+# Generated by Django 2.0.2 on 2018-02-24 21:22
+
+from django.db import migrations
+import django.db.models.manager
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('api', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterModelManagers(
+ ... | |
eea2d8de93806f19f431efff7afe66c1dfef1630 | opps/core/tests/channel_models.py | opps/core/tests/channel_models.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.contrib.sites.models import Site
from opps.core.models.channel import Channel
class ChannelModelTest(TestCase):
def setUp(self):
self.site = Site.objects.filter(name=u'example.com').get()
self.channel = C... | Create setup channel models test | Create setup channel models test
| Python | mit | williamroot/opps,jeanmask/opps,opps/opps,jeanmask/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,opps/opps,williamroot/opps,YACOWS/opps,opps/opps,opps/opps | ---
+++
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from django.test import TestCase
+from django.contrib.sites.models import Site
+
+from opps.core.models.channel import Channel
+
+
+class ChannelModelTest(TestCase):
+
+ def setUp(self):
+ self.site = Site.objects.filter(name=u'exam... | |
11aed227058304d691ed0dc42f533ee0832ac5ae | space_allocator.py | space_allocator.py | """space_allocator.py
Usage:
create_room <room_type> <room_name>
Create rooms in the dojo
add_person <person_name> <FELLOW|STAFF> [wants_accommodation]
Adds and allocate space to a person in the dojo
print_room <room_name>
Prints the names of all the people in room_name on the scree... | Add docopt implementation in main file | Add docopt implementation in main file
| Python | mit | EdwinKato/Space-Allocator,EdwinKato/Space-Allocator | ---
+++
@@ -0,0 +1,36 @@
+"""space_allocator.py
+
+Usage:
+ create_room <room_type> <room_name>
+ Create rooms in the dojo
+ add_person <person_name> <FELLOW|STAFF> [wants_accommodation]
+ Adds and allocate space to a person in the dojo
+ print_room <room_name>
+ Prints the names of all ... | |
ea66e543df237cc066b17e3bc814a885eb60cc95 | scripts/submit.py | scripts/submit.py | #!/usr/bin/env python
import getpass
import json
import requests
import sys
from argparse import ArgumentParser, FileType
from urllib.parse import urljoin
class Nudibranch(object):
BASE_URL = 'https://borg.cs.ucsb.edu'
PATHS = {'auth': 'session'}
@classmethod
def url(cls, resource, **kwargs):
... | Add submission script that currently only performs login. | Add submission script that currently only performs login.
| Python | bsd-2-clause | ucsb-cs/submit,ucsb-cs/submit,ucsb-cs/submit,ucsb-cs/submit | ---
+++
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+import getpass
+import json
+import requests
+import sys
+from argparse import ArgumentParser, FileType
+from urllib.parse import urljoin
+
+class Nudibranch(object):
+ BASE_URL = 'https://borg.cs.ucsb.edu'
+ PATHS = {'auth': 'session'}
+
+ @classmethod
+ d... | |
0bdb41a9e1820abf7d068e58f3cdac9d2c8f7221 | sympy/logic/benchmarks/run-solvers.py | sympy/logic/benchmarks/run-solvers.py | from __future__ import print_function, division
from sympy.logic.utilities import load_file
from sympy.logic import satisfiable
import time
import os
import sys
input_path = os.getcwd() + '/' + '/'.join(sys.argv[0].split('/')[:-1])
INPUT = [5 * i for i in range(2, 16)]
ALGORITHMS = ['dpll', 'dpll2']
results = {}
fo... | from __future__ import print_function, division
from sympy.logic.utilities import load_file
from sympy.logic import satisfiable
import time
import os
import sys
input_path = os.getcwd() + '/' + '/'.join(sys.argv[0].split('/')[:-1])
INPUT = [5 * i for i in range(2, 16)]
ALGORITHMS = ['dpll', 'dpll2']
results = {}
fo... | Fix a white space error | Fix a white space error
This was introduced in e2a415797d4adb81551c5331b1adfdb4a6ecbe94.
| Python | bsd-3-clause | MridulS/sympy,cccfran/sympy,yashsharan/sympy,shipci/sympy,sahilshekhawat/sympy,Sumith1896/sympy,ga7g08/sympy,chaffra/sympy,souravsingh/sympy,sahilshekhawat/sympy,atreyv/sympy,lidavidm/sympy,postvakje/sympy,jerli/sympy,rahuldan/sympy,chaffra/sympy,Sumith1896/sympy,ga7g08/sympy,sunny94/temp,abhiii5459/sympy,sahmed95/symp... | ---
+++
@@ -23,7 +23,7 @@
assert satisfiable(theory, algorithm=alg)
end = time.time()
results[test][alg] = end - start
- print("Test %d in time %.2f seconds for algorithm %s." %
+ print("Test %d in time %.2f seconds for algorithm %s." %
(test, end - start, alg))
... |
9dc756b627e39c62ffce3af617089c331822fa33 | test/test_extra_root.py | test/test_extra_root.py | from support import lib,ffi
from qcgc_test import QCGCTest
import unittest
class ExtraRootTestCase(QCGCTest):
def test_extra_root(self):
# XXX: Violates the condition of the extra roots but it does not matter atm
extra_root_obj = self.allocate_ref(2)
# Register roots
lib.qcgc_regist... | Add test for extra roots | Add test for extra roots
| Python | mit | ntruessel/qcgc,ntruessel/qcgc,ntruessel/qcgc | ---
+++
@@ -0,0 +1,28 @@
+from support import lib,ffi
+from qcgc_test import QCGCTest
+import unittest
+
+class ExtraRootTestCase(QCGCTest):
+ def test_extra_root(self):
+ # XXX: Violates the condition of the extra roots but it does not matter atm
+ extra_root_obj = self.allocate_ref(2)
+ # Re... | |
4519910f34ca35224d9b0fdd1cea4a36a425f4da | gdrived.py | gdrived.py | #!/usr/bin/env python
#
# Copyright 2012 Jim Lawton. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | Add skeleton for sync daemon. | Add skeleton for sync daemon.
| Python | apache-2.0 | jimlawton/gdrive-linux-googlecode,babycaseny/gdrive-linux,jimlawton/gdrive-linux,jmfield2/gdrive-linux | ---
+++
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+#
+# Copyright 2012 Jim Lawton. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/li... | |
0b7b471af3a4b1a2490b9a0dd2dd4b8f64453c17 | test/persistence_test.py | test/persistence_test.py | import os
import shutil
import tempfile
import time
from lwr.persistence import PersistedJobStore
from lwr.queue_manager import QueueManager
def test_persistence():
"""
Tests persistence of a managers jobs.
"""
staging_directory = tempfile.mkdtemp()
try:
persisted_job_store = PersistedJo... | Add initial testing for persistence. | Add initial testing for persistence.
| Python | apache-2.0 | natefoo/pulsar,jmchilton/pulsar,ssorgatem/pulsar,natefoo/pulsar,jmchilton/pulsar,galaxyproject/pulsar,jmchilton/lwr,ssorgatem/pulsar,jmchilton/lwr,galaxyproject/pulsar | ---
+++
@@ -0,0 +1,37 @@
+import os
+import shutil
+import tempfile
+import time
+
+
+from lwr.persistence import PersistedJobStore
+from lwr.queue_manager import QueueManager
+
+
+def test_persistence():
+ """
+ Tests persistence of a managers jobs.
+ """
+ staging_directory = tempfile.mkdtemp()
+ try... | |
ffebf307137d0435d7b2f0d10ac912ca7f87f1c7 | cnn/getReg.py | cnn/getReg.py | # Copyright (C) 2016 Zhixian MA <zxma_sjtu@qq.com>
"""
Transform cavities regions of samples selected from paper
arXiv-1610.03487.
Reference
---------
[1] J. Shin, J. Woo, and, J. Mulchaey
"A systematic search for X-ray cavities in galaxy clusters,
groups, and elliptical galaxies"
arXiv-1610.03487
"""
imp... | Transform units of cavity regions in Shin et al's 2016. | Transform units of cavity regions in Shin et al's 2016.
| Python | mit | myinxd/cavdet,myinxd/cavdet | ---
+++
@@ -0,0 +1,54 @@
+# Copyright (C) 2016 Zhixian MA <zxma_sjtu@qq.com>
+
+"""
+Transform cavities regions of samples selected from paper
+arXiv-1610.03487.
+
+Reference
+---------
+[1] J. Shin, J. Woo, and, J. Mulchaey
+ "A systematic search for X-ray cavities in galaxy clusters,
+ groups, and elliptical ... | |
349cf99e67279a7d26abbff9d9ca09eed8300dda | examples/test_canvas.py | examples/test_canvas.py | from seleniumbase import BaseCase
class CanvasTests(BaseCase):
def get_pixel_colors(self):
# Return the RGB colors of the canvas element's top left pixel
x = 0
y = 0
if self.browser == "safari":
x = 1
y = 1
color = self.execute_script(
... | Add example tests for canvas actions | Add example tests for canvas actions
| Python | mit | seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase | ---
+++
@@ -0,0 +1,38 @@
+from seleniumbase import BaseCase
+
+
+class CanvasTests(BaseCase):
+ def get_pixel_colors(self):
+ # Return the RGB colors of the canvas element's top left pixel
+ x = 0
+ y = 0
+ if self.browser == "safari":
+ x = 1
+ y = 1
+ colo... | |
3942b52249a061dabb0560941aeb9dd135245de9 | gooey/gui/formatters.py | gooey/gui/formatters.py | import os
from gooey.gui.util.quoting import quote
def checkbox(metadata, value):
return metadata['commands'][0] if value else None
def radioGroup(metadata, value):
# TODO
try:
return self.commands[self._value.index(True)][0]
except ValueError:
return None
def mul... | Move all formatting logic into a single module | Move all formatting logic into a single module
| Python | mit | chriskiehl/Gooey,codingsnippets/Gooey,partrita/Gooey | ---
+++
@@ -0,0 +1,83 @@
+import os
+
+from gooey.gui.util.quoting import quote
+
+
+def checkbox(metadata, value):
+ return metadata['commands'][0] if value else None
+
+
+def radioGroup(metadata, value):
+ # TODO
+ try:
+ return self.commands[self._value.index(True)][0]
+ except ValueError:
+ ... | |
bd19faaa16c92072dd1a597f35b173e20a768a5b | fpr/migrations/0017_ocr_unique_names.py | fpr/migrations/0017_ocr_unique_names.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def data_migration(apps, schema_editor):
"""Migration that causes each OCR text file to include the UUID of its
source file in its filename. This prevents OCR text files from overwriting
one another when the... | Add file UUID to OCR text file name | Add file UUID to OCR text file name
Adds a migration that causes each OCR text file to include the UUID of its
source file in its filename. This prevents OCR text files from overwriting one
another when there are two identically named source files in a transfer. Fixes
issue #66.
| Python | agpl-3.0 | artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin | ---
+++
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+def data_migration(apps, schema_editor):
+ """Migration that causes each OCR text file to include the UUID of its
+ source file in its filename. This prevents OCR text files from... | |
fb4212e1e3de5a63652561066d8a30c833607b28 | alembic/versions/551bc42a839_add_role_type.py | alembic/versions/551bc42a839_add_role_type.py | """add_role_type
Revision ID: 551bc42a839
Revises: 41af1c8d394
Create Date: 2016-02-02 17:19:21.998718
"""
# revision identifiers, used by Alembic.
revision = '551bc42a839'
down_revision = '41af1c8d394'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
"""
... | Add alembic migration for role type | Add alembic migration for role type
refs #295
| Python | apache-2.0 | rickmak/skygear-server,SkygearIO/skygear-server,rickmak/skygear-server,rickmak/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server,SkygearIO/skygear-server | ---
+++
@@ -0,0 +1,32 @@
+"""add_role_type
+
+Revision ID: 551bc42a839
+Revises: 41af1c8d394
+Create Date: 2016-02-02 17:19:21.998718
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '551bc42a839'
+down_revision = '41af1c8d394'
+branch_labels = None
+depends_on = None
+
+from alembic import op
+import s... | |
5c063317bbf1c67b1e17992ec338b00451735296 | src/website/migrations/0005_auto_20180621_1659.py | src/website/migrations/0005_auto_20180621_1659.py | # Generated by Django 2.0.6 on 2018-06-21 07:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0004_auto_20170713_2346'),
]
operations = [
migrations.AlterField(
model_name='user',
name='last_name',
... | Add migrations for website app | Add migrations for website app
| Python | apache-2.0 | PLUS-POSTECH/study.plus.or.kr,PLUS-POSTECH/study.plus.or.kr,PLUS-POSTECH/study.plus.or.kr | ---
+++
@@ -0,0 +1,18 @@
+# Generated by Django 2.0.6 on 2018-06-21 07:59
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('website', '0004_auto_20170713_2346'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_nam... | |
be7a803888793a09ac714220be08f3914034c1bb | go/apps/jsbox/tests/test_views.py | go/apps/jsbox/tests/test_views.py | from django.test.client import Client
from django.core.urlresolvers import reverse
from go.apps.tests.base import DjangoGoApplicationTestCase
class JsBoxTestCase(DjangoGoApplicationTestCase):
def setUp(self):
super(JsBoxTestCase, self).setUp()
self.setup_riak_fixtures()
self.client = Cli... | Add basic tests for views. | Add basic tests for views.
| Python | bsd-3-clause | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | ---
+++
@@ -0,0 +1,56 @@
+from django.test.client import Client
+from django.core.urlresolvers import reverse
+
+from go.apps.tests.base import DjangoGoApplicationTestCase
+
+
+class JsBoxTestCase(DjangoGoApplicationTestCase):
+
+ def setUp(self):
+ super(JsBoxTestCase, self).setUp()
+ self.setup_ria... | |
481df944700297300892bd14783310aad14c093c | test/selenium/src/lib/page/modal/delete_object.py | test/selenium/src/lib/page/modal/delete_object.py | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Modals for deleting objects"""
from lib import base
from lib import decorator
from lib.constants import locator
class DeleteObjectModal(base.Modal):
"""A generic modal for deleting an object"""
_p... | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Modals for deleting objects"""
from lib import base
from lib.constants import locator
class DeleteObjectModal(base.Modal):
"""A generic modal for deleting an object"""
_page_model_cls_after_redire... | Remove redirect from delete modal page object | Remove redirect from delete modal page object
(cherry picked from commit 480ecdb)
| Python | apache-2.0 | VinnieJohns/ggrc-core,selahssea/ggrc-core,j0gurt/ggrc-core,josthkko/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,selahssea/ggrc-core,j0gurt/ggrc-core,kr41/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,andrei-karalionak/ggrc-core,VinnieJohns/ggrc-core,j0gurt/ggrc-core,andrei-karalionak/ggrc-core,kr41/ggrc-core,p... | ---
+++
@@ -4,7 +4,6 @@
"""Modals for deleting objects"""
from lib import base
-from lib import decorator
from lib.constants import locator
@@ -25,7 +24,6 @@
self.button_delete = base.Button(
driver, self._locator.BUTTON_DELETE)
- @decorator.wait_for_redirect
def confirm_delete(self):
... |
6031700ba86611809619409c2a83d551f622e391 | hardware/gpio/TrafficLights_gpiozero.py | hardware/gpio/TrafficLights_gpiozero.py | from gpiozero import TrafficLights
import time
def british_lights_cycle(lights, cycle_time):
lights.off()
# Red
lights.red.on()
time.sleep(cycle_time)
# Red and Amber
lights.amber.on()
time.sleep(cycle_time)
# Green
lights.red.off()
lights.amber.off()
lights.green.on()
... | Add GPIO-zero-based demo of 4Tronix Pi-Stop | Add GPIO-zero-based demo of 4Tronix Pi-Stop | Python | mit | claremacrae/raspi_code,claremacrae/raspi_code,claremacrae/raspi_code | ---
+++
@@ -0,0 +1,38 @@
+from gpiozero import TrafficLights
+import time
+
+def british_lights_cycle(lights, cycle_time):
+ lights.off()
+
+ # Red
+ lights.red.on()
+ time.sleep(cycle_time)
+
+ # Red and Amber
+ lights.amber.on()
+ time.sleep(cycle_time)
+
+ # Green
+ lights.red.off()
+ ... | |
f1d956a646b86da5fcb97cf918495ceaa1bbaa9b | ideascube/conf/idb_fra_canopecayenne.py | ideascube/conf/idb_fra_canopecayenne.py | from .idb import * # pragma: no flakes
CUSTOM_CARDS = [
{
# Must be one of create, discover, info, learn, manage, read
'category': 'create',
'url': 'http://etherpad.ideasbox.lan',
'title': 'Etherpad',
'description': 'A collaborative text editor',
# The name of a Fon... | Add conf file for Canope Guyane with Moodle and Etherpad card | Add conf file for Canope Guyane with Moodle and Etherpad card
| Python | agpl-3.0 | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ---
+++
@@ -0,0 +1,26 @@
+from .idb import * # pragma: no flakes
+
+CUSTOM_CARDS = [
+ {
+ # Must be one of create, discover, info, learn, manage, read
+ 'category': 'create',
+ 'url': 'http://etherpad.ideasbox.lan',
+ 'title': 'Etherpad',
+ 'description': 'A collaborative text ... | |
32fb188b7569fae39979b8b0482e618fe5187d26 | tests/test_ansi.py | tests/test_ansi.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Test the cprint function."""
from colorise.nix.color_functions import to_ansi
import pytest
@pytest.mark.skip_on_windows
def test_ansi():
assert to_ansi(34, '95') == '\x1b[34;95m'
assert to_ansi(0) == '\x1b[0m'
assert to_ansi() == ''
| Test ansi escape sequence function | Test ansi escape sequence function
| Python | bsd-3-clause | MisanthropicBit/colorise | ---
+++
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""Test the cprint function."""
+
+from colorise.nix.color_functions import to_ansi
+import pytest
+
+
+@pytest.mark.skip_on_windows
+def test_ansi():
+ assert to_ansi(34, '95') == '\x1b[34;95m'
+ assert to_ansi(0) == '\x1b[0m'
+ ass... | |
e2a5ead8838d484a2216a84b174418ec18fc21f0 | extras/gallery_sync.py | extras/gallery_sync.py | #!/usr/bin/env python
"""Script to upload pictures to the gallery.
This script scans a local picture folder to determine which patients
have not yet been created in the gallery. It then creates the missing
patients.
"""
from getpass import getpass
import requests
API_URL = 'http://localhost:8000/gallery/api/patie... | Add method to get list of patients from API. | Add method to get list of patients from API.
| Python | mit | cdriehuys/chmvh-website,cdriehuys/chmvh-website,cdriehuys/chmvh-website | ---
+++
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+"""Script to upload pictures to the gallery.
+
+This script scans a local picture folder to determine which patients
+have not yet been created in the gallery. It then creates the missing
+patients.
+"""
+
+from getpass import getpass
+
+import requests
+
+
+API_URL ... | |
5e874fdc4d19f30123b74c00c162bab12e086735 | ugly_code.py | ugly_code.py | def pretty_function(string_to_count):
raise NotImplementedError()
def Ugly_Function(string_to_count):
Cpy_Of_String = str(string_to_count)
Result = {}#holds result
for c in Cpy_Of_String:
if (c in Result.keys()) == False:
Result[c] = [c]
elif (c in Result.k... | Add some ugly code to make pretty and more efficient | Add some ugly code to make pretty and more efficient
| Python | mit | coolshop-com/coolshop-application-assignment | ---
+++
@@ -0,0 +1,52 @@
+def pretty_function(string_to_count):
+ raise NotImplementedError()
+
+
+def Ugly_Function(string_to_count):
+ Cpy_Of_String = str(string_to_count)
+ Result = {}#holds result
+
+
+ for c in Cpy_Of_String:
+ if (c in Result.keys()) == False:
+ Resu... | |
48cb07f0a464bde537be409318448095cabfe10e | useradmin.py | useradmin.py | #!/usr/bin/python
import argparse
import datetime
import json
import sys
import requests
def listusers(server):
try:
url = 'http://' + server + '/nhlplayoffs/api/v2.0/players'
headers = {'content-type': 'application/json'}
r = requests.get(url, headers=headers)
if not r.ok:
... | Add user admin script with list function | Add user admin script with list function
| Python | mit | fjacob21/nhlplayoffs,fjacob21/nhlplayoffs,fjacob21/nhlplayoffs | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/python
+import argparse
+import datetime
+import json
+import sys
+import requests
+
+def listusers(server):
+ try:
+ url = 'http://' + server + '/nhlplayoffs/api/v2.0/players'
+ headers = {'content-type': 'application/json'}
+ r = requests.get(url, headers... | |
111813afa21ac0d7e4b537f9eb1295cbc0357413 | examples/load_hgpackage.py | examples/load_hgpackage.py | #!/usr/bin/env python
from pymoku import Moku
import sys, logging
logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
log = logging.getLogger()
log.setLevel(logging.DEBUG)
if len(sys.argv) != 3:
print "Usage %s <ip> <packname>" % sys.argv[0]
exit(1)
m = Moku(sys.argv[1])
pack = sys.argv... | Add simple script to upload hg pack files to a device | PM-86: Add simple script to upload hg pack files to a device
| Python | mit | liquidinstruments/pymoku | ---
+++
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+
+from pymoku import Moku
+import sys, logging
+
+logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
+log = logging.getLogger()
+log.setLevel(logging.DEBUG)
+
+if len(sys.argv) != 3:
+ print "Usage %s <ip> <packname>" % sys.argv[0]
+ exit(1)
... | |
bd94ce78b29d918db59f2702fd76e3207840d46f | pyscf/pbc/ci/test/test_ci.py | pyscf/pbc/ci/test/test_ci.py | import pyscf.pbc.cc.test.make_test_cell as make_test_cell
from pyscf.pbc import gto, scf, ci
from pyscf.pbc.ci import KCIS
import unittest
cell = make_test_cell.test_cell_n3()
cell.mesh = [29] * 3
cell.build()
kmf_n3_none = scf.KRHF(cell, kpts=cell.make_kpts([2,1,1]), exxdiv=None)
kmf_n3_none.kernel()
kmf_n3_ewald = s... | Add unit test for KCIS (defined in pbc/ci/kcis_rhf.py) | Add unit test for KCIS (defined in pbc/ci/kcis_rhf.py)
| Python | apache-2.0 | sunqm/pyscf,sunqm/pyscf,sunqm/pyscf,sunqm/pyscf,gkc1000/pyscf,gkc1000/pyscf,gkc1000/pyscf,gkc1000/pyscf,gkc1000/pyscf | ---
+++
@@ -0,0 +1,52 @@
+import pyscf.pbc.cc.test.make_test_cell as make_test_cell
+from pyscf.pbc import gto, scf, ci
+from pyscf.pbc.ci import KCIS
+import unittest
+
+cell = make_test_cell.test_cell_n3()
+cell.mesh = [29] * 3
+cell.build()
+kmf_n3_none = scf.KRHF(cell, kpts=cell.make_kpts([2,1,1]), exxdiv=None)
+... | |
f6e2bdeb8662cdb44db9de91d0cbebf6fc41a231 | Variance.py | Variance.py | import math
def listVariance(base, new):
for i in new:
if i in base:
return 0
return 1
def valueVariance(base, new):
return math.fabs(base-new)
compareVec = [
listVariance,
listVariance,
valueVariance,
valueVariance,
valueVariance,
valueVariance,
valueVariance,
value... | Create initial vector variance helpers file | Create initial vector variance helpers file
| Python | mit | SLongofono/448_Project4,SLongofono/448_Project4 | ---
+++
@@ -0,0 +1,54 @@
+import math
+
+def listVariance(base, new):
+ for i in new:
+ if i in base:
+ return 0
+ return 1
+
+def valueVariance(base, new):
+ return math.fabs(base-new)
+
+
+compareVec = [
+ listVariance,
+ listVariance,
+ valueVariance,
+ valueVariance,
+ valueVarian... | |
a71aa49833030795cfe6b187c5497cb5d67ae263 | portal/migrations/versions/c3d394d9dfd1_.py | portal/migrations/versions/c3d394d9dfd1_.py | """empty message
Revision ID: c3d394d9dfd1
Revises: ('3c81fc76164c', 'c19bff0f70ab')
Create Date: 2021-01-06 12:53:14.809274
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'c3d394d9dfd1'
down_revision = ('3c81fc76164c', 'c19bff0f70ab')
def upgrade():
pas... | Add merge heads needed migration | Add merge heads needed migration
| Python | bsd-3-clause | uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal | ---
+++
@@ -0,0 +1,22 @@
+"""empty message
+
+Revision ID: c3d394d9dfd1
+Revises: ('3c81fc76164c', 'c19bff0f70ab')
+Create Date: 2021-01-06 12:53:14.809274
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = 'c3d394d9dfd1'
+down_revision = ('3c81fc76164c',... | |
85f8bb3e46c5c79af6ba1e246ad5938642feadcc | test/test_i18n.py | test/test_i18n.py | # -*- coding: utf8 -*-
###
# Copyright (c) 2012, Valentin Lorentz
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# ... | Add unit tests for i18n. | Add unit tests for i18n.
| Python | bsd-3-clause | Ban3/Limnoria,Ban3/Limnoria,ProgVal/Limnoria-test,ProgVal/Limnoria-test | ---
+++
@@ -0,0 +1,59 @@
+# -*- coding: utf8 -*-
+###
+# Copyright (c) 2012, Valentin Lorentz
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must re... | |
30cb67f454165a72287ba511adba0d8606f3ae72 | utils/esicog.py | utils/esicog.py | import esipy
from discord.ext import commands
import time
ESI_SWAGGER_JSON = 'https://esi.evetech.net/latest/swagger.json'
ESI_APP: esipy.App = None
ESI_CLIENT: esipy.EsiClient = None
def get_esi_app():
global ESI_APP
if not ESI_APP:
ESI_APP = esipy.App.create(url=ESI_SWAGGER_JSON)
return ESI_APP... | Add base class for cogs using ESIpy | Add base class for cogs using ESIpy
| Python | mit | randomic/antinub-gregbot | ---
+++
@@ -0,0 +1,33 @@
+import esipy
+from discord.ext import commands
+import time
+
+ESI_SWAGGER_JSON = 'https://esi.evetech.net/latest/swagger.json'
+ESI_APP: esipy.App = None
+ESI_CLIENT: esipy.EsiClient = None
+
+
+def get_esi_app():
+ global ESI_APP
+ if not ESI_APP:
+ ESI_APP = esipy.App.create(... | |
75015c024520af76d454e48cc59eb76c23c35aee | soccer/gameplay/timeout_behavior.py | soccer/gameplay/timeout_behavior.py | import composite_behavior
import behavior
import constants
import robocup
import time
import main
import enum
import logging
class TimeoutBehavior(composite_behavior.CompositeBehavior):
class State(enum.Enum):
timeout = 1
def __init__(self, subbehavior, timeout):
super().__init__(continuous=... | Add a timeout wrapper play | Add a timeout wrapper play
| Python | apache-2.0 | JNeiger/robocup-software,JNeiger/robocup-software,JNeiger/robocup-software,RoboJackets/robocup-software,RoboJackets/robocup-software,JNeiger/robocup-software,RoboJackets/robocup-software,RoboJackets/robocup-software,JNeiger/robocup-software | ---
+++
@@ -0,0 +1,49 @@
+import composite_behavior
+import behavior
+import constants
+import robocup
+import time
+import main
+import enum
+import logging
+
+class TimeoutBehavior(composite_behavior.CompositeBehavior):
+
+
+ class State(enum.Enum):
+ timeout = 1
+
+ def __init__(self, subbehavior, tim... | |
d91807ff8c8cd652e220a4add65d47e0afbcdb47 | back_office/migrations/0007_teacher_nationality.py | back_office/migrations/0007_teacher_nationality.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('master_data', '0001_initial'),
('back_office', '0006_auto_20160111_1315'),
]
operations = [
migrations.AddField(
... | Make migration for Teacher model after add nationlaity field to it | Make migration for Teacher model after add nationlaity field to it
| Python | mit | EmadMokhtar/halaqat,EmadMokhtar/halaqat,EmadMokhtar/halaqat | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('master_data', '0001_initial'),
+ ('back_office', '0006_auto_20160111_1315'),
+ ]
+
+ operat... | |
6609836c0d36930a73074ec4f0cf136d887ee0f9 | src/data_preparation/get_dhis_data.py | src/data_preparation/get_dhis_data.py | import pandas as pd
from blsqpy.postgres_hook import PostgresHook
from blsqpy.dhis2 import Dhis2
pgHook = PostgresHook('local_pdss')
dhis = Dhis2(pgHook)
dhis.build_de_cc_table()
dhis.get_data
de_maps_id = pd.read_excel("credes_monitoring/data/raw/mapping_sheet.xlsx", 1)
de_maps_name = pd.read_excel("credes_monitori... | Add data extraction from dhis | Add data extraction from dhis
| Python | mit | grlurton/orbf_data_validation,grlurton/orbf_data_validation | ---
+++
@@ -0,0 +1,18 @@
+import pandas as pd
+from blsqpy.postgres_hook import PostgresHook
+from blsqpy.dhis2 import Dhis2
+
+pgHook = PostgresHook('local_pdss')
+dhis = Dhis2(pgHook)
+dhis.build_de_cc_table()
+
+dhis.get_data
+
+de_maps_id = pd.read_excel("credes_monitoring/data/raw/mapping_sheet.xlsx", 1)
+de_map... | |
c12bf811be03d8bf9f1d91adea5104f538210910 | share/gdb/python/libport/__init__.py | share/gdb/python/libport/__init__.py | # Copyright (C) 2011, Gostai S.A.S.
#
# This software is provided "as is" without warranty of any kind,
# either expressed or implied, including but not limited to the
# implied warranties of fitness for a particular purpose.
#
# See the LICENSE file for more information.
"""This file define the libport gdb module"""
... | Add module index for libport instrumentation for GDB. | Add module index for libport instrumentation for GDB.
* share/gdb/python/libport/__init__.py: New.
| Python | bsd-3-clause | aldebaran/libport,aldebaran/libport,aldebaran/libport,aldebaran/libport,aldebaran/libport | ---
+++
@@ -0,0 +1,12 @@
+# Copyright (C) 2011, Gostai S.A.S.
+#
+# This software is provided "as is" without warranty of any kind,
+# either expressed or implied, including but not limited to the
+# implied warranties of fitness for a particular purpose.
+#
+# See the LICENSE file for more information.
+
+"""This fi... | |
9358b83c1dc0c6e0306416705d28a48f478878db | test/tests/python-imports/container.py | test/tests/python-imports/container.py | import curses
import dbm
import readline
import bz2
assert(bz2.decompress(bz2.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')
import platform
if platform.python_implementation() != 'PyPy' and platform.python_version_tuple()[0] != '2':
# PyPy and Python 2 don't support lzma
import lz... | import curses
import readline
import bz2
assert(bz2.decompress(bz2.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')
import platform
isNotPypy = platform.python_implementation() != 'PyPy'
isCaveman = platform.python_version_tuple()[0] == '2'
if isCaveman:
import gdbm
else:
import db... | Reorder python import test to use gnu dbm imports instead of generic dbm | Reorder python import test to use gnu dbm imports instead of generic dbm
| Python | apache-2.0 | nodejs-docker-bot/official-images,robfrank/official-images,mattrobenolt/official-images,mattrobenolt/official-images,infosiftr/stackbrew,infosiftr/stackbrew,neo-technology/docker-official-images,chorrell/official-images,nodejs-docker-bot/official-images,pesho/docker-official-images,chorrell/official-images,pesho/docker... | ---
+++
@@ -1,15 +1,23 @@
import curses
-import dbm
import readline
import bz2
assert(bz2.decompress(bz2.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')
import platform
-if platform.python_implementation() != 'PyPy' and platform.python_version_tuple()[0] != '2':
- # PyPy and Pyt... |
6b218f9e6c714af7c63bcc683a55b8d98f8a1506 | WR31/ain_diff.py | WR31/ain_diff.py | import digihw
import sarcli
from time import sleep
GPIO_CLI = 'gpio ain'
def cli(cmd):
s = sarcli.open()
s.write(cmd)
resp = s.read()
s.close()
return resp.strip('\r\n').strip('\r\nOK')
def python_ain():
return digihw.wr31_ain_get_value()
if __name__ == "__main__":
for x in range(20):
... | Create initial script for gathering AIN value from CLI. | Create initial script for gathering AIN value from CLI.
| Python | mpl-2.0 | digidotcom/transport_examples | ---
+++
@@ -0,0 +1,26 @@
+import digihw
+import sarcli
+from time import sleep
+
+GPIO_CLI = 'gpio ain'
+
+
+def cli(cmd):
+ s = sarcli.open()
+ s.write(cmd)
+ resp = s.read()
+ s.close()
+ return resp.strip('\r\n').strip('\r\nOK')
+
+
+def python_ain():
+ return digihw.wr31_ain_get_value()
+
+if __... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.