commit
stringlengths
40
40
old_file
stringlengths
5
117
new_file
stringlengths
5
117
old_contents
stringlengths
0
1.93k
new_contents
stringlengths
19
3.3k
subject
stringlengths
17
320
message
stringlengths
18
3.28k
lang
stringclasses
1 value
license
stringclasses
13 values
repos
stringlengths
7
42.4k
completion
stringlengths
152
6.66k
prompt
stringlengths
21
3.65k
4e28e43fea2eaa08006eeb4d70159c8ebd3c83b4
flask_uploads/__init__.py
flask_uploads/__init__.py
import loaders loader = loaders.Lazy( '%s.models' % __name__, ('Upload',) ) import extensions from .functions import ( delete, save, save_file, save_images, ) from .models import Upload def init(db, Storage, resizer=None): extensions.db = db extensions.resizer = resizer extensions...
import loaders loader = loaders.Lazy( '%s.models' % __name__, ('Upload',) ) import extensions from .functions import ( delete, save, save_file, save_images, ) from .models import Upload def init(db, Storage, resizer=None): if 'upload' in db.metadata.tables: return # Already regis...
Make sure model isn't added several times.
Make sure model isn't added several times.
Python
mit
FelixLoether/flask-uploads,FelixLoether/flask-image-upload-thing
<INSERT> if 'upload' in db.metadata.tables: return # Already registered the model. <INSERT_END> <|endoftext|> import loaders loader = loaders.Lazy( '%s.models' % __name__, ('Upload',) ) import extensions from .functions import ( delete, save, save_file, save_images, ) from .models...
Make sure model isn't added several times. import loaders loader = loaders.Lazy( '%s.models' % __name__, ('Upload',) ) import extensions from .functions import ( delete, save, save_file, save_images, ) from .models import Upload def init(db, Storage, resizer=None): extensions.db = db ...
624c52c63084f91429400fcc590e70b9c122ba7c
oslo/__init__.py
oslo/__init__.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Remove extraneous vim editor configuration comments
Remove extraneous vim editor configuration comments Change-Id: Id34b3ed02b6ef34b92d0cae9791f6e1b2d6cd4d8 Partial-Bug: #1229324
Python
apache-2.0
varunarya10/oslo.i18n,openstack/oslo.i18n
<DELETE> vim: tabstop=4 shiftwidth=4 softtabstop=4 # <DELETE_END> <|endoftext|> # 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 ...
Remove extraneous vim editor configuration comments Change-Id: Id34b3ed02b6ef34b92d0cae9791f6e1b2d6cd4d8 Partial-Bug: #1229324 # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may...
35bb090dd926d4327fa046ee2da64c4cb5b38a47
app/notify_client/email_branding_client.py
app/notify_client/email_branding_client.py
from app.notify_client import NotifyAdminAPIClient, cache class EmailBrandingClient(NotifyAdminAPIClient): @cache.set("email_branding-{branding_id}") def get_email_branding(self, branding_id): return self.get(url="/email-branding/{}".format(branding_id)) @cache.set("email_branding") def get_a...
from app.notify_client import NotifyAdminAPIClient, cache class EmailBrandingClient(NotifyAdminAPIClient): @cache.set("email_branding-{branding_id}") def get_email_branding(self, branding_id): return self.get(url="/email-branding/{}".format(branding_id)) @cache.set("email_branding") def get_a...
Remove old way of sorting
Remove old way of sorting This is redundant since the model layer has built-in sorting. It’s also not a good separation of concerns for something presentational (sort order) to be in the API client layer.
Python
mit
alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin
<REPLACE_OLD> get_all_email_branding(self, sort_key=None): brandings = self.get(url="/email-branding")["email_branding"] if sort_key and sort_key in brandings[0]: brandings.sort(key=lambda branding: branding[sort_key].lower()) <REPLACE_NEW> get_all_email_branding(self): <REPLACE_END> <REPL...
Remove old way of sorting This is redundant since the model layer has built-in sorting. It’s also not a good separation of concerns for something presentational (sort order) to be in the API client layer. from app.notify_client import NotifyAdminAPIClient, cache class EmailBrandingClient(NotifyAdminAPIClient): ...
aff8945aef3f10fa9d1243b25301e84611c27422
aleph/views/status_api.py
aleph/views/status_api.py
import logging from flask import Blueprint, request from aleph.model import Collection from aleph.queues import get_active_collection_status from aleph.views.util import jsonify from aleph.logic import resolver from aleph.views.util import require log = logging.getLogger(__name__) blueprint = Blueprint('status_api',...
import logging from flask import Blueprint, request from aleph.model import Collection from aleph.queues import get_active_collection_status from aleph.views.util import jsonify from aleph.views.util import require log = logging.getLogger(__name__) blueprint = Blueprint('status_api', __name__) @blueprint.route('/a...
Load only the active collections instead of all accessible collections
Load only the active collections instead of all accessible collections
Python
mit
alephdata/aleph,alephdata/aleph,pudo/aleph,alephdata/aleph,pudo/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph
<DELETE> aleph.logic import resolver from <DELETE_END> <INSERT> results = [] <INSERT_END> <REPLACE_OLD> collection_id <REPLACE_NEW> fid <REPLACE_END> <REPLACE_OLD> collections: <REPLACE_NEW> active_foreign_ids: <REPLACE_END> <REPLACE_OLD> resolver.queue(request, Collection, collection_id) resolver.resolve(req...
Load only the active collections instead of all accessible collections import logging from flask import Blueprint, request from aleph.model import Collection from aleph.queues import get_active_collection_status from aleph.views.util import jsonify from aleph.logic import resolver from aleph.views.util import require...
8a0ea95de9343b901d7d3cd8b3c5b0370d43eb0f
setup.py
setup.py
#!/usr/bin/env python """Setup script for GDM.""" import setuptools from gdm import __project__, __version__, CLI, DESCRIPTION import os if os.path.exists('README.rst'): README = open('README.rst').read() else: README = "" # a placeholder, readme is generated on release CHANGES = open('CHANGES.md').read() ...
#!/usr/bin/env python """Setup script for GDM.""" import setuptools from gdm import __project__, __version__, CLI, DESCRIPTION import os if os.path.exists('README.rst'): README = open('README.rst').read() else: README = "" # a placeholder, readme is generated on release CHANGES = open('CHANGES.md').read() ...
Update classifiers for a beta release
Update classifiers for a beta release
Python
mit
jacebrowning/gitman,jacebrowning/gdm
<REPLACE_OLD> 1 <REPLACE_NEW> 4 <REPLACE_END> <REPLACE_OLD> Planning', <REPLACE_NEW> Beta', 'Environment :: Console', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', <REPLACE_END> <REPLACE_OLD> OS Independent', <REPLACE_NEW> MacOS', 'Operating System :: PO...
Update classifiers for a beta release #!/usr/bin/env python """Setup script for GDM.""" import setuptools from gdm import __project__, __version__, CLI, DESCRIPTION import os if os.path.exists('README.rst'): README = open('README.rst').read() else: README = "" # a placeholder, readme is generated on relea...
7e2835f76474f6153d8972a983c5d45f9c4f11ee
tests/Physics/TestLight.py
tests/Physics/TestLight.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from numpy.testing import assert_approx_equal from UliEngineering.Physics.Light import * from UliEngineering.EngineerIO import auto_format import unittest class TestJohnsonNyquistNoise(unittest.TestCase): def test_lumen_to_candela_by_apex_angle(self): v = lume...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from numpy.testing import assert_approx_equal from UliEngineering.Physics.Light import * from UliEngineering.EngineerIO import auto_format import unittest class TestLight(unittest.TestCase): def test_lumen_to_candela_by_apex_angle(self): v = lumen_to_candela_b...
Fix badly named test class
Fix badly named test class
Python
apache-2.0
ulikoehler/UliEngineering
<REPLACE_OLD> TestJohnsonNyquistNoise(unittest.TestCase): <REPLACE_NEW> TestLight(unittest.TestCase): <REPLACE_END> <|endoftext|> #!/usr/bin/env python3 # -*- coding: utf-8 -*- from numpy.testing import assert_approx_equal from UliEngineering.Physics.Light import * from UliEngineering.EngineerIO import auto_format im...
Fix badly named test class #!/usr/bin/env python3 # -*- coding: utf-8 -*- from numpy.testing import assert_approx_equal from UliEngineering.Physics.Light import * from UliEngineering.EngineerIO import auto_format import unittest class TestJohnsonNyquistNoise(unittest.TestCase): def test_lumen_to_candela_by_apex_a...
4095b95930a57e78e35592dba413a776959adcde
logistic_order/model/sale_order.py
logistic_order/model/sale_order.py
# -*- coding: utf-8 -*- from openerp.osv import orm, fields class sale_order(orm.Model): _inherit = 'sale.order' _columns = { # override only to change the 'string' argument # from 'Customer' to 'Requesting Entity' 'partner_id': fields.many2one( 'res.partner', ...
# -*- coding: utf-8 -*- from openerp.osv import orm, fields class sale_order(orm.Model): _inherit = 'sale.order' _columns = { # override only to change the 'string' argument # from 'Customer' to 'Requesting Entity' 'partner_id': fields.many2one( 'res.partner', ...
Rename state of SO according to LO and Cost Estimate
[IMP] Rename state of SO according to LO and Cost Estimate
Python
agpl-3.0
yvaucher/vertical-ngo,mdietrichc2c/vertical-ngo,jorsea/vertical-ngo,gurneyalex/vertical-ngo,jorsea/vertical-ngo,jgrandguillaume/vertical-ngo
<INSERT> 'state': fields.selection([ ('draft', 'Draft Cost Estimate'), ('sent', 'Cost Estimate Sent'), ('cancel', 'Cancelled'), ('waiting_date', 'Waiting Schedule'), ('progress', 'Logistic Order'), ('manual', 'Logistic Order to Invoice'), ...
[IMP] Rename state of SO according to LO and Cost Estimate # -*- coding: utf-8 -*- from openerp.osv import orm, fields class sale_order(orm.Model): _inherit = 'sale.order' _columns = { # override only to change the 'string' argument # from 'Customer' to 'Requesting Entity' 'partner_...
d6643fa72f6783fc0f92cb9d8f44daf52fc1bf5f
registry/admin.py
registry/admin.py
from models import Resource, ResourceCollection, Contact from django.contrib import admin class ResourceAdmin(admin.ModelAdmin): list_display = ('title', 'couchDB_link', 'edit_metadata_link', 'published') filter_horizontal = ['editors', 'collections'] list_filter = ('published', 'collections') search_f...
from models import Resource, ResourceCollection, Contact from django.contrib import admin def make_published(modeladmin, request, queryset): queryset.update(published=True) make_published.short_description = "Mark selected resources as published" class ResourceAdmin(admin.ModelAdmin): list_display = ('title',...
Add bulk updating of a model's published status
Add bulk updating of a model's published status
Python
bsd-3-clause
usgin/metadata-repository,usgin/metadata-repository,usgin/nrrc-repository,usgin/nrrc-repository
<REPLACE_OLD> admin class <REPLACE_NEW> admin def make_published(modeladmin, request, queryset): queryset.update(published=True) make_published.short_description = "Mark selected resources as published" class <REPLACE_END> <INSERT> actions = [make_published] <INSERT_END> <|endoftext|> from models import Reso...
Add bulk updating of a model's published status from models import Resource, ResourceCollection, Contact from django.contrib import admin class ResourceAdmin(admin.ModelAdmin): list_display = ('title', 'couchDB_link', 'edit_metadata_link', 'published') filter_horizontal = ['editors', 'collections'] list_f...
713da17448f7d6c23c8527c737b9c9c03dea5d80
adhocracy4/emails/mixins.py
adhocracy4/emails/mixins.py
from email.mime.image import MIMEImage from django.contrib.staticfiles import finders from .base import EmailBase class PlatformEmailMixin: """ Attaches the static file images/logo.png so it can be used in an html email. """ def get_attachments(self): attachments = super().get_attachments...
from email.mime.image import MIMEImage from django.contrib.staticfiles import finders from .base import EmailBase class PlatformEmailMixin: """ Attaches the static file images/logo.png so it can be used in an html email. """ def get_attachments(self): attachments = super().get_attachments...
Fix missing close for email logo file handle
Fix missing close for email logo file handle
Python
agpl-3.0
liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4
<REPLACE_OLD> f = <REPLACE_NEW> with <REPLACE_END> <REPLACE_OLD> 'rb') <REPLACE_NEW> 'rb') as f: <REPLACE_END> <|endoftext|> from email.mime.image import MIMEImage from django.contrib.staticfiles import finders from .base import EmailBase class PlatformEmailMixin: """ Attaches the static file images/lo...
Fix missing close for email logo file handle from email.mime.image import MIMEImage from django.contrib.staticfiles import finders from .base import EmailBase class PlatformEmailMixin: """ Attaches the static file images/logo.png so it can be used in an html email. """ def get_attachments(self):...
5619a15402099b1209db9ed7f71e1e55548ddebe
run-thnvm-se.py
run-thnvm-se.py
#!/bin/bash if [ $# -lt 1 ]; then echo "Usage: $0 [-h] [-c COMMAND] [-o OPTIONS]" exit -1 fi GEM5ROOT=~/Projects/Sexain-MemController/gem5-stable ARCH=X86 #X86_MESI_CMP_directory # in ./build_opts CPU_TYPE=atomic # timing, detailed NUM_CPUS=1 MEM_TYPE=simple_mem MEM_SIZE=2GB L1D_SIZE=32kB L1D_ASSOC=8 L1I_SIZE=...
Add basic run script with config for syscall emulation.
[gem5] Add basic run script with config for syscall emulation.
Python
apache-2.0
basicthinker/Sexain-MemController,basicthinker/Sexain-MemController,basicthinker/Sexain-MemController,basicthinker/Sexain-MemController,basicthinker/Sexain-MemController,basicthinker/Sexain-MemController,basicthinker/Sexain-MemController,basicthinker/Sexain-MemController
<INSERT> #!/bin/bash if [ $# -lt 1 ]; then <INSERT_END> <INSERT> echo "Usage: $0 [-h] [-c COMMAND] [-o OPTIONS]" exit -1 fi GEM5ROOT=~/Projects/Sexain-MemController/gem5-stable ARCH=X86 #X86_MESI_CMP_directory # in ./build_opts CPU_TYPE=atomic # timing, detailed NUM_CPUS=1 MEM_TYPE=simple_mem MEM_SIZE=2GB L1D_S...
[gem5] Add basic run script with config for syscall emulation.
9ea98f37ca4c1ea00fd6c77d5a651b4a928a237d
fix_past_due_issue.py
fix_past_due_issue.py
import sys from datetime import datetime from courtutils.databases.postgres import PostgresDatabase from courtreader import readers from courtutils.logger import get_logger log = get_logger() reader = readers.DistrictCourtReader() reader.connect() db = PostgresDatabase('district') def update_case(fips): cases_to_...
import sys from datetime import datetime from courtutils.databases.postgres import PostgresDatabase from courtreader import readers from courtutils.logger import get_logger log = get_logger() reader = readers.DistrictCourtReader() reader.connect() db = PostgresDatabase('district') def update_case(fips): cases_to_...
Fix mistake in last commit
Fix mistake in last commit
Python
mit
bschoenfeld/va-court-scraper,bschoenfeld/va-court-scraper
<REPLACE_OLD> 2: update_case(sys.argv[2]) else: <REPLACE_NEW> 1: update_case(sys.argv[1]) else: <REPLACE_END> <|endoftext|> import sys from datetime import datetime from courtutils.databases.postgres import PostgresDatabase from courtreader import readers from courtutils.logger import get_logger log = get_lo...
Fix mistake in last commit import sys from datetime import datetime from courtutils.databases.postgres import PostgresDatabase from courtreader import readers from courtutils.logger import get_logger log = get_logger() reader = readers.DistrictCourtReader() reader.connect() db = PostgresDatabase('district') def upda...
2d4da5b24f8a01b7e3a09ecb9f8f55d695d01a5e
apns/tests/test_utils.py
apns/tests/test_utils.py
from datetime import datetime from twisted.trial.unittest import TestCase from apns.utils import datetime_to_timestamp class DatetimeToTimestampTestCase(TestCase): def test_datetime(self): now = datetime.now() timestamp = datetime_to_timestamp(now) self.assertEqual(datetime.fromtimest...
Add tests to utils module
Add tests to utils module
Python
mit
operasoftware/twisted-apns,operasoftware/twisted-apns
<INSERT> from datetime import datetime from twisted.trial.unittest import TestCase from apns.utils import datetime_to_timestamp class DatetimeToTimestampTestCase(TestCase): <INSERT_END> <INSERT> def test_datetime(self): now = datetime.now() timestamp = datetime_to_timestamp(now) self.a...
Add tests to utils module
c129e600b91ac0c35e26847ef5b1df75a1dec695
fmn/filters/generic.py
fmn/filters/generic.py
# Generic filters for FMN import fedmsg def user_filter(config, message, fasnick=None, *args, **kw): """ Filters the messages by the user that performed the action. Use this filter to filter out messages that are associated with a specified user. """ fasnick = kw.get('fasnick', fasnick) if f...
# Generic filters for FMN import fedmsg def user_filter(config, message, fasnick=None, *args, **kw): """ All messages of user Use this filter to filter out messages that are associated with a specified user. """ fasnick = kw.get('fasnick', fasnick) if fasnick: return fasnick in fedms...
Update the documentation title for the user_filter
Update the documentation title for the user_filter
Python
lgpl-2.1
jeremycline/fmn,jeremycline/fmn,jeremycline/fmn
<REPLACE_OLD> Filters the <REPLACE_NEW> All <REPLACE_END> <REPLACE_OLD> by the user that performed the action. <REPLACE_NEW> of user <REPLACE_END> <|endoftext|> # Generic filters for FMN import fedmsg def user_filter(config, message, fasnick=None, *args, **kw): """ All messages of user Use this filter to...
Update the documentation title for the user_filter # Generic filters for FMN import fedmsg def user_filter(config, message, fasnick=None, *args, **kw): """ Filters the messages by the user that performed the action. Use this filter to filter out messages that are associated with a specified user. """...
451483d991c5cb0b2c9b9a4879e10e759be0667a
setup.py
setup.py
from setuptools import setup REPO_URL = 'http://github.com/datasciencebr/serenata-toolbox' setup( author='Serenata de Amor', classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Programming Language...
from setuptools import setup REPO_URL = 'http://github.com/datasciencebr/serenata-toolbox' setup( author='Serenata de Amor', classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Programming Language...
Remove numpy as it's a dependency of Pandas already
Remove numpy as it's a dependency of Pandas already
Python
mit
datasciencebr/serenata-toolbox
<DELETE> 'numpy>=1.11', <DELETE_END> <|endoftext|> from setuptools import setup REPO_URL = 'http://github.com/datasciencebr/serenata-toolbox' setup( author='Serenata de Amor', classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Science/Research', 'License :: ...
Remove numpy as it's a dependency of Pandas already from setuptools import setup REPO_URL = 'http://github.com/datasciencebr/serenata-toolbox' setup( author='Serenata de Amor', classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Science/Research', 'License :: OSI Ap...
d1e56cfcd11bcd509d8fa3954c00e06a84bddd87
synapse/storage/engines/__init__.py
synapse/storage/engines/__init__.py
# -*- coding: utf-8 -*- # Copyright 2015, 2016 OpenMarket Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# -*- coding: utf-8 -*- # Copyright 2015, 2016 OpenMarket Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Fix pep8 error on psycopg2cffi hack
Fix pep8 error on psycopg2cffi hack
Python
apache-2.0
matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse
<REPLACE_OLD> needs_pypy_hack = <REPLACE_NEW> # pypy requires psycopg2cffi rather than psycopg2 if <REPLACE_END> <REPLACE_OLD> "PyPy") if needs_pypy_hack: module = importlib.import_module("psycopg2cffi") else: <REPLACE_NEW> "PyPy"): name = "psycopg2cffi" <REPLACE_EN...
Fix pep8 error on psycopg2cffi hack # -*- coding: utf-8 -*- # Copyright 2015, 2016 OpenMarket Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
d95181d8de55c77e10aca390a40074d5ef0a7bb2
angr/procedures/java_lang/string_equals.py
angr/procedures/java_lang/string_equals.py
from ..java import JavaSimProcedure import logging l = logging.getLogger('angr.procedures.java.string.equals') class StringEquals(JavaSimProcedure): NO_RET = True __provides__ = ( ("java.lang.String", "equals(java.lang.String)"), ) def run(self, str_1, str_2): l.info("Called SimPro...
Add dummy Simprocedure for java.lang.string.equals
Add dummy Simprocedure for java.lang.string.equals
Python
bsd-2-clause
schieb/angr,schieb/angr,iamahuman/angr,angr/angr,angr/angr,schieb/angr,angr/angr,iamahuman/angr,iamahuman/angr
<INSERT> from ..java import JavaSimProcedure import <INSERT_END> <INSERT> logging l = logging.getLogger('angr.procedures.java.string.equals') class StringEquals(JavaSimProcedure): NO_RET = True __provides__ = ( ("java.lang.String", "equals(java.lang.String)"), ) def run(self, str_1, str_2):...
Add dummy Simprocedure for java.lang.string.equals
2edd0ee699cfc0ef66d27ccb87ddefad26aa1a77
Challenges/chall_31.py
Challenges/chall_31.py
#!/usr/local/bin/python3 # Python Challenge - 31 # http://www.pythonchallenge.com/pc/ring/grandpa.html # http://www.pythonchallenge.com/pc/rock/grandpa.html # Username: repeat; Password: switch # Keyword: kohsamui, thailand; ''' Uses Anaconda environment with Pillow for image processing - Python 3.7, numpy, and Pi...
#!/usr/local/bin/python3 # Python Challenge - 31 # http://www.pythonchallenge.com/pc/ring/grandpa.html # http://www.pythonchallenge.com/pc/rock/grandpa.html # Username: repeat; Password: switch # Keyword: kohsamui, thailand; ''' Uses Anaconda environment with Pillow for image processing - Python 3.7, numpy, and Pi...
Add info for mandelbrot set
Add info for mandelbrot set
Python
mit
HKuz/PythonChallenge
<REPLACE_OLD> country <REPLACE_NEW> country -> search for Grandpa rock <REPLACE_END> <REPLACE_OLD> width = 0.036 height = 0.027 <REPLACE_NEW> w_step = 0.036 # x-axis = reals h_step = 0.027 # y-axis = imaginaries <REPLACE_END> <REPLACE_OLD> pass <REPLACE_NEW> w, h = mandelbrot.size print('W: {}, H...
Add info for mandelbrot set #!/usr/local/bin/python3 # Python Challenge - 31 # http://www.pythonchallenge.com/pc/ring/grandpa.html # http://www.pythonchallenge.com/pc/rock/grandpa.html # Username: repeat; Password: switch # Keyword: kohsamui, thailand; ''' Uses Anaconda environment with Pillow for image processing ...
12acfff456e1a696d1117b20b8843c6789ee38bb
wake/views.py
wake/views.py
from been.couch import CouchStore from flask import render_template, abort from wake import app store = CouchStore().load() @app.route('/') def wake(): return render_template('stream.html', events=store.collapsed_events()) @app.route('/<slug>') def by_slug(slug): events = list(store.events_by_slug(slug)) ...
from been.couch import CouchStore from flask import render_template, abort, request, url_for from urlparse import urljoin from werkzeug.contrib.atom import AtomFeed from datetime import datetime from wake import app store = CouchStore().load() @app.route('/') def wake(): return render_template('stream.html', even...
Add Atom feed for events that have 'syndicate' set in their source config.
Add Atom feed for events that have 'syndicate' set in their source config.
Python
bsd-3-clause
chromakode/wake
<REPLACE_OLD> abort from <REPLACE_NEW> abort, request, url_for from urlparse import urljoin from werkzeug.contrib.atom import AtomFeed from datetime import datetime from <REPLACE_END> <REPLACE_OLD> events=events) <REPLACE_NEW> events=events) @app.route('/recent.atom') def recent_feed(): feed = AtomFeed('Recent P...
Add Atom feed for events that have 'syndicate' set in their source config. from been.couch import CouchStore from flask import render_template, abort from wake import app store = CouchStore().load() @app.route('/') def wake(): return render_template('stream.html', events=store.collapsed_events()) @app.route('/<...
ebd9842569201ce0e87827c2031c28c51159c472
tests/test_pathutils.py
tests/test_pathutils.py
from os.path import join import sublime import sys from unittest import TestCase from unittest.mock import patch version = sublime.version() try: from libsass import pathutils except ImportError: from sublime_libsass.libsass import pathutils class TestPathutils(TestCase): def test_subpaths(self): ...
from os.path import join import sublime import sys from unittest import TestCase from unittest.mock import patch version = sublime.version() try: from libsass import pathutils except ImportError: from sublime_libsass.libsass import pathutils class TestPathutils(TestCase): def test_subpaths(self): ...
Change mocking scope to take effect
Change mocking scope to take effect
Python
mit
blitzrk/sublime_libsass,blitzrk/sublime_libsass
<REPLACE_OLD> @patch.object(pathutils, 'os') <REPLACE_NEW> @patch.object(pathutils.os, 'walk') <REPLACE_END> <REPLACE_OLD> mock_os): <REPLACE_NEW> mock_walk): <REPLACE_END> <REPLACE_OLD> mock_os.walk <REPLACE_NEW> mock_walk <REPLACE_END> <|endoftext|> from os.path import join import sublime import sys from unittest...
Change mocking scope to take effect from os.path import join import sublime import sys from unittest import TestCase from unittest.mock import patch version = sublime.version() try: from libsass import pathutils except ImportError: from sublime_libsass.libsass import pathutils class TestPathutils(TestCase)...
3ca4a7334a3a759762d309bcff94ddde62d5a48b
accounts/management/__init__.py
accounts/management/__init__.py
from django.db.models.signals import post_syncdb from accounts import models, names def ensure_core_accounts_exists(sender, **kwargs): # We only create core accounts the first time syncdb is run if models.Account.objects.all().count() > 0: return # Create asset accounts assets = models.Accou...
from accounts import models, names def ensure_core_accounts_exists(sender, **kwargs): # We only create core accounts the first time syncdb is run if models.Account.objects.all().count() > 0: return # Create asset accounts assets = models.AccountType.add_root(name='Assets') assets.accounts...
Remove syncdb signal - will move to migration shortly
Remove syncdb signal - will move to migration shortly
Python
bsd-3-clause
Jannes123/django-oscar-accounts,machtfit/django-oscar-accounts,michaelkuty/django-oscar-accounts,Mariana-Tek/django-oscar-accounts,amsys/django-account-balances,michaelkuty/django-oscar-accounts,Jannes123/django-oscar-accounts,carver/django-account-balances,Mariana-Tek/django-oscar-accounts,amsys/django-account-balance...
<DELETE> django.db.models.signals import post_syncdb from <DELETE_END> <REPLACE_OLD> accounts") post_syncdb.connect(ensure_core_accounts_exists, <REPLACE_NEW> accounts") #post_syncdb.connect(ensure_core_accounts_exists, <REPLACE_END> <|endoftext|> from accounts import models, names def ensure_core_accounts_exist...
Remove syncdb signal - will move to migration shortly from django.db.models.signals import post_syncdb from accounts import models, names def ensure_core_accounts_exists(sender, **kwargs): # We only create core accounts the first time syncdb is run if models.Account.objects.all().count() > 0: return...
52716c4dc7d95820d2640ba7c9e75fb00f786e85
lib/ansible/utils/module_docs_fragments/validate.py
lib/ansible/utils/module_docs_fragments/validate.py
# Copyright (c) 2015 Ansible, Inc # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansi...
# Copyright (c) 2015 Ansible, Inc # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansi...
Remove mention of 'apache example'
Remove mention of 'apache example' Removed explicit mention of 'apache'
Python
mit
thaim/ansible,thaim/ansible
<DELETE> apache <DELETE_END> <|endoftext|> # Copyright (c) 2015 Ansible, Inc # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (...
Remove mention of 'apache example' Removed explicit mention of 'apache' # Copyright (c) 2015 Ansible, Inc # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either ve...
4a985c3695c5781ab90c35b929eb21c3207d11ff
bluebottle/files/tests/test_models.py
bluebottle/files/tests/test_models.py
from django.test import TestCase from bluebottle.files.tests.factories import ImageFactory class FileTestCase(TestCase): def test_file_properties(self): image = ImageFactory.create() self.assertEqual(str(image), str(image.id)) self.assertGreater(len(str(image)), 8)
Add test for file model
Add test for file model
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
<INSERT> from django.test import TestCase from bluebottle.files.tests.factories import ImageFactory class FileTestCase(TestCase): <INSERT_END> <INSERT> def test_file_properties(self): image = ImageFactory.create() self.assertEqual(str(image), str(image.id)) self.assertGreater(len(str(imag...
Add test for file model
d2971af14f57e925e1500da9ede42adb34d0dc62
tastycrust/authentication.py
tastycrust/authentication.py
#!/usr/bin/env python # -*- coding: utf-8 class AnonymousAuthentication(object): anonymous_allowed_methods = ['GET'] def __init__(self, allowed=None): if allowed is not None: self.anonymous_allowed_methods = allowed def is_authenticated(self, request, **kwargs): allowed_metho...
#!/usr/bin/env python # -*- coding: utf-8 class AnonymousAuthentication(object): allowed_methods = ['GET'] def __init__(self, allowed=None): if allowed is not None: self.allowed_methods = allowed def is_authenticated(self, request, **kwargs): return (request.method in [s.uppe...
Change some naming in AnonymousAuthentication
Change some naming in AnonymousAuthentication
Python
bsd-3-clause
uranusjr/django-tastypie-crust
<REPLACE_OLD> anonymous_allowed_methods <REPLACE_NEW> allowed_methods <REPLACE_END> <REPLACE_OLD> self.anonymous_allowed_methods <REPLACE_NEW> self.allowed_methods <REPLACE_END> <REPLACE_OLD> allowed_methods = <REPLACE_NEW> return (request.method in <REPLACE_END> <REPLACE_OLD> self.anonymous_allowed_methods] if...
Change some naming in AnonymousAuthentication #!/usr/bin/env python # -*- coding: utf-8 class AnonymousAuthentication(object): anonymous_allowed_methods = ['GET'] def __init__(self, allowed=None): if allowed is not None: self.anonymous_allowed_methods = allowed def is_authenticated(...
328eef0c145c1efbaedd9453d515955012d1a975
backend/scripts/projsize.py
backend/scripts/projsize.py
#!/usr/bin/env python import rethinkdb as r from optparse import OptionParser def compute_project_size(project_id, conn): total = 0 for f in r.table('project2datafile').get_all(project_id, index="project_id").eq_join('datafile_id', r.table( 'datafiles')).zip().run(conn): total = total + f...
Add script for computing total project size.
Add script for computing total project size.
Python
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
<INSERT> #!/usr/bin/env python import rethinkdb as r from optparse import OptionParser def compute_project_size(project_id, conn): <INSERT_END> <INSERT> total = 0 for f in r.table('project2datafile').get_all(project_id, index="project_id").eq_join('datafile_id', r.table( 'datafiles')).zip().run(co...
Add script for computing total project size.
bf312434a9b52264dc63667c986ff353d0379e5b
cogs/utils/dataIO.py
cogs/utils/dataIO.py
import redis_collections import threading import time import __main__ class RedisDict(redis_collections.Dict): def __init__(self, **kwargs): super().__init__(**kwargs) self.die = False self.thread = threading.Thread(target=self.update_loop) self.thread.start() self.prev = N...
import redis_collections import threading import time import __main__ class RedisDict(redis_collections.Dict): def __init__(self, **kwargs): super().__init__(**kwargs) self.die = False self.thread = threading.Thread(target=self.update_loop, daemon=True) self.thread.start() ...
Make threads run in daemon mode
Make threads run in daemon mode
Python
mit
Thessia/Liara
<REPLACE_OLD> threading.Thread(target=self.update_loop) <REPLACE_NEW> threading.Thread(target=self.update_loop, daemon=True) <REPLACE_END> <|endoftext|> import redis_collections import threading import time import __main__ class RedisDict(redis_collections.Dict): def __init__(self, **kwargs): super().__...
Make threads run in daemon mode import redis_collections import threading import time import __main__ class RedisDict(redis_collections.Dict): def __init__(self, **kwargs): super().__init__(**kwargs) self.die = False self.thread = threading.Thread(target=self.update_loop) self.thr...
04f36fab2168fb9cd34d3c6fc7f31533c90b9149
app/clients/statsd/statsd_client.py
app/clients/statsd/statsd_client.py
from statsd import StatsClient class StatsdClient(StatsClient): def init_app(self, app, *args, **kwargs): self.active = app.config.get('STATSD_ENABLED') self.namespace = app.config.get('NOTIFY_ENVIRONMENT') + ".notifications.api." if self.active: StatsClient.__init__( ...
from statsd import StatsClient class StatsdClient(StatsClient): def init_app(self, app, *args, **kwargs): self.active = app.config.get('STATSD_ENABLED') self.namespace = app.config.get('NOTIFY_ENVIRONMENT') + ".notifications.api." if self.active: StatsClient.__init__( ...
Format the stat name with environmenbt
Format the stat name with environmenbt
Python
mit
alphagov/notifications-api,alphagov/notifications-api
<REPLACE_OLD> self).timing(stat, <REPLACE_NEW> self).timing(self.format_stat_name(stat), <REPLACE_END> <|endoftext|> from statsd import StatsClient class StatsdClient(StatsClient): def init_app(self, app, *args, **kwargs): self.active = app.config.get('STATSD_ENABLED') self.namespace = app.config....
Format the stat name with environmenbt from statsd import StatsClient class StatsdClient(StatsClient): def init_app(self, app, *args, **kwargs): self.active = app.config.get('STATSD_ENABLED') self.namespace = app.config.get('NOTIFY_ENVIRONMENT') + ".notifications.api." if self.active: ...
6c293b42bdae81082c73754b8cf2d8616cbf1ec2
test/integration/ggrc/converters/test_base_block.py
test/integration/ggrc/converters/test_base_block.py
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> import mock from collections import defaultdict from ddt import data, ddt from ggrc.converters import base_block from ggrc import models from integration.ggrc import TestCase from integration.ggrc.models...
Add export mapping cache tests
Add export mapping cache tests
Python
apache-2.0
AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core
<REPLACE_OLD> <REPLACE_NEW> # Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> import mock from collections import defaultdict from ddt import data, ddt from ggrc.converters import base_block from ggrc import models from integration.ggrc import TestCase...
Add export mapping cache tests
06fc94beb1f0e557be11010eaaf9635350940865
insertion_sort.py
insertion_sort.py
def insertion_sort(un_list): for idx in range(1, len(un_list)): current = un_list[idx] position = idx while position > 0 and un_list[position-1] > current: un_list[position] = un_list[position-1] position = position - 1 un_list[position] = current if __name...
Add insertion sort method to module.
Add insertion sort method to module.
Python
mit
jonathanstallings/data-structures
<INSERT> def insertion_sort(un_list): <INSERT_END> <INSERT> for idx in range(1, len(un_list)): current = un_list[idx] position = idx while position > 0 and un_list[position-1] > current: un_list[position] = un_list[position-1] position = position - 1 un_list[...
Add insertion sort method to module.
a43634b3c9ec4d47d8ec032e34a197210a6dddb7
gesture_recognition/gesture_recognizer.py
gesture_recognition/gesture_recognizer.py
""" Main script to execute the gesture recognition software. """ # Import native python libraries import inspect import os import sys from listener import MyListener from face_detection import face_detector_gui import time # Setup environment variables src_dir = os.path.dirname(inspect.getfile(inspect.currentframe())...
""" Main script to execute the gesture recognition software. """ # Import native python libraries import inspect import os import sys from listener import MyListener from face_detection import face_detector_gui import time # Setup environment variables src_dir = os.path.dirname(inspect.getfile(inspect.currentframe())...
Add some prints to improve verbosity
Add some prints to improve verbosity
Python
mit
oscarorti/pae-gesture-recognition,oscarorti/pae-gesture-recognition,oscarorti/pae-gesture-recognition,oscarorti/pae-gesture-recognition,oscarorti/pae-gesture-recognition,oscarorti/pae-gesture-recognition,oscarorti/pae-gesture-recognition
<REPLACE_OLD> print face.face_detected <REPLACE_NEW> print('Is face detected? ', face.face_detected) <REPLACE_END> <INSERT> print("Enabled Gesture Recognition") <INSERT_END> <INSERT> print('Disabled Gesture Recognition') <INSERT_END> <|endoftext|> """ Main script to execute the gesture recognition sof...
Add some prints to improve verbosity """ Main script to execute the gesture recognition software. """ # Import native python libraries import inspect import os import sys from listener import MyListener from face_detection import face_detector_gui import time # Setup environment variables src_dir = os.path.dirname(i...
fa85cd0d992b5153f9a48f3cf9d504a2b33cca1d
tempest/tests/lib/services/volume/v2/test_availability_zone_client.py
tempest/tests/lib/services/volume/v2/test_availability_zone_client.py
# Copyright 2017 FiberHome Telecommunication Technologies CO.,LTD # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LI...
Add unit test for volume availability zone client
Add unit test for volume availability zone client This patch adds unit test for volume v2 availability zone client. Partially Implements: blueprint tempest-lib-missing-test-coverage Change-Id: I94f758307255de06fbaf8c6744912b46e15a6cb2
Python
apache-2.0
openstack/tempest,Juniper/tempest,openstack/tempest,masayukig/tempest,masayukig/tempest,Juniper/tempest,cisco-openstack/tempest,cisco-openstack/tempest
<REPLACE_OLD> <REPLACE_NEW> # Copyright 2017 FiberHome Telecommunication Technologies CO.,LTD # 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...
Add unit test for volume availability zone client This patch adds unit test for volume v2 availability zone client. Partially Implements: blueprint tempest-lib-missing-test-coverage Change-Id: I94f758307255de06fbaf8c6744912b46e15a6cb2
b986b437495b4406936b2a139e4e027f6275c9eb
boussole/logs.py
boussole/logs.py
""" Logging ======= """ import logging import colorlog def init_logger(level, printout=True): """ Initialize app logger to configure its level/handler/formatter/etc.. Todo: * A mean to raise click.Abort or sys.exit when CRITICAL is used; Args: level (str): Level name (``debug``, ``i...
""" Logging ======= """ import logging import colorlog def init_logger(level, printout=True): """ Initialize app logger to configure its level/handler/formatter/etc.. Todo: * A mean to raise click.Abort or sys.exit when CRITICAL is used; Args: level (str): Level name (``debug``, ``i...
Use StringIO object from 'io' module instead of deprecated 'StringIO' module
Use StringIO object from 'io' module instead of deprecated 'StringIO' module
Python
mit
sveetch/boussole
<REPLACE_OLD> StringIO <REPLACE_NEW> io <REPLACE_END> <|endoftext|> """ Logging ======= """ import logging import colorlog def init_logger(level, printout=True): """ Initialize app logger to configure its level/handler/formatter/etc.. Todo: * A mean to raise click.Abort or sys.exit when CRITICAL...
Use StringIO object from 'io' module instead of deprecated 'StringIO' module """ Logging ======= """ import logging import colorlog def init_logger(level, printout=True): """ Initialize app logger to configure its level/handler/formatter/etc.. Todo: * A mean to raise click.Abort or sys.exit whe...
3ce13307cfaca4ed0e069ed1d1f61f4afd2dca85
greatbigcrane/job_queue/management/commands/job_processor.py
greatbigcrane/job_queue/management/commands/job_processor.py
import zmq import time import json from django.core.management.base import NoArgsCommand addr = 'tcp://127.0.0.1:5555' class Command(NoArgsCommand): help = "Run the 0MQ based job processor. Accepts jobs from the job server and processes them." def handle(self, **options): context = zmq.Context() ...
Move the basic job processor into a django management command as well.
Move the basic job processor into a django management command as well.
Python
apache-2.0
pnomolos/greatbigcrane,pnomolos/greatbigcrane
<REPLACE_OLD> <REPLACE_NEW> import zmq import time import json from django.core.management.base import NoArgsCommand addr = 'tcp://127.0.0.1:5555' class Command(NoArgsCommand): help = "Run the 0MQ based job processor. Accepts jobs from the job server and processes them." def handle(self, **options): ...
Move the basic job processor into a django management command as well.
243bb615c579c0598a2f2be5791d3d5092dcd556
invoice/tasks.py
invoice/tasks.py
# -*- encoding: utf-8 -*- import logging from celery import shared_task from django.utils import timezone from invoice.models import InvoiceUser from mail.service import queue_mail_message from mail.tasks import process_mail from .report import time_summary logger = logging.getLogger(__name__) @shared_task def ma...
# -*- encoding: utf-8 -*- import logging from celery import shared_task from django.utils import timezone from invoice.models import InvoiceUser from mail.service import queue_mail_message from mail.tasks import process_mail from .report import time_summary logger = logging.getLogger(__name__) @shared_task def ma...
Remove HTML table (our mail cannot send HTML)
Remove HTML table (our mail cannot send HTML)
Python
apache-2.0
pkimber/invoice,pkimber/invoice,pkimber/invoice
<REPLACE_OLD> '<table border="0">' <REPLACE_NEW> '' <REPLACE_END> <REPLACE_OLD> '<tr colspan="3">' message = message + '<td>{}</td>'.format(d.strftime('%d/%m/%Y %A')) message = message + '</tr>' <REPLACE_NEW> '\n\n{}, total time {}'.format( d.strftime('%d/%m/%Y %A'), ...
Remove HTML table (our mail cannot send HTML) # -*- encoding: utf-8 -*- import logging from celery import shared_task from django.utils import timezone from invoice.models import InvoiceUser from mail.service import queue_mail_message from mail.tasks import process_mail from .report import time_summary logger = lo...
9be7deeaf400858dc00118d274b4cf4d19c60858
stdnum/cr/__init__.py
stdnum/cr/__init__.py
# __init__.py - collection of Costa Rican numbers # coding: utf-8 # # Copyright (C) 2019 Leandro Regueiro # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the Lic...
# __init__.py - collection of Costa Rican numbers # coding: utf-8 # # Copyright (C) 2019 Leandro Regueiro # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the Lic...
Add missing vat alias for Costa Rica
Add missing vat alias for Costa Rica
Python
lgpl-2.1
arthurdejong/python-stdnum,arthurdejong/python-stdnum,arthurdejong/python-stdnum
<REPLACE_OLD> numbers.""" <REPLACE_NEW> numbers.""" from stdnum.cr import cpj as vat # noqa: F401 <REPLACE_END> <|endoftext|> # __init__.py - collection of Costa Rican numbers # coding: utf-8 # # Copyright (C) 2019 Leandro Regueiro # # This library is free software; you can redistribute it and/or # modify it under t...
Add missing vat alias for Costa Rica # __init__.py - collection of Costa Rican numbers # coding: utf-8 # # Copyright (C) 2019 Leandro Regueiro # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Found...
a412de216896ddf5b1c2156927d39bade75b10d8
setup.py
setup.py
import os import sys import imp from setuptools import find_packages try: from restricted_pkg import setup except: # allow falling back to setuptools only if # we are not trying to upload if 'upload' in sys.argv: raise ImportError('restricted_pkg is required to upload, first do pip install rest...
import os import sys import imp from setuptools import find_packages try: from restricted_pkg import setup except: # allow falling back to setuptools only if # we are not trying to upload if 'upload' in sys.argv: raise ImportError('restricted_pkg is required to upload, first do pip install rest...
Add entrypoint for Dusty client
Add entrypoint for Dusty client
Python
mit
gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty
<REPLACE_OLD> dusty.daemon:main']}, <REPLACE_NEW> dusty.daemon:main', 'dusty = dusty.client:main']}, <REPLACE_END> <|endoftext|> import os import sys import imp from setuptools import find_packages try: from restricted_pkg import setup except: # allow falling back to setuptools only if ...
Add entrypoint for Dusty client import os import sys import imp from setuptools import find_packages try: from restricted_pkg import setup except: # allow falling back to setuptools only if # we are not trying to upload if 'upload' in sys.argv: raise ImportError('restricted_pkg is required to ...
1bb7ff80906058370839eb22ff2ebc67f11ad09e
django_auth_adfs/rest_framework.py
django_auth_adfs/rest_framework.py
import logging from django.contrib.auth import authenticate from rest_framework import exceptions from rest_framework.authentication import ( BaseAuthentication, get_authorization_header ) logger = logging.getLogger(__name__) class AdfsAccessTokenAuthentication(BaseAuthentication): """ ADFS access Token...
from __future__ import absolute_import import logging from django.contrib.auth import authenticate from rest_framework import exceptions from rest_framework.authentication import ( BaseAuthentication, get_authorization_header ) logger = logging.getLogger(__name__) class AdfsAccessTokenAuthentication(BaseAuthen...
Make sure we don't have a import namespace clash with DRF
Make sure we don't have a import namespace clash with DRF For python 2.7 you need to add from __future__ import absolute_import
Python
bsd-2-clause
jobec/django-auth-adfs,jobec/django-auth-adfs
<INSERT> from __future__ <INSERT_END> <INSERT> absolute_import import <INSERT_END> <|endoftext|> from __future__ import absolute_import import logging from django.contrib.auth import authenticate from rest_framework import exceptions from rest_framework.authentication import ( BaseAuthentication, get_authorizati...
Make sure we don't have a import namespace clash with DRF For python 2.7 you need to add from __future__ import absolute_import import logging from django.contrib.auth import authenticate from rest_framework import exceptions from rest_framework.authentication import ( BaseAuthentication, get_authorization_heade...
b72c9a26c00ca31966be3ae8b529e9272d300290
__main__.py
__main__.py
import sys import argparse from . import parse from . import compile from . import runtime from .interactive import Interactive class Interactive (Interactive): def __init__(self, args): super().__init__() self.args = args self.single = sys.stdin.isatty() or args.print def displ...
import sys import argparse from . import parse from . import compile from . import runtime from .interactive import Interactive class Interactive (Interactive): def __init__(self, args): super().__init__() self.args = args def traceback(self, trace): # When running in non-interac...
Remove the -p command-line option.
Remove the -p command-line option. It's pretty useless anyway. Use instead.
Python
mit
pyos/dg
<DELETE> <DELETE_END> <REPLACE_OLD> args self.single = sys.stdin.isatty() or args.print def displayhook(self, value): self.args.print and print(value) return super().displayhook(value) <REPLACE_NEW> args <REPLACE_END> <REPLACE_OLD> single=self.single) <REPLACE_NEW> single=True) <RE...
Remove the -p command-line option. It's pretty useless anyway. Use instead. import sys import argparse from . import parse from . import compile from . import runtime from .interactive import Interactive class Interactive (Interactive): def __init__(self, args): super().__init__() self.args...
eb109a55bc1d4c3be961257d9713b23a5916f5ef
tests/monitoring/test_check_mesos_quorum.py
tests/monitoring/test_check_mesos_quorum.py
# Copyright 2015-2016 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 or agreed to in writin...
Add last metastatus check test
Add last metastatus check test
Python
apache-2.0
somic/paasta,Yelp/paasta,Yelp/paasta,somic/paasta
<REPLACE_OLD> <REPLACE_NEW> # Copyright 2015-2016 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 applicab...
Add last metastatus check test
269439513e2f9f84e89592565b20d9ff193fe210
pyes/scriptfields.py
pyes/scriptfields.py
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Armando Guereca' class ScriptFields: _internal_name = "script_fields" """ This object create the script_fields definition """ def __init__(self, field_name, script, params = None): self.fields={} self.add_field(field_name,...
Add ScriptFields object used as parameter script_fields of Search object
Add ScriptFields object used as parameter script_fields of Search object
Python
bsd-3-clause
rookdev/pyes,jayzeng/pyes,mouadino/pyes,jayzeng/pyes,mouadino/pyes,aparo/pyes,HackLinux/pyes,aparo/pyes,haiwen/pyes,Fiedzia/pyes,rookdev/pyes,mavarick/pyes,aparo/pyes,HackLinux/pyes,haiwen/pyes,HackLinux/pyes,Fiedzia/pyes,jayzeng/pyes,mavarick/pyes,haiwen/pyes,mavarick/pyes,Fiedzia/pyes
<REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Armando Guereca' class ScriptFields: _internal_name = "script_fields" """ This object create the script_fields definition """ def __init__(self, field_name, script, params = None): self.fields={} ...
Add ScriptFields object used as parameter script_fields of Search object
2eb8570d52c15b1061f74fe23c1f361ae8ab6d7c
CI/syntaxCheck.py
CI/syntaxCheck.py
import sys from CITests import CITests # Libs in Application Examples appExamples = { #"KundurSMIB":"/ApplicationExamples/KundurSMIB/package.mo", #"TwoAreas":"/ApplicationExamples/TwoAreas/package.mo", #"SevenBus":"/ApplicationExamples/SevenBus/package.mo", #"IEEE9":"/ApplicationExamples/IEEE9/package.mo", #"IEEE14":"...
import sys from CITests import CITests # Libs in Application Examples appExamples = { #"KundurSMIB":"/ApplicationExamples/KundurSMIB/package.mo", #"TwoAreas":"/ApplicationExamples/TwoAreas/package.mo", #"SevenBus":"/ApplicationExamples/SevenBus/package.mo", #"IEEE9":"/ApplicationExamples/IEEE9/package.mo", #"IEEE14":"...
Fix the location path of OpenIPSL
Fix the location path of OpenIPSL
Python
bsd-3-clause
SmarTS-Lab/OpenIPSL,SmarTS-Lab/OpenIPSL,tinrabuzin/OpenIPSL,OpenIPSL/OpenIPSL
<REPLACE_OLD> ci.runSyntaxCheck("OpenIPSL","/OpenIPSL/package.mo") if <REPLACE_NEW> ci.runSyntaxCheck("OpenIPSL","/OpenIPSL/OpenIPSL/package.mo") if <REPLACE_END> <|endoftext|> import sys from CITests import CITests # Libs in Application Examples appExamples = { #"KundurSMIB":"/ApplicationExamples/KundurSMIB/package...
Fix the location path of OpenIPSL import sys from CITests import CITests # Libs in Application Examples appExamples = { #"KundurSMIB":"/ApplicationExamples/KundurSMIB/package.mo", #"TwoAreas":"/ApplicationExamples/TwoAreas/package.mo", #"SevenBus":"/ApplicationExamples/SevenBus/package.mo", #"IEEE9":"/ApplicationExa...
56fca00d992c84e46e60fa8b9ea66eb9eadc7508
mgsv_names.py
mgsv_names.py
from __future__ import unicode_literals, print_function import sqlite3, os, random _select = 'select {0} from {1} limit 1 offset abs(random()) % (select count({0}) from {1});' _uncommon_select = 'select value from uncommons where key=?;' def generate_name(): conn = sqlite3.connect(os.path.join(os.path.dirname(__f...
from __future__ import unicode_literals, print_function import sqlite3, os, random _select_random = 'select {0} from {1} limit 1 offset abs(random()) % (select count({0}) from {1});' _select_uncommon = 'select value from uncommons where key=?;' def generate_name(): conn = sqlite3.connect(os.path.join(os.path.dirn...
Rename the SQL module vars for consistency.
Rename the SQL module vars for consistency.
Python
unlicense
rotated8/mgsv_names
<REPLACE_OLD> random _select <REPLACE_NEW> random _select_random <REPLACE_END> <REPLACE_OLD> {1});' _uncommon_select <REPLACE_NEW> {1});' _select_uncommon <REPLACE_END> <REPLACE_OLD> cursor.execute(_select.format('adjective', <REPLACE_NEW> cursor.execute(_select_random.format('adjective', <REPLACE_END> <REPLACE_OLD> ...
Rename the SQL module vars for consistency. from __future__ import unicode_literals, print_function import sqlite3, os, random _select = 'select {0} from {1} limit 1 offset abs(random()) % (select count({0}) from {1});' _uncommon_select = 'select value from uncommons where key=?;' def generate_name(): conn = sql...
1f6cb706d16153814ff5821998f0fb9216357573
src/main.py
src/main.py
#!/usr/bin/env python if __name__ == "__main__": run()
#!/usr/bin/env python """Simple Genetic Algorithm for solving TSP. Usage: main.py FILE --pop-size=POP_SIZE --max-gen=MAX_GENERATIONS --xover-rate=CROSSOVER_RATE --mute-rate=MUTATION_RATE --num-elites=NUM_ELITES --tournament-k=K main.py (-h | --help) main.py (-v | --version) Options: -h --help Show this s...
Build interface w/ docopt and add POD
Build interface w/ docopt and add POD
Python
unlicense
dideler/intro-to-genetic-algorithms
<REPLACE_OLD> python if __name__ == "__main__": <REPLACE_NEW> python """Simple Genetic Algorithm for solving TSP. Usage: main.py FILE --pop-size=POP_SIZE --max-gen=MAX_GENERATIONS --xover-rate=CROSSOVER_RATE --mute-rate=MUTATION_RATE --num-elites=NUM_ELITES --tournament-k=K main.py (-h | --help) main.py (-v |...
Build interface w/ docopt and add POD #!/usr/bin/env python if __name__ == "__main__": run()
0fe7cd8cf316dc6d4ef547d733b634de64fc768c
dbaas/dbaas_services/analyzing/admin/analyze.py
dbaas/dbaas_services/analyzing/admin/analyze.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django_services import admin from dbaas_services.analyzing.service import AnalyzeRepositoryService from dbaas_services.analyzing.forms import AnalyzeRepositoryForm class AnalyzeRepositoryAdmin(admin.DjangoServicesAdmin): form = ...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django_services import admin from dbaas_services.analyzing.service import AnalyzeRepositoryService from dbaas_services.analyzing.forms import AnalyzeRepositoryForm class AnalyzeRepositoryAdmin(admin.DjangoServicesAdmin): form = ...
Add more options on filters
Add more options on filters
Python
bsd-3-clause
globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service
<REPLACE_OLD> "volume_alarm") <REPLACE_NEW> "volume_alarm", "engine_name", "environment_name", "databaseinfra_name") <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django_services import admin from dbaas_services.analyzing.service i...
Add more options on filters # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django_services import admin from dbaas_services.analyzing.service import AnalyzeRepositoryService from dbaas_services.analyzing.forms import AnalyzeRepositoryForm class AnalyzeRepositoryAdmin(admin.Djan...
c3836bb9528c8dd45486ef0078f15e358a6e3977
ask_api_examples/list_all_c_and_fortran_models.py
ask_api_examples/list_all_c_and_fortran_models.py
"""Queries the CSDMS model repository for all models written in C, C++, Fortran 77, or Fortran 90.""" from ask_api_examples import make_query query = '[[Programming language::C||C++||Fortran77||Fortran90]]|limit=10000' def main(): r = make_query(query, __file__) return r if __name__ == '__main__': pri...
Add example to list all models written in Fortran or C/C++
Add example to list all models written in Fortran or C/C++
Python
mit
mdpiper/csdms-wiki-api-examples
<INSERT> """Queries the CSDMS model repository for all models written in C, C++, Fortran 77, or Fortran 90.""" from ask_api_examples import make_query query = '[[Programming language::C||C++||Fortran77||Fortran90]]|limit=10000' def main(): <INSERT_END> <INSERT> r = make_query(query, __file__) return r if _...
Add example to list all models written in Fortran or C/C++
73e50feae8fb6c06ace5f268e11c8df985e5eace
login/routers.py
login/routers.py
# List of apps that will use the users database USERS_DATABASE_APPS = ['auth','login','sessions'] class UserRouter(object): """ A router to control all database operations on models in the login application. """ def db_for_read(self, model, **hints): """ Attempts to read login model...
# List of apps that will use the users database USERS_DATABASE_APPS = ['auth', 'login', 'sessions', 'contenttypes', 'sites'] class UserRouter(object): """ A router to control all database operations on models in the login application. """ def db_for_read(self, model, **hints): """ A...
Add apps on list that will be used on the test databases
[login] Add apps on list that will be used on the test databases Added apps sites and contenttypes to the list. These apps were causing troubles on the test databases. Signed off by: Heitor Reis <marcheing@gmail.com> Signed off by: Filipe Vaz <vazfilipe92@gmail.com>
Python
agpl-3.0
SuperNovaPOLIUSP/supernova,SuperNovaPOLIUSP/supernova,SuperNovaPOLIUSP/supernova,SuperNovaPOLIUSP/supernova
<REPLACE_OLD> ['auth','login','sessions'] class <REPLACE_NEW> ['auth', 'login', 'sessions', 'contenttypes', 'sites'] class <REPLACE_END> <DELETE> print model._meta.app_label print "BRISA" <DELETE_END> <INSERT> print model._meta.app_label print "BRISA1" <INSERT_END> <INSERT> print model...
[login] Add apps on list that will be used on the test databases Added apps sites and contenttypes to the list. These apps were causing troubles on the test databases. Signed off by: Heitor Reis <marcheing@gmail.com> Signed off by: Filipe Vaz <vazfilipe92@gmail.com> # List of apps that will use the users database US...
dd01830cf9be3672d4223cdb37ed8bb410730b62
devil/devil/android/tools/adb_run_shell_cmd.py
devil/devil/android/tools/adb_run_shell_cmd.py
#!/usr/bin/env python # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import json import logging import sys from devil.android import device_blacklist from devil.android import device_erro...
Add util for running adb shell commands on device.
[Android] Add util for running adb shell commands on device. BUG=543257 Review URL: https://codereview.chromium.org/1498113002 Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#365301}
Python
bsd-3-clause
sahiljain/catapult,benschmaus/catapult,catapult-project/catapult-csm,catapult-project/catapult,catapult-project/catapult-csm,catapult-project/catapult-csm,sahiljain/catapult,benschmaus/catapult,catapult-project/catapult,catapult-project/catapult-csm,sahiljain/catapult,SummerLW/Perf-Insight-Report,catapult-project/catap...
<REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import json import logging import sys from devil.android import device_blacklist from dev...
[Android] Add util for running adb shell commands on device. BUG=543257 Review URL: https://codereview.chromium.org/1498113002 Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#365301}
a15855f83d44eee4a8fac3aea97658d8d0051f96
setup.py
setup.py
from distribute_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages version_classifiers = ['Programming Language :: Python :: %s' % version for version in ['2', '2.5', '2.6', '2.7']] other_classifiers = [ 'Development Status :: 5 - Production/Stable', ...
from distribute_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages version_classifiers = ['Programming Language :: Python :: %s' % version for version in ['2', '2.5', '2.6', '2.7']] other_classifiers = [ 'Development Status :: 5 - Production/Stable', ...
Use context managers to build detailed_description.
Use context managers to build detailed_description.
Python
bsd-3-clause
dougbeal/nosy
<REPLACE_OLD> ] readme_file = <REPLACE_NEW> ] with <REPLACE_END> <REPLACE_OLD> 'rt') try: <REPLACE_NEW> 'rt') as file_obj: <REPLACE_END> <REPLACE_OLD> readme_file.read() finally: <REPLACE_NEW> file_obj.read() with open('CHANGELOG', 'rt') as file_obj: <REPLACE_END> <REPLACE_OLD> readme_file.close() setup( <REPLA...
Use context managers to build detailed_description. from distribute_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages version_classifiers = ['Programming Language :: Python :: %s' % version for version in ['2', '2.5', '2.6', '2.7']] other_classifiers = [ ...
d5be5401a1666f6a4caa2604c9918345f6202b70
tests/testapp/models.py
tests/testapp/models.py
from django.db import models from django.utils.timezone import now from towel import deletion from towel.managers import SearchManager from towel.modelview import ModelViewURLs class PersonManager(SearchManager): search_fields = ('family_name', 'given_name') class Person(models.Model): created = models.Dat...
from django.db import models from django.utils.timezone import now from towel import deletion from towel.managers import SearchManager from towel.modelview import ModelViewURLs class PersonManager(SearchManager): search_fields = ('family_name', 'given_name') class Person(models.Model): created = models.Dat...
Use the item access variant instead
Use the item access variant instead
Python
bsd-3-clause
matthiask/towel,matthiask/towel,matthiask/towel,matthiask/towel
<REPLACE_OLD> self.urls.url('detail') class <REPLACE_NEW> self.urls['detail'] class <REPLACE_END> <REPLACE_OLD> self.urls.url('detail') <REPLACE_NEW> self.urls['detail'] <REPLACE_END> <|endoftext|> from django.db import models from django.utils.timezone import now from towel import deletion from towel.managers i...
Use the item access variant instead from django.db import models from django.utils.timezone import now from towel import deletion from towel.managers import SearchManager from towel.modelview import ModelViewURLs class PersonManager(SearchManager): search_fields = ('family_name', 'given_name') class Person(mo...
8d1bfe6b62d65c709c2feb91cc09b94d1c95f600
examples/lvm_cachepool.py
examples/lvm_cachepool.py
import os import blivet from blivet.size import Size from blivet.util import set_up_logging, create_sparse_tempfile set_up_logging() b = blivet.Blivet() # create an instance of Blivet (don't add system devices) # create a disk image file on which to create new devices disk1_file = create_sparse_tempfile("disk1", ...
Add LVM cache pool example
examples: Add LVM cache pool example
Python
lgpl-2.1
vojtechtrefny/blivet,vojtechtrefny/blivet,rvykydal/blivet,rvykydal/blivet
<REPLACE_OLD> <REPLACE_NEW> import os import blivet from blivet.size import Size from blivet.util import set_up_logging, create_sparse_tempfile set_up_logging() b = blivet.Blivet() # create an instance of Blivet (don't add system devices) # create a disk image file on which to create new devices disk1_file = cre...
examples: Add LVM cache pool example
bd5c215c1c481f3811753412bca6b509bb00591a
me_api/app.py
me_api/app.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from flask import Flask from .middleware.me import me from .cache import cache def _register_module(app, module): if module == 'douban': from .middleware import douban app.register_blueprint(...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from flask import Flask from werkzeug.utils import import_string from me_api.middleware.me import me from me_api.cache import cache middlewares = { 'douban': 'me_api.middleware.douban:douban_api', 'githu...
Improve the way that import middlewares
Improve the way that import middlewares
Python
mit
lord63/me-api
<REPLACE_OLD> Flask from .middleware.me <REPLACE_NEW> Flask from werkzeug.utils import import_string from me_api.middleware.me <REPLACE_END> <REPLACE_OLD> .cache <REPLACE_NEW> me_api.cache <REPLACE_END> <REPLACE_OLD> cache def _register_module(app, module): <REPLACE_NEW> cache middlewares = { <REPLACE_END> <REP...
Improve the way that import middlewares #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from flask import Flask from .middleware.me import me from .cache import cache def _register_module(app, module): if module == 'douban': from .middleware impo...
cfeca089dd10a6853d2b969d2d248a0f7d506d1a
emission/net/usercache/formatters/android/motion_activity.py
emission/net/usercache/formatters/android/motion_activity.py
import logging import emission.core.wrapper.motionactivity as ecwa import emission.net.usercache.formatters.common as fc import attrdict as ad def format(entry): formatted_entry = ad.AttrDict() formatted_entry["_id"] = entry["_id"] formatted_entry.user_id = entry.user_id metadata = entry.metadata ...
import logging import emission.core.wrapper.motionactivity as ecwa import emission.net.usercache.formatters.common as fc import attrdict as ad def format(entry): formatted_entry = ad.AttrDict() formatted_entry["_id"] = entry["_id"] formatted_entry.user_id = entry.user_id metadata = entry.metadata ...
Handle the weird field names from the new version of the API
Handle the weird field names from the new version of the API As part of the switch to cordova, we moved to a newer version of the google play API. Unfortunately, this meant that the weird field names for the confidence and type changed to a different set of weird field names. We should really use a standard wrapper cl...
Python
bsd-3-clause
e-mission/e-mission-server,sunil07t/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,yw374cornell/e-mission-server,e-mission/e-mission-server,joshzarrabi/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,joshzarrabi/e-mission-server,joshzarrabi/e-mission-server,yw374cornell/e-mis...
<INSERT> if 'agb' in entry.data: <INSERT_END> <INSERT> else: data.type = ecwa.MotionTypes(entry.data.zzaEg).value if 'agc' in entry.data: <INSERT_END> <INSERT> else: data.confidence = entry.data.zzaEh <INSERT_END> <|endoftext|> import logging import emission.core.wrapper.motio...
Handle the weird field names from the new version of the API As part of the switch to cordova, we moved to a newer version of the google play API. Unfortunately, this meant that the weird field names for the confidence and type changed to a different set of weird field names. We should really use a standard wrapper cl...
b52db04e4f57e805b3ff9a1b9a5ae61eb1a152d0
rx-tests/rx-async-test-with-closure.py
rx-tests/rx-async-test-with-closure.py
#!/usr/bin/env python3 ''' Process two different streams in parallel, retrieving them from the module's scope ''' import rx import asyncio from concurrent.futures import ThreadPoolExecutor from functools import partial import APIReaderTwitter as Twitter try: import json except ImportError: import si...
Add example of processing two different streams in separate threads retrieving the streams from the module's global scope.
Add example of processing two different streams in separate threads retrieving the streams from the module's global scope.
Python
mit
Pysellus/streaming-api-test,Pysellus/streaming-api-test
<INSERT> #!/usr/bin/env python3 ''' <INSERT_END> <INSERT> Process two different streams in parallel, retrieving them from the module's scope ''' import rx import asyncio from concurrent.futures import ThreadPoolExecutor from functools import partial import APIReaderTwitter as Twitter try: import json exc...
Add example of processing two different streams in separate threads retrieving the streams from the module's global scope.
31b70041a9fc7da87774bffd59a9f93917200f18
setup.py
setup.py
from setuptools import setup, find_packages with open('README.rst') as readme: long_description = ''.join(readme).strip() setup( name='rsocks', version='0.3.3', author='Jiangge Zhang', author_email='tonyseek@gmail.com', description='A SOCKS reverse proxy server.', long_description=long_d...
from setuptools import setup, find_packages with open('README.rst') as readme: long_description = ''.join(readme).strip() setup( name='rsocks', version='0.3.3', author='Jiangge Zhang', author_email='tonyseek@gmail.com', description='A SOCKS reverse proxy server.', long_description=long_d...
Upgrade PySocks to fix Python 3.10 compatbility
Upgrade PySocks to fix Python 3.10 compatbility
Python
mit
tonyseek/rsocks,tonyseek/rsocks
<INSERT> 3.10', 'Programming Language :: Python :: <INSERT_END> <REPLACE_OLD> 'PySocks>=1.5,<1.6', <REPLACE_NEW> 'PySocks>=1.7.1,<1.8', <REPLACE_END> <|endoftext|> from setuptools import setup, find_packages with open('README.rst') as readme: long_description = ''.join(readme).strip() setup( name=...
Upgrade PySocks to fix Python 3.10 compatbility from setuptools import setup, find_packages with open('README.rst') as readme: long_description = ''.join(readme).strip() setup( name='rsocks', version='0.3.3', author='Jiangge Zhang', author_email='tonyseek@gmail.com', description='A SOCKS re...
b4fa0194d995fd2ae20a11d8f27a6273e1f01aa9
sci_lib.py
sci_lib.py
#!/usr/bin/python #Author: Scott T. Salesky #Created: 12.6.2014 #Purpose: Collection of functions, routines to use #Python for scientific work #----------------------------------------------
Add function to read 3d direct access Fortran binary files into NumPy arrays.
Add function to read 3d direct access Fortran binary files into NumPy arrays.
Python
mit
ssalesky/Science-Library
<REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/python #Author: Scott T. Salesky #Created: 12.6.2014 #Purpose: Collection of functions, routines to use #Python for scientific work #---------------------------------------------- <REPLACE_END> <|endoftext|> #!/usr/bin/python #Author: Scott T. Salesky #Created: 12.6.2014 #Purpo...
Add function to read 3d direct access Fortran binary files into NumPy arrays.
f8e375bdc07b6fdefdae589f2d75c4ec0f5f3864
website/search/mutation_result.py
website/search/mutation_result.py
from models import Protein, Mutation class SearchResult: def __init__(self, protein, mutation, is_mutation_novel, type, **kwargs): self.protein = protein self.mutation = mutation self.is_mutation_novel = is_mutation_novel self.type = type self.meta_user = None self...
from models import Protein, Mutation from database import get_or_create class SearchResult: def __init__(self, protein, mutation, is_mutation_novel, type, **kwargs): self.protein = protein self.mutation = mutation self.is_mutation_novel = is_mutation_novel self.type = type ...
Fix result loading for novel mutations
Fix result loading for novel mutations
Python
lgpl-2.1
reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/ActiveDriverDB,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualist...
<REPLACE_OLD> Mutation class <REPLACE_NEW> Mutation from database import get_or_create class <REPLACE_END> <REPLACE_OLD> state['mutation'] = Mutation.query.filter_by( <REPLACE_NEW> state['mutation'], created = get_or_create( Mutation, <REPLACE_END> <REPLACE_OLD> ).one() <REPLACE_NEW> ) <REPLACE_END>...
Fix result loading for novel mutations from models import Protein, Mutation class SearchResult: def __init__(self, protein, mutation, is_mutation_novel, type, **kwargs): self.protein = protein self.mutation = mutation self.is_mutation_novel = is_mutation_novel self.type = type ...
6182fd214580e517ffe8a59ed89037adf7fd2094
traits/tests/test_dynamic_trait_definition.py
traits/tests/test_dynamic_trait_definition.py
from traits.testing.unittest_tools import unittest from traits.api import Float, HasTraits, Int, List class Foo(HasTraits): x = Float x_changes = List y_changes = List def _x_changed(self, new): self.x_changes.append(new) def _y_changed(self, new): self.y_changes.append(new) ...
from traits.testing.unittest_tools import unittest from traits.api import Float, HasTraits, Int, List class Foo(HasTraits): x = Float y_changes = List def _y_changed(self, new): self.y_changes.append(new) class TestDynamicTraitDefinition(unittest.TestCase): """ Test demonstrating special ...
Remove unused trait definitions in test.
Remove unused trait definitions in test.
Python
bsd-3-clause
burnpanck/traits,burnpanck/traits
<DELETE> x_changes = List <DELETE_END> <DELETE> def _x_changed(self, new): self.x_changes.append(new) <DELETE_END> <|endoftext|> from traits.testing.unittest_tools import unittest from traits.api import Float, HasTraits, Int, List class Foo(HasTraits): x = Float y_changes = List def _y...
Remove unused trait definitions in test. from traits.testing.unittest_tools import unittest from traits.api import Float, HasTraits, Int, List class Foo(HasTraits): x = Float x_changes = List y_changes = List def _x_changed(self, new): self.x_changes.append(new) def _y_changed(self, n...
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/...
<INSERT> """ =========================================== 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 sklear...
Add example plot script for RANSAC
4e3773d96a47b88529a01fa4c4a0f25bf1b77b1c
lib/github_test.py
lib/github_test.py
import unittest import github class TestGithub(unittest.TestCase): def setUp(self): pass def test_user(self): u = github.user() u1 = github.user() self.assertTrue(u) # make sure hash works self.assertTrue(u is u1) def test_has_issues(self): ...
import unittest import github class TestGithub(unittest.TestCase): def setUp(self): pass def test_user(self): u = github.user() u1 = github.user() self.assertTrue(u) # make sure hash works self.assertTrue(u is u1) def test_has_issues(self): ...
Remove old repo_from_path tests. This is a very hard functionality to test
Remove old repo_from_path tests. This is a very hard functionality to test
Python
mit
jonmorehouse/vimhub
<REPLACE_OLD> self.assertFalse(github.has_issues(("jonmorehouse/github-issues.vim"))) def test_repo_from_path(self): up = "/Users/MorehouseJ09/Desktop/github-issues.vim" self.assertTrue(github.repo_from_path(up)) if <REPLACE_NEW> self.assertFalse(github.has_issues(("jonmorehouse/github-issues.vim...
Remove old repo_from_path tests. This is a very hard functionality to test import unittest import github class TestGithub(unittest.TestCase): def setUp(self): pass def test_user(self): u = github.user() u1 = github.user() self.assertTrue(u) # make sure hash works ...
5bb84d5eac353cd4bbe1843fccaca64161830591
savu/__init__.py
savu/__init__.py
# Copyright 2014 Diamond Light Source Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
# Copyright 2014 Diamond Light Source Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
Update to make import of savu a little more useful
Update to make import of savu a little more useful
Python
apache-2.0
mjn19172/Savu,swtp1v07/Savu,swtp1v07/Savu,swtp1v07/Savu,mjn19172/Savu,swtp1v07/Savu,mjn19172/Savu,mjn19172/Savu,mjn19172/Savu
<REPLACE_OLD> <scientificsoftware@diamond.ac.uk> """ <REPLACE_NEW> <scientificsoftware@diamond.ac.uk> """ from . import core from . import data from . import plugins <REPLACE_END> <|endoftext|> # Copyright 2014 Diamond Light Source Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may ...
Update to make import of savu a little more useful # Copyright 2014 Diamond Light Source Ltd. # # 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....
82cb6d190ce1e805914cc791518c97e063ecdc96
tests/test_individual.py
tests/test_individual.py
import sys, os myPath = os.path.dirname(os.path.abspath(__file__)) print(myPath) sys.path.insert(0, myPath + '/../SATSolver') from unittest import TestCase from individual import Individual from BitVector import BitVector from bitarray import bitarray class TestIndividual(TestCase): """ Testing class for Ind...
import sys, os myPath = os.path.dirname(os.path.abspath(__file__)) print(myPath) sys.path.insert(0, myPath + '/../SATSolver') from unittest import TestCase from individual import Individual from bitarray import bitarray class TestIndividual(TestCase): """ Testing class for Individual. """ def test_g...
Remove BitVector import - Build fails
Remove BitVector import - Build fails
Python
mit
Imperium-Software/resolver,Imperium-Software/resolver,Imperium-Software/resolver,Imperium-Software/resolver
<DELETE> BitVector import BitVector from <DELETE_END> <|endoftext|> import sys, os myPath = os.path.dirname(os.path.abspath(__file__)) print(myPath) sys.path.insert(0, myPath + '/../SATSolver') from unittest import TestCase from individual import Individual from bitarray import bitarray class TestIndividual(TestCase...
Remove BitVector import - Build fails import sys, os myPath = os.path.dirname(os.path.abspath(__file__)) print(myPath) sys.path.insert(0, myPath + '/../SATSolver') from unittest import TestCase from individual import Individual from BitVector import BitVector from bitarray import bitarray class TestIndividual(TestCa...
1c41a79dc46bf717ee43ad46ac499f5310ad792e
invite/urls.py
invite/urls.py
from django.urls import path from invite import views app_name = 'invite' urlpatterns = [ path('', views.index, name='index'), path('invite/', views.invite, name='invite'), path('resend/(<slug:code>)/', views.resend, name='resend'), path('revoke/(<slug:code>)/', views.revoke, name='revoke'), path('...
from django.urls import path from invite import views app_name = 'invite' urlpatterns = [ path('', views.index, name='index'), path('invite/', views.invite, name='invite'), path('resend/<slug:code>/', views.resend, name='resend'), path('revoke/<slug:code>/', views.revoke, name='revoke'), path('logi...
Fix issue with URL patterns adding parentheses around codes.
Fix issue with URL patterns adding parentheses around codes.
Python
bsd-3-clause
unt-libraries/django-invite,unt-libraries/django-invite
<REPLACE_OLD> path('resend/(<slug:code>)/', <REPLACE_NEW> path('resend/<slug:code>/', <REPLACE_END> <REPLACE_OLD> path('revoke/(<slug:code>)/', <REPLACE_NEW> path('revoke/<slug:code>/', <REPLACE_END> <|endoftext|> from django.urls import path from invite import views app_name = 'invite' urlpatterns = [ path('', vi...
Fix issue with URL patterns adding parentheses around codes. from django.urls import path from invite import views app_name = 'invite' urlpatterns = [ path('', views.index, name='index'), path('invite/', views.invite, name='invite'), path('resend/(<slug:code>)/', views.resend, name='resend'), path('re...
2e3d133874e1df647df146ce90e0f4e2ccf84ef4
todo-list/todo.py
todo-list/todo.py
#!/usr/bin/env python # My solution to the following challenge: https://redd.it/39ws1x from datetime import date from collections import defaultdict class Todo: def __init__(self): self.items = defaultdict(list) def add_item(self, item, tag): self.items[tag].append(item) def remove_item(...
#!/usr/bin/env python # My solution to the following challenge: https://redd.it/39ws1x import os from datetime import date from collections import defaultdict home = os.path.expanduser('~') class Todo: def __init__(self): self.items = defaultdict(list) def __load_items(self): try: ...
Add and remove now work with minimal error checking.
Add and remove now work with minimal error checking.
Python
mit
Kredns/python
<REPLACE_OLD> https://redd.it/39ws1x from <REPLACE_NEW> https://redd.it/39ws1x import os from <REPLACE_END> <REPLACE_OLD> defaultdict class <REPLACE_NEW> defaultdict home = os.path.expanduser('~') class <REPLACE_END> <INSERT> def __load_items(self): try: with open(home + '/.config/todo/list'...
Add and remove now work with minimal error checking. #!/usr/bin/env python # My solution to the following challenge: https://redd.it/39ws1x from datetime import date from collections import defaultdict class Todo: def __init__(self): self.items = defaultdict(list) def add_item(self, item, tag): ...
fdf0daefac50de71a8c4f80a9ef877669ebea48b
byceps/services/tourney/transfer/models.py
byceps/services/tourney/transfer/models.py
""" byceps.services.tourney.transfer.models ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2019 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from typing import NewType from uuid import UUID from attr import attrs TourneyCategoryID = NewType('TourneyCategoryID', UUID) Tourne...
""" byceps.services.tourney.transfer.models ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2019 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from dataclasses import dataclass from typing import NewType from uuid import UUID TourneyCategoryID = NewType('TourneyCategoryID', UUID...
Change tourney match transfer model from `attrs` to `dataclass`
Change tourney match transfer model from `attrs` to `dataclass`
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps
<INSERT> dataclasses import dataclass from <INSERT_END> <REPLACE_OLD> UUID from attr import attrs TourneyCategoryID <REPLACE_NEW> UUID TourneyCategoryID <REPLACE_END> <REPLACE_OLD> UUID) @attrs(auto_attribs=True, frozen=True, slots=True) class <REPLACE_NEW> UUID) @dataclass(frozen=True) class <REPLACE_END> <|e...
Change tourney match transfer model from `attrs` to `dataclass` """ byceps.services.tourney.transfer.models ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2019 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from typing import NewType from uuid import UUID from attr import attrs ...
a1eaf7bcd40b96d4074202174af3dab5a0d026e1
projects/templatetags/projects_tags.py
projects/templatetags/projects_tags.py
from django.template.base import Library from django.core.urlresolvers import reverse from projects.models import ProjectBuild register = Library() @register.simple_tag() def build_url(build_id): """ Fetches the ProjectBuild for a given build_id, if any. """ try: build = ProjectBuild.object...
from django.template.base import Library from django.core.urlresolvers import reverse from projects.models import ProjectBuild register = Library() @register.simple_tag() def build_url(build_key): """ Fetches the ProjectBuild for a given build_id, if any. """ try: build = ProjectBuild.objec...
Change the project_tags parameter to use build_key which makes it clearer.
Change the project_tags parameter to use build_key which makes it clearer.
Python
mit
caio1982/capomastro,caio1982/capomastro,caio1982/capomastro
<REPLACE_OLD> build_url(build_id): <REPLACE_NEW> build_url(build_key): <REPLACE_END> <REPLACE_OLD> ProjectBuild.objects.get(build_key=build_id) <REPLACE_NEW> ProjectBuild.objects.get(build_key=build_key) <REPLACE_END> <|endoftext|> from django.template.base import Library from django.core.urlresolvers import revers...
Change the project_tags parameter to use build_key which makes it clearer. from django.template.base import Library from django.core.urlresolvers import reverse from projects.models import ProjectBuild register = Library() @register.simple_tag() def build_url(build_id): """ Fetches the ProjectBuild for a ...
6480a810b66a437ac716eb164c20f5bcc97d0934
src/handlers/admin.py
src/handlers/admin.py
from flask.ext.admin import Admin from flask.ext.admin.contrib.sqla import ModelView import db.schema as schema import db.query as query from handlers.rest import app admin = Admin(app, url="/admin") class RoundModelView(ModelView): def __init__(self, name=None, category=None, endpoint=None, url=None, **kwargs): ...
from flask.ext.admin import Admin from flask.ext.admin.contrib.sqla import ModelView import db.schema as schema import db.query as query from handlers.rest import app admin = Admin(app, url="/admin") class RoundModelView(ModelView): column_list = ('id', 'perspective', 'start_time') def __init__(self, name=None, ...
Fix list columns for all models
Fix list columns for all models
Python
apache-2.0
pascalc/narrative-roulette,pascalc/narrative-roulette
<INSERT> column_list = ('id', 'perspective', 'start_time') <INSERT_END> <INSERT> column_list = ('id', 'gender', 'text', 'created_at') <INSERT_END> <REPLACE_OLD> ) admin.add_view(RoundModelView()) admin.add_view(PerspectiveModelView()) admin.add_view(ModelView(schema.Submission, query.session)) <REPLACE_NEW> ) c...
Fix list columns for all models from flask.ext.admin import Admin from flask.ext.admin.contrib.sqla import ModelView import db.schema as schema import db.query as query from handlers.rest import app admin = Admin(app, url="/admin") class RoundModelView(ModelView): def __init__(self, name=None, category=None, endp...
aeb6ce26bdde8697e7beb3d06391a04f500f574a
mara_db/__init__.py
mara_db/__init__.py
from mara_db import config, views, cli MARA_CONFIG_MODULES = [config] MARA_NAVIGATION_ENTRY_FNS = [views.navigation_entry] MARA_ACL_RESOURCES = [views.acl_resource] MARA_FLASK_BLUEPRINTS = [views.blueprint] MARA_CLICK_COMMANDS = [cli.migrate]
"""Make the functionalities of this package auto-discoverable by mara-app""" def MARA_CONFIG_MODULES(): from . import config return [config] def MARA_FLASK_BLUEPRINTS(): from . import views return [views.blueprint] def MARA_AUTOMIGRATE_SQLALCHEMY_MODELS(): return [] def MARA_ACL_RESOURCES():...
Change MARA_XXX variables to functions to delay importing of imports (requires updating mara-app to 2.0.0)
Change MARA_XXX variables to functions to delay importing of imports (requires updating mara-app to 2.0.0)
Python
mit
mara/mara-db,mara/mara-db
<INSERT> """Make the functionalities of this package auto-discoverable by mara-app""" def MARA_CONFIG_MODULES(): <INSERT_END> <REPLACE_OLD> mara_db <REPLACE_NEW> . <REPLACE_END> <REPLACE_OLD> config, views, cli MARA_CONFIG_MODULES = [config] MARA_NAVIGATION_ENTRY_FNS = [views.navigation_entry] MARA_ACL_RESOURC...
Change MARA_XXX variables to functions to delay importing of imports (requires updating mara-app to 2.0.0) from mara_db import config, views, cli MARA_CONFIG_MODULES = [config] MARA_NAVIGATION_ENTRY_FNS = [views.navigation_entry] MARA_ACL_RESOURCES = [views.acl_resource] MARA_FLASK_BLUEPRINTS = [views.blueprint] ...
85246afcca06fe60567392216ffc6805521594d3
billjobs/tests/tests_export_account_email.py
billjobs/tests/tests_export_account_email.py
from django.test import TestCase from billjobs.admin import UserAdmin class EmailExportTestCase(TestCase): """ Tests for email account export """ def test_action_is_avaible(self): """ Test admin can select the action in dropdown list """ self.assertTrue(hasattr(UserAdmin, 'export_email'))
Add test for email account export
Add test for email account export
Python
mit
ioO/billjobs
<INSERT> from django.test import TestCase from billjobs.admin import UserAdmin class EmailExportTestCase(TestCase): <INSERT_END> <INSERT> """ Tests for email account export """ def test_action_is_avaible(self): """ Test admin can select the action in dropdown list """ self.assertTrue(hasattr(Us...
Add test for email account export
dff5a8650c5d7ed5b5bab12b36ac5d61541dbb4e
python/day3.py
python/day3.py
import sys def read_sides(line): return map(int, line.split()) def valid_triangle((a, b, c)): return a + b > c and b + c > a and a + c > b if __name__ == '__main__': print len(filter(valid_triangle, map(read_sides, sys.stdin)))
import sys import itertools def grouper(iterable, n, fillvalue=None): args = [iter(iterable)] * n return itertools.izip_longest(fillvalue=fillvalue, *args) def transpose(xs): return zip(*xs) def read_sides(line): return map(int, line.split()) def valid_triangle((a, b, c)): return a + b > c a...
Implement part 2 of day 3 Python solution.
Implement part 2 of day 3 Python solution.
Python
mit
jonathanj/advent2016
<REPLACE_OLD> sys def <REPLACE_NEW> sys import itertools def grouper(iterable, n, fillvalue=None): args = [iter(iterable)] * n return itertools.izip_longest(fillvalue=fillvalue, *args) def transpose(xs): return zip(*xs) def <REPLACE_END> <REPLACE_OLD> len(filter(valid_triangle, map(read_sides, sys.s...
Implement part 2 of day 3 Python solution. import sys def read_sides(line): return map(int, line.split()) def valid_triangle((a, b, c)): return a + b > c and b + c > a and a + c > b if __name__ == '__main__': print len(filter(valid_triangle, map(read_sides, sys.stdin)))
efac0ccf8357c5bee978513722331ee196b9936f
bin/resize_regions.py
bin/resize_regions.py
#!/usr/bin/env python # # resize_ranges # Resizes ranges in a BED file around a center point # import sys import argparse import csv def resize_row(row, width): start, end = int(row[1]), int(row[2]) original_range = end-start margin = (original_range - width) / 2 start = start + margin end = end ...
Add python script to resize regions
Add python script to resize regions
Python
mit
Duke-GCB/TrackHubGenerator,Duke-GCB/TrackHubGenerator
<REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python # # resize_ranges # Resizes ranges in a BED file around a center point # import sys import argparse import csv def resize_row(row, width): start, end = int(row[1]), int(row[2]) original_range = end-start margin = (original_range - width) / 2 start = ...
Add python script to resize regions
8f246f28809025ad18f4910d75f703d37ec31b11
examples/write_once.py
examples/write_once.py
"""An example of writing an API to scrapper hacker news once, and then enabling usage everywhere""" import hug import requests @hug.local() @hug.cli() @hug.get() def top_post(section:hug.types.one_of(('news', 'newest', 'show'))='news'): """Returns the top post from the provided section""" content = requests.g...
Add example of a write once API
Add example of a write once API
Python
mit
MuhammadAlkarouri/hug,timothycrosley/hug,timothycrosley/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,timothycrosley/hug
<INSERT> """An example of writing an API to scrapper hacker news once, and then enabling usage everywhere""" import hug import requests @hug.local() @hug.cli() @hug.get() def top_post(section:hug.types.one_of(('news', 'newest', 'show'))='news'): <INSERT_END> <INSERT> """Returns the top post from the provided secti...
Add example of a write once API
2f31183c2ec71baa826282e10ce7e6b7decbdc75
Tools/idle/IdlePrefs.py
Tools/idle/IdlePrefs.py
# Color Prefs for idle class ColorPrefs: CNormal = "black", "white" # "purple", "white" CKeyword = "#ff7700", None CComment = "#dd0000", None CString = "#00aa00", None CDefinition = "#0000ff", None CHilite = "#000068", "#006868" CSync = None, None # N...
# Color Prefs for idle class ColorPrefs: CNormal = "black", "white" # "purple", "white" CKeyword = "#ff7700", None CComment = "#dd0000", None CString = "#00aa00", None CDefinition = "#0000ff", None CHilite = "#000068", "#006868" CSync = None, None # N...
Make the color for stderr red (i.e. the standard warning/danger/stop color) rather than green. Suggested by Sam Schulenburg.
Make the color for stderr red (i.e. the standard warning/danger/stop color) rather than green. Suggested by Sam Schulenburg.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
<REPLACE_OLD> "#007700", <REPLACE_NEW> "red", <REPLACE_END> <|endoftext|> # Color Prefs for idle class ColorPrefs: CNormal = "black", "white" # "purple", "white" CKeyword = "#ff7700", None CComment = "#dd0000", None CString = "#00aa00", None CDefinition = "#0000ff", None CHil...
Make the color for stderr red (i.e. the standard warning/danger/stop color) rather than green. Suggested by Sam Schulenburg. # Color Prefs for idle class ColorPrefs: CNormal = "black", "white" # "purple", "white" CKeyword = "#ff7700", None CComment = "#dd0000", None CString = "#00a...
a6fba1b774d5ddeaa8eeab1b9a394a2d5ec0fdcf
tests/terminal_tests/__init__.py
tests/terminal_tests/__init__.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """
Add module for Terminal tests
Add module for Terminal tests
Python
mit
PatrikValkovic/grammpy
<REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ <REPLACE_END> <|endoftext|> #!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """
Add module for Terminal tests
54a3cf2994b2620fc3b0e62af8c91b034290e98a
tuskar_ui/infrastructure/dashboard.py
tuskar_ui/infrastructure/dashboard.py
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
Remove the Infrastructure panel group
Remove the Infrastructure panel group Remove the Infrastructure panel group, and place the panels directly under the Infrastructure dashboard. Change-Id: I321f9a84dd885732438ad58b6c62c480c9c10e37
Python
apache-2.0
rdo-management/tuskar-ui,rdo-management/tuskar-ui,rdo-management/tuskar-ui,rdo-management/tuskar-ui
<REPLACE_OLD> BasePanels(horizon.PanelGroup): <REPLACE_NEW> Infrastructure(horizon.Dashboard): name = _("Infrastructure") <REPLACE_END> <DELETE> name = _("Infrastructure") <DELETE_END> <DELETE> ) class Infrastructure(horizon.Dashboard): name = _("Infrastructure") slug = "infrastructure" panels =...
Remove the Infrastructure panel group Remove the Infrastructure panel group, and place the panels directly under the Infrastructure dashboard. Change-Id: I321f9a84dd885732438ad58b6c62c480c9c10e37 # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in complianc...
746420daec76bf605f0da57902bb60b2cb17c87d
bcbio/bed/__init__.py
bcbio/bed/__init__.py
import pybedtools as bt import six def concat(bed_files, catted=None): """ recursively concat a set of BED files, returning a sorted bedtools object of the result """ bed_files = [x for x in bed_files if x] if len(bed_files) == 0: if catted: # move to a .bed extension for do...
import pybedtools as bt import six def concat(bed_files, catted=None): """ recursively concat a set of BED files, returning a sorted bedtools object of the result """ bed_files = [x for x in bed_files if x] if len(bed_files) == 0: if catted: # move to a .bed extension for do...
Return None if no bed file exists to be opened.
Return None if no bed file exists to be opened.
Python
mit
guillermo-carrasco/bcbio-nextgen,biocyberman/bcbio-nextgen,lbeltrame/bcbio-nextgen,chapmanb/bcbio-nextgen,mjafin/bcbio-nextgen,elkingtonmcb/bcbio-nextgen,a113n/bcbio-nextgen,Cyberbio-Lab/bcbio-nextgen,guillermo-carrasco/bcbio-nextgen,vladsaveliev/bcbio-nextgen,brainstorm/bcbio-nextgen,chapmanb/bcbio-nextgen,lbeltrame/b...
<INSERT> if not bed_file: return bed_file else: <INSERT_END> <|endoftext|> import pybedtools as bt import six def concat(bed_files, catted=None): """ recursively concat a set of BED files, returning a sorted bedtools object of the result """ bed_files = [x for x in bed_files if ...
Return None if no bed file exists to be opened. import pybedtools as bt import six def concat(bed_files, catted=None): """ recursively concat a set of BED files, returning a sorted bedtools object of the result """ bed_files = [x for x in bed_files if x] if len(bed_files) == 0: if catt...
63d1eb69fc614cb3f019e7b37dd4ec10896c644e
chartflo/views.py
chartflo/views.py
# -*- coding: utf-8 -*- from django.views.generic import TemplateView from chartflo.factory import ChartDataPack class ChartsView(TemplateView): template_name = 'chartflo/charts.html' graph_type = "pie" title = "" def get_data(self): return {} def get_context_data(self, **kwargs): ...
# -*- coding: utf-8 -*- from django.views.generic import TemplateView from chartflo.factory import ChartDataPack class ChartsView(TemplateView): template_name = 'chartflo/charts.html' chart_type = "pie" title = "" def get_data(self): return {} def get_context_data(self, **kwargs): ...
Change graph_type for chart_type and remove it from context
Change graph_type for chart_type and remove it from context
Python
mit
synw/django-chartflo,synw/django-chartflo,synw/django-chartflo
<REPLACE_OLD> graph_type <REPLACE_NEW> chart_type <REPLACE_END> <DELETE> context["graph_type"] = self.graph_type <DELETE_END> <REPLACE_OLD> self.graph_type <REPLACE_NEW> self.chart_type <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*- from django.views.generic import TemplateView from chartflo.factory impor...
Change graph_type for chart_type and remove it from context # -*- coding: utf-8 -*- from django.views.generic import TemplateView from chartflo.factory import ChartDataPack class ChartsView(TemplateView): template_name = 'chartflo/charts.html' graph_type = "pie" title = "" def get_data(self): ...
19debebae3368be479b8368e96e17458e9a18d23
setup.py
setup.py
import os from setuptools import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup(name='windpowerlib', version='0.1.3', description='Creating time series of wind power plants.', url='http://github.com/wind-python/windpowerlib', author='oemof...
import os from setuptools import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup(name='windpowerlib', version='0.1.3', description='Creating time series of wind power plants.', url='http://github.com/wind-python/windpowerlib', author='oemof...
Add content type of long description
Add content type of long description
Python
mit
wind-python/windpowerlib
<INSERT> long_description_content_type='text/rst', <INSERT_END> <|endoftext|> import os from setuptools import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup(name='windpowerlib', version='0.1.3', description='Creating time series of wind power p...
Add content type of long description import os from setuptools import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup(name='windpowerlib', version='0.1.3', description='Creating time series of wind power plants.', url='http://github.com/wind-pyt...
b236a7961dbc9930ed135602cbed783818bde16e
kolibri/utils/tests/test_cli_at_import.py
kolibri/utils/tests/test_cli_at_import.py
""" Tests for `kolibri.utils.cli` module. These tests deliberately omit `@pytest.mark.django_db` from the tests, so that any attempt to access the Django database during the running of these cli methods will result in an error and test failure. """ from __future__ import absolute_import from __future__ import print_fun...
""" Tests for `kolibri.utils.cli` module. These tests deliberately omit `@pytest.mark.django_db` from the tests, so that any attempt to access the Django database during the running of these cli methods will result in an error and test failure. """ from __future__ import absolute_import from __future__ import print_fun...
Add regression test against options evaluation during import in cli.
Add regression test against options evaluation during import in cli.
Python
mit
learningequality/kolibri,learningequality/kolibri,learningequality/kolibri,indirectlylit/kolibri,indirectlylit/kolibri,learningequality/kolibri,indirectlylit/kolibri,indirectlylit/kolibri
<REPLACE_OLD> create_engine_mock.assert_not_called() <REPLACE_NEW> create_engine_mock.assert_not_called() @patch("kolibri.utils.options.read_options_file") def test_import_no_options_evaluation(read_options_mock): from kolibri.utils import cli # noqa F401 read_options_mock.assert_not_called() <REPLACE_END...
Add regression test against options evaluation during import in cli. """ Tests for `kolibri.utils.cli` module. These tests deliberately omit `@pytest.mark.django_db` from the tests, so that any attempt to access the Django database during the running of these cli methods will result in an error and test failure. """ f...
f185f04f6efdabe161ae29ba72f7208b8adccc41
bulletin/tools/plugins/models.py
bulletin/tools/plugins/models.py
from django.db import models from bulletin.models import Post class Event(Post): start_date = models.DateTimeField() end_date = models.DateTimeField(null=True, blank=True) time = models.CharField(max_length=255, null=True, blank=True) organization = models.CharField(max_l...
from django.db import models from bulletin.models import Post class Event(Post): start_date = models.DateTimeField() end_date = models.DateTimeField(null=True, blank=True) time = models.CharField(max_length=255, null=True, blank=True) organization = models.CharField(max_l...
Set verbose name of NewResource.
Set verbose name of NewResource.
Python
mit
AASHE/django-bulletin,AASHE/django-bulletin,AASHE/django-bulletin
<REPLACE_OLD> models.TextField() class <REPLACE_NEW> models.TextField() verbose_name = 'newresource' class <REPLACE_END> <|endoftext|> from django.db import models from bulletin.models import Post class Event(Post): start_date = models.DateTimeField() end_date = models.DateTimeField(null=True, blank...
Set verbose name of NewResource. from django.db import models from bulletin.models import Post class Event(Post): start_date = models.DateTimeField() end_date = models.DateTimeField(null=True, blank=True) time = models.CharField(max_length=255, null=True, blank=True) org...
926d1cea1a0c52325cc66dc51dd8b941a0dfa783
scripts/angle_deqp_test_merge.py
scripts/angle_deqp_test_merge.py
#!/usr/bin/env python # # Copyright 2021 The ANGLE Project Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Merges dEQP sharded test results in the ANGLE testing infrastucture.""" import os import sys d = os.path.dirname THIS_DIR =...
Add dEQP test merge script.
testing: Add dEQP test merge script. This script will allow ANGLE to process custom logic when we complete a suite of dEQP tests on the bots. The first customization step we can do is merge the myriad batch QPA files into one master QPA file. This script is currently a no-op and will let us set up the merge st...
Python
bsd-3-clause
ppy/angle,ppy/angle,ppy/angle,ppy/angle
<INSERT> #!/usr/bin/env python # # Copyright 2021 The ANGLE Project Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Merges dEQP sharded test results in the ANGLE testing infrastucture.""" import os import sys d = os.path.dirname T...
testing: Add dEQP test merge script. This script will allow ANGLE to process custom logic when we complete a suite of dEQP tests on the bots. The first customization step we can do is merge the myriad batch QPA files into one master QPA file. This script is currently a no-op and will let us set up the merge st...
7eb8da13a873604f12dd9a4b9e890be7447115c4
tests/services/authorization/test_service.py
tests/services/authorization/test_service.py
""" :Copyright: 2006-2018 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from byceps.services.authorization import service as authorization_service from tests.base import AbstractAppTestCase class AuthorizationServiceTestCase(AbstractAppTestCase): def test_get_permission_ids_for_user...
""" :Copyright: 2006-2018 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from byceps.services.authorization import service as authorization_service from tests.base import AbstractAppTestCase from tests.helpers import assign_permissions_to_user class AuthorizationServiceTestCase(AbstractAp...
Use existing test helper to create and assign permissions and roles
Use existing test helper to create and assign permissions and roles
Python
bsd-3-clause
m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps
<REPLACE_OLD> AbstractAppTestCase class <REPLACE_NEW> AbstractAppTestCase from tests.helpers import assign_permissions_to_user class <REPLACE_END> <DELETE> board_moderator_role = create_role_with_permissions('board_moderator', [ 'board_topic_hide', 'board_topic_pin', ]) ...
Use existing test helper to create and assign permissions and roles """ :Copyright: 2006-2018 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from byceps.services.authorization import service as authorization_service from tests.base import AbstractAppTestCase class AuthorizationServiceTes...
969559c6eb94405ecf470b310e752a80736aeeef
setup.py
setup.py
try: from setuptools import setup except ImportError: from disutils.core import setup try: from pypandoc import convert long_description = convert('README.md', 'rst') except: """ Don't fail if pandoc or pypandoc are not installed. However, it is better to publish the package with a form...
try: from setuptools import setup except ImportError: from disutils.core import setup try: from pypandoc import convert long_description = convert('README.md', 'rst') except: """ Don't fail if pandoc or pypandoc are not installed. However, it is better to publish the package with a form...
Add warning for missing pandoc
Add warning for missing pandoc
Python
mit
chargehound/chargehound-python
<INSERT> print(""" Warning: Missing pandoc, which is used to format \ the README. Install pypandoc and pandoc before publishing \ a new version.""") <INSERT_END> <|endoftext|> try: from setuptools import setup except ImportError: from disutils.core import setup try: from pypandoc import convert lon...
Add warning for missing pandoc try: from setuptools import setup except ImportError: from disutils.core import setup try: from pypandoc import convert long_description = convert('README.md', 'rst') except: """ Don't fail if pandoc or pypandoc are not installed. However, it is better to pub...
8216ba599b6c33207f413381b755d8db25c01440
spacy/tests/en/tokenizer/test_text.py
spacy/tests/en/tokenizer/test_text.py
# coding: utf-8 """Test that longer and mixed texts are tokenized correctly.""" from __future__ import unicode_literals import pytest def test_tokenizer_handles_long_text(en_tokenizer): text = """Tributes pour in for late British Labour Party leader Tributes poured in from around the world Thursday to the lat...
Add tests for longer and mixed English texts
Add tests for longer and mixed English texts
Python
mit
raphael0202/spaCy,banglakit/spaCy,honnibal/spaCy,oroszgy/spaCy.hu,aikramer2/spaCy,aikramer2/spaCy,banglakit/spaCy,raphael0202/spaCy,aikramer2/spaCy,Gregory-Howard/spaCy,Gregory-Howard/spaCy,aikramer2/spaCy,spacy-io/spaCy,spacy-io/spaCy,oroszgy/spaCy.hu,Gregory-Howard/spaCy,recognai/spaCy,banglakit/spaCy,banglakit/spaCy...
<INSERT> # coding: utf-8 """Test that longer and mixed texts are tokenized correctly.""" from __future__ import unicode_literals import pytest def test_tokenizer_handles_long_text(en_tokenizer): <INSERT_END> <INSERT> text = """Tributes pour in for late British Labour Party leader Tributes poured in from around...
Add tests for longer and mixed English texts
650126e0007dfda5cc8091ef8ee42991433b742f
product_sale_price_by_margin/migrations/8.0.0.3.0/pre-migration.py
product_sale_price_by_margin/migrations/8.0.0.3.0/pre-migration.py
# -*- encoding: utf-8 -*- from openerp import SUPERUSER_ID from openerp.modules.registry import RegistryManager def copy_column(cr, model, table, target_field, source_field, condition): print 'Making copy of columne %s to column %s' % ( source_field, target_field) cr.execute('SELECT id, %(field)s ' ...
ADD prod sale price by margin migration scripts
ADD prod sale price by margin migration scripts
Python
agpl-3.0
ingadhoc/product,ingadhoc/product
<REPLACE_OLD> <REPLACE_NEW> # -*- encoding: utf-8 -*- from openerp import SUPERUSER_ID from openerp.modules.registry import RegistryManager def copy_column(cr, model, table, target_field, source_field, condition): print 'Making copy of columne %s to column %s' % ( source_field, target_field) cr.execu...
ADD prod sale price by margin migration scripts
0a610a44f0d20170ba9c3e6f9ec4eafaac937be1
test/unit/filterer/test_pattern.py
test/unit/filterer/test_pattern.py
# :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. import pytest from bark.log import Log from bark.filterer.pattern import Pattern def test_missing_key_passes(): '''Test log record with missing key passes.''' log = Log() filterer = Pattern('bark\.tes...
Add unit test for Pattern filterer.
Add unit test for Pattern filterer.
Python
apache-2.0
4degrees/mill,4degrees/sawmill
<REPLACE_OLD> <REPLACE_NEW> # :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. import pytest from bark.log import Log from bark.filterer.pattern import Pattern def test_missing_key_passes(): '''Test log record with missing key passes.''' log = Log() ...
Add unit test for Pattern filterer.
6325b0eebbe5c14284df4fa5398ffc678c3e0eca
posts/tests.py
posts/tests.py
from test_plus.test import TestCase from posts.factories import PostFactory class PostsTest(TestCase): def test_get_list(self): post = PostFactory() post_list_url = self.reverse('post:list') self.get_check_200(post_list_url) self.assertResponseContains(post.title, html=False) ...
from test_plus.test import TestCase from posts.factories import PostFactory class PostsTest(TestCase): def test_get_list(self): # given post = PostFactory() post_list_url = self.reverse('post:list') # when self.get_check_200(post_list_url) # then self.asser...
Add given, when, then comment
Add given, when, then comment
Python
mit
9XD/9XD,9XD/9XD,9XD/9XD,9XD/9XD
<INSERT> # given <INSERT_END> <INSERT> # when <INSERT_END> <INSERT> # then <INSERT_END> <REPLACE_OLD> html=False) <REPLACE_NEW> html=False) <REPLACE_END> <INSERT> # given <INSERT_END> <REPLACE_OLD> jelly') <REPLACE_NEW> jelly') # when <REPLACE_END> <INSERT> # then ...
Add given, when, then comment from test_plus.test import TestCase from posts.factories import PostFactory class PostsTest(TestCase): def test_get_list(self): post = PostFactory() post_list_url = self.reverse('post:list') self.get_check_200(post_list_url) self.assertResponseContai...
bf15370e98a015fd0a989f7df2be6ba0383fbd78
submissions/McLean/myLogic.py
submissions/McLean/myLogic.py
cats = { 'kb': ''' Name(Felis, Catus) Name2(Catus, Cat) Name(Felis, Chaus) Name2(Chaus, JungleCat) Name(Panthera, Tigris) Name2(Tigris, Tiger) Name(Panthera, Onca) Name2(Onca, Jaguar) Name(Panthera, Pardus) Name2(Pardus, Leopared) Name(Panthera, Leo) Name2(Leo, Lion) Name(Felinae, Lynx) Name2(Lynx, Lynx) Name(Ac...
Bring my Github up to date, with latest CSP.
Bring my Github up to date, with latest CSP.
Python
mit
JoeLaMartina/AlphametricProject,NolanBecker/aima-python,AmberJBlue/aima-python,JamesDickenson/aima-python,AmberJBlue/aima-python,SimeonFritz/aima-python,jottenlips/aima-python,chandlercr/aima-python,WmHHooper/aima-python,AmberJBlue/aima-python,abbeymiles/aima-python,WhittKinley/aima-python,WmHHooper/aima-python,grantvk...
<INSERT> cats = { <INSERT_END> <INSERT> 'kb': ''' Name(Felis, Catus) Name2(Catus, Cat) Name(Felis, Chaus) Name2(Chaus, JungleCat) Name(Panthera, Tigris) Name2(Tigris, Tiger) Name(Panthera, Onca) Name2(Onca, Jaguar) Name(Panthera, Pardus) Name2(Pardus, Leopared) Name(Panthera, Leo) Name2(Leo, Lion) Name(Felinae, L...
Bring my Github up to date, with latest CSP.
4e94612f7fad4b231de9c1a4044259be6079a982
fabtasks.py
fabtasks.py
# -*- coding: utf-8 -*- from fabric.api import task, run def _generate_password(): import string from random import sample chars = string.letters + string.digits return ''.join(sample(chars, 8)) def create_mysql_instance(mysql_user, mysql_password, instance_code): user = instance_code passwo...
# -*- coding: utf-8 -*- from fabric.api import run def _generate_password(): import string from random import sample chars = string.letters + string.digits return ''.join(sample(chars, 8)) def create_mysql_instance(mysql_user, mysql_password, instance_code): user = instance_code password = _...
Split create database and create user into to individual commands
Split create database and create user into to individual commands
Python
mit
goncha/fablib
<DELETE> task, <DELETE_END> <REPLACE_OLD> cmd <REPLACE_NEW> cmd_create_database <REPLACE_END> <REPLACE_OLD> %s; grant <REPLACE_NEW> %s;\"" % ( mysql_user, mysql_password, 3306, user,) cmd_create_user = "/usr/bin/mysql -h localhost -u '%s' '--password=%s' -P %s -e \"grant <REPLACE_END> <REPLACE_OLD> ...
Split create database and create user into to individual commands # -*- coding: utf-8 -*- from fabric.api import task, run def _generate_password(): import string from random import sample chars = string.letters + string.digits return ''.join(sample(chars, 8)) def create_mysql_instance(mysql_user, ...
4298cb6ccaac055a4a8db250dc6143b37870edd6
openacademy/model/openacademy_session.py
openacademy/model/openacademy_session.py
from openerp import fields, models class Session(models.Model): _name = 'openacademy.session' name = fields.Char(required=True) start_date = fields.Date() duration = fields.Float(digits=(6, 2), help="Duration in days") seats = fields.Integer(string="Number of seats") instructor_id = fields.Ma...
from openerp import fields, models class Session(models.Model): _name = 'openacademy.session' name = fields.Char(required=True) start_date = fields.Date() duration = fields.Float(digits=(6, 2), help="Duration in days") seats = fields.Integer(string="Number of seats") instructor_id = fiel...
Add domain or and ilike
[REF] openacademy: Add domain or and ilike
Python
apache-2.0
Hiregui92/openacademy-project
<INSERT> <INSERT_END> <REPLACE_OLD> string="Instructor") <REPLACE_NEW> string="Instructor", domain=['|', ('instructor', '=', True), ('category_id.name', 'ilike', "Teacher")]) <REPLACE_END> <|endoftext|> from openerp import fields, models class Session(models.Model): _name =...
[REF] openacademy: Add domain or and ilike from openerp import fields, models class Session(models.Model): _name = 'openacademy.session' name = fields.Char(required=True) start_date = fields.Date() duration = fields.Float(digits=(6, 2), help="Duration in days") seats = fields.Integer(string="Num...
b66143e2984fb390766cf47dd2297a3f06ad26d0
apps/home/views.py
apps/home/views.py
# (c) Crown Owned Copyright, 2016. Dstl. from django.core.urlresolvers import reverse from django.shortcuts import redirect from django.views.generic.base import View from django.contrib.auth import login class Home(View): # Get the homepage. If the user isn't logged in, (we can find no trace # of the us...
# (c) Crown Owned Copyright, 2016. Dstl. from django.core.urlresolvers import reverse from django.shortcuts import redirect from django.views.generic.base import View from django.contrib.auth import login from django.contrib.auth import get_user_model class Home(View): # Get the homepage. If the user isn't log...
Add import statement for get_user_model.
Add import statement for get_user_model.
Python
mit
dstl/lighthouse,dstl/lighthouse,dstl/lighthouse,dstl/lighthouse,dstl/lighthouse
<REPLACE_OLD> login class <REPLACE_NEW> login from django.contrib.auth import get_user_model class <REPLACE_END> <|endoftext|> # (c) Crown Owned Copyright, 2016. Dstl. from django.core.urlresolvers import reverse from django.shortcuts import redirect from django.views.generic.base import View from django.contrib.aut...
Add import statement for get_user_model. # (c) Crown Owned Copyright, 2016. Dstl. from django.core.urlresolvers import reverse from django.shortcuts import redirect from django.views.generic.base import View from django.contrib.auth import login class Home(View): # Get the homepage. If the user isn't logged i...
07f531c7e3bbc0149fad4cfda75d8803cbc48e1d
smserver/chatplugin.py
smserver/chatplugin.py
#!/usr/bin/env python3 # -*- coding: utf8 -*- """ This module add the class needed for creating custom chat command :Example: Here's a simple ChatPlugin which will send a HelloWorld on use `` ChatHelloWorld(ChatPlugin): helper = "Display Hello World" cimmand def __call__...
#!/usr/bin/env python3 # -*- coding: utf8 -*- """ This module add the class needed for creating custom chat command :Example: Here's a simple ChatPlugin which will send a HelloWorld on use `` ChatHelloWorld(ChatPlugin): helper = "Display Hello World" command = "hello" de...
Correct chat plugin example in docsctring
Correct chat plugin example in docsctring
Python
mit
ningirsu/stepmania-server,Nickito12/stepmania-server,ningirsu/stepmania-server,Nickito12/stepmania-server
<REPLACE_OLD> cimmand <REPLACE_NEW> command = "hello" <REPLACE_END> <|endoftext|> #!/usr/bin/env python3 # -*- coding: utf8 -*- """ This module add the class needed for creating custom chat command :Example: Here's a simple ChatPlugin which will send a HelloWorld on use `` ChatHelloWorld(Cha...
Correct chat plugin example in docsctring #!/usr/bin/env python3 # -*- coding: utf8 -*- """ This module add the class needed for creating custom chat command :Example: Here's a simple ChatPlugin which will send a HelloWorld on use `` ChatHelloWorld(ChatPlugin): helper = "Display Hello W...
4223233a301657afb16536e4e589fd6ab0bec464
sparqllib/querycomponent/tests/test_triple.py
sparqllib/querycomponent/tests/test_triple.py
import unittest import sparqllib from rdflib import BNode, Literal class TestTriple(unittest.TestCase): def setUp(self): self.subject = BNode("subject") self.relation = BNode("relation") self.object = Literal("Cats") self.triple = sparqllib.Triple(self.subject, ...
Test for Triple query component
Test for Triple query component
Python
mit
ALSchwalm/sparqllib
<REPLACE_OLD> <REPLACE_NEW> import unittest import sparqllib from rdflib import BNode, Literal class TestTriple(unittest.TestCase): def setUp(self): self.subject = BNode("subject") self.relation = BNode("relation") self.object = Literal("Cats") self.triple = sparqllib.Triple(self....
Test for Triple query component
31b7ad0eaf4f74503a970e0cee303eb3bc5ea460
charity_server.py
charity_server.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 30 01:14:12 2017 @author: colm """ from flask import Flask, jsonify from parse_likecharity import refresh_charities import threading refresh_rate = 24 * 60 * 60 #Seconds # variables that are accessible from anywhere payload = {} # lock to control...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 30 01:14:12 2017 @author: colm """ from flask import Flask, jsonify from parse_likecharity import refresh_charities import threading from datetime import datetime refresh_rate = 24 * 60 * 60 #Seconds start_time = datetime.now() # variables that a...
Switch to datetime based on calls for updates.
Switch to datetime based on calls for updates.
Python
mit
colmcoughlan/alchemy-server
<REPLACE_OLD> threading refresh_rate <REPLACE_NEW> threading from datetime import datetime refresh_rate <REPLACE_END> <REPLACE_OLD> #Seconds # <REPLACE_NEW> #Seconds start_time = datetime.now() # <REPLACE_END> <REPLACE_OLD> @app.route("/") def <REPLACE_NEW> @app.route("/gci") def <REPLACE_END> <INSERT> delta =...
Switch to datetime based on calls for updates. #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 30 01:14:12 2017 @author: colm """ from flask import Flask, jsonify from parse_likecharity import refresh_charities import threading refresh_rate = 24 * 60 * 60 #Seconds # variables that are accessi...
966c22d4bae270a14176ae1c7b9887eb55743612
tests/conftest.py
tests/conftest.py
import datetime import odin.datetimeutil ARE_YOU_EXPERIENCED = datetime.date(1967, 5, 12) MWT = odin.datetimeutil.FixedTimezone(-6, 'Mountain War Time') BOOM = datetime.datetime(1945, 7, 16, 5, 29, 45, 0, MWT)
import os import sys import datetime import odin.datetimeutil HERE = os.path.abspath(os.path.dirname(__file__)) SRC = os.path.normpath(os.path.join(HERE, "..", "src")) sys.path.insert(0, SRC) ARE_YOU_EXPERIENCED = datetime.date(1967, 5, 12) MWT = odin.datetimeutil.FixedTimezone(-6, "Mountain War Time") BOOM = datetim...
Update tests to find source path
Update tests to find source path
Python
bsd-3-clause
python-odin/odin
<INSERT> os import sys import <INSERT_END> <REPLACE_OLD> odin.datetimeutil ARE_YOU_EXPERIENCED <REPLACE_NEW> odin.datetimeutil HERE = os.path.abspath(os.path.dirname(__file__)) SRC = os.path.normpath(os.path.join(HERE, "..", "src")) sys.path.insert(0, SRC) ARE_YOU_EXPERIENCED <REPLACE_END> <REPLACE_OLD> 'Mountain <R...
Update tests to find source path import datetime import odin.datetimeutil ARE_YOU_EXPERIENCED = datetime.date(1967, 5, 12) MWT = odin.datetimeutil.FixedTimezone(-6, 'Mountain War Time') BOOM = datetime.datetime(1945, 7, 16, 5, 29, 45, 0, MWT)
445f244ddac6001b65f03d058a14178a19919eed
diamondash/config.py
diamondash/config.py
import yaml from diamondash import utils class ConfigError(Exception): """Raised when there is an error parsing a configuration""" class ConfigMetaClass(type): def __new__(mcs, name, bases, dict): cls = type.__new__(mcs, name, bases, dict) defaults = {} for base in bases: ...
import yaml from diamondash import utils class ConfigError(Exception): """Raised when there is an error parsing a configuration""" class ConfigMetaClass(type): def __new__(mcs, name, bases, dict): cls = type.__new__(mcs, name, bases, dict) defaults = {} for base in bases: ...
Allow Config to be initialised without any args
Allow Config to be initialised without any args
Python
bsd-3-clause
praekelt/diamondash,praekelt/diamondash,praekelt/diamondash
<REPLACE_OLD> items): <REPLACE_NEW> items=None): <REPLACE_END> <REPLACE_OLD> self).__init__(self._parse(items)) <REPLACE_NEW> self).__init__(self._parse(items or {})) <REPLACE_END> <|endoftext|> import yaml from diamondash import utils class ConfigError(Exception): """Raised when there is an error parsing ...
Allow Config to be initialised without any args import yaml from diamondash import utils class ConfigError(Exception): """Raised when there is an error parsing a configuration""" class ConfigMetaClass(type): def __new__(mcs, name, bases, dict): cls = type.__new__(mcs, name, bases, dict) d...
2a820e1ed31e601a6c5b72a1a83f290b351a31ec
setup.py
setup.py
from setuptools import setup PACKAGE_VERSION = '0.1' deps = [] setup(name='wptserve', version=PACKAGE_VERSION, description="Python webserver intended for in web browser testing", long_description=open("README.md").read(), classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction...
from setuptools import setup PACKAGE_VERSION = '1.0' deps = [] setup(name='wptserve', version=PACKAGE_VERSION, description="Python webserver intended for in web browser testing", long_description=open("README.md").read(), # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifier...
Update package version to 1.0
Update package version to 1.0
Python
bsd-3-clause
youennf/wptserve
<REPLACE_OLD> '0.1' deps <REPLACE_NEW> '1.0' deps <REPLACE_END> <DELETE> classifiers=[], <DELETE_END> <INSERT> classifiers=["Development Status :: 5 - Production/Stable", "License :: OSI Approved :: BSD License", "Topic :: Internet :: WWW/HTTP :: HTTP Servers"], <INSERT_END> ...
Update package version to 1.0 from setuptools import setup PACKAGE_VERSION = '0.1' deps = [] setup(name='wptserve', version=PACKAGE_VERSION, description="Python webserver intended for in web browser testing", long_description=open("README.md").read(), classifiers=[], # Get strings from http:/...
295772657e61edf0dc10b3c5206248c6bfb6273f
py_naca0020_3d_openfoam/plotting.py
py_naca0020_3d_openfoam/plotting.py
""" Plotting functions. """ import matplotlib.pyplot as plt from .processing import * def plot_spanwise_pressure(ax=None): """Plot spanwise pressure, normalized and inverted.""" df = load_sampled_set("spanwise", "p") df["p_norm"] = -df.p df.p_norm -= df.p_norm.min() df.p_norm /= df.p_norm.max() ...
Add function to plot spanwise pressure
Add function to plot spanwise pressure
Python
mit
petebachant/actuatorLine-3D-turbinesFoam,petebachant/actuatorLine-3D-turbinesFoam,petebachant/actuatorLine-3D-turbinesFoam,petebachant/NACA0020-3D-OpenFOAM,petebachant/NACA0020-3D-OpenFOAM,petebachant/NACA0020-3D-OpenFOAM
<INSERT> """ Plotting functions. """ import matplotlib.pyplot as plt from .processing import * def plot_spanwise_pressure(ax=None): <INSERT_END> <INSERT> """Plot spanwise pressure, normalized and inverted.""" df = load_sampled_set("spanwise", "p") df["p_norm"] = -df.p df.p_norm -= df.p_norm.min() ...
Add function to plot spanwise pressure
f367d3122084c85e11efeb20d560a856e9f24d0e
zuice/django.py
zuice/django.py
django = __import__("django.conf.urls.defaults", {}) from zuice import Injector def _view_builder(bindings): def view(request, view_class, **kwargs): view_injector = Injector(bindings) view = view_injector.get_from_type(view_class) bindings_for_response = bindings.copy() bindings_...
django = __import__("django.conf.urls.defaults", {}) from zuice import Injector def _view_builder(bindings): def view(request, view_class, **kwargs): view_injector = Injector(bindings) view = view_injector.get_from_type(view_class) bindings_for_response = bindings.copy() bindings_...
Refactor url_to_class_builder so that the view is only built once
Refactor url_to_class_builder so that the view is only built once
Python
bsd-2-clause
mwilliamson/zuice
<INSERT> view = _view_builder(bindings.copy()) <INSERT_END> <REPLACE_OLD> _view_builder(bindings), <REPLACE_NEW> view, <REPLACE_END> <|endoftext|> django = __import__("django.conf.urls.defaults", {}) from zuice import Injector def _view_builder(bindings): def view(request, view_class, **kwargs): view_...
Refactor url_to_class_builder so that the view is only built once django = __import__("django.conf.urls.defaults", {}) from zuice import Injector def _view_builder(bindings): def view(request, view_class, **kwargs): view_injector = Injector(bindings) view = view_injector.get_from_type(view_class)...
c16e2fed1b64c2d875c99940912e2aa3e5d6c33f
polyaxon/auditor/service.py
polyaxon/auditor/service.py
import tracker from auditor.manager import default_manager from event_manager.event_service import EventService class AuditorService(EventService): """An service that just passes the event to author services.""" event_manager = default_manager def get_event(self, event_type, instance, **kwargs): ...
import auditor import tracker from auditor.manager import default_manager from event_manager.event_service import EventService class AuditorService(EventService): """An service that just passes the event to author services.""" event_manager = default_manager def get_event(self, event_type, instance, **...
Add activity logs to auditor tracking
Add activity logs to auditor tracking
Python
apache-2.0
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
<INSERT> auditor import <INSERT_END> <INSERT> **event['kwargs']) auditor.record(event_type=event['event_type'], instance=event['instance'], <INSERT_END> <|endoftext|> import auditor import tracker from auditor.manager import default_manager from event_manager.event...
Add activity logs to auditor tracking import tracker from auditor.manager import default_manager from event_manager.event_service import EventService class AuditorService(EventService): """An service that just passes the event to author services.""" event_manager = default_manager def get_event(self, ...
d1a43bb960d695ce74d38e9bd95218f655f057a0
forth-like/demo.py
forth-like/demo.py
#!/usr/bin/python """ demo.py -- Experimenting with expressing this forth-like pattern in Python. It appears it can be done with varargs and splatting. """ import sys import time def retry(*args): n = args[0] f = args[1] a = args[2:] for i in range(n): f(*a) def hello_sleep(*args): print 'hello' ...
#!/usr/bin/python """ demo.py -- Experimenting with expressing this forth-like pattern in Python. It appears it can be done with varargs and splatting. """ import sys import time def retry(n, f, *args): for i in range(n): f(*args) def hello_sleep(t): print 'hello' time.sleep(t) def retry_demo(): ret...
Remove manual indexing of args
Remove manual indexing of args
Python
apache-2.0
oilshell/blog-code,oilshell/blog-code,oilshell/blog-code,oilshell/blog-code,oilshell/blog-code,oilshell/blog-code,oilshell/blog-code
<REPLACE_OLD> retry(*args): n = args[0] f = args[1] a = args[2:] <REPLACE_NEW> retry(n, f, *args): <REPLACE_END> <REPLACE_OLD> f(*a) def hello_sleep(*args): <REPLACE_NEW> f(*args) def hello_sleep(t): <REPLACE_END> <REPLACE_OLD> time.sleep(args[0]) def <REPLACE_NEW> time.sleep(t) def <REPLACE_END> <RE...
Remove manual indexing of args #!/usr/bin/python """ demo.py -- Experimenting with expressing this forth-like pattern in Python. It appears it can be done with varargs and splatting. """ import sys import time def retry(*args): n = args[0] f = args[1] a = args[2:] for i in range(n): f(*a) def hello_s...
b6ac7ed0f8318cb708b3e49a7019891f702d7f4a
h2o-py/tests/testdir_algos/deepwater/pyunit_multiclass_deepwater.py
h2o-py/tests/testdir_algos/deepwater/pyunit_multiclass_deepwater.py
from __future__ import print_function import sys, os sys.path.insert(1, os.path.join("..","..","..")) import h2o from tests import pyunit_utils from h2o.estimators.deepwater import H2ODeepWaterEstimator def deepwater_multi(): print("Test checks if Deep Water works fine with a multiclass image dataset") frame = h2...
Add PyUnit for DeepWater cat/dog/mouse image classification.
Add PyUnit for DeepWater cat/dog/mouse image classification.
Python
apache-2.0
h2oai/h2o-3,mathemage/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,spennihana/h2o-3,spennihana/h2o-3,mathemage/h2o-3,h2oai/h2o-dev,h2oai/h2o-3,jangorecki/h2o-3,spennihana/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,jangorecki/h2o-3,jangorecki/h2o-3,jangorecki/h2o-3,h2oai/h2o-dev,h2oai/h2o-3,mathemage/h2o-3...
<INSERT> from __future__ import print_function import sys, os sys.path.insert(1, os.path.join("..","..","..")) import h2o from tests import pyunit_utils from h2o.estimators.deepwater import H2ODeepWaterEstimator def deepwater_multi(): <INSERT_END> <INSERT> print("Test checks if Deep Water works fine with a multiclass...
Add PyUnit for DeepWater cat/dog/mouse image classification.