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
dcac78f31a2c46038d547821d8b56d721a095093
app/tools/application.py
app/tools/application.py
# -*- coding:utf-8 -*- import os,time,asyncio,json import logging logging.basicConfig(level=logging.ERROR) try: from aiohttp import web except ImportError: logging.error("Can't import module aiohttp") from tools.log import Log from tools.httptools import Middleware,Route,Template from tools.config import Config clas...
Add Application class,for init all self write module
Add Application class,for init all self write module
Python
mit
free-free/pyblog,free-free/pyblog,free-free/pyblog,free-free/pyblog
--- +++ @@ -0,0 +1,25 @@ +# -*- coding:utf-8 -*- +import os,time,asyncio,json +import logging +logging.basicConfig(level=logging.ERROR) +try: + from aiohttp import web +except ImportError: + logging.error("Can't import module aiohttp") +from tools.log import Log +from tools.httptools import Middleware,Route,Template ...
cbb6bee9622f5a899892a3fdf05368ac3665ff06
zues/migrations/0002_change_managers.py
zues/migrations/0002_change_managers.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import zues.utils class Migration(migrations.Migration): dependencies = [ ('zues', '0001_initial'), ] operations = [ migrations.AlterModelManagers( name='actuelepolitieke...
Add migration to change managers
Add migration to change managers
Python
mit
jonge-democraten/zues,jonge-democraten/zues,jonge-democraten/zues
--- +++ @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import zues.utils + + +class Migration(migrations.Migration): + + dependencies = [ + ('zues', '0001_initial'), + ] + + operations = [ + migrations.AlterModelMa...
d1009f5de4a8e9a97686d36f26d60255ffffea42
anytownlib/kavrayskiy.py
anytownlib/kavrayskiy.py
"""Functions that produce a Kavrayskiy VII projection map.""" import math def coords_to_kavrayskiy(coords): """Convert geographical coordinates to Kavrayskiy VII coordinates. A Kavrayskiy VII map is defined with the following dimensions: - Height: pi units - Width: sqrt(3) * pi units """ # c...
Add Kavrayskiy VII utils lib
Add Kavrayskiy VII utils lib
Python
mit
andrewyang96/AnytownMapper,andrewyang96/AnytownMapper,andrewyang96/AnytownMapper
--- +++ @@ -0,0 +1,17 @@ +"""Functions that produce a Kavrayskiy VII projection map.""" + +import math + + +def coords_to_kavrayskiy(coords): + """Convert geographical coordinates to Kavrayskiy VII coordinates. + + A Kavrayskiy VII map is defined with the following dimensions: + - Height: pi units + - Wid...
fc253535f2ef3cc256b8dd6912b65ac136eafb9c
heat/tests/functional/test_WordPress_Single_Instance_With_HA.py
heat/tests/functional/test_WordPress_Single_Instance_With_HA.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # 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 applicabl...
Add functional test for HA template
Add functional test for HA template Change-Id: I6d3304b807492e7041264402d161365447fa6ce1 Signed-off-by: Angus Salkeld <86b65304d27d8de73dd7d624c33df7e088f8d94b@redhat.com>
Python
apache-2.0
takeshineshiro/heat,cryptickp/heat,dims/heat,pratikmallya/heat,varunarya10/heat,jasondunsmore/heat,steveb/heat,rickerc/heat_audit,dims/heat,varunarya10/heat,citrix-openstack-build/heat,jasondunsmore/heat,maestro-hybrid-cloud/heat,miguelgrinberg/heat,pratikmallya/heat,cwolferh/heat-scratch,gonzolino/heat,dragorosson/hea...
--- +++ @@ -0,0 +1,70 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +# +# 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 +...
55fe2230ad3d4f9c4957600b0ff49ce23575017a
senato/spiders/zan_spider.py
senato/spiders/zan_spider.py
# -*- coding: utf-8 -*- import os import re import scrapy AMENDMENT_XPATH = '//dl[@class="emendamenti"]/dt/a/@href' AMENDMENT_URL = '/leg/18/BGT/Testi/Emend/0{parent}/0{_id}.akn' HREF_REGEX = r'id=(?P<_id>\d+)&idoggetto=(?P<parent>\d+)' class ZanSpider(scrapy.Spider): name = 'zan' allowed_domains = ['senat...
Add spider for the amendments to the Zan DDL
Add spider for the amendments to the Zan DDL
Python
mit
jacquerie/senato.py
--- +++ @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- + +import os +import re + +import scrapy + +AMENDMENT_XPATH = '//dl[@class="emendamenti"]/dt/a/@href' +AMENDMENT_URL = '/leg/18/BGT/Testi/Emend/0{parent}/0{_id}.akn' +HREF_REGEX = r'id=(?P<_id>\d+)&idoggetto=(?P<parent>\d+)' + + +class ZanSpider(scrapy.Spider): + n...
4e3b01b3f702c60083dd94136263cea9e11fb725
server/daily_backup.py
server/daily_backup.py
#!/usr/bin/env python2 # coding: utf-8 ''' A daily backup script How to use: 0. Init a borg repository using `borg init ...` 1. Fill information in this script 2. Set a daily cron job for this script 3. Sleep. :) You'll be notified once the backup finished or failed. ''' import os from requests import post as http_pos...
Add server daily backup script
Add server daily backup script
Python
bsd-2-clause
JokerQyou/toolset,JokerQyou/toolset
--- +++ @@ -0,0 +1,95 @@ +#!/usr/bin/env python2 +# coding: utf-8 +''' +A daily backup script +How to use: +0. Init a borg repository using `borg init ...` +1. Fill information in this script +2. Set a daily cron job for this script +3. Sleep. :) You'll be notified once the backup finished or failed. +''' +import os ...
299bfcd6cff71f847023eeb3bcd4a8296457f2d9
scripts/merge_abr_files.py
scripts/merge_abr_files.py
import os.path from cochlear.util import merge_abr_files if __name__ == '__main__': import argparse description = 'Merge ABR files' parser = argparse.ArgumentParser(description=description) parser.add_argument('files', nargs='+', help='ABR files to merge') parser.add_argument('-o', '--out', nargs...
Add script to merge ABR files
Add script to merge ABR files
Python
bsd-3-clause
bburan/cochlear
--- +++ @@ -0,0 +1,16 @@ +import os.path + +from cochlear.util import merge_abr_files + + +if __name__ == '__main__': + import argparse + description = 'Merge ABR files' + parser = argparse.ArgumentParser(description=description) + parser.add_argument('files', nargs='+', help='ABR files to merge') + pa...
4631a2192b24675f61f4eec5ab68e273ea47cca8
sklearn/svm/sparse/base.py
sklearn/svm/sparse/base.py
import numpy as np import scipy.sparse from abc import ABCMeta, abstractmethod from ..base import BaseLibSVM class SparseBaseLibSVM(BaseLibSVM): __metaclass__ = ABCMeta @abstractmethod def __init__(self, impl, kernel, degree, gamma, coef0, tol, C, nu, epsilon, shrinking, probability, ca...
import numpy as np import scipy.sparse from abc import ABCMeta, abstractmethod from ..base import BaseLibSVM class SparseBaseLibSVM(BaseLibSVM): __metaclass__ = ABCMeta @abstractmethod def __init__(self, impl, kernel, degree, gamma, coef0, tol, C, nu, epsilon, shrinking, probability, ca...
FIX sparse OneClassSVM was using the wrong parameter
FIX sparse OneClassSVM was using the wrong parameter
Python
bsd-3-clause
rishikksh20/scikit-learn,kmike/scikit-learn,JPFrancoia/scikit-learn,B3AU/waveTree,themrmax/scikit-learn,vybstat/scikit-learn,kaichogami/scikit-learn,IndraVikas/scikit-learn,walterreade/scikit-learn,tosolveit/scikit-learn,macks22/scikit-learn,AlexRobson/scikit-learn,heli522/scikit-learn,robbymeals/scikit-learn,xuewei4d/...
--- +++ @@ -23,4 +23,5 @@ def fit(self, X, y, sample_weight=None): X = scipy.sparse.csr_matrix(X, dtype=np.float64) - return super(SparseBaseLibSVM, self).fit(X, y, sample_weight) + return super(SparseBaseLibSVM, self).fit(X, y, + sample_we...
37a8da7f759e2218c63b9c56e69cca0987855cc9
comics/crawler/crawlers/johnnywander.py
comics/crawler/crawlers/johnnywander.py
from comics.crawler.base import BaseComicCrawler from comics.crawler.meta import BaseComicMeta class ComicMeta(BaseComicMeta): name = 'Johnny Wander' language = 'en' url = 'http://www.johnnywander.com/' start_date = '2008-09-30' history_capable_days = 40 schedule = 'Tu,Th' time_zone = -8 ...
Add crawler for Johnny Wander
Add crawler for Johnny Wander
Python
agpl-3.0
jodal/comics,jodal/comics,klette/comics,jodal/comics,jodal/comics,klette/comics,datagutten/comics,klette/comics,datagutten/comics,datagutten/comics,datagutten/comics
--- +++ @@ -0,0 +1,28 @@ +from comics.crawler.base import BaseComicCrawler +from comics.crawler.meta import BaseComicMeta + +class ComicMeta(BaseComicMeta): + name = 'Johnny Wander' + language = 'en' + url = 'http://www.johnnywander.com/' + start_date = '2008-09-30' + history_capable_days = 40 + sch...
cd97d293343f59b28c59ec88c1f80ebb4697a3f2
protein_preview_generation/protein_preview_generation.py
protein_preview_generation/protein_preview_generation.py
##This script takes a path with PDB files, an output path and a csv file as inputs, and creates a high quality static image #of each uniprot in the csv file in the right orientation, coloured by secondary structure #The CSV file contains a column with uniprot ids, a column with the pdb file that contains the best chain...
Add protein preview generation script
Add protein preview generation script
Python
mit
jtapial/snvdb,jtapial/snvdb
--- +++ @@ -0,0 +1,57 @@ +##This script takes a path with PDB files, an output path and a csv file as inputs, and creates a high quality static image +#of each uniprot in the csv file in the right orientation, coloured by secondary structure +#The CSV file contains a column with uniprot ids, a column with the pdb fil...
213708504447c8858ed3ba86324acaff98dbefdf
seahub/profile/models.py
seahub/profile/models.py
from django.db import models class Profile(models.Model): user = models.EmailField(unique=True) nickname = models.CharField(max_length=64, blank=True) intro = models.TextField(max_length=256, blank=True)
from django.db import models from django.core.cache import cache from django.dispatch import receiver from settings import EMAIL_ID_CACHE_PREFIX, EMAIL_ID_CACHE_TIMEOUT from registration.signals import user_registered class Profile(models.Model): user = models.EmailField(unique=True) nickname = models.CharFie...
Update email_id cache when user has registered
Update email_id cache when user has registered
Python
apache-2.0
madflow/seahub,cloudcopy/seahub,Chilledheart/seahub,cloudcopy/seahub,miurahr/seahub,Chilledheart/seahub,cloudcopy/seahub,miurahr/seahub,madflow/seahub,madflow/seahub,cloudcopy/seahub,miurahr/seahub,Chilledheart/seahub,madflow/seahub,madflow/seahub,Chilledheart/seahub,Chilledheart/seahub,miurahr/seahub
--- +++ @@ -1,7 +1,17 @@ from django.db import models +from django.core.cache import cache +from django.dispatch import receiver + +from settings import EMAIL_ID_CACHE_PREFIX, EMAIL_ID_CACHE_TIMEOUT +from registration.signals import user_registered class Profile(models.Model): user = models.EmailField(unique...
25215f3b353122ccb4a20b00a9fdcdaca81f3ef8
other/vlen_leak.py
other/vlen_leak.py
""" Demonstrates memory leak involving variable-length strings. """ import sys import resource import numpy as np import h5py FNAME = 'test.hdf5' if 'linux' in sys.platform: MAXRSS_BYTES = 1024. # in KiB on linux else: MAXRSS_BYTES = 1. if sys.version_info[0] == 3: xrange = range memory = 0 def p...
Add script demonstrating vlen memory leak
Add script demonstrating vlen memory leak
Python
bsd-3-clause
h5py/h5py,h5py/h5py,h5py/h5py
--- +++ @@ -0,0 +1,60 @@ + +""" + Demonstrates memory leak involving variable-length strings. +""" + +import sys +import resource +import numpy as np + +import h5py + +FNAME = 'test.hdf5' + +if 'linux' in sys.platform: + MAXRSS_BYTES = 1024. # in KiB on linux +else: + MAXRSS_BYTES = 1. + +if sys.version_info...
76d5056c24daf3a61201f6b171a21fc879c0e602
tests/test_migrations.py
tests/test_migrations.py
import copy import pytest import mock import scrapi from scrapi.linter.document import NormalizedDocument, RawDocument from scrapi import tasks from scrapi.migrations import rename from scrapi import registry # Need to force cassandra to ignore set keyspace from scrapi.processing.cassandra import CassandraProcessor...
Add migration test for rename
Add migration test for rename
Python
apache-2.0
fabianvf/scrapi,fabianvf/scrapi,icereval/scrapi,mehanig/scrapi,erinspace/scrapi,felliott/scrapi,alexgarciac/scrapi,erinspace/scrapi,felliott/scrapi,jeffreyliu3230/scrapi,CenterForOpenScience/scrapi,ostwald/scrapi,mehanig/scrapi,CenterForOpenScience/scrapi
--- +++ @@ -0,0 +1,63 @@ +import copy +import pytest +import mock + +import scrapi +from scrapi.linter.document import NormalizedDocument, RawDocument + +from scrapi import tasks + +from scrapi.migrations import rename +from scrapi import registry + +# Need to force cassandra to ignore set keyspace +from scrapi.proce...
1397791e663f57927524ccf7a25915e8059d7376
tests/provider/test_article_structure.py
tests/provider/test_article_structure.py
import unittest from ddt import ddt, data, unpack from provider.article_structure import ArticleInfo @ddt class TestArticleStructure(unittest.TestCase): @unpack @data({'input': 'elife-07702-vor-r4.zip', 'expected': None}, {'input': 'elife-00013-vor-v1-20121015000000.zip', 'expected':'2012-10-15T00:...
Test article structure replacing lettuce tests
Test article structure replacing lettuce tests
Python
mit
gnott/elife-bot,jhroot/elife-bot,jhroot/elife-bot,gnott/elife-bot,gnott/elife-bot,jhroot/elife-bot
--- +++ @@ -0,0 +1,26 @@ +import unittest +from ddt import ddt, data, unpack +from provider.article_structure import ArticleInfo + + +@ddt +class TestArticleStructure(unittest.TestCase): + + @unpack + @data({'input': 'elife-07702-vor-r4.zip', 'expected': None}, + {'input': 'elife-00013-vor-v1-201210150...
9388754e53c0d2898a6b1bfbc64f3d5c68c1f8d1
scripts/box/connect_external_accounts.py
scripts/box/connect_external_accounts.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ First run rm -rf website/addons/box/views/ Then change the user_settings field of BoxNodeSettings to foreign_user_settings """ import sys import logging from modularodm import Q from website.app import init_app from scripts import utils as script_utils from frame...
Add script to connect ExternalAccounts and folders -after the pre-merge migrations have been done
Add script to connect ExternalAccounts and folders -after the pre-merge migrations have been done
Python
apache-2.0
RomanZWang/osf.io,RomanZWang/osf.io,amyshi188/osf.io,GageGaskins/osf.io,baylee-d/osf.io,cwisecarver/osf.io,adlius/osf.io,leb2dg/osf.io,jnayak1/osf.io,erinspace/osf.io,acshi/osf.io,billyhunt/osf.io,brianjgeiger/osf.io,wearpants/osf.io,zamattiac/osf.io,mluke93/osf.io,KAsante95/osf.io,leb2dg/osf.io,samchrisinger/osf.io,To...
--- +++ @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +First run + rm -rf website/addons/box/views/ + +Then change the user_settings field of BoxNodeSettings to foreign_user_settings +""" +import sys +import logging +from modularodm import Q + +from website.app import init_app +from script...
9e89e35d1071a2123c9fa8a28bf538f2e34daeeb
bumblebee/modules/cpu.py
bumblebee/modules/cpu.py
import bumblebee.module import psutil class Module(bumblebee.module.Module): def __init__(self, args): super(Module, self).__init__(args) self._perc = psutil.cpu_percent(percpu=False) def data(self): self._perc = psutil.cpu_percent(percpu=False) return "{:05.02f}%".format(self...
Add module for measuring CPU utilization
[modules] Add module for measuring CPU utilization Add module "cpu", which uses psutil to measure CPU utilization between two consecutive calls.
Python
mit
tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status
--- +++ @@ -0,0 +1,20 @@ +import bumblebee.module +import psutil + +class Module(bumblebee.module.Module): + def __init__(self, args): + super(Module, self).__init__(args) + self._perc = psutil.cpu_percent(percpu=False) + + def data(self): + self._perc = psutil.cpu_percent(percpu=False) + +...
6e723142d28aafb0bb925cb3456fd962b679349b
app/applier.py
app/applier.py
import random from collections import namedtuple Rule = namedtuple('Rule', ['changes', 'environments']) sonorization = Rule({'p': 'b', 't': 'd', 'ʈ': 'ɖ', 'c':'ɟ', 'k': 'g', 'q': 'ɢ'}, ['^.', 'V.V']) rules = [sonorization] words = ['potato', 'tobado', 'tabasco'] def choose_rule(words, rules): ...
Create skeleton for new rule chooser
Create skeleton for new rule chooser
Python
mit
kdelwat/LangEvolve,kdelwat/LangEvolve,kdelwat/LangEvolve
--- +++ @@ -0,0 +1,34 @@ +import random + +from collections import namedtuple + +Rule = namedtuple('Rule', ['changes', 'environments']) + +sonorization = Rule({'p': 'b', 't': 'd', 'ʈ': 'ɖ', 'c':'ɟ', 'k': 'g', 'q': 'ɢ'}, + ['^.', 'V.V']) + +rules = [sonorization] + +words = ['potato', 'tobado', 'tab...
e1c5891650eaf3934a082e52934a1c4dd113fee7
doc/quickstart/testlibs/LoginLibrary.py
doc/quickstart/testlibs/LoginLibrary.py
import os import sys class LoginLibrary: def __init__(self): self._sut_path = os.path.join(os.path.dirname(__file__), '..', 'sut', 'login.py') self._status = '' def create_user(self, username, password): self._run_command('create', username, pass...
import os import sys import subprocess class LoginLibrary: def __init__(self): self._sut_path = os.path.join(os.path.dirname(__file__), '..', 'sut', 'login.py') self._status = '' def create_user(self, username, password): self._run_command('creat...
Use subprocess isntead of popen to get Jython working too
Use subprocess isntead of popen to get Jython working too
Python
apache-2.0
ChrisHirsch/robotframework,alexandrul-ci/robotframework,yonglehou/robotframework,JackNokia/robotframework,edbrannin/robotframework,jaloren/robotframework,un33k/robotframework,Colorfulstan/robotframework,kyle1986/robortframe,synsun/robotframework,userzimmermann/robotframework,userzimmermann/robotframework,un33k/robotfra...
--- +++ @@ -1,5 +1,6 @@ import os import sys +import subprocess class LoginLibrary: @@ -24,7 +25,9 @@ % (expected_status, self._status)) def _run_command(self, command, *args): - command = '"%s" %s %s' % (self._sut_path, command, ' '.join(args)) - process...
72e743b0ee40609ce2f469b44afe82d1574c498a
bin/explore.py
bin/explore.py
#!/usr/bin/env python3 import os, sys sys.path.append(os.path.dirname(__file__)) import random, support import matplotlib.pyplot as pp support.figure() app_count = support.count_apps() user_count = support.count_users() while True: while True: app = None user = random.randrange(user_count) ...
Add a script for the exploration of app-user pairs
Add a script for the exploration of app-user pairs
Python
mit
learning-on-chip/google-cluster-prediction
--- +++ @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import os, sys +sys.path.append(os.path.dirname(__file__)) + +import random, support +import matplotlib.pyplot as pp + +support.figure() +app_count = support.count_apps() +user_count = support.count_users() +while True: + while True: + app = None + ...
fb9a381f7a45e79b8c67f516c2e4d76c9a1d9553
sts/util/rpc_forker.py
sts/util/rpc_forker.py
from abc import * import os from SimpleXMLRPCServer import SimpleXMLRPCServer import xmlrpclib import sys class Forker(object): ''' Easily fork a job and retrieve the results ''' __metaclass__ = ABCMeta def __init__(self, ip='localhost', port=3370): self.ip = ip self.port = port self.server = Simpl...
Add a forker class: spawn children and return results via XML-RPC
Add a forker class: spawn children and return results via XML-RPC
Python
apache-2.0
jmiserez/sts,ucb-sts/sts,ucb-sts/sts,jmiserez/sts
--- +++ @@ -0,0 +1,57 @@ + +from abc import * +import os +from SimpleXMLRPCServer import SimpleXMLRPCServer +import xmlrpclib +import sys + +class Forker(object): + ''' Easily fork a job and retrieve the results ''' + __metaclass__ = ABCMeta + + def __init__(self, ip='localhost', port=3370): + self.ip = ip + ...
48acf7dd057d17611dcafa279721a99434e99885
ou_noise.py
ou_noise.py
# -------------------------------------- # Reference: https://github.com/rllab/rllab/blob/master/rllab/exploration_strategies/ou_strategy.py # -------------------------------------- import numpy as np import numpy.random as nr class OUNoise: """ docstring for OUNoise """ def __init__(self,action_dimension,mu=...
Add OU Noise as given in ddpg paper
Add OU Noise as given in ddpg paper
Python
mit
stevenpjg/ddpg-aigym
--- +++ @@ -0,0 +1,35 @@ +# -------------------------------------- +# Reference: https://github.com/rllab/rllab/blob/master/rllab/exploration_strategies/ou_strategy.py +# -------------------------------------- + +import numpy as np +import numpy.random as nr + +class OUNoise: + """ docstring for OUNoise """ + d...
3c5c28f598738be2457948aa8872196604496c73
custom-scripts/long-term-formula.py
custom-scripts/long-term-formula.py
#! /usr/bin/python3 import argparse def generate_rows(lower, upper): assert (lower <= upper), "Lower limit can not be larger than upper" for i in range(lower, upper): print("=VLOOKUP(C{0},MFPortfolio!G52:MFPortfolio!H72,2,FALSE)".format(i)) def main(): parser = argparse.ArgumentParser(description='Process ...
Add script to generate sheets formula for personal usage
Add script to generate sheets formula for personal usage
Python
mit
ayushgoel/dotfiles,ayushgoel/dotfiles,ayushgoel/dotfiles
--- +++ @@ -0,0 +1,18 @@ +#! /usr/bin/python3 + +import argparse + +def generate_rows(lower, upper): + assert (lower <= upper), "Lower limit can not be larger than upper" + for i in range(lower, upper): + print("=VLOOKUP(C{0},MFPortfolio!G52:MFPortfolio!H72,2,FALSE)".format(i)) + +def main(): + parser = argpars...
7b2c418cbe6291afa4d339278d549dda162b382e
tests/test_version_parser.py
tests/test_version_parser.py
import pytest from leak.version_parser import versions_split def test_versions_split(): pass def test_wrong_versions_split(): # too many dots assert versions_split('1.2.3.4') == [0, 0, 0] # test missing numeric version with pytest.raises(ValueError): versions_split('not.numeric') ...
Add some dummy test for negative cases when version splitting
Add some dummy test for negative cases when version splitting
Python
mit
bmwant21/leak
--- +++ @@ -0,0 +1,20 @@ +import pytest + +from leak.version_parser import versions_split + + +def test_versions_split(): + pass + + +def test_wrong_versions_split(): + # too many dots + assert versions_split('1.2.3.4') == [0, 0, 0] + + # test missing numeric version + with pytest.raises(ValueError): +...
48944ae9625cf36457b053508eff1e189c64f2c4
libraries/verification.py
libraries/verification.py
from django.contrib.sites.models import Site from django.core.mail import send_mail from okupy.libraries.encryption import random_string from okupy.libraries.exception import OkupyException, log_extra_data import logging logger = logging.getLogger('okupy') def sendConfirmationEmail(request, form, model): ''' ...
from django.contrib.sites.models import Site from django.core.mail import send_mail from okupy.libraries.encryption import random_string from okupy.libraries.exception import OkupyException, log_extra_data import logging logger = logging.getLogger('okupy') def sendConfirmationEmail(request, form, model): ''' ...
Fix bug in checkConfirmationKey, call the model directly instead of eval(arg)
Fix bug in checkConfirmationKey, call the model directly instead of eval(arg)
Python
agpl-3.0
gentoo/identity.gentoo.org,dastergon/identity.gentoo.org,dastergon/identity.gentoo.org,gentoo/identity.gentoo.org
--- +++ @@ -30,7 +30,7 @@ Check if the URL matches any of the confirmation keys in the database ''' try: - result = eval(model).objects.get(url = key) - except eval(model).DoesNotExist as error: + result = model.objects.get(url = key) + except model.DoesNotExist: raise Okup...
6a91b842626d531f7242994c91bb496f5b90d6c7
web/ctf_gameserver/web/scoring/forms.py
web/ctf_gameserver/web/scoring/forms.py
from django import forms from django.utils.translation import ugettext_lazy as _ from . import models class GameControlAdminForm(forms.ModelForm): """ Form for the GameControl object, designed to be used in GameControlAdmin. """ class Meta: model = models.GameControl fields = '__all_...
Add missing file, which actually belongs to last commit
Add missing file, which actually belongs to last commit
Python
isc
fausecteam/ctf-gameserver,fausecteam/ctf-gameserver,fausecteam/ctf-gameserver,fausecteam/ctf-gameserver,fausecteam/ctf-gameserver
--- +++ @@ -0,0 +1,18 @@ +from django import forms +from django.utils.translation import ugettext_lazy as _ + +from . import models + + +class GameControlAdminForm(forms.ModelForm): + """ + Form for the GameControl object, designed to be used in GameControlAdmin. + """ + + class Meta: + model = mod...
e2e609aec055a6e81a0ca7cb747809081ade81b1
designate/backend/impl_powerdns/migrate_repo/versions/010_records_add_disabled_column.py
designate/backend/impl_powerdns/migrate_repo/versions/010_records_add_disabled_column.py
# Copyright 2015 NetEase, Inc. # # Author: Zhang Gengyuan <stanzgy@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
Fix powerdns db table records missing column disabled
Fix powerdns db table records missing column disabled Fix powerdns db table 'records' missing column 'disabled', which makes powerdns service unable to start. Change-Id: I3b4c056ca68c44b7e42d20faba555471171b661f Closes-Bug: 1409629
Python
apache-2.0
cneill/designate,ionrock/designate,kiall/designate-py3,ionrock/designate,muraliselva10/designate,openstack/designate,kiall/designate-py3,ramsateesh/designate,muraliselva10/designate,cneill/designate-testing,grahamhayes/designate,kiall/designate-py3,muraliselva10/designate,openstack/designate,cneill/designate-testing,cn...
--- +++ @@ -0,0 +1,38 @@ +# Copyright 2015 NetEase, Inc. +# +# Author: Zhang Gengyuan <stanzgy@gmail.com> +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.or...
89597c9a277cb092e2a61450efad3d95574ec3b1
scripts/password_confirmation_reminders.py
scripts/password_confirmation_reminders.py
''' Send an email to users who haven't confirmed their passwords asking them to confirm. ''' import logging from community_share.models.user import User from community_share.models.share import Event from community_share.models.conversation import Conversation from community_share import mail_actions, config, store ...
''' Send an email to users who haven't confirmed their passwords asking them to confirm. ''' import logging from community_share.models.user import User from community_share.models.share import Event from community_share.models.conversation import Conversation from community_share import mail_actions, config, store ...
Fix bug in email confirmation scripts.
Fix bug in email confirmation scripts.
Python
mpl-2.0
seanastephens/communityshare,seanastephens/communityshare,seanastephens/communityshare,communityshare/communityshare,communityshare/communityshare,seanastephens/communityshare,communityshare/communityshare,communityshare/communityshare
--- +++ @@ -11,7 +11,7 @@ def send_reminders(): users = store.session.query(User).filter_by( - active=True, email_confirmed=True).all() + active=True, email_confirmed=False).all() for user in users: template = mail_actions.CONFIRM_EMAIL_REMINDER_TEMPLATE subject = 'Please ...
32ceedf7be64bde3dfd5804e87d7337c566a28e5
OIPA/api/activity/tests/test_filters.py
OIPA/api/activity/tests/test_filters.py
from django.urls import reverse from rest_framework import status from rest_framework.test import APITestCase from iati.factory.iati_factory import ActivityFactory, OtherIdentifierFactory class ActivityFiltersTestCase(APITestCase): def setUp(self): self.first_activity = ActivityFactory( iati...
Add tests for new 'other_identifier' filter
Add tests for new 'other_identifier' filter
Python
agpl-3.0
openaid-IATI/OIPA,zimmerman-zimmerman/OIPA,openaid-IATI/OIPA,openaid-IATI/OIPA,zimmerman-zimmerman/OIPA,zimmerman-zimmerman/OIPA,openaid-IATI/OIPA,zimmerman-zimmerman/OIPA,zimmerman-zimmerman/OIPA,openaid-IATI/OIPA
--- +++ @@ -0,0 +1,69 @@ +from django.urls import reverse +from rest_framework import status +from rest_framework.test import APITestCase + +from iati.factory.iati_factory import ActivityFactory, OtherIdentifierFactory + + +class ActivityFiltersTestCase(APITestCase): + + def setUp(self): + self.first_activi...
e238b3b7ffea183f22d8171c8640e8a888fda791
zinnia/tests/test_context.py
zinnia/tests/test_context.py
"""Test cases for Zinnia Context""" from django.test import TestCase from django.template import Context from django.core.paginator import Paginator from zinnia.context import get_context_first_object from zinnia.context import get_context_loop_position class ContextTestCase(TestCase): """Tests cases for context...
Add unit tests for zinnia.context
Add unit tests for zinnia.context
Python
bsd-3-clause
Fantomas42/django-blog-zinnia,ghachey/django-blog-zinnia,Fantomas42/django-blog-zinnia,Zopieux/django-blog-zinnia,ghachey/django-blog-zinnia,Fantomas42/django-blog-zinnia,ghachey/django-blog-zinnia,Zopieux/django-blog-zinnia,Zopieux/django-blog-zinnia
--- +++ @@ -0,0 +1,39 @@ +"""Test cases for Zinnia Context""" +from django.test import TestCase +from django.template import Context +from django.core.paginator import Paginator + +from zinnia.context import get_context_first_object +from zinnia.context import get_context_loop_position + + +class ContextTestCase(Test...
fb4fc80c5e95308f363d96d02193300abbeb22c9
hotline/db/db_mongo.py
hotline/db/db_mongo.py
import os from pymongo import MongoClient from urllib.parse import urlparse mongo_url = os.environ.get('MONGODB_URL', 'mongodb://localhost:27017/') # mongo_url_parse = urlparse(mongo_url) mongo_client = MongoClient(mongo_url) mongo_db = mongo_client['hotline']
Define layer for Mongo client
Define layer for Mongo client
Python
mit
wearhacks/hackathon_hotline
--- +++ @@ -0,0 +1,11 @@ +import os + +from pymongo import MongoClient +from urllib.parse import urlparse + +mongo_url = os.environ.get('MONGODB_URL', 'mongodb://localhost:27017/') +# mongo_url_parse = urlparse(mongo_url) +mongo_client = MongoClient(mongo_url) +mongo_db = mongo_client['hotline'] + +
1c18e61ece7f05ac5b1afd276c72a6a242e9fb66
braid/info.py
braid/info.py
from fabric.api import run, quiet from braid import succeeds, cacheInEnvironment @cacheInEnvironment def distroName(): """ Get the name of the distro. """ with quiet(): lsb = run('lsb_release --id --short', warn_only=True) if lsb.succeeded: return lsb.lower() distro...
Add some tools for detecting the remote distribution.
Add some tools for detecting the remote distribution.
Python
mit
alex/braid,alex/braid
--- +++ @@ -0,0 +1,36 @@ +from fabric.api import run, quiet +from braid import succeeds, cacheInEnvironment + +@cacheInEnvironment +def distroName(): + """ + Get the name of the distro. + """ + with quiet(): + lsb = run('lsb_release --id --short', warn_only=True) + if lsb.succeeded: + ...
16ab1054d77d0f50762122cb747ba0d819f3ec2c
numba/cuda/tests/cudapy/test_lineinfo.py
numba/cuda/tests/cudapy/test_lineinfo.py
from numba.cuda.testing import skip_on_cudasim from numba import cuda from numba.core import types from numba.cuda.testing import CUDATestCase import re import unittest @skip_on_cudasim('Simulator does not produce lineinfo') class TestCudaLineInfo(CUDATestCase): """ These tests only check the compiled PTX for...
Add tests for lineinfo in cuda.jit
Add tests for lineinfo in cuda.jit
Python
bsd-2-clause
stonebig/numba,cpcloud/numba,stuartarchibald/numba,stuartarchibald/numba,numba/numba,cpcloud/numba,stonebig/numba,IntelLabs/numba,stonebig/numba,numba/numba,IntelLabs/numba,stonebig/numba,seibert/numba,IntelLabs/numba,numba/numba,stuartarchibald/numba,seibert/numba,cpcloud/numba,seibert/numba,cpcloud/numba,seibert/numb...
--- +++ @@ -0,0 +1,43 @@ +from numba.cuda.testing import skip_on_cudasim +from numba import cuda +from numba.core import types +from numba.cuda.testing import CUDATestCase +import re +import unittest + + +@skip_on_cudasim('Simulator does not produce lineinfo') +class TestCudaLineInfo(CUDATestCase): + """ + Thes...
acebd3a5e91788c95cbd22745620d6e05e8bf3a3
zerver/migrations/0126_disallow_chars_in_stream_and_user_name.py
zerver/migrations/0126_disallow_chars_in_stream_and_user_name.py
# -*- coding: utf-8 -*- from django.db import models, migrations from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor from django.db.migrations.state import StateApps from typing import Text def remove_special_chars_from_streamname(apps, schema_editor): # type: (StateApps, DatabaseSchemaE...
Replace special chars in stream & user names with space.
migrations: Replace special chars in stream & user names with space. Also handle potential duplicate stream names created. Fixes #6534
Python
apache-2.0
punchagan/zulip,showell/zulip,shubhamdhama/zulip,jackrzhang/zulip,jackrzhang/zulip,rishig/zulip,brainwane/zulip,rishig/zulip,hackerkid/zulip,rht/zulip,zulip/zulip,tommyip/zulip,rishig/zulip,timabbott/zulip,showell/zulip,kou/zulip,rishig/zulip,brainwane/zulip,hackerkid/zulip,kou/zulip,jackrzhang/zulip,rishig/zulip,kou/z...
--- +++ @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +from django.db import models, migrations +from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor +from django.db.migrations.state import StateApps +from typing import Text + +def remove_special_chars_from_streamname(apps, schema_editor): + ...
abc46027b8af2d21debe8a23968b964ab6cb5c6b
CSP-Browser/CSPBrowser.py
CSP-Browser/CSPBrowser.py
#!/usr/bin/python from pyvirtualdisplay import Display from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.keys import Keys import selenium.webdriver.support.ui as ui import re import atexit disp = Display(visible=0, size=(800,600)) atexit.regist...
#!/usr/bin/python from pyvirtualdisplay import Display from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.keys import Keys import selenium.webdriver.support.ui as ui import re import atexit disp = Display(visible=0, size=(800,600)) atexit.regist...
Make Selenium shut down after it's done
Make Selenium shut down after it's done
Python
mit
reedox/CSPTools,Kennysan/CSPTools
--- +++ @@ -21,7 +21,7 @@ profile.set_preference("network.proxy.http", domain) profile.set_preference("network.proxy.http_port", port) profile.update_preferences() - self.driver = webdriver.Firefox(firefox_profile=profile) + self.driver = webdriver.Firefox(fir...
e963ba18ec0b2d403a8a99d6374f42245a30e20d
spicedham/basewrapper.py
spicedham/basewrapper.py
class BaseWrapper(object): def set_up(): pass def get_key(key, default=None): raise NotImplementedError() def get_key_list(keys, default=None): return [ get_key(key, default) for key in keys ] def set_key_list(key_value_tuples): return [ set_key(key, value) for key, ...
Add a base class for the backends
Add a base class for the backends
Python
mpl-2.0
mozilla/spicedham,mozilla/spicedham
--- +++ @@ -0,0 +1,17 @@ + +class BaseWrapper(object): + + def set_up(): + pass + + def get_key(key, default=None): + raise NotImplementedError() + + def get_key_list(keys, default=None): + return [ get_key(key, default) for key in keys ] + + def set_key_list(key_value_tuples): + ...
13c490a10c8eb7b84583c2713843969bcdc035e1
bluebottle/members/migrations/0029_merge_20190222_0930.py
bluebottle/members/migrations/0029_merge_20190222_0930.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2019-02-22 08:30 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('members', '0028_auto_20190219_1024'), ('members', '0028_merge_20190215_1441'), ] o...
Make migrate file database members
Make migrate file database members - Migrate field last_logout to member & field scim_external_id to member
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
--- +++ @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.15 on 2019-02-22 08:30 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('members', '0028_auto_20190219_1024'), + ('members', '0...
f2c79668789dd2c9f7dcfe2bf12bb34d30516962
bluebottle/projects/migrations/0084_auto_20181207_1435.py
bluebottle/projects/migrations/0084_auto_20181207_1435.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2018-12-07 13:35 from __future__ import unicode_literals import bluebottle.utils.fields from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('projects', '0083_auto_20181129_1506'), ] operations = [ ...
Add migration that removes bank_account_reviewed flag on project
Add migration that removes bank_account_reviewed flag on project
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
--- +++ @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.8 on 2018-12-07 13:35 +from __future__ import unicode_literals + +import bluebottle.utils.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0083_auto_20181129...
8ebba2af62f7b917427fa1233ad81314f4e47102
shade/tests/unit/test_operator_noauth.py
shade/tests/unit/test_operator_noauth.py
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Add test of OperatorCloud auth_type=None
Add test of OperatorCloud auth_type=None Ironic features a noauth mode which is intended for use in isolated trusted environments. As this is not a normal use case for shade, it is an increadibly important item to have a test for. Change-Id: If86b9df238982d912105fb08dcd59c9c85b7de4a
Python
apache-2.0
stackforge/python-openstacksdk,dtroyer/python-openstacksdk,stackforge/python-openstacksdk,openstack-infra/shade,dtroyer/python-openstacksdk,openstack-infra/shade,openstack/python-openstacksdk,jsmartin/shade,jsmartin/shade,openstack/python-openstacksdk
--- +++ @@ -0,0 +1,49 @@ +# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. +# +# 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-...
f7287bdf569374757880a70e4c2e3a69ed31295e
tests/test_cpan.py
tests/test_cpan.py
from tests.helper import ExternalVersionTestCase class CPANTest(ExternalVersionTestCase): def test_cpan(self): self.assertEqual(self.sync_get_version("POE-Component-Server-HTTPServer", {"cpan": None}), "0.9.2")
Add a testcase for CPAN
Add a testcase for CPAN
Python
mit
lilydjwg/nvchecker
--- +++ @@ -0,0 +1,6 @@ +from tests.helper import ExternalVersionTestCase + + +class CPANTest(ExternalVersionTestCase): + def test_cpan(self): + self.assertEqual(self.sync_get_version("POE-Component-Server-HTTPServer", {"cpan": None}), "0.9.2")
a01d667946b65ca3ede55fa44a2c409cc129b737
misc/show-cairo-subpixel-behavior.py
misc/show-cairo-subpixel-behavior.py
import cairo # this shows that even though we are using integer values # for set_source_surface, the subpixel translation is # capturing pixel values from adjacent pixels of the source src = cairo.ImageSurface(cairo.FORMAT_RGB24, 60, 40) cr = cairo.Context(src) #cr.set_source_rgb(1, 0, 0) #cr.rectangle(0, 0, 20, 40)...
Add script to show what cairo is doing that is strange
Add script to show what cairo is doing that is strange
Python
lgpl-2.1
openslide/openslide,openslide/openslide,openslide/openslide,openslide/openslide
--- +++ @@ -0,0 +1,32 @@ +import cairo + +# this shows that even though we are using integer values +# for set_source_surface, the subpixel translation is +# capturing pixel values from adjacent pixels of the source + +src = cairo.ImageSurface(cairo.FORMAT_RGB24, 60, 40) +cr = cairo.Context(src) + +#cr.set_source_rgb...
2e8728a0bfa6cac8f4a17c53ce762f82c4f60583
cherrypy/test/test_package.py
cherrypy/test/test_package.py
from jaraco.packaging import depends def test_dependencies_no_namespaces(): """ Until #1673 lands, ensure dependencies do not employ namespace packages. """ deps = depends.load_dependencies('cherrypy') names = map(package_name, traverse(deps)) assert not any(name.startswith('jaraco.') for...
Add test module, omitted from prior commit.
Add test module, omitted from prior commit.
Python
bsd-3-clause
cherrypy/cherrypy,Safihre/cherrypy,cherrypy/cherrypy,Safihre/cherrypy
--- +++ @@ -0,0 +1,24 @@ +from jaraco.packaging import depends + + + +def test_dependencies_no_namespaces(): + """ + Until #1673 lands, ensure dependencies do not employ + namespace packages. + """ + deps = depends.load_dependencies('cherrypy') + names = map(package_name, traverse(deps)) + assert...
b282434e61cd1a185806b985953d1543a57bca8f
skan/_testdata.py
skan/_testdata.py
import numpy as np tinycycle = np.array([[0, 1, 0], [1, 0, 1], [0, 1, 0]], dtype=bool) skeleton1 = np.array([[0, 1, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0, 1], [0, 1, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 0, 0], ...
Add some tiny synthetic data for testing
Add some tiny synthetic data for testing
Python
bsd-3-clause
jni/skan
--- +++ @@ -0,0 +1,13 @@ +import numpy as np + + +tinycycle = np.array([[0, 1, 0], + [1, 0, 1], + [0, 1, 0]], dtype=bool) + + +skeleton1 = np.array([[0, 1, 1, 1, 1, 1, 0], + [1, 0, 0, 0, 0, 0, 1], + [0, 1, 1, 0, 1, 1, 0], + ...
ef294ced9a9500344e02b046a2d4dd3b9621229d
tests/t_utils/test_filters.py
tests/t_utils/test_filters.py
# -*- coding: utf-8 -*- """ tests.t_utils.test_filters ~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2017 by The Stormrose Project team, see AUTHORS. :license: MIT License, see LICENSE for details. """ import os from unittest import TestCase from xobox.utils import filters class TestXoboxUtilsFi...
Add unit test for xobox.utils.filters.file
Add unit test for xobox.utils.filters.file
Python
mit
stormrose-va/xobox
--- +++ @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +""" + tests.t_utils.test_filters + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright 2017 by The Stormrose Project team, see AUTHORS. + :license: MIT License, see LICENSE for details. +""" + + +import os +from unittest import TestCase +from xobox.utils...
b2158dcd6aaae9c44503b509ddcb5187ea37bdba
api/production_pending.py
api/production_pending.py
from constants import * import sys, time, datetime from scraper import Scraper from dateutil import tz from execute_query import execute_query try: guild_ids = str(sys.argv[1]).split(',') print '[INFO] [{0}] - Not using all guild IDs, but only the following: {1}'.format(datetime.datetime.utcnow().replace(tzin...
Add script to process pending changes separately from the regular refresh cycle
Add script to process pending changes separately from the regular refresh cycle
Python
mit
Sheday/GuildAudit,Sheday/GuildAudit
--- +++ @@ -0,0 +1,29 @@ +from constants import * +import sys, time, datetime +from scraper import Scraper +from dateutil import tz +from execute_query import execute_query + + +try: + guild_ids = str(sys.argv[1]).split(',') + print '[INFO] [{0}] - Not using all guild IDs, but only the following: {1}'.format(da...
173423ee7f43fb7a33db847e2ef3abb34317944e
tests/test_decorators.py
tests/test_decorators.py
from dtest import * from dtest.util import * @skip def test_skip(): pass @failing def test_failing(): pass @attr(attr1=1, attr2=2) def test_attr(): pass @depends(test_skip, test_failing, test_attr) def test_depends(): pass class DecoratorTestException(Exception): pass @raises(DecoratorTe...
Add tests to verify the proper functioning of decorators
Add tests to verify the proper functioning of decorators
Python
apache-2.0
klmitch/dtest,klmitch/dtest
--- +++ @@ -0,0 +1,90 @@ +from dtest import * +from dtest.util import * + + +@skip +def test_skip(): + pass + + +@failing +def test_failing(): + pass + + +@attr(attr1=1, attr2=2) +def test_attr(): + pass + + +@depends(test_skip, test_failing, test_attr) +def test_depends(): + pass + + +class DecoratorTest...
1cbd6aedeb3b7c3b867f0927450154f386de5664
tests/test_playsongin.py
tests/test_playsongin.py
#!/usr/bin/env python # coding=utf-8 from __future__ import print_function, unicode_literals import os import os.path import nose.tools as nose from tests.utils import run_filter def test_query_ignore_case(): """should ignore case when querying songs in an album""" results = run_filter('playsongin', 'beat...
Add tests for playsongin filter
Add tests for playsongin filter
Python
mit
caleb531/play-song,caleb531/play-song
--- +++ @@ -0,0 +1,58 @@ +#!/usr/bin/env python +# coding=utf-8 + +from __future__ import print_function, unicode_literals + +import os +import os.path + +import nose.tools as nose + +from tests.utils import run_filter + + +def test_query_ignore_case(): + """should ignore case when querying songs in an album""" + ...
af94b633f11cc7ea550dd52a165989370137a27d
paretoer.py
paretoer.py
#!/usr/bin/env python import sys import csv import string class CSVParetoer(): """ This class represents an instance of paretoization. In short, it operates on a CSV file and produces another file with a list of tags to be applied to that file. """ def __init__(self, input_path, output_pat...
Add main file. Initial functionality, no error checking.
Add main file. Initial functionality, no error checking.
Python
mit
sposterkil/pareto-project
--- +++ @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +import sys +import csv +import string + + +class CSVParetoer(): + + """ + This class represents an instance of paretoization. In short, + it operates on a CSV file and produces another file with a list + of tags to be applied to that file. + """ + + ...
bb467be1398e43becde8a3cb2494ba0c81ec40e1
kpi/ona_db_routers.py
kpi/ona_db_routers.py
from __future__ import unicode_literals, absolute_import ​ from .constants import SHADOW_MODEL_APP_LABEL ​ ​ class DefaultDatabaseRouter(object): ​ def db_for_read(self, model, **hints): """ Reads go to a randomly-chosen replica. """ return "default" ​ def db_for_write(self, mode...
Include ona database router file
Include ona database router file
Python
agpl-3.0
onaio/kpi,onaio/kpi,onaio/kpi,onaio/kpi
--- +++ @@ -0,0 +1,36 @@ +from __future__ import unicode_literals, absolute_import +​ +from .constants import SHADOW_MODEL_APP_LABEL +​ +​ +class DefaultDatabaseRouter(object): +​ + def db_for_read(self, model, **hints): + """ + Reads go to a randomly-chosen replica. + """ + return "def...
29e8cf3a1ecd3ce24a1d4473f7817da6df815c77
salad/terrains/browser.py
salad/terrains/browser.py
from lettuce import before, world, after from splinter.browser import Browser from salad.logger import logger @before.all def setup_master_browser(): world.master_browser = setup_browser(world.drivers[0], world.remote_url) world.browser = world.master_browser def setup_browser(browser, url=None): logger...
from lettuce import before, world, after from splinter.browser import Browser from salad.logger import logger @before.all def setup_master_browser(): try: browser = world.drivers[0] remote_url = world.remote_url except AttributeError, IndexError: browser = 'firefox' remote_url ...
Make sure executing lettuce still results in something sane
Make sure executing lettuce still results in something sane
Python
bsd-3-clause
salad/salad,adw0rd/salad-py3,beanqueen/salad,adw0rd/salad-py3,beanqueen/salad,salad/salad
--- +++ @@ -5,7 +5,14 @@ @before.all def setup_master_browser(): - world.master_browser = setup_browser(world.drivers[0], world.remote_url) + try: + browser = world.drivers[0] + remote_url = world.remote_url + except AttributeError, IndexError: + browser = 'firefox' + remote_u...
d8cd90bfea137f27c356bb34687e4b847d2019f4
pylab/website/tests/test_comments.py
pylab/website/tests/test_comments.py
import datetime from django.test import TestCase from django.contrib.auth.models import User from django_comments.models import Comment from pylab.core.models import Project class CommentsTests(TestCase): def test_add_comment(self): user = User.objects.create_user('user1') project = Project.o...
Add test for project comments
Add test for project comments
Python
agpl-3.0
python-dirbtuves/website,python-dirbtuves/website,python-dirbtuves/website
--- +++ @@ -0,0 +1,35 @@ +import datetime + +from django.test import TestCase + +from django.contrib.auth.models import User + +from django_comments.models import Comment + +from pylab.core.models import Project + + +class CommentsTests(TestCase): + + def test_add_comment(self): + user = User.objects.create...
e3838a3281184b4fe3428b55cb893ecfd213e845
zmq_io/out_pifacedigitalio.py
zmq_io/out_pifacedigitalio.py
import argparse import json import pifacedigitalio as pfdio import zmq PINS = ( 0b00000001, 0b00000010, 0b00000100, 0b00001000, 0b00010000, 0b00100000, 0b01000000, 0b10000000 ) def parse_args(): """ Specify and parse command line arguments. """ p = argparse.ArgumentP...
Add outbound pifacedigitalio module which uses interrupt events instead of polling.
Add outbound pifacedigitalio module which uses interrupt events instead of polling.
Python
unlicense
flyte/zmq-io-modules,flyte/zmq-io-modules
--- +++ @@ -0,0 +1,59 @@ +import argparse +import json + +import pifacedigitalio as pfdio +import zmq + + +PINS = ( + 0b00000001, + 0b00000010, + 0b00000100, + 0b00001000, + 0b00010000, + 0b00100000, + 0b01000000, + 0b10000000 +) + + +def parse_args(): + """ + Specify and parse command l...
d2883e9c38d0b093c78b2145343b922fd2406cbb
samples/debugger_membp_singlestep.py
samples/debugger_membp_singlestep.py
import sys import os.path import pprint sys.path.append(os.path.abspath(__file__ + "\..\..")) import windows import windows.test import windows.debug import windows.native_exec.simple_x86 as x86 from windows.generated_def.winstructs import * class MyDebugger(windows.debug.Debugger): def __init__(self, *args, *...
Add a sample on memoryBP + singlestep (cc Heurs :D)
Add a sample on memoryBP + singlestep (cc Heurs :D)
Python
bsd-3-clause
hakril/PythonForWindows
--- +++ @@ -0,0 +1,63 @@ +import sys +import os.path +import pprint +sys.path.append(os.path.abspath(__file__ + "\..\..")) + +import windows +import windows.test +import windows.debug + +import windows.native_exec.simple_x86 as x86 +from windows.generated_def.winstructs import * + + + +class MyDebugger(windows.debug....
f08aa45603056c4fa8fca398a65d7bd751a7e4ed
src/Scripts/cachelines.py
src/Scripts/cachelines.py
# Takes a Document Frequency Table and caclulates the expected number of cache # misses for each term. # # TODO: allow use of different TermTreatments. # TODO: this assumes we subtract 1 from 'rows' because the DocumentActive row is counted as a row. Check that assumption! from collections import defaultdict import c...
Add script for cache miss estimation.
Add script for cache miss estimation.
Python
mit
danluu/BitFunnel,BitFunnel/BitFunnel,BitFunnel/BitFunnel,danluu/BitFunnel,danluu/BitFunnel,BitFunnel/BitFunnel,BitFunnel/BitFunnel,danluu/BitFunnel,danluu/BitFunnel,danluu/BitFunnel,BitFunnel/BitFunnel,BitFunnel/BitFunnel
--- +++ @@ -0,0 +1,61 @@ +# Takes a Document Frequency Table and caclulates the expected number of cache +# misses for each term. +# +# TODO: allow use of different TermTreatments. + +# TODO: this assumes we subtract 1 from 'rows' because the DocumentActive row is counted as a row. Check that assumption! + +from coll...
b20be113b5aa491025dd6f2b4ea0a6d0cd1c7343
ynr/apps/parties/migrations/0011_add_initial_candidates_counts.py
ynr/apps/parties/migrations/0011_add_initial_candidates_counts.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-03-22 11:39 from __future__ import unicode_literals from django.db import migrations def populate_initial_candidate_counts(apps, schema_editor): Party = apps.get_model("parties", "Party") parties_qs = Party.objects.all() for party in parties_q...
Add initial candidates counts in migration
Add initial candidates counts in migration
Python
agpl-3.0
DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative
--- +++ @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-03-22 11:39 +from __future__ import unicode_literals + +from django.db import migrations + + +def populate_initial_candidate_counts(apps, schema_editor): + Party = apps.get_model("parties", "Party") + parties_qs = Party.obj...
277fd92e8f3a695af1af9ec795a3dd63e21566d9
test/unittests/audio/test_vlc_backend.py
test/unittests/audio/test_vlc_backend.py
import unittest import unittest.mock as mock import mycroft.audio.services.vlc as vlc config = { 'backends': { 'test_simple': { 'type': 'vlc', 'active': True } } } @mock.patch('mycroft.audio.services.vlc.vlc') class TestVlcBackend(unittest.TestCase): def test_loa...
Add tests for vlc audio backend
Add tests for vlc audio backend
Python
apache-2.0
forslund/mycroft-core,MycroftAI/mycroft-core,forslund/mycroft-core,MycroftAI/mycroft-core
--- +++ @@ -0,0 +1,75 @@ +import unittest +import unittest.mock as mock + +import mycroft.audio.services.vlc as vlc + + +config = { + 'backends': { + 'test_simple': { + 'type': 'vlc', + 'active': True + } + } +} + + +@mock.patch('mycroft.audio.services.vlc.vlc') +class TestVl...
6a67e280fd690dccf4ff5c22460dd0d52b9ec88d
napper_kittydar.py
napper_kittydar.py
import sys, socket, time, logging import shlex, subprocess from hdfs import * logging.basicConfig() if len(sys.argv) < 4: print "usage: napper_kittydar <job name> <worker ID> <executable>" sys.exit(1) job_name = sys.argv[1] worker_id = int(sys.argv[2]) kittydar_path = " ".join(sys.argv[3:]) # fetch inputs from ...
Add simplified napper instance for kittydar.
Add simplified napper instance for kittydar.
Python
mit
ms705/napper
--- +++ @@ -0,0 +1,29 @@ +import sys, socket, time, logging +import shlex, subprocess +from hdfs import * + +logging.basicConfig() + +if len(sys.argv) < 4: + print "usage: napper_kittydar <job name> <worker ID> <executable>" + sys.exit(1) + +job_name = sys.argv[1] +worker_id = int(sys.argv[2]) +kittydar_path = " "....
d78d944038dfa768a6aac5dc531d5220e6883a11
tests/unit/models/reddit/test_modmail.py
tests/unit/models/reddit/test_modmail.py
from praw.models import ModmailConversation from ... import UnitTest class TestModmailConversation(UnitTest): def test_parse(self): conversation = ModmailConversation(self.reddit, _data={'id': 'ik72'}) assert str(conversation) == 'ik72'
Test that ModmailConversation.id is preserved after fetch
Test that ModmailConversation.id is preserved after fetch
Python
bsd-2-clause
gschizas/praw,13steinj/praw,13steinj/praw,praw-dev/praw,gschizas/praw,darthkedrik/praw,praw-dev/praw,leviroth/praw,leviroth/praw,darthkedrik/praw
--- +++ @@ -0,0 +1,10 @@ +from praw.models import ModmailConversation + +from ... import UnitTest + + +class TestModmailConversation(UnitTest): + def test_parse(self): + conversation = ModmailConversation(self.reddit, + _data={'id': 'ik72'}) + assert str(conv...
c15293b0b68ebee62b148ac8c8e1930d17cd27c7
py/heaters.py
py/heaters.py
class Solution(object): def findRadius(self, houses, heaters): """ :type houses: List[int] :type heaters: List[int] :rtype: int """ heaters.sort() lh = len(heaters) ans = 0 for h in houses: L, U = -1, lh while L + 1 < U:...
Add py solution for 475. Heaters
Add py solution for 475. Heaters 475. Heaters: https://leetcode.com/problems/heaters/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,33 @@ +class Solution(object): + def findRadius(self, houses, heaters): + """ + :type houses: List[int] + :type heaters: List[int] + :rtype: int + """ + heaters.sort() + lh = len(heaters) + ans = 0 + for h in houses: + L, ...
38d17a3d7cf98d69b2366b50bc3994de2f505cca
core/migrations/0029_machinerequest_new_version_scripts.py
core/migrations/0029_machinerequest_new_version_scripts.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('core', '0028_add_version_license_and_scripts'), ] operations = [ migrations.AddField( model_name='machinerequest...
Add boot script and licensing support to API v1
Add boot script and licensing support to API v1
Python
apache-2.0
CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0028_add_version_license_and_scripts'), + ] + + operations = [ + migrations.AddFiel...
34c179a2db3fa1b2419869b2f77f37de272d21d5
voteswap/tests/test_sendgrid_backend.py
voteswap/tests/test_sendgrid_backend.py
from django.core.mail import EmailMultiAlternatives from django.test import override_settings from django.test import TestCase from mock import patch from mock import MagicMock @override_settings( EMAIL_BACKEND='voteswap.mail.backends.sendgrid.SendGridBackend') class TestEmailBase(TestCase): def setUp(self): ...
Test the sendgrid email backend
Test the sendgrid email backend
Python
mit
sbuss/voteswap,sbuss/voteswap,sbuss/voteswap,sbuss/voteswap
--- +++ @@ -0,0 +1,58 @@ +from django.core.mail import EmailMultiAlternatives +from django.test import override_settings +from django.test import TestCase +from mock import patch +from mock import MagicMock + + +@override_settings( + EMAIL_BACKEND='voteswap.mail.backends.sendgrid.SendGridBackend') +class TestEmail...
8803f6058255237dff39549426ca6a513a25193c
website_product_supplier/__openerp__.py
website_product_supplier/__openerp__.py
# -*- coding: utf-8 -*- # (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel # (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { 'name': "Website Product Supplier", 'category': 'Website', 'version': '8.0.1.0.0', 'depends': [ 'website...
# -*- coding: utf-8 -*- # (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel # (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { 'name': "Website Product Supplier", 'category': 'Website', 'version': '8.0.1.0.0', 'depends': [ 'website...
Add images key in manifest file
[FIX] website_product_supplier: Add images key in manifest file
Python
agpl-3.0
nuobit/website,open-synergy/website,gfcapalbo/website,LasLabs/website,acsone/website,nuobit/website,LasLabs/website,Yajo/website,LasLabs/website,gfcapalbo/website,kaerdsar/website,Yajo/website,nuobit/website,nuobit/website,Yajo/website,gfcapalbo/website,acsone/website,kaerdsar/website,LasLabs/website,open-synergy/websi...
--- +++ @@ -18,6 +18,7 @@ 'views/assets.xml', 'security/website_product_supplier_security.xml', ], + 'images': [], 'qweb': ['static/src/xml/*.xml'], 'author': 'Antiun Ingeniería S.L., ' 'Incaser Informatica S.L., '
d758cab051d9f6b36daa39bb061cc17bbb3e53b9
locations/spiders/jefferson_univ_hosp.py
locations/spiders/jefferson_univ_hosp.py
# -*- coding: utf-8 -*- import json import re import scrapy from locations.items import GeojsonPointItem class jefferson_univ_hosp(scrapy.Spider): name = "jefferson_univ_hosp" allowed_domains = ['https://hospitals.jefferson.edu'] start_urls = [ 'https://hospitals.jefferson.edu/find-a-location.ht...
Add spider for Thomas Jefferson University and Hospitals
Add spider for Thomas Jefferson University and Hospitals
Python
mit
iandees/all-the-places,iandees/all-the-places,iandees/all-the-places
--- +++ @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +import json +import re + +import scrapy + +from locations.items import GeojsonPointItem + + +class jefferson_univ_hosp(scrapy.Spider): + name = "jefferson_univ_hosp" + allowed_domains = ['https://hospitals.jefferson.edu'] + start_urls = [ + 'https://h...
d98f57c7be175df8103c7f29fac4e39057ff4891
website/upload_local_replays.py
website/upload_local_replays.py
""" Pull replay from rocketleaguereplays and post turbo-carnival """ import StringIO import os import sys import traceback import requests import boto3 # To setup your keys # aws configure DYNAMO = boto3.resource("dynamodb") TABLE = DYNAMO.Table('turbo-carnival') REPLAY_DIR = "C:\Users\Carlos\Documents\My Games\Rocke...
Add script to upload local replays
Add script to upload local replays
Python
mit
mrcarlosrendon/turbo-carnival,mrcarlosrendon/turbo-carnival,mrcarlosrendon/turbo-carnival
--- +++ @@ -0,0 +1,39 @@ +""" Pull replay from rocketleaguereplays and post turbo-carnival """ +import StringIO +import os +import sys +import traceback +import requests +import boto3 + +# To setup your keys +# aws configure +DYNAMO = boto3.resource("dynamodb") +TABLE = DYNAMO.Table('turbo-carnival') + +REPLAY_DIR = ...
bf0a8d5a13ecf7acbb646696a602a24898793294
newsroom/management/commands/setsite.py
newsroom/management/commands/setsite.py
from django.core.management.base import BaseCommand, CommandError from newsroom.models import Article from django.contrib.sites.models import Site def process(site_name, site_domain): site = Site.objects.get_current() site.name = site_name site.domain = site_domain site.save() class Command(BaseComma...
Change site name and domain from command line.
Change site name and domain from command line.
Python
bsd-3-clause
groundupnews/gu,groundupnews/gu,groundupnews/gu,groundupnews/gu,groundupnews/gu
--- +++ @@ -0,0 +1,20 @@ +from django.core.management.base import BaseCommand, CommandError +from newsroom.models import Article + +from django.contrib.sites.models import Site + +def process(site_name, site_domain): + site = Site.objects.get_current() + site.name = site_name + site.domain = site_domain + ...
b98f0570842a5c51a286b09df7e7d49ae708765e
tests/reader-revA-test.py
tests/reader-revA-test.py
"""Tests for the revA circuit board of the 'reader'. These tests will test the expected functionality of 'reader-revA' (https://github.com/fmfi-svt-deadlock/reader-hw/releases/tag/revA). They are intended to be run once on new boards before the FW is loaded and the device is deployed """ import mempoke from test_sequ...
Add tests for LED1 and LED2
[reader-revA] Add tests for LED1 and LED2
Python
mit
fmfi-svt-deadlock/hw-testing,fmfi-svt-deadlock/hw-testing
--- +++ @@ -0,0 +1,51 @@ +"""Tests for the revA circuit board of the 'reader'. + +These tests will test the expected functionality of 'reader-revA' +(https://github.com/fmfi-svt-deadlock/reader-hw/releases/tag/revA). +They are intended to be run once on new boards before the FW is loaded +and the device is deployed +...
c3efc9ba15fd1833474e2a59e4e266cfc6a4b9dc
awacs/kms.py
awacs/kms.py
from aws import Action, BaseARN service_name = 'Amazon Key Management Service' prefix = 'kms' class ARN(BaseARN): def __init__(self, resource, region='', account=''): sup = super(ARN, self) sup.__init__(service=prefix, resource=resource, region=region, account=account) Cance...
Add support for key management service
Add support for key management service
Python
bsd-2-clause
cloudtools/awacs,craigbruce/awacs
--- +++ @@ -0,0 +1,42 @@ +from aws import Action, BaseARN + +service_name = 'Amazon Key Management Service' +prefix = 'kms' + + +class ARN(BaseARN): + def __init__(self, resource, region='', account=''): + sup = super(ARN, self) + sup.__init__(service=prefix, resource=resource, region=region, + ...
356bba4061a6dbc70f086c59f1870e729733b062
build/unix/pandoc-jira.py
build/unix/pandoc-jira.py
#!/usr/bin/env python import json from sys import stdin from StringIO import StringIO def gotObj(obj): # Replace {"t":"Str","c":"[ROOT-7392]"} if 't' in obj and obj['t'] == 'Str' \ and obj['c'][0:6] == '[ROOT-': # with {"t":"Link","c":[[{"t":"Str","c":"ROOT-7290"}],["https://sft.its.cern.ch/jir...
Add pandoc filter to convert [ROOT-nnnn] into proper links.
Add pandoc filter to convert [ROOT-nnnn] into proper links. (cherry picked from commit 5d48c8e572ee0bf6e9db759eb9089f0a921562b4)
Python
lgpl-2.1
simonpf/root,krafczyk/root,root-mirror/root,gganis/root,lgiommi/root,abhinavmoudgil95/root,root-mirror/root,jrtomps/root,lgiommi/root,thomaskeck/root,sawenzel/root,gbitzes/root,mhuwiler/rootauto,lgiommi/root,mkret2/root,lgiommi/root,georgtroska/root,georgtroska/root,mhuwiler/rootauto,BerserkerTroll/root,satyarth934/roo...
--- +++ @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import json +from sys import stdin +from StringIO import StringIO + +def gotObj(obj): + # Replace {"t":"Str","c":"[ROOT-7392]"} + if 't' in obj and obj['t'] == 'Str' \ + and obj['c'][0:6] == '[ROOT-': + # with {"t":"Link","c":[[{"t":"Str","c":"ROOT...
cf0174b72f6a7e4318b8e97f7a11fc93502c4a0f
command/sub8_alarm/nodes/alarm_handler.py
command/sub8_alarm/nodes/alarm_handler.py
#!/usr/bin/env python import rospy import json from sub8_msgs.msg import Alarm from std_msgs.msg import Header from sub8_alarm import alarms import string class AlarmHandler(object): def __init__(self): '''Alarm Handler Listen for alarms, call scenarios TODO: - Add alarm qu...
Add core alarm handling node
ALARMS: Add core alarm handling node
Python
mit
pemami4911/Sub8,pemami4911/Sub8,pemami4911/Sub8
--- +++ @@ -0,0 +1,59 @@ +#!/usr/bin/env python +import rospy +import json +from sub8_msgs.msg import Alarm +from std_msgs.msg import Header +from sub8_alarm import alarms +import string + + +class AlarmHandler(object): + def __init__(self): + '''Alarm Handler + Listen for alarms, call scenarios ...
a1e332d8deef67d0a854471cfbb5fd3a57658e49
py/judge-route-circle.py
py/judge-route-circle.py
from collections import Counter class Solution(object): def judgeCircle(self, moves): """ :type moves: str :rtype: bool """ c = Counter(moves) return c['L'] == c['R'] and c['U'] == c['D']
Add sql solution for 657. Judge Route Circle
Add sql solution for 657. Judge Route Circle 657. Judge Route Circle: https://leetcode.com/problems/judge-route-circle/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,9 @@ +from collections import Counter +class Solution(object): + def judgeCircle(self, moves): + """ + :type moves: str + :rtype: bool + """ + c = Counter(moves) + return c['L'] == c['R'] and c['U'] == c['D']
8c087accfcc1e5692a608162a2f8e867e8a9b7df
tools/update-seahub-db_0.9.4_to_0.9.5.py
tools/update-seahub-db_0.9.4_to_0.9.5.py
#!/usr/bin/env python # encoding: utf-8 import sqlite3 conn = sqlite3.connect('/home/xiez/seahub/seahub.db') c = conn.cursor() # Create index c.execute('''CREATE INDEX IF NOT EXISTS "group_groupmessage_425ae3c4" ON "group_groupmessage" ("group_id")''') c.execute('''CREATE UNIQUE INDEX IF NOT EXISTS "contacts_conta...
Add update script to tools
Add update script to tools
Python
apache-2.0
madflow/seahub,madflow/seahub,Chilledheart/seahub,madflow/seahub,Chilledheart/seahub,madflow/seahub,cloudcopy/seahub,cloudcopy/seahub,miurahr/seahub,Chilledheart/seahub,miurahr/seahub,miurahr/seahub,madflow/seahub,cloudcopy/seahub,Chilledheart/seahub,Chilledheart/seahub,miurahr/seahub,cloudcopy/seahub
--- +++ @@ -0,0 +1,15 @@ +#!/usr/bin/env python +# encoding: utf-8 + +import sqlite3 + +conn = sqlite3.connect('/home/xiez/seahub/seahub.db') + +c = conn.cursor() + +# Create index +c.execute('''CREATE INDEX IF NOT EXISTS "group_groupmessage_425ae3c4" ON "group_groupmessage" ("group_id")''') + +c.execute('''CREATE UN...
dcffaaf4bccee5930d7ec0cef6e81543bb4d851e
examples/chord_catalog.py
examples/chord_catalog.py
""" Play all the 3-note chords on one octave, after Tom Johnson's "Chord Catalog". Example originally by Douglas Repetto """ import pretty_midi import itertools # Our starting note/octave is middle C base_note = 60 # Time between each chord chord_duration = .1 # Length of each note note_duration = chord_duration*.9 ...
Add MIDI file generation example
Add MIDI file generation example
Python
mit
douglaseck/pretty-midi,craffel/pretty-midi,rafaelvalle/pretty-midi,tygeng/pretty-midi
--- +++ @@ -0,0 +1,43 @@ +""" +Play all the 3-note chords on one octave, after Tom Johnson's "Chord Catalog". +Example originally by Douglas Repetto +""" + +import pretty_midi +import itertools + +# Our starting note/octave is middle C +base_note = 60 + +# Time between each chord +chord_duration = .1 +# Length of eac...
1e4a2b9c9898de4f8e98ac09179afdd7a47f8508
demo_data.py
demo_data.py
from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from database_setup import Base, User, Business, Category, Account, Transaction, AccountUser engine = create_engine('sqlite:///bam.db') Base.metadata.bind = engine Base.metadata.drop_all(engine) # Drop all existing tables Base.metadata.crea...
Add file that was omitted from previous commit
Add file that was omitted from previous commit
Python
unknown
gregcowell/BAM,gregcowell/PFT,gregcowell/PFT,gregcowell/BAM
--- +++ @@ -0,0 +1,30 @@ +from sqlalchemy import create_engine +from sqlalchemy.orm import sessionmaker + +from database_setup import Base, User, Business, Category, Account, Transaction, AccountUser + +engine = create_engine('sqlite:///bam.db') +Base.metadata.bind = engine +Base.metadata.drop_all(engine) # Drop all...
e411edf21bc13518fb1dba8f394fb4d0ed7ed60d
scripts/monitor_yatsm.py
scripts/monitor_yatsm.py
#!/usr/bin/env python """ Near real-time monitoring Usage: monitor_yatsm.py [options] <config_file> <job_number> <total_jobs> Options: --resume Do not overwrite pre-existing results -v --verbose Show verbose debugging messages --version Print program...
Add prototype CLI to monitoring script
Add prototype CLI to monitoring script
Python
mit
valpasq/yatsm,valpasq/yatsm,c11/yatsm,jmorton/yatsm,c11/yatsm,jmorton/yatsm,ceholden/yatsm,jmorton/yatsm,ceholden/yatsm
--- +++ @@ -0,0 +1,13 @@ +#!/usr/bin/env python +""" Near real-time monitoring + +Usage: + monitor_yatsm.py [options] <config_file> <job_number> <total_jobs> + +Options: + --resume Do not overwrite pre-existing results + -v --verbose Show verbose debugging messages + --ve...
6fcc2bff61aad25d9f2f1da93c1e1cc6390c19b7
scripts/motion_sensor.py
scripts/motion_sensor.py
import time import RPi.GPIO as GPIO from blink2 import Blink GPIO.setmode(GPIO.BCM) pir_pin = 23 GPIO.setup(pir_pin, GPIO.IN) # activate input i = 0 while True: if GPIO.input(pir_pin): i += 1 print("%i PIR ALARM!" % i) Blink(27, 3, 0.3) GPIO.setmode(GPIO.BCM) GPI...
Add motion sensor python script.
Add motion sensor python script.
Python
bsd-3-clause
kbsezginel/raspberry-pi,kbsezginel/raspberry-pi,kbsezginel/raspberry-pi,kbsezginel/raspberry-pi
--- +++ @@ -0,0 +1,21 @@ +import time +import RPi.GPIO as GPIO +from blink2 import Blink + + +GPIO.setmode(GPIO.BCM) + +pir_pin = 23 + +GPIO.setup(pir_pin, GPIO.IN) # activate input + +i = 0 +while True: + if GPIO.input(pir_pin): + i += 1 + print("%i PIR ALARM!" % i) + Blink(27, 3, 0.3...
9a27a0699127be1a6b2770e6ffcbfa22a2f72e32
_tests/test_item.py
_tests/test_item.py
from unittest import TestCase from classes.item import Item class TestShoppingList(TestCase): def setUp(self): self.item = Item("name") def tearDown(self): self.item = None def test_item_id_is_int(self): self.assertIsInstance(self.item.id, int) def test_item_name_is_str(self...
Create test-cases for class item
[TESTS] Create test-cases for class item
Python
mit
EinsteinCarrey/Shoppinglist,EinsteinCarrey/Shoppinglist,EinsteinCarrey/Shoppinglist
--- +++ @@ -0,0 +1,31 @@ +from unittest import TestCase +from classes.item import Item + + +class TestShoppingList(TestCase): + def setUp(self): + self.item = Item("name") + + def tearDown(self): + self.item = None + + def test_item_id_is_int(self): + self.assertIsInstance(self.item.id, ...
92de07a7f959df2a4ad7d3dfcb1e9fb8af890fc9
openedx/core/djangoapps/content/block_structure/migrations/0005_trim_leading_slashes_in_data_path.py
openedx/core/djangoapps/content/block_structure/migrations/0005_trim_leading_slashes_in_data_path.py
""" Data migration to convert absolute paths in block_structure.data to be relative. This has only been tested with MySQL, though it should also work for Postgres as well. This is necessary to manually correct absolute paths in the "data" field of the block_structure table. For S3 storage, having a path that starts wi...
Convert block_structure.data to relative paths (TNL-8335)
fix: Convert block_structure.data to relative paths (TNL-8335) In order to upgrade to Django > 2.2.20, we can't continue to use absolute paths in the block_structure's data FileField. This used to work for S3, but it will not work going forward due to a security fix in Django 2.2.21. This data migration will remove t...
Python
agpl-3.0
edx/edx-platform,arbrandes/edx-platform,eduNEXT/edx-platform,eduNEXT/edx-platform,edx/edx-platform,angelapper/edx-platform,edx/edx-platform,eduNEXT/edx-platform,arbrandes/edx-platform,angelapper/edx-platform,angelapper/edx-platform,eduNEXT/edx-platform,arbrandes/edx-platform,edx/edx-platform,arbrandes/edx-platform,ange...
--- +++ @@ -0,0 +1,46 @@ +""" +Data migration to convert absolute paths in block_structure.data to be relative. + +This has only been tested with MySQL, though it should also work for Postgres as +well. This is necessary to manually correct absolute paths in the "data" field +of the block_structure table. For S3 stor...
ed729218148a2700093bc17ffd7e0b10400b9443
alembic/versions/f96f78987d58_added_self_referential_image_parent.py
alembic/versions/f96f78987d58_added_self_referential_image_parent.py
"""Added self-referential image parent Revision ID: f96f78987d58 Revises: 698cc06661d6 Create Date: 2016-03-20 19:21:05.651929 """ # revision identifiers, used by Alembic. revision = 'f96f78987d58' down_revision = '698cc06661d6' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa ...
Add DB migration for self referential images
Add DB migration for self referential images
Python
mit
matslindh/kimochi,matslindh/kimochi
--- +++ @@ -0,0 +1,38 @@ +"""Added self-referential image parent + +Revision ID: f96f78987d58 +Revises: 698cc06661d6 +Create Date: 2016-03-20 19:21:05.651929 + +""" + +# revision identifiers, used by Alembic. +revision = 'f96f78987d58' +down_revision = '698cc06661d6' +branch_labels = None +depends_on = None + +from a...
b0ad67e88481b7656e56f6d1af9449eb43e43337
lowfat/management/commands/fixstatus.py
lowfat/management/commands/fixstatus.py
import datetime from django.core.management.base import BaseCommand from lowfat.models import Fund, Expense class Command(BaseCommand): help = "Fix the status on the database." def handle(self, *args, **options): # Blog posts # Nothing to change # Expense status # Nothing to...
Add script to archive some funding requests
Add script to archive some funding requests
Python
bsd-3-clause
softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat
--- +++ @@ -0,0 +1,44 @@ +import datetime + +from django.core.management.base import BaseCommand + +from lowfat.models import Fund, Expense + +class Command(BaseCommand): + help = "Fix the status on the database." + + def handle(self, *args, **options): + # Blog posts + # Nothing to change + + ...
7d31792ad48cccf1e893cc2f5a1552d562030771
symposion/schedule/migrations/0004_remove_session_and_sessionrole.py
symposion/schedule/migrations/0004_remove_session_and_sessionrole.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2018-10-05 17:38 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('symposion_schedule', '0003_make_sessionrole_submitted_timezone_aware'), ] operations = [ ...
Add migrations to remove Session and SessionRole.
Add migrations to remove Session and SessionRole. See 7873a7959f27bbd39fde74f7912d24390d1f58a0.
Python
mit
pydata/conf_site,pydata/conf_site,pydata/conf_site
--- +++ @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.15 on 2018-10-05 17:38 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('symposion_schedule', '0003_make_sessionrole_submitted_timezon...
5ba528773ca7b7bce61e983cfa2d9f028367805c
fat/migrations/0081_auto_20161010_1616.py
fat/migrations/0081_auto_20161010_1616.py
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-10-10 16:16 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fat', '0080_auto_20160831_0732'), ] operations = [ migrations.AddField( ...
Add migration for Software Carpentry and Data Carpentry
Add migration for Software Carpentry and Data Carpentry
Python
bsd-3-clause
softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat
--- +++ @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2016-10-10 16:16 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('fat', '0080_auto_20160831_0732'), + ] + + operatio...
36aa92b1c4a6c00cd50ed303565107b0213f09c2
enthought/chaco/tests/border_test_case.py
enthought/chaco/tests/border_test_case.py
""" Needed Tests Component.draw_border() tests -------------------- DONE *. draw_border output should match a similar draw_rect output """ import nose import unittest from numpy import array, alltrue, ravel # Chaco imports from enthought.chaco.api import Plot, PlotGraphicsCon...
Add a test case for component borders
Add a test case for component borders
Python
bsd-3-clause
tommy-u/chaco,ContinuumIO/chaco,tommy-u/chaco,burnpanck/chaco,ContinuumIO/chaco,ContinuumIO/chaco,tommy-u/chaco,burnpanck/chaco,ContinuumIO/chaco,burnpanck/chaco
--- +++ @@ -0,0 +1,42 @@ +""" Needed Tests + + Component.draw_border() tests + -------------------- + DONE *. draw_border output should match a similar draw_rect output +""" + +import nose +import unittest + +from numpy import array, alltrue, ravel + +# Chaco imports +from enthoug...
edb2aaa60d56526a8f48ed40b04a8c903203bc64
web/utils/views.py
web/utils/views.py
import StringIO import zipfile from django.http import HttpResponse def plain_text(name, contents, content_type='text/plain'): """ Downloads a plain text file with the given name and contents. """ response = HttpResponse(content_type='{0}; charset=utf-8'.format(content_type)) response['Content-Dis...
Add helper functions for downloading files
Add helper functions for downloading files
Python
agpl-3.0
matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo
--- +++ @@ -0,0 +1,29 @@ +import StringIO +import zipfile +from django.http import HttpResponse + + +def plain_text(name, contents, content_type='text/plain'): + """ + Downloads a plain text file with the given name and contents. + """ + response = HttpResponse(content_type='{0}; charset=utf-8'.format(con...
7726ac8471730cdcb426ef002c7b2046cdffd602
sippy/IVoiSysAuthorisation.py
sippy/IVoiSysAuthorisation.py
# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved. # Copyright (c) 2006-2007 Sippy Software, Inc. All rights reserved. # # This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA. # # SIPPY is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License a...
Add class specific for IVoiSys to do DB auth.
Add class specific for IVoiSys to do DB auth.
Python
bsd-2-clause
AVOXI/b2bua,sippy/b2bua,sippy/b2bua,AVOXI/b2bua
--- +++ @@ -0,0 +1,44 @@ +# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved. +# Copyright (c) 2006-2007 Sippy Software, Inc. All rights reserved. +# +# This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA. +# +# SIPPY is free software; you can redistribute it and/or modify +# it under the terms o...
d77a01a76bfe4789cf76f656b7136069ddac33a3
scipy/constants/tests/test_constants.py
scipy/constants/tests/test_constants.py
from numpy.testing import run_module_suite, assert_equal import scipy.constants as sc def test_fahrenheit_to_celcius(): assert_equal(sc.F2C(32), 0) assert_equal(sc.F2C([32, 32]), [0, 0]) def test_celcius_to_kelvin(): assert_equal(sc.C2K([0, 0]), [273.15, 273.15]) def test_kelvin_to_celcius(): assert_...
Add basic tests for constants.
ENH: Add basic tests for constants.
Python
bsd-3-clause
arokem/scipy,zxsted/scipy,cpaulik/scipy,mingwpy/scipy,Gillu13/scipy,njwilson23/scipy,matthew-brett/scipy,mikebenfield/scipy,pnedunuri/scipy,larsmans/scipy,ilayn/scipy,jonycgn/scipy,dch312/scipy,anntzer/scipy,maniteja123/scipy,futurulus/scipy,Dapid/scipy,hainm/scipy,WarrenWeckesser/scipy,e-q/scipy,person142/scipy,lhilt/...
--- +++ @@ -0,0 +1,30 @@ +from numpy.testing import run_module_suite, assert_equal +import scipy.constants as sc + +def test_fahrenheit_to_celcius(): + assert_equal(sc.F2C(32), 0) + assert_equal(sc.F2C([32, 32]), [0, 0]) + +def test_celcius_to_kelvin(): + assert_equal(sc.C2K([0, 0]), [273.15, 273.15]) + +def...
d6b11eec630d3709d69e3b3878a7859b67cb0fd4
src/compare_meta_data.py
src/compare_meta_data.py
import argparse import json import re from os.path import join file_regex = re.compile("(^[a-z\-]*)") results_log = "query_results.json" def extract_arXiv_topic(filename): return_topic = "" matches = file_regex.match(filename).groups() if len(matches) > 0: return_topic = matches[0] return r...
Add script to compare similarites with meta data
Add script to compare similarites with meta data
Python
mit
PinPinIre/Final-Year-Project,PinPinIre/Final-Year-Project,PinPinIre/Final-Year-Project
--- +++ @@ -0,0 +1,48 @@ +import argparse +import json +import re +from os.path import join + +file_regex = re.compile("(^[a-z\-]*)") + + +results_log = "query_results.json" + + +def extract_arXiv_topic(filename): + return_topic = "" + matches = file_regex.match(filename).groups() + if len(matches) > 0: + ...
8df57b5241ba04ec8444546ed2356ae421796d23
django_vend/core/forms.py
django_vend/core/forms.py
import re from django import forms from django.utils.dateparse import parse_datetime from django.core.exceptions import ValidationError def valid_date(date): regex = ("^(?:[1-9]\d{3}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1\d|2[0-8])|(?:0[13" "-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[1-9]\d(?:0[48]|[...
Create form field that can accept dates in the format used by the Vend API
Create form field that can accept dates in the format used by the Vend API
Python
bsd-3-clause
remarkablerocket/django-vend,remarkablerocket/django-vend
--- +++ @@ -0,0 +1,21 @@ +import re + +from django import forms +from django.utils.dateparse import parse_datetime +from django.core.exceptions import ValidationError + +def valid_date(date): + regex = ("^(?:[1-9]\d{3}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1\d|2[0-8])|(?:0[13" + "-9]|1[0-2])-(?:29|30)|(?:0[13...
cb88cdb82eb8032b2a83f006aa7c5e153cbbe8e2
python/smqtk/data_rep/data_set_impl/test_plugins.py
python/smqtk/data_rep/data_set_impl/test_plugins.py
from smqtk.data_rep.data_set_impl import get_data_set_impls __author__ = 'purg' def test_plugin_getter(): c = get_data_set_impls() assert 'DataFileSet' in c
Add missing DataSet plugin test
Add missing DataSet plugin test
Python
bsd-3-clause
kfieldho/SMQTK,Purg/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK,Purg/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK,Purg/SMQTK,Purg/SMQTK,Purg/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK,Purg/SMQTK,Purg/SMQTK,kfieldho/SMQTK,Purg/SMQTK,Purg/SMQTK
--- +++ @@ -0,0 +1,10 @@ + +from smqtk.data_rep.data_set_impl import get_data_set_impls + + +__author__ = 'purg' + + +def test_plugin_getter(): + c = get_data_set_impls() + assert 'DataFileSet' in c
fa4f6bc0eae79aec45ee3da5bc70515bb363110c
misc/bonus_feat_dumper.py
misc/bonus_feat_dumper.py
#!/usr/bin/env python import argparse from pynwn.resource import ResourceManager from pynwn.file.twoda import TwoDA from pynwn.item import Item parser = argparse.ArgumentParser() parser.add_argument('-v', '--version', action='version', version='0.1') parser.add_argument('--nwn', help='NWN Path.', ...
Add little class bonus feat dumper.
Add little class bonus feat dumper.
Python
mit
jd28/pynwn-tools,jd28/pynwn-tools
--- +++ @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +import argparse + +from pynwn.resource import ResourceManager +from pynwn.file.twoda import TwoDA +from pynwn.item import Item + +parser = argparse.ArgumentParser() +parser.add_argument('-v', '--version', action='version', version='0.1') +parser.add_argument('--nwn',...
e98452df23fd680be0b4b9729d1c7f80d0686a0e
examples/open-existing.py
examples/open-existing.py
#!/usr/bin/python # This is a simple example program to show how to use PyIso to open up an # existing ISO passed on the command-line, and print out all of the file names # at the root of the ISO. # Import standard python modules. import sys # Import pyiso itself. import pyiso # Check that there are enough command-...
Add a well-documented example for opening an existing ISO.
Add a well-documented example for opening an existing ISO. Signed-off-by: Chris Lalancette <281cd07d7578d97c83271fbbf2faddb83ab3791c@gmail.com>
Python
lgpl-2.1
clalancette/pycdlib,clalancette/pyiso
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/python + +# This is a simple example program to show how to use PyIso to open up an +# existing ISO passed on the command-line, and print out all of the file names +# at the root of the ISO. + +# Import standard python modules. +import sys + +# Import pyiso itself. +import pyiso +...
6ba590092846ca240629091df2f064b389d15eca
babybuddy/migrations/0002_add_settings.py
babybuddy/migrations/0002_add_settings.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def add_settings(apps, schema_editor): Settings = apps.get_model('babybuddy', 'Settings') User = apps.get_model('auth', 'User') for user in User.objects.all(): if Settings.objects.filter(user=user).co...
Add migration to handle existing users when adding the Settings model.
Add migration to handle existing users when adding the Settings model.
Python
bsd-2-clause
cdubz/babybuddy,cdubz/babybuddy,cdubz/babybuddy
--- +++ @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +def add_settings(apps, schema_editor): + Settings = apps.get_model('babybuddy', 'Settings') + User = apps.get_model('auth', 'User') + for user in User.objects.all(): + if...
9fb8b2bc70a34c9f91c652eb5582b3d894a069d6
util/fetch_archive.py
util/fetch_archive.py
#!/usr/bin/python3 import argparse import os import requests import shutil import subprocess parser = argparse.ArgumentParser(description='iconograph fetch_archive') parser.add_argument( '--dest-dir', dest='dest_dir', action='store', default='.') parser.add_argument( '--https-ca-cert', dest='...
Add utility to fetch and unpack tarballs securely from a server.
Add utility to fetch and unpack tarballs securely from a server.
Python
apache-2.0
robot-tools/iconograph,robot-tools/iconograph,robot-tools/iconograph,robot-tools/iconograph
--- +++ @@ -0,0 +1,70 @@ +#!/usr/bin/python3 + +import argparse +import os +import requests +import shutil +import subprocess + + +parser = argparse.ArgumentParser(description='iconograph fetch_archive') +parser.add_argument( + '--dest-dir', + dest='dest_dir', + action='store', + default='.') +parser.add_...
6db79795e3839003965686f8ef73d1937aba1fba
scripts/consistency/fix_duplicate_addons.py
scripts/consistency/fix_duplicate_addons.py
"""Fixes nodes with two copies of the files and wiki addons attached. This script must be run from the OSF root directory for the imports to work. """ from pymongo import MongoClient from website.app import init_app from website.project.model import Node from website.addons.wiki.model import AddonWikiNodeSettings ...
Add script to fix file and wiki migration bug
Add script to fix file and wiki migration bug
Python
apache-2.0
sloria/osf.io,felliott/osf.io,chrisseto/osf.io,mattclark/osf.io,icereval/osf.io,samanehsan/osf.io,cwisecarver/osf.io,laurenrevere/osf.io,reinaH/osf.io,erinspace/osf.io,abought/osf.io,baylee-d/osf.io,dplorimer/osf,danielneis/osf.io,jinluyuan/osf.io,rdhyee/osf.io,chrisseto/osf.io,jolene-esposito/osf.io,CenterForOpenScien...
--- +++ @@ -0,0 +1,42 @@ +"""Fixes nodes with two copies of the files and wiki addons attached. + +This script must be run from the OSF root directory for the imports to work. +""" + + +from pymongo import MongoClient + +from website.app import init_app +from website.project.model import Node + +from website.addons.w...
2c6cb6b869726fbac859b5e3e1ab3d3a76d4908b
tools/telemetry/telemetry/page/page_test_results.py
tools/telemetry/telemetry/page/page_test_results.py
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import traceback import unittest class PageTestResults(unittest.TestResult): def __init__(self): super(PageTestResults, self).__init__() self....
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import traceback import unittest class PageTestResults(unittest.TestResult): def __init__(self): super(PageTestResults, self).__init__() self....
Add skipped and addSkip() to PageTestResults, for Python < 2.7.
[telemetry] Add skipped and addSkip() to PageTestResults, for Python < 2.7. Fixing bots after https://chromiumcodereview.appspot.com/15153003/ Also fix typo in addSuccess(). successes is only used by record_wpr, so that mistake had no effect on the bots. TBR=tonyg@chromium.org BUG=None. TEST=None. Review URL: https:...
Python
bsd-3-clause
ondra-novak/chromium.src,dushu1203/chromium.src,hgl888/chromium-crosswalk,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk-efl,jaruba/chromium.src,Just-D/chromium-1,ondra-novak/chromium.src,hgl888/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,Chilledheart/chromium,patrickm/chromium.sr...
--- +++ @@ -9,6 +9,7 @@ def __init__(self): super(PageTestResults, self).__init__() self.successes = [] + self.skipped = [] def addError(self, test, err): if isinstance(test, unittest.TestCase): @@ -23,7 +24,10 @@ self.failures.append((test, ''.join(traceback.format_exception(*err))))...
dd617bf4ef79d61caa3080331733d05c46b6aa04
python/aspk/super_test.py
python/aspk/super_test.py
# this file demostrate the diamond problem. The constructore method can't be called correctly in this case. # When instance a D object, super(D, self) will be a B object, so B.__init__ will be called. # But in B.__init__, super(B, self) will be a C object, instead of a A object, so C.__init__ will be called, this will ...
Test the diamond inheritance problem.
Test the diamond inheritance problem.
Python
mit
astropeak/aspk-code-base,astropeak/aspk-code-base,astropeak/aspk-code-base,astropeak/aspk-code-base,astropeak/aspk-code-base,astropeak/aspk-code-base,astropeak/aspk-code-base,astropeak/aspk-code-base,astropeak/aspk-code-base
--- +++ @@ -0,0 +1,41 @@ +# this file demostrate the diamond problem. The constructore method can't be called correctly in this case. +# When instance a D object, super(D, self) will be a B object, so B.__init__ will be called. +# But in B.__init__, super(B, self) will be a C object, instead of a A object, so C.__ini...
0ff96767ea737a1771bec6ac912c2e5dec6c3328
modules/tools/extractor/extractor.py
modules/tools/extractor/extractor.py
#!/usr/bin/env python ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy ...
Add tool to extract routing from planning debug
Add tool to extract routing from planning debug
Python
apache-2.0
msbeta/apollo,msbeta/apollo,msbeta/apollo,msbeta/apollo,msbeta/apollo,msbeta/apollo
--- +++ @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +############################################################################### +# Copyright 2017 The Apollo Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the...
4c359a1bab5782614d95c7165c6af8805fe85d99
plot.py
plot.py
#!/usr/bin/env python """ This script generates the relevant figures and/or tables from the experiment. To reprocess the data, run `process.py`. """ import os from Modules.plotting import * from pxl.styleplot import set_sns save = True savetype = ".pdf" show = True if __name__ == "__main__": # Set plot style us...
Add top-level script for generating figures
Add top-level script for generating figures
Python
mit
iangagnon/2015-09-24-turbine-test-bed-demo,UNH-CORE/2015-09-24-turbine-test-bed-demo,petebachant/TurbineDAQ-project-template
--- +++ @@ -0,0 +1,23 @@ +#!/usr/bin/env python +""" +This script generates the relevant figures and/or tables from the experiment. To +reprocess the data, run `process.py`. +""" + +import os +from Modules.plotting import * +from pxl.styleplot import set_sns + +save = True +savetype = ".pdf" +show = True + + +if __na...
23255192812a687e9fa56828908828d5c4caddc6
DBConnect.py
DBConnect.py
import psycopg2 as pg_driver class DBService: def __init__(self, user, password, host, dbname): self.db = pg_driver.connect(user=user, password=password, host=host, dbname=dbname) self.cur = self.db.cursor() def __del__(self): self.db.close() def get_url(self): self.cur.e...
Implement class for connect to DB
Implement class for connect to DB
Python
mit
YorovSobir/informational_retrieval
--- +++ @@ -0,0 +1,51 @@ +import psycopg2 as pg_driver + + +class DBService: + def __init__(self, user, password, host, dbname): + self.db = pg_driver.connect(user=user, password=password, host=host, dbname=dbname) + self.cur = self.db.cursor() + + def __del__(self): + self.db.close() + + ...
9cb3ab8ff55cfdf1413f1290bdc40d2e90fe1e02
tests/test_response.py
tests/test_response.py
"""Unit test some basic response rendering functionality. These tests use the unittest.mock mechanism to provide a simple Assistant instance for the _Response initialization. """ from unittest.mock import patch from flask import Flask from flask_assistant import Assistant from flask_assistant.response import _Respons...
Add basic unittests for _Response initialization
Add basic unittests for _Response initialization
Python
apache-2.0
treethought/flask-assistant
--- +++ @@ -0,0 +1,31 @@ +"""Unit test some basic response rendering functionality. + +These tests use the unittest.mock mechanism to provide a simple Assistant +instance for the _Response initialization. +""" +from unittest.mock import patch + +from flask import Flask +from flask_assistant import Assistant +from fla...
6ae99e2d05ba43e09f500ddad9d8cc491c7263f7
static_rnn.py
static_rnn.py
# Static unrolling through time import tensorflow as tf import numpy as np tf.set_random_seed(765) np.random.seed(765) n_inputs = 3 n_neurons = 5 X0 = tf.placeholder(tf.float32, [None, n_inputs]) X1 = tf.placeholder(tf.float32, [None, n_inputs]) basic_cell = tf.contrib.rnn.BasicRNNCell(num_units=n_neurons) output_s...
Add code for simple static RNN
Add code for simple static RNN Hard to scale up this example.
Python
mit
KT12/hands_on_machine_learning
--- +++ @@ -0,0 +1,18 @@ +# Static unrolling through time +import tensorflow as tf +import numpy as np + +tf.set_random_seed(765) +np.random.seed(765) + +n_inputs = 3 +n_neurons = 5 + +X0 = tf.placeholder(tf.float32, [None, n_inputs]) +X1 = tf.placeholder(tf.float32, [None, n_inputs]) + +basic_cell = tf.contrib.rnn.B...
d6aeb1b4e4a9df6ae1f8b8316a90b1d9e3e7b7f2
test.py
test.py
#!/usr/bin/env python # built-in import os from pprint import pprint import sys # 3rd party by pip # local from bibpy import bib def main(argv=sys.argv[:]): # example = 'bibtex/robust_inside-outside_segmentation_using_generalized_winding_numbers.bib' example = argv[1] data = bib.clear_comments(open(exa...
Test bibpy. It works really well.
Test bibpy. It works really well.
Python
unlicense
drakeguan/siggraphwall,drakeguan/siggraphwall,drakeguan/siggraphwall
--- +++ @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +# built-in +import os +from pprint import pprint +import sys + +# 3rd party by pip + +# local +from bibpy import bib + + +def main(argv=sys.argv[:]): + # example = 'bibtex/robust_inside-outside_segmentation_using_generalized_winding_numbers.bib' + example = arg...