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
5e3f3b83974c4826cddcfdb73f2d4eb4abe2aca1
examples/test_download_files.py
examples/test_download_files.py
from seleniumbase import BaseCase class DownloadTests(BaseCase): def test_download_files(self): self.open("https://pypi.org/project/seleniumbase/#files") pkg_header = self.get_text("h1.package-header__name") pkg_name = pkg_header.replace(" ", "-") whl_file = pkg_name + "-...
Add test for asserting downloaded files
Add test for asserting downloaded files
Python
mit
seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase
--- +++ @@ -0,0 +1,15 @@ +from seleniumbase import BaseCase + + +class DownloadTests(BaseCase): + + def test_download_files(self): + self.open("https://pypi.org/project/seleniumbase/#files") + pkg_header = self.get_text("h1.package-header__name") + pkg_name = pkg_header.replace(" ", "-") + ...
724e8303a80f17c83128b5876dbb3d95c106805c
segments/npm_version.py
segments/npm_version.py
import subprocess def add_npm_version_segment(powerline): try: p1 = subprocess.Popen(["npm", "--version"], stdout=subprocess.PIPE) version = p1.communicate()[0].decode("utf-8").rstrip() version = "npm " + version powerline.append(version, 15, 18) except OSError: return
Add segment for npm version
Add segment for npm version
Python
mit
tswsl1989/powerline-shell,bitIO/powerline-shell,milkbikis/powerline-shell,banga/powerline-shell,b-ryan/powerline-shell,b-ryan/powerline-shell,banga/powerline-shell
--- +++ @@ -0,0 +1,11 @@ +import subprocess + + +def add_npm_version_segment(powerline): + try: + p1 = subprocess.Popen(["npm", "--version"], stdout=subprocess.PIPE) + version = p1.communicate()[0].decode("utf-8").rstrip() + version = "npm " + version + powerline.append(version, 15, 18)...
9b42c3553b6b55125d63c902de6f9a92bc7c1fc0
openprescribing/frontend/migrations/0007_auto_20160908_0811.py
openprescribing/frontend/migrations/0007_auto_20160908_0811.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2016-09-08 07:14 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('frontend', '0006_importlog_populate'), ] operations = [ migrations.AlterMode...
Add file found on server
Add file found on server
Python
mit
ebmdatalab/openprescribing,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc,ebmdatalab/openprescribing
--- +++ @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.1 on 2016-09-08 07:14 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('frontend', '0006_importlog_populate'), + ] + + op...
1c293752b03b74105ad48d4d9be0a38bec55ca9a
flexx/ui/examples/code_editor.py
flexx/ui/examples/code_editor.py
# doc-export: CodeEditor """ This example demonstrates a code editor widget based on CodeMirror. """ # todo: Maybe this should be a widget in the library (flexx.ui.CodeMirror) ? from flexx import ui, app, event from flexx.pyscript.stubs import window # Associate CodeMirror's assets with this module so th...
Add example for code editor widget based on codemirror
Add example for code editor widget based on codemirror
Python
bsd-2-clause
jrversteegh/flexx,JohnLunzer/flexx,zoofIO/flexx,jrversteegh/flexx,JohnLunzer/flexx,zoofIO/flexx,JohnLunzer/flexx
--- +++ @@ -0,0 +1,53 @@ +# doc-export: CodeEditor +""" +This example demonstrates a code editor widget based on CodeMirror. +""" + +# todo: Maybe this should be a widget in the library (flexx.ui.CodeMirror) ? + +from flexx import ui, app, event +from flexx.pyscript.stubs import window + + +# Associate CodeMirror's a...
051e2ff67a87fbbf7229b8f04b70742d441b75fd
examples/freesolv/gather_data_for_analysis.py
examples/freesolv/gather_data_for_analysis.py
import numpy as np import yaml from perses.analysis import Analysis import glob def collect_file_conditions(experiment_directory): """ Collect the experiment files for each condition of phase, ncmc steps, sterics, and geometry intervals. This assumes there is one output for each experimental condition. ...
Add beginning of simple script to gather data on cluster
Add beginning of simple script to gather data on cluster
Python
mit
choderalab/perses,choderalab/perses
--- +++ @@ -0,0 +1,65 @@ +import numpy as np +import yaml +from perses.analysis import Analysis +import glob + +def collect_file_conditions(experiment_directory): + """ + Collect the experiment files for each condition of phase, ncmc steps, sterics, and geometry intervals. + This assumes there is one output ...
16d690031e3a95f636e1730ba59f8c91c0019f97
scripts/check_yaml_cde_calculation.py
scripts/check_yaml_cde_calculation.py
#!/usr/bin/env python """ Validates CDE calculation javascript in registry YAML files. """ from __future__ import print_function import io import sys import yaml from rdrf.utils import check_calculation yaml.add_constructor(u'tag:yaml.org,2002:str', yaml.constructor.Constructor.construct_python_u...
Add a script for checking CDE calculations in rdrd repo
scripts: Add a script for checking CDE calculations in rdrd repo
Python
agpl-3.0
muccg/rdrf,muccg/rdrf,muccg/rdrf,muccg/rdrf,muccg/rdrf
--- +++ @@ -0,0 +1,29 @@ +#!/usr/bin/env python +""" +Validates CDE calculation javascript in registry YAML files. +""" + +from __future__ import print_function +import io +import sys +import yaml +from rdrf.utils import check_calculation + +yaml.add_constructor(u'tag:yaml.org,2002:str', + yaml.co...
25f0375683064d39fc460da6f42109a8b6b2e60c
migrations/versions/690_add_brief_length_to_published_briefs.py
migrations/versions/690_add_brief_length_to_published_briefs.py
"""Give published specialist briefs a requirementsLength of '2 weeks' Revision ID: 690 Revises: 680 Create Date: 2016-07-28 12:30:11.406853 """ # revision identifiers, used by Alembic. revision = '690' down_revision = '680' from alembic import op import sqlalchemy as sa from sqlalchemy.sql import table, column from...
Create migration for specialist requirementLengths
Create migration for specialist requirementLengths Due to the new functionality for specialist briefs to be live for one or two weeks, it's necessary to migrate existing published briefs to have a requirementsLength of '2 weeks' so they don't fail validation.
Python
mit
alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api
--- +++ @@ -0,0 +1,45 @@ +"""Give published specialist briefs a requirementsLength of '2 weeks' + +Revision ID: 690 +Revises: 680 +Create Date: 2016-07-28 12:30:11.406853 + +""" + +# revision identifiers, used by Alembic. +revision = '690' +down_revision = '680' + +from alembic import op +import sqlalchemy as sa +fro...
a0bdba19b6f22363bed532a7872a1128679fafe6
scripts/remove_notification_subscriptions_from_registrations.py
scripts/remove_notification_subscriptions_from_registrations.py
""" Script for removing NotificationSubscriptions from registrations. Registrations shouldn't have them! """ import logging import sys import django django.setup() from website.app import init_app from django.apps import apps logger = logging.getLogger(__name__) def remove_notification_subscriptions_from_regis...
Add script to remove NotificationSubscriptions on Registrations.
Add script to remove NotificationSubscriptions on Registrations.
Python
apache-2.0
felliott/osf.io,brianjgeiger/osf.io,felliott/osf.io,baylee-d/osf.io,aaxelb/osf.io,CenterForOpenScience/osf.io,aaxelb/osf.io,brianjgeiger/osf.io,baylee-d/osf.io,Johnetordoff/osf.io,mattclark/osf.io,adlius/osf.io,aaxelb/osf.io,mattclark/osf.io,mfraezz/osf.io,felliott/osf.io,CenterForOpenScience/osf.io,Johnetordoff/osf.io...
--- +++ @@ -0,0 +1,36 @@ +""" Script for removing NotificationSubscriptions from registrations. + Registrations shouldn't have them! +""" +import logging +import sys + +import django +django.setup() + +from website.app import init_app +from django.apps import apps + +logger = logging.getLogger(__name__) + + +def r...
89423bdccbf5fbfc8a645e0066e1082de64a8eac
features/environment.py
features/environment.py
from behave import * import shutil import os def before_scenario(context, scenario): """Before each scenario, backup all config and journal test data.""" for folder in ("configs", "journals"): original = os.path.join("features", folder) backup = os.path.join("features", folder+"_backup") ...
Backup and restore config and journal files every time
Backup and restore config and journal files every time
Python
mit
cloudrave/jrnl-todos,flight16/jrnl,MinchinWeb/jrnl,philipsd6/jrnl,maebert/jrnl,notbalanced/jrnl,Shir0kamii/jrnl,MSylvia/jrnl,zdravi/jrnl,nikvdp/jrnl,dzeban/jrnl,beni55/jrnl,rzyns/jrnl
--- +++ @@ -0,0 +1,22 @@ +from behave import * +import shutil +import os + +def before_scenario(context, scenario): + """Before each scenario, backup all config and journal test data.""" + for folder in ("configs", "journals"): + original = os.path.join("features", folder) + backup = os.path.join(...
f0b009494ba743272e555c87bc9d1ea99377371f
sra_status.py
sra_status.py
""" Report the status of an SRA run """ import os import sys import argparse import requests import json def get_status(runids, verbose, url='https://www.ncbi.nlm.nih.gov/Traces/sra/status/srastatrep.fcgi/acc-mirroring?acc='): """ Get the status of the run :param runid: the set of run ids to get :par...
Check the status of a read
Check the status of a read
Python
mit
linsalrob/partie,linsalrob/partie,linsalrob/partie,linsalrob/partie
--- +++ @@ -0,0 +1,76 @@ +""" +Report the status of an SRA run +""" + +import os +import sys +import argparse +import requests +import json + + +def get_status(runids, verbose, url='https://www.ncbi.nlm.nih.gov/Traces/sra/status/srastatrep.fcgi/acc-mirroring?acc='): + """ + Get the status of the run + :param...
69b3d3619ce08940277c811cb9e4c24a137831da
st2actions/tests/unit/test_action_runner_worker.py
st2actions/tests/unit/test_action_runner_worker.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
Add test for ActionsQueueConsumer class which verifies that the right BufferedDispatcher class is used.
Add test for ActionsQueueConsumer class which verifies that the right BufferedDispatcher class is used.
Python
apache-2.0
emedvedev/st2,nzlosh/st2,peak6/st2,punalpatel/st2,peak6/st2,Plexxi/st2,punalpatel/st2,Plexxi/st2,StackStorm/st2,nzlosh/st2,peak6/st2,punalpatel/st2,pixelrebel/st2,nzlosh/st2,tonybaloney/st2,tonybaloney/st2,Plexxi/st2,StackStorm/st2,pixelrebel/st2,StackStorm/st2,nzlosh/st2,StackStorm/st2,lakshmi-kannan/st2,pixelrebel/st...
--- +++ @@ -0,0 +1,56 @@ +# Licensed to the StackStorm, Inc ('StackStorm') under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (th...
61d1020d1a96e6384426414ee122a013c6d75ea9
djconnectwise/migrations/0046_auto_20180104_1504.py
djconnectwise/migrations/0046_auto_20180104_1504.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('djconnectwise', '0045_auto_20171222_1725'), ] operations = [ migrations.AlterField( model_name='scheduleentry', ...
Add migration for last commit
Add migration for last commit
Python
mit
KerkhoffTechnologies/django-connectwise,KerkhoffTechnologies/django-connectwise
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('djconnectwise', '0045_auto_20171222_1725'), + ] + + operations = [ + migrations.AlterField(...
158d8722b8a232dceefc040cb2414201ddc7a059
test_all.py
test_all.py
import pytest import random import pymongo from pymongo import MongoClient _connection = None class TempCollection: def __init__(self, db, name, initial_data=None): self.db = db self.name = name self.initial_data = initial_data def __enter__(self): self.col = self.db[self.n...
Add fixture for database related testing
Add fixture for database related testing
Python
mit
irvind/logster,irvind/logster,irvind/logster
--- +++ @@ -0,0 +1,58 @@ +import pytest +import random + +import pymongo +from pymongo import MongoClient + + +_connection = None + + +class TempCollection: + def __init__(self, db, name, initial_data=None): + self.db = db + self.name = name + self.initial_data = initial_data + + def __ente...
34f8c0a4a0a9f78c124cd07b121ce5b2fbf00136
onadata/libs/utils/csv_import.py
onadata/libs/utils/csv_import.py
import unicodecsv as ucsv from cStringIO import StringIO from ondata.apps.api.viewsets.xform_submission_api import dict_lists2strings from onadata.libs.utils.logger_tools import dict2xform, safe_create_instance def submit_csv(username, request, csv_data): if isinstance(csv_data, (str, unicode)): csv_data...
import unicodecsv as ucsv from cStringIO import StringIO from ondata.apps.api.viewsets.xform_submission_api import dict_lists2strings from onadata.libs.utils.logger_tools import dict2xform, safe_create_instance from django.db import transaction class CSVImportException(Exception): pass def submit_csv(username, ...
Implement atomicity for CSV imports
JZ: Implement atomicity for CSV imports CSV imports should happen for all rows or nothing at all! Use `django.transactions` for rollbacks on submission on errors Also remove metadata from CSV rows before submitting
Python
bsd-2-clause
awemulya/fieldsight-kobocat,mainakibui/kobocat,qlands/onadata,smn/onadata,sounay/flaminggo-test,piqoni/onadata,qlands/onadata,jomolinare/kobocat,sounay/flaminggo-test,mainakibui/kobocat,kobotoolbox/kobocat,kobotoolbox/kobocat,smn/onadata,piqoni/onadata,hnjamba/onaclone,awemulya/fieldsight-kobocat,smn/onadata,jomolinare...
--- +++ @@ -2,6 +2,11 @@ from cStringIO import StringIO from ondata.apps.api.viewsets.xform_submission_api import dict_lists2strings from onadata.libs.utils.logger_tools import dict2xform, safe_create_instance +from django.db import transaction + + +class CSVImportException(Exception): + pass def submit_cs...
23d34308206013033f22204f8720ef01263ab07b
examples/plot_ransac.py
examples/plot_ransac.py
""" =========================================== Robust linear model estimation using RANSAC =========================================== In this example we see how to robustly fit a linear model to faulty data using the RANSAC algorithm. """ import numpy as np from matplotlib import pyplot as plt from sklearn import ...
Add example plot script for RANSAC
Add example plot script for RANSAC
Python
bsd-3-clause
maheshakya/scikit-learn,meduz/scikit-learn,tawsifkhan/scikit-learn,thilbern/scikit-learn,abimannans/scikit-learn,mikebenfield/scikit-learn,fyffyt/scikit-learn,xwolf12/scikit-learn,nhejazi/scikit-learn,btabibian/scikit-learn,Lawrence-Liu/scikit-learn,ngoix/OCRF,loli/semisupervisedforests,mugizico/scikit-learn,pnedunuri/...
--- +++ @@ -0,0 +1,60 @@ +""" +=========================================== +Robust linear model estimation using RANSAC +=========================================== + +In this example we see how to robustly fit a linear model to faulty data using +the RANSAC algorithm. + +""" +import numpy as np +from matplotlib impo...
a6407fe9a3b77372ed3e93b92f77bcea32e77393
kive/archive/migrations/0014_dataset_name_length.py
kive/archive/migrations/0014_dataset_name_length.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('archive', '0013_methodoutput_are_checksums_ok'), ] operations = [ migrations.AlterField( model_name='dataset', ...
Add a migration for dataset name length.
Add a migration for dataset name length.
Python
bsd-3-clause
cfe-lab/Kive,cfe-lab/Kive,cfe-lab/Kive,cfe-lab/Kive,cfe-lab/Kive
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('archive', '0013_methodoutput_are_checksums_ok'), + ] + + operations = [ + migrations.AlterF...
db20a15c34fc6bb43ad8e0a4860dd252e49a8033
Regression/MultipleLinearRegression/regularMultipleRegression.py
Regression/MultipleLinearRegression/regularMultipleRegression.py
# -*- coding: utf-8 -*- """Multiple linear regression for machine learning. A linear regression model that contains more than one predictor variable is called a multiple linear regression model. It is basically the same as Simple Linear regression, but with more predictor variables (features). The idea is that linearl...
Add Python file for Multiple linear regression
Add Python file for Multiple linear regression
Python
mit
a-holm/MachinelearningAlgorithms,a-holm/MachinelearningAlgorithms
--- +++ @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +"""Multiple linear regression for machine learning. + +A linear regression model that contains more than one predictor variable is +called a multiple linear regression model. It is basically the same as Simple +Linear regression, but with more predictor variables (fe...
5fee82b0ef269993ebc4147bfd825718a460616c
neural_style/convert_model_cpu.py
neural_style/convert_model_cpu.py
from transformer_net import TransformerNet import argparse import torch def main(): parser = argparse.ArgumentParser() parser.add_argument("--gpu-model", type=str, required=True) parser.add_argument("--cpu-model", type=str, required=True) args = parser.parse_args() tr = torch.load(args.gpu_model)...
Convert gpu model to cpu model
Convert gpu model to cpu model
Python
mit
onai/fast-neural-style
--- +++ @@ -0,0 +1,20 @@ +from transformer_net import TransformerNet +import argparse +import torch + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--gpu-model", type=str, required=True) + parser.add_argument("--cpu-model", type=str, required=True) + args = parser.parse_args()...
a7c952cce7c006913727adf1be29e6d94e3b9f6a
orges/test/unit/test_pluggable.py
orges/test/unit/test_pluggable.py
from mock import Mock from orges.invoker.pluggable import PluggableInvoker from orges.args import ArgsCreator import orges.param as param @param.int("a", interval=(0, 1)) def f(a): return a def test_before_invoke_calls_plugins(): mock_plugin = Mock() mock_plugin.before_invoke = Mock(spec=[]) plugin...
Add unit tests for invocation plugin hooks
Add unit tests for invocation plugin hooks
Python
bsd-3-clause
cigroup-ol/metaopt,cigroup-ol/metaopt,cigroup-ol/metaopt
--- +++ @@ -0,0 +1,88 @@ +from mock import Mock + +from orges.invoker.pluggable import PluggableInvoker + +from orges.args import ArgsCreator +import orges.param as param + +@param.int("a", interval=(0, 1)) +def f(a): + return a + +def test_before_invoke_calls_plugins(): + mock_plugin = Mock() + mock_plugin....
45ef1d56e77b1b5414c7c5d596441295c8cef497
scripts/generate_csv_files.py
scripts/generate_csv_files.py
# -*- coding: utf-8 -*- import pandas as pd df = pd.read_csv("data/all.anonymes.csv", dtype=object, encoding='utf-8') df['DECL_AVANT_MONTANT'] = df.DECL_AVANT_MONTANT.astype('float32') # by LABO labos = df.groupby(['LABO', 'BENEF_PS_DEPARTEMENT', 'DECL_TYPE']).agg({'DECL_AVANT_MONTANT': {'DECL_AVANT_SOMME': 'sum', ...
Add script to generate csv for dataviz
Add script to generate csv for dataviz
Python
agpl-3.0
regardscitoyens/sunshine-data,regardscitoyens/sunshine-data,regardscitoyens/sunshine-data,regardscitoyens/sunshine-data,regardscitoyens/sunshine-data,regardscitoyens/sunshine-data
--- +++ @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +import pandas as pd + +df = pd.read_csv("data/all.anonymes.csv", dtype=object, encoding='utf-8') + +df['DECL_AVANT_MONTANT'] = df.DECL_AVANT_MONTANT.astype('float32') + +# by LABO +labos = df.groupby(['LABO', 'BENEF_PS_DEPARTEMENT', 'DECL_TYPE']).agg({'DECL_AVANT_M...
dedfec08bbec4c97ff8e7e1242ac8d406cc73b0b
init.py
init.py
url = "https://pub.orcid.org/0000-0002-2907-3313" import requests import json resp = requests.get(url, headers={'Accept':'application/orcid+json'}) print json.dumps(resp.json(), sort_keys=True, indent=4, separators=(',', ': '))
Load JSON of Melodee ORCID
Load JSON of Melodee ORCID
Python
mit
njall/Orctrix,njall/Orctrix,njall/Orctrix
--- +++ @@ -0,0 +1,13 @@ +url = "https://pub.orcid.org/0000-0002-2907-3313" + +import requests +import json + +resp = requests.get(url, + headers={'Accept':'application/orcid+json'}) + +print json.dumps(resp.json(), + sort_keys=True, + indent=4, separators=(',', ': '...
1b8bf0b171532d366f0823ea9afb9ac500262488
python/array/RemoveElement.py
python/array/RemoveElement.py
class Solution: # @param A a list of integers # @param elem an integer, value need to be removed # @return an integer def removeElement(self, A, elem): result = len(A) start = 0 for i in xrange(len(A)): A[start] = A[i] if A[i] != elem: ...
Remove Element -- keep streak!
Remove Element -- keep streak!
Python
mit
sureleo/leetcode,sureleo/leetcode,lsingal/leetcode,sureleo/leetcode,lsingal/leetcode,lsingal/leetcode
--- +++ @@ -0,0 +1,14 @@ +class Solution: + # @param A a list of integers + # @param elem an integer, value need to be removed + # @return an integer + def removeElement(self, A, elem): + result = len(A) + start = 0 + for i in xrange(len(A)): + A[start] = A[i...
0f5c38b1c7bcd8a26c415c8d0c93edc132263087
CodeFights/firstDigit.py
CodeFights/firstDigit.py
#!/usr/local/bin/python # Code Fights First Digit Problem import re def firstDigit(inputString): match = re.search(r'\d', inputString) return match.group(0) def main(): tests = [ ["var_1__Int", "1"], ["q2q-q", "2"], ["0ss", "0"] ] for t in tests: res = firstDigi...
Solve Code Fights first digit problem
Solve Code Fights first digit problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,31 @@ +#!/usr/local/bin/python +# Code Fights First Digit Problem + +import re + + +def firstDigit(inputString): + match = re.search(r'\d', inputString) + return match.group(0) + + +def main(): + tests = [ + ["var_1__Int", "1"], + ["q2q-q", "2"], + ["0ss", "0"] + ] ...
dcd80232189743962d12a3df15bbb2708b1966b8
tests/test_decider.py
tests/test_decider.py
from unittest.mock import MagicMock import boto.swf.layer2 as swf from boto.swf import layer1 import pytest from garcon import activity from garcon import decider def mock(monkeypatch): for base in [swf.Decider, swf.WorkflowType, swf.ActivityType, swf.Domain]: monkeypatch.setattr(base, '__init__', MagicM...
Add some tests for the decider.
Add some tests for the decider.
Python
mit
xethorn/garcon,theorchard/garcon,pkuong/garcon,rantonmattei/garcon,someboredkiddo/garcon
--- +++ @@ -0,0 +1,35 @@ +from unittest.mock import MagicMock +import boto.swf.layer2 as swf +from boto.swf import layer1 +import pytest + +from garcon import activity +from garcon import decider + + +def mock(monkeypatch): + for base in [swf.Decider, swf.WorkflowType, swf.ActivityType, swf.Domain]: + monke...
1ec0c1d949e9379fc2a01bf480a782bb4d75afb9
test.py
test.py
#!/bin/env python3 # -*- coding: utf-8 -*- """ Test the 'send_morse' module. """ import sys import os import getopt import threading sys.path.append('..') from sound_morse import SoundMorse # get program name from sys.argv prog_name = sys.argv[0] if prog_name.endswith('.py'): prog_name = prog_name[:-3] def us...
Test program for thread debugging
Test program for thread debugging
Python
mit
rzzzwilson/morse_trainer,rzzzwilson/morse_trainer
--- +++ @@ -0,0 +1,90 @@ +#!/bin/env python3 +# -*- coding: utf-8 -*- + +""" +Test the 'send_morse' module. +""" + +import sys +import os +import getopt +import threading +sys.path.append('..') +from sound_morse import SoundMorse + + +# get program name from sys.argv +prog_name = sys.argv[0] +if prog_name.endswith('....
fa87821a4a4b282e5cc0d9311a0c4dfb5fbc37db
comics/aggregator/utils.py
comics/aggregator/utils.py
from comics.comics import get_comic_module SCHEDULE_DAYS = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] def get_comic_schedule(comic): module = get_comic_module(comic.slug) schedule = module.Crawler(comic).schedule if not schedule: return [] return [SCHEDULE_DAYS.index(day) for day in schedule....
Add helper for getting schedule
Add helper for getting schedule
Python
agpl-3.0
jodal/comics,klette/comics,klette/comics,jodal/comics,klette/comics,datagutten/comics,jodal/comics,datagutten/comics,datagutten/comics,jodal/comics,datagutten/comics
--- +++ @@ -0,0 +1,11 @@ +from comics.comics import get_comic_module + +SCHEDULE_DAYS = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] + +def get_comic_schedule(comic): + module = get_comic_module(comic.slug) + schedule = module.Crawler(comic).schedule + + if not schedule: + return [] + return [SCHEDUL...
6db2c7298a4111ce540743099cabed7aed4439c8
dbaas/workflow/steps/mysql/region_migration/remove_nfs_snapshot.py
dbaas/workflow/steps/mysql/region_migration/remove_nfs_snapshot.py
# -*- coding: utf-8 -*- import logging from util import full_stack from workflow.steps.util.base import BaseStep from dbaas_nfsaas.provider import NfsaasProvider from workflow.exceptions.error_codes import DBAAS_0020 LOG = logging.getLogger(__name__) class RemoveNfsSnapshot(BaseStep): def __unicode__(self): ...
Add step to remove nfs snapshot
Add step to remove nfs snapshot
Python
bsd-3-clause
globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service
--- +++ @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +import logging +from util import full_stack +from workflow.steps.util.base import BaseStep +from dbaas_nfsaas.provider import NfsaasProvider +from workflow.exceptions.error_codes import DBAAS_0020 + +LOG = logging.getLogger(__name__) + + +class RemoveNfsSnapshot(Base...
27439c063c51015c1405c3c855ce96157892da72
opps/channel/search_indexes.py
opps/channel/search_indexes.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from datetime import datetime from haystack.indexes import SearchIndex, CharField, DateTimeField from haystack import site from .models import Channel class ChannelIndex(SearchIndex): text = CharField(document=True, use_template=True) date_available = DateTimeFi...
Create channel search index, indexed all channel name
Create channel search index, indexed all channel name
Python
mit
williamroot/opps,YACOWS/opps,opps/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps,opps/opps,williamroot/opps,williamroot/opps,YACOWS/opps,opps/opps,opps/opps,jeanmask/opps,jeanmask/opps,williamroot/opps,YACOWS/opps
--- +++ @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +from datetime import datetime + +from haystack.indexes import SearchIndex, CharField, DateTimeField +from haystack import site + +from .models import Channel + + +class ChannelIndex(SearchIndex): + text = CharField(document=True, use_templat...
f4bb9685d4ba6661cdda34635c772fb39dc3e246
wsgi.py
wsgi.py
""" WSGI Entry Point """ from portal.app import create_app from werkzeug.contrib.fixers import ProxyFix app = create_app() if app.config.get('PREFERRED_URL_SCHEME', '').lower() == 'https': app.wsgi_app = ProxyFix(app.wsgi_app)
Add proxy-fixing middleware if serving over HTTPS proxy
Add proxy-fixing middleware if serving over HTTPS proxy
Python
bsd-3-clause
uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal
--- +++ @@ -0,0 +1,11 @@ +""" WSGI Entry Point + +""" + +from portal.app import create_app +from werkzeug.contrib.fixers import ProxyFix + +app = create_app() + +if app.config.get('PREFERRED_URL_SCHEME', '').lower() == 'https': + app.wsgi_app = ProxyFix(app.wsgi_app)
6c53c55204955cf0682c655321219b4e67481030
lab/10/template_10_c.py
lab/10/template_10_c.py
# Template Binary Search Tree class Node: ''' Class untuk node dari Binary Search Tree Terdiri dari value dari node dan reference ke left child dan right child ''' def __init__(self, value): self.value = value self.left = None self.right = None # Benny-ry Sear...
Add lab 10 template for class C
Add lab 10 template for class C
Python
mit
giovanism/TarungLab,laymonage/TarungLab
--- +++ @@ -0,0 +1,99 @@ +# Template Binary Search Tree + +class Node: + + ''' + Class untuk node dari Binary Search Tree + Terdiri dari value dari node + dan reference ke left child dan right child + ''' + + def __init__(self, value): + self.value = value + self.left = None + ...
127338c9584b6ac0e74ef0009d2769dd43d080f9
particle-beam/particle-beam.py
particle-beam/particle-beam.py
#!/usr/bin/env python3 import random import const from particle import Particle, propagate from detector import Detector from initial import Beam, Profile, Energy random.seed(91400) N = 1000 beam = Beam( profile=Profile( centre=0, diameter=50, shape=const.UNIFORM, ), energy=Ener...
Add the 'shell' for the MC simulation.
Add the 'shell' for the MC simulation.
Python
mpl-2.0
DanielBrookRoberge/MonteCarloExamples
--- +++ @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 + +import random + +import const +from particle import Particle, propagate +from detector import Detector +from initial import Beam, Profile, Energy + +random.seed(91400) + +N = 1000 + +beam = Beam( + profile=Profile( + centre=0, + diameter=50, + ...
8fb60650f8ff1da16d537402e7227f78667b434e
tests/test_schema_loader.py
tests/test_schema_loader.py
import contextlib import json import os import tempfile import unittest from faker_schema.schema_loader import load_json_from_file, load_json_from_string class TestFakerSchema(unittest.TestCase): def test_load_json_from_string(self): schema_json_string = '{"Full Name": "name", "Address": "address", "Email": "ema...
Add unit tests for schema loader module
Add unit tests for schema loader module
Python
mit
ueg1990/faker-schema
--- +++ @@ -0,0 +1,45 @@ +import contextlib +import json +import os +import tempfile +import unittest + +from faker_schema.schema_loader import load_json_from_file, load_json_from_string + + +class TestFakerSchema(unittest.TestCase): + + def test_load_json_from_string(self): + schema_json_string = '{"Full Name": "na...
b38edc2a192151324855d50e9e172f0fd96b9064
mda/finance.py
mda/finance.py
from __future__ import division import numpy as np import pandas as pd import urllib2 # __author__ = 'mattmcd' class LseReader: def __init__(self): dataLoc = '/home/mattmcd/Work/Data/' ftseFile = dataLoc + 'FTSE100.csv' self.ftse100 = pd.read_csv( ftseFile ) self.prefixURL = 'h...
Read prices from Google Finance
Read prices from Google Finance
Python
apache-2.0
mattmcd/PyAnalysis
--- +++ @@ -0,0 +1,23 @@ +from __future__ import division +import numpy as np +import pandas as pd +import urllib2 + +# __author__ = 'mattmcd' + + +class LseReader: + + def __init__(self): + dataLoc = '/home/mattmcd/Work/Data/' + ftseFile = dataLoc + 'FTSE100.csv' + + self.ftse100 = pd.read_c...
0dfe3084cf7d4832d14c027e646bfd74cc096177
mongonaut/views.py
mongonaut/views.py
from django.views.generic import DetailView from django.views.generic import ListView from mongonaut.sites import NautSite class IndexView(ListView): queryset = NautSite._registry.iteritems() template_name = "mongonaut/index.html" class AppListView(ListView): """ :args: <app_label> """ template_name...
import importlib from django.views.generic import DetailView from django.views.generic import ListView from mongonaut.sites import NautSite class IndexView(ListView): queryset = NautSite._registry.iteritems() template_name = "mongonaut/index.html" class AppListView(ListView): """ :args: <app_label> """ ...
Work on the document list view
Work on the document list view
Python
mit
jazzband/django-mongonaut,pydanny/django-mongonaut,jazzband/django-mongonaut,lchsk/django-mongonaut,jazzband/django-mongonaut,lchsk/django-mongonaut,pydanny/django-mongonaut,lchsk/django-mongonaut,pydanny/django-mongonaut
--- +++ @@ -1,3 +1,5 @@ +import importlib + from django.views.generic import DetailView from django.views.generic import ListView @@ -15,6 +17,23 @@ class DocumentListView(ListView): """ :args: <app_label> <document_name> """ template_name = "mongonaut/document_list.html" + queryset = [] + + ...
40f57a73adadf08e497464990a34860d03e04d39
mezzanine/core/urls.py
mezzanine/core/urls.py
from django.conf.urls.defaults import patterns, url from mezzanine.conf import settings urlpatterns = [] if "django.contrib.admin" in settings.INSTALLED_APPS: urlpatterns += patterns("django.contrib.auth.views", url("^password_reset/$", "password_reset", name="password_reset"), ("^password_rese...
from django.conf.urls.defaults import patterns, url from mezzanine.conf import settings urlpatterns = [] if "django.contrib.admin" in settings.INSTALLED_APPS: urlpatterns += patterns("django.contrib.auth.views", url("^password_reset/$", "password_reset", name="password_reset"), ("^password_rese...
Allow static proxy URL to be configured.
Allow static proxy URL to be configured.
Python
bsd-2-clause
scarcry/snm-mezzanine,vladir/mezzanine,fusionbox/mezzanine,jerivas/mezzanine,molokov/mezzanine,frankchin/mezzanine,adrian-the-git/mezzanine,fusionbox/mezzanine,mush42/mezzanine,damnfine/mezzanine,molokov/mezzanine,Kniyl/mezzanine,cccs-web/mezzanine,orlenko/sfpirg,sjdines/mezzanine,adrian-the-git/mezzanine,scarcry/snm-m...
--- +++ @@ -15,10 +15,12 @@ ("^reset/done/$", "password_reset_complete"), ) +_proxy_url = getattr(settings, "STATIC_PROXY_URL", "static_proxy").strip("/") + urlpatterns += patterns("mezzanine.core.views", url("^edit/$", "edit", name="edit"), url("^search/$", "search", name="search"), u...
d3367d32dbc080d8e963542351c427fe2da48f18
talempd/amazing/MaxProfit.py
talempd/amazing/MaxProfit.py
def maxprofit(stockvals): maxval, profit = 0, 0 for stockval in stockvals[::-1]: maxval = max(maxval, stockval) profit += maxval - stockval return profit stockvalues = [1, 3, 1, 2, 4] print "Profit was: " + str(maxprofit(stockvalues))
Change name for maxprofit in amazing
Change name for maxprofit in amazing
Python
mit
cc13ny/Allin,Chasego/cod,cc13ny/Allin,Chasego/codirit,cc13ny/Allin,Chasego/codi,cc13ny/algo,cc13ny/algo,Chasego/cod,Chasego/codi,cc13ny/Allin,cc13ny/algo,Chasego/cod,Chasego/codirit,cc13ny/algo,Chasego/codi,cc13ny/Allin,Chasego/codirit,cc13ny/algo,Chasego/cod,Chasego/codi,Chasego/codi,Chasego/codirit,Chasego/codirit,Ch...
--- +++ @@ -0,0 +1,9 @@ +def maxprofit(stockvals): + maxval, profit = 0, 0 + for stockval in stockvals[::-1]: + maxval = max(maxval, stockval) + profit += maxval - stockval + return profit + +stockvalues = [1, 3, 1, 2, 4] +print "Profit was: " + str(maxprofit(stockvalues))
272f285f1c9caa19c7c05bf92bd362cda9f762d1
experimental/directshow.py
experimental/directshow.py
#!/usr/bin/python # $Id:$ # Play an audio file with DirectShow. Tested ok with MP3, WMA, MID, WAV, AU. # Caveats: # - Requires a filename (not from memory or stream yet). Looks like we need # to manually implement a filter which provides an output IPin. Lot of # work. # - Theoretically can traverse the ...
Move win32 audio experiment to trunk.
Move win32 audio experiment to trunk.
Python
bsd-3-clause
mammadori/pyglet,oktayacikalin/pyglet,theblacklion/pyglet,theblacklion/pyglet,oktayacikalin/pyglet,oktayacikalin/pyglet,mammadori/pyglet,oktayacikalin/pyglet,oktayacikalin/pyglet,mammadori/pyglet,theblacklion/pyglet,theblacklion/pyglet,mammadori/pyglet,theblacklion/pyglet
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/python +# $Id:$ + +# Play an audio file with DirectShow. Tested ok with MP3, WMA, MID, WAV, AU. +# Caveats: +# - Requires a filename (not from memory or stream yet). Looks like we need +# to manually implement a filter which provides an output IPin. Lot of +# work. +# - The...
4af2f405c1c09737bdb32842f8e87a730d9bedd3
photutils/psf/building/epsf.py
photutils/psf/building/epsf.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tools to build an ePSF. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from astropy.modeling.fitting import LevMarLSQFitter from astropy.stats import SigmaClip __all__ = ['EPSFFitter...
Add initial EPSFBuilder and EPSFFitter classes
Add initial EPSFBuilder and EPSFFitter classes
Python
bsd-3-clause
astropy/photutils,larrybradley/photutils
--- +++ @@ -0,0 +1,57 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +""" +Tools to build an ePSF. +""" + +from __future__ import (absolute_import, division, print_function, + unicode_literals) + +from astropy.modeling.fitting import LevMarLSQFitter +from astropy.stats impo...
96af482f65385ebe9a4da1606d12875c7eaf320f
pombola/south_africa/management/commands/south_africa_restart_constituency_contacts.py
pombola/south_africa/management/commands/south_africa_restart_constituency_contacts.py
from datetime import date from optparse import make_option from django.core.management.base import NoArgsCommand, CommandError from django_date_extensions.fields import ApproximateDate from pombola.core.models import PositionTitle # A few days before the election: date_for_last_active_check = date(2014, 5, 1) # The ...
Add a script to restart constituency contact positions
Add a script to restart constituency contact positions We need this because it will be some time before we have new constituency contact information. It's reasonable to guess, however, that people who were previously MPs or MPLs and constituency contacts who have been re-elected will still be constituency contacts. ...
Python
agpl-3.0
hzj123/56th,geoffkilpin/pombola,patricmutwiri/pombola,patricmutwiri/pombola,ken-muturi/pombola,mysociety/pombola,geoffkilpin/pombola,hzj123/56th,hzj123/56th,patricmutwiri/pombola,mysociety/pombola,ken-muturi/pombola,mysociety/pombola,hzj123/56th,patricmutwiri/pombola,mysociety/pombola,hzj123/56th,geoffkilpin/pombola,ke...
--- +++ @@ -0,0 +1,76 @@ +from datetime import date +from optparse import make_option + +from django.core.management.base import NoArgsCommand, CommandError +from django_date_extensions.fields import ApproximateDate + +from pombola.core.models import PositionTitle + +# A few days before the election: +date_for_last_a...
0aa1f60fc00d488cf662f16cf966e7a6b6af43a0
scripts/collapse_xls_to_csv.py
scripts/collapse_xls_to_csv.py
#!/usr/bin/env python3 import os import logging import csv import argparse import xlrd logger = logging.getLogger() def main(args): infile_path = os.path.abspath(args.infile) if infile_path.endswith('.xls') or infile_path.endswith('.xlsx'): book = xlrd.open_workbook(infile_path) sheet_names...
Add script to convert a multi-sheet Excel to a single csv.
Add script to convert a multi-sheet Excel to a single csv.
Python
bsd-3-clause
dmc2015/hall-of-justice,dmc2015/hall-of-justice,sunlightlabs/hall-of-justice,dmc2015/hall-of-justice,sunlightlabs/hall-of-justice,sunlightlabs/hall-of-justice
--- +++ @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 + +import os +import logging +import csv +import argparse +import xlrd + +logger = logging.getLogger() + + +def main(args): + infile_path = os.path.abspath(args.infile) + + if infile_path.endswith('.xls') or infile_path.endswith('.xlsx'): + book = xlrd.ope...
4c008042d01be6020a863855f74d8ee931dab46e
pdsspect/transforms.py
pdsspect/transforms.py
from qtpy import QtWidgets from .pdsspect_image_set import PDSSpectImageSetViewBase class TransformsController(object): def __init__(self, image_set, view): self.image_set = image_set self.view = view def set_flip_x(self, flip_x): self.image_set.flip_x = flip_x def set_flip_y(s...
Handle flipping the image with checl boxes
Handle flipping the image with checl boxes
Python
bsd-3-clause
planetarypy/pdsspect
--- +++ @@ -0,0 +1,71 @@ +from qtpy import QtWidgets + +from .pdsspect_image_set import PDSSpectImageSetViewBase + + +class TransformsController(object): + + def __init__(self, image_set, view): + self.image_set = image_set + self.view = view + + def set_flip_x(self, flip_x): + self.image_s...
0cb5f00975570a115322ab028dcb93c92c2e0872
tests/packets/test_message.py
tests/packets/test_message.py
from cactusbot.packets import MessagePacket def _split(text, *args, **kwargs): return [ component.text for component in MessagePacket(text).split(*args, **kwargs) ] def test_split(): assert _split("0 1 2 3") == ['0', '1', '2', '3'] assert _split("0 1 2 3", "2") == ['0 1 ', ...
Add simple tests for MessagePacket
Add simple tests for MessagePacket Currently only MessagePacket.split(). Needs to be improved.
Python
mit
CactusDev/CactusBot
--- +++ @@ -0,0 +1,20 @@ +from cactusbot.packets import MessagePacket + + +def _split(text, *args, **kwargs): + return [ + component.text + for component in + MessagePacket(text).split(*args, **kwargs) + ] + + +def test_split(): + + assert _split("0 1 2 3") == ['0', '1', '2', '3'] + + ...
cd121a2466887999062e4e674998af971cd416e2
check-wayback-machine.py
check-wayback-machine.py
#!/usr/bin/env python3 from datetime import datetime, timezone, timedelta import json import re import sys import traceback import feeds import util import web_cache BLOG_POSTS = json.loads(util.get_file_text("blog.json")) for post in BLOG_POSTS: page_count = (len(post["comments"]) + 199) // 200 print("DEBU...
Add script to verify that all pages(+comments) are in the Internet Archive
Add script to verify that all pages(+comments) are in the Internet Archive
Python
mit
squirrel2038/thearchdruidreport-archive,squirrel2038/thearchdruidreport-archive,squirrel2038/thearchdruidreport-archive
--- +++ @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +from datetime import datetime, timezone, timedelta +import json +import re +import sys +import traceback + +import feeds +import util +import web_cache + + +BLOG_POSTS = json.loads(util.get_file_text("blog.json")) + +for post in BLOG_POSTS: + page_count = (len(post...
9fa3e7161764d1bc5a812bccc27837c9ddabef23
sleep_wake_hourly_pie_chart.py
sleep_wake_hourly_pie_chart.py
import plotly as py import plotly.graph_objs as go import plotly.tools as tools from datetime import datetime, time, timedelta from sys import argv import utils.names as names from utils.csvparser import parse from utils.exporter import export # load data from csv into an OrderedDict data_file = argv[1] raw_data = pa...
Add hourly sleep wake pie chart
Add hourly sleep wake pie chart
Python
mit
f-jiang/sleep-pattern-grapher
--- +++ @@ -0,0 +1,64 @@ +import plotly as py +import plotly.graph_objs as go +import plotly.tools as tools +from datetime import datetime, time, timedelta +from sys import argv + +import utils.names as names +from utils.csvparser import parse +from utils.exporter import export + +# load data from csv into an Ordered...
488cf1d22504346df0c4d4cebdb27e792d241c8d
learning/tests/test_dsbn.py
learning/tests/test_dsbn.py
import unittest import numpy as np import theano import theano.tensor as T import testing from test_rws import RWSLayerTest, RWSTopLayerTest # Unit Under Test from learning.dsbn import DSBN #----------------------------------------------------------------------------- class TestDSBN(RWSLayerTest, unittest.TestC...
Add unit test for DSBN
Add unit test for DSBN
Python
agpl-3.0
lenovor/reweighted-ws,yanweifu/reweighted-ws,skaasj/reweighted-ws,yanweifu/reweighted-ws,jbornschein/y2k,jbornschein/y2k,codeaudit/reweighted-ws,jbornschein/reweighted-ws,skaasj/reweighted-ws,lenovor/reweighted-ws,codeaudit/reweighted-ws,jbornschein/reweighted-ws
--- +++ @@ -0,0 +1,24 @@ +import unittest + +import numpy as np + +import theano +import theano.tensor as T + +import testing +from test_rws import RWSLayerTest, RWSTopLayerTest + +# Unit Under Test +from learning.dsbn import DSBN + +#----------------------------------------------------------------------------- + +...
09011ddc407ec5d9ff0535b043f9630fa76d2dfc
ELiDE/ELiDE/game.py
ELiDE/ELiDE/game.py
import os from importlib import import_module from kivy.properties import ( AliasProperty, ObjectProperty ) from kivy.app import App from kivy.uix.widget import Widget from kivy.uix.screenmanager import ScreenManager, Screen from LiSE.engine import Engine import LiSE.proxy class GameScreen(Screen): switch...
Implement App and Screen subclasses for developer's convenience
Implement App and Screen subclasses for developer's convenience
Python
agpl-3.0
LogicalDash/LiSE,LogicalDash/LiSE
--- +++ @@ -0,0 +1,85 @@ +import os +from importlib import import_module +from kivy.properties import ( + AliasProperty, + ObjectProperty +) +from kivy.app import App +from kivy.uix.widget import Widget +from kivy.uix.screenmanager import ScreenManager, Screen +from LiSE.engine import Engine +import LiSE.proxy ...
100e0a406551707e92826c2374f9c135613f6858
bin/index_to_contig.py
bin/index_to_contig.py
""" Given a tuple of index1, index2, correlation and a tuple of index, contig rewrite the correlation to be contig1, contig2, correlation """ import os import sys import argparse __author__ = 'Rob Edwards' if __name__ == "__main__": parser = argparse.ArgumentParser(description=' ') parser.add_argument('-i',...
Convert an index to a contig
Convert an index to a contig
Python
mit
linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab
--- +++ @@ -0,0 +1,46 @@ +""" +Given a tuple of index1, index2, correlation and a tuple of index, contig + +rewrite the correlation to be contig1, contig2, correlation +""" + +import os +import sys +import argparse + +__author__ = 'Rob Edwards' + +if __name__ == "__main__": + parser = argparse.ArgumentParser(descr...
733d24512b40bc5737704f715cea792fa5a702f0
script/covall.py
script/covall.py
#!/usr/bin/env python3 """ Parse a coverage.info file, and report success if all files have 100% test coverage. """ import sys if len(sys.argv) != 2: sys.exit("Usage: covall.py <file>") covinfo = sys.argv[1] COV = dict() with open(covinfo) as fin: for line in fin: if line.startswith("SF:"): ...
Add script to test for 100% coverage
Add script to test for 100% coverage
Python
apache-2.0
cjdrake/boolexpr,cjdrake/boolexpr
--- +++ @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 + +""" +Parse a coverage.info file, +and report success if all files have 100% test coverage. +""" + +import sys + +if len(sys.argv) != 2: + sys.exit("Usage: covall.py <file>") + +covinfo = sys.argv[1] + +COV = dict() + +with open(covinfo) as fin: + for line in f...
5622b1c0ad7708b1d3df72da9caa888d111f6156
greatbigcrane/job_queue/management/commands/job_server.py
greatbigcrane/job_queue/management/commands/job_server.py
import Queue import zmq addr = 'tcp://127.0.0.1:5555' from django.core.management.base import NoArgsCommand class Command(NoArgsCommand): def handle(self, **options): context = zmq.Context() socket = context.socket(zmq.REP) # Receives job requests from application server socket.bind(addr)...
Move the job server into a django management command.
Move the job server into a django management command.
Python
apache-2.0
pnomolos/greatbigcrane,pnomolos/greatbigcrane
--- +++ @@ -0,0 +1,29 @@ +import Queue +import zmq + +addr = 'tcp://127.0.0.1:5555' + +from django.core.management.base import NoArgsCommand + +class Command(NoArgsCommand): + def handle(self, **options): + context = zmq.Context() + socket = context.socket(zmq.REP) # Receives job requests from applic...
9539a6874af98e437cc17ba04c7f0bdfd0a81c5c
cltk/tokenize/utils.py
cltk/tokenize/utils.py
""" Tokenization utilities """ __author__ = ['Patrick J. Burns <patrick@diyclassics.org>'] __license__ = 'MIT License.' import pickle from abc import abstractmethod from nltk.tokenize.punkt import PunktSentenceTokenizer, PunktTrainer from nltk.tokenize.punkt import PunktLanguageVars from cltk.corpus.latin.readers i...
Add utilities file for tokenize
Add utilities file for tokenize
Python
mit
TylerKirby/cltk,diyclassics/cltk,TylerKirby/cltk,kylepjohnson/cltk,cltk/cltk,D-K-E/cltk
--- +++ @@ -0,0 +1,70 @@ +""" Tokenization utilities +""" + +__author__ = ['Patrick J. Burns <patrick@diyclassics.org>'] +__license__ = 'MIT License.' + +import pickle +from abc import abstractmethod + +from nltk.tokenize.punkt import PunktSentenceTokenizer, PunktTrainer +from nltk.tokenize.punkt import PunktLanguage...
5000a069b0a7ab32eefafc7acef64946450837cb
setup.py
setup.py
from setuptools import setup setup(name='', version='0.1', description='', url='', author='', author_email='', packages=[''], install_requires=[ 'numpy', 'biopython' ], zip_safe=False)
Test install numpy and biopython for RTD
Test install numpy and biopython for RTD
Python
mit
m4rx9/rna-pdb-tools,m4rx9/rna-pdb-tools
--- +++ @@ -0,0 +1,14 @@ +from setuptools import setup + +setup(name='', + version='0.1', + description='', + url='', + author='', + author_email='', + packages=[''], + install_requires=[ + 'numpy', + 'biopython' + ], + zip_safe=False)
bcbf11a44074d3c027d523e97d274f7838969d65
tests.py
tests.py
#!/usr/bin/python -O import sqlite3 from parser import SQLITE3_DB_NAME from random import randint, randrange def main(): """ Ouputs a random clue (with game ID) from 10 random games for checking. """ sql = sqlite3.connect(SQLITE3_DB_NAME) # list of random game id numbers gids = [randint(1, 3790) for i in xran...
Test to check the db.
Test to check the db.
Python
mit
whymarrh/jeopardy-parser,dangoldin/jeopardy-parser,dangoldin/jeopardy-parser
--- +++ @@ -0,0 +1,25 @@ +#!/usr/bin/python -O + +import sqlite3 +from parser import SQLITE3_DB_NAME +from random import randint, randrange + +def main(): + """ Ouputs a random clue (with game ID) from 10 random games for checking. """ + sql = sqlite3.connect(SQLITE3_DB_NAME) + # list of random game id numbers + ...
1cd9e2ececc47eddf5089596b35797ec4e7562de
test/merge_test.py
test/merge_test.py
import unittest, pyPdf, sys, os.path from mock import Mock SRC = os.path.join(os.path.dirname(__file__), '..', 'src') sys.path.append(SRC) import merge class MockPdfReader: def __init__(self): self.pages = [None] * 3 def getNumPages(self): return len(self.pages) def getPage(self, page_num): pass clas...
Create test class for merge function
Create test class for merge function
Python
bsd-2-clause
mgarriott/PDFMerger
--- +++ @@ -0,0 +1,44 @@ +import unittest, pyPdf, sys, os.path +from mock import Mock + +SRC = os.path.join(os.path.dirname(__file__), '..', 'src') +sys.path.append(SRC) +import merge + +class MockPdfReader: + def __init__(self): + self.pages = [None] * 3 + + def getNumPages(self): + return len(self.pages) + ...
8ed2ef198b5b28f7d4661ea9c50e5076273b6c97
CodeFights/alphabeticShift.py
CodeFights/alphabeticShift.py
#!/usr/local/bin/python # Code Fights Alternating Sums Problem def alphabeticShift(inputString): test = [chr((ord(c) - 96) % 26 + 97) for c in inputString] return ''.join(test) def main(): tests = [ ["crazy", "dsbaz"], ["z", "a"] ] for t in tests: res = alphabeticShift(t...
Solve Code Fights alphabetic shift problem
Solve Code Fights alphabetic shift problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,27 @@ +#!/usr/local/bin/python +# Code Fights Alternating Sums Problem + + +def alphabeticShift(inputString): + test = [chr((ord(c) - 96) % 26 + 97) for c in inputString] + return ''.join(test) + + +def main(): + tests = [ + ["crazy", "dsbaz"], + ["z", "a"] + ] + + for ...
a45d3def93e78d9fc26fadf27d83d5a4de44ddc4
playserver/trackchecker.py
playserver/trackchecker.py
from threading import Timer import track class TrackChecker(): currentSong = "" currentArtist = "" currentAlbum = "" timer = Timer(interval, checkSong) listeners = [] @staticmethod def checkSong(): song = track.getCurrentSong() artist = track.getCurrentArtist() album = track.getCurrentAlbum() if (son...
Add TrackChecker to allow checking of changing tracks
Add TrackChecker to allow checking of changing tracks
Python
mit
ollien/playserver,ollien/playserver,ollien/playserver
--- +++ @@ -0,0 +1,32 @@ +from threading import Timer +import track + + +class TrackChecker(): + + currentSong = "" + currentArtist = "" + currentAlbum = "" + timer = Timer(interval, checkSong) + listeners = [] + + @staticmethod + def checkSong(): + song = track.getCurrentSong() + artist = track.getCurrentArtist() ...
842064d8b4852232c19df9d176fb50a0c302d867
update-manifest.py
update-manifest.py
#!/usr/bin/env python import os import re repo = os.path.dirname(os.path.realpath(__file__)) code = 'android:versionCode="%s"' name = 'android:versionName="%s"' in_code = code % r'(\d+)' in_name = name % r'([^"]+)' new_code = None new_name = None for dirpath, dirnames, filenames in os.walk(repo): for filename i...
Add super-simple automatic AndroidManifest.xml updater.
Add super-simple automatic AndroidManifest.xml updater.
Python
apache-2.0
msdgwzhy6/ActionBarSherlock,caobaibing/ActionBarSherlock,msdgwzhy6/ActionBarSherlock,ubreader/ActionBarSherlock,msdgwzhy6/ActionBarSherlock,mercadolibre/ActionBarSherlock,mxn21/ActionBarSherlock,vimalrajpara2006/Lib-Droid-ActionbarSherlock,zhaokidd/ActionBarSherlock,zhupengGitHub/ActionBarSherlock,SpeedSolutions/Action...
--- +++ @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +import os +import re + +repo = os.path.dirname(os.path.realpath(__file__)) + +code = 'android:versionCode="%s"' +name = 'android:versionName="%s"' +in_code = code % r'(\d+)' +in_name = name % r'([^"]+)' +new_code = None +new_name = None + +for dirpath, dirnames, file...
c94aefed7b260b7ae05c56f02253cba44f03b602
scripts/migrate_boxfiles.py
scripts/migrate_boxfiles.py
import logging from website.app import init_app from website.addons.box.model import BoxFile from scripts import utils as scripts_utils logger = logging.getLogger(__name__) def main(): for file in BoxFile.find(): new_path = '/' + file.path.split('/')[1] logger.info(u'{} -> {}'.format(file.path, ...
Add a migration for box file guids
Add a migration for box file guids
Python
apache-2.0
brandonPurvis/osf.io,rdhyee/osf.io,mattclark/osf.io,alexschiller/osf.io,adlius/osf.io,TomHeatwole/osf.io,sbt9uc/osf.io,MerlinZhang/osf.io,petermalcolm/osf.io,mfraezz/osf.io,brandonPurvis/osf.io,aaxelb/osf.io,crcresearch/osf.io,sbt9uc/osf.io,adlius/osf.io,lyndsysimon/osf.io,ZobairAlijan/osf.io,cosenal/osf.io,laurenrever...
--- +++ @@ -0,0 +1,21 @@ +import logging +from website.app import init_app +from website.addons.box.model import BoxFile +from scripts import utils as scripts_utils + + +logger = logging.getLogger(__name__) + + +def main(): + for file in BoxFile.find(): + new_path = '/' + file.path.split('/')[1] + lo...
8db409d7d63135c81daa5cc556269599b362b525
affiliate-builder/build_recipes.py
affiliate-builder/build_recipes.py
from __future__ import (division, print_function, absolute_import, unicode_literals) from obvci.conda_tools.build_directory import Builder from prepare_packages import RECIPE_FOLDER, BINSTAR_CHANNEL def main(recipe_dir=RECIPE_FOLDER): builder = Builder(recipe_dir, BINSTAR_CHANNEL, 'main')...
Add script for building recipes
Add script for building recipes
Python
bsd-3-clause
astropy/conda-builder-affiliated,Cadair/conda-builder-affiliated,mwcraig/conda-builder-affiliated,kbarbary/conda-builder-affiliated,zblz/conda-builder-affiliated,kbarbary/conda-builder-affiliated,cdeil/conda-builder-affiliated,cdeil/conda-builder-affiliated,astropy/conda-build-tools,bmorris3/conda-builder-affiliated,Ca...
--- +++ @@ -0,0 +1,15 @@ +from __future__ import (division, print_function, absolute_import, + unicode_literals) + +from obvci.conda_tools.build_directory import Builder +from prepare_packages import RECIPE_FOLDER, BINSTAR_CHANNEL + + +def main(recipe_dir=RECIPE_FOLDER): + builder = Builder(...
3d04954345b15527707d119939b8f79a761e7782
pyaml.py
pyaml.py
import yaml sample_yaml_as_dict = ''' first_dict_key: some value second_dict_key: some other value ''' sample_yaml_as_list = ''' # Notice here how i don't need quotes. Read the wikipedia page for more info! - list item 1 - list item 2 ''' my_config_dict = yaml.load(sample_yaml_as_dict) print my_config_dict # Will pr...
Add yaml file to python dict example
Add yaml file to python dict example
Python
mit
voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts
--- +++ @@ -0,0 +1,28 @@ +import yaml + +sample_yaml_as_dict = ''' +first_dict_key: some value +second_dict_key: some other value +''' + +sample_yaml_as_list = ''' +# Notice here how i don't need quotes. Read the wikipedia page for more info! +- list item 1 +- list item 2 +''' + +my_config_dict = yaml.load(sample_yam...
0c0cbd2a289a651a5247b7c378d70370b76a35c2
app/soc/logic/helper/convert_db.py
app/soc/logic/helper/convert_db.py
#!/usr/bin/python2.5 # # Copyright 2008 the Melange authors. # # 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...
Add a script to normalize user accounts
Add a script to normalize user accounts Patch by: Sverre Rabbelier --HG-- extra : convert_revision : svn%3A32761e7d-7263-4528-b7be-7235b26367ec/trunk%402240
Python
apache-2.0
rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son
--- +++ @@ -0,0 +1,46 @@ +#!/usr/bin/python2.5 +# +# Copyright 2008 the Melange authors. +# +# 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...
55d299d88358bd1e106e96b4475a268cdfe581fb
setup.py
setup.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 OpenStack LLC. # 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/...
Split functions to avoid eventlet import.
Split functions to avoid eventlet import. Some of these functions are used in setup.py. In a virtualenv based workflow, python setup.py sdist is called to create a tarball which is then installed into the virtualenv. These functions need to be in a separate file so that they can be imported by setup.py without eventle...
Python
apache-2.0
openstack-attic/oslo.version,emonty/oslo.version
--- +++ @@ -0,0 +1,42 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2011 OpenStack LLC. +# 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...
3b79b49b08c35a1e8d57fa9774027bdeda4e8e83
test_transformations.py
test_transformations.py
import unittest from transformations import drop_vowel, words_with_ck, repeat_to_single, vowel_expand, get_matched_letters_indices, l33t class MyTestCase(unittest.TestCase): def test_drop_one_vowel(self): bad_words = drop_vowel('duck') expected = ['duck', 'dck'] self.assertEquals(expected...
Add tests for transformation functions
Add tests for transformation functions
Python
apache-2.0
JeffSpies/nonwordlist,CenterForOpenScience/guid-filter
--- +++ @@ -0,0 +1,58 @@ +import unittest +from transformations import drop_vowel, words_with_ck, repeat_to_single, vowel_expand, get_matched_letters_indices, l33t + + +class MyTestCase(unittest.TestCase): + + def test_drop_one_vowel(self): + bad_words = drop_vowel('duck') + expected = ['duck', 'dck'...
7a9772952b5a6b39986b9a705ac7bbaf2810de91
python/prm_fhir/extractors.py
python/prm_fhir/extractors.py
""" ### CODE OWNERS: Shea Parkes ### OBJECTIVE: Extraction methods for relevant items. ### DEVELOPER NOTES: <none> """ import typing from collections import OrderedDict from fhirclient.client import FHIRClient # ============================================================================= # LIBRARIES, LOCATION...
Put up a structure to extraction library.
Put up a structure to extraction library. Do this so we have a skelton to fill in.
Python
mit
IndyActuaries/epic-fhir,IndyActuaries/epic-fhir
--- +++ @@ -0,0 +1,45 @@ +""" +### CODE OWNERS: Shea Parkes + +### OBJECTIVE: + Extraction methods for relevant items. + +### DEVELOPER NOTES: + <none> +""" + +import typing +from collections import OrderedDict + +from fhirclient.client import FHIRClient + +# ========================================================...
847f38e75e4ec79dbdd10a9627ec6b5a15ba2e41
tests/seat_map_test.py
tests/seat_map_test.py
import unittest import datetime import json import sys sys.path.append('..') import sabre_dev_studio import sabre_dev_studio.sabre_exceptions as sabre_exceptions ''' requires config.json in the same directory for api authentication { "sabre_client_id": -----, "sabre_client_secret": ----- } ''' class TestBasicSeat...
Add tests for seat map
Add tests for seat map
Python
mit
Jamil/sabre_dev_studio
--- +++ @@ -0,0 +1,85 @@ +import unittest +import datetime +import json +import sys + +sys.path.append('..') +import sabre_dev_studio +import sabre_dev_studio.sabre_exceptions as sabre_exceptions + +''' +requires config.json in the same directory for api authentication + +{ + "sabre_client_id": -----, + "sabre_client...
1455d5109efb64aa1c2579a97c0d84a60da22708
EDMScripts/test_rotator.py
EDMScripts/test_rotator.py
# Import a whole load of stuff from System.IO import * from System.Drawing import * from System.Runtime.Remoting import * from System.Threading import * from System.Windows.Forms import * from System.Xml.Serialization import * from System import * from Analysis.EDM import * from DAQ.Environment import * fro...
Add a script to test the Thorlabs polarization rotator.
Add a script to test the Thorlabs polarization rotator.
Python
mit
ColdMatter/EDMSuite,jstammers/EDMSuite,jstammers/EDMSuite,jstammers/EDMSuite,ColdMatter/EDMSuite,ColdMatter/EDMSuite,Stok/EDMSuite,Stok/EDMSuite,jstammers/EDMSuite,jstammers/EDMSuite,ColdMatter/EDMSuite
--- +++ @@ -0,0 +1,29 @@ +# Import a whole load of stuff +from System.IO import * +from System.Drawing import * +from System.Runtime.Remoting import * +from System.Threading import * +from System.Windows.Forms import * +from System.Xml.Serialization import * +from System import * + +from Analysis.EDM import * +from D...
8b4e49f5aae691a5b3f3b77190356f70f9f23bb8
src/project/word2vec_corpus.py
src/project/word2vec_corpus.py
import sys from os.path import isdir, isfile from corpus import Corpus class W2VCorpus(Corpus): def __init__(self, dict_loc, vec_loc): Corpus.__init__(self) Corpus.load(self, dict_loc, vec_loc) # Set up for Word-to-Vec return def main(): if len(sys.argv) > 2 and isdir(sys.ar...
Add basic framework for W2V
Add basic framework for W2V
Python
mit
PinPinIre/Final-Year-Project,PinPinIre/Final-Year-Project,PinPinIre/Final-Year-Project
--- +++ @@ -0,0 +1,24 @@ +import sys +from os.path import isdir, isfile +from corpus import Corpus + + +class W2VCorpus(Corpus): + + def __init__(self, dict_loc, vec_loc): + Corpus.__init__(self) + Corpus.load(self, dict_loc, vec_loc) + # Set up for Word-to-Vec + return + + +def main():...
8a3b9c2b3a25bda85cf3d961758a986dbdc19084
tests/test_advection.py
tests/test_advection.py
from parcels import Grid, Particle, JITParticle, AdvectionRK4, Geographic, GeographicPolar import numpy as np import pytest from datetime import timedelta as delta ptype = {'scipy': Particle, 'jit': JITParticle} @pytest.fixture def lon(xdim=200): return np.linspace(-170, 170, xdim, dtype=np.float32) @pytest.f...
Add a set of advection tests for meridional and zonal advection
Tests: Add a set of advection tests for meridional and zonal advection
Python
mit
OceanPARCELS/parcels,OceanPARCELS/parcels
--- +++ @@ -0,0 +1,52 @@ +from parcels import Grid, Particle, JITParticle, AdvectionRK4, Geographic, GeographicPolar +import numpy as np +import pytest +from datetime import timedelta as delta + + +ptype = {'scipy': Particle, 'jit': JITParticle} + + +@pytest.fixture +def lon(xdim=200): + return np.linspace(-170, 1...
ff0fa3d3aaa7de147571330a16895befb272440a
mongoshell.py
mongoshell.py
#! /usr/bin/env python from os import environ from subprocess import check_call from urlparse import urlparse if 'MONGOLAB_URI' in environ: print 'Using', environ['MONGOLAB_URI'] url = urlparse(environ['MONGOLAB_URI']) cmd = 'mongo -u %s -p %s %s:%d/%s' % (url.username, ...
Add script to run a mongo shell in the MongoLab environment
Add script to run a mongo shell in the MongoLab environment
Python
bsd-3-clause
taarifa/taarifa_backend,taarifa/taarifa_backend,taarifa/taarifa_backend,taarifa/taarifa_backend
--- +++ @@ -0,0 +1,17 @@ +#! /usr/bin/env python + +from os import environ +from subprocess import check_call +from urlparse import urlparse + +if 'MONGOLAB_URI' in environ: + print 'Using', environ['MONGOLAB_URI'] + url = urlparse(environ['MONGOLAB_URI']) + cmd = 'mongo -u %s -p %s %s:%d/%s' % (url.username...
c8f3e1149d8fa7ed4e402fc655cb13758f7f28c7
services/comprehension/main-api/comprehension/management/commands/pre_filter_responses.py
services/comprehension/main-api/comprehension/management/commands/pre_filter_responses.py
import csv from django.core.management.base import BaseCommand from ...views.plagiarism import PlagiarismFeedbackView class Command(BaseCommand): help = 'Parses a CSV for feedback records' def add_arguments(self, parser): parser.add_argument('passage_source', metavar='PASSAGE_SOURCE', ...
Add a command to filter responses for plagiarism
Add a command to filter responses for plagiarism
Python
agpl-3.0
empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core
--- +++ @@ -0,0 +1,38 @@ +import csv + +from django.core.management.base import BaseCommand + +from ...views.plagiarism import PlagiarismFeedbackView + + +class Command(BaseCommand): + help = 'Parses a CSV for feedback records' + + def add_arguments(self, parser): + parser.add_argument('passage_source', ...
60e31ba20a596346031396fcd34796dc96f9ffdf
kolibri/content/migrations/0009_auto_20180410_1139.py
kolibri/content/migrations/0009_auto_20180410_1139.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.11 on 2018-04-10 18:39 from __future__ import unicode_literals from django.db import migrations from django.db import models class Migration(migrations.Migration): dependencies = [ ('content', '0008_contentnode_coach_content'), ] operations = [...
Add epub to file preset and localfile extension
Add epub to file preset and localfile extension
Python
mit
lyw07/kolibri,DXCanas/kolibri,mrpau/kolibri,benjaoming/kolibri,learningequality/kolibri,indirectlylit/kolibri,benjaoming/kolibri,learningequality/kolibri,jonboiser/kolibri,learningequality/kolibri,indirectlylit/kolibri,jonboiser/kolibri,indirectlylit/kolibri,mrpau/kolibri,DXCanas/kolibri,indirectlylit/kolibri,jonboiser...
--- +++ @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.11 on 2018-04-10 18:39 +from __future__ import unicode_literals + +from django.db import migrations +from django.db import models + + +class Migration(migrations.Migration): + + dependencies = [ + ('content', '0008_contentnode_coa...
0add6b09c268b87a9f7007f80934418cbdee6d2c
ci/generate_universe_resource.py
ci/generate_universe_resource.py
#!/usr/bin/env python3 # Usage example: # ./generate_universe_resource.py dcos-core-cli 1.12-patch.2 import json import sys import hashlib as hash import requests plugin_name = sys.argv[1] plugin_version = sys.argv[2] resource = { "cli": { "binaries": {} } } for platform in ['linux', 'darwin', 'windo...
Add a script to generate a universe resource
Add a script to generate a universe resource The generate_universe_resource.py script can be used to generate resource files for universe. It takes as argument a plugin name and a version and uses them to download the plugins from their canonical URLs and generate sha256 checksums accordingly. https://jira.mesosphere...
Python
apache-2.0
kensipe/dcos-cli,kensipe/dcos-cli,dcos/dcos-cli,dcos/dcos-cli,dcos/dcos-cli,dcos/dcos-cli,dcos/dcos-cli,kensipe/dcos-cli,kensipe/dcos-cli,kensipe/dcos-cli
--- +++ @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 + +# Usage example: +# ./generate_universe_resource.py dcos-core-cli 1.12-patch.2 + +import json +import sys +import hashlib as hash + +import requests + + +plugin_name = sys.argv[1] +plugin_version = sys.argv[2] + +resource = { + "cli": { + "binaries": {} + }...
5b1a84a73abc6fc95d453cfbb78cf58bfc9c8310
setup.py
setup.py
from __future__ import print_function from os import sys, path try: from skbuild import setup except ImportError: print('scikit-build is required to build from source.', file=sys.stderr) print('Please run:', file=sys.stderr) print('', file=sys.stderr) print(' python -m pip install scikit-build') ...
Add initial Python package configuration
ENH: Add initial Python package configuration
Python
apache-2.0
InsightSoftwareConsortium/ITKTextureFeatures,InsightSoftwareConsortium/ITKTextureFeatures
--- +++ @@ -0,0 +1,53 @@ +from __future__ import print_function +from os import sys, path + +try: + from skbuild import setup +except ImportError: + print('scikit-build is required to build from source.', file=sys.stderr) + print('Please run:', file=sys.stderr) + print('', file=sys.stderr) + print(' p...
3bf5f09f61cfe3e1bd4d8c736a014f05c1bd940e
tests/test_sqlcache.py
tests/test_sqlcache.py
from botbot import sqlcache import os from itertools import combinations from string import ascii_letters def get_dbpath(): return os.path.join('.', 'test.db') def test_FileDatabase_constructor(tmpdir): prev = tmpdir.chdir() f = sqlcache.FileDatabase(get_dbpath()) assert f prev.chdir() def test...
Add new tests for sqlcache.py
Add new tests for sqlcache.py
Python
mit
jackstanek/BotBot,jackstanek/BotBot
--- +++ @@ -0,0 +1,34 @@ +from botbot import sqlcache + +import os +from itertools import combinations +from string import ascii_letters + +def get_dbpath(): + return os.path.join('.', 'test.db') + +def test_FileDatabase_constructor(tmpdir): + prev = tmpdir.chdir() + + f = sqlcache.FileDatabase(get_dbpath())...
269a40987bcda02109ea9b53157056c43ff6ab58
demo_zinnia_ckeditor/urls.py
demo_zinnia_ckeditor/urls.py
"""Urls for the zinnia-ckeditor demo""" from django.conf import settings from django.contrib import admin from django.conf.urls import url from django.conf.urls import include from django.conf.urls import patterns from django.views.generic.base import RedirectView from zinnia.sitemaps import TagSitemap from zinnia.sit...
Add URLs for demo project
Add URLs for demo project
Python
bsd-3-clause
django-blog-zinnia/zinnia-wysiwyg-ckeditor
--- +++ @@ -0,0 +1,54 @@ +"""Urls for the zinnia-ckeditor demo""" +from django.conf import settings +from django.contrib import admin +from django.conf.urls import url +from django.conf.urls import include +from django.conf.urls import patterns +from django.views.generic.base import RedirectView + +from zinnia.sitema...
7ee31b444556a70fb1d6fca27545ad1fbc317347
paasta_tools/contrib/add_to_deploy_queue.py
paasta_tools/contrib/add_to_deploy_queue.py
#!/usr/bin/env python # Copyright 2015-2020 Yelp Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Add script to add an arbitrary service instance to the deploy_queue
Add script to add an arbitrary service instance to the deploy_queue
Python
apache-2.0
Yelp/paasta,Yelp/paasta
--- +++ @@ -0,0 +1,85 @@ +#!/usr/bin/env python +# Copyright 2015-2020 Yelp Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# ...
d2ff3f0905ded1dcbffd7ebd9cada423d44767d6
py/4sum-ii.py
py/4sum-ii.py
from collections import Counter class Solution(object): def fourSumCount(self, A, B, C, D): """ :type A: List[int] :type B: List[int] :type C: List[int] :type D: List[int] :rtype: int """ count1 = Counter() for a in A: for b in B: ...
Add py solution for 454. 4Sum II
Add py solution for 454. 4Sum II 454. 4Sum II: https://leetcode.com/problems/4sum-ii/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,19 @@ +from collections import Counter +class Solution(object): + def fourSumCount(self, A, B, C, D): + """ + :type A: List[int] + :type B: List[int] + :type C: List[int] + :type D: List[int] + :rtype: int + """ + count1 = Counter() + ...
a807dcac9c69ec6769f233f9ea8be3dfd06f43c4
elections/kenya/data/update_csv.py
elections/kenya/data/update_csv.py
#!/usr/bin/env python import requests URLS = ( ('2017_candidates_presidency.csv', 'https://docs.google.com/a/mysociety.org/spreadsheets/d/10RBG4fIluYn2jBgCRBBQ--6yHTtppYrB2ef-zpmVxhE/export?format=csv'), ('2017_candidates_senate.csv', 'https://docs.google.com/a/mysociety.org/spreadsheets/d/1x3_otOE...
Add a script for updating the CSV files
Add a script for updating the CSV files
Python
agpl-3.0
mysociety/yournextmp-popit,mysociety/yournextmp-popit,mysociety/yournextmp-popit,mysociety/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextmp-popit,mysociety/yournextmp-popit,mysociety/yournextrepresentative,mysociety/yournextrepresentative
--- +++ @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +import requests + + +URLS = ( + ('2017_candidates_presidency.csv', + 'https://docs.google.com/a/mysociety.org/spreadsheets/d/10RBG4fIluYn2jBgCRBBQ--6yHTtppYrB2ef-zpmVxhE/export?format=csv'), + ('2017_candidates_senate.csv', + 'https://docs.google.com/a/...
2d1dcb334a8fec45f3abe11c13d1649a18e3033d
shuup/core/migrations/0087_fix_attribute_migration.py
shuup/core/migrations/0087_fix_attribute_migration.py
# Generated by Django 2.2.19 on 2021-05-03 20:51 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('shuup', '0086_attribute_choices'), ] operations = [ migrations.AlterField( model_name='attribute', name='max_choice...
Make sure there is no pending migrations
Make sure there is no pending migrations
Python
agpl-3.0
shoopio/shoop,shoopio/shoop,shoopio/shoop
--- +++ @@ -0,0 +1,23 @@ +# Generated by Django 2.2.19 on 2021-05-03 20:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('shuup', '0086_attribute_choices'), + ] + + operations = [ + migrations.AlterField( + model_name=...
ee0cda1dea775e58e5416b57fc0d96114f075128
tests/unit/test_repr.py
tests/unit/test_repr.py
from butter.eventfd import Eventfd from butter.fanotify import Fanotify from butter.inotify import Inotify from butter.signalfd import Signalfd from butter.timerfd import Timerfd import pytest @pytest.fixture(params=[Eventfd, Fanotify, Inotify, Signalfd, Timerfd]) def obj(request): Obj = request.param o = Obj...
Test the repr() of object
Test the repr() of object
Python
bsd-3-clause
wdv4758h/butter,dasSOZO/python-butter
--- +++ @@ -0,0 +1,33 @@ +from butter.eventfd import Eventfd +from butter.fanotify import Fanotify +from butter.inotify import Inotify +from butter.signalfd import Signalfd +from butter.timerfd import Timerfd +import pytest + + +@pytest.fixture(params=[Eventfd, Fanotify, Inotify, Signalfd, Timerfd]) +def obj(request)...
28af24002e410c27d5d09c301bd8b8b6bf4683dd
meanrecipes/sources.py
meanrecipes/sources.py
#!/usr/bin/env python3 import random class Recipe: ''' Represents an individual recipe, made up of the following attributes: * title A string containing a human-readable title or name for the recipe. * ingredients An iterable of tuples (quantity, unit, name) describing the ingredi...
Add recipe & source base classes and fake recipe generator
Add recipe & source base classes and fake recipe generator
Python
bsd-2-clause
kkelk/MeanRecipes,kkelk/MeanRecipes,kkelk/MeanRecipes,kkelk/MeanRecipes
--- +++ @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 +import random + +class Recipe: + ''' + Represents an individual recipe, made up of the following attributes: + + * title + A string containing a human-readable title or name for the recipe. + + * ingredients + An iterable of tuples (quant...
92171a1bbccdfac0fd962f046f72faa681244c98
src/txkube/test/_compat.py
src/txkube/test/_compat.py
# Copyright Least Authority Enterprises. # See LICENSE for details. """ Helpers for Python 2/3 compatibility. """ from twisted.python.compat import _PY3 def encode_environ(env): """ Convert a ``dict`` of ``unicode`` keys and values to ``bytes`` on Python 2, but return the ``dict`` unmodified on Python 3....
Add helper for Python 2/3 compatibility.
Add helper for Python 2/3 compatibility.
Python
mit
LeastAuthority/txkube
--- +++ @@ -0,0 +1,21 @@ +# Copyright Least Authority Enterprises. +# See LICENSE for details. + +""" +Helpers for Python 2/3 compatibility. +""" + +from twisted.python.compat import _PY3 + +def encode_environ(env): + """ + Convert a ``dict`` of ``unicode`` keys and values to ``bytes`` on Python 2, + but ret...
70e55da36982217e5bcd983128a984be1aae84ab
util/timeline_adjust.py
util/timeline_adjust.py
#!/usr/bin/python from __future__ import print_function import argparse import re time_re = re.compile(r"^\s*#?\s*([0-9]+(?:\.[0-9]+)?)\s+\"") first_num_re = re.compile(r"([0-9]+(?:\.[0-9]+)?)") def adjust_lines(lines, adjust): for line in lines: match = re.match(time_re, line) if match: time = float...
Add python utility to adjust timelines
Add python utility to adjust timelines It's kind of a pain to adjust all the times in a file or a section by a particular amount, so this python file will do it for you.
Python
apache-2.0
quisquous/cactbot,quisquous/cactbot,sqt/cactbot,sqt/cactbot,quisquous/cactbot,sqt/cactbot,quisquous/cactbot,sqt/cactbot,quisquous/cactbot,quisquous/cactbot,sqt/cactbot
--- +++ @@ -0,0 +1,32 @@ +#!/usr/bin/python +from __future__ import print_function +import argparse +import re + +time_re = re.compile(r"^\s*#?\s*([0-9]+(?:\.[0-9]+)?)\s+\"") +first_num_re = re.compile(r"([0-9]+(?:\.[0-9]+)?)") + + +def adjust_lines(lines, adjust): + for line in lines: + match = re.match(time_re,...
804086ef7fe50d8b710406dd0efb614733779912
iati/core/tests/test_validate.py
iati/core/tests/test_validate.py
"""A module containing tests for the library representation of validation.""" valid_xml = """ <?xml version="1.0"?> <iati-activities version="2.02"> <iati-activity> <iati-identifier></iati-identifier> <reporting-org type="40" ref="AA-AAA-123456789"> <narrative>Organisation name</narrative> </repo...
Add valid and invalid xml Invalid XML is currently only invalid due to an incorrect version number.
Add valid and invalid xml Invalid XML is currently only invalid due to an incorrect version number.
Python
mit
IATI/iati.core,IATI/iati.core
--- +++ @@ -0,0 +1,46 @@ +"""A module containing tests for the library representation of validation.""" + + +valid_xml = """ +<?xml version="1.0"?> + +<iati-activities version="2.02"> + <iati-activity> + <iati-identifier></iati-identifier> + <reporting-org type="40" ref="AA-AAA-123456789"> + <narrative>Or...
979347a3af800229701d3a48ea2ca5e9aec709df
faq/migrations/0001_initial.py
faq/migrations/0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Questions', fields=[ ('id', models.AutoField(pr...
Create migration for the models.
Create migration for the models.
Python
bsd-3-clause
donnywdavis/Django-faq-views,donnywdavis/Django-faq-views
--- +++ @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Questions', + fields=[ ...
894cbd1f7439fd6aca5a2f54a8111d22143c10f8
package/segmenter.py
package/segmenter.py
import copy import package.app as app import cv2 import numpy as np from package.image import Image, CS_BGR __author__ = 'luigolas' class Segmenter(): compatible_color_spaces = [] def segment(self, image): """ :param image: :raise NotImplementedError: """ raise NotIm...
Add Segmenter. Not working yet
Add Segmenter. Not working yet
Python
mit
Luigolas/PyReID
--- +++ @@ -0,0 +1,76 @@ +import copy +import package.app as app +import cv2 +import numpy as np +from package.image import Image, CS_BGR + +__author__ = 'luigolas' + + +class Segmenter(): + compatible_color_spaces = [] + + def segment(self, image): + """ + + :param image: + :raise NotImple...
3c898782f8b51c4af9bff2c566adb80c1f740e53
lintcode/Medium/120_Word_Ladder.py
lintcode/Medium/120_Word_Ladder.py
class Solution: # @param start, a string # @param end, a string # @param dict, a set of string # @return an integer def ladderLength(self, start, end, dict): # write your code here queue = [start] level = 1 levelIndex = 0 dict.add(end) while (queue): ...
Add solution to lintcode question 120
Add solution to lintcode question 120
Python
mit
Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode
--- +++ @@ -0,0 +1,28 @@ +class Solution: + # @param start, a string + # @param end, a string + # @param dict, a set of string + # @return an integer + def ladderLength(self, start, end, dict): + # write your code here + queue = [start] + level = 1 + levelIndex = 0 + ...
c891fd7fb399c5b1730eef33ccea12770c28b2fd
setup.py
setup.py
from distutils.core import setup setup(name='dimreducer', version='1.0', description='Dimension reduction methods', py_modules=['dimreducer'], ) setup(name='multiphenotype_utils', version='1.0', description='Utility functions for all methods', py_modules=['multiphenotype_utils...
Add simple distutils script for modules
Add simple distutils script for modules
Python
mit
epierson9/multiphenotype_methods
--- +++ @@ -0,0 +1,37 @@ +from distutils.core import setup + +setup(name='dimreducer', + version='1.0', + description='Dimension reduction methods', + py_modules=['dimreducer'], + ) + +setup(name='multiphenotype_utils', + version='1.0', + description='Utility functions for all methods', +...
8fa6beb9bd3fe866be11c97bed4fbe2532198dfc
ingestor/ingest_from_yaml.py
ingestor/ingest_from_yaml.py
import click import os import os.path import yaml from create_tiles import calc_target_names, create_tiles from geotiff_to_netcdf import create_or_replace from pprint import pprint def read_yaml(filename): with open(filename) as f: data = yaml.load(f) return data def get_input_files(input_file,...
Add new command line tool for injesting from YAML description to NetCDF
Add new command line tool for injesting from YAML description to NetCDF
Python
bsd-3-clause
omad/datacube-experiments
--- +++ @@ -0,0 +1,58 @@ + +import click +import os +import os.path +import yaml +from create_tiles import calc_target_names, create_tiles +from geotiff_to_netcdf import create_or_replace +from pprint import pprint + + +def read_yaml(filename): + with open(filename) as f: + data = yaml.load(f) + retu...
ae15b8db30d726990b3ba2ee1885e093b0b933bf
tests/test_core/test_compoundgenerator_performance.py
tests/test_core/test_compoundgenerator_performance.py
import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "..")) import unittest import time from test_util import ScanPointGeneratorTest from scanpointgenerator import CompoundGenerator from scanpointgenerator import LineGenerator from scanpointgenerator import SpiralGenerator from scanpointgenerat...
Add time-sensitive test for compound generator for a large scan.
Add time-sensitive test for compound generator for a large scan. Tests that point preparation for ~100 million points (before region filtering) happens within a few seconds.
Python
apache-2.0
dls-controls/scanpointgenerator
--- +++ @@ -0,0 +1,50 @@ +import os +import sys +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import unittest +import time + +from test_util import ScanPointGeneratorTest +from scanpointgenerator import CompoundGenerator +from scanpointgenerator import LineGenerator +from scanpointgenerator import ...
5898822218500487419256676ac57c70a7d40367
py/2-keys-keyboard.py
py/2-keys-keyboard.py
class Solution(object): def minSteps(self, n): """ :type n: int :rtype: int """ ans = [n] * (n + 1) ans[1] = 0 for i in xrange(1, n + 1): for j in xrange(2, n / i + 1): ans[j * i] = min(ans[i] + j, ans[j * i]) return ans[n]
Add py solution for 650. 2 Keys Keyboard
Add py solution for 650. 2 Keys Keyboard 650. 2 Keys Keyboard: https://leetcode.com/problems/2-keys-keyboard/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,12 @@ +class Solution(object): + def minSteps(self, n): + """ + :type n: int + :rtype: int + """ + ans = [n] * (n + 1) + ans[1] = 0 + for i in xrange(1, n + 1): + for j in xrange(2, n / i + 1): + ans[j * i] = min(ans[i] +...
44971ec8f96302a04dbb9d4e66299462f245fb1d
bin/aggregate_metrics.py
bin/aggregate_metrics.py
import sys import csv import os SRC_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + '/src' sys.path.append(SRC_DIR) from aggregator import ReportAggregator def check_arguments(): if len(sys.argv) != 2: print 'usage: aggregate_metrics.py <data directory>\n' print ' data direc...
Add script to aggregate metrics
Add script to aggregate metrics
Python
mit
Datafable/gbif-dataset-metrics,Datafable/gbif-dataset-metrics,Datafable/gbif-dataset-metrics
--- +++ @@ -0,0 +1,44 @@ +import sys +import csv +import os +SRC_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + '/src' +sys.path.append(SRC_DIR) +from aggregator import ReportAggregator + +def check_arguments(): + if len(sys.argv) != 2: + print 'usage: aggregate_metrics.py <data direct...
800e5514d0e641a09a3539c6425309e1f149621b
scripts/validate_pccora_filename_dates.py
scripts/validate_pccora_filename_dates.py
#!/usr/bin/env python3 import glob import sys, os sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'pccora')) from pccora import * def dump_values(obj): for key in obj: print("%s -> %s" % (key, obj[key])) def dump_array_values(obj): i = 0 for container in obj: print("### Item %d" % (i+1)) for k...
Add script to validate identification section date and filename date
Add script to validate identification section date and filename date
Python
mit
kinow/pccora
--- +++ @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 + +import glob +import sys, os +sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'pccora')) +from pccora import * + +def dump_values(obj): + for key in obj: + print("%s -> %s" % (key, obj[key])) + +def dump_array_values(obj): + i = 0 + for container in ob...
a20f2077ef910a930508a5ed1e5e598b66db3b03
ckanext/dataviewanalytics/db.py
ckanext/dataviewanalytics/db.py
'''Models definition for database tables creation ''' from ckan.common import config from sqlalchemy import (Column, Integer, String, ForeignKey, create_engine, types) from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base from ckan import model from ckan.model import user_tabl...
Write models for analytics tables
Write models for analytics tables
Python
agpl-3.0
shemogumbe/ckanext-dataviewanalytics,shemogumbe/ckanext-dataviewanalytics,shemogumbe/ckanext-dataviewanalytics
--- +++ @@ -0,0 +1,50 @@ +'''Models definition for database tables creation +''' + +from ckan.common import config +from sqlalchemy import (Column, Integer, String, ForeignKey, create_engine, types) +from sqlalchemy.orm import sessionmaker +from sqlalchemy.ext.declarative import declarative_base +from ckan import mod...
798394af2580cc755dac4d70892c150bc0e69d32
config/andrew_list_violation.py
config/andrew_list_violation.py
from experiment_config_lib import ControllerConfig from sts.topology import MeshTopology from sts.control_flow import Fuzzer from sts.input_traces.input_logger import InputLogger from sts.invariant_checker import InvariantChecker from sts.simulation_state import SimulationConfig # Use POX as our controller command_lin...
Add configuration file for Andrew to test changes on
Add configuration file for Andrew to test changes on
Python
apache-2.0
jmiserez/sts,ucb-sts/sts,ucb-sts/sts,jmiserez/sts
--- +++ @@ -0,0 +1,23 @@ +from experiment_config_lib import ControllerConfig +from sts.topology import MeshTopology +from sts.control_flow import Fuzzer +from sts.input_traces.input_logger import InputLogger +from sts.invariant_checker import InvariantChecker +from sts.simulation_state import SimulationConfig + +# Us...
0032cfba11665de9200410cc132eb8aa368c7601
conveyor/utils.py
conveyor/utils.py
class DictDiffer(object): """ Calculate the difference between two dictionaries as: (1) items added (2) items removed (3) keys same in both but changed values (4) keys same in both and unchanged values """ def __init__(self, current_dict, past_dict): self.curren...
Add a utility for diffing dicts
Add a utility for diffing dicts
Python
bsd-2-clause
crateio/carrier
--- +++ @@ -0,0 +1,26 @@ +class DictDiffer(object): + """ + Calculate the difference between two dictionaries as: + + (1) items added + (2) items removed + (3) keys same in both but changed values + (4) keys same in both and unchanged values + """ + + def __init__(self, current...
f073437f02737568b7d12cba6050afda92933a87
docs/source/conf.py
docs/source/conf.py
# vim:fileencoding=utf-8:noet from __future__ import (unicode_literals, division, absolute_import, print_function) import os import sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(os.getcwd())))) sys.path.insert(0, os.path.abspath(os.getcwd())) extensions = ['powerline_autodoc', 'sphinx.ext.t...
# vim:fileencoding=utf-8:noet from __future__ import (unicode_literals, division, absolute_import, print_function) import os import sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(os.getcwd())))) sys.path.insert(0, os.path.abspath(os.getcwd())) extensions = ['powerline_autodoc', 'sphinx.ext.t...
Remove the only remaining reference to `u'` string prefix
Remove the only remaining reference to `u'` string prefix
Python
mit
DoctorJellyface/powerline,lukw00/powerline,cyrixhero/powerline,bezhermoso/powerline,QuLogic/powerline,Luffin/powerline,bartvm/powerline,s0undt3ch/powerline,darac/powerline,junix/powerline,seanfisk/powerline,darac/powerline,IvanAli/powerline,DoctorJellyface/powerline,Liangjianghao/powerline,Liangjianghao/powerline,wfsch...
--- +++ @@ -11,7 +11,7 @@ extensions = ['powerline_autodoc', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.viewcode'] source_suffix = '.rst' master_doc = 'index' -project = u'Powerline' +project = 'Powerline' version = 'beta' release = 'beta' exclude_patterns = ['_build']
5f15edde5d753423f70bfd7401c215053cbe746c
tests/test_http_messages.py
tests/test_http_messages.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2016 <> # # Distributed under terms of the MIT license. """ Test the Request and Response classes """ from fnapy.utils import Response, Request from lxml import etree from fnapy.utils import xml2dict, remove_namespace BATCH_ID = "BFACA...
Test the Request and Response classes
Test the Request and Response classes
Python
mit
alexandriagroup/fnapy,alexandriagroup/fnapy
--- +++ @@ -0,0 +1,61 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +# vim:fenc=utf-8 +# +# Copyright © 2016 <> +# +# Distributed under terms of the MIT license. + +""" +Test the Request and Response classes +""" + +from fnapy.utils import Response, Request +from lxml import etree +from fnapy.utils import xml2...
c90bde47b1faab13396052fa474bc802ea5b2438
testscroll.py
testscroll.py
from PySide import QtCore, QtGui import os,sys from bgsub import SpectrumData from matplotlib import pyplot as plt path = "/home/danielle/Documents/LMCE_one" file_list = [f for f in sorted(os.listdir(path)) if f.endswith(".txt")] os.chdir(path) spectra = [] for each in file_list: spectra.append(SpectrumData.from_...
Test interface for showing plots
Test interface for showing plots
Python
mit
danushkana/pyspectrum
--- +++ @@ -0,0 +1,61 @@ +from PySide import QtCore, QtGui +import os,sys +from bgsub import SpectrumData +from matplotlib import pyplot as plt + +path = "/home/danielle/Documents/LMCE_one" + +file_list = [f for f in sorted(os.listdir(path)) if f.endswith(".txt")] +os.chdir(path) +spectra = [] +for each in file_list:...
2207dd266887e812cae9da67ca00bef80c9985fd
thefuck/shells/__init__.py
thefuck/shells/__init__.py
"""Package with shell specific actions, each shell class should implement `from_shell`, `to_shell`, `app_alias`, `put_to_history` and `get_aliases` methods. """ import os from psutil import Process from .bash import Bash from .fish import Fish from .generic import Generic from .tcsh import Tcsh from .zsh import Zsh sh...
"""Package with shell specific actions, each shell class should implement `from_shell`, `to_shell`, `app_alias`, `put_to_history` and `get_aliases` methods. """ import os from psutil import Process from .bash import Bash from .fish import Fish from .generic import Generic from .tcsh import Tcsh from .zsh import Zsh sh...
Update _get_shell to work with Windows
Update _get_shell to work with Windows - _get_shell assumed the parent process would always be the shell process, in Powershell the parent process is Python, with the grandparent being the shell - Switched to walking the process tree so the same code path can be used in both places
Python
mit
mlk/thefuck,SimenB/thefuck,SimenB/thefuck,mlk/thefuck,nvbn/thefuck,Clpsplug/thefuck,scorphus/thefuck,Clpsplug/thefuck,scorphus/thefuck,nvbn/thefuck
--- +++ @@ -18,11 +18,26 @@ def _get_shell(): - try: - shell_name = Process(os.getpid()).parent().name() - except TypeError: - shell_name = Process(os.getpid()).parent.name - return shells.get(shell_name, Generic)() + proc = Process(os.getpid()) + + while (proc is not None): + ...
731b53a21ca5d027384b1db3d5bfdcdd055eff28
run_doodle_exp.py
run_doodle_exp.py
#!/usr/bin/env python3 import subprocess import os img_dir = 'samples/' out_dir = 'outputs/' ext = '.jpg' sem_ext = '.png' c_images = ['arthur', 'matheus', 'sergio', 'morgan'] s_image = 'morgan' content_weight = 15 style_weight = 10 iterations = 200 ### Create outputs' folder if it doesn't exist if not os.path.exist...
Change style for each execution of the experiment
Change style for each execution of the experiment
Python
agpl-3.0
msvolenski/transfer-style-deep-investigation
--- +++ @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 + +import subprocess +import os + +img_dir = 'samples/' +out_dir = 'outputs/' +ext = '.jpg' +sem_ext = '.png' +c_images = ['arthur', 'matheus', 'sergio', 'morgan'] +s_image = 'morgan' +content_weight = 15 +style_weight = 10 +iterations = 200 + +### Create outputs' fold...