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
4e4d07254dfdbc86a2a9ed4211aacb0165cf8411
domain_api/migrations/0016_auto_20170407_0815.py
domain_api/migrations/0016_auto_20170407_0815.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-04-07 08:15 from __future__ import unicode_literals from django.conf import settings from django.db import migrations class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('...
Migrate db to make default_registrant unique for project
Migrate db to make default_registrant unique for project
Python
mit
heytrav/drs-project
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-04-07 08:15 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependenc...
1e87a9803c76128eec0c4a8f895f163682c8591e
examples/application/app_with_kv_in_template1.py
examples/application/app_with_kv_in_template1.py
''' Application from a .kv ====================== The root application is created from the corresponding .kv. Check the test.kv file to see what will be the root widget. This example show how you can change the directory where the .kv live. ''' import kivy kivy.require('1.0.7') from kivy.app import App class TestA...
''' Application from a .kv ====================== The root application is created from the corresponding .kv. Check the test.kv file to see what will be the root widget. This example shows how you can change the directory where the .kv lives. ''' import kivy kivy.require('1.0.7') from kivy.app import App class Te...
Correct description comment, add a line break
Correct description comment, add a line break
Python
mit
cbenhagen/kivy,niavlys/kivy,JohnHowland/kivy,ernstp/kivy,edubrunaldi/kivy,akshayaurora/kivy,manthansharma/kivy,andnovar/kivy,andnovar/kivy,inclement/kivy,arlowhite/kivy,CuriousLearner/kivy,Farkal/kivy,tony/kivy,yoelk/kivy,angryrancor/kivy,darkopevec/kivy,MiyamotoAkira/kivy,CuriousLearner/kivy,janssen/kivy,CuriousLearne...
--- +++ @@ -4,7 +4,8 @@ The root application is created from the corresponding .kv. Check the test.kv file to see what will be the root widget. -This example show how you can change the directory where the .kv live. + +This example shows how you can change the directory where the .kv lives. ''' import kivy
23ebe6036ae0590ee62c8eb738a9e88a81989204
tests/test_path.py
tests/test_path.py
from django.test import TestCase from binder.views import split_path, join_path class PathTest(TestCase): def _test_path(self, path_str, path_keys): with self.subTest('str to keys'): self.assertEqual(tuple(split_path(path_str)), path_keys) with self.subTest('keys to str'): self.assertEqual(join_path(path...
Add tests for split_path/join_path functionality
Add tests for split_path/join_path functionality
Python
mit
CodeYellowBV/django-binder
--- +++ @@ -0,0 +1,24 @@ +from django.test import TestCase + +from binder.views import split_path, join_path + + +class PathTest(TestCase): + + def _test_path(self, path_str, path_keys): + with self.subTest('str to keys'): + self.assertEqual(tuple(split_path(path_str)), path_keys) + with self.subTest('keys to str...
c93da26c35607518f286dbdf9023034288074fab
tests/test_unix.py
tests/test_unix.py
import asyncio import os import socket import tempfile import uvloop from uvloop import _testbase as tb class _TestUnix: def test_create_server_1(self): CNT = 0 # number of clients that were successful TOTAL_CNT = 100 # total number of clients that test will create TIMEOUT = 5...
Add a test for loop.create_unix_server
tests: Add a test for loop.create_unix_server
Python
apache-2.0
MagicStack/uvloop,1st1/uvloop,MagicStack/uvloop
--- +++ @@ -0,0 +1,92 @@ +import asyncio +import os +import socket +import tempfile +import uvloop + +from uvloop import _testbase as tb + + +class _TestUnix: + def test_create_server_1(self): + CNT = 0 # number of clients that were successful + TOTAL_CNT = 100 # total number of clients t...
0e4a6550984d2a244cd0a816101697d174eb3df2
tests/aggregate/test_search_vectors.py
tests/aggregate/test_search_vectors.py
import sqlalchemy as sa from sqlalchemy_utils import aggregated, TSVectorType from tests import TestCase def tsvector_reduce_concat(vectors): return sa.sql.expression.cast( sa.func.coalesce( sa.func.array_to_string(sa.func.array_agg(vectors), ' ') ), TSVectorType ) class ...
Add search vector agg test case
Add search vector agg test case
Python
bsd-3-clause
tonyseek/sqlalchemy-utils,rmoorman/sqlalchemy-utils,spoqa/sqlalchemy-utils,cheungpat/sqlalchemy-utils,joshfriend/sqlalchemy-utils,tonyseek/sqlalchemy-utils,konstantinoskostis/sqlalchemy-utils,JackWink/sqlalchemy-utils,marrybird/sqlalchemy-utils,joshfriend/sqlalchemy-utils
--- +++ @@ -0,0 +1,56 @@ +import sqlalchemy as sa +from sqlalchemy_utils import aggregated, TSVectorType +from tests import TestCase + + +def tsvector_reduce_concat(vectors): + return sa.sql.expression.cast( + sa.func.coalesce( + sa.func.array_to_string(sa.func.array_agg(vectors), ' ') + )...
b1949e4c0984c1f254c5877da1b977c01567bf4d
tests/unicode/unicode_index.py
tests/unicode/unicode_index.py
print("Привет".find("т")) print("Привет".find("П")) print("Привет".rfind("т")) print("Привет".rfind("П")) print("Привет".index("т")) print("Привет".index("П"))
Add tests for unicode find()/rfind()/index().
tests: Add tests for unicode find()/rfind()/index().
Python
mit
turbinenreiter/micropython,deshipu/micropython,jlillest/micropython,xuxiaoxin/micropython,dxxb/micropython,ChuckM/micropython,EcmaXp/micropython,henriknelson/micropython,alex-robbins/micropython,HenrikSolver/micropython,tdautc19841202/micropython,blmorris/micropython,emfcamp/micropython,selste/micropython,aethaniel/mic...
--- +++ @@ -0,0 +1,6 @@ +print("Привет".find("т")) +print("Привет".find("П")) +print("Привет".rfind("т")) +print("Привет".rfind("П")) +print("Привет".index("т")) +print("Привет".index("П"))
f8988e956577bf838663346412d223d4cd1351d5
django_orm/postgresql/expressions.py
django_orm/postgresql/expressions.py
# -*- coding: utf-8 -*- from django.db.models.expressions import F as BaseF class F(BaseF): def __invert__(self): self._invert = True return self def evaluate(self, evaluator, qn, connection): result = evaluator.evaluate_leaf(self, qn, connection) if self._invert and len(resul...
Add new modifier of F expression class (~F("boolean field"))
Add new modifier of F expression class (~F("boolean field"))
Python
bsd-3-clause
EnTeQuAk/django-orm,EnTeQuAk/django-orm
--- +++ @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from django.db.models.expressions import F as BaseF + +class F(BaseF): + def __invert__(self): + self._invert = True + return self + + def evaluate(self, evaluator, qn, connection): + result = evaluator.evaluate_leaf(self, qn, connection)...
2471742baac1a452efb4ab532e0aa1bb873a2913
rail-system-optimizer.py
rail-system-optimizer.py
""" Train station Optimizer! This program optimizes the efficiency of a train station by simulating normal operations and varying train schedules and escalator ediquette. """ from CreateRailSystem import * from StationPopWithoutTrain import * from StationPopWithTrain import * from MonteCarloSim import * runs = eval...
Add main function of the rail system optimizer
Add main function of the rail system optimizer def issue#17
Python
mit
ForestPride/rail-problem
--- +++ @@ -0,0 +1,46 @@ +""" +Train station Optimizer! + +This program optimizes the efficiency of a train station by simulating normal +operations and varying train schedules and escalator ediquette. +""" + + +from CreateRailSystem import * +from StationPopWithoutTrain import * +from StationPopWithTrain import * +f...
60889b58596e81fd84d9b4fab5f8c04f0382f99c
examples/summary.py
examples/summary.py
#! /usr/bin/env python # -*- coding: utf-8 -*- """Use IMAP CLI to gt a summary of IMAP account state.""" import argparse import getpass import logging import os import sys from imap_cli import config from imap_cli.imap import connection from imap_cli.imap import search from imap_cli import list_mail from imap_cli ...
Add an example script showing how to use this library
Add an example script showing how to use this library
Python
mit
Gentux/imap-cli,Gentux/imap-cli
--- +++ @@ -0,0 +1,70 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + + +"""Use IMAP CLI to gt a summary of IMAP account state.""" + + +import argparse +import getpass +import logging +import os +import sys + +from imap_cli import config +from imap_cli.imap import connection +from imap_cli.imap import search +f...
41047fa4f4e83d457b68b69ae04d7a5373f3aa06
malaria-3view-normalise.py
malaria-3view-normalise.py
# IPython log file import toolz as tz import numpy as np from skimage import io import os filenames = sorted(os.listdir()) from toolz import curried as c os.makedirs('8bit') # find the maximum value over all images tz.pipe(filenames, c.map(io.imread), c.map(np.max), max) import sys sys.path.append('/Users/nuneziglesi...
Add session normalising malaria 3view stack
Add session normalising malaria 3view stack
Python
bsd-3-clause
jni/useful-histories
--- +++ @@ -0,0 +1,36 @@ +# IPython log file + + +import toolz as tz +import numpy as np +from skimage import io +import os +filenames = sorted(os.listdir()) +from toolz import curried as c +os.makedirs('8bit') +# find the maximum value over all images +tz.pipe(filenames, c.map(io.imread), c.map(np.max), max) +import...
76d1930367418ffc01c9629b686557d0bd979f03
CodeFights/rockPaperScissors.py
CodeFights/rockPaperScissors.py
#!/usr/local/bin/python # Code Fights Rock Paper Scissors Problem from itertools import combinations def rockPaperScissors(players): return sorted([[b, a] for a, b in combinations(players, 2)] + [[a, b] for a, b in combinations(players, 2)]) def main(): tests = [ [ ["t...
Solve Code Fights rock paper scissors problem
Solve Code Fights rock paper scissors problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,41 @@ +#!/usr/local/bin/python +# Code Fights Rock Paper Scissors Problem + +from itertools import combinations + + +def rockPaperScissors(players): + return sorted([[b, a] for a, b in combinations(players, 2)] + + [[a, b] for a, b in combinations(players, 2)]) + + +def main(): ...
748e39de86b35d5288cef55d3eb246dc0fd84e48
enasearch/__main__.py
enasearch/__main__.py
#!/usr/bin/env python import click import ebisearch from pprint import pprint @click.group() def main(): pass @click.command('get_results', short_help='Get list of results') def get_results(): """Return the list of domains in EBI""" ebisearch.get_results(verbose=True) @click.command('get_filter_field...
Add first version of main
Add first version of main
Python
mit
bebatut/enasearch
--- +++ @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +import click +import ebisearch +from pprint import pprint + + +@click.group() +def main(): + pass + + +@click.command('get_results', short_help='Get list of results') +def get_results(): + """Return the list of domains in EBI""" + ebisearch.get_results(verbo...
99e5badeb1e2e6aeffd3b3d56902d4257e168326
examples/hwapi/soft_pwm_uasyncio.py
examples/hwapi/soft_pwm_uasyncio.py
# See original soft_pwm.py for detailed comments. import uasyncio from hwconfig import LED async def pwm_cycle(led, duty, cycles): duty_off = 20 - duty for i in range(cycles): if duty: led.value(1) await uasyncio.sleep_ms(duty) if duty_off: led.value(0) ...
Add soft_pwm example converted to uasyncio.
examples/hwapi: Add soft_pwm example converted to uasyncio.
Python
mit
oopy/micropython,swegener/micropython,puuu/micropython,adafruit/micropython,Timmenem/micropython,pozetroninc/micropython,henriknelson/micropython,torwag/micropython,alex-robbins/micropython,infinnovation/micropython,bvernoux/micropython,pozetroninc/micropython,micropython/micropython-esp32,tralamazza/micropython,swegen...
--- +++ @@ -0,0 +1,28 @@ +# See original soft_pwm.py for detailed comments. +import uasyncio +from hwconfig import LED + + +async def pwm_cycle(led, duty, cycles): + duty_off = 20 - duty + for i in range(cycles): + if duty: + led.value(1) + await uasyncio.sleep_ms(duty) + if ...
36f8bcbb5df95c10deea461ee5afddbfbf746f16
oidc_provider/tests/test_creatersakey_command.py
oidc_provider/tests/test_creatersakey_command.py
from django.core.management import call_command from django.test import TestCase, override_settings from django.utils.six import StringIO class CreateRSAKeyTest(TestCase): @override_settings(BASE_DIR='/tmp') def test_command_output(self): out = StringIO() call_command('creatersakey', stdout=ou...
Add a basic test for the creatersakey management command
Add a basic test for the creatersakey management command
Python
mit
wayward710/django-oidc-provider,wayward710/django-oidc-provider,torreco/django-oidc-provider,wojtek-fliposports/django-oidc-provider,juanifioren/django-oidc-provider,bunnyinc/django-oidc-provider,juanifioren/django-oidc-provider,ByteInternet/django-oidc-provider,bunnyinc/django-oidc-provider,ByteInternet/django-oidc-pr...
--- +++ @@ -0,0 +1,11 @@ +from django.core.management import call_command +from django.test import TestCase, override_settings +from django.utils.six import StringIO + + +class CreateRSAKeyTest(TestCase): + @override_settings(BASE_DIR='/tmp') + def test_command_output(self): + out = StringIO() + c...
238a063b821525bc24f059225cfe8fe1ecbdb586
thinc/tests/unit/test_difference.py
thinc/tests/unit/test_difference.py
'''Tests for distance-based objectives, layers, etc.''' import pytest import numpy import numpy.linalg from numpy.testing import assert_allclose from ...neural._classes.difference import word_movers_similarity @pytest.fixture def N1(): return 5 @pytest.fixture def N2(): return 3 @pytest.fixture def ndim(): ...
Add tests for new difference module
Add tests for new difference module
Python
mit
spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc
--- +++ @@ -0,0 +1,65 @@ +'''Tests for distance-based objectives, layers, etc.''' +import pytest +import numpy +import numpy.linalg +from numpy.testing import assert_allclose +from ...neural._classes.difference import word_movers_similarity + +@pytest.fixture +def N1(): + return 5 + +@pytest.fixture +def N2(): + ...
dc7ba5b850c268c3a572e109e8bcaf9dff3ff589
amcat/management/commands/install_r.py
amcat/management/commands/install_r.py
########################################################################### # (C) Vrije Universiteit, Amsterdam (the Netherlands) # # # # This file is part of AmCAT - The Amsterdam Content Analysis Toolkit # # ...
Add manage command for installing R dependencies
Add manage command for installing R dependencies
Python
agpl-3.0
amcat/amcat,amcat/amcat,amcat/amcat,amcat/amcat,amcat/amcat,amcat/amcat
--- +++ @@ -0,0 +1,53 @@ +########################################################################### +# (C) Vrije Universiteit, Amsterdam (the Netherlands) # +# # +# This file is part of AmCAT - The Amsterdam Content Analysis...
d0f144e6e7ca587e42556e19958c53ea131a68e2
tests/data_checks/test_pvalue_filtering.py
tests/data_checks/test_pvalue_filtering.py
# ------------------------------------------------ # built-ins import unittest # local from utils.base import TestPostgapBase # ------------------------------------------------ class TestPValueFiltering(TestPostgapBase): def test_one_pvalue_per_gwas_pmid_AND_efo_id(self): self.skipTest('ONE PVALUE PER GW...
Add placeholder for gwas pvalue
Add placeholder for gwas pvalue
Python
apache-2.0
Ensembl/cttv024,Ensembl/cttv024
--- +++ @@ -0,0 +1,19 @@ +# ------------------------------------------------ +# built-ins +import unittest + +# local +from utils.base import TestPostgapBase +# ------------------------------------------------ + +class TestPValueFiltering(TestPostgapBase): + + def test_one_pvalue_per_gwas_pmid_AND_efo_id(self): + ...
b69a3381381aabd97873903eea863a85fc4c932d
pokedex/tests/test_docs.py
pokedex/tests/test_docs.py
import os import re from pokedex.db.tables import mapped_classes def test_main_tables(): """Check that tables.py and main-tables.rst are in sync: every table should be documented, and every documented table should exist.""" main_tables_path = os.path.join(os.path.dirname(__file__), '../../doc/main-tables...
Add a test for main-tables.rst
Add a test for main-tables.rst
Python
mit
mschex1/pokedex,DaMouse404/pokedex,RK905/pokedex-1,xfix/pokedex,veekun/pokedex,veekun/pokedex
--- +++ @@ -0,0 +1,22 @@ +import os +import re + +from pokedex.db.tables import mapped_classes + +def test_main_tables(): + """Check that tables.py and main-tables.rst are in sync: every table should + be documented, and every documented table should exist.""" + + main_tables_path = os.path.join(os.path.dirn...
6454bcae6c519c47fc4bd05610e8f16dfe355d66
TopologyEventTest/host_lib.py
TopologyEventTest/host_lib.py
from ryu.base import app_manager from ryu.controller import ofp_event from ryu.controller import event from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER from ryu.controller.handler import set_ev_cls from ryu.ofproto import ofproto_v1_3 from ryu.lib.packet import packet from ryu.lib.packet import eth...
Add host library to topology event test
Add host library to topology event test
Python
mit
TakeshiTseng/SDN-Work,TakeshiTseng/SDN-Work,TakeshiTseng/SDN-Work,TakeshiTseng/SDN-Work
--- +++ @@ -0,0 +1,51 @@ +from ryu.base import app_manager +from ryu.controller import ofp_event +from ryu.controller import event +from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER +from ryu.controller.handler import set_ev_cls +from ryu.ofproto import ofproto_v1_3 +from ryu.lib.packet import pac...
37e8ab6ca1ac8853df9b856c03263f4d0d7bf8ac
pdf_to_text.py
pdf_to_text.py
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter from cStringIO import StringIO from pdfminer.converter import TextConverter from pdfminer.layout import LAParams from pdfminer.pdfpage import PDFPage def pdf_to_text(s): infile = StringIO(s) output = StringIO() manager = PDFResourceManager() con...
Convert PDF to Text As a Function
Convert PDF to Text As a Function
Python
mit
young-geng/ResumeAnalytics
--- +++ @@ -0,0 +1,29 @@ +from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter +from cStringIO import StringIO +from pdfminer.converter import TextConverter +from pdfminer.layout import LAParams +from pdfminer.pdfpage import PDFPage + +def pdf_to_text(s): + infile = StringIO(s) + output = StringIO() ...
143af64f9435b3964ee618cccb89e7ad211e030a
db/__init__.py
db/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from .common import session_scope def commit_db_item(db_item): with session_scope() as session: session.merge(db_item) session.commit()
#!/usr/bin/env python # -*- coding: utf-8 -*- from .common import session_scope def commit_db_item(db_item): with session_scope() as session: session.merge(db_item) session.commit() def create_or_update_db_item(db_item, new_item): """ Updates an existing or creates a new database item. ...
Add utility function to create or update database items
Add utility function to create or update database items
Python
mit
leaffan/pynhldb
--- +++ @@ -8,3 +8,23 @@ with session_scope() as session: session.merge(db_item) session.commit() + + +def create_or_update_db_item(db_item, new_item): + """ + Updates an existing or creates a new database item. + """ + with session_scope() as session: + # if database item ex...
ea7aea1950e8794d9cc838b4c2311e806058e129
tests/test1.py
tests/test1.py
# -*- coding: utf-8 -*- """ Created on Wed Oct 02 12:23:00 2013 @author: jeff """ import OpenPNM #This fails
Test script that demonstrate the failure to import OpenPNM in the test folder.
Test script that demonstrate the failure to import OpenPNM in the test folder. Former-commit-id: 38d931cb07cfb102415dc2ac2a68142e3ca3f22d Former-commit-id: 83bb6579e4bd1d15fe39ef9dcb894519feaff707
Python
mit
amdouglas/OpenPNM,TomTranter/OpenPNM,stadelmanma/OpenPNM,PMEAL/OpenPNM,amdouglas/OpenPNM
--- +++ @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Oct 02 12:23:00 2013 + +@author: jeff +""" + +import OpenPNM #This fails +
002bd742a2dfb01e3c69ce97987af21cb5104292
readthedocs/projects/migrations/0038_update-doctype-helptext.py
readthedocs/projects/migrations/0038_update-doctype-helptext.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.18 on 2019-02-02 19:45 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('projects', '0037_add_htmlfile'), ] operations = [ migrations.AlterField( ...
Create migration for the change to the more info link
Create migration for the change to the more info link
Python
mit
rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-02-02 19:45 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0037_add_htmlfile'), + ] + + operat...
a86264c3d238d04cd38be2d995a7421dbaa49cd1
examples/resources_with_negotiation.py
examples/resources_with_negotiation.py
"""Example using `routing.ResourceRouter` and `negotiation` (content negotation). Start the app with :: $ pip install gunicorn http $ gunicorn -k aiohttp.worker.GunicornWebWorker examples.resources_with_negotiation:app --reload Try it out: :: $ pip install httpie $ http :8000/ message==Hello $ ht...
Add example with ResourceRouter and content negotiation
Add example with ResourceRouter and content negotiation
Python
mit
sloria/aiohttp_utils
--- +++ @@ -0,0 +1,41 @@ +"""Example using `routing.ResourceRouter` and `negotiation` (content negotation). + +Start the app with +:: + $ pip install gunicorn http + $ gunicorn -k aiohttp.worker.GunicornWebWorker examples.resources_with_negotiation:app --reload + +Try it out: +:: + + $ pip install httpie + ...
28c0046329681ceb0f0d7163738a60314837339e
website/tests/views/test_gene.py
website/tests/views/test_gene.py
from view_testing import ViewTest from models import Protein from models import Gene from database import db test_gene_data = { 'name': 'BRCA1', 'isoforms': [ Protein( refseq='NM_000123', sequence='TRAN', ), ] } class TestPGeneView(ViewTest): def test_show(s...
Add basic test for GeneView:show
Add basic test for GeneView:show
Python
lgpl-2.1
reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-M...
--- +++ @@ -0,0 +1,30 @@ +from view_testing import ViewTest +from models import Protein +from models import Gene +from database import db + + +test_gene_data = { + 'name': 'BRCA1', + 'isoforms': [ + Protein( + refseq='NM_000123', + sequence='TRAN', + ), + + ] +} + + +class...
e445e62dac1e08ab36fee5d37a51c32228707ce8
scrolls/configure.py
scrolls/configure.py
from copy import copy def run(): ## UDP /etc/rsyslog.conf uncomment('/etc/rsyslog.conf', ['$ModLoad imudp', '$UDPServerRun 514']) ## nginx ## sudo service rsyslog restart def uncomment(fpath, statements): found = {s:False for s in statements} with open(fpath, 'r') as fh: oldlines = ...
Configure will uncomment UDP config
Configure will uncomment UDP config
Python
mit
ilogue/scrolls
--- +++ @@ -0,0 +1,37 @@ +from copy import copy + + +def run(): + ## UDP /etc/rsyslog.conf + uncomment('/etc/rsyslog.conf', ['$ModLoad imudp', '$UDPServerRun 514']) + ## nginx + + + ## sudo service rsyslog restart + +def uncomment(fpath, statements): + found = {s:False for s in statements} + with op...
1cbd0c19501fc4605a65e89cb8fb72271751777d
txircd/modules/server/push.py
txircd/modules/server/push.py
from twisted.plugin import IPlugin from txircd.module_interface import Command, ICommand, IModuleData, ModuleData from zope.interface import implements class ServerPush(ModuleData, Command): implements(IPlugin, IModuleData, ICommand) name = "ServerPush" core = True def hookIRCd(self, ircd): ...
Implement the server PUSH command
Implement the server PUSH command
Python
bsd-3-clause
ElementalAlchemist/txircd,Heufneutje/txircd
--- +++ @@ -0,0 +1,37 @@ +from twisted.plugin import IPlugin +from txircd.module_interface import Command, ICommand, IModuleData, ModuleData +from zope.interface import implements + +class ServerPush(ModuleData, Command): + implements(IPlugin, IModuleData, ICommand) + + name = "ServerPush" + core = True ...
acda62ab8af2499c04ff15012039cb5fb5fa8968
process-lines.py
process-lines.py
#!/usr/bin/env python # coding: utf-8 import re import envoy def parse_state(line): match = re.search('\[(?P<state>[^\]]+?)\] at time', line) if match: return match.group('state') def parse_time(line): time = line.rsplit(' ', 1)[-1] time = map(float, time.split(':')) return time[0] * 60 ...
Add an utiity to measure salt performance.
Add an utiity to measure salt performance.
Python
bsd-2-clause
AllMyChanges/allmychanges.com,AllMyChanges/allmychanges.com,AllMyChanges/allmychanges.com,AllMyChanges/allmychanges.com
--- +++ @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# coding: utf-8 + +import re +import envoy + + +def parse_state(line): + match = re.search('\[(?P<state>[^\]]+?)\] at time', line) + if match: + return match.group('state') + +def parse_time(line): + time = line.rsplit(' ', 1)[-1] + time = map(float,...
1107b5435d7564cf3dcadfa6515d397eab203c6f
bs.py
bs.py
import urllib import re import math from bs4 import BeautifulSoup ## This is my small project on Sentimental Analysis ## Please NOTE: You cannot use this code without prior permission poststext=[] htmlfile = urllib.urlopen("http://manraj.collegespace.in/sentimentanalysisPY/") htmltext = htmlfile.read() htmlfile.clo...
Add list of words and combine it with twitter.
Add list of words and combine it with twitter.
Python
mit
ManrajGrover/Sentimental-Analysis
--- +++ @@ -0,0 +1,27 @@ +import urllib +import re +import math +from bs4 import BeautifulSoup + +## This is my small project on Sentimental Analysis +## Please NOTE: You cannot use this code without prior permission + +poststext=[] +htmlfile = urllib.urlopen("http://manraj.collegespace.in/sentimentanalysisPY/") +h...
d1e241e0b9ce264227e151df7a302471e0df7e6d
python/vpc_flow_logs_enabled.py
python/vpc_flow_logs_enabled.py
# # This file made available under CC0 1.0 Universal (https://creativecommons.org/publicdomain/zero/1.0/legalcode) # import boto3 import json def evaluate_compliance(config_item, is_flow_logs_enabled): if (config_item['resourceType'] != 'AWS::EC2::VPC'): return 'NOT_APPLICABLE' elif is_flow_logs_enab...
Add rule that vpc flow logs enabled
Add rule that vpc flow logs enabled
Python
cc0-1.0
awslabs/aws-config-rules,awslabs/aws-config-rules,awslabs/aws-config-rules,ravvav/aws-config-rules,aaronkhoo/aws-config-rules,ravvav/aws-config-rules,anthroprose/aws-config-rules,ravvav/aws-config-rules,anthroprose/aws-config-rules,aaronkhoo/aws-config-rules,aaronkhoo/aws-config-rules
--- +++ @@ -0,0 +1,50 @@ +# +# This file made available under CC0 1.0 Universal (https://creativecommons.org/publicdomain/zero/1.0/legalcode) +# + +import boto3 +import json + +def evaluate_compliance(config_item, is_flow_logs_enabled): + if (config_item['resourceType'] != 'AWS::EC2::VPC'): + return 'NOT_AP...
b48cbb3a41372e785bb840a14880ebade4be4e67
py/maximum-product-of-three-numbers.py
py/maximum-product-of-three-numbers.py
from operator import mul import heapq class Solution(object): def maximumProduct(self, nums): """ :type nums: List[int] :rtype: int """ largest3 = heapq.nlargest(3, nums) smallest3 = heapq.nsmallest(3, nums) if largest3[0] <= 0: if largest3[0] == 0...
Add py solution for 628. Maximum Product of Three Numbers
Add py solution for 628. Maximum Product of Three Numbers 628. Maximum Product of Three Numbers: https://leetcode.com/problems/maximum-product-of-three-numbers/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,31 @@ +from operator import mul +import heapq +class Solution(object): + def maximumProduct(self, nums): + """ + :type nums: List[int] + :rtype: int + """ + largest3 = heapq.nlargest(3, nums) + smallest3 = heapq.nsmallest(3, nums) + if largest3[0]...
a5173a0a153f40b62a7f3c086de1d97b97279bd4
test/helper.py
test/helper.py
import os, os.path import nose.tools as nose import biobox_cli.container as ctn def project_root(): return os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) def is_ci_server(): return "CI" in os.environ.keys() def remove_container(container): if not is_ci_server(): ctn.remo...
import os, os.path import nose.tools as nose import biobox_cli.container as ctn def project_root(): return os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) def is_ci_server(): return "CIRCLECI" in os.environ.keys() def remove_container(container): if not is_ci_server(): ct...
Fix environment variable checks for removing container
Fix environment variable checks for removing container
Python
mit
michaelbarton/command-line-interface,michaelbarton/command-line-interface,bioboxes/command-line-interface,bioboxes/command-line-interface
--- +++ @@ -6,7 +6,7 @@ return os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) def is_ci_server(): - return "CI" in os.environ.keys() + return "CIRCLECI" in os.environ.keys() def remove_container(container): if not is_ci_server():
2654bb9ee85a9c4ba4798c1a1ce40df20417380a
src/owncloud_rename.py
src/owncloud_rename.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Parse tree and find files matching owncloud forbidden characters. Rename in place or move into a specific folder """ import KmdCmd import KmdFiles import os, re import logging class KmdOwncloudRename(KmdCmd.KmdCommand): regexp = r'[\*:"?><|]+' def extendParser...
Rename files according to owncloud forbidden characters
Rename files according to owncloud forbidden characters
Python
mit
pzia/keepmydatas
--- +++ @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""Parse tree and find files matching owncloud forbidden characters. +Rename in place or move into a specific folder +""" + +import KmdCmd +import KmdFiles +import os, re +import logging + +class KmdOwncloudRename(KmdCmd.KmdCommand): + regex...
cfc1d8c604ab4d472d7b8a73374dcead40c88073
indico/modules/core/captcha_test.py
indico/modules/core/captcha_test.py
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. import pytest from flask import session from .captcha import _verify_captcha, generate_captcha_challenge ...
Add test for captcha generation/validation
Add test for captcha generation/validation
Python
mit
indico/indico,indico/indico,indico/indico,indico/indico
--- +++ @@ -0,0 +1,39 @@ +# This file is part of Indico. +# Copyright (C) 2002 - 2022 CERN +# +# Indico is free software; you can redistribute it and/or +# modify it under the terms of the MIT License; see the +# LICENSE file for more details. + +import pytest +from flask import session + +from .captcha import _verif...
b5f61c33c4e6cb73df5a00532191fbc38fbf3010
utils/verify_alerts.py
utils/verify_alerts.py
#!/usr/bin/env python import os import sys from os.path import dirname, join, realpath from optparse import OptionParser # Get the current working directory of this file. # http://stackoverflow.com/a/4060259/120999 __location__ = realpath(join(os.getcwd(), dirname(__file__))) # Add the shared settings file to namesp...
Add script to test/verify alert configuration
Add script to test/verify alert configuration We're looking to build out another alerter or two, and wanted a way to test our current alert configurations as well as be able to trigger alerts as we developer new alerters.
Python
mit
triplekill/skyline,CDKGlobal/skyline,PaytmLabs/skyline,loggly/skyline,hcxiong/skyline,sdgdsffdsfff/skyline,CDKGlobal/skyline,hcxiong/skyline,sdgdsffdsfff/skyline,100star/skyline,etsy/skyline,triplekill/skyline,etsy/skyline,sdgdsffdsfff/skyline,PaytmLabs/skyline,MyNameIsMeerkat/skyline,100star/skyline,etsy/skyline,Paytm...
--- +++ @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +import os +import sys +from os.path import dirname, join, realpath +from optparse import OptionParser + +# Get the current working directory of this file. +# http://stackoverflow.com/a/4060259/120999 +__location__ = realpath(join(os.getcwd(), dirname(__file__))) + +#...
f6b28b3f256388057ef54f72bbc39d89d61ad5a0
ironic/tests/unit/api/v1/test_expose.py
ironic/tests/unit/api/v1/test_expose.py
# All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
Add test to ensure policy is always authorized
Add test to ensure policy is always authorized This adds new unit tests to ensure that all API methods decorated with @expose.expose are also calling policy.authorize() and context.to_policy_values() within the method body. This is done by patching sys.modules to replace the @expose decorator with a wrapper that reco...
Python
apache-2.0
openstack/ironic,pshchelo/ironic,NaohiroTamura/ironic,SauloAislan/ironic,NaohiroTamura/ironic,pshchelo/ironic,openstack/ironic,SauloAislan/ironic
--- +++ @@ -0,0 +1,78 @@ +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless requir...
127087eef72df5f052638bf8a770728800c15fb1
lib/bridgedb/test/test_Tests.py
lib/bridgedb/test/test_Tests.py
# -*- coding: utf-8 -*- # # This file is part of BridgeDB, a Tor bridge distribution system. # # :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org> # please also see AUTHORS file # :copyright: (c) 2013, Isis Lovecruft # (c) 2007-2013, The Tor Project, Inc. # (c) 2007-201...
Add trial runner/report class adapter for old unittests.
Add trial runner/report class adapter for old unittests. This adds a new unittest file, `lib/bridgedb/test/test_Tests.py`, which runs the old unittests in `lib/bridgedb/Tests.py` with a unittest report adapter that is compatible with twisted.trial. It uses the underlying SynchronousTestCase wrapper for the stdlib `uni...
Python
bsd-3-clause
wfn/bridgedb,mmaker/bridgedb,pagea/bridgedb,pagea/bridgedb,wfn/bridgedb,mmaker/bridgedb
--- +++ @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# +# This file is part of BridgeDB, a Tor bridge distribution system. +# +# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org> +# please also see AUTHORS file +# :copyright: (c) 2013, Isis Lovecruft +# (c) 2007-2013, The Tor Proje...
546df2580036206eaa9a9bbc3d45c8004ad0825e
run.py
run.py
#!/usr/bin/env python import sys import os from app.main import app if __name__ == '__main__': if len(sys.argv) > 1 and sys.argv[1] == 'debug': app.debug = True port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port, threaded=True)
Add separate script for starting app
Add separate script for starting app
Python
mit
mpolden/jarvis2,mpolden/jarvis2,Foxboron/Frank,martinp/jarvis2,martinp/jarvis2,mpolden/jarvis2,Foxboron/Frank,Foxboron/Frank,martinp/jarvis2
--- +++ @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +import sys +import os +from app.main import app + +if __name__ == '__main__': + if len(sys.argv) > 1 and sys.argv[1] == 'debug': + app.debug = True + port = int(os.environ.get('PORT', 5000)) + app.run(host='0.0.0.0', port=port, threaded=True)
63a70d847073accf679c215e3bf3296c1b107dca
cmsplugin_filer_utils/__init__.py
cmsplugin_filer_utils/__init__.py
# -*- coding: utf-8 -*- from django.db import models class FilerPluginManager(models.Manager): def __init__(self, select_related=None): self._select_related = select_related super(FilerPluginManager, self).__init__() def get_query_set(self): qs = super(FilerPluginManager, self).get_qu...
# -*- coding: utf-8 -*- from django.db import models class FilerPluginManager(models.Manager): def __init__(self, select_related=None): self._select_related = select_related super(FilerPluginManager, self).__init__() def get_query_set(self): qs = super(FilerPluginManager, self).get_qu...
Use prefetch related to trigger polymorphic downcast.
Use prefetch related to trigger polymorphic downcast.
Python
bsd-3-clause
divio/cmsplugin-filer,creimers/cmsplugin-filer,NB-Dev/cmsplugin-filer,brightinteractive/cmsplugin-filer,yvess/cmsplugin-filer,nephila/cmsplugin-filer,stefanfoulis/cmsplugin-filer,centralniak/cmsplugin-filer,skirsdeda/cmsplugin-filer,brightinteractive/cmsplugin-filer,jrutila/cmsplugin-filer,alsoicode/cmsplugin-filer,jru...
--- +++ @@ -10,5 +10,5 @@ def get_query_set(self): qs = super(FilerPluginManager, self).get_query_set() if self._select_related: - qs = qs.select_related(*self._select_related) + qs = qs.prefetch_related(*self._select_related) return qs
628907dc438f80f9f587c612fa756f2ffbb0eaaf
src/account.py
src/account.py
#!/usr/bin/env python3 import sqlite3 # Connexion database database = "../data/storage.sq3" connexion = sqlite3.connect(database) cursor = connexion.cursor() for row in cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='users' AND name='password';"): print(row) if ("users" not in row...
Connect to database and create if tables not exists
Connect to database and create if tables not exists
Python
mit
cboin/becon
--- +++ @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +import sqlite3 + +# Connexion database +database = "../data/storage.sq3" +connexion = sqlite3.connect(database) + +cursor = connexion.cursor() +for row in cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='users' AND name='password';"): + ...
adf12bd0561fb92705346f09ec6740c664fd656f
misc/automata/main.py
misc/automata/main.py
data = "00000000000000000000100000000000000000000" str2idx = { "111": 0, "110": 1, "101": 2, "100": 3, "011": 4, "010": 5, "001": 6, "000": 7 } def step(data, rule): newdata = "" newdata += rule[str2idx["0" + data[:2]]] for i in range(1,len(d...
Add simple wolfram-style cellular automata
Add simple wolfram-style cellular automata
Python
mit
WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox
--- +++ @@ -0,0 +1,25 @@ +data = "00000000000000000000100000000000000000000" + +str2idx = { + "111": 0, + "110": 1, + "101": 2, + "100": 3, + "011": 4, + "010": 5, + "001": 6, + "000": 7 +} + +def step(data, rule): + newdata = "" + newdata += rule[str2idx[...
8c6e294de4c70d97bed685f433a6541dd80cfb0b
src/ggrc/migrations/versions/20150428152310_3be12e136921_remove_programdirective_table.py
src/ggrc/migrations/versions/20150428152310_3be12e136921_remove_programdirective_table.py
"""Remove ProgramDirective table Revision ID: 3be12e136921 Revises: 57cc398ad417 Create Date: 2015-04-28 15:23:10.503624 """ # revision identifiers, used by Alembic. revision = '3be12e136921' down_revision = '57cc398ad417' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql def up...
Add drop ProgramDirective table migration
Add drop ProgramDirective table migration
Python
apache-2.0
prasannav7/ggrc-core,plamut/ggrc-core,uskudnik/ggrc-core,NejcZupec/ggrc-core,hyperNURb/ggrc-core,VinnieJohns/ggrc-core,kr41/ggrc-core,vladan-m/ggrc-core,NejcZupec/ggrc-core,jmakov/ggrc-core,prasannav7/ggrc-core,hasanalom/ggrc-core,hyperNURb/ggrc-core,plamut/ggrc-core,josthkko/ggrc-core,jmakov/ggrc-core,j0gurt/ggrc-core...
--- +++ @@ -0,0 +1,47 @@ + +"""Remove ProgramDirective table + +Revision ID: 3be12e136921 +Revises: 57cc398ad417 +Create Date: 2015-04-28 15:23:10.503624 + +""" + +# revision identifiers, used by Alembic. +revision = '3be12e136921' +down_revision = '57cc398ad417' + +from alembic import op +import sqlalchemy as sa +fr...
192bf9ea05fb5ebcf46a6f1707ca339eed96bcf0
cli/commands/cmd_secret.py
cli/commands/cmd_secret.py
import binascii import logging import os import click @click.command() @click.argument('bytes', default=128) def cli(bytes): """ Generate a random secret token. :return: str """ return logging.info(binascii.b2a_hex(os.urandom(bytes)))
Add CLI command to generate a secret token
Add CLI command to generate a secret token
Python
mit
nickjj/build-a-saas-app-with-flask,nickjj/build-a-saas-app-with-flask,z123/build-a-saas-app-with-flask,nickjj/build-a-saas-app-with-flask,nickjj/build-a-saas-app-with-flask,z123/build-a-saas-app-with-flask,z123/build-a-saas-app-with-flask
--- +++ @@ -0,0 +1,16 @@ +import binascii +import logging +import os + +import click + + +@click.command() +@click.argument('bytes', default=128) +def cli(bytes): + """ + Generate a random secret token. + + :return: str + """ + return logging.info(binascii.b2a_hex(os.urandom(bytes)))
976f1881ad97df2f393bb1a090419531ce11eca7
test/trainer_test.py
test/trainer_test.py
import theanets import util class TestTrainer(util.MNIST): def setUp(self): super(TestTrainer, self).setUp() self.exp = theanets.Experiment( theanets.Autoencoder, layers=(self.DIGIT_SIZE, 10, self.DIGIT_SIZE)) def assert_progress(self, algo, **kwargs): trainer...
import theanets import util class TestTrainer(util.MNIST): def setUp(self): super(TestTrainer, self).setUp() self.exp = theanets.Experiment( theanets.Autoencoder, layers=(self.DIGIT_SIZE, 10, self.DIGIT_SIZE)) def assert_progress(self, algo, **kwargs): trainer...
Make HF test take much less time!
Make HF test take much less time!
Python
mit
devdoer/theanets,chrinide/theanets,lmjohns3/theanets
--- +++ @@ -33,7 +33,7 @@ self.assert_progress('adadelta', learning_rate=1e-4) def test_hf(self): - self.assert_progress('hf') + self.assert_progress('hf', num_updates=3) def test_cg(self): self.assert_progress('cg')
59915f5fd782cef4f5805a2f7ca616b8d615b7e1
osf/migrations/0009_auto_20170406_1614.py
osf/migrations/0009_auto_20170406_1614.py
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2017-04-06 21:14 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('osf', '0008_merge'), ] operations = [ migrati...
Add pointless migration to ensure python functionality
Add pointless migration to ensure python functionality
Python
apache-2.0
caneruguz/osf.io,binoculars/osf.io,laurenrevere/osf.io,hmoco/osf.io,leb2dg/osf.io,mattclark/osf.io,felliott/osf.io,chrisseto/osf.io,felliott/osf.io,caseyrollins/osf.io,baylee-d/osf.io,brianjgeiger/osf.io,chennan47/osf.io,cwisecarver/osf.io,caneruguz/osf.io,caseyrollins/osf.io,aaxelb/osf.io,cwisecarver/osf.io,caseyrolli...
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2017-04-06 21:14 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('osf', '0008_merge'), + ...
a53fba0f648b3472834443fa3dc31c0611bcb6a3
test/test_mcmc_serial.py
test/test_mcmc_serial.py
import time import numpy as np import yaml import quantitation # Set parameters path_cfg = 'examples/basic.yml' # Load config cfg = yaml.load(open(path_cfg, 'rb')) # Load data mapping_peptides = np.loadtxt(cfg['data']['path_mapping_peptides'], dtype=np.int) mapping_states_obs, intensi...
Add basic test script for mcmc_serial. Code now passes with conditions on prior.
Add basic test script for mcmc_serial. Code now passes with conditions on prior. Code runs with all prior inputs on ups2 and simulated data. However, variance hyperparameters exhibit issues when used with improper priors on the rate parameter. The shape and rate parameters diverge towards infinity as their ratio (the ...
Python
bsd-3-clause
awblocker/quantitation,awblocker/quantitation,awblocker/quantitation
--- +++ @@ -0,0 +1,40 @@ +import time + +import numpy as np +import yaml + +import quantitation + +# Set parameters +path_cfg = 'examples/basic.yml' + +# Load config +cfg = yaml.load(open(path_cfg, 'rb')) + +# Load data +mapping_peptides = np.loadtxt(cfg['data']['path_mapping_peptides'], + ...
342d96b2bc0665ec43ef51415bbc8a7c4f6f9b63
test/test_old_version.py
test/test_old_version.py
#!bin/env python import subprocess import os.path import unittest, re class TestOldVersion(unittest.TestCase): @classmethod def setUpClass(self): subprocess.call('rm -rf remote local 2>> /dev/null', shell=True) subprocess.call('mkdir remote; mkdir local', shell=True) subprocess.cal...
Test to ensure git-project exits early if out of date
Test to ensure git-project exits early if out of date See: (CLD-2913)
Python
mit
3ptscience/git-project,aranzgeo/git-project
--- +++ @@ -0,0 +1,49 @@ +#!bin/env python + +import subprocess +import os.path +import unittest, re + + +class TestOldVersion(unittest.TestCase): + + @classmethod + def setUpClass(self): + + subprocess.call('rm -rf remote local 2>> /dev/null', shell=True) + + subprocess.call('mkdir remote; mkdir ...
1c3871b5f9effcbd859d530b3105c67eaf385ed2
tests/test_delete.py
tests/test_delete.py
import os, os.path from quilt.patch import Patch from six.moves import cStringIO import sys from helpers import QuiltTest, make_file, tmp_mapping, tmp_series from quilt.delete import Delete from quilt.cli.delete import DeleteCommand class Test(QuiltTest): def test_next_first(self): """ Delete the next p...
Test deletion with only unapplied patches, and without the --backup option
Test deletion with only unapplied patches, and without the --backup option
Python
mit
bjoernricks/python-quilt
--- +++ @@ -0,0 +1,63 @@ +import os, os.path +from quilt.patch import Patch +from six.moves import cStringIO +import sys + +from helpers import QuiltTest, make_file, tmp_mapping, tmp_series + +from quilt.delete import Delete +from quilt.cli.delete import DeleteCommand + +class Test(QuiltTest): + + def test_next_fi...
42f32ddcd33d1c8325400405b27e20a3cd54ce36
merge_in_place.py
merge_in_place.py
a = [1, 3, 8, 12, 15] b = [4, 12, 17, 0, 0, 0, 0, 0] i = len(a) - 1 j = len(b) - len(a) - 1 k = len(b) - 1 while i >= 0: if j >= 0: if a[i] > b[j]: while i >= 0 and a[i] >= b[j]: b[k] = a[i] i -= 1 k -= 1 else: while j >= 0 an...
Add algorithm for merging arrays in place
Add algorithm for merging arrays in place
Python
mit
dnl-blkv/algorithms
--- +++ @@ -0,0 +1,26 @@ +a = [1, 3, 8, 12, 15] +b = [4, 12, 17, 0, 0, 0, 0, 0] + +i = len(a) - 1 +j = len(b) - len(a) - 1 +k = len(b) - 1 + +while i >= 0: + if j >= 0: + if a[i] > b[j]: + while i >= 0 and a[i] >= b[j]: + b[k] = a[i] + i -= 1 + k -= 1 ...
b5b65ce4c7a592372690b6d1fecc68a6d3f33bfb
doc/example1.py
doc/example1.py
""" Draw the example used in the README file. """ # Standard library modules. # Third party modules. import numpy as np import matplotlib.pyplot as plt import matplotlib.cbook as cbook # Local modules. from matplotlib_colorbar.colorbar import ColorBar # Globals and constants variables. plt.figure() data = np.arra...
Add script to generate README figure.
Add script to generate README figure.
Python
bsd-2-clause
ppinard/matplotlib-colorbar
--- +++ @@ -0,0 +1,24 @@ +""" +Draw the example used in the README file. +""" + +# Standard library modules. + +# Third party modules. +import numpy as np +import matplotlib.pyplot as plt +import matplotlib.cbook as cbook + +# Local modules. +from matplotlib_colorbar.colorbar import ColorBar + +# Globals and constant...
ffb8292bc4d91771458126677016d8f883c29bbf
tests/test_config.py
tests/test_config.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import import os from os import path import unittest import click from click.testing import CliRunner import mock import yaml from tldr.config import get_config from tldr import cli class TestConfig(unittest.TestCase): def setUp(sel...
Add test for the config file
Add test for the config file
Python
mit
lord63/tldr.py
--- +++ @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from __future__ import absolute_import + +import os +from os import path +import unittest + +import click +from click.testing import CliRunner +import mock +import yaml + +from tldr.config import get_config +from tldr import cli + + +class Te...
4bb1c93f1e88b6472c1e3ec058a52156160a0aaf
dipy/reconst/tests/test_dsi.py
dipy/reconst/tests/test_dsi.py
import numpy as np from nose.tools import assert_true, assert_false, assert_equal, assert_raises from numpy.testing import assert_array_equal, assert_array_almost_equal import nibabel as nib from dipy.data import get_data, get_sphere from dipy.reconst.recspeed import peak_finding from dipy.reconst.gqi import Generaliz...
TEST added test for dsi
TEST added test for dsi
Python
bsd-3-clause
rfdougherty/dipy,oesteban/dipy,nilgoyyou/dipy,samuelstjean/dipy,matthieudumont/dipy,sinkpoint/dipy,beni55/dipy,mdesco/dipy,oesteban/dipy,samuelstjean/dipy,rfdougherty/dipy,JohnGriffiths/dipy,jyeatman/dipy,maurozucchelli/dipy,StongeEtienne/dipy,Messaoud-Boudjada/dipy,villalonreina/dipy,samuelstjean/dipy,demianw/dipy,nil...
--- +++ @@ -0,0 +1,40 @@ +import numpy as np +from nose.tools import assert_true, assert_false, assert_equal, assert_raises +from numpy.testing import assert_array_equal, assert_array_almost_equal + +import nibabel as nib +from dipy.data import get_data, get_sphere +from dipy.reconst.recspeed import peak_finding +fro...
dc6b2014b7b8cefeb1314a09184cfc2755501735
CodeFights/deleteDigit.py
CodeFights/deleteDigit.py
#!/usr/local/bin/python # Code Fights Delete Digit Problem def deleteDigit(n): s = str(n) return max(int(''.join(s[:i] + s[i + 1:])) for i in range(len(s))) # idxs = [i for i in range(len(s) - 1) if int(s[i]) < int(s[i + 1])] # if idxs: # return int(s[:idxs[0]] + s[idxs[0] + 1:]) # else: ...
Solve Code Fights delete digit problem
Solve Code Fights delete digit problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,35 @@ +#!/usr/local/bin/python +# Code Fights Delete Digit Problem + + +def deleteDigit(n): + s = str(n) + return max(int(''.join(s[:i] + s[i + 1:])) for i in range(len(s))) + # idxs = [i for i in range(len(s) - 1) if int(s[i]) < int(s[i + 1])] + # if idxs: + # return int(s[:idxs...
cb7515358fcc9ee2daf030c5eb0ffa68db0d95d3
test/test_nap_inherit.py
test/test_nap_inherit.py
""" Tests for nap module. These tests only focus that requests is called properly. Everything related to HTTP requests should be tested in requests' own tests. """ from mock import MagicMock, patch import unittest import requests from nap.api import Api class NewApi(Api): def before_request(self, method, requ...
Add tests for inheriting Nap class
Add tests for inheriting Nap class
Python
mit
kimmobrunfeldt/nap
--- +++ @@ -0,0 +1,70 @@ +""" +Tests for nap module. + +These tests only focus that requests is called properly. +Everything related to HTTP requests should be tested in requests' own tests. +""" + +from mock import MagicMock, patch +import unittest +import requests + +from nap.api import Api + + +class NewApi(Api): ...
984dd9d20814e3190ee197b47c756f2b8f4ecb52
django_prometheus/testutils.py
django_prometheus/testutils.py
from prometheus_client import REGISTRY METRIC_EQUALS_ERR_EXPLANATION = """ %s%s = %s, expected %s. The values for %s are: %s""" class PrometheusTestCaseMixin(object): """A collection of utilities that make it easier to write test cases that interact with metrics. """ def setUp(self): self.cl...
Add a mixin to test exported metrics.
Add a mixin to test exported metrics. Most of this mixin should be moved to prometheus_client eventually, since it relies heavily on its internals.
Python
apache-2.0
wangwanzhong/django-prometheus,obytes/django-prometheus,obytes/django-prometheus,wangwanzhong/django-prometheus,korfuri/django-prometheus,DingaGa/django-prometheus,DingaGa/django-prometheus,korfuri/django-prometheus
--- +++ @@ -0,0 +1,88 @@ +from prometheus_client import REGISTRY + + +METRIC_EQUALS_ERR_EXPLANATION = """ +%s%s = %s, expected %s. +The values for %s are: +%s""" + + +class PrometheusTestCaseMixin(object): + """A collection of utilities that make it easier to write test cases + that interact with metrics. + ...
bc97749944eeb5b5b1366f4da6f2f5c04eaba434
deepLearningWithNeuralNetworks/regularDeepLearningWithNeuralNetworks.py
deepLearningWithNeuralNetworks/regularDeepLearningWithNeuralNetworks.py
# -*- coding: utf-8 -*- """Deep Learning with Neural Networks and TensorFlow. Deep learning is part of a broader family of machine learning methods based on learning data representations, as opposed to task-specific algorithms. Learning can be supervised, partially supervised or unsupervised. A deep neural network (D...
Add Deep Learning with Neural Networks and TensorFlow
Add Deep Learning with Neural Networks and TensorFlow
Python
mit
a-holm/MachinelearningAlgorithms,a-holm/MachinelearningAlgorithms
--- +++ @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +"""Deep Learning with Neural Networks and TensorFlow. + +Deep learning is part of a broader family of machine learning methods based on +learning data representations, as opposed to task-specific algorithms. Learning +can be supervised, partially supervised or unsupe...
d8bcdced24e9787711cbf5787011d88a086d4956
seleniumbase/console_scripts/logo_helper.py
seleniumbase/console_scripts/logo_helper.py
""" SeleniumBase Logo Processing (for the console scripts interface) Logo generated from: http://www.patorjk.com/software/taag/#p=display&f=Slant&t=SeleniumBase """ import colorama r''' ______ __ _ ____ / ____/__ / /__ ____ (_)_ ______ ___ / __ `____ ________ \__ \/...
Create a SeleniumBase logo for console interfaces
Create a SeleniumBase logo for console interfaces
Python
mit
mdmintz/seleniumspot,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/seleniumspot,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase
--- +++ @@ -0,0 +1,58 @@ +""" SeleniumBase Logo Processing (for the console scripts interface) + Logo generated from: + http://www.patorjk.com/software/taag/#p=display&f=Slant&t=SeleniumBase """ + +import colorama + +r''' + ______ __ _ ____ + / ____/__ / /__ ____ (_)_ _____...
dde3f2e15c0c8db29140cd2d26e2c75e89661a41
analysis/data_process/uk_2017/generate_notebook.py
analysis/data_process/uk_2017/generate_notebook.py
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__: 'Olivier PHILIPPE' __licence__: 'BSD3-clause' """ Scrip to programatically generate notebook for exploratory analysis Use the code from: https://gist.github.com/fperez/9716279 """ import nbformat as nbf class GenerateNotebook: """ """ def __init...
Move into uk_2017 folder and transforming the notebook into a class
Move into uk_2017 folder and transforming the notebook into a class
Python
bsd-3-clause
softwaresaved/international-survey
--- +++ @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +__author__: 'Olivier PHILIPPE' +__licence__: 'BSD3-clause' + +""" +Scrip to programatically generate notebook for exploratory analysis +Use the code from: https://gist.github.com/fperez/9716279 +""" + +import nbformat as nbf + + +class Genera...
7ace1149a2aa2c1725438cabf123cadfb326e82b
meinberlin/apps/contrib/management/commands/cleanup_unverified_users.py
meinberlin/apps/contrib/management/commands/cleanup_unverified_users.py
from datetime import timedelta from django.core.management.base import BaseCommand from django.utils import timezone from meinberlin.apps.users.models import User class Command(BaseCommand): help = 'Remove all users that registered more than n days ago but never ' \ 'logged in. This implies they never v...
Add command to clean up unverified users
contrib/management: Add command to clean up unverified users Strictly speaking we should check for the email verified status here, but if a user never logged in that pretty much implies the same. Prints a list of deleted users, which we'll recieve as mail from a cron job.
Python
agpl-3.0
liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin
--- +++ @@ -0,0 +1,39 @@ +from datetime import timedelta + +from django.core.management.base import BaseCommand +from django.utils import timezone + +from meinberlin.apps.users.models import User + + +class Command(BaseCommand): + help = 'Remove all users that registered more than n days ago but never ' \ + ...
9f7ed73485f94a1a23f7318a5daab82dbafab413
tests/graphics/ticket2925.py
tests/graphics/ticket2925.py
# Copyright (C) 2007, Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distrib...
Test for ticket 2925, it doesn't reproduce the issue for some reason.
Test for ticket 2925, it doesn't reproduce the issue for some reason.
Python
lgpl-2.1
sugarlabs/sugar-toolkit-gtk3,samdroid-apps/sugar-toolkit-gtk3,gusDuarte/sugar-toolkit-gtk3,tchx84/debian-pkg-sugar-toolkit-gtk3,i5o/sugar-toolkit-gtk3,tchx84/debian-pkg-sugar-toolkit,quozl/sugar-toolkit-gtk3,gusDuarte/sugar-toolkit-gtk3,ceibal-tatu/sugar-toolkit,ceibal-tatu/sugar-toolkit,puneetgkaur/sugar-toolkit-gtk3,...
--- +++ @@ -0,0 +1,40 @@ +# Copyright (C) 2007, Red Hat, Inc. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later ver...
ba1a32ca744d001697e52be7a0c36dd76c81446c
tools/droplets/add_mentor.py
tools/droplets/add_mentor.py
# Allows a mentor to ssh into a Digital Ocean droplet. This is designed to be # executed on the target machine. # # This script takes the username of the mentor as an argument: # # $ python3 add_mentor.py <mentor's username> # # Alternatively you can pass in --remove to remove their ssh key from the # machine: # # $ py...
Create script to add and remove mentor's ssh key from DO droplets.
Create script to add and remove mentor's ssh key from DO droplets.
Python
apache-2.0
andersk/zulip,zulip/zulip,rishig/zulip,eeshangarg/zulip,dhcrzf/zulip,timabbott/zulip,rishig/zulip,hackerkid/zulip,tommyip/zulip,jackrzhang/zulip,showell/zulip,andersk/zulip,brainwane/zulip,punchagan/zulip,jackrzhang/zulip,showell/zulip,brainwane/zulip,eeshangarg/zulip,timabbott/zulip,mahim97/zulip,rht/zulip,synicalsynt...
--- +++ @@ -0,0 +1,75 @@ +# Allows a mentor to ssh into a Digital Ocean droplet. This is designed to be +# executed on the target machine. +# +# This script takes the username of the mentor as an argument: +# +# $ python3 add_mentor.py <mentor's username> +# +# Alternatively you can pass in --remove to remove their s...
0f6056989079323277329825534f9290cad8c019
grow/deployments/scp.py
grow/deployments/scp.py
from grow.deployments import base import errno import os import paramiko class ScpDeployment(base.BaseDeployment): def get_destination_address(self): return '{}:{}'.format(self.host, self.root_dir) def set_params(self, host, root_dir, port=22): # TODO(jeremydw): Behavior of set_params and __init__ #...
Add missing SCP deployment file.
Add missing SCP deployment file.
Python
mit
codedcolors/pygrow,grow/grow,grow/pygrow,vitorio/pygrow,denmojo/pygrow,codedcolors/pygrow,codedcolors/pygrow,grow/pygrow,denmojo/pygrow,vitorio/pygrow,grow/grow,vitorio/pygrow,denmojo/pygrow,grow/grow,grow/grow,grow/pygrow,denmojo/pygrow
--- +++ @@ -0,0 +1,65 @@ +from grow.deployments import base +import errno +import os +import paramiko + + +class ScpDeployment(base.BaseDeployment): + + def get_destination_address(self): + return '{}:{}'.format(self.host, self.root_dir) + + def set_params(self, host, root_dir, port=22): + # TODO(jeremydw): B...
66543a7330a0898146076adb5269b75708f763a9
boardinghouse/tests/test_sql.py
boardinghouse/tests/test_sql.py
""" Tests for the RAW sql functions. """ from django.conf import settings from django.test import TestCase from django.db.models import connection from boardinghouse.models import Schema class TestRejectSchemaColumnChange(TestCase): def test_exception_is_raised(self): Schema.objects.mass_create('a') ...
Add test for exception raising.
Add test for exception raising.
Python
bsd-3-clause
schinckel/django-boardinghouse,schinckel/django-boardinghouse,schinckel/django-boardinghouse
--- +++ @@ -0,0 +1,16 @@ +""" +Tests for the RAW sql functions. +""" + +from django.conf import settings +from django.test import TestCase +from django.db.models import connection + +from boardinghouse.models import Schema + +class TestRejectSchemaColumnChange(TestCase): + def test_exception_is_raised(self): + ...
d691fa14cc7ecf1b2dc53473553407008591b503
git-lang-guesser/gitRequester.py
git-lang-guesser/gitRequester.py
import http.client import requests from . import exceptions USER_URL = 'https://api.github.com/users/{username}' USER_PUBLIC_REPO_URL = 'https://api.github.com/users/{username}/repos' def do_request(url_format, format_args): r = requests.get(url_format.format(**format_args)) if r.status_code == http.clien...
Add git api request helpers
Add git api request helpers Add helper functions for getting info on a user, and all public repos owned by a user
Python
mit
robbie-c/git-lang-guesser
--- +++ @@ -0,0 +1,31 @@ +import http.client + +import requests + +from . import exceptions + +USER_URL = 'https://api.github.com/users/{username}' +USER_PUBLIC_REPO_URL = 'https://api.github.com/users/{username}/repos' + + +def do_request(url_format, format_args): + r = requests.get(url_format.format(**format_arg...
cb99e3f0ae298fb7065b661190a88d144d663183
gffutils-utils/scripts/gtf_to_bed.py
gffutils-utils/scripts/gtf_to_bed.py
import tempfile from argparse import ArgumentParser import gffutils import os def disable_infer_extent(gtf_file): """ guess if we need to use the gene extent option when making a gffutils database by making a tiny database of 1000 lines from the original GTF and looking for all of the features """ ...
Add script to convert GTF to BED file.
Add script to convert GTF to BED file.
Python
mit
roryk/junkdrawer,roryk/junkdrawer
--- +++ @@ -0,0 +1,73 @@ +import tempfile +from argparse import ArgumentParser +import gffutils +import os + +def disable_infer_extent(gtf_file): + """ + guess if we need to use the gene extent option when making a gffutils + database by making a tiny database of 1000 lines from the original + GTF and loo...
c711928fd84f37d1e9f7035eaa3fc010d7a4355f
docker/switch-server.py
docker/switch-server.py
#!/usr/bin/env python3 import argparse import subprocess parser = argparse.ArgumentParser() parser.add_argument('server', choices=['blue', 'green',], help='Specify server to switch to') args = parser.parse_args() server = 'muzhack-{}'.format(args.server) subprocess.check_call(['tutum', 'service', 'set', '--link'...
Add script for switching production server
Add script for switching production server
Python
mit
muzhack/musitechhub,muzhack/muzhack,muzhack/muzhack,muzhack/muzhack,muzhack/muzhack,muzhack/musitechhub,muzhack/musitechhub,muzhack/musitechhub
--- +++ @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +import argparse +import subprocess + +parser = argparse.ArgumentParser() +parser.add_argument('server', choices=['blue', 'green',], + help='Specify server to switch to') +args = parser.parse_args() + +server = 'muzhack-{}'.format(args.server) + +subprocess.check_ca...
40a1730100091c6eee03ee5fe7687bd542e92077
cli_progress_bar.py
cli_progress_bar.py
# Print iterations progress def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█'): """ Call in a loop to create terminal progress bar @params: iteration - Required : current iteration (Int) total - Required : total iterations (Int...
Add cli progress bar example
Add cli progress bar example
Python
mit
voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts
--- +++ @@ -0,0 +1,30 @@ +# Print iterations progress +def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█'): + """ + Call in a loop to create terminal progress bar + @params: + iteration - Required : current iteration (Int) + total -...
b4f7bbe1d018316dce0c82b64c74efabbeea523e
backend/scripts/conversion/addprojs.py
backend/scripts/conversion/addprojs.py
#!/usr/bin/env python import rethinkdb as r from optparse import OptionParser def main(conn): groups = list(r.table('usergroups').run(conn)) for group in groups: owner = group['owner'] projects = list(r.table('projects').filter({'owner': owner}) .pluck('id', 'name').ru...
Add projects field to samples and usergroups.
Add projects field to samples and usergroups.
Python
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +import rethinkdb as r +from optparse import OptionParser + + +def main(conn): + groups = list(r.table('usergroups').run(conn)) + for group in groups: + owner = group['owner'] + projects = list(r.table('projects').filter({'owner': owner}) + ...
f595b62b53b25155e6e5aa65cd15e7393b979e82
tools/fix_from_default.py
tools/fix_from_default.py
import datetime from appcomposer import app from appcomposer.db import db from appcomposer.models import ActiveTranslationMessage, TranslationBundle, TranslationMessageHistory from appcomposer.translator.ops import get_golab_default_user with app.app_context(): total = 0 for bundle in db.session.query(Transla...
Fix the from_default field in the database
Fix the from_default field in the database
Python
bsd-2-clause
morelab/appcomposer,go-lab/appcomposer,porduna/appcomposer,morelab/appcomposer,porduna/appcomposer,go-lab/appcomposer,go-lab/appcomposer,morelab/appcomposer,morelab/appcomposer,porduna/appcomposer,porduna/appcomposer,go-lab/appcomposer
--- +++ @@ -0,0 +1,45 @@ +import datetime +from appcomposer import app +from appcomposer.db import db +from appcomposer.models import ActiveTranslationMessage, TranslationBundle, TranslationMessageHistory +from appcomposer.translator.ops import get_golab_default_user + + +with app.app_context(): + total = 0 + f...
ce736e08082b9c5048851a2db77aefbb389b39cb
openrcv/test/test_resource.py
openrcv/test/test_resource.py
from openrcv.resource import tracked from openrcv.utiltest.helpers import skipIfTravis, UnitCase class TrackedTest(UnitCase): """Tests for tracked().""" def test(self): seq = [1, "a"] with self.assertRaises(ValueError) as cm: with tracked(seq) as items: for item ...
Add a unit test for tracked().
Add a unit test for tracked().
Python
mit
cjerdonek/open-rcv,cjerdonek/open-rcv
--- +++ @@ -0,0 +1,18 @@ + +from openrcv.resource import tracked +from openrcv.utiltest.helpers import skipIfTravis, UnitCase + + +class TrackedTest(UnitCase): + + """Tests for tracked().""" + + def test(self): + seq = [1, "a"] + with self.assertRaises(ValueError) as cm: + with tracked(...
a0deef06e23e4c81e55d83afb63d4bbab1bdaaa5
migrations/versions/0217_default_email_branding.py
migrations/versions/0217_default_email_branding.py
""" Revision ID: 0217_default_email_branding Revises: 0216_remove_colours Create Date: 2018-08-24 13:36:49.346156 """ from alembic import op from app.models import BRANDING_ORG revision = '0217_default_email_branding' down_revision = '0216_remove_colours' def upgrade(): op.execute(""" update ...
Set branding_type to org if it’s none
Set branding_type to org if it’s none So later we can: - make it non-nullable later - remove `govuk` as an option This is mostly for people’s local databases, the manual work here has been done on production already.
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -0,0 +1,25 @@ +""" + Revision ID: 0217_default_email_branding +Revises: 0216_remove_colours +Create Date: 2018-08-24 13:36:49.346156 + """ +from alembic import op +from app.models import BRANDING_ORG + +revision = '0217_default_email_branding' +down_revision = '0216_remove_colours' + + +def upgrade(): + ...
9f2231ecd546f9d29d3ebbd354c3376cb7ebd417
migrations/versions/53eb8abce4de_industry_index.py
migrations/versions/53eb8abce4de_industry_index.py
"""industry_index Revision ID: 53eb8abce4de Revises: 1e3725cda0b7 Create Date: 2015-06-19 10:38:31.398000 """ # revision identifiers, used by Alembic. revision = '53eb8abce4de' down_revision = '1e3725cda0b7' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic -...
Add new table for industry index history
Add new table for industry index history
Python
bsd-3-clause
Kyria/LazyBlacksmith,Kyria/LazyBlacksmith,Kyria/LazyBlacksmith,Kyria/LazyBlacksmith
--- +++ @@ -0,0 +1,33 @@ +"""industry_index + +Revision ID: 53eb8abce4de +Revises: 1e3725cda0b7 +Create Date: 2015-06-19 10:38:31.398000 + +""" + +# revision identifiers, used by Alembic. +revision = '53eb8abce4de' +down_revision = '1e3725cda0b7' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): ...
71f3befd5bc3763c302a78d1147d4f203eac71c1
test/forward/TestForwardDeclaration.py
test/forward/TestForwardDeclaration.py
"""Test that forward declaration of a data structure gets resolved correctly.""" import os, time import unittest2 import lldb from lldbtest import * class ForwardDeclarationTestCase(TestBase): mydir = "forward" @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_with_dsy...
Add a test case for the test/forward directory with @expectedFailure decorator for test_with_dwarf_and_run_command(self).
Add a test case for the test/forward directory with @expectedFailure decorator for test_with_dwarf_and_run_command(self). git-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@116416 91177308-0d34-0410-b5e6-96231b3b80d8
Python
apache-2.0
apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb
--- +++ @@ -0,0 +1,64 @@ +"""Test that forward declaration of a data structure gets resolved correctly.""" + +import os, time +import unittest2 +import lldb +from lldbtest import * + +class ForwardDeclarationTestCase(TestBase): + + mydir = "forward" + + @unittest2.skipUnless(sys.platform.startswith("darwin"), "...
18be114d831d9c7204a3eaefae769b83ca674651
moksha/hook.py
moksha/hook.py
# This file is part of Moksha. # # Moksha is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Moksha is distributed in the hope that it...
Add an initial "Hook" object and MokshaHookMapperExtension.
Add an initial "Hook" object and MokshaHookMapperExtension. These area designed to make it simple to write plugins that monitor and analyze database activity.
Python
apache-2.0
pombredanne/moksha,ralphbean/moksha,mokshaproject/moksha,pombredanne/moksha,lmacken/moksha,ralphbean/moksha,pombredanne/moksha,ralphbean/moksha,pombredanne/moksha,lmacken/moksha,lmacken/moksha,mokshaproject/moksha,mokshaproject/moksha,mokshaproject/moksha
--- +++ @@ -0,0 +1,65 @@ +# This file is part of Moksha. +# +# Moksha is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Moksha...
abe8bbd2e602b2f747947a584d752dad5159edfb
src/setup.py2app.py
src/setup.py2app.py
""" This is a setup.py script generated by py2applet Usage: python setup.py py2app """ from setuptools import setup import opencmiss.zinc.context APP = ['opencmiss/neon/neon.py'] DATA_FILES = [] OPTIONS = {'argv_emulation': True, # 'frameworks': ['/Users/hsor001/work/opencmiss-software/zinc-software/zinc/lib...
Add basic setup.py file to create application bundles on OS X.
Add basic setup.py file to create application bundles on OS X.
Python
apache-2.0
alan-wu/neon
--- +++ @@ -0,0 +1,24 @@ +""" +This is a setup.py script generated by py2applet + +Usage: + python setup.py py2app +""" + +from setuptools import setup + +import opencmiss.zinc.context + +APP = ['opencmiss/neon/neon.py'] +DATA_FILES = [] +OPTIONS = {'argv_emulation': True, +# 'frameworks': ['/Users/hsor001/work...
9022e13eb14ce0f031b968d9eb1375ebcae7e770
disasm/tests.py
disasm/tests.py
#!/usr/bin/env python ''' Check that each file assembles and that the output binary is identical to the original file. ''' import filecmp import os import subprocess import shutil import sys import tempfile FILES = { 'prep-corvus-diag.asm': 'prep-corvus-diag.bin', 'prep-hardbox-configure.asm': 'prep-hard...
Add script to check assembly of each file
Add script to check assembly of each file
Python
bsd-3-clause
mnaberez/corvus
--- +++ @@ -0,0 +1,74 @@ +#!/usr/bin/env python +''' +Check that each file assembles and that the output binary +is identical to the original file. +''' +import filecmp +import os +import subprocess +import shutil +import sys +import tempfile + +FILES = { + 'prep-corvus-diag.asm': 'prep-corvus-diag.bin', + ...
a024a9a23cccbb8d72098dc1831770ece8b1aec8
ceph_deploy/tests/parser/test_uninstall.py
ceph_deploy/tests/parser/test_uninstall.py
import pytest from ceph_deploy.cli import get_parser class TestParserUninstall(object): def setup(self): self.parser = get_parser() def test_uninstall_help(self, capsys): with pytest.raises(SystemExit): self.parser.parse_args('uninstall --help'.split()) out, err = capsys...
Add tests for argparse uninstall
[RM-11742] Add tests for argparse uninstall Signed-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>
Python
mit
isyippee/ceph-deploy,ghxandsky/ceph-deploy,trhoden/ceph-deploy,imzhulei/ceph-deploy,shenhequnying/ceph-deploy,codenrhoden/ceph-deploy,osynge/ceph-deploy,Vicente-Cheng/ceph-deploy,zhouyuan/ceph-deploy,isyippee/ceph-deploy,ghxandsky/ceph-deploy,zhouyuan/ceph-deploy,trhoden/ceph-deploy,codenrhoden/ceph-deploy,SUSE/ceph-de...
--- +++ @@ -0,0 +1,32 @@ +import pytest + +from ceph_deploy.cli import get_parser + + +class TestParserUninstall(object): + + def setup(self): + self.parser = get_parser() + + def test_uninstall_help(self, capsys): + with pytest.raises(SystemExit): + self.parser.parse_args('uninstall --...
dff6d985b5b7152a3e5d378aa4919664cb2e1b51
examples/translations/french_test_1.py
examples/translations/french_test_1.py
# French Language Test - Python 3 Only! from seleniumbase.translate.french import CasDeBase class ClasseDeTest(CasDeBase): def test_exemple_1(self): self.ouvrir_url("https://fr.wikipedia.org/wiki/") self.vérifier_le_texte("Wikipédia") # noqa self.vérifier_un_élément('[title="Visiter la p...
Add the example test of SeleniumBase in French
Add the example test of SeleniumBase in French
Python
mit
seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase
--- +++ @@ -0,0 +1,22 @@ +# French Language Test - Python 3 Only! +from seleniumbase.translate.french import CasDeBase + + +class ClasseDeTest(CasDeBase): + + def test_exemple_1(self): + self.ouvrir_url("https://fr.wikipedia.org/wiki/") + self.vérifier_le_texte("Wikipédia") # noqa + self.véri...
ca92d32b73bc6e62fb842f2e7382fbcb076973e1
indra/tests/test_deft_tools.py
indra/tests/test_deft_tools.py
from nose.plugins.attrib import attr from indra.literature.deft_tools import universal_extract_text from indra.literature import pmc_client, elsevier_client, pubmed_client @attr('nonpublic', 'webservice') def test_universal_extract_text_elsevier(): doi = '10.1016/B978-0-12-416673-8.00004-6' xml_str = elsevie...
Write tests for text extraction for deft
Write tests for text extraction for deft
Python
bsd-2-clause
pvtodorov/indra,johnbachman/indra,sorgerlab/belpy,sorgerlab/belpy,sorgerlab/indra,pvtodorov/indra,johnbachman/belpy,johnbachman/indra,johnbachman/belpy,johnbachman/belpy,sorgerlab/indra,johnbachman/indra,bgyori/indra,sorgerlab/belpy,bgyori/indra,sorgerlab/indra,pvtodorov/indra,pvtodorov/indra,bgyori/indra
--- +++ @@ -0,0 +1,57 @@ +from nose.plugins.attrib import attr + +from indra.literature.deft_tools import universal_extract_text +from indra.literature import pmc_client, elsevier_client, pubmed_client + + +@attr('nonpublic', 'webservice') +def test_universal_extract_text_elsevier(): + doi = '10.1016/B978-0-12-416...
8a6121cbd594fcd5402d0170614f4e1340282145
eccodes/__main__.py
eccodes/__main__.py
# # Copyright 2017-2019 European Centre for Medium-Range Weather Forecasts (ECMWF). # # 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...
Enable python -m eccodes selfcheck.
Enable python -m eccodes selfcheck.
Python
apache-2.0
ecmwf/eccodes-python,ecmwf/eccodes-python
--- +++ @@ -0,0 +1,64 @@ +# +# Copyright 2017-2019 European Centre for Medium-Range Weather Forecasts (ECMWF). +# +# 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....
bd7e802e81d313805c47b3822b70e9180bf9af98
examples/widgets/compound_selection.py
examples/widgets/compound_selection.py
from kivy.uix.gridlayout import GridLayout from kivy.uix.button import Button from kivy.uix.behaviors import CompoundSelectionBehavior from kivy.app import runTouchApp from kivy.core.window import Window class SelectableGrid(CompoundSelectionBehavior, GridLayout): def __init__(self, **kwargs): super(Sele...
Add compound selection usage example to examples.
Add compound selection usage example to examples.
Python
mit
arcticshores/kivy,mSenyor/kivy,Cheaterman/kivy,inclement/kivy,xpndlabs/kivy,habibmasuro/kivy,KeyWeeUsr/kivy,bob-the-hamster/kivy,xpndlabs/kivy,angryrancor/kivy,Cheaterman/kivy,Farkal/kivy,viralpandey/kivy,rafalo1333/kivy,adamkh/kivy,VinGarcia/kivy,bliz937/kivy,Shyam10/kivy,yoelk/kivy,bionoid/kivy,Shyam10/kivy,iamutkars...
--- +++ @@ -0,0 +1,57 @@ +from kivy.uix.gridlayout import GridLayout +from kivy.uix.button import Button +from kivy.uix.behaviors import CompoundSelectionBehavior +from kivy.app import runTouchApp +from kivy.core.window import Window + + +class SelectableGrid(CompoundSelectionBehavior, GridLayout): + + def __init_...
8bdeefa23ce44a0c0aad3913ec59d4167d2b0eff
duralex/AddCommitMessageVisitor.py
duralex/AddCommitMessageVisitor.py
# -*- coding: utf-8 -*- from AbstractVisitor import AbstractVisitor from duralex.alinea_parser import * import duralex.node_type def int_to_roman(integer): string = '' table = [ ['M',1000], ['CM',900], ['D',500], ['CD',400], ['C',100], ['XC',90], ['L',50], ['XL',40], ['X',10], ['IX',9], ['V'...
Add a visitor to generate commit messages on each 'edit" node.
Add a visitor to generate commit messages on each 'edit" node.
Python
mit
Legilibre/duralex
--- +++ @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +from AbstractVisitor import AbstractVisitor + +from duralex.alinea_parser import * + +import duralex.node_type + +def int_to_roman(integer): + string = '' + table = [ + ['M',1000], ['CM',900], ['D',500], ['CD',400], ['C',100], ['XC',90], ['L',50], ['XL...
44662a9b82f22de611a99722eb7763f31d723be6
plugins/configuration/configurationtype/validated_dictionary.py
plugins/configuration/configurationtype/validated_dictionary.py
#!/usr/bin/env python #-*- coding: utf-8 -*- #This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software. #The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif...
Add documentation plan for ValidatedDictionary
Add documentation plan for ValidatedDictionary This is supposed to implement the latest idea for how we're going to do that flexible configuration properly...
Python
cc0-1.0
Ghostkeeper/Luna
--- +++ @@ -0,0 +1,30 @@ +#!/usr/bin/env python +#-*- coding: utf-8 -*- + +#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software. +#The license can also be read online: <https://creativecommons.org/publicdomain/zero/1...
ea06febec1d9bb3c288bade012f1d9c1144577fd
007.py
007.py
""" Project Euler Problem 7 ======================= By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? """ from itertools import count def is_prime(number): """ Takes a number and returns True if it's a prime number, otherwi...
Add solution and unit tests for problem 7
Add solution and unit tests for problem 7
Python
mit
BeataBak/project-euler-problems
--- +++ @@ -0,0 +1,47 @@ +""" +Project Euler Problem 7 +======================= + +By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see +that the 6th prime is 13. + +What is the 10001st prime number? +""" +from itertools import count + + +def is_prime(number): + """ + Takes a number and re...
027c91860a610b28d42d3045cb461f5fc78e7e2a
course_discovery/apps/course_metadata/migrations/0114_auto_20180905_1547.py
course_discovery/apps/course_metadata/migrations/0114_auto_20180905_1547.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2018-09-05 15:47 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('course_metadata', '0113_brief_text_curriculum'), ] operations = [ migrations.Remov...
Remove the no longer used header images from database
Remove the no longer used header images from database
Python
agpl-3.0
edx/course-discovery,edx/course-discovery,edx/course-discovery,edx/course-discovery
--- +++ @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.15 on 2018-09-05 15:47 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('course_metadata', '0113_brief_text_curriculum'), + ] + + ...
adc85e4680f7fd7bde12dcc374fa097afb876b22
redditscrape.py
redditscrape.py
#!/usr/bin/env python __author__ = "Patrick Guelcher" __copyright__ = "(C) 2016 Patrick Guelcher" __license__ = "MIT" __version__ = "1.0" """ Scrapes the list of provided subreddits for images and downloads them to a local directoy """ import os import praw import wget import urllib.error # Configuration path = 'im...
Add image scraper for Reddit
Add image scraper for Reddit Currently breaks after pulling a few images
Python
mit
aerovolts/python-scripts
--- +++ @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +__author__ = "Patrick Guelcher" +__copyright__ = "(C) 2016 Patrick Guelcher" +__license__ = "MIT" +__version__ = "1.0" + +""" +Scrapes the list of provided subreddits for images and downloads them to a local directoy +""" + +import os +import praw +import wget +impor...
a2afb7983735f82695068e945fa5fe325f6b9813
cfp/management/commands/applications_for_scoring.py
cfp/management/commands/applications_for_scoring.py
from cfp.models import CallForPaper from django.core.management.base import BaseCommand from django.db.models import StdDev, Count, Avg class Command(BaseCommand): help = ('Dumps a list of applications with scoring info, ready to be ' 'copy/pasted into a google drive spreadsheet.') def add_argume...
Add command for dumping the scoring sheet
Add command for dumping the scoring sheet
Python
bsd-3-clause
WebCampZg/conference-web,WebCampZg/conference-web,WebCampZg/conference-web
--- +++ @@ -0,0 +1,50 @@ +from cfp.models import CallForPaper +from django.core.management.base import BaseCommand +from django.db.models import StdDev, Count, Avg + + +class Command(BaseCommand): + help = ('Dumps a list of applications with scoring info, ready to be ' + 'copy/pasted into a google drive...
6294766c3e30963380fda5b6c6f4f57d16be81d1
scripts/export_point_cloud_to_vtu.py
scripts/export_point_cloud_to_vtu.py
import pyevtk import numpy as np # Input and output file are hardcoded at this time but that can be changed if # necessary input_filename = 'point_cloud.txt' # If output_path is ./point_cloud, the script will output in the current # directory a file named point_cloud.vtu output_path = './point_cloud' point_cloud = np...
Add script to output point clouds as vtu files
Add script to output point clouds as vtu files
Python
bsd-3-clause
ORNL-CEES/DataTransferKit,ORNL-CEES/DataTransferKit,dalg24/DataTransferKit,Rombur/DataTransferKit,Rombur/DataTransferKit,ORNL-CEES/DataTransferKit,dalg24/DataTransferKit,ORNL-CEES/DataTransferKit,Rombur/DataTransferKit,dalg24/DataTransferKit,dalg24/DataTransferKit,Rombur/DataTransferKit
--- +++ @@ -0,0 +1,16 @@ +import pyevtk +import numpy as np + +# Input and output file are hardcoded at this time but that can be changed if +# necessary +input_filename = 'point_cloud.txt' +# If output_path is ./point_cloud, the script will output in the current +# directory a file named point_cloud.vtu +output_path...
db6dafeabdade2cc8f2e14be3ed06938d3dff644
tests/test_classes.py
tests/test_classes.py
import unittest from classes import Paladin from models.spells.loader import load_paladin_spells_for_level class PaladinTests(unittest.TestCase): def setUp(self): self.name = "Netherblood" self.level = 3 self.dummy = Paladin(name=self.name, level=self.level, health=100, mana=100, strength...
Test for the __init__ function of the Paladin class
Test for the __init__ function of the Paladin class
Python
mit
Enether/python_wow
--- +++ @@ -0,0 +1,28 @@ +import unittest + +from classes import Paladin +from models.spells.loader import load_paladin_spells_for_level + + +class PaladinTests(unittest.TestCase): + def setUp(self): + self.name = "Netherblood" + self.level = 3 + self.dummy = Paladin(name=self.name, level=self...
289a17fe296f579b43d62c00d27ca691da2ac944
reporter-cli/sql-pdf/python/src/reportlabpkq/__init__.py
reporter-cli/sql-pdf/python/src/reportlabpkq/__init__.py
# -*- coding: utf-8 -*- # reporter-cli/sql-pdf/python/src/reportlabpkq/__init__.py # ============================================================================= # Reporter Multilang. Version 0.1 # ============================================================================= # A tool to generate human-readable reports...
Add package initializer (according to PEP 420).
SQL-PDF-Python: Add package initializer (according to PEP 420).
Python
unlicense
rgolubtsov/reporter-multilang,rgolubtsov/reporter-multilang,rgolubtsov/reporter-multilang,rgolubtsov/reporter-multilang
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# reporter-cli/sql-pdf/python/src/reportlabpkq/__init__.py +# ============================================================================= +# Reporter Multilang. Version 0.1 +# ============================================================================= +# A tool t...
cdb12a5536931c62652f4e7a329eb13969cac6cb
lintcode/Medium/124_Longest_Consecutive_Sequence.py
lintcode/Medium/124_Longest_Consecutive_Sequence.py
class Solution: """ @param num, a list of integer @return an integer """ def longestConsecutive(self, num): # write your code here hashMap = {} res = 0 for n in num: hashMap[n] = False for k in hashMap: tmp = k - 1 tmpRes = ...
Add Solution to lintcode question 124
Add Solution to lintcode question 124
Python
mit
Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode
--- +++ @@ -0,0 +1,25 @@ +class Solution: + """ + @param num, a list of integer + @return an integer + """ + def longestConsecutive(self, num): + # write your code here + hashMap = {} + res = 0 + for n in num: + hashMap[n] = False + for k in hashMap: + ...
bd243742f65a8fd92f4a773ce485cdc6f03f4a84
kevin/leet/copy_list_with_random_pointers.py
kevin/leet/copy_list_with_random_pointers.py
""" https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3635/ """ class Node: def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None): self.val = int(x) self.next = next self.random = random class Solution: def...
Add Copy List with Random Pointer LeetCode problem
Add Copy List with Random Pointer LeetCode problem - No tests though
Python
mit
kalyons11/kevin,kalyons11/kevin
--- +++ @@ -0,0 +1,48 @@ +""" +https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3635/ +""" + +class Node: + def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None): + self.val = int(x) + self.next = next + self.rand...
e51e1c14b1375249af90eff21978a316471c16b9
ichnaea/tests/test_migration.py
ichnaea/tests/test_migration.py
from alembic import command as alembic_command from alembic.config import Config from alembic.script import ScriptDirectory from sqlalchemy import inspect from sqlalchemy.schema import ( MetaData, Table, ) # make sure all models are imported from ichnaea import models # NOQA from ichnaea.content import models...
Add a test to execute all migrations.
Add a test to execute all migrations.
Python
apache-2.0
mozilla/ichnaea,therewillbecode/ichnaea,mozilla/ichnaea,mozilla/ichnaea,mozilla/ichnaea,therewillbecode/ichnaea,therewillbecode/ichnaea
--- +++ @@ -0,0 +1,96 @@ +from alembic import command as alembic_command +from alembic.config import Config +from alembic.script import ScriptDirectory +from sqlalchemy import inspect +from sqlalchemy.schema import ( + MetaData, + Table, +) + +# make sure all models are imported +from ichnaea import models # N...
5b2d5446b178cc49934192d42de73b29ed0707e1
del_no_available.py
del_no_available.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import os import re import shutil import imagehash from PIL import Image TRAIN_DIR = 'flickr_logos_27_dataset' DISTRACT_IMAGE_DIR = os.path.join(TRAIN_DIR, 'flickr_logos_27_dataset_distractor_images') NO_AVAILABLE_IMG =...
Add a new script to delete no available image file.
Add a new script to delete no available image file.
Python
mit
satojkovic/DeepLogo
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import numpy as np +import os +import re +import shutil +import imagehash +from PIL import Image + +TRAIN_DIR = 'flickr_logos_27_dataset' +DISTRACT_IMAGE_DIR = os.path.join(TRAIN_DIR, + 'flickr_logos_27_datase...
1e1d58c3a3d2134c98f42206b1dd5226d5e23c27
phasortoolbox/synchrophasor.py
phasortoolbox/synchrophasor.py
from collections import UserList class Synchrophasor(UserList): """ time_tag is the time tag of the synchrophasor message arr_time is the unix time that the last data frame for the synchrophasor received perf_counter is used the check the performace """ def __init__(self, list_, time_tag, arr_t...
Put Synchrophasor in a seperate file
Put Synchrophasor in a seperate file
Python
mit
sonusz/PhasorToolBox
--- +++ @@ -0,0 +1,12 @@ +from collections import UserList +class Synchrophasor(UserList): + """ + time_tag is the time tag of the synchrophasor message + arr_time is the unix time that the last data frame for the synchrophasor received + perf_counter is used the check the performace + """ + def __...
03f1f9558b717cd2d6b08db609eb8bd706ad641e
griddedspectra.py
griddedspectra.py
# -*- coding: utf-8 -*- """Class to create spectra spaced on a regular grid through the box""" import numpy as np import hdfsim import spectra class GriddedSpectra(spectra.Spectra): """Generate metal line spectra from simulation snapshot. Default parameters are BOSS DR9""" def __init__(self,num, base, nspec=2...
Add script for generating spectra on a grid
Add script for generating spectra on a grid
Python
mit
sbird/fake_spectra,sbird/fake_spectra,sbird/fake_spectra
--- +++ @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +"""Class to create spectra spaced on a regular grid through the box""" + +import numpy as np +import hdfsim +import spectra + +class GriddedSpectra(spectra.Spectra): + """Generate metal line spectra from simulation snapshot. Default parameters are BOSS DR9""" + ...
4071277c8fe920e19293e46ac1fa937008418616
kqml/cl_json.py
kqml/cl_json.py
from .kqml_string import KQMLString from .kqml_list import KQMLList from .kqml_token import KQMLToken from .kqml_exceptions import KQMLException def parse_json(json_obj): if isinstance(json_obj, list): ret = KQMLList() for elem in json_obj: ret.append(parse_json(elem)) elif isinsta...
Write function to parse cl-json.
Write function to parse cl-json.
Python
bsd-2-clause
bgyori/pykqml
--- +++ @@ -0,0 +1,30 @@ +from .kqml_string import KQMLString +from .kqml_list import KQMLList +from .kqml_token import KQMLToken +from .kqml_exceptions import KQMLException + + +def parse_json(json_obj): + if isinstance(json_obj, list): + ret = KQMLList() + for elem in json_obj: + ret.app...
05695f5b5f6ebac318b9ff3290d2be9834125307
test/unittests/util/test_platform.py
test/unittests/util/test_platform.py
from unittest import TestCase, mock from mycroft.util import get_arch class TestPlatform(TestCase): @mock.patch('os.uname') def test_get_arch(self, mock_uname): mock_uname.return_value = ('Linux', 'Woodstock', '4.15.0-39-generic', 'Awesome test system Mark 7', 'x86_...
Add simple test for get_platform
Add simple test for get_platform
Python
apache-2.0
MycroftAI/mycroft-core,forslund/mycroft-core,MycroftAI/mycroft-core,forslund/mycroft-core
--- +++ @@ -0,0 +1,11 @@ +from unittest import TestCase, mock + +from mycroft.util import get_arch + + +class TestPlatform(TestCase): + @mock.patch('os.uname') + def test_get_arch(self, mock_uname): + mock_uname.return_value = ('Linux', 'Woodstock', '4.15.0-39-generic', + ...
7e9bd459b13efa191fb2293e675166e21de4ec28
setup/create_player_seasons.py
setup/create_player_seasons.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import concurrent.futures from db.common import session_scope from db.player import Player from utils.player_data_retriever import PlayerDataRetriever def create_player_seasons(simulation=False): data_retriever = PlayerDataRetriever() with session_scope() as s...
Add utility script for mass season data retrieval
Add utility script for mass season data retrieval
Python
mit
leaffan/pynhldb
--- +++ @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import concurrent.futures + +from db.common import session_scope +from db.player import Player +from utils.player_data_retriever import PlayerDataRetriever + + +def create_player_seasons(simulation=False): + + data_retriever = PlayerDataRe...
540a13e49d5f08fc030c273c4b24b62feab117b4
crawler/management/commands/classify.py
crawler/management/commands/classify.py
from django.core.management.base import BaseCommand from crawler.models import App from crawler.tasks import AppClassifier class Command(BaseCommand): help = 'Process similar csv' def handle(self, *args, **options): classifier = AppClassifier() apps = App.objects.all()[:100] classifi...
Create a Custom Command to use the classifier
Create a Custom Command to use the classifier
Python
apache-2.0
bkosawa/admin-recommendation
--- +++ @@ -0,0 +1,13 @@ +from django.core.management.base import BaseCommand + +from crawler.models import App +from crawler.tasks import AppClassifier + + +class Command(BaseCommand): + help = 'Process similar csv' + + def handle(self, *args, **options): + classifier = AppClassifier() + apps = A...