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 |
|---|---|---|---|---|---|---|---|---|---|---|
7f74911cf02c624afbb85e63dedde68cda2f53f6 | modules/bilingual_generator/bilingual-preprocess.py | modules/bilingual_generator/bilingual-preprocess.py | import itertools
import codecs
d=[]
for entry in a.findall("ar"):
foo = [x.text.split(";") for x in entry if x.text]
if len(foo) == 2:
english,hindi = foo
english = [e.strip() for e in english ]
hindi = [h.strip() for h in hindi]
english = [e for e in english if not " " in... | Add script for preprocess of Universal bilingual dictionary database | Add script for preprocess of Universal bilingual dictionary database
| Python | mit | KshitijKarthick/tvecs,KshitijKarthick/tvecs,KshitijKarthick/tvecs | ---
+++
@@ -0,0 +1,21 @@
+import itertools
+import codecs
+
+d=[]
+for entry in a.findall("ar"):
+
+ foo = [x.text.split(";") for x in entry if x.text]
+ if len(foo) == 2:
+ english,hindi = foo
+ english = [e.strip() for e in english ]
+ hindi = [h.strip() for h in hindi]
+
+ eng... | |
a652707d889b84762f68ac381aa4e89801279e90 | src/legendary_potato/composition.py | src/legendary_potato/composition.py | "Functions to create kernels from already existing kernels."
import numpy as np
def normalize(kernel, *args, **kwargs):
"""Return the normalized version.
This correspond to the new kernel
.. math::
K(x_1, x_2) = \frac{kernel(x_1, x2)}\
{sqrt(kernel(x_1, x_1) kernel(x_2, x_2))}... | Add kernel construction based on kernels | Add kernel construction based on kernels
| Python | mit | manu3618/legendary-potato | ---
+++
@@ -0,0 +1,22 @@
+"Functions to create kernels from already existing kernels."
+
+import numpy as np
+
+
+def normalize(kernel, *args, **kwargs):
+ """Return the normalized version.
+
+ This correspond to the new kernel
+ .. math::
+ K(x_1, x_2) = \frac{kernel(x_1, x2)}\
+ {s... | |
59d8a8c1218a9641ae559b0cd710c05d17e26409 | graph_over_time.py | graph_over_time.py | #!/usr/bin/python2
import json
import subprocess
import time
import calendar
import dateutil.parser
import datetime
runs = json.load(open("list.json","r"))
num_master = 0
psnr = []
psnrhvs = []
ssim = []
fastssim = []
def unix_time(dt):
epoch = datetime.datetime.utcfromtimestamp(0)
delta = dt - epoch
... | Add tool to generate timeline data | Add tool to generate timeline data
| Python | mit | mdinger/awcy,tdaede/awcy,tdaede/awcy,tdaede/awcy,tdaede/awcy,mdinger/awcy,mdinger/awcy,tdaede/awcy,mdinger/awcy,mdinger/awcy,tdaede/awcy | ---
+++
@@ -0,0 +1,40 @@
+#!/usr/bin/python2
+
+import json
+import subprocess
+import time
+import calendar
+import dateutil.parser
+import datetime
+
+runs = json.load(open("list.json","r"))
+
+num_master = 0
+
+psnr = []
+psnrhvs = []
+ssim = []
+fastssim = []
+
+
+def unix_time(dt):
+ epoch = datetime.datetime... | |
2981f89a1ffffbd3dae78543fd1e8e257e6a8a3f | copy_ftp.py | copy_ftp.py | #C:\Users\smst\AppData\Local\Radio Server Player 2>
#for /d %f in (profiles\*) do \code\rsab\nowplaying\copy_ftp.py setup.ini "%f\setup.ini"
start_time = __import__('time').time()
def selective_merge(target_ini, merge_from_ini, merge_items):
try:
set
except NameError:
from sets import... | Copy the RSP2 FTP settings from one INI file into another | Copy the RSP2 FTP settings from one INI file into another
| Python | mit | radio-st-austell-bay/helpers | ---
+++
@@ -0,0 +1,94 @@
+#C:\Users\smst\AppData\Local\Radio Server Player 2>
+#for /d %f in (profiles\*) do \code\rsab\nowplaying\copy_ftp.py setup.ini "%f\setup.ini"
+
+start_time = __import__('time').time()
+
+def selective_merge(target_ini, merge_from_ini, merge_items):
+ try:
+ set
+ except NameErro... | |
1c04af7fa83c8bbe841ecb0ab449b31780b7571f | de-boor/b-splines-with-de-Boor-recurrence.py | de-boor/b-splines-with-de-Boor-recurrence.py |
import numpy as np
def extend_knots_vector(order, a, b, internal_knots, multiplicities=None, closed=False):
"""
This function produces an extended knots vector for BSpline functions given a simple one.
Parameters
==========
a:
Examples
========
Simple extension for an open curve
... | Add a new Python implementation about de Boor recurrence to draw BSplines curves, this commit contains the initial work on a module which contains knot partition extension utilities. | Add a new Python implementation about de Boor recurrence to draw
BSplines curves, this commit contains the initial work on a module
which contains knot partition extension utilities.
| Python | mit | massimo-nocentini/cagd,massimo-nocentini/cagd,massimo-nocentini/cagd | ---
+++
@@ -0,0 +1,46 @@
+
+
+import numpy as np
+
+def extend_knots_vector(order, a, b, internal_knots, multiplicities=None, closed=False):
+ """
+ This function produces an extended knots vector for BSpline functions given a simple one.
+
+ Parameters
+ ==========
+ a:
+
+ Examples
+ ========
+... | |
02ba3da06a40e3841e54ee1c93d4dc345a69cca3 | motmetrics/tests/test_utils.py | motmetrics/tests/test_utils.py | # py-motmetrics - Metrics for multiple object tracker (MOT) benchmarking.
# https://github.com/cheind/py-motmetrics/
#
# MIT License
# Copyright (c) 2017-2020 Christoph Heindl, Jack Valmadre and others.
# See LICENSE file for terms.
"""Tests accumulation of events using utility functions."""
from __future__ import ab... | Add test to catch bug in compare_to_groundtruth | Add test to catch bug in compare_to_groundtruth
| Python | mit | cheind/py-motmetrics,cheind/py-motmetrics | ---
+++
@@ -0,0 +1,55 @@
+# py-motmetrics - Metrics for multiple object tracker (MOT) benchmarking.
+# https://github.com/cheind/py-motmetrics/
+#
+# MIT License
+# Copyright (c) 2017-2020 Christoph Heindl, Jack Valmadre and others.
+# See LICENSE file for terms.
+
+"""Tests accumulation of events using utility funct... | |
62933a44942088e512ec3aa8024f97ed48375519 | djset/backends.py | djset/backends.py | import os
import codecs
import keyring.util.platform
from keyring.py27compat import configparser
from keyring.backends.file import BaseKeyring
from keyring.core import load_keyring
from keyring.util.escape import escape as escape_for_ini
from keyring.util import properties
class UnencryptedKeyring(BaseKeyring):
... | Add an unencrypted file based backend. | Add an unencrypted file based backend.
| Python | mit | bretth/djset,bretth/djset | ---
+++
@@ -0,0 +1,88 @@
+import os
+import codecs
+
+import keyring.util.platform
+from keyring.py27compat import configparser
+from keyring.backends.file import BaseKeyring
+from keyring.core import load_keyring
+from keyring.util.escape import escape as escape_for_ini
+from keyring.util import properties
+
+
+clas... | |
74e46d577bab048a473862b070d8abfb1db00ea1 | workup/migrations/0005_auto_20160826_0620.py | workup/migrations/0005_auto_20160826_0620.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import workup.validators
class Migration(migrations.Migration):
dependencies = [
('workup', '0004_auto_20160328_1425'),
]
operations = [
migrations.AlterField(
model_name... | Add migration for updates to workup (smallintegerfield -> charfield to fix vitals thing). | Add migration for updates to workup (smallintegerfield -> charfield to fix vitals thing).
| Python | mit | SaturdayNeighborhoodHealthClinic/clintools,SaturdayNeighborhoodHealthClinic/clintools,SaturdayNeighborhoodHealthClinic/clintools | ---
+++
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import workup.validators
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('workup', '0004_auto_20160328_1425'),
+ ]
+
+ operations = [
+ mig... | |
51c589491257b870ce70bac66c358fac77b463d3 | scripts/trectransform.py | scripts/trectransform.py | """
Transform janky trec topics into lucene4ir topics.
"""
import argparse
import sys
def transform(data: str) -> str:
"""
:param data:
:return:
"""
topics = ''
num = None
for n, line in enumerate(data.split('\n')):
if '<num>' in line:
num = line.split()[-1]
... | Add script for transforming trec topic files to lucene4ir topic files. | Add script for transforming trec topic files to lucene4ir topic files.
| Python | apache-2.0 | leifos/lucene4ir,leifos/lucene4ir,lucene4ir/lucene4ir,lucene4ir/lucene4ir,leifos/lucene4ir,lucene4ir/lucene4ir | ---
+++
@@ -0,0 +1,41 @@
+"""
+Transform janky trec topics into lucene4ir topics.
+"""
+
+import argparse
+
+import sys
+
+
+def transform(data: str) -> str:
+ """
+
+ :param data:
+ :return:
+ """
+ topics = ''
+ num = None
+ for n, line in enumerate(data.split('\n')):
+ if '<num>' in lin... | |
37ee7ede62cee88a925b2f1ed99a94b445ce6a88 | lowfat/management/commands/fixfundingsource.py | lowfat/management/commands/fixfundingsource.py | import pandas as pd
from django.core.management.base import BaseCommand
from lowfat.models import Fund, Expense
class Command(BaseCommand):
help = "Fix funding source"
def add_arguments(self, parser):
parser.add_argument('csv', nargs='?', default='funds.csv')
# pylint: disable=too-many-branches... | Add script to fix funding source | Add script to fix funding source
| Python | bsd-3-clause | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | ---
+++
@@ -0,0 +1,36 @@
+import pandas as pd
+
+from django.core.management.base import BaseCommand
+
+from lowfat.models import Fund, Expense
+
+class Command(BaseCommand):
+ help = "Fix funding source"
+
+ def add_arguments(self, parser):
+ parser.add_argument('csv', nargs='?', default='funds.csv')
+
... | |
fe2f6e4b326ac0c441f561b8c9185cdad2c738fc | streamer/scripts/id_munging_test.py | streamer/scripts/id_munging_test.py | #!/usr/bin/env python
import json
import sys
count = 0
mismatches = 0
# Validate incoming twitter object id, id_str match and are expected types
# stdin is JSONL tweet objects (one fully-formed tweet per line of text)
try:
for line in sys.stdin:
try:
t = json.loads(line.strip())
except... | Add script to validate incoming tweet IDs | Add script to validate incoming tweet IDs
| Python | mit | inactivist/twitter-streamer,inactivist/twitter-streamer | ---
+++
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+import json
+import sys
+
+count = 0
+mismatches = 0
+
+# Validate incoming twitter object id, id_str match and are expected types
+# stdin is JSONL tweet objects (one fully-formed tweet per line of text)
+try:
+ for line in sys.stdin:
+ try:
+ t =... | |
9d79b33abc80d10d525dccae7d2c5419888d96c0 | tests/test_config.py | tests/test_config.py | import unittest
class TestConfigMerge(unittest.TestCase):
def _call_fut(self, destcfg, srccfg):
from tilequeue.config import merge_cfg
return merge_cfg(destcfg, srccfg)
def test_both_empty(self):
self.assertEqual({}, self._call_fut({}, {}))
def test_complementary_scalar(self):
... | Add tests for config dict merging | Add tests for config dict merging
| Python | mit | tilezen/tilequeue,mapzen/tilequeue | ---
+++
@@ -0,0 +1,39 @@
+import unittest
+
+
+class TestConfigMerge(unittest.TestCase):
+
+ def _call_fut(self, destcfg, srccfg):
+ from tilequeue.config import merge_cfg
+ return merge_cfg(destcfg, srccfg)
+
+ def test_both_empty(self):
+ self.assertEqual({}, self._call_fut({}, {}))
+
+ ... | |
734775524e14a8ae3997933afba64a4ac6a3cd47 | tests/basics/class_super_closure.py | tests/basics/class_super_closure.py | # test that no-arg super() works when self is closed over
class A:
def __init__(self):
self.val = 4
def foo(self):
# we access a member of self to check that self is correct
return list(range(self.val))
class B(A):
def foo(self):
# self is closed over because it's referenced... | Add test for super() when self is closed over. | tests/basics: Add test for super() when self is closed over.
| Python | mit | toolmacher/micropython,HenrikSolver/micropython,henriknelson/micropython,oopy/micropython,HenrikSolver/micropython,adafruit/micropython,tralamazza/micropython,alex-robbins/micropython,cwyark/micropython,toolmacher/micropython,tralamazza/micropython,deshipu/micropython,torwag/micropython,swegener/micropython,lowRISC/mic... | ---
+++
@@ -0,0 +1,18 @@
+# test that no-arg super() works when self is closed over
+
+class A:
+ def __init__(self):
+ self.val = 4
+ def foo(self):
+ # we access a member of self to check that self is correct
+ return list(range(self.val))
+class B(A):
+ def foo(self):
+ # self ... | |
ed491383b183d9001872591554d218603983ae35 | tests/test_reader.py | tests/test_reader.py | from catsup.reader import get_reader, markdown_reader, txt_reader
def test_reader_choser():
assert get_reader("md") == markdown_reader
assert get_reader("markdown") == markdown_reader
assert get_reader("txt") == txt_reader
| Add tests for ``get_reader`` func | Add tests for ``get_reader`` func
| Python | mit | whtsky/catsup-docs-zh,whtsky/Catsup,whtsky/Catsup,whtsky/catsup-docs-zh | ---
+++
@@ -0,0 +1,8 @@
+from catsup.reader import get_reader, markdown_reader, txt_reader
+
+
+def test_reader_choser():
+ assert get_reader("md") == markdown_reader
+ assert get_reader("markdown") == markdown_reader
+ assert get_reader("txt") == txt_reader
+ | |
5c308a46ae6863473db9cfe5f159e6fd70fe8691 | profundity.py | profundity.py | #!/usr/bin/env python
# What an incredibly stupid application.
# I realize that it's released under the MIT License.
# But, seriously. Who cares?
import datetime
import json
import logging
import os
import sys
import BaseHTTPServer as http
def port_from_env():
return int(os.getenv('PROFOUND_PORT', '8080'))
def... | Add the most excellent web server ever conceived. | Add the most excellent web server ever conceived.
Use PROFOUND_PORT and PROFOUND_NAME to control the service port
and "name", respectively. It has sane defaults for each.
| Python | mit | ethanrowe/docker-xtream-profundity,ethanrowe/docker-xtream-profundity | ---
+++
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+
+# What an incredibly stupid application.
+# I realize that it's released under the MIT License.
+# But, seriously. Who cares?
+
+import datetime
+import json
+import logging
+import os
+import sys
+import BaseHTTPServer as http
+
+def port_from_env():
+ return in... | |
5420d368c064953842023ccc07b531b071ec3514 | src/tests/test_login_page.py | src/tests/test_login_page.py | from src.lib.page.login import LoginPage
from src.lib.base import BaseTest
class TestLoginPage(BaseTest):
def test_login_as_admin(self):
login_page = LoginPage(self.driver)
login_page.login()
self.driver.find_element_by_css_selector("li.user.user-dropdown.dropdown")
| from src.lib.page.login import LoginPage
from src.lib.base import BaseTest
from src.lib.constants import selector
class TestLoginPage(BaseTest):
def test_login_as_admin(self):
login_page = LoginPage(self.driver)
login_page.login()
self.driver.find_element_by_css_selector(selector.LoginPag... | Modify login page test to use selectors defined in the module constants. | Modify login page test to use selectors defined in the module constants.
| Python | apache-2.0 | edofic/ggrc-core,kr41/ggrc-core,jmakov/ggrc-core,selahssea/ggrc-core,j0gurt/ggrc-core,kr41/ggrc-core,josthkko/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,edofic/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,j0gurt/ggrc-core,prasan... | ---
+++
@@ -1,5 +1,6 @@
from src.lib.page.login import LoginPage
from src.lib.base import BaseTest
+from src.lib.constants import selector
class TestLoginPage(BaseTest):
@@ -7,6 +8,6 @@
login_page = LoginPage(self.driver)
login_page.login()
- self.driver.find_element_by_css_selector(... |
10caef4f58f7176ccce3ba65d9d068dc393e7905 | playhouse/mysql_ext.py | playhouse/mysql_ext.py | try:
import mysql.connector as mysql_connector
except ImportError:
mysql_connector = None
from peewee import ImproperlyConfigured
from peewee import MySQLDatabase
class MySQLConnectorDatabase(MySQLDatabase):
def _connect(self):
if mysql_connector is None:
raise ImproperlyConfigured('M... | Add support for MySQL-Connector python driver. | Add support for MySQL-Connector python driver.
| Python | mit | coleifer/peewee,coleifer/peewee,coleifer/peewee | ---
+++
@@ -0,0 +1,19 @@
+try:
+ import mysql.connector as mysql_connector
+except ImportError:
+ mysql_connector = None
+
+from peewee import ImproperlyConfigured
+from peewee import MySQLDatabase
+
+
+class MySQLConnectorDatabase(MySQLDatabase):
+ def _connect(self):
+ if mysql_connector is None:
+ ... | |
6c0a2c487671693c7efa61aca37b177eb2d18031 | session1_Decorators/decorators.py | session1_Decorators/decorators.py | """
Decorators
"""
# 1 Decorators##################################################################
# Have a look at the warnings examples in warnings.py. How would you
# go about writing a more general deprectation warning if you have
# multiple deprecated functions? Wouldn't it be nice to 'decorate' a function
# as ... | Add solutions and demo scripts | Add solutions and demo scripts
| Python | mit | INM-6/Python-Module-of-the-Week,INM-6/Python-Module-of-the-Week,INM-6/Python-Module-of-the-Week,INM-6/Python-Module-of-the-Week | ---
+++
@@ -0,0 +1,72 @@
+"""
+Decorators
+"""
+
+# 1 Decorators##################################################################
+# Have a look at the warnings examples in warnings.py. How would you
+# go about writing a more general deprectation warning if you have
+# multiple deprecated functions? Wouldn't it be ... | |
b32f3db018612285d228a9757d9a644292ec278e | tests/scoring_engine/engine/checks/test_mysql.py | tests/scoring_engine/engine/checks/test_mysql.py | from tests.scoring_engine.engine.checks.check_test import CheckTest
class TestMYSQLCheck(CheckTest):
check_name = 'MYSQLCheck'
properties = {
'database': 'wordpressdb',
'command': 'show tables'
}
accounts = {
'pwnbus': 'pwnbuspass'
}
cmd = "mysql -h 127.0.0.1 -u pwnbus -ppwnb... | from tests.scoring_engine.engine.checks.check_test import CheckTest
class TestMYSQLCheck(CheckTest):
check_name = 'MYSQLCheck'
properties = {
'database': 'wordpressdb',
'command': 'show tables'
}
accounts = {
'pwnbus': 'pwnbuspass'
}
cmd = "mysql -h 127.0.0.1 -u pwnbus ... | Fix pep8 in mysql test | Fix pep8 in mysql test
Signed-off-by: Brandon Myers <9cda508be11a1ae7ceef912b85c196946f0ec5f3@mozilla.com>
| Python | mit | pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine | ---
+++
@@ -4,10 +4,10 @@
class TestMYSQLCheck(CheckTest):
check_name = 'MYSQLCheck'
properties = {
- 'database': 'wordpressdb',
- 'command': 'show tables'
+ 'database': 'wordpressdb',
+ 'command': 'show tables'
}
accounts = {
- 'pwnbus': 'pwnbuspass'
+ 'pwnbus... |
ca847aea1de45971327b0008c17e07c3d9d5281c | tests/unit/core/migrations_tests.py | tests/unit/core/migrations_tests.py | # -*- coding: utf-8 -*-
import os
from django.test import TestCase
import oscar.apps
class TestMigrations(TestCase):
def check_for_auth_model(self, filepath):
with open(filepath) as f:
s = f.read()
return 'auth.User' in s or 'auth.user' in s
def test_dont_contain_hardcoded... | Add test for hardcoded user model in migrations | Add test for hardcoded user model in migrations
New migrations need to be manually updated to correctly deal with custom
user models. This test fails if this isn't done.
| Python | bsd-3-clause | jlmadurga/django-oscar,MatthewWilkes/django-oscar,faratro/django-oscar,pasqualguerrero/django-oscar,kapt/django-oscar,monikasulik/django-oscar,nfletton/django-oscar,eddiep1101/django-oscar,sasha0/django-oscar,okfish/django-oscar,jmt4/django-oscar,manevant/django-oscar,ka7eh/django-oscar,django-oscar/django-oscar,marcoa... | ---
+++
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+
+import os
+
+from django.test import TestCase
+
+import oscar.apps
+
+
+class TestMigrations(TestCase):
+
+ def check_for_auth_model(self, filepath):
+ with open(filepath) as f:
+ s = f.read()
+ return 'auth.User' in s or 'auth.user'... | |
5caa1952c1e413922e313dd51903904fe8e23bef | calc_gain_read.py | calc_gain_read.py | from triage_fits_files import ImageFileCollection
from ccd_characterization import ccd_gain, ccd_read_noise
from numpy import array
from astropysics import ccd
def as_images(tbl, src_dir):
from os import path
img = []
for tb in tbl:
img.append(ccd.FitsImage(path.join(src_dir, tb['file'])).data)
... | Add function to calculate gain/read noise given a directory. | Add function to calculate gain/read noise given a directory.
| Python | bsd-3-clause | mwcraig/msumastro | ---
+++
@@ -0,0 +1,35 @@
+from triage_fits_files import ImageFileCollection
+from ccd_characterization import ccd_gain, ccd_read_noise
+from numpy import array
+from astropysics import ccd
+
+def as_images(tbl, src_dir):
+ from os import path
+ img = []
+ for tb in tbl:
+ img.append(ccd.FitsImage(pat... | |
346a6b5cc5426ce38195dd5ce4507894710ee8a7 | fix-gpt-ubuntu.py | fix-gpt-ubuntu.py | #!/usr/bin/env python
#
# Copyright 2014 Microsoft Corporation
#
# 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 applic... | Add script to fix gpt mounting issue with ubuntu. | Add script to fix gpt mounting issue with ubuntu.
| Python | apache-2.0 | fieryorc/WALinuxAgent,lizzha/WALinuxAgent,jerickso/WALinuxAgent,SuperScottz/WALinuxAgent,yuezh/WALinuxAgent,thomas1206/WALinuxAgent,AbelHu/WALinuxAgent,thomas1206/WALinuxAgent,karataliu/WALinuxAgent,karataliu/WALinuxAgent,AbelHu/WALinuxAgent,ryanmiao/WALinuxAgent,ryanmiao/WALinuxAgent,SuperScottz/WALinuxAgent,yuezh/WAL... | ---
+++
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 Microsoft Corporation
+#
+# 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/LICEN... | |
aec7f2bee97d79777e418b4752b5e9ce4d9f2a2c | dit/math/tests/test_fraction.py | dit/math/tests/test_fraction.py | from __future__ import division
from nose.tools import *
from fractions import Fraction
from ..fraction import *
def test_fraction():
"""Smoke tests to convert float to fraction."""
numerators = range(10)
denominator = 10
xvals = [x / denominator for x in numerators]
af = lambda x: approximate_fr... | Add some unit tests for approximate fractions. | Add some unit tests for approximate fractions.
| Python | bsd-3-clause | dit/dit,Autoplectic/dit,Autoplectic/dit,chebee7i/dit,dit/dit,chebee7i/dit,dit/dit,Autoplectic/dit,Autoplectic/dit,chebee7i/dit,Autoplectic/dit,dit/dit,dit/dit,chebee7i/dit | ---
+++
@@ -0,0 +1,36 @@
+from __future__ import division
+
+from nose.tools import *
+
+from fractions import Fraction
+from ..fraction import *
+
+def test_fraction():
+ """Smoke tests to convert float to fraction."""
+ numerators = range(10)
+ denominator = 10
+ xvals = [x / denominator for x in numera... | |
807ceb2de5dd0f9d84d17252b0929c1c7136919d | utils/generate_plenary_agenda_md.py | utils/generate_plenary_agenda_md.py | #!/usr/bin/env python3.8
import sys
import yaml
def print_votes(votes):
if votes:
for v in votes:
print("""* [#{num}](https://github.com/mpi-forum/mpi-issues/issues/{num}): {description}"""
.format(num=v['number'], description=v['description']))
def main():
agenda_year... | Add script to convert agenda to markdown | Add script to convert agenda to markdown
| Python | mit | mpi-forum/mpi-forum.github.io,mpi-forum/mpi-forum.github.io,mpi-forum/mpi-forum.github.io,mpi-forum/mpi-forum.github.io,mpi-forum/mpi-forum.github.io | ---
+++
@@ -0,0 +1,57 @@
+#!/usr/bin/env python3.8
+
+import sys
+import yaml
+
+def print_votes(votes):
+ if votes:
+ for v in votes:
+ print("""* [#{num}](https://github.com/mpi-forum/mpi-issues/issues/{num}): {description}"""
+ .format(num=v['number'], description=v['descrip... | |
541d4080821692ed879bfee47eb0ce1a8b278dac | Python/reverse-words-in-a-string-iii.py | Python/reverse-words-in-a-string-iii.py | # Time: O(n)
# Space: O(1)
# Given a string, you need to reverse the order of characters in each word within a sentence
# while still preserving whitespace and initial word order.
#
# Example 1:
# Input: "Let's take LeetCode contest"
# Output: "s'teL ekat edoCteeL tsetnoc"
# Note: In the string, each word is separate... | # Time: O(n)
# Space: O(1)
# Given a string, you need to reverse the order of characters in each word within a sentence
# while still preserving whitespace and initial word order.
#
# Example 1:
# Input: "Let's take LeetCode contest"
# Output: "s'teL ekat edoCteeL tsetnoc"
# Note: In the string, each word is separate... | Add alternative solution for 'Reverse words in string III' | Add alternative solution for 'Reverse words in string III'
| Python | mit | kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015 | ---
+++
@@ -26,3 +26,9 @@
reverse(s, i, j)
i = j + 1
return "".join(s)
+
+
+class Solution2(object):
+ def reverseWords(self, s):
+ reversed_words = [word[::-1] for word in s.split(' ')]
+ return ' '.join(reversed_words) |
cee058cf81fc0baba625942d90a5fd3f67fb9bec | util/generate_loading_gif.py | util/generate_loading_gif.py | #!/usr/bin/env python3
""" Generate a "loading" or "waiting" animated gif. """
import math
import PIL.Image
import PIL.ImageDraw
SIZE = 16
TOTAL_DOTS = 8
VISUAL_DOTS = 4 # how many dots are visible in each frame.
DIAMETER = SIZE / 8.0
SECONDS = 1.25 # how long it takes to do a complete cycle.
OUTPUT = "loading.gi... | Add script to generate the "loading" animation | Add script to generate the "loading" animation
| Python | bsd-2-clause | Tarsnap/tarsnap-gui,Tarsnap/tarsnap-gui,Tarsnap/tarsnap-gui,Tarsnap/tarsnap-gui,Tarsnap/tarsnap-gui | ---
+++
@@ -0,0 +1,74 @@
+#!/usr/bin/env python3
+
+""" Generate a "loading" or "waiting" animated gif. """
+
+import math
+
+import PIL.Image
+import PIL.ImageDraw
+
+SIZE = 16
+TOTAL_DOTS = 8
+VISUAL_DOTS = 4 # how many dots are visible in each frame.
+DIAMETER = SIZE / 8.0
+SECONDS = 1.25 # how long it takes to ... | |
fe3a40caf31aa1eaff4e1b6ce7dba3e01a27eec7 | rgb_color_k_nearest.py | rgb_color_k_nearest.py | #!/usr/bin/env python
# rgb2_color_k_nearest.py
# by wilsonmar@gmail.com, ayush.original@gmail.com, paarth.n@gmail.com
# This is not the complete/correct approach. This is just the framework possibly of using ML
import numpy as np
from sklearn import preprocessing, cross_validation, neighbors
import pandas as pd
df = ... | Add basic ML framework- does not work though | Add basic ML framework- does not work though
| Python | mit | jetbloom/rgb2colorname,jetbloom/rgb2colorname | ---
+++
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# rgb2_color_k_nearest.py
+# by wilsonmar@gmail.com, ayush.original@gmail.com, paarth.n@gmail.com
+# This is not the complete/correct approach. This is just the framework possibly of using ML
+import numpy as np
+from sklearn import preprocessing, cross_validation, nei... | |
18b93a1c998c720554554b5797bcd1a5a38e4e77 | util/hgfilesize.py | util/hgfilesize.py | from mercurial import context
from mercurial.i18n import _
'''
[extensions]
hgfilesize=~/m5/incoming/util/hgfilesize.py
[hooks]
pretxncommit = python:hgfilesize.limit_file_size
pretxnchangegroup = python:hgfilesize.limit_file_size
[limit_file_size]
maximum_file_size = 200000
'''
def limit_file_size(ui, repo, node=N... | Add a hook to limit the size of any individual file | hooks: Add a hook to limit the size of any individual file
| Python | bsd-3-clause | andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin,andrewfu0325/gem5-aladdin | ---
+++
@@ -0,0 +1,32 @@
+from mercurial import context
+from mercurial.i18n import _
+
+'''
+[extensions]
+hgfilesize=~/m5/incoming/util/hgfilesize.py
+
+[hooks]
+pretxncommit = python:hgfilesize.limit_file_size
+pretxnchangegroup = python:hgfilesize.limit_file_size
+
+[limit_file_size]
+maximum_file_size = 200000
+... | |
fc60ac22d7497e8350351a5c82a86588c6a224fe | setup_base.py | setup_base.py | from distutils.core import setup
long_description="""HTML parser designed to follow the WHATWG HTML5
specification. The parser is designed to handle all flavours of HTML and
parses invalid documents using well-defined error handling rules compatible
with the behaviour of major desktop web browsers.
Output is to a t... | Add base setup file for generating packages | Add base setup file for generating packages
--HG--
extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40527
| Python | mit | gsnedders/html5lib-python,alex/html5lib-python,mindw/html5lib-python,mindw/html5lib-python,ordbogen/html5lib-python,ordbogen/html5lib-python,dstufft/html5lib-python,html5lib/html5lib-python,mgilson/html5lib-python,alex/html5lib-python,alex/html5lib-python,mgilson/html5lib-python,html5lib/html5lib-python,mgilson/html5li... | ---
+++
@@ -0,0 +1,34 @@
+from distutils.core import setup
+
+long_description="""HTML parser designed to follow the WHATWG HTML5
+specification. The parser is designed to handle all flavours of HTML and
+parses invalid documents using well-defined error handling rules compatible
+with the behaviour of major deskto... | |
1635bf028cf2a1a971f082370c94c446801ac444 | ObjectTracking/DisplayVideoStream.py | ObjectTracking/DisplayVideoStream.py | import cv2
cv2.namedWindow("preview")
vc = cv2.VideoCapture(0)
if vc.isOpened(): # try to get the first frame
rval, frame = vc.read()
else:
rval = False
while rval:
cv2.imshow("preview", frame)
rval, frame = vc.read()
key = cv2.waitKey(20)
if key == 27: # exit on ESC
break
| Add python script to diplay webcam video stream | Add python script to diplay webcam video stream
| Python | mit | baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite | ---
+++
@@ -0,0 +1,17 @@
+import cv2
+
+cv2.namedWindow("preview")
+
+vc = cv2.VideoCapture(0)
+
+if vc.isOpened(): # try to get the first frame
+ rval, frame = vc.read()
+else:
+ rval = False
+
+while rval:
+ cv2.imshow("preview", frame)
+ rval, frame = vc.read()
+ key = cv2.waitKey(20)
+ if key ==... | |
4e6705acffe2ecc42bb934863629eb597375e8dc | data_provider.py | data_provider.py | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 10 00:15:50 2017
@author: sakurai
"""
import numpy as np
from sklearn.preprocessing import LabelEncoder
from datasets import get_cars196_streams
class DataProvider(object):
def __init__(self, stream, batch_size):
self._stream = stream
if hasattr(st... | Implement a class to feed minibatches for N-pair-mc training | Implement a class to feed minibatches for N-pair-mc training
| Python | mit | ronekko/deep_metric_learning | ---
+++
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Tue Jan 10 00:15:50 2017
+
+@author: sakurai
+"""
+
+import numpy as np
+from sklearn.preprocessing import LabelEncoder
+
+from datasets import get_cars196_streams
+
+
+class DataProvider(object):
+ def __init__(self, stream, batch_size):
+ ... | |
822cb468c033c81d8107d865715d024177b38fcd | CodeFights/doodledPassword.py | CodeFights/doodledPassword.py | #!/usr/local/bin/python
# Code Fights Alphabetic Shift Problem
from collections import deque
def doodledPassword(digits):
n = len(digits)
res = [deque(digits) for _ in range(n)]
deque(map(lambda i_x: i_x[1].rotate(-i_x[0]), enumerate(res)), 0)
return [list(d) for d in res]
def main():
tests = [... | Solve Code Fights doodled password problem | Solve Code Fights doodled password problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,70 @@
+#!/usr/local/bin/python
+# Code Fights Alphabetic Shift Problem
+
+from collections import deque
+
+
+def doodledPassword(digits):
+ n = len(digits)
+ res = [deque(digits) for _ in range(n)]
+ deque(map(lambda i_x: i_x[1].rotate(-i_x[0]), enumerate(res)), 0)
+ return [list(d) for... | |
14118d824b3d9b25b4c6cebd0f94d81ea64b4add | test/test_cache/test_cache_categories.py | test/test_cache/test_cache_categories.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2015 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | Add tests for categories in cache | Add tests for categories in cache
| Python | agpl-3.0 | PyBossa/pybossa,Scifabric/pybossa,geotagx/pybossa,PyBossa/pybossa,Scifabric/pybossa,geotagx/pybossa | ---
+++
@@ -0,0 +1,51 @@
+# -*- coding: utf8 -*-
+# This file is part of PyBossa.
+#
+# Copyright (C) 2015 SF Isle of Man Limited
+#
+# PyBossa is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either... | |
73d2cf253bbc11d7878db55823240824646f6079 | tests/check_locale_format_consistency.py | tests/check_locale_format_consistency.py | import re
import json
import glob
locale_folder = "../locales/"
locale_files = glob.glob(locale_folder + "*.json")
locale_files = [filename.split("/")[-1] for filename in locale_files]
locale_files.remove("en.json")
reference = json.loads(open(locale_folder + "en.json").read())
for locale_file in locale_files:
... | Add draft of linter script to check locale format consistency | Add draft of linter script to check locale format consistency
| Python | agpl-3.0 | YunoHost/yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost | ---
+++
@@ -0,0 +1,28 @@
+import re
+import json
+import glob
+
+locale_folder = "../locales/"
+locale_files = glob.glob(locale_folder + "*.json")
+locale_files = [filename.split("/")[-1] for filename in locale_files]
+locale_files.remove("en.json")
+
+reference = json.loads(open(locale_folder + "en.json").read())
+
... | |
81468159a3fec44ba3d764d1fbf6545bc604468b | accounts/tests/test_registration_view.py | accounts/tests/test_registration_view.py | from django.test import TestCase
from django.core.urlresolvers import reverse
from ..models import PendingUser
class RegisterViewTestCase(TestCase):
def test_view_loads(self):
response = self.client.get(reverse('accounts:register'))
self.assertEqual(response.status_code, 200)
self.assert... | Add tests for registration view | Add tests for registration view
| Python | mit | Atilla106/members.atilla.org,Atilla106/members.atilla.org,Atilla106/members.atilla.org,Atilla106/members.atilla.org,Atilla106/members.atilla.org | ---
+++
@@ -0,0 +1,51 @@
+from django.test import TestCase
+from django.core.urlresolvers import reverse
+
+from ..models import PendingUser
+
+
+class RegisterViewTestCase(TestCase):
+ def test_view_loads(self):
+ response = self.client.get(reverse('accounts:register'))
+
+ self.assertEqual(response... | |
92759e9df89664ae515e51825982141750921ce3 | src/sample_xblocks/basic/test/test_view_counter.py | src/sample_xblocks/basic/test/test_view_counter.py | """ Simple test for the view counter that verifies that it is updating properly """
from collections import namedtuple
from mock import Mock
from xblock.runtime import KvsFieldData, DictKeyValueStore
from xblock.view_counter import ViewCounter
from xblock.test.tools import assert_in, assert_equals
TestUsage = nam... | """ Simple test for the view counter that verifies that it is updating properly """
from collections import namedtuple
from mock import Mock
from xblock.runtime import KvsFieldData, DictKeyValueStore
from sample_xblocks.basic.view_counter import ViewCounter
from xblock.test.tools import assert_in, assert_equals
T... | Use the correct location of view_counter in test | Use the correct location of view_counter in test
| Python | apache-2.0 | stvstnfrd/xblock-sdk,dcadams/xblock-sdk,edx/xblock-sdk,jamiefolsom/xblock-sdk,edx/xblock-sdk,stvstnfrd/xblock-sdk,nagyistoce/edx-xblock-sdk,lovehhf/xblock-sdk,edx-solutions/xblock-sdk,Pilou81715/hackathon_edX,Pilou81715/hackathon_edX,edx-solutions/xblock-sdk,lovehhf/xblock-sdk,lovehhf/xblock-sdk,nagyistoce/edx-xblock-s... | ---
+++
@@ -5,7 +5,7 @@
from mock import Mock
from xblock.runtime import KvsFieldData, DictKeyValueStore
-from xblock.view_counter import ViewCounter
+from sample_xblocks.basic.view_counter import ViewCounter
from xblock.test.tools import assert_in, assert_equals
|
ddc73ffe5f68d57afc8965078fcdc8f61aaf589d | tests/app/test_model.py | tests/app/test_model.py | from app import create_app, ApiClient
from .flask_api_client.test_api_client import TestApiClient
from .helpers import BaseApplicationTest
from app.model import User
from nose.tools import assert_equal
class TestModel(BaseApplicationTest):
def __init__(self):
self.app = create_app('test')
self.a... | Move test to it's own file | Move test to it's own file
The `from_json` method being tested has moved from the api client to the model,
so I've moved the test to reflect the change.
| Python | mit | alphagov/digitalmarketplace-supplier-frontend,mtekel/digitalmarketplace-supplier-frontend,mtekel/digitalmarketplace-supplier-frontend,alphagov/digitalmarketplace-supplier-frontend,mtekel/digitalmarketplace-supplier-frontend,alphagov/digitalmarketplace-supplier-frontend,alphagov/digitalmarketplace-supplier-frontend,mtek... | ---
+++
@@ -0,0 +1,18 @@
+from app import create_app, ApiClient
+from .flask_api_client.test_api_client import TestApiClient
+from .helpers import BaseApplicationTest
+
+from app.model import User
+from nose.tools import assert_equal
+
+
+class TestModel(BaseApplicationTest):
+
+ def __init__(self):
+ self.... | |
0504943ebedccbeea2d22a88510aa523afa9365c | tools/data/select_class_images_from_video_proto.py | tools/data/select_class_images_from_video_proto.py | #!/usr/bin/env python
import sys
import os.path as osp
import os
import argparse
this_dir = osp.dirname(__file__)
sys.path.insert(0, osp.join(this_dir, '../../external/'))
from vdetlib.utils.protocol import proto_load, frame_path_at, annots_at_frame
import shutil
if __name__ == '__main__':
parser = argparse.Argum... | Add script select class images from video protocols. | Add script select class images from video protocols.
| Python | mit | myfavouritekk/TPN | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+import sys
+import os.path as osp
+import os
+import argparse
+this_dir = osp.dirname(__file__)
+sys.path.insert(0, osp.join(this_dir, '../../external/'))
+from vdetlib.utils.protocol import proto_load, frame_path_at, annots_at_frame
+import shutil
+
+if __name__ == ... | |
98b3f4429cb9959f294f2fb6d6345ce18339a098 | test/commands/test_object_mask.py | test/commands/test_object_mask.py | from unrealcv import client
import re
class Color(object):
''' A utility class to parse color value '''
regexp = re.compile('\(R=(.*),G=(.*),B=(.*),A=(.*)\)')
def __init__(self, color_str):
self.color_str = color_str
match = self.regexp.match(color_str)
(self.R, self.G, self.B, self... | Add a test for object mask. | Add a test for object mask.
| Python | mit | qiuwch/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv | ---
+++
@@ -0,0 +1,39 @@
+from unrealcv import client
+import re
+
+class Color(object):
+ ''' A utility class to parse color value '''
+ regexp = re.compile('\(R=(.*),G=(.*),B=(.*),A=(.*)\)')
+ def __init__(self, color_str):
+ self.color_str = color_str
+ match = self.regexp.match(color_str)
+... | |
08718ce949e7f80b0cbe39c3eba4446133c6d72d | code/marv-api/marv_api/deprecation.py | code/marv-api/marv_api/deprecation.py | # Copyright 2020 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
import warnings
from dataclasses import dataclass
from typing import Any
@dataclass
class Info:
module: str
version: str
obj: Any
msg: str = None
def make_getattr(module, dct):
assert all(x.module == module for x in dct.values... | # Copyright 2020 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
import functools
import warnings
from dataclasses import dataclass
from typing import Any
@dataclass
class Info:
module: str
version: str
obj: Any
msg: str = None
def make_getattr(module, dct):
assert all(x.module == module fo... | Add decorator to declare function deprecated | Add decorator to declare function deprecated
| Python | agpl-3.0 | ternaris/marv-robotics,ternaris/marv-robotics | ---
+++
@@ -1,6 +1,7 @@
# Copyright 2020 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
+import functools
import warnings
from dataclasses import dataclass
from typing import Any
@@ -30,3 +31,18 @@
return info.obj
return __getattr__
+
+
+def deprecated(version, msg=None, name=None):
+ "... |
148cb8b58387f0e604ef93c8080be3ed533be488 | tools/data/smooth_gt.py | tools/data/smooth_gt.py | #!/usr/bin/env python
import sys
import os.path as osp
this_dir = osp.dirname(__file__)
sys.path.insert(0, osp.join(this_dir, '../../external/'))
from vdetlib.utils.protocol import proto_load, proto_dump
import argparse
import numpy as np
import scipy.ndimage
if __name__ == '__main__':
parser = argparse.Argument... | Add a script to smooth gt tracks. | Add a script to smooth gt tracks.
| Python | mit | myfavouritekk/TPN | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import sys
+import os.path as osp
+this_dir = osp.dirname(__file__)
+sys.path.insert(0, osp.join(this_dir, '../../external/'))
+from vdetlib.utils.protocol import proto_load, proto_dump
+import argparse
+import numpy as np
+import scipy.ndimage
+
+
+if __name__ == '_... | |
98f4a1c0fc1562d49d86b4b8f6763f2ce259280d | eche/eche_types.py | eche/eche_types.py | class Symbol(str):
pass
# lists
class List(list):
def __add__(self, rhs):
return List(list.__add__(self, rhs))
def __getitem__(self, i):
if type(i) == slice:
return List(list.__getitem__(self, i))
elif i >= len(self):
return None
else:
r... | Create Symbol, List, Boolean, Nil and Atom types. | Create Symbol, List, Boolean, Nil and Atom types.
| Python | mit | skk/eche | ---
+++
@@ -0,0 +1,54 @@
+class Symbol(str):
+ pass
+
+
+# lists
+class List(list):
+ def __add__(self, rhs):
+ return List(list.__add__(self, rhs))
+
+ def __getitem__(self, i):
+ if type(i) == slice:
+ return List(list.__getitem__(self, i))
+ elif i >= len(self):
+ ... | |
b1079d59593a9b0e6a5c3f4ffa286ab472c174bf | rockethook.py | rockethook.py | #!/usr/bin/env python
"""Simple library for posting to Rocket.Chat via webhooks a.k.a. integrations."""
import json
import httplib
import urllib
class WebhookError(Exception):
def __init__(self, status, message):
self.status = status
self.message = 'Rocket.Chat server error, code {0}: {1}'.format... | Move code from old repo. | Move code from old repo.
| Python | mit | gevial/rockethook | ---
+++
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+"""Simple library for posting to Rocket.Chat via webhooks a.k.a. integrations."""
+
+import json
+import httplib
+import urllib
+
+
+class WebhookError(Exception):
+ def __init__(self, status, message):
+ self.status = status
+ self.message = 'Rocket.C... | |
af966370d7c13e17f7b0ad77cec8e0c53d6738f1 | alembic/versions/3b85eb7c4d7_add_dark_theme_entry.py | alembic/versions/3b85eb7c4d7_add_dark_theme_entry.py | """Add dark_theme entry
Revision ID: 3b85eb7c4d7
Revises: 3d4136d1ae1
Create Date: 2015-08-06 03:34:32.888608
"""
# revision identifiers, used by Alembic.
revision = '3b85eb7c4d7'
down_revision = '3d4136d1ae1'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('user', Column('dark_the... | Add alembic migration script for dark theme | Add alembic migration script for dark theme
| Python | mit | EIREXE/SpaceDock,EIREXE/SpaceDock,KerbalStuff/KerbalStuff,Kerbas-ad-astra/KerbalStuff,KerbalStuff/KerbalStuff,EIREXE/SpaceDock,KerbalStuff/KerbalStuff,Kerbas-ad-astra/KerbalStuff,EIREXE/SpaceDock,Kerbas-ad-astra/KerbalStuff | ---
+++
@@ -0,0 +1,25 @@
+"""Add dark_theme entry
+
+Revision ID: 3b85eb7c4d7
+Revises: 3d4136d1ae1
+Create Date: 2015-08-06 03:34:32.888608
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '3b85eb7c4d7'
+down_revision = '3d4136d1ae1'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade()... | |
f647b1bc68a76d990d452d50bb2d67981db12c4c | importlib_resources/tests/test_abc.py | importlib_resources/tests/test_abc.py | import io
import zipfile
import unittest
from importlib_resources._compat import ZipPath, Path
from importlib_resources.abc import Traversable
class TraversableTests(unittest.TestCase):
def test_zip_path_traversable(self):
zf = zipfile.ZipFile(io.BytesIO(), 'w')
assert isinstance(ZipPath(zf), Tra... | Add tests for Traversable on pathlib and zipfile Path objects. | Add tests for Traversable on pathlib and zipfile Path objects.
| Python | apache-2.0 | python/importlib_resources | ---
+++
@@ -0,0 +1,15 @@
+import io
+import zipfile
+import unittest
+
+from importlib_resources._compat import ZipPath, Path
+from importlib_resources.abc import Traversable
+
+
+class TraversableTests(unittest.TestCase):
+ def test_zip_path_traversable(self):
+ zf = zipfile.ZipFile(io.BytesIO(), 'w')
+ ... | |
ca8efa51b4a8269089671ec24ccbf5d5ed56dd71 | astropy/table/tests/test_subclass.py | astropy/table/tests/test_subclass.py | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# TEST_UNICODE_LITERALS
from ... import table
class MyRow(table.Row):
def __str__(self):
return str(self.data)
class MyColumn(table.Column):
def cool(self):
return 'Cool!'
class MyMaskedColumn(table.C... | Add initial tests of subclassing components | Add initial tests of subclassing components
| Python | bsd-3-clause | kelle/astropy,MSeifert04/astropy,pllim/astropy,aleksandr-bakanov/astropy,larrybradley/astropy,tbabej/astropy,bsipocz/astropy,joergdietrich/astropy,joergdietrich/astropy,mhvk/astropy,stargaser/astropy,kelle/astropy,dhomeier/astropy,pllim/astropy,astropy/astropy,DougBurke/astropy,saimn/astropy,MSeifert04/astropy,larrybra... | ---
+++
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+# Licensed under a 3-clause BSD style license - see LICENSE.rst
+
+# TEST_UNICODE_LITERALS
+
+from ... import table
+
+
+class MyRow(table.Row):
+ def __str__(self):
+ return str(self.data)
+
+
+class MyColumn(table.Column):
+ def cool(self):
+ re... | |
fc616c89e0b647c5ada9f15bfdc508fd77e1b391 | tests/task.py | tests/task.py | from mongoengine import ValidationError
from nose.tools import raises
from app.task import Priority, Task
def test_Set_Title_String():
task = Task()
task.title = "Hello"
assert task.title == "Hello"
@raises(ValidationError)
def test_Set_Title_Int():
task = Task()
task.title = 1
# Should th... | Add some tests for the Task model | Add some tests for the Task model
| Python | mit | Zillolo/lazy-todo | ---
+++
@@ -0,0 +1,26 @@
+from mongoengine import ValidationError
+from nose.tools import raises
+
+from app.task import Priority, Task
+
+def test_Set_Title_String():
+ task = Task()
+
+ task.title = "Hello"
+ assert task.title == "Hello"
+
+@raises(ValidationError)
+def test_Set_Title_Int():
+ task = Ta... | |
314c40bbfa33f5ae71b35b50de5305dc20b8fd9d | src/rnaseq_lib/civic/__init__.py | src/rnaseq_lib/civic/__init__.py | import requests
import progressbar
import pandas as pd
bar = progressbar.ProgressBar()
def create_civic_drug_disease_dataframe():
payload = {'count': 999} # Only 295 genes at time of writing
request = requests.get('https://civic.genome.wustl.edu/api/genes/', params=payload)
assert request.status_code ==... | Add function to retrieve CIViC Drug / Disease information | Add function to retrieve CIViC Drug / Disease information
| Python | mit | jvivian/rnaseq-lib,jvivian/rnaseq-lib | ---
+++
@@ -0,0 +1,35 @@
+import requests
+import progressbar
+import pandas as pd
+
+bar = progressbar.ProgressBar()
+
+
+def create_civic_drug_disease_dataframe():
+ payload = {'count': 999} # Only 295 genes at time of writing
+ request = requests.get('https://civic.genome.wustl.edu/api/genes/', params=paylo... | |
205ce3a2d480e0d05bbdfd9cd2c2f3bafc08a061 | gorynych/task.py | gorynych/task.py | #!/usr/bin/python3
from enum import Enum
class State(Enum):
inactive = 1
active = 2
running = 3
paused = 4
aborted = 5
failed = 6
frozen = 7
class Task(object):
def __init__(self):
self.state = State.inactive
self.scarab = None
def activate(self):
sel... | Add dummy module of Task class | Add dummy module of Task class
| Python | apache-2.0 | vurmux/gorynych | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/python3
+
+
+from enum import Enum
+
+
+class State(Enum):
+ inactive = 1
+ active = 2
+ running = 3
+ paused = 4
+ aborted = 5
+ failed = 6
+ frozen = 7
+
+
+class Task(object):
+
+ def __init__(self):
+ self.state = State.inactive
+ self.sc... | |
3265a243e5bea63d49259d0e56b4270ca322e696 | ckanext/requestdata/logic/actions.py | ckanext/requestdata/logic/actions.py | from ckan.plugins import toolkit
from ckan.logic import check_access
import ckan.lib.navl.dictization_functions as df
from ckanext.requestdata.logic import schema
from ckanext.requestdata.model import ckanextRequestdata
def request_create(context, data_dict):
'''Create new request data.
:param sender_name: ... | Add action for creating new request data | Add action for creating new request data
| Python | agpl-3.0 | ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata | ---
+++
@@ -0,0 +1,84 @@
+from ckan.plugins import toolkit
+from ckan.logic import check_access
+import ckan.lib.navl.dictization_functions as df
+
+from ckanext.requestdata.logic import schema
+from ckanext.requestdata.model import ckanextRequestdata
+
+
+def request_create(context, data_dict):
+ '''Create new re... | |
eacf27ebc042799a586039c76aa9cdd29d03c03d | lily/deals/migrations/0008_auto_20150930_1720.py | lily/deals/migrations/0008_auto_20150930_1720.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.db.models import Count
def set_correct_status(apps, schema_editor):
"""
Some deals had incorrect status of new business.
This migration tries to fix that for two cases:
- When an acc... | Migrate certain deals to set status new business | Migrate certain deals to set status new business
| Python | agpl-3.0 | HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily | ---
+++
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+from django.db.models import Count
+
+
+def set_correct_status(apps, schema_editor):
+ """
+ Some deals had incorrect status of new business.
+
+ This migration tries to fix... | |
ab1bcd10d7abf226b4f85970eec6e27512a431f2 | CodeFights/codefighterAttribute.py | CodeFights/codefighterAttribute.py | #!/usr/local/bin/python
# Code Fights Codefighter Attribute Problem
class CodeFighter(object):
def __init__(self, username, _id, xp, name):
self.username = username
self._id = _id
self.xp = xp
self.name = name
def __getattr__(self, attribute, default=None):
if default ... | Solve Code Fights codefighter attribute problem | Solve Code Fights codefighter attribute problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/local/bin/python
+# Code Fights Codefighter Attribute Problem
+
+
+class CodeFighter(object):
+ def __init__(self, username, _id, xp, name):
+ self.username = username
+ self._id = _id
+ self.xp = xp
+ self.name = name
+
+ def __getattr__(self, attrib... | |
f0146cfdf639df8905f7240ca8ef939fbd328ece | pentagon/migration/migrations/migration_2_5_0.py | pentagon/migration/migrations/migration_2_5_0.py | from pentagon import migration
from pentagon.migration import *
from pentagon.component import core, inventory
from pentagon.helpers import merge_dict
import re
class Migration(migration.Migration):
_starting_version = '2.5.0'
_ending_version = '2.6.0'
def run(self):
for item in self.inventory:
... | Add migration for VPC module update | Add migration for VPC module update
| Python | apache-2.0 | reactiveops/pentagon,reactiveops/pentagon,reactiveops/pentagon | ---
+++
@@ -0,0 +1,44 @@
+from pentagon import migration
+from pentagon.migration import *
+from pentagon.component import core, inventory
+from pentagon.helpers import merge_dict
+
+import re
+
+
+class Migration(migration.Migration):
+ _starting_version = '2.5.0'
+ _ending_version = '2.6.0'
+
+ def run(sel... | |
fa475825a9d31aab6f5f4cb8851531ec5207315c | scripts/kanimaji_batch.py | scripts/kanimaji_batch.py | #!/usr/bin/env python2
import os
import progressbar
svgs = filter(lambda f: f.endswith(".svg"), os.listdir("."))
bar = progressbar.ProgressBar()
for svg in bar(svgs):
os.system("./kanimaji/kanimaji.py %s > /dev/null" % svg) | Add batch script for kanji animations | Add batch script for kanji animations
| Python | apache-2.0 | Tenchi2xh/rem-v2,Tenchi2xh/rem-v2,Tenchi2xh/rem-v2 | ---
+++
@@ -0,0 +1,11 @@
+#!/usr/bin/env python2
+
+import os
+import progressbar
+
+svgs = filter(lambda f: f.endswith(".svg"), os.listdir("."))
+
+bar = progressbar.ProgressBar()
+
+for svg in bar(svgs):
+ os.system("./kanimaji/kanimaji.py %s > /dev/null" % svg) | |
b4fa0194d995fd2ae20a11d8f27a6273e1f01aa9 | sci_lib.py | sci_lib.py | #!/usr/bin/python
#Author: Scott T. Salesky
#Created: 12.6.2014
#Purpose: Collection of functions, routines to use
#Python for scientific work
#----------------------------------------------
| Add function to read 3d direct access Fortran binary files into NumPy arrays. | Add function to read 3d direct access Fortran binary files into NumPy arrays.
| Python | mit | ssalesky/Science-Library | ---
+++
@@ -0,0 +1,6 @@
+#!/usr/bin/python
+#Author: Scott T. Salesky
+#Created: 12.6.2014
+#Purpose: Collection of functions, routines to use
+#Python for scientific work
+#---------------------------------------------- | |
700fa0144c5276d8e31c01a243340f6cbac07e8f | sentry/client/handlers.py | sentry/client/handlers.py | import logging
class SentryHandler(logging.Handler):
def emit(self, record):
from sentry.client.models import get_client
get_client().create_from_record(record) | import logging
import sys
class SentryHandler(logging.Handler):
def emit(self, record):
from sentry.client.models import get_client
# Avoid typical config issues by overriding loggers behavior
if record.name == 'sentry.errors':
print >> sys.stderr, record.message
re... | Add a safety net for recursive logging | Add a safety net for recursive logging
| Python | bsd-3-clause | ewdurbin/sentry,hongliang5623/sentry,Photonomie/raven-python,ewdurbin/raven-python,daevaorn/sentry,NickPresta/sentry,dcramer/sentry-old,looker/sentry,NickPresta/sentry,chayapan/django-sentry,Kryz/sentry,BuildingLink/sentry,gencer/sentry,boneyao/sentry,danriti/raven-python,imankulov/sentry,nikolas/raven-python,mvaled/se... | ---
+++
@@ -1,7 +1,13 @@
import logging
+import sys
class SentryHandler(logging.Handler):
def emit(self, record):
from sentry.client.models import get_client
+ # Avoid typical config issues by overriding loggers behavior
+ if record.name == 'sentry.errors':
+ print >> sys.... |
e4d7375b2706dd46cf08831e5f005ce3a3c17553 | embedding_server/embedding_server.py | embedding_server/embedding_server.py | from flask import Flask
from flask import request, abort, jsonify
import numpy as np
import gensim
import re
import string
app = Flask(__name__)
model = None
maxSeqLength = 70
numFeatures = 300
def get_tokens(s):
return re.sub('[{}]'.format(string.punctuation), '', s).lower().split()
def get_sequence_matrix(to... | Add server for embedding transformation | Add server for embedding transformation
| Python | mit | DolphinBlockchainIntelligence/bitcointalk-sentiment | ---
+++
@@ -0,0 +1,70 @@
+from flask import Flask
+from flask import request, abort, jsonify
+import numpy as np
+import gensim
+import re
+import string
+
+app = Flask(__name__)
+
+model = None
+maxSeqLength = 70
+numFeatures = 300
+
+
+def get_tokens(s):
+ return re.sub('[{}]'.format(string.punctuation), '', s).... | |
02ef9c6e77ce4ba1521eaf590b2bcba278ab2814 | tests/test_wendy.py | tests/test_wendy.py | # test_wendy.py: some basic tests
import numpy
import wendy
def test_energy_conservation():
# Test that energy is conserved for a simple problem
x= numpy.array([-1.1,0.1,1.3])
v= numpy.array([3.,2.,-5.])
m= numpy.array([1.,1.,1.])
g= wendy.nbody(x,v,m,0.05)
E= wendy.energy(x,v,m)
cnt= 0
... | Add a bunch of simple tests | Add a bunch of simple tests
| Python | mit | jobovy/wendy,jobovy/wendy | ---
+++
@@ -0,0 +1,58 @@
+# test_wendy.py: some basic tests
+import numpy
+import wendy
+def test_energy_conservation():
+ # Test that energy is conserved for a simple problem
+ x= numpy.array([-1.1,0.1,1.3])
+ v= numpy.array([3.,2.,-5.])
+ m= numpy.array([1.,1.,1.])
+ g= wendy.nbody(x,v,m,0.05)
+ E... | |
529d72ff62f3d4b8ab18a26beadd20322a118a28 | client/scripts/osutil.py | client/scripts/osutil.py | import sys
class OSUtil():
def __init__(self):
pass
def platform(self):
platform = sys.platform # Map from python platform name to ue4 platform name
names = {
'cygwin': 'Win', # could be win32 also
'win32': 'Win',
'win64': 'Win',
'linux2'... | import sys, platform
class OSUtil():
def __init__(self):
pass
def platform(self):
win = 'Win'
mac = 'Mac'
linux = 'Linux'
if platform.release().endswith('Microsoft'):
# This is a hacky way to check whether I am running Ubuntu on Windows
return wi... | Fix the platform check for windows. | Fix the platform check for windows.
| Python | mit | qiuwch/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv | ---
+++
@@ -1,16 +1,23 @@
-import sys
+import sys, platform
class OSUtil():
def __init__(self):
pass
def platform(self):
- platform = sys.platform # Map from python platform name to ue4 platform name
+ win = 'Win'
+ mac = 'Mac'
+ linux = 'Linux'
+ if platform... |
37848cc0a6cffe9c12dda905715fd1e347603560 | routing_table.py | routing_table.py | import pandas
class DynamicTable(object):
"""
Dynamically sized table.
"""
def __init__(self, *args, **kwargs):
self._data = pandas.DataFrame(*args, **kwargs)
def __getitem__(self, key):
"""
Retrieve a value from the table.
Note
----
The first inde... | Add routing table class based on pandas.DataFrame. | Add routing table class based on pandas.DataFrame.
| Python | bsd-3-clause | cerrno/neurokernel | ---
+++
@@ -0,0 +1,113 @@
+import pandas
+
+class DynamicTable(object):
+ """
+ Dynamically sized table.
+ """
+
+ def __init__(self, *args, **kwargs):
+ self._data = pandas.DataFrame(*args, **kwargs)
+
+ def __getitem__(self, key):
+ """
+ Retrieve a value from the table.
+
+ ... | |
4df85e49d48a76246d97383ac6a5d63e1ce2be60 | tests/basics/builtin_hash.py | tests/basics/builtin_hash.py | # test builtin hash function
class A:
def __hash__(self):
return 123
def __repr__(self):
return "a instance"
print(hash(A()))
print({A():1})
| Add test for hash of user defined class. | tests: Add test for hash of user defined class.
| Python | mit | Peetz0r/micropython-esp32,henriknelson/micropython,drrk/micropython,dxxb/micropython,kerneltask/micropython,SHA2017-badge/micropython-esp32,turbinenreiter/micropython,martinribelotta/micropython,tobbad/micropython,misterdanb/micropython,Peetz0r/micropython-esp32,ganshun666/micropython,galenhz/micropython,mgyenik/microp... | ---
+++
@@ -0,0 +1,10 @@
+# test builtin hash function
+
+class A:
+ def __hash__(self):
+ return 123
+ def __repr__(self):
+ return "a instance"
+
+print(hash(A()))
+print({A():1}) | |
e149bddfe280e37adf2b67500c0696a86c9341dc | tests/test_in_serializers.py | tests/test_in_serializers.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_in_serializers
-------------------
Tests of the fields cooperation in the serializer interfaces for serialization, de-serialization,
and validation.
"""
# Django settings:
import os
os.environ['DJANGO_SETTINGS_MODULE'] = __name__
from django.conf.global_sett... | Add tests of fields in serializers | Add tests of fields in serializers
| Python | bsd-3-clause | estebistec/drf-compound-fields,pombredanne/drf-compound-fields | ---
+++
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+
+"""
+test_in_serializers
+-------------------
+
+Tests of the fields cooperation in the serializer interfaces for serialization, de-serialization,
+and validation.
+
+"""
+
+
+# Django settings:
+import os
+os.environ['DJANGO_SETTINGS_MODUL... | |
51b8e860e7edf77c7333c19d7de7654f22cd1b09 | load_manifest.py | load_manifest.py | import argparse
import json
import os
import mcbench.client
def parse_args():
parser = argparse.ArgumentParser(
description='load benchmarks into McBench redis instance')
parser.add_argument(
'--redis_url',
default='redis://localhost:6379',
help='URL of redis instance.'
)
... | Add script to load data from scraper manifest. | Add script to load data from scraper manifest.
| Python | mit | isbadawi/mcbench,isbadawi/mcbench | ---
+++
@@ -0,0 +1,33 @@
+import argparse
+import json
+import os
+
+import mcbench.client
+
+
+def parse_args():
+ parser = argparse.ArgumentParser(
+ description='load benchmarks into McBench redis instance')
+ parser.add_argument(
+ '--redis_url',
+ default='redis://localhost:6379',
+ ... | |
40da5ab867f49f5db64d0c58e19723149d2f8243 | cms/tests/plugins_mti.py | cms/tests/plugins_mti.py | # -*- coding: utf-8 -*-
from django.conf import settings
from cms.models import Page
from cms.models.pluginmodel import CMSPlugin
from cms.test_utils.util.context_managers import SettingsOverride
from cms.test_utils.testcases import (
URL_CMS_PAGE_ADD,
URL_CMS_PLUGIN_ADD,
URL_CMS_PLUGIN_EDIT,
)
from cms.... | Create test case for MTI Plugins | Create test case for MTI Plugins
| Python | bsd-3-clause | rryan/django-cms,datakortet/django-cms,owers19856/django-cms,qnub/django-cms,mkoistinen/django-cms,rryan/django-cms,stefanfoulis/django-cms,petecummings/django-cms,wyg3958/django-cms,jeffreylu9/django-cms,nimbis/django-cms,netzkolchose/django-cms,jeffreylu9/django-cms,petecummings/django-cms,vxsx/django-cms,jsma/django... | ---
+++
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+
+from django.conf import settings
+
+from cms.models import Page
+from cms.models.pluginmodel import CMSPlugin
+from cms.test_utils.util.context_managers import SettingsOverride
+from cms.test_utils.testcases import (
+ URL_CMS_PAGE_ADD,
+ URL_CMS_PLUGIN_ADD,
... | |
1458b5a02df4e983dfa54b474d1796d530d536a7 | normalize_spelling.py | normalize_spelling.py | """Normalize the spelling of the data used for machine learning
Usage: python normalize_spelling <train set> <test set> <output dir>
"""
import codecs
import json
import argparse
from collections import Counter
import os
import string
with codecs.open('hist2modern_liwc.json', 'rb', 'utf-8') as f:
full_dict = js... | Add script to normalize spelling | Add script to normalize spelling
Added a script that takes as input a training and test set containing
sentences with words separated by spaces, normalizes the spelling using
the hist2modern dictionary and writes files containing the spelling
normalized train and test set. It also outputs to std out the counts of
word... | Python | apache-2.0 | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | ---
+++
@@ -0,0 +1,75 @@
+"""Normalize the spelling of the data used for machine learning
+
+Usage: python normalize_spelling <train set> <test set> <output dir>
+"""
+
+import codecs
+import json
+import argparse
+from collections import Counter
+import os
+import string
+
+
+with codecs.open('hist2modern_liwc.json'... | |
d339980773fb9e6b61c1f5dfab935aeb2daf8d5d | tests/tests_scanimage.py | tests/tests_scanimage.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import shutil
import unittest
class TestScanimage(unittest.TestCase):
"""
TODO: Docstring
"""
def setUp(self):
pass
def tearDown(self):
pass
def test_tesseract_binary_in_path(self):
self.assertIsNotNone(shutil.which('t... | Add test for checking if tesseract binary is available | Add test for checking if tesseract binary is available
| Python | bsd-2-clause | sjktje/sjkscan,sjktje/sjkscan | ---
+++
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import shutil
+import unittest
+
+
+class TestScanimage(unittest.TestCase):
+
+ """
+ TODO: Docstring
+
+ """
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def test_tesseract_binary_in_path(sel... | |
830227bad5e32683180d7d8df12f20e5935d81ed | test/test_shortcuts.py | test/test_shortcuts.py | from nose.tools import *
from lctools.shortcuts import get_node_or_fail
class TestShortCuts(object):
def setup(self):
class MyNode(object):
def __init__(self, id):
self.id = id
class MyConn(object):
def __init__(self, nodes):
self.nodes =... | Add tests for new shortcuts. | Add tests for new shortcuts.
| Python | apache-2.0 | novel/lc-tools,novel/lc-tools | ---
+++
@@ -0,0 +1,60 @@
+from nose.tools import *
+
+from lctools.shortcuts import get_node_or_fail
+
+class TestShortCuts(object):
+
+ def setup(self):
+ class MyNode(object):
+
+ def __init__(self, id):
+ self.id = id
+
+ class MyConn(object):
+
+ def __init__(... | |
ad68c13a4080c80c88b039e3033f6b94421f4a27 | sms_send_demo.py | sms_send_demo.py | """
Basic demo of summit-python that sends a simple SMS message from the
command-line.
"""
import argparse
from summit.rest import SummitRestClient
def main():
parser = argparse.ArgumentParser(
description="Command-line SMS sender using Corvisa's Summit API.")
parser.add_argument('--key', required=T... | Add demo script to send SMS message from command_line | Add demo script to send SMS message from command_line
| Python | mit | josephl/summit-python | ---
+++
@@ -0,0 +1,34 @@
+"""
+Basic demo of summit-python that sends a simple SMS message from the
+command-line.
+"""
+
+import argparse
+
+from summit.rest import SummitRestClient
+
+
+def main():
+ parser = argparse.ArgumentParser(
+ description="Command-line SMS sender using Corvisa's Summit API.")
+ ... | |
a60ee78c65cc1920dc57bf26781cde5836271147 | indra/sources/bbn/make_bbn_ontology.py | indra/sources/bbn/make_bbn_ontology.py | import yaml
import requests
from os.path import join, dirname, abspath
from rdflib import Graph, Namespace, Literal
bb_ont_url = ('https://raw.githubusercontent.com/BBN-E/Hume/master/resource/'
'ontologies/hume_ontology.yaml')
eidos_ns = Namespace('https://github.com/clulab/eidos/wiki/JSON-LD/Grounding#... | Create separate bbn ontology retriever. | Create separate bbn ontology retriever.
| Python | bsd-2-clause | johnbachman/belpy,sorgerlab/belpy,johnbachman/belpy,johnbachman/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra,sorgerlab/indra,pvtodorov/indra,sorgerlab/belpy,bgyori/indra,pvtodorov/indra,pvtodorov/indra,bgyori/indra,johnbachman/belpy,sorgerlab/indra,johnbachman/indra,bgyori/indra,pvtodorov/indra | ---
+++
@@ -0,0 +1,61 @@
+import yaml
+import requests
+from os.path import join, dirname, abspath
+from rdflib import Graph, Namespace, Literal
+
+bb_ont_url = ('https://raw.githubusercontent.com/BBN-E/Hume/master/resource/'
+ 'ontologies/hume_ontology.yaml')
+
+eidos_ns = Namespace('https://github.com/... | |
bddd57dd75b81887cda3f82f44eaf548b6bba405 | tests/grammar_term-nonterm_test/NonterminalIterationTest.py | tests/grammar_term-nonterm_test/NonterminalIterationTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase, main
from grammpy import Grammar
from grammpy import Nonterminal
class TempClass(Nonterminal):
pass
class Second(Nonterminal):
pass
class Third(Nonterminal):
p... | Add file for nonterms iteration tests | Add file for nonterms iteration tests
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 23.06.2017 16:39
+:Licence GNUv3
+Part of grammpy
+
+"""
+from unittest import TestCase, main
+from grammpy import Grammar
+from grammpy import Nonterminal
+
+
+class TempClass(Nonterminal):
+ pass
+
+
+class Second(Nonterminal... | |
af3577a1ab0f7005d95c64be640550263efcb416 | indra/tools/reading/util/reporter.py | indra/tools/reading/util/reporter.py | from reportlab.lib.enums import TA_JUSTIFY
from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import inch
class Reporter(object):
def __init__(self, name... | Add a simple class to work with canvas tools. | Add a simple class to work with canvas tools.
| Python | bsd-2-clause | johnbachman/indra,bgyori/indra,johnbachman/indra,johnbachman/belpy,sorgerlab/belpy,johnbachman/belpy,pvtodorov/indra,sorgerlab/belpy,johnbachman/belpy,sorgerlab/indra,pvtodorov/indra,pvtodorov/indra,bgyori/indra,pvtodorov/indra,bgyori/indra,sorgerlab/indra,johnbachman/indra,sorgerlab/indra,sorgerlab/belpy | ---
+++
@@ -0,0 +1,37 @@
+from reportlab.lib.enums import TA_JUSTIFY
+from reportlab.lib.pagesizes import letter
+from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image
+from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
+from reportlab.lib.units import inch
+
+
+class Reporter(o... | |
05d7332d6305ed7d1bc75a843f91603c5997b14e | tests/test_learning.py | tests/test_learning.py | """
Learning tests.
"""
# pylint: disable=no-member
# pylint: disable=missing-docstring
# future imports
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import os
import numpy as np
import numpy.testing as nt
import pygp
import pygp.demos.basic as demo
... | Add test for the optimizer. | Add test for the optimizer.
| Python | bsd-2-clause | mwhoffman/pygp | ---
+++
@@ -0,0 +1,36 @@
+"""
+Learning tests.
+"""
+
+# pylint: disable=no-member
+# pylint: disable=missing-docstring
+
+# future imports
+from __future__ import division
+from __future__ import absolute_import
+from __future__ import print_function
+
+import os
+import numpy as np
+import numpy.testing as nt
+
+im... | |
58b9d66a10c88fb141570f7aca9ea6f471e2f82d | statsmodels/tsa/statespace/tests/test_forecasting.py | statsmodels/tsa/statespace/tests/test_forecasting.py | r"""
Tests for forecasting-related features not tested elsewhere
"""
import numpy as np
import pandas as pd
import pytest
from numpy.testing import assert_, assert_equal, assert_allclose
from statsmodels.tsa.statespace import sarimax
@pytest.mark.parametrize('data', ['list', 'numpy', 'range', 'date', 'period'])
de... | Add test for multi-step append | TST: Add test for multi-step append | Python | bsd-3-clause | jseabold/statsmodels,statsmodels/statsmodels,statsmodels/statsmodels,statsmodels/statsmodels,josef-pkt/statsmodels,bashtage/statsmodels,bashtage/statsmodels,jseabold/statsmodels,josef-pkt/statsmodels,jseabold/statsmodels,josef-pkt/statsmodels,josef-pkt/statsmodels,josef-pkt/statsmodels,bashtage/statsmodels,statsmodels/... | ---
+++
@@ -0,0 +1,49 @@
+r"""
+Tests for forecasting-related features not tested elsewhere
+"""
+
+import numpy as np
+import pandas as pd
+
+import pytest
+from numpy.testing import assert_, assert_equal, assert_allclose
+
+from statsmodels.tsa.statespace import sarimax
+
+
+@pytest.mark.parametrize('data', ['list'... | |
8d1b806e6b28bcb80bed64d1449716a218008529 | test/418-wof-l10n_name.py | test/418-wof-l10n_name.py | # Hollywood (wof neighbourhood)
# https://whosonfirst.mapzen.com/data/858/260/37/85826037.geojson
assert_has_feature(
16, 11227, 26157, 'places',
{ 'id': 85826037, 'kind': 'neighbourhood',
'source': "whosonfirst.mapzen.com",
'name': 'Hollywood',
'name:ko': '\xed\x97\x90\xeb\xa6\xac\xec\x9a\xb0... | Add l10n test for Hollywood neighbourhood | Add l10n test for Hollywood neighbourhood
| Python | mit | mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource | ---
+++
@@ -0,0 +1,8 @@
+# Hollywood (wof neighbourhood)
+# https://whosonfirst.mapzen.com/data/858/260/37/85826037.geojson
+assert_has_feature(
+ 16, 11227, 26157, 'places',
+ { 'id': 85826037, 'kind': 'neighbourhood',
+ 'source': "whosonfirst.mapzen.com",
+ 'name': 'Hollywood',
+ 'name:ko': '\x... | |
102481bc47e22424cd4d623fd84f1eb317b1d55f | zerver/migrations/0398_tsvector_statistics.py | zerver/migrations/0398_tsvector_statistics.py | # Generated by Django 4.0.6 on 2022-07-18 23:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("zerver", "0397_remove_custom_field_values_for_deleted_options"),
]
operations = [
# The "most common values" list for a tsvector is 10x this
... | Adjust stats size for tsvector to 10k, from 100. | migrations: Adjust stats size for tsvector to 10k, from 100.
PostgreSQL's `default_statistics_target` is used to track how many
"most common values" ("MCVs") for a column when performing an
`ANALYZE`. For `tsvector` columns, the number of values is actually
10x this number, because each row contains multiple values f... | Python | apache-2.0 | zulip/zulip,rht/zulip,rht/zulip,andersk/zulip,andersk/zulip,zulip/zulip,andersk/zulip,andersk/zulip,rht/zulip,andersk/zulip,andersk/zulip,rht/zulip,rht/zulip,zulip/zulip,rht/zulip,andersk/zulip,zulip/zulip,rht/zulip,zulip/zulip,zulip/zulip,zulip/zulip | ---
+++
@@ -0,0 +1,26 @@
+# Generated by Django 4.0.6 on 2022-07-18 23:22
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("zerver", "0397_remove_custom_field_values_for_deleted_options"),
+ ]
+
+ operations = [
+ # The "most common values"... | |
0d3ff29b122d01fa34eaf639fde091618e15cd4d | survey/migrations/0013_auto_20200609_0748.py | survey/migrations/0013_auto_20200609_0748.py | # Generated by Django 3.0.7 on 2020-06-09 07:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("survey", "0012_add_display_by_category")]
operations = [
migrations.AlterField(
model_name="question",
name="type",
f... | Create old migrations that were not done before | Create old migrations that were not done before
| Python | agpl-3.0 | Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey | ---
+++
@@ -0,0 +1,31 @@
+# Generated by Django 3.0.7 on 2020-06-09 07:48
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [("survey", "0012_add_display_by_category")]
+
+ operations = [
+ migrations.AlterField(
+ model_name="question",... | |
7b6e503924525046932ad671d1a39990492c37ff | convert_velocity.py | convert_velocity.py |
from astropy import units as u
import numpy as np
def optical_to_radio(vel, freq, rest):
return freq * vel / rest
def radio_to_optical(vel, freq, rest):
return rest * vel / freq
def test_opt_to_rad():
opt_vel = -2126.1876453900204 * (u.km/u.s)
rad_vel = -2141.374699999949 * (u.km/u.s)
re... | Convert between optical and radio velocities. | Convert between optical and radio velocities.
| Python | mit | e-koch/ewky_scripts,e-koch/ewky_scripts | ---
+++
@@ -0,0 +1,30 @@
+
+from astropy import units as u
+import numpy as np
+
+
+def optical_to_radio(vel, freq, rest):
+
+ return freq * vel / rest
+
+
+def radio_to_optical(vel, freq, rest):
+
+ return rest * vel / freq
+
+
+def test_opt_to_rad():
+
+ opt_vel = -2126.1876453900204 * (u.km/u.s)
+
+ ra... | |
1cb22dfdf9882de7aa6e977c79d80eac7158873e | tools/win32build/doall.py | tools/win32build/doall.py | import subprocess
import os
PYVER = "2.5"
# Bootstrap
subprocess.check_call(['python', 'prepare_bootstrap.py'])
# Build binaries
subprocess.check_call(['python', 'build.py', '-p', PYVER], cwd = 'bootstrap-%s' % PYVER)
# Build installer using nsis
subprocess.check_call(['makensis', 'numpy-superinstaller.... | Add top script to generate binaries from scratch. | Add top script to generate binaries from scratch.
git-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@5553 94b884b6-d6fd-0310-90d3-974f1d3f35e1
| Python | bsd-3-clause | efiring/numpy-work,teoliphant/numpy-refactor,Ademan/NumPy-GSoC,teoliphant/numpy-refactor,efiring/numpy-work,efiring/numpy-work,illume/numpy3k,chadnetzer/numpy-gaurdro,jasonmccampbell/numpy-refactor-sprint,illume/numpy3k,illume/numpy3k,jasonmccampbell/numpy-refactor-sprint,efiring/numpy-work,jasonmccampbell/numpy-refact... | ---
+++
@@ -0,0 +1,13 @@
+import subprocess
+import os
+
+PYVER = "2.5"
+
+# Bootstrap
+subprocess.check_call(['python', 'prepare_bootstrap.py'])
+
+# Build binaries
+subprocess.check_call(['python', 'build.py', '-p', PYVER], cwd = 'bootstrap-%s' % PYVER)
+
+# Build installer using nsis
+subprocess.check_call(['maken... | |
34ec07ef4601a7702f8d606efa0d861b11cca393 | code/animatefuse.py | code/animatefuse.py | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as anim
from mpl_toolkits.mplot3d import Axes3D
import sys
import numpy.ma as ma
i=0
fuz = 1;
minLength = 500.0
if (len(sys.argv) < 2) :
print("Usage: \n dataplot.py path_to_binfile [clamp value]")
sys.exit()
elif (len(sys.argv) > 2) :
... | Create a animated figure from a series of data | Create a animated figure from a series of data
| Python | mit | TAdeJong/plasma-analysis,TAdeJong/plasma-analysis | ---
+++
@@ -0,0 +1,50 @@
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.animation as anim
+from mpl_toolkits.mplot3d import Axes3D
+import sys
+
+import numpy.ma as ma
+
+
+i=0
+fuz = 1;
+minLength = 500.0
+if (len(sys.argv) < 2) :
+ print("Usage: \n dataplot.py path_to_binfile [clamp value]"... | |
a37521ef7b6ce40b6a182c6ff42c62f30fb12537 | tests/changes/api/test_build_details.py | tests/changes/api/test_build_details.py | from datetime import datetime
from changes.constants import Status
from changes.testutils import APITestCase
class BuildDetailsTest(APITestCase):
def test_simple(self):
previous_build = self.create_build(
self.project, date_created=datetime(2013, 9, 19, 22, 15, 23),
status=Status.... | Add simple test for build details | Add simple test for build details
| Python | apache-2.0 | bowlofstew/changes,wfxiang08/changes,wfxiang08/changes,dropbox/changes,wfxiang08/changes,bowlofstew/changes,dropbox/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes,dropbox/changes,bowlofstew/changes | ---
+++
@@ -0,0 +1,31 @@
+from datetime import datetime
+
+from changes.constants import Status
+from changes.testutils import APITestCase
+
+
+class BuildDetailsTest(APITestCase):
+ def test_simple(self):
+ previous_build = self.create_build(
+ self.project, date_created=datetime(2013, 9, 19, 22... | |
c95ff949ea70e5466cf6bd0775f1033d0ad6caab | pysyte/types/times.py | pysyte/types/times.py | """Handle datetime for pysyte's types"""
import datetime
epoch = datetime.datetime.fromtimestamp(0)
def taken(diff, days=True):
seconds = diff.seconds * 1_000 + diff.microseconds
if days:
return seconds
result = abs(diff.days * 24 * 60 * 60 + seconds)
return result
| Add method to find time taken | Add method to find time taken
| Python | mit | jalanb/dotsite | ---
+++
@@ -0,0 +1,11 @@
+"""Handle datetime for pysyte's types"""
+import datetime
+epoch = datetime.datetime.fromtimestamp(0)
+
+
+def taken(diff, days=True):
+ seconds = diff.seconds * 1_000 + diff.microseconds
+ if days:
+ return seconds
+ result = abs(diff.days * 24 * 60 * 60 + seconds)
+ retu... | |
ca61d3c9ca598dfb5bd685b6dcb81a6f933c2e36 | scripts/dist-standalone-collector.py | scripts/dist-standalone-collector.py | #!/usr/bin/python
import os
import shutil
import glob
distPath = "./dist/standalone-collector"
if not os.path.exists(distPath):
os.makedirs(distPath)
if not os.path.exists(distPath + "/simplejson"):
os.mkdir(distPath + "/simplejson")
shutil.copy("./docs/README-standalone-collector.txt", distPath + "/README.txt")
... | Add distribution script for standalone collector | Add distribution script for standalone collector
git-svn-id: 0429bb2eb6f71f8cd87fe9410a915008a087abca@34 efcc4bdc-162a-0410-a8af-5b4b46c5376d
| Python | mpl-2.0 | luser/socorro,Tchanders/socorro,luser/socorro,luser/socorro,pcabido/socorro,Tchanders/socorro,twobraids/socorro,cliqz/socorro,KaiRo-at/socorro,m8ttyB/socorro,Tchanders/socorro,AdrianGaudebert/socorro,pcabido/socorro,rhelmer/socorro,adngdb/socorro,luser/socorro,KaiRo-at/socorro,mozilla/socorro,m8ttyB/socorro,pcabido/soc... | ---
+++
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+import os
+import shutil
+import glob
+
+distPath = "./dist/standalone-collector"
+if not os.path.exists(distPath):
+ os.makedirs(distPath)
+if not os.path.exists(distPath + "/simplejson"):
+ os.mkdir(distPath + "/simplejson")
+
+shutil.copy("./docs/README-standalone-col... | |
8cfc4d0fda1bbc3301953cd7bb03073042f7c38b | telethon_tests/higher_level_test.py | telethon_tests/higher_level_test.py | import unittest
import os
from io import BytesIO
from random import randint
from hashlib import sha256
from telethon import TelegramClient
# Fill in your api_id and api_hash when running the tests
# and REMOVE THEM once you've finished testing them.
api_id = None
api_hash = None
if not api_id or not api_hash:
rai... | Add a unit test for CDN-downloads | Add a unit test for CDN-downloads
| Python | mit | LonamiWebs/Telethon,andr-04/Telethon,LonamiWebs/Telethon,expectocode/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon | ---
+++
@@ -0,0 +1,44 @@
+import unittest
+import os
+from io import BytesIO
+from random import randint
+from hashlib import sha256
+from telethon import TelegramClient
+
+# Fill in your api_id and api_hash when running the tests
+# and REMOVE THEM once you've finished testing them.
+api_id = None
+api_hash = None
+... | |
fa4cdc8cf87d45b2f3fe38d3a99ad9ac70f70a17 | util/check_pireps_against_aviationwx.py | util/check_pireps_against_aviationwx.py | """
Compare our PIREPs data against what is at aviation wx JSON service
"""
import json
import urllib2
import datetime
import psycopg2
pgconn = psycopg2.connect(database='postgis', user='nobody', host='iemdb')
cursor = pgconn.cursor()
avwx = urllib2.urlopen("http://aviationweather.gov/gis/scripts/AirepJSON.php")
av... | Add diagnostic comparing aviationweather.gov to IEM | Add diagnostic comparing aviationweather.gov to IEM | Python | mit | akrherz/pyWWA,akrherz/pyWWA | ---
+++
@@ -0,0 +1,47 @@
+"""
+ Compare our PIREPs data against what is at aviation wx JSON service
+"""
+import json
+import urllib2
+import datetime
+import psycopg2
+
+pgconn = psycopg2.connect(database='postgis', user='nobody', host='iemdb')
+cursor = pgconn.cursor()
+
+avwx = urllib2.urlopen("http://aviationwea... | |
b3d863bd43ee53ed4fee32c4ebcd4e935852a752 | pychat/pychat.py | pychat/pychat.py | """
A simple chat server using TCP/IP and the publisher-subscriber pattern.
@author Steven Briggs
@version 2015.05.25
"""
import sys
import argparse
import socket
DEFAULT_PORT = 8080
DEFAULT_BACKLOG = 5
def get_args():
"""
Parse and return the arguments given at the command line
@returns the command... | Add a simple accept loop for clients | Add a simple accept loop for clients
| Python | mit | Broar/PyChat | ---
+++
@@ -0,0 +1,48 @@
+"""
+
+A simple chat server using TCP/IP and the publisher-subscriber pattern.
+
+@author Steven Briggs
+@version 2015.05.25
+
+"""
+
+import sys
+import argparse
+import socket
+
+DEFAULT_PORT = 8080
+DEFAULT_BACKLOG = 5
+
+def get_args():
+ """
+
+ Parse and return the arguments give... | |
0cd84e16ae6159097900e743160c6b2efa66ea0e | test/test_orm.py | test/test_orm.py | # encoding: utf-8
from __future__ import print_function, unicode_literals
import sys
import pytest
from simplesqlite import connect_memdb
from simplesqlite.model import Blob, Integer, Model, Real, Text
class Hoge(Model):
hoge_id = Integer()
name = Text()
class Foo(Model):
foo_id = Integer(not_null=Tr... | Add a test case for ORM | Add a test case for ORM
| Python | mit | thombashi/SimpleSQLite,thombashi/SimpleSQLite | ---
+++
@@ -0,0 +1,43 @@
+# encoding: utf-8
+
+from __future__ import print_function, unicode_literals
+
+import sys
+
+import pytest
+from simplesqlite import connect_memdb
+from simplesqlite.model import Blob, Integer, Model, Real, Text
+
+
+class Hoge(Model):
+ hoge_id = Integer()
+ name = Text()
+
+
+class ... | |
a95e5532468bbdc8bb667e377a6f515854474d79 | tests/test_configuration/test_menu.py | tests/test_configuration/test_menu.py | '''
Test menu creation
'''
import unittest
from wirecurly.configuration import menu
from nose import tools
class testMenuCreation(unittest.TestCase):
'''
Test menu creation
'''
def setUp(self):
'''
menu fixtures for tests
'''
self.menu = menu.Menu('on_hours')
def test_menu_dict_ok(self):
'''
... | Add tests for IVR menu | Add tests for IVR menu
| Python | mpl-2.0 | IndiciumSRL/wirecurly | ---
+++
@@ -0,0 +1,57 @@
+'''
+ Test menu creation
+'''
+
+import unittest
+from wirecurly.configuration import menu
+from nose import tools
+
+
+class testMenuCreation(unittest.TestCase):
+ '''
+ Test menu creation
+ '''
+
+ def setUp(self):
+ '''
+ menu fixtures for tests
+ '''
+
+ self.menu = menu.Menu('on_h... | |
4e90a2fd424eeb078957b779a211d9643c516566 | tests/commands/test_settings.py | tests/commands/test_settings.py | # Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | # Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | Fix test for settings command | Fix test for settings command
| Python | apache-2.0 | platformio/platformio-core,eiginn/platformio,platformio/platformio-core,ZachMassia/platformio,platformio/platformio,valeros/platformio | ---
+++
@@ -18,7 +18,8 @@
def test_settings_check(clirunner, validate_cliresult):
result = clirunner.invoke(cli, ["get"])
- validate_cliresult(result)
+ assert result.exit_code == 0
+ assert not result.exception
assert len(result.output)
for item in app.DEFAULT_SETTINGS.items():
as... |
f2bdbe29395f1fc875d097200821f0bfd099ee68 | tests/test_config_milestones.py | tests/test_config_milestones.py | from tg.configuration.milestones import _ConfigMilestoneTracker
class Action:
called = 0
def __call__(self):
self.called += 1
class TestMilestones(object):
def setup(self):
self.milestone = _ConfigMilestoneTracker('test_milestone')
def test_multiple_registration(self):
a = A... | Add tests for config milestones | Add tests for config milestones
| Python | mit | lucius-feng/tg2,lucius-feng/tg2 | ---
+++
@@ -0,0 +1,54 @@
+from tg.configuration.milestones import _ConfigMilestoneTracker
+
+
+class Action:
+ called = 0
+ def __call__(self):
+ self.called += 1
+
+
+class TestMilestones(object):
+ def setup(self):
+ self.milestone = _ConfigMilestoneTracker('test_milestone')
+
+ def test_m... | |
b41e5552fe5abf75e6bfda9814eed4798695c01b | tools/rm_trailing_whitespace.py | tools/rm_trailing_whitespace.py | import glob
import os
import sys
extensions = [".cpp", ".hpp"]
PATH = "/home/youngmit/git/mocc/src"
def strip( filename ):
with open(filename, 'r') as f:
new = []
n_white = 0
for line in f:
strip_line = line.rstrip()
# Minus 1 for the newline
n_whit... | Remove tabs and trailing whitespace | Remove tabs and trailing whitespace
Also added a simple python script for stripping the whitespace. Tabs, just grep
and remove manually
| Python | apache-2.0 | youngmit/mocc,youngmit/mocc,youngmit/mocc,youngmit/mocc | ---
+++
@@ -0,0 +1,48 @@
+import glob
+import os
+import sys
+
+
+
+
+
+extensions = [".cpp", ".hpp"]
+
+PATH = "/home/youngmit/git/mocc/src"
+
+def strip( filename ):
+ with open(filename, 'r') as f:
+ new = []
+ n_white = 0
+ for line in f:
+ strip_line = line.rstrip()
+ ... | |
86cd7dff1ab6d0c47b51f14d8784b8bf5f61e762 | update-readme.py | update-readme.py | from hammock import Hammock as Github
import json
import base64
from pprint import pprint
# Let's create the first chain of hammock using base api url
github = Github('https://api.github.com')
user = 'holtzermann17'
# In the future this will be running on a server
# somewhere, so password can just be hard coded
passw... | Add a proof of concept for reading and writing from github api | Add a proof of concept for reading and writing from github api
| Python | mit | maddyloo/miniBibServer,maddyloo/miniBibServer | ---
+++
@@ -0,0 +1,61 @@
+from hammock import Hammock as Github
+import json
+import base64
+from pprint import pprint
+
+# Let's create the first chain of hammock using base api url
+github = Github('https://api.github.com')
+
+user = 'holtzermann17'
+# In the future this will be running on a server
+# somewhere, so... | |
1c2fc6d3e60cf36bc66aac96baa31074d52e3695 | CodeFights/checkPassword.py | CodeFights/checkPassword.py | #!/usr/local/bin/python
# Code Fights Check Password Problem
def checkPassword(attempts, password):
def check():
while True:
tmp = yield
yield tmp == password
checker = check()
for i, attempt in enumerate(attempts):
next(checker)
if checker.send(attempt):
... | Solve Code Fights check password problem | Solve Code Fights check password problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/local/bin/python
+# Code Fights Check Password Problem
+
+
+def checkPassword(attempts, password):
+ def check():
+ while True:
+ tmp = yield
+ yield tmp == password
+
+ checker = check()
+ for i, attempt in enumerate(attempts):
+ next(chec... | |
5f5f5df6f76e6f82960f7cd0050266e4f523d481 | tests/gl.py | tests/gl.py |
def test_mesh():
from pyquante2 import grid,h2o
from pyquante2.viewer.viewer import Shapes,Viewer
h2o_mesh = grid(h2o)
shapes = Shapes(h2o)
shapes.add_points(h2o_mesh.points[:,:3])
win = Viewer()
win.calllist(shapes.shapelist)
win.run()
return
if __name__ == '__main__': test_mesh()... | Test example viewing a dft mesh | Test example viewing a dft mesh
| Python | bsd-3-clause | Konjkov/pyquante2,Konjkov/pyquante2,Konjkov/pyquante2 | ---
+++
@@ -0,0 +1,14 @@
+
+def test_mesh():
+ from pyquante2 import grid,h2o
+ from pyquante2.viewer.viewer import Shapes,Viewer
+ h2o_mesh = grid(h2o)
+ shapes = Shapes(h2o)
+ shapes.add_points(h2o_mesh.points[:,:3])
+ win = Viewer()
+ win.calllist(shapes.shapelist)
+ win.run()
+ return
+... | |
2a964e2030fd3764c0cdebfd98701f6ea381fd40 | euler007.py | euler007.py | #!/usr/bin/python
from math import sqrt, ceil
def isPrime (x):
for i in range (3, ceil (sqrt (x) + 1), 2):
if x % i == 0:
return 0
return 1
# 2 already count
count = 1
# we start from 3
test = 3
while (count < 10001):
if isPrime (test):
count += 1
test += 2
print (test - ... | Add solution for problem 7 | Add solution for problem 7
| Python | mit | cifvts/PyEuler | ---
+++
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+from math import sqrt, ceil
+
+def isPrime (x):
+ for i in range (3, ceil (sqrt (x) + 1), 2):
+ if x % i == 0:
+ return 0
+ return 1
+
+# 2 already count
+count = 1
+# we start from 3
+test = 3
+while (count < 10001):
+ if isPrime (test):
+ ... | |
ba9f62379b4f6b0dd8546d843840a011ce7edef2 | tests/RemoveEpsilonRules/__init__.py | tests/RemoveEpsilonRules/__init__.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 20.08.2017 17:38
:Licence GNUv3
Part of grammpy-transforms
""" | Add directory for tests of removing epsilon rules | Add directory for tests of removing epsilon rules
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,8 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 20.08.2017 17:38
+:Licence GNUv3
+Part of grammpy-transforms
+
+""" | |
0a9d56d7e99324bf09cbb0ce6d6893e716b99f4f | api_tests/registrations/views/test_registration_embeds.py | api_tests/registrations/views/test_registration_embeds.py | from nose.tools import * # flake8: noqa
import functools
from framework.auth.core import Auth
from api.base.settings.defaults import API_BASE
from tests.base import ApiTestCase
from tests.factories import (
ProjectFactory,
AuthUserFactory,
RegistrationFactory
)
class TestRegistrationEmbeds(ApiTestCase):... | Add a couple registrations embeds tests. | Add a couple registrations embeds tests.
| Python | apache-2.0 | cwisecarver/osf.io,mattclark/osf.io,Ghalko/osf.io,samchrisinger/osf.io,billyhunt/osf.io,billyhunt/osf.io,chrisseto/osf.io,SSJohns/osf.io,CenterForOpenScience/osf.io,aaxelb/osf.io,chennan47/osf.io,binoculars/osf.io,chrisseto/osf.io,crcresearch/osf.io,pattisdr/osf.io,zamattiac/osf.io,alexschiller/osf.io,crcresearch/osf.i... | ---
+++
@@ -0,0 +1,64 @@
+from nose.tools import * # flake8: noqa
+import functools
+
+from framework.auth.core import Auth
+
+from api.base.settings.defaults import API_BASE
+from tests.base import ApiTestCase
+from tests.factories import (
+ ProjectFactory,
+ AuthUserFactory,
+ RegistrationFactory
+)
+
+c... | |
dcb8bc2a4bb06c9a6fd5d76d90a6c7621a2f7011 | moniker/tests/test_backend/test_mysqlbind9.py | moniker/tests/test_backend/test_mysqlbind9.py | # Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# 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 r... | Add empty testcase for the MySQL Bind9 backend | Add empty testcase for the MySQL Bind9 backend
Change-Id: I55ef157b0c3dbf5f353553336d15c1f9681a92d4
| Python | apache-2.0 | openstack/designate,richm/designate,melodous/designate,cneill/designate,NeCTAR-RC/designate,tonyli71/designate,cneill/designate-testing,muraliselva10/designate,ionrock/designate,ramsateesh/designate,grahamhayes/designate,richm/designate,ramsateesh/designate,ionrock/designate,cneill/designate-testing,melodous/designate,... | ---
+++
@@ -0,0 +1,28 @@
+# Copyright 2012 Managed I.T.
+#
+# Author: Kiall Mac Innes <kiall@managedit.ie>
+#
+# 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.o... | |
83328bdc1ce69a8a3b8f6f7465e226ef524bc728 | obfsproxy/test/transports/test_bananaphone.py | obfsproxy/test/transports/test_bananaphone.py | #!/usr/bin/env python
import unittest
import twisted.trial.unittest
from struct import pack
from obfsproxy.network.buffer import Buffer
from obfsproxy.transports.bananaphone import rh_encoder, rh_decoder
class test_Bananaphone(twisted.trial.unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.e... | Add simple unit test for Bananaphone codec | Add simple unit test for Bananaphone codec
| Python | bsd-3-clause | david415/obfsproxy | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+import unittest
+import twisted.trial.unittest
+from struct import pack
+
+from obfsproxy.network.buffer import Buffer
+from obfsproxy.transports.bananaphone import rh_encoder, rh_decoder
+
+class test_Bananaphone(twisted.trial.unittest.TestCase):
+
+ @classmethod... | |
7b7f723ca2c7e4569e24d79d16693b6113824780 | ida/anim_to_dict.py | ida/anim_to_dict.py | from collections import namedtuple
from struct import unpack
import sark
ImagePosition = namedtuple('ImagePosition', 'spritesheet image_number y collide x')
def hex_to_sign(value):
if value >= 0x8000:
value -= 0x10000
return value
def byte_to_sign(value):
if value >= 0x80:
value -= 0x... | Add ida script to convert ida anim to python anim | Add ida script to convert ida anim to python anim
select the address of the AnimationFrame in ida and run this script and it'll output ImagePositions that I can copy paste into animations
| Python | agpl-3.0 | joetsoi/moonstone,joetsoi/moonstone | ---
+++
@@ -0,0 +1,58 @@
+from collections import namedtuple
+from struct import unpack
+
+import sark
+
+
+ImagePosition = namedtuple('ImagePosition', 'spritesheet image_number y collide x')
+
+
+def hex_to_sign(value):
+ if value >= 0x8000:
+ value -= 0x10000
+ return value
+
+
+def byte_to_sign(value)... | |
e081d62fb4a715ceafc753ad278579885e6e69da | chapter1/mouse_pos.py | chapter1/mouse_pos.py | #!/bin/env python
import wx
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "My Frame", size=(300, 300))
panel = wx.Panel(self, -1)
panel.Bind(wx.EVT_MOTION, self.OnMove)
wx.StaticText(panel, -1, "Pos:", pos=(10, 12))
self.posCtrl = wx... | Add chapter1 folder and moise_pos.py | Add chapter1 folder and moise_pos.py
Signed-off-by: sdphome <e1de489c79848a5fdae5f6d6adb3887195897185@live.cn>
| Python | apache-2.0 | sdphome/wxPython_training | ---
+++
@@ -0,0 +1,21 @@
+#!/bin/env python
+import wx
+
+class MyFrame(wx.Frame):
+ def __init__(self):
+ wx.Frame.__init__(self, None, -1, "My Frame", size=(300, 300))
+ panel = wx.Panel(self, -1)
+ panel.Bind(wx.EVT_MOTION, self.OnMove)
+ wx.StaticText(panel, -1, "Pos:", pos=(10, 12)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.