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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d42b826ea6105956511cfb8f5e8d13b61f7c8033 | Ratings-Counter.py | Ratings-Counter.py | from pyspark import SparkConf, SparkContext
import collections
conf = SparkConf().setMaster("local").setAppName("RatingsHistogram")
sc = SparkContext(conf = conf)
lines = sc.textFile("ml-100k/u.data")
ratings = lines.map(lambda x: x.split()[2])
result = ratings.countByValue()
sortedResults = collections.Or... | # import os
# import sys
#
# # Path for spark source folder
# os.environ['SPARK_HOME'] = "/usr/local/Cellar/apache-spark/1.6.1"
#
# # Append pyspark to Python Path
# sys.path.append("/usr/local/Cellar/apache-spark/1.6.1/libexec/python")
# sys.path.append("/usr/local/Cellar/apache-spark/1.6.1/libexec/python/lib... | Test to make file run in IDE | Test to make file run in IDE
| Python | mit | tonirilix/apache-spark-hands-on | <REPLACE_OLD> from <REPLACE_NEW> # import os
# import sys
#
# # Path for spark source folder
# os.environ['SPARK_HOME'] = "/usr/local/Cellar/apache-spark/1.6.1"
#
# # Append pyspark to Python Path
# sys.path.append("/usr/local/Cellar/apache-spark/1.6.1/libexec/python")
# sys.path.append("/usr/local/Cellar/apac... | Test to make file run in IDE
from pyspark import SparkConf, SparkContext
import collections
conf = SparkConf().setMaster("local").setAppName("RatingsHistogram")
sc = SparkContext(conf = conf)
lines = sc.textFile("ml-100k/u.data")
ratings = lines.map(lambda x: x.split()[2])
result = ratings.countByValue()
... |
1acb0e5db755b0d4cc389ed32f740d7e65218a5e | celestial/views.py | celestial/views.py | from django.views.generic import ListView, DetailView
from .models import Planet, SolarSystem
class SystemMixin(object):
model = SolarSystem
def get_queryset(self):
return super(SystemMixin, self).get_queryset().filter(radius__isnull=False)
class PlanetMixin(object):
model = Planet
def get_... | from django.views.generic import ListView, DetailView
from .models import Planet, SolarSystem
class SystemMixin(object):
model = SolarSystem
def get_queryset(self):
return super(SystemMixin, self).get_queryset().filter(radius__isnull=False)
class PlanetMixin(object):
model = Planet
def get_... | Order planets by distance form their star. | Order planets by distance form their star.
| Python | mit | Floppy/kepler-explorer,Floppy/kepler-explorer,Floppy/kepler-explorer | <REPLACE_OLD> radius__isnull=False)})
<REPLACE_NEW> radius__isnull=False).order_by('semi_major_axis')})
<REPLACE_END> <|endoftext|> from django.views.generic import ListView, DetailView
from .models import Planet, SolarSystem
class SystemMixin(object):
model = SolarSystem
def get_queryset(self):
re... | Order planets by distance form their star.
from django.views.generic import ListView, DetailView
from .models import Planet, SolarSystem
class SystemMixin(object):
model = SolarSystem
def get_queryset(self):
return super(SystemMixin, self).get_queryset().filter(radius__isnull=False)
class PlanetMi... |
4ec16018192c1bd8fbe60a9e4c410c6c898149f0 | server/ec2spotmanager/migrations/0007_instance_type_to_list.py | server/ec2spotmanager/migrations/0007_instance_type_to_list.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-02-28 16:47
from __future__ import unicode_literals
from django.db import migrations, models
def instance_types_to_list(apps, schema_editor):
PoolConfiguration = apps.get_model("ec2spotmanager", "PoolConfiguration")
for pool in PoolConfiguration.ob... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-02-28 16:47
from __future__ import print_function, unicode_literals
import json
import sys
from django.db import migrations, models
def instance_type_to_list(apps, schema_editor):
PoolConfiguration = apps.get_model("ec2spotmanager", "PoolConfiguration"... | Fix migration. Custom triggers are not run in data migrations. | Fix migration. Custom triggers are not run in data migrations.
| Python | mpl-2.0 | MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager | <REPLACE_OLD> unicode_literals
from <REPLACE_NEW> print_function, unicode_literals
import json
import sys
from <REPLACE_END> <REPLACE_OLD> instance_types_to_list(apps, <REPLACE_NEW> instance_type_to_list(apps, <REPLACE_END> <REPLACE_OLD> pool.ec2_instance_types_list = [pool.ec2_instance_types]
<REPLACE_NEW> if pool.... | Fix migration. Custom triggers are not run in data migrations.
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-02-28 16:47
from __future__ import unicode_literals
from django.db import migrations, models
def instance_types_to_list(apps, schema_editor):
PoolConfiguration = apps.get_model("ec2spotman... |
d07722c8e7cc2efa0551830ca424d2db2bf734f3 | app/__init__.py | app/__init__.py | from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.uploads import UploadSet, configure_uploads, IMAGES
from config import config
bootstrap = Bootstrap()
db = SQLAlchemy()
login_manager = LoginManager()
l... | from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.uploads import UploadSet, configure_uploads, IMAGES
from helpers.text import slugify
from config import config
bootstrap = Bootstrap()
db = SQLAlchemy(... | Add slugify to the jinja2's globals scope | Add slugify to the jinja2's globals scope
| Python | mit | finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is | <INSERT> helpers.text import slugify
from <INSERT_END> <REPLACE_OLD> app.config.from_object(config[config_name])
<REPLACE_NEW> app.config.from_object(config[config_name])
app.jinja_env.globals.update(slugify=slugify)
<REPLACE_END> <|endoftext|> from flask import Flask
from flask.ext.bootstrap import Bootstrap
fr... | Add slugify to the jinja2's globals scope
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.uploads import UploadSet, configure_uploads, IMAGES
from config import config
bootstrap = Bootstrap()
db = SQ... |
eef768a538c82629073b360618d8b39bcbf4c474 | tests/dojo_test.py | tests/dojo_test.py | import unittest
from src.dojo import Dojo
class TestCreateRoom (unittest.TestCase):
def setUp(self):
self.dojo = Dojo()
self.test_office = self.dojo.create_room("office", "test")
self.test_living_space = self.dojo.create_room("living_space", "test living space")
def test_create_room_... | import unittest
from src.dojo import Dojo
class TestCreateRoom (unittest.TestCase):
def setUp(self):
self.dojo = Dojo()
self.test_office = self.dojo.create_room("office", "test")
self.test_living_space = self.dojo.create_room("living_space", "test living space")
def test_create_room_... | Implement test for duplicate rooms | Implement test for duplicate rooms
| Python | mit | EdwinKato/Space-Allocator,EdwinKato/Space-Allocator | <REPLACE_OLD> pass <REPLACE_NEW> initial_room_count = len(self.dojo.all_people)
room1 = self.dojo.create_room("office", "Blue")
room1 = self.dojo.create_room("office", "Blue")
new_room_count = len(self.dojo.all_people)
self.assertEqual(new_room_count - initial_room_count, 0) <REPLACE_END... | Implement test for duplicate rooms
import unittest
from src.dojo import Dojo
class TestCreateRoom (unittest.TestCase):
def setUp(self):
self.dojo = Dojo()
self.test_office = self.dojo.create_room("office", "test")
self.test_living_space = self.dojo.create_room("living_space", "test livin... |
5d01c58aef7f101531ecc7a44a83d225fa2fdcc8 | npc/linters/__init__.py | npc/linters/__init__.py | from . import changeling
| """
Linters for verifying the correctness of certain character types
The `commands.lint` function can lint all basic files, but special character
types sometimes need extra checks. The linters in this package encapsulate that
logic.
All linter packages have a single main entry point `lint` which accepts a
character i... | Add docstring to linters package | Add docstring to linters package
| Python | mit | aurule/npc,aurule/npc | <REPLACE_OLD> from <REPLACE_NEW> """
Linters for verifying the correctness of certain character types
The `commands.lint` function can lint all basic files, but special character
types sometimes need extra checks. The linters in this package encapsulate that
logic.
All linter packages have a single main entry point `... | Add docstring to linters package
from . import changeling
|
8a3b9c2b3a25bda85cf3d961758a986dbdc19084 | tests/test_advection.py | tests/test_advection.py | from parcels import Grid, Particle, JITParticle, AdvectionRK4, Geographic, GeographicPolar
import numpy as np
import pytest
from datetime import timedelta as delta
ptype = {'scipy': Particle, 'jit': JITParticle}
@pytest.fixture
def lon(xdim=200):
return np.linspace(-170, 170, xdim, dtype=np.float32)
@pytest.f... | Add a set of advection tests for meridional and zonal advection | Tests: Add a set of advection tests for meridional and zonal advection
| Python | mit | OceanPARCELS/parcels,OceanPARCELS/parcels | <REPLACE_OLD> <REPLACE_NEW> from parcels import Grid, Particle, JITParticle, AdvectionRK4, Geographic, GeographicPolar
import numpy as np
import pytest
from datetime import timedelta as delta
ptype = {'scipy': Particle, 'jit': JITParticle}
@pytest.fixture
def lon(xdim=200):
return np.linspace(-170, 170, xdim, ... | Tests: Add a set of advection tests for meridional and zonal advection
| |
ff3a3cd831a70d89864d040c9cc6a71a378a5569 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
from cron_sentry.version import VERSION
setup(
name='cron-sentry',
version=VERSION,
author='Yipit Coders',
author_email='coders@yipit.com',
description='Cron-Sentry is a command-line wrapper that reports unsuccessful runs to Sentry (... | #!/usr/bin/env python
from setuptools import setup, find_packages
from cron_sentry.version import VERSION
setup(
name='cron-sentry',
version=VERSION,
author='Yipit Coders',
author_email='coders@yipit.com',
description='Cron-Sentry is a command-line wrapper that reports unsuccessful runs to Sentry (... | Add missing package requirement of argparse. | Add missing package requirement of argparse.
| Python | mit | ciiol/cron-sentry,sysadmind/cron-sentry | <REPLACE_OLD> install_requires=['raven'],
<REPLACE_NEW> install_requires=['raven', 'argparse'],
<REPLACE_END> <|endoftext|> #!/usr/bin/env python
from setuptools import setup, find_packages
from cron_sentry.version import VERSION
setup(
name='cron-sentry',
version=VERSION,
author='Yipit Coders',
auth... | Add missing package requirement of argparse.
#!/usr/bin/env python
from setuptools import setup, find_packages
from cron_sentry.version import VERSION
setup(
name='cron-sentry',
version=VERSION,
author='Yipit Coders',
author_email='coders@yipit.com',
description='Cron-Sentry is a command-line wrap... |
7b5625a722a9b3e69636ffe3a89b9d314a1ce8e3 | netbox/extras/management/commands/clearcache.py | netbox/extras/management/commands/clearcache.py | from django.core.cache import cache
from django.core.management.base import BaseCommand
class Command(BaseCommand):
"""Command to clear the entire cache."""
help = 'Clears the cache.'
def handle(self, *args, **kwargs):
cache.clear()
self.stdout.write('Cache has been cleared.', ending="\n"... | Add management command for clearing cache | Add management command for clearing cache
| Python | apache-2.0 | digitalocean/netbox,digitalocean/netbox,digitalocean/netbox,digitalocean/netbox | <INSERT> from django.core.cache import cache
from django.core.management.base import BaseCommand
class Command(BaseCommand):
<INSERT_END> <INSERT> """Command to clear the entire cache."""
help = 'Clears the cache.'
def handle(self, *args, **kwargs):
cache.clear()
self.stdout.write('Cache h... | Add management command for clearing cache
| |
236d707697ba0aa68d2549f2c8bc6e4d038dd626 | cw_model.py | cw_model.py |
class CWModel(object):
def __init__(self, json_dict=None):
if json_dict is not None:
self.__dict__.update(json_dict)
def __repr__(self):
string = ''
for k, v in self.__dict__.items():
string = ''.join([string, '{}: {}\n'.format(k, v)])
return s... | Add super model class via upload | Add super model class via upload | Python | mit | joshuamsmith/ConnectPyse | <INSERT>
class CWModel(object):
<INSERT_END> <INSERT> def __init__(self, json_dict=None):
if json_dict is not None:
self.__dict__.update(json_dict)
def __repr__(self):
string = ''
for k, v in self.__dict__.items():
string = ''.join([string, '{}: {}\n'.fo... | Add super model class via upload
| |
d0c284139fe475a62fa53cde7e3e20cf2cc2d977 | plugins/FileHandlers/STLWriter/__init__.py | plugins/FileHandlers/STLWriter/__init__.py | from . import STLWriter
def getMetaData():
return {
'type': 'mesh_writer',
'plugin': {
"name": "STL Writer"
}
}
def register(app):
return STLWriter.STLWriter()
| from . import STLWriter
def getMetaData():
return {
'type': 'mesh_writer',
'plugin': {
"name": "STL Writer"
},
'mesh_writer': {
'extension': 'stl',
'description': 'STL File'
}
}
def register(app):
return STLWriter.STLWriter()
| Add writer metadata to the STL writer plugin so it can be used in Cura | Add writer metadata to the STL writer plugin so it can be used in Cura
| Python | agpl-3.0 | onitake/Uranium,onitake/Uranium | <INSERT> },
'mesh_writer': {
'extension': 'stl',
'description': 'STL File'
<INSERT_END> <|endoftext|> from . import STLWriter
def getMetaData():
return {
'type': 'mesh_writer',
'plugin': {
"name": "STL Writer"
},
'mesh_writer': {
... | Add writer metadata to the STL writer plugin so it can be used in Cura
from . import STLWriter
def getMetaData():
return {
'type': 'mesh_writer',
'plugin': {
"name": "STL Writer"
}
}
def register(app):
return STLWriter.STLWriter()
|
f01ce359618e66163f280eb386d70e1350addbc6 | py/top-k-frequent-elements.py | py/top-k-frequent-elements.py | import heapq
from operator import itemgetter
from collections import Counter
class Solution(object):
def topKFrequent(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: List[int]
"""
c = Counter(nums)
return map(itemgetter(1), heapq.nlargest(k, [(c... | Add py solution for 347. Top K Frequent Elements | Add py solution for 347. Top K Frequent Elements
347. Top K Frequent Elements: https://leetcode.com/problems/top-k-frequent-elements/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | <INSERT> import heapq
from operator import itemgetter
from collections import Counter
class Solution(object):
<INSERT_END> <INSERT> def topKFrequent(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: List[int]
"""
c = Counter(nums)
return map(itemge... | Add py solution for 347. Top K Frequent Elements
347. Top K Frequent Elements: https://leetcode.com/problems/top-k-frequent-elements/
| |
8c9fa6d2b31cc08212cb42ca4b429ae4a2793b70 | tools/shared-packs.py | tools/shared-packs.py | import os
import sys
import yaml
import paste.util.multidict
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
os.pardir))
if os.path.exists(os.path.join(possible_topdir,
'devsta... | Add tool that will show the shared packages | Add tool that will show the shared packages
| Python | apache-2.0 | stackforge/anvil,mc2014/anvil,stackforge/anvil,mc2014/anvil | <REPLACE_OLD> <REPLACE_NEW> import os
import sys
import yaml
import paste.util.multidict
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
os.pardir))
if os.path.exists(os.path.join(possible_topdir,
... | Add tool that will show the shared packages
| |
2988bc031187a21f5ff6a5c5f6af3af43dbb422c | rdmo/questions/migrations/0065_data_migration.py | rdmo/questions/migrations/0065_data_migration.py | from __future__ import unicode_literals
from django.db import migrations
def run_data_migration(apps, schema_editor):
Attribute = apps.get_model('domain', 'Attribute')
QuestionSet = apps.get_model('questions', 'QuestionSet')
questionsets = QuestionSet.objects.filter(is_collection=True)
for questions... | Add data migration to update questionsets | Add data migration to update questionsets
| Python | apache-2.0 | rdmorganiser/rdmo,rdmorganiser/rdmo,rdmorganiser/rdmo | <INSERT> from __future__ import unicode_literals
from django.db import migrations
def run_data_migration(apps, schema_editor):
<INSERT_END> <INSERT> Attribute = apps.get_model('domain', 'Attribute')
QuestionSet = apps.get_model('questions', 'QuestionSet')
questionsets = QuestionSet.objects.filter(is_coll... | Add data migration to update questionsets
| |
f5d9fbf618f44e8572344e04e9a09c7cae3302bb | neurodsp/plts/__init__.py | neurodsp/plts/__init__.py | """Plotting functions."""
from .time_series import plot_time_series, plot_bursts
from .filt import plot_filter_properties, plot_frequency_response, plot_impulse_response
from .rhythm import plot_swm_pattern, plot_lagged_coherence
from .spectral import plot_power_spectra, plot_scv, plot_scv_rs_lines, plot_scv_rs_matrix... | """Plotting functions."""
from .time_series import plot_time_series, plot_bursts, plot_instantaneous_measure
from .filt import plot_filter_properties, plot_frequency_response, plot_impulse_response
from .rhythm import plot_swm_pattern, plot_lagged_coherence
from .spectral import plot_power_spectra, plot_scv, plot_scv_... | Make plot_instantaneous_measure accessible from root of plots | Make plot_instantaneous_measure accessible from root of plots
| Python | apache-2.0 | voytekresearch/neurodsp | <REPLACE_OLD> plot_bursts
from <REPLACE_NEW> plot_bursts, plot_instantaneous_measure
from <REPLACE_END> <|endoftext|> """Plotting functions."""
from .time_series import plot_time_series, plot_bursts, plot_instantaneous_measure
from .filt import plot_filter_properties, plot_frequency_response, plot_impulse_response
fro... | Make plot_instantaneous_measure accessible from root of plots
"""Plotting functions."""
from .time_series import plot_time_series, plot_bursts
from .filt import plot_filter_properties, plot_frequency_response, plot_impulse_response
from .rhythm import plot_swm_pattern, plot_lagged_coherence
from .spectral import plot... |
0d1e5990d55bea9530beaa49aaf5091a6434a48e | newswall/providers/base.py | newswall/providers/base.py | from newswall.models import Story
class ProviderBase(object):
def __init__(self, source, config):
self.source = source
self.config = config
def update(self):
raise NotImplementedError
def create_story(self, object_url, **kwargs):
defaults = {'source': self.source}
... | from datetime import date, timedelta
from newswall.models import Story
class ProviderBase(object):
def __init__(self, source, config):
self.source = source
self.config = config
def update(self):
raise NotImplementedError
def create_story(self, object_url, **kwargs):
defa... | Set stories to inactive if a story with the same title has been published recently | Set stories to inactive if a story with the same title has been published recently
| Python | bsd-3-clause | HerraLampila/django-newswall,michaelkuty/django-newswall,matthiask/django-newswall,matthiask/django-newswall,HerraLampila/django-newswall,registerguard/django-newswall,registerguard/django-newswall,michaelkuty/django-newswall | <INSERT> datetime import date, timedelta
from <INSERT_END> <INSERT> if defaults.get('title'):
if Story.objects.filter(
title=defaults.get('title'),
timestamp__gte=date.today() - timedelta(days=3),
).exists():
defaults['is_active'] ... | Set stories to inactive if a story with the same title has been published recently
from newswall.models import Story
class ProviderBase(object):
def __init__(self, source, config):
self.source = source
self.config = config
def update(self):
raise NotImplementedError
def create_s... |
d0139d460b1f4710e8f870700ecf51336538d430 | examples/basic_flask.py | examples/basic_flask.py | import flask
import mmstats
application = app = flask.Flask(__name__)
app.config['DEBUG'] = True
class Stats(mmstats.MmStats):
ok = mmstats.CounterField(label="mmstats.example.ok")
bad = mmstats.CounterField(label="mmstats.example.bad")
working = mmstats.BoolField(label="mmstats.example.working")
stat... | import flask
import mmstats
application = app = flask.Flask(__name__)
app.config['DEBUG'] = True
class Stats(mmstats.MmStats):
ok = mmstats.CounterField(label="mmstats.example.ok")
bad = mmstats.CounterField(label="mmstats.example.bad")
working = mmstats.BoolField(label="mmstats.example.working")
stat... | Make the default OK page in the flask example obvious to find | Make the default OK page in the flask example obvious to find
| Python | bsd-3-clause | schmichael/mmstats,schmichael/mmstats,schmichael/mmstats,schmichael/mmstats | <REPLACE_OLD> app)
@app.route('/200')
def <REPLACE_NEW> app)
@app.route('/')
def <REPLACE_END> <REPLACE_OLD> 'OK'
@app.route('/500')
def <REPLACE_NEW> "OK or see /status for a single process's status"
@app.route('/500')
def <REPLACE_END> <|endoftext|> import flask
import mmstats
application = app = flask.Fla... | Make the default OK page in the flask example obvious to find
import flask
import mmstats
application = app = flask.Flask(__name__)
app.config['DEBUG'] = True
class Stats(mmstats.MmStats):
ok = mmstats.CounterField(label="mmstats.example.ok")
bad = mmstats.CounterField(label="mmstats.example.bad")
wor... |
84a2aa1187cf7a9ec7593920d9ad0708b7d28f55 | sqlobject/tests/test_pickle.py | sqlobject/tests/test_pickle.py | import pickle
from sqlobject import *
from sqlobject.tests.dbtest import *
########################################
## Pickle instances
########################################
class TestPickle(SQLObject):
question = StringCol()
answer = IntCol()
test_question = 'The Ulimate Question of Life, the Universe an... | import pickle
from sqlobject import *
from sqlobject.tests.dbtest import *
########################################
## Pickle instances
########################################
class TestPickle(SQLObject):
question = StringCol()
answer = IntCol()
test_question = 'The Ulimate Question of Life, the Universe an... | Fix flake8 E113 unexpected indentation | Fix flake8 E113 unexpected indentation
| Python | lgpl-2.1 | drnlm/sqlobject,sqlobject/sqlobject,sqlobject/sqlobject,drnlm/sqlobject | <REPLACE_OLD> TestPickle.get(test.id,
<REPLACE_NEW> TestPickle.get(
<REPLACE_END> <REPLACE_OLD> connection=getConnection(registry='')) # to make a different DB URI
<REPLACE_NEW> test.id,
<REPLACE_END> <INSERT> make a different DB URI <INSERT_END> <INSERT> connection=getCon... | Fix flake8 E113 unexpected indentation
import pickle
from sqlobject import *
from sqlobject.tests.dbtest import *
########################################
## Pickle instances
########################################
class TestPickle(SQLObject):
question = StringCol()
answer = IntCol()
test_question = 'The U... |
e50744ecf87e2210de9fb32bf8c34e71e1752463 | stack-builder/hiera_config.py | stack-builder/hiera_config.py | #!/usr/bin/env python
"""
stack-builder.hiera_config
~~~~~~~~~~~~~~~~~~~~~~~~~~
This module will read metadata set during instance
launch and override any yaml under the /etc/puppet/data
directory (except data_mappings) that has a key matching
the metadata
"""
import yaml
import os
hiera_dir ... | #!/usr/bin/env python
"""
stack-builder.hiera_config
~~~~~~~~~~~~~~~~~~~~~~~~~~
This module will read metadata set during instance
launch and override any yaml under the /etc/puppet/data
directory (except data_mappings) that has a key matching
the metadata
"""
import yaml
import os
hiera_dir ... | Fix bug dealing with spaces in exports | Fix bug dealing with spaces in exports
| Python | apache-2.0 | phchoic/puppet_openstack_builder,michaeltchapman/puppet_openstack_builder,michaeltchapman/puppet_openstack_builder,CiscoSystems/openstack-installer--to-be-replaced-by-puppet_openstack_builder,CiscoSystems/puppet_openstack_builder--to-be-deleted,michaeltchapman/vagrant-consul,CiscoSystems/puppet_openstack_builder,michae... | <INSERT> # Things with spaces can't be exported
if ' ' not in value:
<INSERT_END> <|endoftext|> #!/usr/bin/env python
"""
stack-builder.hiera_config
~~~~~~~~~~~~~~~~~~~~~~~~~~
This module will read metadata set during instance
launch and override any yaml under the /... | Fix bug dealing with spaces in exports
#!/usr/bin/env python
"""
stack-builder.hiera_config
~~~~~~~~~~~~~~~~~~~~~~~~~~
This module will read metadata set during instance
launch and override any yaml under the /etc/puppet/data
directory (except data_mappings) that has a key matching
the metadat... |
2da56c5bd7b5f33eb8e7769cb76c29a64058c96e | flexget/plugins/est_released_series.py | flexget/plugins/est_released_series.py | from __future__ import unicode_literals, division, absolute_import
import logging
from sqlalchemy import desc, func
from flexget.manager import Session
from flexget.plugin import register_plugin, priority
from flexget.plugins.filter.series import SeriesDatabase, Series, Episode
from flexget.utils.tools import multipl... | from __future__ import unicode_literals, division, absolute_import
import logging
from sqlalchemy import desc, func
from flexget.manager import Session
from flexget.plugin import register_plugin, priority, DependencyError
from flexget.utils.tools import multiply_timedelta
try:
from flexget.plugins.filter.series i... | Raise DependencyError when series plugin is missing | Raise DependencyError when series plugin is missing
| Python | mit | vfrc2/Flexget,dsemi/Flexget,Danfocus/Flexget,thalamus/Flexget,JorisDeRieck/Flexget,crawln45/Flexget,antivirtel/Flexget,ibrahimkarahan/Flexget,poulpito/Flexget,voriux/Flexget,drwyrm/Flexget,Pretagonist/Flexget,qk4l/Flexget,patsissons/Flexget,JorisDeRieck/Flexget,malkavi/Flexget,X-dark/Flexget,JorisDeRieck/Flexget,tsnoam... | <REPLACE_OLD> priority
from <REPLACE_NEW> priority, DependencyError
from flexget.utils.tools import multiply_timedelta
try:
from <REPLACE_END> <DELETE> SeriesDatabase, <DELETE_END> <REPLACE_OLD> Episode
from flexget.utils.tools import multiply_timedelta
log <REPLACE_NEW> Episode
except ImportError:
raise Depen... | Raise DependencyError when series plugin is missing
from __future__ import unicode_literals, division, absolute_import
import logging
from sqlalchemy import desc, func
from flexget.manager import Session
from flexget.plugin import register_plugin, priority
from flexget.plugins.filter.series import SeriesDatabase, Se... |
09ec38cdf1bf6be59f6961fbcbf9847e2b29ccfe | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
import colors
setup(
name='ansicolors',
version=colors.__version__,
description='ANSI colors for Python',
long_description=open('README.rst').read(),
author='Giorgos Verigakis',
author_email='verigak@gmail.com',
url='http://github.com/ve... | #!/usr/bin/env python
from setuptools import setup
import colors
setup(
name='ansicolors',
version=colors.__version__,
description='ANSI colors for Python',
long_description=open('README.rst').read(),
author='Giorgos Verigakis',
author_email='verigak@gmail.com',
url='http://github.com/ve... | Add requirement for version 2.6 and higher | Add requirement for version 2.6 and higher
Fixes #1 | Python | isc | Vietworm/colors,verigak/colors,jonathaneunice/colors,pombredanne/colors,grnet/colors | <REPLACE_OLD> Python'
<REPLACE_NEW> Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3'
<REPLACE_END> <|endoftext|> #!/usr/bin/env python
from setuptools import setup
import colors
setup(
name='ansicolors',
version=colors.__version__,
descript... | Add requirement for version 2.6 and higher
Fixes #1
#!/usr/bin/env python
from setuptools import setup
import colors
setup(
name='ansicolors',
version=colors.__version__,
description='ANSI colors for Python',
long_description=open('README.rst').read(),
author='Giorgos Verigakis',
author_ema... |
c31bde7660d8fbaa6d2e1404defb3f9d1ca13fea | chandra_aca/tests/test_dark_scale.py | chandra_aca/tests/test_dark_scale.py | import numpy as np
from .. import dark_scale
def test_dark_temp_scale():
scale = dark_scale.dark_temp_scale(-10., -14)
assert np.allclose(scale, 0.70)
scale = dark_scale.dark_temp_scale(-10., -14, scale_4c=2.0)
assert scale == 0.5 # Should be an exact match
| Add dark cal scale test | Add dark cal scale test
| Python | bsd-2-clause | sot/chandra_aca,sot/chandra_aca | <INSERT> import numpy as np
from .. import dark_scale
def test_dark_temp_scale():
<INSERT_END> <INSERT> scale = dark_scale.dark_temp_scale(-10., -14)
assert np.allclose(scale, 0.70)
scale = dark_scale.dark_temp_scale(-10., -14, scale_4c=2.0)
assert scale == 0.5 # Should be an exact match
<INSERT_END>... | Add dark cal scale test
| |
62503058850008d7b346d6e6b70943f5e2a1efba | app/taskqueue/celeryconfig.py | app/taskqueue/celeryconfig.py | # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | Set celery task results to expire in 1h | Set celery task results to expire in 1h
| Python | lgpl-2.1 | kernelci/kernelci-backend,kernelci/kernelci-backend | <REPLACE_OLD> "kjson"
CELERY_TIMEZONE <REPLACE_NEW> "kjson"
CELERY_TASK_RESULT_EXPIRES = 3600
CELERY_TIMEZONE <REPLACE_END> <|endoftext|> # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, e... | Set celery task results to expire in 1h
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is dist... |
56879634bda7c6c7024d0b9b4bf77c99e703f4f3 | server.py | server.py | """This module runs the api server."""
import os
from app import flask_app, db
from app.models import User, BucketList, BucketListItem
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.restful import Resource, Api
from app.api_v1.resources import TestResour... | """This module runs the api server."""
import os
from app import flask_app, db
from app.models import User, BucketList, BucketListItem
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.restful import Resource, Api
from app.api_v1.resources import TestResour... | Create BucketList & BucketLists endpoints. | [Feature] Create BucketList & BucketLists endpoints.
| Python | mit | andela-akiura/bucketlist | <INSERT> BucketListsApi, <INSERT_END> <REPLACE_OLD> '/')
api.add_resource(BucketListApi, '/bucketlists/')
api.add_resource(UserLogin, <REPLACE_NEW> '/')
api.add_resource(BucketListsApi, '/bucketlists/')
api.add_resource(BucketListApi, '/bucketlists/<id>/')
api.add_resource(UserLogin, <REPLACE_END> <|endoftext|> """This... | [Feature] Create BucketList & BucketLists endpoints.
"""This module runs the api server."""
import os
from app import flask_app, db
from app.models import User, BucketList, BucketListItem
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.restful import Res... |
5b9a92a77fb2830d904e239f08c444e0c2cd2e6c | wheelcms_axle/tests/test_middleware.py | wheelcms_axle/tests/test_middleware.py | import mock
from wheelcms_axle.middleware import FixMessageMiddleware
class TestFixMessageMiddleware(object):
def test_oldstyle(self):
""" mock CookieStorage raising IndexError """
with mock.patch("django.contrib.messages.storage.cookie"
".CookieStorage._decode", side_eff... | Add middleware, if not for keeping the coverage up :) | Add middleware, if not for keeping the coverage up :)
| Python | bsd-2-clause | wheelcms/wheelcms_axle,wheelcms/wheelcms_axle,wheelcms/wheelcms_axle,wheelcms/wheelcms_axle | <INSERT> import mock
from wheelcms_axle.middleware import FixMessageMiddleware
class TestFixMessageMiddleware(object):
<INSERT_END> <INSERT> def test_oldstyle(self):
""" mock CookieStorage raising IndexError """
with mock.patch("django.contrib.messages.storage.cookie"
".Co... | Add middleware, if not for keeping the coverage up :)
| |
526e90b2b47a68f128e3cd618fd67ed6aefeaff5 | mysite/profile/management/commands/profile_hourly_tasks.py | mysite/profile/management/commands/profile_hourly_tasks.py | import datetime
import logging
from django.core.management.base import BaseCommand
import mysite.profile.tasks
import mysite.search.models
import mysite.search.tasks
## FIXME: Move to a search management command?
def periodically_check_if_bug_epoch_eclipsed_the_cached_search_epoch():
logging.info("Checking if bu... | import datetime
import logging
from django.core.management.base import BaseCommand
import mysite.profile.tasks
import mysite.search.models
import mysite.search.tasks
## FIXME: Move to a search management command?
def periodically_check_if_bug_epoch_eclipsed_the_cached_search_epoch():
logging.info("Checking if bu... | Remove apparently superfluous call to fill_recommended_bugs_cache. | Remove apparently superfluous call to fill_recommended_bugs_cache.
| Python | agpl-3.0 | vipul-sharma20/oh-mainline,heeraj123/oh-mainline,willingc/oh-mainline,Changaco/oh-mainline,eeshangarg/oh-mainline,moijes12/oh-mainline,SnappleCap/oh-mainline,sudheesh001/oh-mainline,vipul-sharma20/oh-mainline,openhatch/oh-mainline,nirmeshk/oh-mainline,heeraj123/oh-mainline,mzdaniel/oh-mainline,vipul-sharma20/oh-mainlin... | <REPLACE_OLD> mysite.profile.tasks.sync_bug_epoch_from_model_then_fill_recommended_bugs_cache()
mysite.profile.tasks.fill_recommended_bugs_cache()
<REPLACE_NEW> mysite.profile.tasks.sync_bug_epoch_from_model_then_fill_recommended_bugs_cache()
<REPLACE_END> <|endoftext|> import datetime
import logging
from ... | Remove apparently superfluous call to fill_recommended_bugs_cache.
import datetime
import logging
from django.core.management.base import BaseCommand
import mysite.profile.tasks
import mysite.search.models
import mysite.search.tasks
## FIXME: Move to a search management command?
def periodically_check_if_bug_epoch_... |
6fd4e2e4158c968a095832f3bf669109dc9f1481 | mopidy_mpris/__init__.py | mopidy_mpris/__init__.py | import os
from mopidy import config, exceptions, ext
__version__ = "2.0.0"
class Extension(ext.Extension):
dist_name = "Mopidy-MPRIS"
ext_name = "mpris"
version = __version__
def get_default_config(self):
conf_file = os.path.join(os.path.dirname(__file__), "ext.conf")
return config... | import pathlib
from mopidy import config, exceptions, ext
__version__ = "2.0.0"
class Extension(ext.Extension):
dist_name = "Mopidy-MPRIS"
ext_name = "mpris"
version = __version__
def get_default_config(self):
return config.read(pathlib.Path(__file__).parent / "ext.conf")
def get_conf... | Use pathlib to read ext.conf | Use pathlib to read ext.conf
| Python | apache-2.0 | mopidy/mopidy-mpris | <REPLACE_OLD> os
from <REPLACE_NEW> pathlib
from <REPLACE_END> <DELETE> conf_file = os.path.join(os.path.dirname(__file__), "ext.conf")
<DELETE_END> <REPLACE_OLD> config.read(conf_file)
<REPLACE_NEW> config.read(pathlib.Path(__file__).parent / "ext.conf")
<REPLACE_END> <|endoftext|> import pathlib
from m... | Use pathlib to read ext.conf
import os
from mopidy import config, exceptions, ext
__version__ = "2.0.0"
class Extension(ext.Extension):
dist_name = "Mopidy-MPRIS"
ext_name = "mpris"
version = __version__
def get_default_config(self):
conf_file = os.path.join(os.path.dirname(__file__), "ex... |
7afa271a1e8513fa78300f5aee10f4e7b63df293 | jupyter_notebook_config.py | jupyter_notebook_config.py | # Configuration file for Jupyter-notebook.
# https://github.com/jupyter/docker-demo-images/blob/master/resources/jupyter_notebook_config.partial.py
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888 #9999
# Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real... | Add config file TODO: edit to work with IFrames | Add config file TODO: edit to work with IFrames
| Python | bsd-3-clause | ProjectPyRhO/Prometheus,ProjectPyRhO/Prometheus,ProjectPyRhO/Prometheus,ProjectPyRhO/Prometheus | <INSERT> # Configuration file for Jupyter-notebook.
# https://github.com/jupyter/docker-demo-images/blob/master/resources/jupyter_notebook_config.partial.py
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888 #9999
# Whether to trust or not X-Scheme/X-Forwarded-Proto a... | Add config file TODO: edit to work with IFrames
| |
28bc35bc8ed2646faf0d6662b54a5324c0fd1e31 | pspec/cli.py | pspec/cli.py | """
Python testing for humans.
Usage: pspec [<path>...]
Options:
-h --help show this
"""
from attest.hook import AssertImportHook
from docopt import docopt
import os
import sys
from .collectors import PSpecTests
def main():
arguments = docopt(__doc__)
paths = arguments['<path>']
if not paths:
... | """
Python testing for humans.
Usage: pspec [<path>...]
Options:
-h --help show this
"""
from attest.hook import AssertImportHook
from docopt import docopt
import os
import sys
from .collectors import PSpecTests
def main():
# When run as a console script (i.e. ``pspec``), the CWD isn't
# ``sys.path[0]`... | Put CWD at start of sys.path | Put CWD at start of sys.path
| Python | bsd-3-clause | bfirsh/pspec | <INSERT> # When run as a console script (i.e. ``pspec``), the CWD isn't
# ``sys.path[0]``, but it should be.
cwd = os.getcwd()
if sys.path[0] not in ('', cwd):
sys.path.insert(0, cwd)
<INSERT_END> <|endoftext|> """
Python testing for humans.
Usage: pspec [<path>...]
Options:
-h --help sh... | Put CWD at start of sys.path
"""
Python testing for humans.
Usage: pspec [<path>...]
Options:
-h --help show this
"""
from attest.hook import AssertImportHook
from docopt import docopt
import os
import sys
from .collectors import PSpecTests
def main():
arguments = docopt(__doc__)
paths = arguments['<p... |
ac9c8fe7519ff76b4f4002ae8c50e0185fa4bb88 | tools/test_filter.py | tools/test_filter.py | {
'bslmf_addreference': [ {'OS': 'Windows'} ],
'bslstl_iteratorutil': [ {'OS': 'SunOS'} ],
'bslstl_unorderedmultiset': [ {'OS': 'SunOS'} ],
'bslalg_constructorproxy': [ {'OS': 'AIX', 'library': 'shared_library'} ],
'bsls_atomic' : [
{'case': 7, 'HOST': 'VM', 'policy': 'skip' },
{'cas... | {
'bslmf_addreference': [ {'OS': 'Windows'} ],
'bslstl_iteratorutil': [ {'OS': 'SunOS'} ],
'bslstl_unorderedmultiset': [ {'OS': 'SunOS'} ],
'bsls_atomic' : [
{'case': 7, 'HOST': 'VM', 'policy': 'skip' },
{'case': 8, 'HOST': 'VM', 'policy': 'skip' },
],
'bsls_stopwatch' : [ {'case... | Remove exception for bslalg_constructorproxy test driver on AIX shared library builds. | Remove exception for bslalg_constructorproxy test driver on AIX shared library builds.
| Python | apache-2.0 | abeels/bde,che2/bde,minhlongdo/bde,bloomberg/bde-allocator-benchmarks,bowlofstew/bde,bloomberg/bde-allocator-benchmarks,jmptrader/bde,abeels/bde,dharesign/bde,frutiger/bde,che2/bde,apaprocki/bde,RMGiroux/bde-allocator-benchmarks,idispatch/bde,gbleaney/Allocator-Benchmarks,bloomberg/bde-allocator-benchmarks,idispatch/bd... | <DELETE> ],
'bslalg_constructorproxy': [ {'OS': 'AIX', 'library': 'shared_library'} <DELETE_END> <|endoftext|> {
'bslmf_addreference': [ {'OS': 'Windows'} ],
'bslstl_iteratorutil': [ {'OS': 'SunOS'} ],
'bslstl_unorderedmultiset': [ {'OS': 'SunOS'} ],
'bsls_atomic' : [
{'case': 7, 'HOST': 'VM... | Remove exception for bslalg_constructorproxy test driver on AIX shared library builds.
{
'bslmf_addreference': [ {'OS': 'Windows'} ],
'bslstl_iteratorutil': [ {'OS': 'SunOS'} ],
'bslstl_unorderedmultiset': [ {'OS': 'SunOS'} ],
'bslalg_constructorproxy': [ {'OS': 'AIX', 'library': 'shared_library'} ],
... |
495c922c221125bc86ca8a75b03e8c8738c41a7f | test/command_line/tst_hot_pixel_mask_to_xy.py | test/command_line/tst_hot_pixel_mask_to_xy.py | from __future__ import division
import os
import libtbx.load_env
from libtbx import easy_run
have_dials_regression = libtbx.env.has_module("dials_regression")
if have_dials_regression:
dials_regression = libtbx.env.find_in_repositories(
relative_path="dials_regression",
test=os.path.isdir)
def exercise_hot... | Test for jiffy to get hot pixel coordinates as x, y | Test for jiffy to get hot pixel coordinates as x, y
| Python | bsd-3-clause | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | <INSERT> from __future__ import division
import os
import libtbx.load_env
from libtbx import easy_run
have_dials_regression = libtbx.env.has_module("dials_regression")
if have_dials_regression:
<INSERT_END> <INSERT> dials_regression = libtbx.env.find_in_repositories(
relative_path="dials_regression",
test=os.... | Test for jiffy to get hot pixel coordinates as x, y
| |
1e87a9803c76128eec0c4a8f895f163682c8591e | examples/application/app_with_kv_in_template1.py | examples/application/app_with_kv_in_template1.py | '''
Application from a .kv
======================
The root application is created from the corresponding .kv. Check the test.kv
file to see what will be the root widget.
This example show how you can change the directory where the .kv live.
'''
import kivy
kivy.require('1.0.7')
from kivy.app import App
class TestA... | '''
Application from a .kv
======================
The root application is created from the corresponding .kv. Check the test.kv
file to see what will be the root widget.
This example shows how you can change the directory where the .kv lives.
'''
import kivy
kivy.require('1.0.7')
from kivy.app import App
class Te... | Correct description comment, add a line break | Correct description comment, add a line break | Python | mit | cbenhagen/kivy,niavlys/kivy,JohnHowland/kivy,ernstp/kivy,edubrunaldi/kivy,akshayaurora/kivy,manthansharma/kivy,andnovar/kivy,andnovar/kivy,inclement/kivy,arlowhite/kivy,CuriousLearner/kivy,Farkal/kivy,tony/kivy,yoelk/kivy,angryrancor/kivy,darkopevec/kivy,MiyamotoAkira/kivy,CuriousLearner/kivy,janssen/kivy,CuriousLearne... | <REPLACE_OLD> widget.
This <REPLACE_NEW> widget.
This <REPLACE_END> <REPLACE_OLD> show <REPLACE_NEW> shows <REPLACE_END> <REPLACE_OLD> live.
'''
import <REPLACE_NEW> lives.
'''
import <REPLACE_END> <|endoftext|> '''
Application from a .kv
======================
The root application is created from the corresponding... | Correct description comment, add a line break
'''
Application from a .kv
======================
The root application is created from the corresponding .kv. Check the test.kv
file to see what will be the root widget.
This example show how you can change the directory where the .kv live.
'''
import kivy
kivy.require('1... |
ccbceb486dd4775ec6dfe3764e522a869860703b | examples/rbd_fast/rbd_fast.py | examples/rbd_fast/rbd_fast.py | import sys
sys.path.append('../..')
from SALib.analyze import rbd_fast
from SALib.sample import latin
from SALib.test_functions import Ishigami
from SALib.util import read_param_file
# Read the parameter range file and generate samples
problem = read_param_file('../../src/SALib/test_functions/params/Ishigami... | import sys
sys.path.append('../..')
from SALib.analyze import rbd_fast
from SALib.sample import latin
from SALib.test_functions import Ishigami
from SALib.util import read_param_file
# Read the parameter range file and generate samples
problem = read_param_file('../../src/SALib/test_functions/params/Ishigami... | Fix incorrect description of returned dict entries | Fix incorrect description of returned dict entries
| Python | mit | jdherman/SALib,SALib/SALib,jdherman/SALib | <REPLACE_OLD> keys 'S1' and 'ST'
# <REPLACE_NEW> key 'S1'
# <REPLACE_END> <|endoftext|> import sys
sys.path.append('../..')
from SALib.analyze import rbd_fast
from SALib.sample import latin
from SALib.test_functions import Ishigami
from SALib.util import read_param_file
# Read the parameter range file and g... | Fix incorrect description of returned dict entries
import sys
sys.path.append('../..')
from SALib.analyze import rbd_fast
from SALib.sample import latin
from SALib.test_functions import Ishigami
from SALib.util import read_param_file
# Read the parameter range file and generate samples
problem = read_param... |
ee3428d98d9cf322233ac9abfa9cd81513b530e0 | medical_medicament_us/__manifest__.py | medical_medicament_us/__manifest__.py | # -*- coding: utf-8 -*-
# © 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Medical Medicament - US Locale',
'version': '10.0.1.0.0',
'author': "LasLabs, Odoo Community Association (OCA)",
'category': 'Medical',
'depends': [
'medical_base_u... | # -*- coding: utf-8 -*-
# © 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Medical Medicament - US Locale',
'version': '10.0.1.0.0',
'author': "LasLabs, Odoo Community Association (OCA)",
'category': 'Medical',
'depends': [
'medical_base_u... | Add missing dependency * medical.medicament.ndc relates to medical.manufacturer, which does not exist without it defined as a dependency. | [FIX] medical_medicament_us: Add missing dependency
* medical.medicament.ndc relates to medical.manufacturer, which does not exist without it defined as a dependency.
| Python | agpl-3.0 | laslabs/vertical-medical,laslabs/vertical-medical | <INSERT> 'medical_manufacturer',
<INSERT_END> <|endoftext|> # -*- coding: utf-8 -*-
# © 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Medical Medicament - US Locale',
'version': '10.0.1.0.0',
'author': "LasLabs, Odoo Community Association (OCA)",... | [FIX] medical_medicament_us: Add missing dependency
* medical.medicament.ndc relates to medical.manufacturer, which does not exist without it defined as a dependency.
# -*- coding: utf-8 -*-
# © 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Medical Medicament -... |
40688413e59aaabd4a92dba4d2f402fb42fee143 | 1-multiples-of-3-and-5.py | 1-multiples-of-3-and-5.py | from itertools import chain
def threes_and_fives_gen(num=1000):
for i in range(num):
if i % 3 == 0 or i % 5 == 0:
yield i
def threes_and_fives_fun(n):
return set(chain(range(3, n+1, 3), range(5, n+1, 5)))
def solve(n):
return sum(
filter(lambda x: x%3==0 or x%5==0,
... | from itertools import chain
def threes_and_fives_gen(num=1000):
for i in range(num):
if i % 3 == 0 or i % 5 == 0:
yield i
def threes_and_fives_fun(n):
return set(chain(range(3, n+1, 3), range(5, n+1, 5)))
def solve(n):
return sum(
filter(lambda x: x%3==0 or x%5==0,
... | Add gen exp solution to 1 | Add gen exp solution to 1
| Python | mit | dawran6/project-euler | <INSERT> )
def solve_2(n):
return sum(
x
for x in range(1, n)
if x%3==0 or x%5==0
<INSERT_END> <REPLACE_OLD> print(sum(three_and_fives_gen(10000000)))
<REPLACE_NEW> print(solve_2(1000000))
<REPLACE_END> <|endoftext|> from itertools import chain
def threes_and_fives_gen(nu... | Add gen exp solution to 1
from itertools import chain
def threes_and_fives_gen(num=1000):
for i in range(num):
if i % 3 == 0 or i % 5 == 0:
yield i
def threes_and_fives_fun(n):
return set(chain(range(3, n+1, 3), range(5, n+1, 5)))
def solve(n):
return sum(
filter(lambda x: x%... |
8162cf98f04125b7db1460a42a177eae516660d0 | appliance/getready.py | appliance/getready.py | # -*- coding: utf-8 -*-
import RPi.GPIO as gpio
pin_power=12
pin_light=16
# Setup
gpio.setmode(gpio.BOARD)
gpio.setup(pin_power, gpio.OUT)
gpio.setup(pin_light, gpio.OUT)
gpio.output(pin_power, gpio.HIGH)
gpio.output(pin_light, gpio.LOW)
| # -*- coding: utf-8 -*-
import RPi.GPIO as gpio
pin_power=3
pin_light=5
# Setup
gpio.setmode(gpio.BOARD)
gpio.setup(pin_power, gpio.OUT)
gpio.setup(pin_light, gpio.OUT)
gpio.output(pin_power, gpio.HIGH)
gpio.output(pin_light, gpio.LOW)
| Modify the pin number due to the hardware case | Modify the pin number due to the hardware case
| Python | apache-2.0 | kensonman/IMCSmartHome,kensonman/IMCSmartHome,kensonman/IMCSmartHome | <REPLACE_OLD> gpio
pin_power=12
pin_light=16
# <REPLACE_NEW> gpio
pin_power=3
pin_light=5
# <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*-
import RPi.GPIO as gpio
pin_power=3
pin_light=5
# Setup
gpio.setmode(gpio.BOARD)
gpio.setup(pin_power, gpio.OUT)
gpio.setup(pin_light, gpio.OUT)
gpio.output(pin_power,... | Modify the pin number due to the hardware case
# -*- coding: utf-8 -*-
import RPi.GPIO as gpio
pin_power=12
pin_light=16
# Setup
gpio.setmode(gpio.BOARD)
gpio.setup(pin_power, gpio.OUT)
gpio.setup(pin_light, gpio.OUT)
gpio.output(pin_power, gpio.HIGH)
gpio.output(pin_light, gpio.LOW)
|
9674f2d1f459db6e231d81fa979db07d4805ca29 | shuup/admin/modules/shops/views/list.py | shuup/admin/modules/shops/views/list.py | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.conf import settings
fr... | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.conf import settings
fr... | Modify shops for dynamic columns | Modify shops for dynamic columns
Refs SH-64
| Python | agpl-3.0 | shoopio/shoop,suutari/shoop,suutari-ai/shoop,shawnadelic/shuup,suutari/shoop,shawnadelic/shuup,shoopio/shoop,suutari/shoop,suutari-ai/shoop,shawnadelic/shuup,shoopio/shoop,suutari-ai/shoop | <REPLACE_OLD> columns <REPLACE_NEW> default_columns <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tr... | Modify shops for dynamic columns
Refs SH-64
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode... |
f8c8c14e0ca6f8e3174a14f519b395a4e0bfe043 | setup.py | setup.py | from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
#import here, cause outside the eggs a... | from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
#import here, cause outside the eggs a... | Install requirements now include SciPy. | Install requirements now include SciPy.
Used in the operators subpackage, and will likely be used elsewhere due
to the sparse package being inside scipy.
| Python | bsd-3-clause | ryanorendorff/pyop | <REPLACE_OLD> = ['six <REPLACE_NEW> =
[ 'six <REPLACE_END> <REPLACE_OLD> 1.6', <REPLACE_NEW> 1.6'
, <REPLACE_END> <REPLACE_OLD> 1.8']
<REPLACE_NEW> 1.8'
, 'scipy >= 0.14.0'
]
<REPLACE_END> <|endoftext|> from setuptools import setup
from setuptools.command.test import test as TestComma... | Install requirements now include SciPy.
Used in the operators subpackage, and will likely be used elsewhere due
to the sparse package being inside scipy.
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options(self):
TestComman... |
0ede4e22370a3f8217fee8ff995a9c7057d8b00b | vumi_http_retry/tests/test_redis.py | vumi_http_retry/tests/test_redis.py | import json
from twisted.trial.unittest import TestCase
from twisted.internet.defer import inlineCallbacks
from vumi_http_retry.tests.redis import create_client, zitems
class TestRedis(TestCase):
@inlineCallbacks
def setUp(self):
self.redis = yield create_client()
@inlineCallbacks
def tearD... | Add test for redis test helper | Add test for redis test helper
| Python | bsd-3-clause | praekelt/vumi-http-retry-api,praekelt/vumi-http-retry-api | <INSERT> import json
from twisted.trial.unittest import TestCase
from twisted.internet.defer import inlineCallbacks
from vumi_http_retry.tests.redis import create_client, zitems
class TestRedis(TestCase):
<INSERT_END> <INSERT> @inlineCallbacks
def setUp(self):
self.redis = yield create_client()
... | Add test for redis test helper
| |
eeb23b7fde3f728355efcc446912b7c8357c0c08 | util.py | util.py | def format_cols(cols):
widths = [0] * len(cols[0])
for i in cols:
for idx, val in enumerate(i):
widths[idx] = max(len(val), widths[idx])
f = ""
t = []
for i in widths:
t.append("%%-0%ds" % (i,))
return " ".join(t)
def column_report(title, fields, cols):
l ... | import sys
def format_cols(cols):
widths = [0] * len(cols[0])
for i in cols:
for idx, val in enumerate(i):
widths[idx] = max(len(val), widths[idx])
f = ""
t = []
for i in widths:
t.append("%%-0%ds" % (i,))
return " ".join(t)
def column_report(title, fields, c... | Use sys in error cases. | Use sys in error cases.
| Python | mit | lightcrest/kahu-api-demo | <REPLACE_OLD> def <REPLACE_NEW> import sys
def <REPLACE_END> <|endoftext|> import sys
def format_cols(cols):
widths = [0] * len(cols[0])
for i in cols:
for idx, val in enumerate(i):
widths[idx] = max(len(val), widths[idx])
f = ""
t = []
for i in widths:
t.append("%%-... | Use sys in error cases.
def format_cols(cols):
widths = [0] * len(cols[0])
for i in cols:
for idx, val in enumerate(i):
widths[idx] = max(len(val), widths[idx])
f = ""
t = []
for i in widths:
t.append("%%-0%ds" % (i,))
return " ".join(t)
def column_report(tit... |
902b2b0929dad116664d37a13ff325a10b67db7b | catalog/queue/sqs.py | catalog/queue/sqs.py | from Queue import Queue, Empty
import json
from .base import BaseQueue
sqs = None
def do_delayed_imports():
global sqs
from boto import sqs
class SQSQueue(BaseQueue):
_cache = Queue()
def __init__(self):
BaseQueue.__init__(self)
do_delayed_imports()
self.conn = sqs.connect_t... | from multiprocessing import Queue
from Queue import Empty
import json
from .base import BaseQueue
sqs = None
def do_delayed_imports():
global sqs
from boto import sqs
class SQSQueue(BaseQueue):
_cache = Queue()
def __init__(self):
BaseQueue.__init__(self)
do_delayed_imports()
... | Use queue from multiprocessing library instead of Queue | Use queue from multiprocessing library instead of Queue
| Python | mpl-2.0 | mozilla/structured-catalog | <INSERT> multiprocessing import Queue
from <INSERT_END> <DELETE> Queue, <DELETE_END> <|endoftext|> from multiprocessing import Queue
from Queue import Empty
import json
from .base import BaseQueue
sqs = None
def do_delayed_imports():
global sqs
from boto import sqs
class SQSQueue(BaseQueue):
_cache = Que... | Use queue from multiprocessing library instead of Queue
from Queue import Queue, Empty
import json
from .base import BaseQueue
sqs = None
def do_delayed_imports():
global sqs
from boto import sqs
class SQSQueue(BaseQueue):
_cache = Queue()
def __init__(self):
BaseQueue.__init__(self)
... |
b7377196cdd05d9d6d481f7b93308189c4524c52 | sfm/api/filters.py | sfm/api/filters.py | from django_filters import FilterSet, CharFilter, IsoDateTimeFilter
from ui.models import Warc, Seed, Harvest
from django_filters import Filter
from django_filters.fields import Lookup
class ListFilter(Filter):
def filter(self, qs, value):
return super(ListFilter, self).filter(qs, Lookup(value.split(u",")... | from django_filters import FilterSet, CharFilter, IsoDateTimeFilter
from ui.models import Warc, Seed, Harvest
from django_filters import Filter
from django_filters.fields import Lookup
class ListFilter(Filter):
def filter(self, qs, value):
return super(ListFilter, self).filter(qs, Lookup(value.split(u",")... | Fix to take into account history in API queries. | Fix to take into account history in API queries.
| Python | mit | gwu-libraries/sfm,gwu-libraries/sfm-ui,gwu-libraries/sfm,gwu-libraries/sfm,gwu-libraries/sfm-ui,gwu-libraries/sfm-ui,gwu-libraries/sfm-ui | <REPLACE_OLD> CharFilter(name="harvest__seed_set__seedset_id")
<REPLACE_NEW> CharFilter(name="harvest__historical_seed_set__seedset_id")
<REPLACE_END> <REPLACE_OLD> ListFilter(name="harvest__seed_set__seeds__seed_id", <REPLACE_NEW> ListFilter(name="harvest__historical_seeds__seed_id", <REPLACE_END> <DELETE> # TODO... | Fix to take into account history in API queries.
from django_filters import FilterSet, CharFilter, IsoDateTimeFilter
from ui.models import Warc, Seed, Harvest
from django_filters import Filter
from django_filters.fields import Lookup
class ListFilter(Filter):
def filter(self, qs, value):
return super(Lis... |
64d4e5939fbfa325b57149a73c4bf12c54b6f2bf | tests/maptools_test.py | tests/maptools_test.py | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import unittest as ut
import stripeline.maptools as mt
import numpy as np
class TestMaptools(ut.TestCase):
def test_condmatr(self):
matr = np.zeros((2, 9), dtype='float64', order='F')
mt.update_condmatr(numpix=2,
pixidx... | Add a test for update_condmatr | Add a test for update_condmatr
| Python | mit | ziotom78/stripeline,ziotom78/stripeline | <REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import unittest as ut
import stripeline.maptools as mt
import numpy as np
class TestMaptools(ut.TestCase):
def test_condmatr(self):
matr = np.zeros((2, 9), dtype='float64', order='F')
mt.update_condmatr(numpix=2,
... | Add a test for update_condmatr
| |
b1c9aaa6551902b285c96c94c269a787701bb020 | start_tornado.py | start_tornado.py | from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
import tornado.options
import server
import os
use_https = False
if use_https:
default_port = 80
else:
default_port = 443
tornado.options.define("port", default=default_port, help="run on the... | from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
import tornado.options
import server
import os
use_https = False
if use_https:
default_port = 443
else:
default_port = 80
tornado.options.define("port", default=default_port, help="run on the... | Correct the check of use HTTPS in Tornado file. | Correct the check of use HTTPS in Tornado file.
| Python | apache-2.0 | edmundo096/MoodMusic,edmundo096/MoodMusic,edmundo096/MoodMusic | <REPLACE_OLD> 80
else:
<REPLACE_NEW> 443
else:
<REPLACE_END> <REPLACE_OLD> 443
tornado.options.define("port", <REPLACE_NEW> 80
tornado.options.define("port", <REPLACE_END> <|endoftext|> from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
import tornado... | Correct the check of use HTTPS in Tornado file.
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
import tornado.options
import server
import os
use_https = False
if use_https:
default_port = 80
else:
default_port = 443
tornado.options.defi... |
f0c9acaedd9cc36d91758f383a4c703866cde4c7 | idavoll/error.py | idavoll/error.py | # Copyright (c) 2003-2008 Ralph Meijer
# See LICENSE for details.
class Error(Exception):
msg = ''
def __str__(self):
return self.msg
class NodeNotFound(Error):
pass
class NodeExists(Error):
pass
class NotSubscribed(Error):
"""
Entity is not subscribed to this node.
"""
class S... | # Copyright (c) 2003-2008 Ralph Meijer
# See LICENSE for details.
class Error(Exception):
msg = ''
def __str__(self):
return self.msg
class NodeNotFound(Error):
pass
class NodeExists(Error):
pass
class NotSubscribed(Error):
"""
Entity is not subscribed to this node.
"""
cla... | Adjust spacing to match Twisted's. | Adjust spacing to match Twisted's.
--HG--
extra : convert_revision : svn%3Ae60b0d31-0b1b-0410-851a-a02d0c527677/trunk%40258
| Python | mit | ralphm/idavoll | <REPLACE_OLD> self.msg
class <REPLACE_NEW> self.msg
class <REPLACE_END> <REPLACE_OLD> pass
class <REPLACE_NEW> pass
class <REPLACE_END> <REPLACE_OLD> pass
class <REPLACE_NEW> pass
class <REPLACE_END> <REPLACE_OLD> """
class <REPLACE_NEW> """
class <REPLACE_END> <REPLACE_OLD> pass
class <REPLACE_NEW> pass
... | Adjust spacing to match Twisted's.
--HG--
extra : convert_revision : svn%3Ae60b0d31-0b1b-0410-851a-a02d0c527677/trunk%40258
# Copyright (c) 2003-2008 Ralph Meijer
# See LICENSE for details.
class Error(Exception):
msg = ''
def __str__(self):
return self.msg
class NodeNotFound(Error):
pass
clas... |
3bf03b8fee78d6950b4e3cec875392a70b2d577f | grokapi/cli.py | grokapi/cli.py | # -*- coding: utf-8 -*-
from queries import Grok
def print_monthly_views(site, pages, year, month):
grok = Grok(site)
for page in pages:
result = grok.get_views_for_month(page, year, month)
print result['daily_views']
def main():
""" main script. """
from argparse import ArgumentPar... | Add commande-line interface for grokapi | Add commande-line interface for grokapi
Using an ArgumentParser
Closes #4
| Python | mit | Commonists/Grokapi | <REPLACE_OLD> <REPLACE_NEW> # -*- coding: utf-8 -*-
from queries import Grok
def print_monthly_views(site, pages, year, month):
grok = Grok(site)
for page in pages:
result = grok.get_views_for_month(page, year, month)
print result['daily_views']
def main():
""" main script. """
fro... | Add commande-line interface for grokapi
Using an ArgumentParser
Closes #4
| |
76607bfd2b909eb004a897d9b4c78c93690e0f32 | press_releases/migrations/0009_auto_20170519_1308.py | press_releases/migrations/0009_auto_20170519_1308.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icekit_press_releases', '0008_auto_20161128_1049'),
]
operations = [
migrations.AddField(
model_name='pressrelea... | Update DB migrations following upstream change in ICEkit | Update DB migrations following upstream change in ICEkit
The `WorkflowStateMixin` model in django-icekit --
which is used as a basis for the `PressReleaseListing`
model -- was updated with two new fields: `brief`,
and `admin_notes`.
This change updates the model in this project to
comply with the upstream changes.
A... | Python | mit | ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/icekit-press-releases,ic-labs/django-icekit,ic-labs/icekit-press-releases,ic-labs/django-icekit | <INSERT> # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
<INSERT_END> <INSERT> dependencies = [
('icekit_press_releases', '0008_auto_20161128_1049'),
]
operations = [
migrations.AddField(
... | Update DB migrations following upstream change in ICEkit
The `WorkflowStateMixin` model in django-icekit --
which is used as a basis for the `PressReleaseListing`
model -- was updated with two new fields: `brief`,
and `admin_notes`.
This change updates the model in this project to
comply with the upstream changes.
A... | |
a969f342137485dbb6f212bc1aa320770aac1421 | cub200_2011_dataset.py | cub200_2011_dataset.py | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 11 00:57:05 2017
@author: sakurai
"""
from fuel.datasets import H5PYDataset
from fuel.utils import find_in_data_path
from fuel.schemes import SequentialScheme
from fuel.streams import DataStream
class Cub200_2011Dataset(H5PYDataset):
_filename = 'cub200_2011/cub20... | Add fuel dataset for CUB200_2011 | Add fuel dataset for CUB200_2011
| Python | mit | ronekko/deep_metric_learning | <INSERT> # -*- coding: utf-8 -*-
"""
Created on Sat Feb 11 00:57:05 2017
@author: sakurai
"""
from fuel.datasets import H5PYDataset
from fuel.utils import find_in_data_path
from fuel.schemes import SequentialScheme
from fuel.streams import DataStream
class Cub200_2011Dataset(H5PYDataset):
<INSERT_END> <INSERT> ... | Add fuel dataset for CUB200_2011
| |
3d1521892ba17120ca4461335713b9d2254311fe | marble/tests/test_clustering.py | marble/tests/test_clustering.py | """ Tests for the clustering computation """
from nose.tools import *
import marble as mb
# Test c = 0 in the checkerboard case
# Test c = 1 in the fully clustered case
# Test an intermediate situation with known result
| """ Tests for the clustering computation """
from nose.tools import *
import itertools
from shapely.geometry import Polygon
import marble as mb
#
# Synthetic data for tests
#
def grid():
""" Areal units arranged in a grid """
au = [i*3+j for i,j in itertools.product(range(3), repeat=2)]
units = {a:Polygo... | Add tests for the clustering of cities | Add tests for the clustering of cities
| Python | bsd-3-clause | walkerke/marble,scities/marble | <INSERT> itertools
from shapely.geometry import Polygon
import <INSERT_END> <REPLACE_OLD> mb
# Test <REPLACE_NEW> mb
#
# Synthetic data for tests
#
def grid():
""" Areal units arranged in a grid """
au = [i*3+j for i,j in itertools.product(range(3), repeat=2)]
units = {a:Polygon([(a%3, a/3),
... | Add tests for the clustering of cities
""" Tests for the clustering computation """
from nose.tools import *
import marble as mb
# Test c = 0 in the checkerboard case
# Test c = 1 in the fully clustered case
# Test an intermediate situation with known result
|
83267931164adcbb3df5e869e40ebcf7ee4b12e8 | setup.py | setup.py | from setuptools import setup
setup(
name='lektor-s3',
description='Lektor plugin to support publishing to S3',
version='0.2.2',
author=u'Spencer Nelson',
author_email='s@spenczar.com',
url='https://github.com/spenczar/lektor-s3',
license='MIT',
py_modules=['lektor_s3'],
entry_points... | from setuptools import setup
setup(
name='lektor-s3',
description='Lektor plugin to support publishing to S3',
version='0.2.2',
author=u'Spencer Nelson',
author_email='s@spenczar.com',
url='https://github.com/spenczar/lektor-s3',
license='MIT',
platforms='any',
py_modules=['lektor_s... | Add classifiers to PyPi metadata | Add classifiers to PyPi metadata
| Python | mit | spenczar/lektor-s3 | <INSERT> platforms='any',
<INSERT_END> <INSERT> ],
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Lan... | Add classifiers to PyPi metadata
from setuptools import setup
setup(
name='lektor-s3',
description='Lektor plugin to support publishing to S3',
version='0.2.2',
author=u'Spencer Nelson',
author_email='s@spenczar.com',
url='https://github.com/spenczar/lektor-s3',
license='MIT',
py_modul... |
95e0b154f8b612cdab3e255ee8450f7308800c3f | setup.py | setup.py | #! /usr/bin/env python
# coding: utf-8
from setuptools import find_packages, setup
setup(name='egoio',
author='NEXT ENERGY, Reiner Lemoine Institut gGmbH, ZNES',
author_email='ulf.p.mueller@hs-flensburg.de',
description='ego input/output repository',
version='0.4.5',
url='https://github.... | #! /usr/bin/env python
# coding: utf-8
from setuptools import find_packages, setup
setup(name='egoio',
author='NEXT ENERGY, Reiner Lemoine Institut gGmbH, ZNES',
author_email='ulf.p.mueller@hs-flensburg.de',
description='ego input/output repository',
version='0.4.5',
url='https://github.... | Install latest oedialect version from GitHub instead from PyPi | Install latest oedialect version from GitHub instead from PyPi
| Python | agpl-3.0 | openego/ego.io,openego/ego.io | <REPLACE_OLD> 'psycopg2'],
<REPLACE_NEW> 'psycopg2',
'oedialect @ https://github.com/OpenEnergyPlatform/oedialect/archive/master.zip'],
<REPLACE_END> <|endoftext|> #! /usr/bin/env python
# coding: utf-8
from setuptools import find_packages, setup
setup(name='egoio',
author='NEXT ENERGY, Reiner Lemoi... | Install latest oedialect version from GitHub instead from PyPi
#! /usr/bin/env python
# coding: utf-8
from setuptools import find_packages, setup
setup(name='egoio',
author='NEXT ENERGY, Reiner Lemoine Institut gGmbH, ZNES',
author_email='ulf.p.mueller@hs-flensburg.de',
description='ego input/outpu... |
4ed4baae070cd6be5164e03369aa28c75e7684f2 | spec/bottling_specs/factory_specs/BottleSingletonAppLoader_specs.py | spec/bottling_specs/factory_specs/BottleSingletonAppLoader_specs.py | import fudge
from bottling.factory import BottleSingletonAppLoader
class describe_init:
def it_initializes_with_given_options(self):
ref = 'my_module:app'
kind = None
loader = BottleSingletonAppLoader(ref, kind)
assert loader.ref == ref
assert loader.kind == None... | Add loader for singleton apps | Add loader for singleton apps
| Python | mit | datamora/datamora,datamora/datamora | <INSERT> import fudge
from bottling.factory import BottleSingletonAppLoader
class describe_init:
<INSERT_END> <INSERT> def it_initializes_with_given_options(self):
ref = 'my_module:app'
kind = None
loader = BottleSingletonAppLoader(ref, kind)
assert loader.ref == ref
... | Add loader for singleton apps
| |
e3604b5f0cdae3889cfe7531f7a5b9d1c09f56bd | PrettyJson.py | PrettyJson.py | import sublime
import sublime_plugin
import json
s = sublime.load_settings("Pretty JSON.sublime-settings")
class PrettyjsonCommand(sublime_plugin.TextCommand):
""" Pretty Print JSON
"""
def run(self, edit):
for region in self.view.sel():
# If no selection, use the entire file as the s... | import sublime
import sublime_plugin
import json
s = sublime.load_settings("Pretty JSON.sublime-settings")
class PrettyjsonCommand(sublime_plugin.TextCommand):
""" Pretty Print JSON
"""
def run(self, edit):
for region in self.view.sel():
# If no selection, use the entire file as the s... | Configure json.dumps() to use an item separator of "," instead of the default ", " to prevent single whitespace at the end of lines. | Configure json.dumps() to use an item separator of "," instead of the default ", " to prevent single whitespace at the end of lines.
Without this option, all prettyfied JSON has one space at the end of each line, which is not so pretty:
{
"key": "value",_
"key": "value",_
"key": "value"
}
This could ... | Python | mit | dzhibas/SublimePrettyJson | <REPLACE_OLD> True)))
<REPLACE_NEW> True), separators=(',', ': ')))
<REPLACE_END> <|endoftext|> import sublime
import sublime_plugin
import json
s = sublime.load_settings("Pretty JSON.sublime-settings")
class PrettyjsonCommand(sublime_plugin.TextCommand):
""" Pretty Print JSON
"""
def run(self, edit):
... | Configure json.dumps() to use an item separator of "," instead of the default ", " to prevent single whitespace at the end of lines.
Without this option, all prettyfied JSON has one space at the end of each line, which is not so pretty:
{
"key": "value",_
"key": "value",_
"key": "value"
}
This could ... |
e0ffee5d5d6057a6dd776b02fea33c6509eb945c | signac/contrib/formats.py | signac/contrib/formats.py | # Copyright (c) 2016 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
import logging
logger = logging.getLogger(__name__)
class BasicFormat(object):
pass
class FileFormat(BasicFormat):
def __init__(self, file_object):
self... | # Copyright (c) 2016 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
TextFile = 'TextFile'
| Replace TextFile class definition with str constant. | Replace TextFile class definition with str constant.
| Python | bsd-3-clause | csadorf/signac,csadorf/signac | <REPLACE_OLD> License.
import logging
logger <REPLACE_NEW> License.
TextFile <REPLACE_END> <REPLACE_OLD> logging.getLogger(__name__)
class BasicFormat(object):
pass
class FileFormat(BasicFormat):
def __init__(self, file_object):
self._file_object = file_object
@property
def data(self):
... | Replace TextFile class definition with str constant.
# Copyright (c) 2016 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
import logging
logger = logging.getLogger(__name__)
class BasicFormat(object):
pass
class FileFormat(BasicForma... |
3b21b6e9edf19edc6569e383e708965a17c2ce0b | setup.py | setup.py | import os.path
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
README_FILE = os.path.join(ROOT_DIR, "README.rst")
with open(README_FILE) as f:
long_description = f.read()
setup(
name="xutils",
version="1... | import os.path
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
README_FILE = os.path.join(ROOT_DIR, "README.rst")
with open(README_FILE) as f:
long_description = f.read()
setup(
name="xutils",
version="1... | Set the version to 1.1.0 | Set the version to 1.1.0
| Python | mit | xgfone/pycom,xgfone/xutils | <REPLACE_OLD> version="1.0.0",
<REPLACE_NEW> version="1.1.0",
<REPLACE_END> <|endoftext|> import os.path
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
README_FILE = os.path.join(ROOT_DIR, "README.rst")
with open(... | Set the version to 1.1.0
import os.path
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
README_FILE = os.path.join(ROOT_DIR, "README.rst")
with open(README_FILE) as f:
long_description = f.read()
setup(
nam... |
fa89ac95954502c14105857dfbb8dece271408e0 | fiesta/fiesta.py | fiesta/fiesta.py | import base64, json, urllib2
api_client_id = "To3-IKknn36qAAAA"
api_client_secret = "46d028xWl8zXGa3GCOYJMeXlr5pUebCNZcz3SCJj"
basic_auth = base64.b64encode("%s:%s" % (api_client_id, api_client_secret))
def _create_and_send_request(uri, api_inputs):
request = urllib2.Request(uri)
request.add_header("Authoriza... | import base64, json, urllib2
api_client_id = ""
api_client_secret = ""
basic_auth = base64.b64encode("%s:%s" % (api_client_id, api_client_secret))
def _create_and_send_request(uri, api_inputs):
request = urllib2.Request(uri)
request.add_header("Authorization", "Basic %s" % (basic_auth))
request.add_header... | Remove accidental commit of credentials | Remove accidental commit of credentials
| Python | apache-2.0 | fiesta/fiesta-python | <REPLACE_OLD> "To3-IKknn36qAAAA"
api_client_secret <REPLACE_NEW> ""
api_client_secret <REPLACE_END> <REPLACE_OLD> "46d028xWl8zXGa3GCOYJMeXlr5pUebCNZcz3SCJj"
basic_auth <REPLACE_NEW> ""
basic_auth <REPLACE_END> <|endoftext|> import base64, json, urllib2
api_client_id = ""
api_client_secret = ""
basic_auth = base64.b64e... | Remove accidental commit of credentials
import base64, json, urllib2
api_client_id = "To3-IKknn36qAAAA"
api_client_secret = "46d028xWl8zXGa3GCOYJMeXlr5pUebCNZcz3SCJj"
basic_auth = base64.b64encode("%s:%s" % (api_client_id, api_client_secret))
def _create_and_send_request(uri, api_inputs):
request = urllib2.Reque... |
7db366558418f9fb997f8688f4816a500348e5c6 | tools/pdb-files.py | tools/pdb-files.py | import os
import os.path
import sys
import zipfile
'''
Seeks for *.pdb files from current directory and all child directories.
All found pdb files are copied to 'pdb-files.zip' file with their relative file paths.
'''
fileList = []
rootdir = os.curdir
zip_file_name = "pdb-files.zip"
if os.path.isfile(zip_file_name):... | import os
import os.path
import sys
import zipfile
'''
Seeks for *.pdb files from current directory and all child directories.
All found pdb files are copied to 'pdb-files.zip' file with their relative file paths.
'''
fileList = []
rootdir = os.getcwd()[0:-6] # strip the /tools from the end
zip_file_name = "Tundra-pd... | Fix py script to package all .pdb files now that its moved to tools. | Fix py script to package all .pdb files now that its moved to tools.
| Python | apache-2.0 | pharos3d/tundra,BogusCurry/tundra,realXtend/tundra,realXtend/tundra,AlphaStaxLLC/tundra,pharos3d/tundra,realXtend/tundra,jesterKing/naali,BogusCurry/tundra,realXtend/tundra,jesterKing/naali,realXtend/tundra,BogusCurry/tundra,AlphaStaxLLC/tundra,AlphaStaxLLC/tundra,pharos3d/tundra,jesterKing/naali,jesterKing/naali,Alpha... | <REPLACE_OLD> os.curdir
zip_file_name = "pdb-files.zip"
if <REPLACE_NEW> os.getcwd()[0:-6] # strip the /tools from the end
zip_file_name = "Tundra-pdb.zip"
if <REPLACE_END> <REPLACE_OLD> ("All <REPLACE_NEW> ("\nAll <REPLACE_END> <REPLACE_OLD> <REPLACE_NEW>
print "\nPacking..." <REPLACE_END> <REPLACE_OLD> zout.write... | Fix py script to package all .pdb files now that its moved to tools.
import os
import os.path
import sys
import zipfile
'''
Seeks for *.pdb files from current directory and all child directories.
All found pdb files are copied to 'pdb-files.zip' file with their relative file paths.
'''
fileList = []
rootdir = os.cur... |
8d5b0bd8f50d7b0489ebbafd22c66cf5304d308f | auth0/v3/test/management/test_branding.py | auth0/v3/test/management/test_branding.py | import unittest
import mock
from ...management.branding import Branding
class TestBranding(unittest.TestCase):
def test_init_with_optionals(self):
branding = Branding(
domain="domain", token="jwttoken", telemetry=False, timeout=(10, 2)
)
self.assertEqual(branding.client.options... | Add tests for new endpoints | Add tests for new endpoints
| Python | mit | auth0/auth0-python,auth0/auth0-python | <REPLACE_OLD> <REPLACE_NEW> import unittest
import mock
from ...management.branding import Branding
class TestBranding(unittest.TestCase):
def test_init_with_optionals(self):
branding = Branding(
domain="domain", token="jwttoken", telemetry=False, timeout=(10, 2)
)
self.assert... | Add tests for new endpoints
| |
479e532769b201ee0213812b3071100eaf4dfef4 | skele/cli.py | skele/cli.py | """
skele
Usage:
skele hello
skele -h | --help
skele --version
Options:
-h --help Show this screen.
--version Show version.
Examples:
skele hello
Help:
For help using this tool, please open an issue on the Github repository:
https://github.com/rdegges/... | """
skele
Usage:
skele hello
skele -h | --help
skele --version
Options:
-h --help Show this screen.
--version Show version.
Examples:
skele hello
Help:
For help using this tool, please open an issue on the Github repository:
https://github.com/rdegges/... | Validate command not only exists but was used | Validate command not only exists but was used
Without this, it just uses the first command module that exists, even if that option is `False` (it wasn't passed by the user) | Python | mit | snipsco/snipsskills,snipsco/snipsskills,snipsco/snipsskills,snipsco/snipsskills | <REPLACE_OLD> k):
<REPLACE_NEW> k) and v:
<REPLACE_END> <|endoftext|> """
skele
Usage:
skele hello
skele -h | --help
skele --version
Options:
-h --help Show this screen.
--version Show version.
Examples:
skele hello
Help:
For help using this tool, plea... | Validate command not only exists but was used
Without this, it just uses the first command module that exists, even if that option is `False` (it wasn't passed by the user)
"""
skele
Usage:
skele hello
skele -h | --help
skele --version
Options:
-h --help Show this screen.
--version ... |
dfce6a7956a579631961587b0518d352aae675e2 | run_development_server.py | run_development_server.py | #!/usr/bin/env python
from api import app
if __name__ == "__main__":
app.run(debug=True, port=5566)
| #!/usr/bin/env python
from api import app
if __name__ == "__main__":
app.run(debug=True, host='0.0.0.0', port=5566)
| Make it easier to test API with multiple machines | Make it easier to test API with multiple machines
Signed-off-by: Kai Blin <ad3597797f6179d503c382b2627cc19939309418@biosustain.dtu.dk>
| Python | agpl-3.0 | antismash/db-api,antismash/db-api | <INSERT> host='0.0.0.0', <INSERT_END> <|endoftext|> #!/usr/bin/env python
from api import app
if __name__ == "__main__":
app.run(debug=True, host='0.0.0.0', port=5566)
| Make it easier to test API with multiple machines
Signed-off-by: Kai Blin <ad3597797f6179d503c382b2627cc19939309418@biosustain.dtu.dk>
#!/usr/bin/env python
from api import app
if __name__ == "__main__":
app.run(debug=True, port=5566)
|
9dc068f947cbd5ca29b324436496d2d78f55edf7 | src/trajectory/trajectory.py | src/trajectory/trajectory.py | #!/usr/bin/env python
import math
from geometry_msgs.msg import Point
class NegativeTimeException(Exception):
pass
class Trajectory:
def __init__(self):
self.position = Point()
def get_position_at(self, t):
if t < 0:
raise NegativeTimeException()
| #!/usr/bin/env python
import math
from twisted.conch.insults.insults import Vector
from geometry_msgs.msg import Point
class NegativeTimeException(Exception):
pass
class Trajectory:
def __init__(self):
self.position = Point()
def get_position_at(self, t):
if t < 0:
raise Neg... | Implement __abs__ and __sub__ dunder methods | feat: Implement __abs__ and __sub__ dunder methods
Implement methods which are required to apply assertEqual and assertAlmostEqual to points. | Python | mit | bit0001/trajectory_tracking,bit0001/trajectory_tracking | <REPLACE_OLD> math
from <REPLACE_NEW> math
from twisted.conch.insults.insults import Vector
from <REPLACE_END> <REPLACE_OLD> NegativeTimeException()
<REPLACE_NEW> NegativeTimeException()
def abs_vector(self):
return (self.x * self.x + self.y * self.y) ** 0.5
def sub_point(self, other):
return Vector(self.... | feat: Implement __abs__ and __sub__ dunder methods
Implement methods which are required to apply assertEqual and assertAlmostEqual to points.
#!/usr/bin/env python
import math
from geometry_msgs.msg import Point
class NegativeTimeException(Exception):
pass
class Trajectory:
def __init__(self):
self... |
b1d889dc4207af08e8c1ee3f75006fa6b4051376 | vitrage/rpc.py | vitrage/rpc.py | # Copyright 2015 - Alcatel-Lucent
# Copyright 2016 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | # Copyright 2015 - Alcatel-Lucent
# Copyright 2016 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | Set access_policy for messaging's dispatcher | Set access_policy for messaging's dispatcher
oslo.messaging allow dispatcher to restrict endpoint methods since
5.11.0 in d3a8f280ebd6fd12865fd20c4d772774e39aefa2, set with
DefaultRPCAccessPolicy to fix FutureWarning like:
"The access_policy argument is changing its default value to <class
'oslo_messaging.rpc.dispatc... | Python | apache-2.0 | openstack/vitrage,openstack/vitrage,openstack/vitrage | <REPLACE_OLD> messaging
OPTS <REPLACE_NEW> messaging
from oslo_messaging.rpc import dispatcher
OPTS <REPLACE_END> <INSERT> access_policy = dispatcher.DefaultRPCAccessPolicy
<INSERT_END> <REPLACE_OLD> serializer=serializer)
<REPLACE_NEW> serializer=serializer,
access_policy=acc... | Set access_policy for messaging's dispatcher
oslo.messaging allow dispatcher to restrict endpoint methods since
5.11.0 in d3a8f280ebd6fd12865fd20c4d772774e39aefa2, set with
DefaultRPCAccessPolicy to fix FutureWarning like:
"The access_policy argument is changing its default value to <class
'oslo_messaging.rpc.dispatc... |
826f23f0fc7eea4c72dcc26f637f3752bee51b47 | test/ctypesgentest.py | test/ctypesgentest.py | import optparse, sys, StringIO
sys.path.append("..")
import ctypesgencore
"""ctypesgentest is a simple module for testing ctypesgen on various C constructs. It consists of a
single function, test(). test() takes a string that represents a C header file, along with some
keyword arguments representing options. It proces... | import optparse, sys, StringIO
sys.path.append(".") # Allow tests to be called from parent directory with Python 2.6
sys.path.append("..")
import ctypesgencore
"""ctypesgentest is a simple module for testing ctypesgen on various C constructs. It consists of a
single function, test(). test() takes a string that repres... | Allow tests to be called from parent directory of "test" | Allow tests to be called from parent directory of "test"
git-svn-id: 397be6d5b34b040010577acc149a81bea378be26@89 1754e6c4-832e-0410-bb55-0fb906f63d99
| Python | bsd-3-clause | kanzure/ctypesgen,kanzure/ctypesgen,novas0x2a/ctypesgen,davidjamesca/ctypesgen,kanzure/ctypesgen | <REPLACE_OLD> StringIO
sys.path.append("..")
import <REPLACE_NEW> StringIO
sys.path.append(".") # Allow tests to be called from parent directory with Python 2.6
sys.path.append("..")
import <REPLACE_END> <|endoftext|> import optparse, sys, StringIO
sys.path.append(".") # Allow tests to be called from parent directory... | Allow tests to be called from parent directory of "test"
git-svn-id: 397be6d5b34b040010577acc149a81bea378be26@89 1754e6c4-832e-0410-bb55-0fb906f63d99
import optparse, sys, StringIO
sys.path.append("..")
import ctypesgencore
"""ctypesgentest is a simple module for testing ctypesgen on various C constructs. It consist... |
1f5183c345444f35891927014d92510b66b96f5b | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
setup(
name='robber',
version='1.0.0',
description='BDD / TDD assertion library for Python',
long_description=long_description,
author='Tao Liang',... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
setup(
name='robber',
version='1.0.1',
description='BDD / TDD assertion library for Python',
author='Tao Liang',
author_email='tao@synapse-ai.com',
url='https://github.com/vesln/robber.py',
packages=[
'ro... | Remove the dependency on pypandoc. It's unfortunate but we don't want to add dependency just for readability on pypi. | Remove the dependency on pypandoc. It's unfortunate but we don't want to add dependency just for readability on pypi.
| Python | mit | vesln/robber.py,taoenator/robber.py | <REPLACE_OLD> setup
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
setup(
<REPLACE_NEW> setup
setup(
<REPLACE_END> <REPLACE_OLD> version='1.0.0',
<REPLACE_NEW> version='1.0.1',
<REPLACE_END> <DELETE> long_description=long_description,
<DELETE_END> <|endoftext|> #!/usr/bin/env python
... | Remove the dependency on pypandoc. It's unfortunate but we don't want to add dependency just for readability on pypi.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
setup(
name='robber',
version='1.0.0',
... |
b5c02ab5789d228876ef647f35acdf287166256f | csl-add-updated.py | csl-add-updated.py | # Python script to add timestamp to style with empty updated field
# Author: Rintze M. Zelle
# Version: 2011-12-17
# * Requires lxml library (http://lxml.de/)
import os, glob, re
from lxml import etree
path = 'C:\Documents and Settings\zelle\My Documents\CSL\styles\dependent\\'
verbatims = {}
for independentStyle in... | Add old script to add cs:updated element to styles. | Add old script to add cs:updated element to styles.
| Python | mit | citation-style-language/utilities,citation-style-language/utilities,citation-style-language/utilities,citation-style-language/utilities | <INSERT> # Python script to add timestamp to style with empty updated field
# Author: Rintze M. Zelle
# Version: 2011-12-17
# * Requires lxml library (http://lxml.de/)
import os, glob, re
from lxml import etree
path = 'C:\Documents and Settings\zelle\My Documents\CSL\styles\dependent\\'
verbatims = {}
for independen... | Add old script to add cs:updated element to styles.
| |
cb456cbdb8850fda4b438d7f60b3aa00365f7f9b | __init__.py | __init__.py | """Open Drug Discovery Toolkit
==============================
Universal and easy to use resource for various drug discovery tasks, ie docking, virutal screening, rescoring.
Attributes
----------
toolkit : module,
Toolkits backend module, currenlty OpenBabel [ob] and RDKit [rdk].
This settin... | """Open Drug Discovery Toolkit
==============================
Universal and easy to use resource for various drug discovery tasks, ie docking, virutal screening, rescoring.
Attributes
----------
toolkit : module,
Toolkits backend module, currenlty OpenBabel [ob] and RDKit [rdk].
This settin... | Make global utulity for setting random seed | Make global utulity for setting random seed
| Python | bsd-3-clause | mwojcikowski/opendrugdiscovery | <REPLACE_OLD> default
"""
import numpy <REPLACE_NEW> default
"""
from numpy.random import seed <REPLACE_END> <REPLACE_OLD> np
from <REPLACE_NEW> np_seed
from random import seed as python_seed
from <REPLACE_END> <REPLACE_OLD> ['toolkit']
<REPLACE_NEW> ['toolkit']
def random_seed(i):
"""
Set global random see... | Make global utulity for setting random seed
"""Open Drug Discovery Toolkit
==============================
Universal and easy to use resource for various drug discovery tasks, ie docking, virutal screening, rescoring.
Attributes
----------
toolkit : module,
Toolkits backend module, currenlty OpenBa... |
3c319e21ea026651ee568d3c2a74786d33257a93 | paystackapi/paystack.py | paystackapi/paystack.py | """Entry point defined here."""
from paystackapi.cpanel import ControlPanel
from paystackapi.customer import Customer
from paystackapi.invoice import Invoice
from paystackapi.misc import Misc
from paystackapi.page import Page
from paystackapi.plan import Plan
from paystackapi.product import Product
from paystackapi.ref... | """Entry point defined here."""
from paystackapi.charge import Charge
from paystackapi.cpanel import ControlPanel
from paystackapi.customer import Customer
from paystackapi.invoice import Invoice
from paystackapi.misc import Misc
from paystackapi.page import Page
from paystackapi.plan import Plan
from paystackapi.produ... | Add charge to Paystack class | Add charge to Paystack class
| Python | mit | andela-sjames/paystack-python | <INSERT> paystackapi.charge import Charge
from <INSERT_END> <INSERT> self.charge = Charge
<INSERT_END> <REPLACE_OLD> Verification
<REPLACE_NEW> Verification
<REPLACE_END> <|endoftext|> """Entry point defined here."""
from paystackapi.charge import Charge
from paystackapi.cpanel import ControlPanel
from payst... | Add charge to Paystack class
"""Entry point defined here."""
from paystackapi.cpanel import ControlPanel
from paystackapi.customer import Customer
from paystackapi.invoice import Invoice
from paystackapi.misc import Misc
from paystackapi.page import Page
from paystackapi.plan import Plan
from paystackapi.product impor... |
47e4e74dcf5e2a10f1e231d2fa8af453213e77fb | Lib/test/test_winsound.py | Lib/test/test_winsound.py | # Rediculously simple test of the winsound module for Windows.
import winsound
for i in range(100, 2000, 100):
winsound.Beep(i, 75)
print "Hopefully you heard some sounds increasing in frequency!"
| # Ridiculously simple test of the winsound module for Windows.
import winsound
for i in range(100, 2000, 100):
winsound.Beep(i, 75)
print "Hopefully you heard some sounds increasing in frequency!"
| Fix spelling error and remove Windows line endings. | Fix spelling error and remove Windows line endings.
| Python | mit | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | <REPLACE_OLD> Rediculously <REPLACE_NEW> Ridiculously <REPLACE_END> <|endoftext|> # Ridiculously simple test of the winsound module for Windows.
import winsound
for i in range(100, 2000, 100):
winsound.Beep(i, 75)
print "Hopefully you heard some sounds increasing in frequency!"
| Fix spelling error and remove Windows line endings.
# Rediculously simple test of the winsound module for Windows.
import winsound
for i in range(100, 2000, 100):
winsound.Beep(i, 75)
print "Hopefully you heard some sounds increasing in frequency!"
|
505456fed7bdbd6b2cd78eae10b3b64657cd377b | tests/unit/test_commands.py | tests/unit/test_commands.py | import pytest
from pip._internal.commands import commands_dict, create_command
def test_commands_dict__order():
"""
Check the ordering of commands_dict.
"""
names = list(commands_dict)
# A spot-check is sufficient to check that commands_dict encodes an
# ordering.
assert names[0] == 'inst... | import pytest
from pip._internal.cli.req_command import (
IndexGroupCommand,
RequirementCommand,
SessionCommandMixin,
)
from pip._internal.commands import commands_dict, create_command
def check_commands(pred, expected):
"""
Check the commands satisfying a predicate.
"""
commands = [creat... | Test the command class inheritance for each command. | Test the command class inheritance for each command.
| Python | mit | pradyunsg/pip,xavfernandez/pip,pfmoore/pip,rouge8/pip,xavfernandez/pip,pypa/pip,sbidoul/pip,pfmoore/pip,pypa/pip,rouge8/pip,rouge8/pip,pradyunsg/pip,xavfernandez/pip,sbidoul/pip | <INSERT> pip._internal.cli.req_command import (
IndexGroupCommand,
RequirementCommand,
SessionCommandMixin,
)
from <INSERT_END> <INSERT> check_commands(pred, expected):
"""
Check the commands satisfying a predicate.
"""
commands = [create_command(name) for name in sorted(commands_dict)]
... | Test the command class inheritance for each command.
import pytest
from pip._internal.commands import commands_dict, create_command
def test_commands_dict__order():
"""
Check the ordering of commands_dict.
"""
names = list(commands_dict)
# A spot-check is sufficient to check that commands_dict e... |
b8a410bc2f54a89e0e44100a890183fcd6a88e3e | tools/convert-url-history.py | tools/convert-url-history.py | #!/usr/bin/env python
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | Add initial URL history importer | Add initial URL history importer
| Python | apache-2.0 | jimmsta/namebench-1,catap/namebench | <REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python
# Copyright 2009 Google Inc. 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 initial URL history importer
| |
daa5de8071bc0694115dce3d8cc1a3733e269910 | py/ops/itests/test_deps.py | py/ops/itests/test_deps.py | import unittest
from subprocess import call, check_call, check_output
import os.path
from .fixtures import Fixture
@Fixture.inside_container
class DepsTest(Fixture, unittest.TestCase):
def test_install_deps(self):
# Ensure rkt is not installed
self.assertEqual(1, call(['which', 'rkt']))
... | import unittest
from subprocess import call, check_call, check_output
import os.path
from .fixtures import Fixture
@Fixture.inside_container
class DepsTest(Fixture, unittest.TestCase):
def test_install_deps(self):
# Ensure rkt is not installed
self.assertEqual(1, call(['which', 'rkt']))
... | Update ops integration test rkt version | Update ops integration test rkt version
| Python | mit | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | <REPLACE_OLD> 1.25.0
<REPLACE_NEW> 1.29.0
<REPLACE_END> <REPLACE_OLD> os.path.exists('/tmp/tarballs/rkt-v1.25.0.tar.gz'):
<REPLACE_NEW> os.path.exists('/tmp/tarballs/rkt-v1.29.0.tar.gz'):
<REPLACE_END> <REPLACE_OLD> '/tmp/tarballs/rkt-v1.25.0.tar.gz'])
<REPLACE_NEW> '/tmp/tarballs/rkt-v1.29.0.tar.gz'])
<REPLACE_E... | Update ops integration test rkt version
import unittest
from subprocess import call, check_call, check_output
import os.path
from .fixtures import Fixture
@Fixture.inside_container
class DepsTest(Fixture, unittest.TestCase):
def test_install_deps(self):
# Ensure rkt is not installed
self.asser... |
c65b6adafcdf791030090a72f4490171012ce4fd | config/fuzz_pox_simple.py | config/fuzz_pox_simple.py |
from config.experiment_config_lib import ControllerConfig
from sts.topology import MeshTopology
from sts.control_flow import Fuzzer
from sts.input_traces.input_logger import InputLogger
from sts.simulation_state import SimulationConfig
# Use POX as our controller
start_cmd = ('''./pox.py openflow.discovery forwarding... |
from config.experiment_config_lib import ControllerConfig
from sts.topology import MeshTopology
from sts.control_flow import Fuzzer
from sts.input_traces.input_logger import InputLogger
from sts.simulation_state import SimulationConfig
# Use POX as our controller
start_cmd = ('''./pox.py samples.buggy '''
... | Use a buggy pox module | Use a buggy pox module
| Python | apache-2.0 | ucb-sts/sts,jmiserez/sts,jmiserez/sts,ucb-sts/sts | <REPLACE_OLD> openflow.discovery forwarding.l2_multi <REPLACE_NEW> samples.buggy <REPLACE_END> <INSERT> check_interval=5,
<INSERT_END> <|endoftext|>
from config.experiment_config_lib import ControllerConfig
from sts.topology import MeshTopology
from sts.control_flow import Fuzzer
from sts.input_t... | Use a buggy pox module
from config.experiment_config_lib import ControllerConfig
from sts.topology import MeshTopology
from sts.control_flow import Fuzzer
from sts.input_traces.input_logger import InputLogger
from sts.simulation_state import SimulationConfig
# Use POX as our controller
start_cmd = ('''./pox.py openf... |
767b9867a1e28063fae33ea46478372818b5a129 | cla_backend/apps/core/views.py | cla_backend/apps/core/views.py | from django.views import defaults
from sentry_sdk import capture_message, push_scope
def page_not_found(request, *args, **kwargs):
with push_scope() as scope:
scope.set_tag("type", "404")
scope.set_extra("path", request.path)
capture_message("Page not found", level="error")
return de... | from django.views import defaults
from sentry_sdk import capture_message, push_scope
def page_not_found(request, *args, **kwargs):
with push_scope() as scope:
scope.set_tag("path", request.path)
for i, part in enumerate(request.path.strip("/").split("/")):
scope.set_tag("path_{}".forma... | Tag sentry event with each part of path | Tag sentry event with each part of path
| Python | mit | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend | <REPLACE_OLD> scope.set_tag("type", "404")
<REPLACE_NEW> scope.set_tag("path", request.path)
<REPLACE_END> <REPLACE_OLD> scope.set_extra("path", request.path)
<REPLACE_NEW> for i, part in enumerate(request.path.strip("/").split("/")):
scope.set_tag("path_{}".format(i), part)
<REPLACE_END> <|endoftext|... | Tag sentry event with each part of path
from django.views import defaults
from sentry_sdk import capture_message, push_scope
def page_not_found(request, *args, **kwargs):
with push_scope() as scope:
scope.set_tag("type", "404")
scope.set_extra("path", request.path)
capture_message("Page ... |
d407f1bcd95daf4f4bd8dfe8ae3b4b9e68061cb5 | cref/sequence/fragment.py | cref/sequence/fragment.py |
def fragment(sequence, size=5):
"""
Fragment a string sequence using a sliding window given by size
:param sequence: String containing the sequence
:param size: Size of the window
:return: a fragment of the sequence with the given size
"""
for i in range(len(sequence) - size + 1):
... |
def fragment(sequence, size=5):
"""
Fragment a string sequence using a sliding window given by size
:param sequence: String containing the sequence
:param size: Size of the window
:return: a fragment of the sequence with the given size
"""
if size > 0:
for i in range(len(sequence)... | Handle sliding window with size 0 | Handle sliding window with size 0
| Python | mit | mchelem/cref2,mchelem/cref2,mchelem/cref2 | <INSERT> if size > 0:
<INSERT_END> <INSERT> <INSERT_END> <REPLACE_OLD> size]
<REPLACE_NEW> size]
<REPLACE_END> <|endoftext|>
def fragment(sequence, size=5):
"""
Fragment a string sequence using a sliding window given by size
:param sequence: String containing the sequence
:param size: S... | Handle sliding window with size 0
def fragment(sequence, size=5):
"""
Fragment a string sequence using a sliding window given by size
:param sequence: String containing the sequence
:param size: Size of the window
:return: a fragment of the sequence with the given size
"""
for i in range... |
4da185d2902c9a83db1c7022f2e9c65b39957384 | aerodynamics_2d.py | aerodynamics_2d.py | """
This module enables XLFR5 data to numpy.array.
"""
import numpy as np
# import matplotlib.pyplot as plt
def read_xflr5_data(wing_foil_name):
reynolds_numbers = np.arange(0, 1.01, 0.1)
headers = ["alpha", "CL", "CD", "CDp", "Cm", "Top Xtr", "Bot Xtr", "Cpmin", "Chinge", "XCp"]
tmpdict = {i: [] for i i... | Add 2D wing foil reader | Add 2D wing foil reader
| Python | mit | salamann/fpadesigner | <INSERT> """
This module enables XLFR5 data to numpy.array.
"""
import numpy as np
# import matplotlib.pyplot as plt
def read_xflr5_data(wing_foil_name):
<INSERT_END> <INSERT> reynolds_numbers = np.arange(0, 1.01, 0.1)
headers = ["alpha", "CL", "CD", "CDp", "Cm", "Top Xtr", "Bot Xtr", "Cpmin", "Chinge", "XCp"... | Add 2D wing foil reader
| |
8b5f3576ee30c1f50b3d3c5bd477b85ba4ec760e | plinth/modules/sso/__init__.py | plinth/modules/sso/__init__.py | #
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | #
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | Make ttf-bitstream-vera a managed package | captcha: Make ttf-bitstream-vera a managed package
Signed-off-by: Joseph Nuthalpati <f3045f1a422c023fc6364ff0e3a18c260c53336e@thoughtworks.com>
Reviewed-by: James Valleroy <46e3063862880873c8617774e45d63de6172aab0@mailbox.org>
| Python | agpl-3.0 | harry-7/Plinth,harry-7/Plinth,harry-7/Plinth,harry-7/Plinth,harry-7/Plinth | <REPLACE_OLD> ['libapache2-mod-auth-pubtkt', <REPLACE_NEW> [
'libapache2-mod-auth-pubtkt', <REPLACE_END> <REPLACE_OLD> 'flite']
def <REPLACE_NEW> 'flite',
'ttf-bitstream-vera'
]
def <REPLACE_END> <|endoftext|> #
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or... | captcha: Make ttf-bitstream-vera a managed package
Signed-off-by: Joseph Nuthalpati <f3045f1a422c023fc6364ff0e3a18c260c53336e@thoughtworks.com>
Reviewed-by: James Valleroy <46e3063862880873c8617774e45d63de6172aab0@mailbox.org>
#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it... |
a388280d56bb73e64dbea2244e210878d9371984 | NagiosWrapper/NagiosWrapper.py | NagiosWrapper/NagiosWrapper.py | import subprocess
nagiosPluginsCommandLines = [
"/usr/lib64/nagios/plugins/check_sensors",
"/usr/lib64/nagios/plugins/check_mailq -w 10 -c 20 -M postfix",
]
class NagiosWrapper:
def __init__(self, agentConfig, checksLogger, rawConfig):
self.agentConfig = agentConfig
self.checksLogger = ch... | import subprocess
nagiosPluginsCommandLines = [
"/usr/lib64/nagios/plugins/check_sensors",
"/usr/lib64/nagios/plugins/check_mailq -w 10 -c 20 -M postfix",
]
class NagiosWrapper:
def __init__(self, agentConfig, checksLogger, rawConfig):
self.agentConfig = agentConfig
self.checksLogger = ch... | Add support for Python 2.6 | Add support for Python 2.6 | Python | bsd-3-clause | bastiendonjon/sd-agent-plugins,shanethehat/sd-agent-plugins,bencer/sd-agent-plugins,shanethehat/sd-agent-plugins,bencer/sd-agent-plugins,bastiendonjon/sd-agent-plugins | <REPLACE_OLD> {}: {}'.format(pluginCommand, <REPLACE_NEW> {0}: {1}'.format(pluginCommand, <REPLACE_END> <REPLACE_OLD> self.checksLogger.error('Error <REPLACE_NEW> self.checksLogger.error(
'Error <REPLACE_END> <REPLACE_OLD> {}: {}'.format(
pluginCommand, err))
<REPLACE_NEW> {0}:... | Add support for Python 2.6
import subprocess
nagiosPluginsCommandLines = [
"/usr/lib64/nagios/plugins/check_sensors",
"/usr/lib64/nagios/plugins/check_mailq -w 10 -c 20 -M postfix",
]
class NagiosWrapper:
def __init__(self, agentConfig, checksLogger, rawConfig):
self.agentConfig = agentConfig
... |
d4cf6a4737ba6c05c5150e2b892b8b0d01d800e9 | setup.py | setup.py | #!/usr/bin/env python
import setuptools
install_requires = [
'PrettyTable==0.7.2',
'kazoo==1.00',
'simplejson',
'argparse',
'kafka-python'
]
setuptools.setup(
name = 'stormkafkamon',
version = '0.1.0',
license = 'Apache',
description = '''Monitor offsets of a storm kafka spout.'''... | #!/usr/bin/env python
import setuptools
install_requires = [
'PrettyTable==0.7.2',
'kazoo==1.00',
'simplejson',
'argparse',
'kafka-python'
]
setuptools.setup(
name = 'stormkafkamon',
version = '0.1.0',
license = 'Apache',
description = '''Monitor offsets of a storm kafka spout.'''... | Add author and author email. | Add author and author email.
| Python | apache-2.0 | vivekrao1985/stormkafkamon,ianawilson/stormkafkamon,otoolep/stormkafkamon,grue/stormkafkamon | <REPLACE_OLD> '',
<REPLACE_NEW> "Philip O'Toole",
<REPLACE_END> <REPLACE_OLD> '',
<REPLACE_NEW> 'philipomailbox-github@yahoo.com',
<REPLACE_END> <|endoftext|> #!/usr/bin/env python
import setuptools
install_requires = [
'PrettyTable==0.7.2',
'kazoo==1.00',
'simplejson',
'argparse',
'kafka-pyth... | Add author and author email.
#!/usr/bin/env python
import setuptools
install_requires = [
'PrettyTable==0.7.2',
'kazoo==1.00',
'simplejson',
'argparse',
'kafka-python'
]
setuptools.setup(
name = 'stormkafkamon',
version = '0.1.0',
license = 'Apache',
description = '''Monitor offs... |
64ed32aa5e2e36ce58209b0e356f7482137a81f2 | getMesosStats.py | getMesosStats.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import json
import argparse
def get_metric(host, port, metric):
response = urllib2.urlopen(
'http://' + host + ':' + port + '/metrics/snapshot')
data = json.load(response)
# print json.dumps(data, indent=4, sort_keys=Tru... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import json
import argparse
def get_metric(host, port, metric):
response = urllib2.urlopen(
'http://' + host + ':' + port + '/metrics/snapshot')
data = json.load(response)
# print json.dumps(data, indent=4, sort_keys=Tru... | Add KeyError exception and ZBX_NOT_SUPPORTED message. | Add KeyError exception and ZBX_NOT_SUPPORTED message.
| Python | mit | zolech/zabbix-mesos-template | <INSERT> try:
<INSERT_END> <REPLACE_OLD> data[metric]
if <REPLACE_NEW> data[metric]
except KeyError:
print "ZBX_NOT_SUPPORTED"
if <REPLACE_END> <|endoftext|> #!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import json
import argparse
def get_metric(host, port, metric)... | Add KeyError exception and ZBX_NOT_SUPPORTED message.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import json
import argparse
def get_metric(host, port, metric):
response = urllib2.urlopen(
'http://' + host + ':' + port + '/metrics/snapshot')
data = json.load(response)
... |
85be5c1e0510d928f8b5a9a3de77ce674bf38dc4 | datafilters/extra_lookup.py | datafilters/extra_lookup.py |
class Extra(object):
def __init__(self, where=None, tables=None):
self.where = where if where is not None else []
self.tables = tables if tables is not None else []
def is_empty(self):
return self.where or self.tables
def add(self, extra):
self.where.extend(extra.where)
... | class Extra(object):
def __init__(self, where=None, tables=None):
self.where = where if where is not None else []
self.tables = tables if tables is not None else []
def is_empty(self):
return self.where or self.tables
def add(self, extra):
self.where.extend(extra.where)
... | Add a magic member __nonzero__ to Extra | Add a magic member __nonzero__ to Extra
| Python | mit | zorainc/django-datafilters,freevoid/django-datafilters,zorainc/django-datafilters | <REPLACE_OLD>
class <REPLACE_NEW> class <REPLACE_END> <INSERT> __nonzero__ = <INSERT_END> <|endoftext|> class Extra(object):
def __init__(self, where=None, tables=None):
self.where = where if where is not None else []
self.tables = tables if tables is not None else []
def is_empty(self):
... | Add a magic member __nonzero__ to Extra
class Extra(object):
def __init__(self, where=None, tables=None):
self.where = where if where is not None else []
self.tables = tables if tables is not None else []
def is_empty(self):
return self.where or self.tables
def add(self, extra):... |
e3c8e72341fea566113e510b058141c9ff75c0ea | setup.py | setup.py | try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'A LMTP server class',
'long_description': 'A LMTP counterpart to smtpd in the Python standard library',
'author': 'Matt Molyneaux',
'url': 'https://github.com/moggers87/lmtpd',
... | try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'A LMTP server class',
'long_description': 'A LMTP counterpart to smtpd in the Python standard library',
'author': 'Matt Molyneaux',
'url': 'https://github.com/moggers87/lmtpd',
... | Mark package as a stable | Mark package as a stable
| Python | mit | moggers87/lmtpd | <REPLACE_OLD> 4 <REPLACE_NEW> 5 <REPLACE_END> <REPLACE_OLD> Beta',
<REPLACE_NEW> Production/Stable',
<REPLACE_END> <|endoftext|> try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'A LMTP server class',
'long_description': 'A LMTP counterp... | Mark package as a stable
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'A LMTP server class',
'long_description': 'A LMTP counterpart to smtpd in the Python standard library',
'author': 'Matt Molyneaux',
'url': 'https://github.... |
23d5d0e0e77dc0b0816df51a8a1e42bc4069112b | rst2pdf/style2yaml.py | rst2pdf/style2yaml.py | #!/usr/bin/env python3
# SPDX-License-Identifier: MIT
"""Convert older RSON stylesheets to YAML format
Run the script with the filename to convert, it outputs to stdout
"""
import argparse
import json
import yaml
from rst2pdf.dumpstyle import fixstyle
from rst2pdf.rson import loads as rloads
def main():
pars... | #!/usr/bin/env python3
# SPDX-License-Identifier: MIT
"""Convert older RSON stylesheets to YAML format
Run the script with this list of filenames to convert. It outputs to stdout, or
use the --save3 flag to have it create .yaml files
"""
import argparse
import json
import os
import yaml
from rst2pdf.dumpstyle impo... | Add save functionality to the conversion script | Add save functionality to the conversion script
| Python | mit | rst2pdf/rst2pdf,rst2pdf/rst2pdf | <REPLACE_OLD> the filename to convert, <REPLACE_NEW> this list of filenames to convert. It outputs to stdout, or
use the --save3 flag to have <REPLACE_END> <REPLACE_OLD> outputs to stdout
"""
import <REPLACE_NEW> create .yaml files
"""
import <REPLACE_END> <REPLACE_OLD> json
import <REPLACE_NEW> json
import os
impo... | Add save functionality to the conversion script
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
"""Convert older RSON stylesheets to YAML format
Run the script with the filename to convert, it outputs to stdout
"""
import argparse
import json
import yaml
from rst2pdf.dumpstyle import fixstyle
from rst2pdf.r... |
d629cc508cb2d3eab83e259d9aefc9885076a407 | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='wagtailcodeblock',
version="0.4.0",
description='Wagtail Code Block provides PrismJS syntax highlighting in Wagtail.',
long_description='A Wagtail Streamfield block for source code with real-time syntax highlighting.',
author='Tim Allen',
... | from setuptools import setup, find_packages
setup(
name='wagtailcodeblock',
version="0.4.0",
description='Wagtail Code Block provides PrismJS syntax highlighting in Wagtail.',
long_description='A Wagtail Streamfield block for source code with real-time syntax highlighting.',
author='Tim Allen',
... | Move up to be a beta. | Move up to be a beta.
| Python | bsd-3-clause | FlipperPA/wagtailcodeblock,FlipperPA/wagtailcodeblock,FlipperPA/wagtailcodeblock | <REPLACE_OLD> 3 <REPLACE_NEW> 4 <REPLACE_END> <|endoftext|> from setuptools import setup, find_packages
setup(
name='wagtailcodeblock',
version="0.4.0",
description='Wagtail Code Block provides PrismJS syntax highlighting in Wagtail.',
long_description='A Wagtail Streamfield block for source code with r... | Move up to be a beta.
from setuptools import setup, find_packages
setup(
name='wagtailcodeblock',
version="0.4.0",
description='Wagtail Code Block provides PrismJS syntax highlighting in Wagtail.',
long_description='A Wagtail Streamfield block for source code with real-time syntax highlighting.',
a... |
8f03f4fc5b4b321303225ec60879eb4b6a2c14f5 | cli/cli.py | cli/cli.py | import argparse
parser = argparse.ArgumentParser(prog='moocx', description='EdX MOOC Data Anaylysis')
parser.add_argument('-v', '--version', action='version', version='0.1.0')
subparsers = parser.add_subparsers(help='commands')
# A list command
list_parser = subparsers.add_parser('list', help='List commands')
list_p... | import argparse
parser = argparse.ArgumentParser(prog='moocx', description='EdX MOOC Data Anaylysis')
parser.add_argument('-v', '--version', action='version', version='0.1.0')
subparsers = parser.add_subparsers(help='commands')
# A list command
list_parser = subparsers.add_parser('list', help='List commands')
list_p... | Add subparser for run analytics commands | Add subparser for run analytics commands
| Python | mit | McGillX/edx_data_research,McGillX/edx_data_research,McGillX/edx_data_research | <REPLACE_OLD> choice')
parser.parse_args()
<REPLACE_NEW> choice')
# An run command to execute the analysis
run_parser = subparsers.add_parser('run', help='Run commands')
run_parser.add_argument('run_commands', help='Run analytics based on argument', nargs='?', default='basic')
if __name__ == '__main__':
args = ... | Add subparser for run analytics commands
import argparse
parser = argparse.ArgumentParser(prog='moocx', description='EdX MOOC Data Anaylysis')
parser.add_argument('-v', '--version', action='version', version='0.1.0')
subparsers = parser.add_subparsers(help='commands')
# A list command
list_parser = subparsers.add_p... |
705b93f7fd688c4889562a9950c220db23ffa98a | tomso/__init__.py | tomso/__init__.py | __version__ = "0.0.12"
__all__ = [
'adipls',
'utils',
'constants',
'gyre',
'fgong',
'mesa',
'stars'
]
| __version__ = "0.0.12"
__all__ = [
'adipls',
'constants',
'fgong',
'gyre',
'mesa',
'stars',
'utils'
]
| Put modules in alphabetical order | Put modules in alphabetical order
| Python | mit | warrickball/tomso | <REPLACE_OLD> 'utils',
<REPLACE_NEW> 'constants',
<REPLACE_END> <REPLACE_OLD> 'constants',
<REPLACE_NEW> 'fgong',
<REPLACE_END> <DELETE> 'fgong',
<DELETE_END> <REPLACE_OLD> 'stars'
<REPLACE_NEW> 'stars',
'utils'
<REPLACE_END> <|endoftext|> __version__ = "0.0.12"
__all__ = [
'adipls',
'constants',... | Put modules in alphabetical order
__version__ = "0.0.12"
__all__ = [
'adipls',
'utils',
'constants',
'gyre',
'fgong',
'mesa',
'stars'
]
|
37903904cd0b1a8c4a04811b4a10a16606f9d7b0 | doc/jsdoc_conf.py | doc/jsdoc_conf.py | # -*- coding: utf-8 -*- #
from __future__ import unicode_literals
from common_conf import *
SITEURL = ".."
TEMPLATE = "doc/theme/templates/jsdoc.html"
TITLE = "NuvolaKit 3.0 JavaScript API Reference"
| # -*- coding: utf-8 -*- #
from __future__ import unicode_literals
from common_conf import *
SITEURL = ".."
TEMPLATE = "doc/theme/templates/jsdoc.html"
TITLE = "NuvolaKit 3.0 JavaScript API Reference"
INTERLINKS = {
"doc": "../",
"tiliado": TILIADOWEB,
}
| Add interlinks urls for doc and tiliado | Add interlinks urls for doc and tiliado
Signed-off-by: Jiří Janoušek <2a48236b6dcae98c8c0e90f4673742773ee17d91@gmail.com>
| Python | bsd-2-clause | tiliado/nuvolaruntime,tiliado/nuvolaruntime,tiliado/nuvolaruntime,tiliado/nuvolaruntime | <REPLACE_OLD> Reference"
<REPLACE_NEW> Reference"
INTERLINKS = {
"doc": "../",
"tiliado": TILIADOWEB,
}
<REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*- #
from __future__ import unicode_literals
from common_conf import *
SITEURL = ".."
TEMPLATE = "doc/theme/templates/jsdoc.html"
TITLE = "NuvolaKit 3.0 Ja... | Add interlinks urls for doc and tiliado
Signed-off-by: Jiří Janoušek <2a48236b6dcae98c8c0e90f4673742773ee17d91@gmail.com>
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
from common_conf import *
SITEURL = ".."
TEMPLATE = "doc/theme/templates/jsdoc.html"
TITLE = "NuvolaKit 3.0 JavaScript API Refere... |
ced1e16a316fb6f5b22f5da7bb130faf1477b400 | tests/stdout_test.py | tests/stdout_test.py | from nose.tools import *
import beastling.beastxml
import beastling.configuration
def test_extractor():
config = beastling.configuration.Configuration(configfile="tests/configs/basic.conf")
config.process()
xml = beastling.beastxml.BeastXml(config)
xml.write_file("stdout")
| Test writing XML to stdout (currently failing in py3). | Test writing XML to stdout (currently failing in py3).
| Python | bsd-2-clause | lmaurits/BEASTling | <INSERT> from nose.tools import *
import beastling.beastxml
import beastling.configuration
def test_extractor():
<INSERT_END> <INSERT> config = beastling.configuration.Configuration(configfile="tests/configs/basic.conf")
config.process()
xml = beastling.beastxml.BeastXml(config)
xml.write_file("stdout"... | Test writing XML to stdout (currently failing in py3).
| |
58fe858cc61f15dda2f9a1ca0b3937e5968fafa1 | every_election/apps/elections/migrations/0058_set-gla-a-to-ballot.py | every_election/apps/elections/migrations/0058_set-gla-a-to-ballot.py | # Generated by Django 2.2.10 on 2020-02-18 08:36
from django.db import migrations
def remove_gla_a_subtype(apps, schema_editor):
Election = apps.get_model("elections", "Election")
qs = Election.private_objects.filter(election_id__startswith="gla.a.")
qs.update(group_type=None)
class Migration(migration... | Change past gla.a elections to remove subtype group | Change past gla.a elections to remove subtype group
| Python | bsd-3-clause | DemocracyClub/EveryElection,DemocracyClub/EveryElection,DemocracyClub/EveryElection | <INSERT> # Generated by Django 2.2.10 on 2020-02-18 08:36
from django.db import migrations
def remove_gla_a_subtype(apps, schema_editor):
<INSERT_END> <INSERT> Election = apps.get_model("elections", "Election")
qs = Election.private_objects.filter(election_id__startswith="gla.a.")
qs.update(group_type=Non... | Change past gla.a elections to remove subtype group
| |
28c52ee84f139b8fef912a5c04327e69d05dd098 | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='yargy',
version='0.4.0',
description='Tiny rule-based facts extraction package',
url='https://github.com/bureaucratic-labs/yargy',
author='Dmitry Veselov',
author_email='d.a.veselov@yandex.ru',
license='MIT',
classifiers=[
... | from sys import version_info
from setuptools import setup, find_packages
BASE_REQUIREMENTS = [
'pymorphy2'
]
BACKPORT_REQUIREMENTS = [
'enum34',
'backports.functools-lru-cache',
]
if version_info.major == 2 or (version_info.major == 3 and version_info.minor < 4):
BASE_REQUIREMENTS.append(BACKPORT_REQ... | Split python 3 and python 2 requirements | Split python 3 and python 2 requirements
| Python | mit | bureaucratic-labs/yargy | <INSERT> sys import version_info
from <INSERT_END> <REPLACE_OLD> find_packages
setup(
<REPLACE_NEW> find_packages
BASE_REQUIREMENTS = [
'pymorphy2'
]
BACKPORT_REQUIREMENTS = [
'enum34',
'backports.functools-lru-cache',
]
if version_info.major == 2 or (version_info.major == 3 and version_info.minor < 4)... | Split python 3 and python 2 requirements
from setuptools import setup, find_packages
setup(
name='yargy',
version='0.4.0',
description='Tiny rule-based facts extraction package',
url='https://github.com/bureaucratic-labs/yargy',
author='Dmitry Veselov',
author_email='d.a.veselov@yandex.ru',
... |
dcfa7bfa11bea86d831959a217b558d704ece078 | ensemble/ctf/tests/test_manager.py | ensemble/ctf/tests/test_manager.py | from contextlib import contextmanager
from os.path import isfile, join
import shutil
import tempfile
from numpy.testing import assert_allclose
from ensemble.ctf.editor import ALPHA_DEFAULT, COLOR_DEFAULT, create_function
from ensemble.ctf.manager import CTF_EXTENSION, CtfManager
@contextmanager
def temp_directory()... | Add unit tests for CtfManager. | Add unit tests for CtfManager.
| Python | bsd-3-clause | dmsurti/ensemble | <REPLACE_OLD> <REPLACE_NEW> from contextlib import contextmanager
from os.path import isfile, join
import shutil
import tempfile
from numpy.testing import assert_allclose
from ensemble.ctf.editor import ALPHA_DEFAULT, COLOR_DEFAULT, create_function
from ensemble.ctf.manager import CTF_EXTENSION, CtfManager
@contex... | Add unit tests for CtfManager.
| |
ba9386fc7c14be6335896e1d888c822db972dfe1 | indra/java_vm.py | indra/java_vm.py | """Handles all imports from jnius to prevent conflicts resulting from attempts
to set JVM options while the VM is already running."""
import os
import warnings
import jnius_config
if '-Xmx4g' not in jnius_config.get_options():
if not jnius_config.vm_running:
jnius_config.add_options('-Xmx4g')
else:
... | """Handles all imports from jnius to prevent conflicts resulting from attempts
to set JVM options while the VM is already running."""
import os
import warnings
import jnius_config
if '-Xmx4g' not in jnius_config.get_options():
if not jnius_config.vm_running:
jnius_config.add_options('-Xmx4g')
else:
... | Remove messages from Java VM | Remove messages from Java VM
| Python | bsd-2-clause | bgyori/indra,johnbachman/belpy,johnbachman/indra,bgyori/indra,sorgerlab/indra,jmuhlich/indra,pvtodorov/indra,johnbachman/belpy,sorgerlab/indra,pvtodorov/indra,jmuhlich/indra,sorgerlab/belpy,sorgerlab/belpy,pvtodorov/indra,johnbachman/belpy,sorgerlab/indra,jmuhlich/indra,bgyori/indra,johnbachman/indra,pvtodorov/indra,jo... | <REPLACE_OLD> os.environ.get('CLASSPATH')
print 'before', os.environ.get('CLASSPATH')
if <REPLACE_NEW> os.environ.get('CLASSPATH')
if <REPLACE_END> <REPLACE_OLD> cp
print 'after', os.environ.get('CLASSPATH')
from <REPLACE_NEW> cp
from <REPLACE_END> <|endoftext|> """Handles all imports from jnius to prevent conflict... | Remove messages from Java VM
"""Handles all imports from jnius to prevent conflicts resulting from attempts
to set JVM options while the VM is already running."""
import os
import warnings
import jnius_config
if '-Xmx4g' not in jnius_config.get_options():
if not jnius_config.vm_running:
jnius_config.add_... |
ffd917c5ace8e815b185495aec17cf47b0a7648a | storage_service/administration/tests/test_languages.py | storage_service/administration/tests/test_languages.py | from django.contrib.auth.models import User
from django.test import TestCase, override_settings
class TestLanguageSwitching(TestCase):
@classmethod
def setUpClass(cls):
User.objects.create_user(
username="admin", password="admin", email="admin@example.com"
)
super(TestLangu... | from django.contrib.auth.models import User
from django.test import TestCase, override_settings
class TestLanguageSwitching(TestCase):
@classmethod
def setUpClass(cls):
super(TestLanguageSwitching, cls).setUpClass()
User.objects.create_user(
username="admin", password="admin", emai... | Fix integrity error reusing db in tests | Fix integrity error reusing db in tests
Base `setUpClass` needs to be called first so the transaction is initialized
before we mutate the data.
This solves a conflic raised when using `--reuse-db`.
| Python | agpl-3.0 | artefactual/archivematica-storage-service,artefactual/archivematica-storage-service,artefactual/archivematica-storage-service,artefactual/archivematica-storage-service | <INSERT> super(TestLanguageSwitching, cls).setUpClass()
<INSERT_END> <REPLACE_OLD> )
super(TestLanguageSwitching, cls).setUpClass()
<REPLACE_NEW> )
<REPLACE_END> <|endoftext|> from django.contrib.auth.models import User
from django.test import TestCase, override_settings
class TestLanguageSwitchin... | Fix integrity error reusing db in tests
Base `setUpClass` needs to be called first so the transaction is initialized
before we mutate the data.
This solves a conflic raised when using `--reuse-db`.
from django.contrib.auth.models import User
from django.test import TestCase, override_settings
class TestLanguageSwi... |
8d034ca0c30166ec3972d0f8db83e00ff4f8055f | setup.py | setup.py | from distutils.core import setup
setup(name='steamfootbridge',
version='0.0.1',
packages=['steamfootbridge'],
scripts=['bin/steamfootbridge'],
)
| from setuptools import setup
setup(name='steamfootbridge',
version='0.0.1',
packages=['steamfootbridge'],
scripts=['bin/steamfootbridge'],
install_requires=[
'steamodd',
],
)
| Convert Python installation to PyPi | Convert Python installation to PyPi
This does mean python-pip or similar will need to be installed on the
system.
| Python | mit | sirnuke/steamfootbridge,sirnuke/steamfootbridge | <REPLACE_OLD> distutils.core <REPLACE_NEW> setuptools <REPLACE_END> <REPLACE_OLD> scripts=['bin/steamfootbridge'],
)
<REPLACE_NEW> scripts=['bin/steamfootbridge'],
install_requires=[
'steamodd',
],
)
<REPLACE_END> <|endoftext|> from setuptools import setup
setup(name='steamfootbridge',
ve... | Convert Python installation to PyPi
This does mean python-pip or similar will need to be installed on the
system.
from distutils.core import setup
setup(name='steamfootbridge',
version='0.0.1',
packages=['steamfootbridge'],
scripts=['bin/steamfootbridge'],
)
|
70f58979b17bb20282ac37daf298dbe0b506973f | setup.py | setup.py | from setuptools import setup
version = '0.14.dev0'
long_description = '\n\n'.join([
open('README.rst').read(),
open('CREDITS.rst').read(),
open('CHANGES.rst').read(),
])
install_requires = [
'Django',
'django-extensions',
'django-nose',
'requests',
'itsdangerous',
'south',
... | from setuptools import setup
version = '0.14.dev0'
long_description = '\n\n'.join([
open('README.rst').read(),
open('CREDITS.rst').read(),
open('CHANGES.rst').read(),
])
install_requires = [
'Django >= 1.4, < 1.7',
'django-extensions',
'django-nose',
'requests',
'itsdangerous',
... | Document that we don't support Django 1.7 yet | Document that we don't support Django 1.7 yet
| Python | mit | lizardsystem/lizard-auth-client,lizardsystem/lizard-auth-client,lizardsystem/lizard-auth-client | <REPLACE_OLD> 'Django',
<REPLACE_NEW> 'Django >= 1.4, < 1.7',
<REPLACE_END> <|endoftext|> from setuptools import setup
version = '0.14.dev0'
long_description = '\n\n'.join([
open('README.rst').read(),
open('CREDITS.rst').read(),
open('CHANGES.rst').read(),
])
install_requires = [
'Django >= 1.4... | Document that we don't support Django 1.7 yet
from setuptools import setup
version = '0.14.dev0'
long_description = '\n\n'.join([
open('README.rst').read(),
open('CREDITS.rst').read(),
open('CHANGES.rst').read(),
])
install_requires = [
'Django',
'django-extensions',
'django-nose',
'... |
746d3e5aba7b4fb9bfd6c258c80b6a4565de4844 | py/oldfart/handler.py | py/oldfart/handler.py | import http.server
import os
import oldfart.make
__all__ = ['make_http_request_handler_class']
def _send_head(self):
# FIXME: We die here if the directory doesn't exist ('make clean' anyone?)
path = self.translate_path(self.path)
target = os.path.relpath(path, self.maker.project_dir)
if not os.path... | import http.server
import os
import oldfart.make
__all__ = ['make_http_request_handler_class']
def _send_head(self):
# FIXME: We die here if the directory doesn't exist ('make clean' anyone?)
path = self.translate_path(self.path)
target = os.path.relpath(path, self.maker.project_dir)
if not os.path... | Stop handling after responding with 500 | Bugfix: Stop handling after responding with 500
| Python | bsd-3-clause | mjhanninen/oldfart,mjhanninen/oldfart,mjhanninen/oldfart | <INSERT> return None
<INSERT_END> <|endoftext|> import http.server
import os
import oldfart.make
__all__ = ['make_http_request_handler_class']
def _send_head(self):
# FIXME: We die here if the directory doesn't exist ('make clean' anyone?)
path = self.translate_path(self.path)
target = os.p... | Bugfix: Stop handling after responding with 500
import http.server
import os
import oldfart.make
__all__ = ['make_http_request_handler_class']
def _send_head(self):
# FIXME: We die here if the directory doesn't exist ('make clean' anyone?)
path = self.translate_path(self.path)
target = os.path.relpath... |
8a83c67c76d2a96fc9a70f2057787efcd9250e0e | versebot/regex.py | versebot/regex.py | """
VerseBot for reddit
By Matthieu Grieger
regex.py
Copyright (c) 2015 Matthieu Grieger (MIT License)
"""
import re
def find_verses(message_body):
""" Uses regex to search comment body for verse quotations. Returns
a list of matches if found, None otherwise. """
regex = (r"(?<=\[)(?P<book>[\d\w\s]+)... | """
VerseBot for reddit
By Matthieu Grieger
regex.py
Copyright (c) 2015 Matthieu Grieger (MIT License)
"""
import re
def find_verses(message_body):
""" Uses regex to search comment body for verse quotations. Returns
a list of matches if found, None otherwise. """
regex = (r"(?<=\[)(?P<book>[\d\w\s]+)... | Add optional parentheses for translation | Add optional parentheses for translation
| Python | mit | Matthew-Arnold/slack-versebot,Matthew-Arnold/slack-versebot | <REPLACE_OLD> r"\-?\d*)?\s*(?P<translation>[\w\-\d]+)?(?=\])")
<REPLACE_NEW> r"\-?\d*)?\s*\(?(?P<translation>[\w\-\d]+)?\)?(?=\])")
<REPLACE_END> <|endoftext|> """
VerseBot for reddit
By Matthieu Grieger
regex.py
Copyright (c) 2015 Matthieu Grieger (MIT License)
"""
import re
def find_verses(message_body):
""" ... | Add optional parentheses for translation
"""
VerseBot for reddit
By Matthieu Grieger
regex.py
Copyright (c) 2015 Matthieu Grieger (MIT License)
"""
import re
def find_verses(message_body):
""" Uses regex to search comment body for verse quotations. Returns
a list of matches if found, None otherwise. """
... |
54c5f4f476cebec063652f5e4c6acd30bf2dee2e | nova/tests/unit/cmd/test_cmd_db_blocks.py | nova/tests/unit/cmd/test_cmd_db_blocks.py | # Copyright 2016 Red Hat
#
# 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, soft... | Add test for nova-compute and nova-network main database blocks | Add test for nova-compute and nova-network main database blocks
We block the database objects when conductor is not local for compute
and network, but we don't test this code anywhere because it's in the
main() function of the actual executable.
Fix that.
Change-Id: I5b9343d30e6b4aedb05f0731ba9bdca51d408ba9
| Python | apache-2.0 | klmitch/nova,gooddata/openstack-nova,hanlind/nova,mahak/nova,Juniper/nova,phenoxim/nova,vmturbo/nova,phenoxim/nova,mahak/nova,vmturbo/nova,rajalokan/nova,rajalokan/nova,openstack/nova,mikalstill/nova,gooddata/openstack-nova,mikalstill/nova,alaski/nova,sebrandon1/nova,sebrandon1/nova,openstack/nova,alaski/nova,mahak/nov... | <REPLACE_OLD> <REPLACE_NEW> # Copyright 2016 Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | Add test for nova-compute and nova-network main database blocks
We block the database objects when conductor is not local for compute
and network, but we don't test this code anywhere because it's in the
main() function of the actual executable.
Fix that.
Change-Id: I5b9343d30e6b4aedb05f0731ba9bdca51d408ba9
| |
5119d396b67e732646545e50fedac80e5a663475 | tests/test_meta.py | tests/test_meta.py | """
Tests for this repository.
"""
from pathlib import Path
def test_init_files() -> None:
"""
``__init__`` files exist where they should do.
If ``__init__`` files are missing, linters may not run on all files that
they should run on.
"""
directories = (Path('src'), Path('tests'))
for d... | Add meta test for __init__ file | Add meta test for __init__ file
| Python | mit | adamtheturtle/vws-python,adamtheturtle/vws-python | <INSERT> """
Tests for this repository.
"""
from pathlib import Path
def test_init_files() -> None:
<INSERT_END> <INSERT> """
``__init__`` files exist where they should do.
If ``__init__`` files are missing, linters may not run on all files that
they should run on.
"""
directories = (Path('sr... | Add meta test for __init__ file
| |
cf3ba1d37ebcb037c7116097c55814c3af5f9512 | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='django-txtlocal',
packages=find_packages(),
include_package_data=True,
install_requires=['requests>=1.2.3'],
version='0.2',
description='App for sending and receiving SMS messages via http://www.textlocal.com',
author='Incuna Ltd',
... | from setuptools import setup, find_packages
setup(
name='django-txtlocal',
packages=find_packages(),
include_package_data=True,
install_requires=['requests>=1.2.3'],
version='0.2',
description='App for sending and receiving SMS messages via http://www.textlocal.com',
long_description=open(... | Use readme in long description | Use readme in long description
| Python | bsd-2-clause | incuna/django-txtlocal | <REPLACE_OLD> find_packages
setup(
<REPLACE_NEW> find_packages
setup(
<REPLACE_END> <INSERT> long_description=open('README.rst').read(),
<INSERT_END> <|endoftext|> from setuptools import setup, find_packages
setup(
name='django-txtlocal',
packages=find_packages(),
include_package_data=True,
i... | Use readme in long description
from setuptools import setup, find_packages
setup(
name='django-txtlocal',
packages=find_packages(),
include_package_data=True,
install_requires=['requests>=1.2.3'],
version='0.2',
description='App for sending and receiving SMS messages via http://www.textlocal.c... |
8c51722bff4460b33a33d0380b75047649119175 | pyhpeimc/__init__.py | pyhpeimc/__init__.py | #!/usr/bin/env python
# -*- coding: <encoding-name> -*-
'''
Copyright 2015 Hewlett Packard Enterprise Development LP
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/... | #!/usr/bin/env python
# -*- coding: ascii -*-
'''
Copyright 2015 Hewlett Packard Enterprise Development LP
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.... | Fix in groups.py for get_custom_views function. | Fix in groups.py for get_custom_views function.
| Python | apache-2.0 | HPNetworking/HP-Intelligent-Management-Center,HPENetworking/PYHPEIMC,netmanchris/PYHPEIMC | <REPLACE_OLD> <encoding-name> <REPLACE_NEW> ascii <REPLACE_END> <|endoftext|> #!/usr/bin/env python
# -*- coding: ascii -*-
'''
Copyright 2015 Hewlett Packard Enterprise Development LP
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You ... | Fix in groups.py for get_custom_views function.
#!/usr/bin/env python
# -*- coding: <encoding-name> -*-
'''
Copyright 2015 Hewlett Packard Enterprise Development LP
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 o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.