hash
stringlengths
40
40
diff
stringlengths
131
26.7k
message
stringlengths
7
694
project
stringlengths
5
67
split
stringclasses
1 value
diff_languages
stringlengths
2
24
7a6f08e3ff8692ebe079e059de19164b478c54c6
diff --git a/src/bindings/radioBinding.js b/src/bindings/radioBinding.js index <HASH>..<HASH> 100644 --- a/src/bindings/radioBinding.js +++ b/src/bindings/radioBinding.js @@ -14,7 +14,10 @@ ko.bindingHandlers.radio = { value = valueAccessor(), newValue = radio.val(); - value(newValue); + // we shouldn't change value for disables buttons + if (!radio.prop('disabled')) { + value(newValue); + } }, 0); }); },
Fixed changing of selected radio button, when it is disabled (#<I>)
faulknercs_Knockstrap
train
js
9acb68901529a0158e37753c931ff00ccfaaaa7a
diff --git a/test/test_consumer.py b/test/test_consumer.py index <HASH>..<HASH> 100644 --- a/test/test_consumer.py +++ b/test/test_consumer.py @@ -15,10 +15,6 @@ class TestKafkaConsumer(unittest.TestCase): with self.assertRaises(AssertionError): SimpleConsumer(MagicMock(), 'group', 'topic', partitions = [ '0' ]) - def test_broker_list_required(self): - with self.assertRaises(KafkaConfigurationError): - KafkaConsumer() - class TestMultiProcessConsumer(unittest.TestCase): def test_partition_list(self):
bootstrap_servers no longer required in KafkaConsumer (localhost default)
dpkp_kafka-python
train
py
3f0e7c7f22eb3825180d07a9af3706d044aa282a
diff --git a/scripts/constants.py b/scripts/constants.py index <HASH>..<HASH> 100644 --- a/scripts/constants.py +++ b/scripts/constants.py @@ -15,16 +15,16 @@ import sys # Kubernetes branch to get the OpenAPI spec from. -KUBERNETES_BRANCH = "release-1.15" +KUBERNETES_BRANCH = "release-1.16" # client version for packaging and releasing. -CLIENT_VERSION = "11.0.0-snapshot" +CLIENT_VERSION = "12.0.0-snapshot" # Name of the release package PACKAGE_NAME = "kubernetes" # Stage of development, mainly used in setup.py's classifiers. -DEVELOPMENT_STATUS = "4 - Beta" +DEVELOPMENT_STATUS = "3 - Alpha" # If called directly, return the constant value given
Update constants - KUBERNETES_BRANCH to "release-<I>" - CLIENT_VERSION to "<I>-snapshot" - DEVELOPMENT_STATUS to "3 - Alpha"
kubernetes-client_python
train
py
abaad3b218f18c813f961cc3a6871d7e53fa0bac
diff --git a/watcher.go b/watcher.go index <HASH>..<HASH> 100644 --- a/watcher.go +++ b/watcher.go @@ -58,16 +58,14 @@ func (w *Watcher) Watch() error { } for { + if w.config.Once && w.renderedAll(views) { + // If we are in "once" mode and all the templates have been rendered, + // exit gracefully + return nil + } + select { case view := <-viewCh: - println("received on viewCh") - - if w.config.Once && w.renderedAll(views) { - // If we are in "once" mode and all the templates have been rendered, - // exit gracefully - return nil - } - for _, template := range view.Templates { deps := templates[template] context := &TemplateContext{
Move once check outside of the channel case
hashicorp_consul-template
train
go
aac251aa7b711916c7996a27e377b865c440283d
diff --git a/live.js b/live.js index <HASH>..<HASH> 100644 --- a/live.js +++ b/live.js @@ -74,7 +74,7 @@ function teardown(moduleName, needsImport, listeners) { } // If there's an interested listener add it to the needsImport. - if(listeners.reloads[moduleName]) { + if(listeners.reloads[moduleName] || listeners.reloads["*"]) { needsImport[moduleName] = true; }
Always observe import when there are * listeners
stealjs_live-reload
train
js
5faa85a8ab2d546f7a7cfcad343e6f8fefe1dd50
diff --git a/modeshape-jcr/src/main/java/org/modeshape/jcr/index/local/LocalIndexProvider.java b/modeshape-jcr/src/main/java/org/modeshape/jcr/index/local/LocalIndexProvider.java index <HASH>..<HASH> 100644 --- a/modeshape-jcr/src/main/java/org/modeshape/jcr/index/local/LocalIndexProvider.java +++ b/modeshape-jcr/src/main/java/org/modeshape/jcr/index/local/LocalIndexProvider.java @@ -178,7 +178,7 @@ public class LocalIndexProvider extends IndexProvider { @Override protected void postShutdown() { logger().debug("Shutting down the local index provider '{0}' in repository '{1}'", getName(), getRepositoryName()); - if (db != null) { + if (db != null && !db.isClosed()) { try { db.commit(); db.close();
MODE-<I> Prevents the LocalIndexProvider from committing an already closed MapDB instance
ModeShape_modeshape
train
java
cb116c2031c98da7e362645d46814ae4cc5e96be
diff --git a/lib/itamae/resource/git.rb b/lib/itamae/resource/git.rb index <HASH>..<HASH> 100644 --- a/lib/itamae/resource/git.rb +++ b/lib/itamae/resource/git.rb @@ -88,7 +88,7 @@ module Itamae return result.stdout.strip if result.exit_status == 0 fetch_origin! - run_command_in_repo("git rev-parse #{shell_escape(branch)}").strip + run_command_in_repo("git rev-parse #{shell_escape(branch)}").stdout.strip end def fetch_origin!
Restore overlooked `stdout` call
itamae-kitchen_itamae
train
rb
a5cdf72c84e595430ea976d5b425d5ba3dd321c4
diff --git a/lib/gulp-notify-growl.js b/lib/gulp-notify-growl.js index <HASH>..<HASH> 100644 --- a/lib/gulp-notify-growl.js +++ b/lib/gulp-notify-growl.js @@ -12,15 +12,15 @@ module.exports = function(applicationOptions) { icon: fs.readFileSync(__dirname + '/gulp.png') }, applicationOptions || {}); - var growl = new growler.GrowlApplication('Gulp', applicationOptions); + var app = new growler.GrowlApplication('Gulp', applicationOptions); - growl.setNotifications({ + app.setNotifications({ Gulp: {} }); function notify(notificationOptions, callback) { - growl.register(function(success, err) { + app.register(function(success, err) { if (!success) { throw callback(err); } @@ -29,7 +29,7 @@ module.exports = function(applicationOptions) { notificationOptions.text = notificationOptions.message; delete notificationOptions.message; - growl.sendNotification('Gulp', notificationOptions, function(success, err) { + app.sendNotification('Gulp', notificationOptions, function(success, err) { return callback(err, success); }); @@ -37,6 +37,8 @@ module.exports = function(applicationOptions) { } + notify.app = app; + return notify; };
Expose GrowlApplication instance (useful for testing)
yannickcr_gulp-notify-growl
train
js
c8de2e2d0af666b1abe8e7faf3d100da347a152f
diff --git a/lib/hutch/cli.rb b/lib/hutch/cli.rb index <HASH>..<HASH> 100644 --- a/lib/hutch/cli.rb +++ b/lib/hutch/cli.rb @@ -12,6 +12,8 @@ module Hutch def run(argv = ARGV) parse_options(argv) + Process.daemon(true) if Hutch::Config.daemonise + Hutch.logger.info "hutch booted with pid #{Process.pid}" if load_app && start_work_loop == :success @@ -170,6 +172,10 @@ module Hutch Hutch::Config.namespace = namespace end + opts.on('-d', '--daemonise', 'Daemonise') do |daemonise| + Hutch::Config.daemonise = daemonise + end + opts.on('--version', 'Print the version and exit') do puts "hutch v#{VERSION}" exit 0 diff --git a/lib/hutch/config.rb b/lib/hutch/config.rb index <HASH>..<HASH> 100644 --- a/lib/hutch/config.rb +++ b/lib/hutch/config.rb @@ -26,6 +26,7 @@ module Hutch autoload_rails: true, error_handlers: [Hutch::ErrorHandlers::Logger.new], namespace: nil, + daemonise: false, channel_prefetch: 0 } end
Allow hutch to be daemonised at startup
gocardless_hutch
train
rb,rb
e87536d7c34234da7b14532c7aeffa43bb1d99aa
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -86,8 +86,8 @@ function Ssdp() { udpServer.addMembership(BROADCAST_ADDR, ip.address()); }); - this.close = function() { - udpServer.close(); + this.close = function(callback) { + udpServer.close(callback); } this.mSearch = function(st) {
Implement callback to UDP server close method
bazwilliams_node-ssdp
train
js
e898b41f260d98b2c3b6ab96f101dbb8404d8f42
diff --git a/printThis.js b/printThis.js index <HASH>..<HASH> 100644 --- a/printThis.js +++ b/printThis.js @@ -130,9 +130,10 @@ $radio.each(function() { var $this = $(this), $name = $(this).attr('name'), - $checked = $this.is(":checked"); + $checked = $this.is(":checked"), + $value = $this.val(); if ($checked) { - $doc.find('input[name=' + $name + ']').attr('checked', 'checked'); + $doc.find('input[name=' + $name + '][value=' + $value + ']').attr('checked', 'checked'); } }); }
fix for radio button value setting Attempted to combine input loops (input, checkbox, radio) but there were inherit issues in setting radio input values.
jasonday_printThis
train
js
1ccd81326482ef5083ae48726e32a6e15528ca53
diff --git a/lib/classes/task/delete_incomplete_users_task.php b/lib/classes/task/delete_incomplete_users_task.php index <HASH>..<HASH> 100644 --- a/lib/classes/task/delete_incomplete_users_task.php +++ b/lib/classes/task/delete_incomplete_users_task.php @@ -59,6 +59,10 @@ class delete_incomplete_users_task extends scheduled_task { if (isguestuser($user) or is_siteadmin($user)) { continue; } + if ($user->lastname !== '' and $user->firstname !== '' and $user->email !== '') { + // This can happen on MySQL - see MDL-52831. + continue; + } delete_user($user); mtrace(" Deleted not fully setup user $user->username ($user->id)"); }
MDL-<I> users: Do not delete Mr. and Mrs. Whitespace accounts Due to imperfect validation of the user registration and profile forms, we allowed for firstname and lastname be just a whitespace. On MySQL, such a whitespace is not significant for VARCHAR comparison so these otherwise valid accounts could be silently deleted. The patch makes sure that at least one of the checked fields is a real empty string before deleting such account.
moodle_moodle
train
php
aac827c743c4a4d63c0d401f8a817f6ae5a7fc1e
diff --git a/openquake/commonlib/datastore.py b/openquake/commonlib/datastore.py index <HASH>..<HASH> 100644 --- a/openquake/commonlib/datastore.py +++ b/openquake/commonlib/datastore.py @@ -106,6 +106,19 @@ def get_last_calc_id(datadir): return calcs[-1] +def read(calc_id, mode='r'): + """ + Read the datastore identified by the calculation ID, if it exists + and it is accessible. + """ + if calc_id < 0: # use an old datastore + calc_id = get_calc_ids(DATADIR)[calc_id] + fname = os.path.join(DATADIR, 'calc_%s.hdf5' % calc_id) + assert os.path.exists(fname), fname + assert os.access(fname, os.R_OK if mode == 'r' else os.W_OK), fname + return DataStore(calc_id, mode=mode) + + class DataStore(collections.MutableMapping): """ DataStore class to store the inputs/outputs of a calculation on the
Added an utility datastore.read
gem_oq-engine
train
py
60ac1c968ccf2cc4326e5c5f6d46eca58f0c910c
diff --git a/common/tasks_code_boxes.py b/common/tasks_code_boxes.py index <HASH>..<HASH> 100644 --- a/common/tasks_code_boxes.py +++ b/common/tasks_code_boxes.py @@ -108,8 +108,7 @@ class FileBox(BasicBox): return False try: - _, ext = os.path.splitext(taskInput[self.get_complete_id()]["filename"]) - if ext not in self._allowed_exts: + if not taskInput[self.get_complete_id()]["filename"].endswith(tuple(self._allowed_exts)): return False if sys.getsizeof(taskInput[self.get_complete_id()]["value"]) > self._max_size:
Allow compound extensions (.tar.gz, .tar.xz, ...) This fix is not complete, as we should also change frontend/pages/admin_course.py:<I> to generate the filename in the downloaded archive.
UCL-INGI_INGInious
train
py
3f7dfd41d877edd6dbd08f1fd1e2858283ea3f1f
diff --git a/lib/vcoworkflows/workflowtoken.rb b/lib/vcoworkflows/workflowtoken.rb index <HASH>..<HASH> 100644 --- a/lib/vcoworkflows/workflowtoken.rb +++ b/lib/vcoworkflows/workflowtoken.rb @@ -26,14 +26,16 @@ module VcoWorkflows # rubocop:disable CyclomaticComplexity, PerceivedComplexity, MethodLength, LineLength # Create a new workflow token - # @param [String] token_json - JSON document defining the execution token - # @param [String] workflow_id - Workflow GUID + # @param [VcoWorkflows::WorkflowService] workflow_service Workflow service to use + # @param [String] workflow_id GUID of the workflow + # @param [String] execution_id GUID of execution # @return [VcoWorkflows::WorkflowToken] - def initialize(token_json, workflow_id) - @json_content = token_json + def initialize(workflow_service, workflow_id, execution_id) + @service = workflow_service @workflow_id = workflow_id + @json_content = @service.get_execution(workflow_id, execution_id) - token = JSON.parse(token_json) + token = JSON.parse(@json_content) @id = token.key?('id') ? token['id'] : nil @name = token.key?('name') ? token['name'] : nil
Clean up WorkflowToken#initialize for refactor Bring in line with `Workflow` refactor
activenetwork-automation_vcoworkflows
train
rb
c58e6c129a153ca1a5021e5d7e642d00bf011e20
diff --git a/tests/test_modeling_marian.py b/tests/test_modeling_marian.py index <HASH>..<HASH> 100644 --- a/tests/test_modeling_marian.py +++ b/tests/test_modeling_marian.py @@ -233,7 +233,8 @@ class TestMarian_en_ROMANCE(MarianIntegrationTest): self.tokenizer.prepare_translation_batch([""]) def test_pipeline(self): - pipeline = TranslationPipeline(self.model, self.tokenizer, framework="pt") + device = 0 if torch_device == "cuda" else -1 + pipeline = TranslationPipeline(self.model, self.tokenizer, framework="pt", device=device) output = pipeline(self.src_text) self.assertEqual(self.expected_text, [x["translation_text"] for x in output])
[marian tests ] pass device to pipeline (#<I>)
huggingface_pytorch-pretrained-BERT
train
py
614e099b537a4ac23d10cdaaef13022260117e4e
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js b/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js index <HASH>..<HASH> 100644 --- a/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js +++ b/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js @@ -190,7 +190,7 @@ define([ // Listen to model changes from fileCommands var _self = this; this._modelListeners = {}; - ["import"].forEach(function(eventType) { //$NON-NLS-1$//$NON-NLS-0$ + ["create", "import"].forEach(function(eventType) { //$NON-NLS-1$//$NON-NLS-0$ modelEventDispatcher.addEventListener(eventType, _self._modelListeners[eventType] = _self.modelHandler[eventType].bind(_self)); });
Bug <I> - File client should dispatch "changed" event when files change -- Temporaryily expose the project creation model listener.
eclipse_orion.client
train
js
890d344fa21680e02b1063ae5f785b517b2f7333
diff --git a/Event/PageEvents.php b/Event/PageEvents.php index <HASH>..<HASH> 100644 --- a/Event/PageEvents.php +++ b/Event/PageEvents.php @@ -13,8 +13,8 @@ class PageEvents const POST_CREATE = 'ekyna_cms.page.post_create'; const PRE_UPDATE = 'ekyna_cms.page.pre_update'; - const POST_UPDATE = 'ekyna_cms.page.pre_delete'; + const POST_UPDATE = 'ekyna_cms.page.post_delete'; const PRE_DELETE = 'ekyna_cms.page.pre_update'; - const POST_DELETE = 'ekyna_cms.page.pre_delete'; + const POST_DELETE = 'ekyna_cms.page.post_delete'; }
[CmsBundle] Fix page events !
ekyna_CmsBundle
train
php
675b0b502870aea49cf3e2575812344a633bcc1d
diff --git a/python/orca/test/bigdl/orca/learn/ray/mxnet/conftest.py b/python/orca/test/bigdl/orca/learn/ray/mxnet/conftest.py index <HASH>..<HASH> 100644 --- a/python/orca/test/bigdl/orca/learn/ray/mxnet/conftest.py +++ b/python/orca/test/bigdl/orca/learn/ray/mxnet/conftest.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import ray import pytest diff --git a/python/orca/test/bigdl/orca/learn/ray/pytorch/conftest.py b/python/orca/test/bigdl/orca/learn/ray/pytorch/conftest.py index <HASH>..<HASH> 100644 --- a/python/orca/test/bigdl/orca/learn/ray/pytorch/conftest.py +++ b/python/orca/test/bigdl/orca/learn/ray/pytorch/conftest.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import ray import pytest
Support RayOnSpark for k8s and add docs (#<I>) * support ray on k8s * add to init orca context * style * minor * minor * ut
intel-analytics_BigDL
train
py,py
69792a45edc50a185c4e18bbcd7b021c9fda9e59
diff --git a/serviced/proxy.go b/serviced/proxy.go index <HASH>..<HASH> 100644 --- a/serviced/proxy.go +++ b/serviced/proxy.go @@ -76,7 +76,7 @@ func (cli *ServicedCli) CmdProxy(args ...string) error { case cmderr := <-serviceExit: if cmderr != nil { client, err := serviced.NewLBClient(proxyOptions.servicedEndpoint) - message := fmt.Sprintf("Problem running service: %v. Command \"%v\" failed: %v", config.ServiceId, config.Command, err) + message := fmt.Sprintf("Service returned a non-zero exit code: %v. Command: \"%v\" Message: %v", config.ServiceId, config.Command, err) if err == nil { defer client.Close() glog.Errorf(message)
Updated proxy message to seem less threatening
control-center_serviced
train
go
5eb2611c26c3c8be96a0524b952f7a8e907e8efa
diff --git a/test/moan.spec.js b/test/moan.spec.js index <HASH>..<HASH> 100644 --- a/test/moan.spec.js +++ b/test/moan.spec.js @@ -41,7 +41,30 @@ describe('Moan', () => { }) describe('#config', () => { - // TODO: Complete unit tests + context('when only configuration key is provided', () => { + it('should return configuration value', () => { + moan.config('foo', 'bar') + + expect(moan.config('foo')).to.be('bar') + }) + + it('should return nothing if key does not exist', () => { + expect(moan.config('foo')).not.to.be.ok() + }) + }) + + context('when configuration key and value are provided', () => { + it('should return newly configured value', () => { + expect(moan.config('foo', 'bar')).to.be('bar') + }) + + it('should replace any previously configured value', () => { + expect(moan.config('foo', 'bar')).to.be('bar') + expect(moan.config('foo', 'baz')).to.be('baz') + + expect(moan.config('foo')).to.be('baz') + }) + }) }) describe('#currentTask', () => {
added tests to cover moan#config
neocotic_moan
train
js
4d19d32af380d53e03f3677d770a7dee221e4f88
diff --git a/commons-ip-math/src/main/java/net/ripe/commons/ip/Optional.java b/commons-ip-math/src/main/java/net/ripe/commons/ip/Optional.java index <HASH>..<HASH> 100644 --- a/commons-ip-math/src/main/java/net/ripe/commons/ip/Optional.java +++ b/commons-ip-math/src/main/java/net/ripe/commons/ip/Optional.java @@ -68,6 +68,9 @@ public abstract class Optional<T> implements Serializable { public static final class Absent<T> extends Optional<T> { + private Absent() { + } + @Override public T get() { throw new NoSuchElementException("Absent.get");
Add a private constructor to Absent. It's not possible to instantiate Absent outside of Optional any more. It is important because the equals() and hashCode() implementations (the lack of them, that is) relies on the fact that there is only one instance of Absent.
jgonian_commons-ip-math
train
java
8692dc42cd292906ea421b317a3d02df4ef9f5d4
diff --git a/app/controllers/katello/api/v2/host_debs_controller.rb b/app/controllers/katello/api/v2/host_debs_controller.rb index <HASH>..<HASH> 100644 --- a/app/controllers/katello/api/v2/host_debs_controller.rb +++ b/app/controllers/katello/api/v2/host_debs_controller.rb @@ -29,6 +29,7 @@ module Katello def find_host @host = resource_finder(::Host::Managed.authorized(:view_hosts, ::Host::Managed), params[:host_id]) + throw_resource_not_found(name: 'host', id: params[:host_id]) if @host.nil? end end end diff --git a/test/controllers/api/v2/host_debs_controller_test.rb b/test/controllers/api/v2/host_debs_controller_test.rb index <HASH>..<HASH> 100644 --- a/test/controllers/api/v2/host_debs_controller_test.rb +++ b/test/controllers/api/v2/host_debs_controller_test.rb @@ -33,6 +33,12 @@ module Katello assert_response :success end + def test_unable_to_find_host + get :index, params: { :host_id => 22 } + + assert_response 404 + end + def test_view_permissions good_perms = [@view_permission] bad_perms = [@update_permission, @create_permission, @destroy_permission]
Fixes #<I> - updates <I> conditions in before action filters
Katello_katello
train
rb,rb
216f25b94f4c120dda1e3a21dbb7af281604f3c6
diff --git a/tickets/views.py b/tickets/views.py index <HASH>..<HASH> 100644 --- a/tickets/views.py +++ b/tickets/views.py @@ -38,7 +38,7 @@ class MyTicketDetailView(DetailView): comment.author = self.request.user comment.ticket = Ticket.objects.get(id=self.kwargs['pk']) comment.save() - messages.success(self.request, _("Your comment has been successfully added to the ticket.")) + messages.success(self.request, _(u"Your comment has been successfully added to the ticket.")) def get_queryset(self): return Ticket.objects.filter(creator=self.request.user) @@ -53,5 +53,5 @@ class TicketCreateView(CreateView): ticket.creator = self.request.user ticket.save() self.success_url = reverse('tickets:detail', args=[ticket.id]) - messages.success(self.request, _("Your ticket has been successfully created.")) + messages.success(self.request, _(u"Your ticket has been successfully created.")) return super(TicketCreateView, self).form_valid(form)
change success message strings in views to unicode
byteweaver_django-tickets
train
py
573c8eb5097f7cee843655acdf1616f9945e22e7
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/FileTypeAnalyzer.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/FileTypeAnalyzer.java index <HASH>..<HASH> 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/FileTypeAnalyzer.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/FileTypeAnalyzer.java @@ -31,4 +31,9 @@ public interface FileTypeAnalyzer extends Analyzer { * @return whether or not the specified file extension is supported by this analyzer. */ boolean supportsExtension(String extension); + + /** + * Resets the analyzers state. + */ + void reset(); }
added a reset() method as part of resolution for issue #<I> Former-commit-id: b<I>e6a<I>ebd1b<I>f9be6f<I>a<I>fcb<I>a
jeremylong_DependencyCheck
train
java
d66495a9330d3f555af89ea20c422c5a4b4dbdff
diff --git a/ok.js b/ok.js index <HASH>..<HASH> 100644 --- a/ok.js +++ b/ok.js @@ -4,6 +4,8 @@ */ (function (factory, root, _, ok) { +/* global define, require, module */ + // amd if (typeof define === 'function' && define.amd) { define('ok', ['underscore'], factory);
Exclude define, require and module from linting
j-_ok
train
js
0353d6836805af7bc72b158c6668c6586a887107
diff --git a/benchmarks/aggregates.py b/benchmarks/aggregates.py index <HASH>..<HASH> 100644 --- a/benchmarks/aggregates.py +++ b/benchmarks/aggregates.py @@ -95,7 +95,7 @@ class GroupByCat1K(Aggregates): super().setup(N) def time_binby_iB_1M(self, N, B): - self.df.groupby(f'i{B}_1k', agg='count') + self.df.groupby(f'i{B}_1K', agg='count') class GroupByCat1M(Aggregates):
bench: fix benchmark, column name typo
vaexio_vaex
train
py
6a3b344d46645c6f8822a7cf211c51ecddc94c73
diff --git a/library/CM/Util.php b/library/CM/Util.php index <HASH>..<HASH> 100644 --- a/library/CM/Util.php +++ b/library/CM/Util.php @@ -74,13 +74,17 @@ class CM_Util { $timeout = (int) $timeout; $curlConnection = curl_init(); - curl_setopt($curlConnection, CURLOPT_URL, $url); curl_setopt($curlConnection, CURLOPT_RETURNTRANSFER, true); curl_setopt($curlConnection, CURLOPT_TIMEOUT, $timeout); if ($methodPost) { curl_setopt($curlConnection, CURLOPT_POST, 1); curl_setopt($curlConnection, CURLOPT_POSTFIELDS, $params); + } else { + if (!empty($params)) { + $url .= '?' . http_build_query($params); + } } + curl_setopt($curlConnection, CURLOPT_URL, $url); $contents = curl_exec($curlConnection); curl_close($curlConnection);
t<I>: params also for get, pas params as array
cargomedia_cm
train
php
d1627b92fc341cd9690296d1ec6935fb9dbae532
diff --git a/.adiorc.js b/.adiorc.js index <HASH>..<HASH> 100644 --- a/.adiorc.js +++ b/.adiorc.js @@ -20,7 +20,7 @@ module.exports = { } }, ignore: { - src: ["path", "os", "fs", "util", "events"], + src: ["path", "os", "fs", "util", "events", "crypto"], dependencies: ["@babel/runtime"], devDependencies: true },
chore: ignore "crypto" requires, it's a Node.js built-in
Webiny_webiny-js
train
js
17c6690c4709927aa4b0a705ea2802118aa31bbc
diff --git a/pippo-core/src/main/java/ro/fortsoft/pippo/core/DefaultErrorHandler.java b/pippo-core/src/main/java/ro/fortsoft/pippo/core/DefaultErrorHandler.java index <HASH>..<HASH> 100644 --- a/pippo-core/src/main/java/ro/fortsoft/pippo/core/DefaultErrorHandler.java +++ b/pippo-core/src/main/java/ro/fortsoft/pippo/core/DefaultErrorHandler.java @@ -64,15 +64,16 @@ public class DefaultErrorHandler implements ErrorHandler { if (StringUtils.isNullOrEmpty(contentType)) { // unspecified so negotiate a content type based on the request response.contentType(request); + + // retrieve the negotiated type + contentType = response.getContentType(); } - // retrieve the negotiated type - contentType = response.getContentType(); } if (StringUtils.isNullOrEmpty(contentType)) { - log.warn("No content type specified!'"); + log.debug("No accept type nor content type specified! Defaulting to text/html."); renderHtml(statusCode, request, response); } else if (contentType.equals(HttpConstants.ContentType.TEXT_HTML)) {
Fix another error handler content type bug The text/html content type determined by the accept header for an error/exception during a browser request was being reset to null. This caused an incorrect warning to be logged: no content type specified.
pippo-java_pippo
train
java
2b41da058db88c97f4694361624566615f20017e
diff --git a/persistence/rest/src/main/java/org/infinispan/persistence/rest/upgrade/RestTargetMigrator.java b/persistence/rest/src/main/java/org/infinispan/persistence/rest/upgrade/RestTargetMigrator.java index <HASH>..<HASH> 100644 --- a/persistence/rest/src/main/java/org/infinispan/persistence/rest/upgrade/RestTargetMigrator.java +++ b/persistence/rest/src/main/java/org/infinispan/persistence/rest/upgrade/RestTargetMigrator.java @@ -57,7 +57,11 @@ public class RestTargetMigrator implements TargetMigrator { if (log.isDebugEnabled() && i % 100 == 0) log.debugf(">> Moved %s keys\n", i); } catch (Exception e) { - log.keyMigrationFailed(Util.toStr(key), e); + if ((key instanceof String) && ((String)key).matches("___MigrationManager_.+_KnownKeys___")) { + // ISPN-3724 Ignore keys from other migrators. + } else { + log.keyMigrationFailed(Util.toStr(key), e); + } } } });
ISPN-<I> Don't make the REST target migrator complain about spurious keys injected by other source migrators
infinispan_infinispan
train
java
fde92ec3f77d0a50621ac8c91c476b0bba463b40
diff --git a/lib/chef/knife/cloudformation_create.rb b/lib/chef/knife/cloudformation_create.rb index <HASH>..<HASH> 100644 --- a/lib/chef/knife/cloudformation_create.rb +++ b/lib/chef/knife/cloudformation_create.rb @@ -64,7 +64,11 @@ class Chef ui.fatal "Formation name must be specified!" exit 1 end - file = load_template_file + if(Chef::Config[:knife][:cloudformation][:template]) + file = Chef::Config[:knife][:cloudformation][:template] + else + file = load_template_file + end ui.info "#{ui.color('Cloud Formation:', :bold)} #{ui.color('create', :green)}" stack_info = "#{ui.color('Name:', :bold)} #{name}" if(Chef::Config[:knife][:cloudformation][:path])
Allow pre-defined template to be used for creation
sparkleformation_sfn
train
rb
0092a5ae4bca1b957ab970b5a70365b9e0c722e6
diff --git a/janitor/actions.py b/janitor/actions.py index <HASH>..<HASH> 100644 --- a/janitor/actions.py +++ b/janitor/actions.py @@ -62,7 +62,7 @@ class BaseAction(object): except ClientError, e: if (e.response['Error']['Code'] == 'DryRunOperation' and e.response['HTTPStatusCode'] == 412 - and 'would have succeeded' in e.message: + and 'would have succeeded' in e.message): return self.log.info( "Dry run operation %s succeeded" % ( self.__class__.__name__.lower()))
ugh.. egg on face, need ci server
cloud-custodian_cloud-custodian
train
py
038b5b85fd6e78b317236277d676e1202080bae4
diff --git a/worker.go b/worker.go index <HASH>..<HASH> 100644 --- a/worker.go +++ b/worker.go @@ -61,6 +61,7 @@ type Worker struct { *Config JobResource *admin.Resource Jobs []*Job + mounted bool } // ConfigureQorResourceBeforeInitialize a method used to config Worker for qor admin @@ -130,6 +131,7 @@ func (worker *Worker) ConfigureQorResource(res resource.Resourcer) { qorJobID := cmdLine.String("qor-job", "", "Qor Job ID") runAnother := cmdLine.Bool("run-another", false, "Run another qor job") cmdLine.Parse(os.Args[1:]) + worker.mounted = true if *qorJobID != "" { if *runAnother == true { @@ -190,6 +192,11 @@ func (worker *Worker) SetQueue(queue Queue) { // RegisterJob register a job into Worker func (worker *Worker) RegisterJob(job *Job) error { + if worker.mounted { + debug.PrintStack() + fmt.Printf("Job should be registered before Worker mounted into admin, but %v is registered after that", job.Name) + } + job.Worker = worker worker.Jobs = append(worker.Jobs, job) return nil
Show warning message when register job after Worker mounted
qor_worker
train
go
258c04338cfac8c67617c5245e319d9aedf9d82d
diff --git a/packages/stylelint-config-heisenberg/index.js b/packages/stylelint-config-heisenberg/index.js index <HASH>..<HASH> 100644 --- a/packages/stylelint-config-heisenberg/index.js +++ b/packages/stylelint-config-heisenberg/index.js @@ -99,6 +99,7 @@ module.exports = { 'media-query-list-comma-newline-after': 'always-multi-line', 'media-query-list-comma-space-after': 'always-single-line', 'media-query-list-comma-space-before': 'never', + 'no-descending-specificity': null, 'no-eol-whitespace': true, 'no-missing-end-of-source-newline': true, 'number-leading-zero': 'always',
Remove `no-descending-specificity` rule
DekodeInteraktiv_heisenberg
train
js
818a5064c632be61afe788fe46dcc8272beb72f4
diff --git a/src/Knp/Menu/Silex/KnpMenuServiceProvider.php b/src/Knp/Menu/Silex/KnpMenuServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/Knp/Menu/Silex/KnpMenuServiceProvider.php +++ b/src/Knp/Menu/Silex/KnpMenuServiceProvider.php @@ -80,4 +80,13 @@ class KnpMenuServiceProvider implements ServiceProviderInterface })); } } + + /** + * Bootstraps the application. + * + * This method is called after all services are registers + * and should be used for "dynamic" configuration (whenever + * a service must be requested). + */ + public function boot(Application $app){} }
Update master of course, conventions Removed unneeded //TODO:
KnpLabs_KnpMenu
train
php
dd330868e4d1a225d9ab6a99c8b394f1e1a317c7
diff --git a/test/ctx_test.rb b/test/ctx_test.rb index <HASH>..<HASH> 100644 --- a/test/ctx_test.rb +++ b/test/ctx_test.rb @@ -41,6 +41,14 @@ describe GPGME::Ctx do output.seek 0 assert_equal "Hi there", output.read.chomp + + recipients = ctx.decrypt_result.recipients + assert_equal 1, recipients.size + + recipient_key = ctx.get_key(recipient.keyid) + key = ctx.get_key(PASSWORD_KEY[:sha]) + + assert_equal recipient_key, key end end
tests: Inspect decryption result
ueno_ruby-gpgme
train
rb
e05cfdb00a57cafcd26100735dbd2c8b8af0d0d4
diff --git a/text/text.go b/text/text.go index <HASH>..<HASH> 100644 --- a/text/text.go +++ b/text/text.go @@ -268,7 +268,7 @@ func DrawWithOptions(dst *ebiten.Image, text string, face font.Face, options *eb // This means that if the text consists of one character '.', this dot is rendered at (0, 0). // // This is very similar to golang.org/x/image/font's BoundString, -// but this BoundString calculates the actual rendered area considering multiple lines and space characters. +// but this BoundString calculates the actual rendered area considering multiple lines. // // face is the font for text rendering. // text is the string that's being measured.
text: update comments about `BoundsString` The way in which space characters are treated is exactly same as golang.org/x/image/font's `BoundsString`. Updates #<I>
hajimehoshi_ebiten
train
go
993ba30648a407e8dd7e7722d8cbfc8d2d8b8922
diff --git a/tests/config.php b/tests/config.php index <HASH>..<HASH> 100644 --- a/tests/config.php +++ b/tests/config.php @@ -35,9 +35,11 @@ if (!class_exists('PHPTAL')) { abstract class PHPTAL_TestCase extends PHPUnit_Framework_TestCase { - private $cwd_backup; + private $cwd_backup, $buffer_level; function setUp() { + $this->buffer_level = ob_get_level(); + // tests rely on cwd being in tests/ $this->cwd_backup = getcwd(); chdir(dirname(__FILE__)); @@ -47,7 +49,16 @@ abstract class PHPTAL_TestCase extends PHPUnit_Framework_TestCase function tearDown() { + parent::tearDown(); + chdir($this->cwd_backup); + + $unflushed = 0; + while(ob_get_level() > $this->buffer_level) { + ob_end_flush(); $unflushed++; + } + + if ($unflushed) throw new Exception("Unflushed buffers: $unflushed"); } /**
Added check for unflushed output buffers
phptal_PHPTAL
train
php
9d61a87688d4f3c70365a035ad24461daa129739
diff --git a/app/app.go b/app/app.go index <HASH>..<HASH> 100644 --- a/app/app.go +++ b/app/app.go @@ -1047,7 +1047,7 @@ func (app *App) LastLogs(lines int, filterLog Applog) ([]Applog, error) { if filterLog.Unit != "" { q["unit"] = filterLog.Unit } - err = conn.Logs(app.Name).Find(q).Sort("-$natural").Limit(lines).All(&logs) + err = conn.Logs(app.Name).Find(q).Sort("-_id").Limit(lines).All(&logs) if err != nil { return nil, err }
app: sorting logs by _id instead of $natural This is due to <URL>
tsuru_tsuru
train
go
066064a3da2af0d60987f98462f4f67bdb06155d
diff --git a/wptools/utils.py b/wptools/utils.py index <HASH>..<HASH> 100644 --- a/wptools/utils.py +++ b/wptools/utils.py @@ -115,6 +115,12 @@ def strip_refs(blob): return re.sub(r"\[\d+\](:\d+)?", "", blob) +def wiki_path(title): + title = title.replace(" ", "_") + title = title[0].upper() + title[1:] + return "/wiki/%s" % title + + def wikitext_from_json(_json): """return wikitext from API JSON""" text = ""
added wiki_path() to utils.
siznax_wptools
train
py
3f71131de8353594a33f367ae06a4478358ba2e2
diff --git a/spec/project_haystack/point_spec.rb b/spec/project_haystack/point_spec.rb index <HASH>..<HASH> 100644 --- a/spec/project_haystack/point_spec.rb +++ b/spec/project_haystack/point_spec.rb @@ -39,11 +39,10 @@ describe ProjectHaystack::Point do describe '#data' do context 'valid id and range' do before do - @data = @point.data('yesterday') + @data = @point.data('2015-06-15') @d = @data.first end it 'returns data with expected format' do - @d = @data.first expect(@d[:time]).to_not be_nil expect(@d[:value]).to_not be_nil end
use date that is known to have data
NREL_haystack_ruby
train
rb
8aa0f2aeb73e8916bedade8928a118f293257d2e
diff --git a/lib/weather-report.rb b/lib/weather-report.rb index <HASH>..<HASH> 100644 --- a/lib/weather-report.rb +++ b/lib/weather-report.rb @@ -9,7 +9,8 @@ module WeatherReport attr_reader :today, :tomorrow, :day_after_tomorrow def initialize(city) - @uri = URI.parse("http://weather.livedoor.com/forecast/webservice/json/v1?city=#{city}") + id = request_cityid(city) + @uri = URI.parse("http://weather.livedoor.com/forecast/webservice/json/v1?city=#{id}") end def request_cityid(city)
now it can use name of the city to get weather
zakuni_weather-report
train
rb
cff7bffbaf17a093d36e038e702fda3dfcef8c65
diff --git a/bxml/xml.py b/bxml/xml.py index <HASH>..<HASH> 100644 --- a/bxml/xml.py +++ b/bxml/xml.py @@ -263,8 +263,7 @@ class XML(File): cmd.pop(cmd.index('-c')) try: fn = self.fn - tempf = None - if fn is None: + if fn is None or not os.path.exists(fn): tempf = tempfile.NamedTemporaryFile() fn = tempf.name tempf.close()
XML.jing() now handles the case where the XML.fn is not None but the file doesn't exist – in this case as when XML.fn is None, a tempfile is written for jing to use.
BlackEarth_bxml
train
py
5d229748112f9d6db58880e4c9906d8a3697b61a
diff --git a/src/cluster/shard.go b/src/cluster/shard.go index <HASH>..<HASH> 100644 --- a/src/cluster/shard.go +++ b/src/cluster/shard.go @@ -180,6 +180,7 @@ func (self *ShardData) ServerIds() []uint32 { } func (self *ShardData) SyncWrite(request *p.Request) error { + request.ShardId = &self.id if err := self.store.Write(request); err != nil { return err }
fixup! make writes synchronous for continuous queries
influxdata_influxdb
train
go
b70c1cc749fe769f57263128f0d9a510b3f5d604
diff --git a/forms/gridfield/GridFieldBlogPostAddNewButton.php b/forms/gridfield/GridFieldBlogPostAddNewButton.php index <HASH>..<HASH> 100755 --- a/forms/gridfield/GridFieldBlogPostAddNewButton.php +++ b/forms/gridfield/GridFieldBlogPostAddNewButton.php @@ -57,7 +57,7 @@ class GridFieldBlogPostAddNewButton extends GridFieldAddNewButton $singleton->defaultChild() ); $pageTypes->setFieldHolderTemplate("BlogDropdownField_holder") - ->addExtraClass("gridfield-dropdown"); + ->addExtraClass("gridfield-dropdown no-change-track"); $forTemplate = new ArrayData(array()); $forTemplate->Fields = new ArrayList(); @@ -123,4 +123,4 @@ class GridFieldBlogPostAddNewButton extends GridFieldAddNewButton } } -} \ No newline at end of file +}
FIX: Prevent change tracking when picking a different blog post type
micmania1_silverstripe-blogger
train
php
1d6fbab80078568d493f9f29fc880cb24b6b15f4
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/projectCommands.js b/bundles/org.eclipse.orion.client.ui/web/orion/projectCommands.js index <HASH>..<HASH> 100644 --- a/bundles/org.eclipse.orion.client.ui/web/orion/projectCommands.js +++ b/bundles/org.eclipse.orion.client.ui/web/orion/projectCommands.js @@ -179,6 +179,9 @@ define(['i18n!orion/navigate/nls/messages', 'orion/webui/littlelib', 'orion/comm }, function(error){ if(error.Retry && error.Retry.parameters){ + if(error.forceShowMessage){ + context.errorHandler(error); + } context.data.parameters = getCommandParameters(error.Retry.parameters, error.Retry.optionalParameters); context.data.oldParams = enhansedLaunchConf.Params; context.commandService.collectParameters(context.data);
Bug <I> - [Project] When requesting for extra params we should be able to force to show message
eclipse_orion.client
train
js
8274bbf9c85bda410dc7dcb8612cba59ec8d30cc
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/projects_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/projects_controller.rb index <HASH>..<HASH> 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/projects_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/projects_controller.rb @@ -61,6 +61,7 @@ class Api::ProjectsController < Api::ApiController project = Project.by_key(params[:id]) bad_request("Not valid project") unless project access_denied unless is_admin?(project) + bad_request("Not valid project") unless java_facade.getResourceTypeBooleanProperty(project.qualifier, 'deletable') Project.delete_resource_tree(project) render_success("Project deleted")
SONAR-<I> Keep previous behaviour on web service
SonarSource_sonarqube
train
rb
106065271da7bc086b749d0bd8ab0e34875e2baf
diff --git a/src/main/org/openscience/cdk/templates/AminoAcids.java b/src/main/org/openscience/cdk/templates/AminoAcids.java index <HASH>..<HASH> 100644 --- a/src/main/org/openscience/cdk/templates/AminoAcids.java +++ b/src/main/org/openscience/cdk/templates/AminoAcids.java @@ -108,7 +108,7 @@ public class AminoAcids { * * @return aminoAcids, a HashMap containing the amino acids as AminoAcids. */ - public static AminoAcid[] createAAs() { + public synchronized static AminoAcid[] createAAs() { if (aminoAcids != null) { return aminoAcids; }
AminoAcidCountDescriptor constructor made thread safe
cdk_cdk
train
java
0b4db582115536e171c7231992e268fb0210e045
diff --git a/liquibase-core/src/main/java/liquibase/snapshot/jvm/SequenceSnapshotGenerator.java b/liquibase-core/src/main/java/liquibase/snapshot/jvm/SequenceSnapshotGenerator.java index <HASH>..<HASH> 100644 --- a/liquibase-core/src/main/java/liquibase/snapshot/jvm/SequenceSnapshotGenerator.java +++ b/liquibase-core/src/main/java/liquibase/snapshot/jvm/SequenceSnapshotGenerator.java @@ -54,6 +54,7 @@ public class SequenceSnapshotGenerator extends JdbcSnapshotGenerator { List<String> sequenceNames = (List<String>) ExecutorService.getInstance().getExecutor(database).queryForList(new RawSqlStatement(getSelectSequenceSql(example.getSchema(), database)), String.class); for (String name : sequenceNames) { + name = cleanNameFromDatabase(name, database); if ((database.isCaseSensitive() && name.equals(example.getName()) || (!database.isCaseSensitive() && name.equalsIgnoreCase(example.getName())))) { Sequence seq = new Sequence();
Name not cleaned correctly in snapshotObject method
liquibase_liquibase
train
java
7d33378b905cc733c77ff306b3efa29f964e0e94
diff --git a/lib/specjour/worker.rb b/lib/specjour/worker.rb index <HASH>..<HASH> 100644 --- a/lib/specjour/worker.rb +++ b/lib/specjour/worker.rb @@ -50,7 +50,7 @@ module Specjour def run_test(test) puts "Running #{test}" - if test =~ /.feature/ + if test =~ /\.feature$/ run_feature test else run_spec test
Strictly match cucumber features The previous regex allowed for example showcase_feature_spec.rb to be run by cucumber
sandro_specjour
train
rb
f0e786181240c8874f6a2e52fac4a32f06d4657c
diff --git a/code/service/querybuilders/SolrQueryBuilder.php b/code/service/querybuilders/SolrQueryBuilder.php index <HASH>..<HASH> 100644 --- a/code/service/querybuilders/SolrQueryBuilder.php +++ b/code/service/querybuilders/SolrQueryBuilder.php @@ -41,7 +41,11 @@ class SolrQueryBuilder { } public function parse($string) { - + // custom search query entered + if (strpos($string, ':') > 0) { + return $string; + } + $sep = ''; $lucene = ''; foreach ($this->fields as $field) {
BUGFIX: Allow freeform queries to be specified if the user knows how
nyeholt_silverstripe-solr
train
php
fcfda5d71794c967b0369cde3d5940466ac2abb6
diff --git a/lib/cielo/http.rb b/lib/cielo/http.rb index <HASH>..<HASH> 100644 --- a/lib/cielo/http.rb +++ b/lib/cielo/http.rb @@ -8,8 +8,10 @@ module Cielo http = Net::HTTP.new(host, port) http.use_ssl = true + http.ssl_version = :TLSv1 http.open_timeout = 10 * 1000 http.read_timeout = 40 * 1000 + http.verify_mode = OpenSSL::SSL::VERIFY_PEER Cielo.logger.info(http.inspect) post_body = "mensagem=#{to_xml}"
set ssl version and verify mode
rafaelss_cielo
train
rb
b048b261f3951717de26f0ff997d52f1fe8e585c
diff --git a/tests/frontend/org/voltdb/AdhocDDLTestBase.java b/tests/frontend/org/voltdb/AdhocDDLTestBase.java index <HASH>..<HASH> 100644 --- a/tests/frontend/org/voltdb/AdhocDDLTestBase.java +++ b/tests/frontend/org/voltdb/AdhocDDLTestBase.java @@ -57,7 +57,12 @@ public class AdhocDDLTestBase extends TestCase { protected void startClient(ClientConfig clientConfig) throws Exception { - m_client = ClientFactory.createClient(clientConfig); + if (clientConfig != null) { + m_client = ClientFactory.createClient(clientConfig); + } + else { + m_client = ClientFactory.createClient(); + } m_client.createConnection("localhost"); }
ENG-<I> - Fix other ad hoc DDL unit tests that got broken
VoltDB_voltdb
train
java
75371c0388082ab9f74bd8613b9e20192d03d660
diff --git a/Gruntfile.js b/Gruntfile.js index <HASH>..<HASH> 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -110,8 +110,10 @@ module.exports = function (grunt) { var files = grunt.file.expand(['lib/checks/**/*.json']); files.forEach(function (file) { var src = grunt.file.readJSON(file); - src.type = src.result; - delete src.result; + if (src.result) { + src.type = src.result; + delete src.result; + } grunt.file.write(file, JSON.stringify(src, null, '\t')); }); });
Don't overwrite type if result doesn't exist
dequelabs_axe-core
train
js
d5fb4da64012253f5178b0e5ef49fc23f93e221f
diff --git a/pyvista/plotting/picking.py b/pyvista/plotting/picking.py index <HASH>..<HASH> 100644 --- a/pyvista/plotting/picking.py +++ b/pyvista/plotting/picking.py @@ -124,6 +124,8 @@ class PickingHelper: # render here prior to running the callback self_().render() + elif not is_valid_selection: + self.remove_actor('_cell_picking_selection') if callback is not None and is_valid_selection: try_callback(callback, self_().picked_cells)
remove viz of last picked cell after clicking outside the mesh (#<I>) Resolve <URL>
vtkiorg_vtki
train
py
94eeb80f069cd227a92466d9898c7ec22fd0e0f8
diff --git a/luigi/worker.py b/luigi/worker.py index <HASH>..<HASH> 100644 --- a/luigi/worker.py +++ b/luigi/worker.py @@ -126,10 +126,10 @@ class TaskProcess(multiprocessing.Process): raise except BaseException as ex: status = FAILED - logger.exception("[pid %s][host %] Worker %s failed %s", os.getpid(), self.host, self.worker_id, self.task) + logger.exception("[pid %s] Worker %s failed %s", os.getpid(), self.worker_id, self.task) error_message = notifications.wrap_traceback(self.task.on_failure(ex)) self.task.trigger_event(Event.FAILURE, self.task, ex) - subject = "Luigi: %s FAILED - Host: %s" % (self.task, self.host) + subject = "Luigi: %s FAILED" % self.task notifications.send_error_email(subject, error_message) finally: self.result_queue.put(
Fixed bug introduced in #<I> TaskProcess has no attribute host, not sure why nosetests ran
spotify_luigi
train
py
32fb09296baf4e2bf111bedc8d07593ef3442ccf
diff --git a/plugins/src/kg/apc/jmeter/vizualizers/JPerfmonParamsDialog.java b/plugins/src/kg/apc/jmeter/vizualizers/JPerfmonParamsDialog.java index <HASH>..<HASH> 100644 --- a/plugins/src/kg/apc/jmeter/vizualizers/JPerfmonParamsDialog.java +++ b/plugins/src/kg/apc/jmeter/vizualizers/JPerfmonParamsDialog.java @@ -241,13 +241,9 @@ public class JPerfmonParamsDialog extends javax.swing.JDialog { } else if("TAIL".equals(type)) { jTextFieldTail.setText(existing); } else { - int index = existing.lastIndexOf(":"); - if(index == -1) { - index = 0; - } else { - index++; + for(int i=0; i<elements.length; i++) { + initMetricRadios(elements[i]); } - initMetricRadios(existing.substring(index)); } }
Prefill wizard dialog with existing param String - accept any order for metric place
undera_jmeter-plugins
train
java
a875190db7b6aa95eb29bb7e24345fbe3ed9214d
diff --git a/model/AssignmentFactory.php b/model/AssignmentFactory.php index <HASH>..<HASH> 100644 --- a/model/AssignmentFactory.php +++ b/model/AssignmentFactory.php @@ -37,12 +37,15 @@ class AssignmentFactory private $user; private $startable; - - public function __construct(\core_kernel_classes_Resource $delivery, User $user, $startable) + + private $displayAttempts; + + public function __construct(\core_kernel_classes_Resource $delivery, User $user, $startable, $displayAttempts = true) { $this->delivery = $delivery; $this->user = $user; $this->startable = $startable; + $this->displayAttempts = $displayAttempts; } public function getDeliveryId() @@ -111,9 +114,9 @@ class AssignmentFactory } elseif (!empty($endTime)) { $descriptions[] = __('Available until %s', tao_helpers_Date::displayeDate($endTime)); } - - if ($maxExecs !== 0) { - if ($maxExecs === 1) { + + if ($maxExecs != 0 && $this->displayAttempts) { + if ($maxExecs == 1) { $descriptions[] = __('Attempt %1$s of %2$s' ,$countExecs ,!empty($maxExecs)
allow to diplay or not # of attempts and handle maxexecs as strings
oat-sa_extension-tao-delivery-rdf
train
php
e1f0ba85e62f3da7d1ef978a078d928c7040e7ea
diff --git a/facepy/graph_api.py b/facepy/graph_api.py index <HASH>..<HASH> 100755 --- a/facepy/graph_api.py +++ b/facepy/graph_api.py @@ -134,7 +134,7 @@ class GraphAPI(object): yield data - def _query(self, method, path, data={}, page=False): + def _query(self, method, path, data=None, page=False): """ Fetch an object from the Graph API and parse the output, returning a tuple where the first item is the object yielded by the Graph API and the second is the URL for the next page of results, or @@ -145,6 +145,7 @@ class GraphAPI(object): :param data: A dictionary of HTTP GET parameters (for GET requests) or POST data (for POST requests). :param page: A boolean describing whether to return an iterator that iterates over each page of results. """ + data = data or {} def load(method, url, data): if method in ['GET', 'DELETE']:
Avoid using mutables as default arguments See 'Principle of Least Astonishment in Python: The Mutable Default Argument' for really good references on why you should avoid assigning a mutable as a default argument unless you really really know what you are doing. * <URL>
jgorset_facepy
train
py
8e9da6a6d6e2d6395211003ed880b712a2304779
diff --git a/lark/parsers/grammar_analysis.py b/lark/parsers/grammar_analysis.py index <HASH>..<HASH> 100644 --- a/lark/parsers/grammar_analysis.py +++ b/lark/parsers/grammar_analysis.py @@ -38,7 +38,7 @@ class RulePtr(object): def update_set(set1, set2): - if not set2: + if not set2 or set1 > set2: return False copy = set(set1) @@ -82,10 +82,11 @@ def calculate_sets(rules): changed = True for i, sym in enumerate(rule.expansion): - if set(rule.expansion[:i]) > NULLABLE: + if set(rule.expansion[:i]) <= NULLABLE: + if update_set(FIRST[rule.origin], FIRST[sym]): + changed = True + else: break - if update_set(FIRST[rule.origin], FIRST[sym]): - changed = True # Calculate FOLLOW changed = True
Minor optimization in LALR (and fix for last commit)
lark-parser_lark
train
py
b21b89bdb9486cc1ba9996dbc7aa96eebfddde3f
diff --git a/alpaca_trade_api/__init__.py b/alpaca_trade_api/__init__.py index <HASH>..<HASH> 100644 --- a/alpaca_trade_api/__init__.py +++ b/alpaca_trade_api/__init__.py @@ -1,4 +1,4 @@ from .rest import REST # noqa from .stream2 import StreamConn # noqa -__version__ = '0.43' +__version__ = '0.44' diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ setup( author_email='oss@alpaca.markets', url='https://github.com/alpacahq/alpaca-trade-api-python', keywords='financial,timeseries,api,trade', - packages=['alpaca_trade_api', 'alpaca_trade_api.polygon'], + packages=['alpaca_trade_api', 'alpaca_trade_api.polygon', 'alpaca_trade_api.alpha_vantage'], install_requires=[ 'asyncio-nats-client', 'pandas',
Add missing package declaration in setup.py
alpacahq_alpaca-trade-api-python
train
py,py
984e25a4c196016370a25e678168db4a9f1e5ad8
diff --git a/app/deploy.go b/app/deploy.go index <HASH>..<HASH> 100644 --- a/app/deploy.go +++ b/app/deploy.go @@ -291,10 +291,14 @@ func incrementDeploy(app *App) error { return err } defer conn.Close() - return conn.Apps().Update( + err = conn.Apps().Update( bson.M{"name": app.Name}, bson.M{"$inc": bson.M{"deploys": 1}}, ) + if err == nil { + app.Deploys += 1 + } + return err } func getImage(appName string, img string) (string, error) { diff --git a/app/deploy_test.go b/app/deploy_test.go index <HASH>..<HASH> 100644 --- a/app/deploy_test.go +++ b/app/deploy_test.go @@ -587,6 +587,7 @@ func (s *S) TestIncrementDeploy(c *check.C) { c.Assert(err, check.IsNil) defer s.conn.Apps().Remove(bson.M{"name": a.Name}) incrementDeploy(&a) + c.Assert(a.Deploys, check.Equals, uint(1)) s.conn.Apps().Find(bson.M{"name": a.Name}).One(&a) c.Assert(a.Deploys, check.Equals, uint(1)) }
app: increment deploys in app pointer for consistency
tsuru_tsuru
train
go,go
32106519b647573bbc36d953fe6855d57565be36
diff --git a/src/Client/Client.php b/src/Client/Client.php index <HASH>..<HASH> 100644 --- a/src/Client/Client.php +++ b/src/Client/Client.php @@ -23,7 +23,7 @@ use Yproximite\Ekomi\Api\Proxy\CacheProxy; */ class Client { - const BASE_URL = 'https://csv.ekomi.com/api/3.0'; + const BASE_URL = 'https://csv.ekomiapps.de/api/3.0'; const CACHE_KEY = 'yproximite.ekomi.cache_key';
Update Client::BASE_URL
Yproximite_ekomi-api
train
php
7e4b72a1d6946ec0203af472140e07581b51a703
diff --git a/tests/test_views.py b/tests/test_views.py index <HASH>..<HASH> 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -4,6 +4,7 @@ from mock import patch import os from django.test import TestCase, RequestFactory +from django.utils.six.moves.urllib.parse import ParseResult from revproxy.exceptions import InvalidUpstream from revproxy.views import ProxyView, DiazoProxyView @@ -25,6 +26,21 @@ class ViewTest(TestCase): with self.assertRaises(NotImplementedError): upstream = proxy_view.upstream + def test_upstream_parsed_url_cache(self): + class CustomProxyView(ProxyView): + upstream = 'http://www.example.com' + + proxy_view = CustomProxyView() + with self.assertRaises(AttributeError): + proxy_view._parsed_url + + # Test for parsed URL + proxy_view.get_upstream() + self.assertIsInstance(proxy_view._parsed_url, ParseResult) + # Get parsed URL from cache + proxy_view.get_upstream() + self.assertIsInstance(proxy_view._parsed_url, ParseResult) + def test_upstream_without_scheme(self): class BrokenProxyView(ProxyView): upstream = 'www.example.com'
Added test for parsed_url
TracyWebTech_django-revproxy
train
py
8b1f69ea77bd9d77cbe87b076d28a12cd1a65cca
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -28,7 +28,7 @@ Swig.prototype._w = Swig.prototype._widget = function(api, id, attr, options) { return function(locals) { api.addPagelet({ - 'for': attr['for'], + container: attr['container'] || attr['for'], model: attr.model, id: attr.id, mode: attr.mode,
renmae for to container
fex-team_yog-swig
train
js
646e2e66cc78a9657f2797f5d749b18e74f02537
diff --git a/watson_developer_cloud/speech_to_text_v1.py b/watson_developer_cloud/speech_to_text_v1.py index <HASH>..<HASH> 100644 --- a/watson_developer_cloud/speech_to_text_v1.py +++ b/watson_developer_cloud/speech_to_text_v1.py @@ -27,7 +27,7 @@ class SpeechToTextV1(WatsonDeveloperCloudService): WatsonDeveloperCloudService.__init__(self, 'speech_to_text', url, **kwargs) - def recognize(self, audio, content_type, continuous=False, model=None, + def recognize(self, audio, content_type, continuous=None, model=None, customization_id=None, inactivity_timeout=None, keywords=None, keywords_threshold=None,
Prevent continuous from getting passed by default
watson-developer-cloud_python-sdk
train
py
d137d3bd268246ec214cf2abc721f137f6ae6948
diff --git a/glances/compat.py b/glances/compat.py index <HASH>..<HASH> 100644 --- a/glances/compat.py +++ b/glances/compat.py @@ -31,16 +31,10 @@ from glances.logger import logger PY3 = sys.version_info[0] == 3 -try: - from statistics import mean -except ImportError: - # Statistics is only available for Python 3.4 or higher - def mean(numbers): - return float(sum(numbers)) / max(len(numbers), 1) - if PY3: import queue from configparser import ConfigParser, NoOptionError, NoSectionError + from statistics import mean from xmlrpc.client import Fault, ProtocolError, ServerProxy, Transport, Server from xmlrpc.server import SimpleXMLRPCRequestHandler, SimpleXMLRPCServer from urllib.request import urlopen @@ -130,6 +124,9 @@ else: viewvalues = operator.methodcaller('viewvalues') viewitems = operator.methodcaller('viewitems') + def mean(numbers): + return float(sum(numbers)) / max(len(numbers), 1) + def to_ascii(s): """Convert the unicode 's' to a ASCII string Usefull to remove accent (diacritics)"""
Unconditionally use statistics module since we support Python <I>+ now
nicolargo_glances
train
py
657623aea63e5edcd523ca532c44af3e9a9c7abf
diff --git a/spec/statsd/sender_spec.rb b/spec/statsd/sender_spec.rb index <HASH>..<HASH> 100644 --- a/spec/statsd/sender_spec.rb +++ b/spec/statsd/sender_spec.rb @@ -54,8 +54,16 @@ describe Datadog::Statsd::Sender do it 'starts a worker thread and a flush timer thread' do mutex = Mutex.new cv = ConditionVariable.new - expect(subject).to receive(:flush).and_wrap_original do - mutex.synchronize { cv.broadcast } + flush_called = false + + # #flush can be called multiple times before #stop is called. + # It is also called in #stop, which is executed in the after callback, + # so "expect(subject).to receive(:flush).at_least(:once)" doesn't work. + allow(subject).to receive(:flush) do + mutex.synchronize do + flush_called = true + cv.broadcast + end end expect do @@ -63,10 +71,11 @@ describe Datadog::Statsd::Sender do end.to change { Thread.list.size }.by(2) # wait a second or until #flush is called - mutex.synchronize { cv.wait(mutex, 1) } + mutex.synchronize do + cv.wait(mutex, 1) unless flush_called + end - # subject.stop calls #flush - allow(subject).to receive(:flush) + expect(flush_called).to be true end end end
Fix test of Datadog::Statsd::Sender#start In the test, even if `flush` isn't called, it still succeeds because `stop` calls `flush`. This commit makes the test work expectedly.
DataDog_dogstatsd-ruby
train
rb
b18b568d78ecb73ae3c687e85ad2992db06a850b
diff --git a/fmn/rules/generic.py b/fmn/rules/generic.py index <HASH>..<HASH> 100644 --- a/fmn/rules/generic.py +++ b/fmn/rules/generic.py @@ -45,21 +45,20 @@ def package_filter(config, message, package=None, *args, **kw): def trac_hosted_filter(config, message, project=None, *args, **kw): """ Filter the messages for a specified fedorahosted project - Adding this rule allows you to get notifications for a specific - `fedorahosted <https://fedorahosted.org>`_ project. + Adding this rule allows you to get notifications for one or more + `fedorahosted <https://fedorahosted.org>`_ project. Specify multiple + projects by separating them with a comma ','. """ project = kw.get('project', project) link = fedmsg.meta.msg2link(message, **config) if not link: return False - if ',' in project: - project = project.split(',') - else: - project = [project] + project = project.split(',') valid = False for proj in project: - valid = '://fedorahosted.org/%s/' % proj in link + if '://fedorahosted.org/%s/' % proj in link: + valid = True return valid
Update the generic filter for Fedora Hosted projects This takes into account the suggestions of @ralphbean
fedora-infra_fmn.rules
train
py
d15b6059ee2e9e624d3ccc281a6cf622b2407f91
diff --git a/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/fetcher/HdfsFetcher.java b/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/fetcher/HdfsFetcher.java index <HASH>..<HASH> 100644 --- a/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/fetcher/HdfsFetcher.java +++ b/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/fetcher/HdfsFetcher.java @@ -291,11 +291,11 @@ public class HdfsFetcher implements FileFetcher { if(read < 0) { break; } else { - output.write(buffer, 0, read); + output.write(buffer, 0, read); } if(fileCheckSumGenerator != null) - fileCheckSumGenerator.update(buffer); + fileCheckSumGenerator.update(buffer, 0, read); if(throttler != null) throttler.maybeThrottle(read); stats.recordBytes(read);
Updating the checksum code to handle computation for a buffer range
voldemort_voldemort
train
java
35ee8de8e84258d14668d9379227faf09096e6b3
diff --git a/lib/sprockets/context.rb b/lib/sprockets/context.rb index <HASH>..<HASH> 100644 --- a/lib/sprockets/context.rb +++ b/lib/sprockets/context.rb @@ -2,7 +2,6 @@ require 'pathname' require 'rack/utils' require 'set' require 'sprockets/errors' -require 'sprockets/utils' module Sprockets # Deprecated: `Context` provides helper methods to all `Template` processors.
Context doesn't use sprocket utils
rails_sprockets
train
rb
3f2d0a45d86793ae99d9c6806a53ca99fafe6430
diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index <HASH>..<HASH> 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -513,7 +513,6 @@ def test_cover_looponfail(testdir, monkeypatch): monkeypatch.setattr(testdir, 'run', lambda *args: TestProcess(*map(str, args))) with testdir.runpytest('-v', '--cov=%s' % script.dirpath(), - '--cov-report=term-missing', '--looponfail', script) as process: wait_for_strings(
improved test for #<I> to check second regression
pytest-dev_pytest-cov
train
py
f8dee054130872f1ecec41c94ae5ffe7aa9c24a9
diff --git a/Handler/RequestPaginationHandler.php b/Handler/RequestPaginationHandler.php index <HASH>..<HASH> 100644 --- a/Handler/RequestPaginationHandler.php +++ b/Handler/RequestPaginationHandler.php @@ -72,13 +72,12 @@ class RequestPaginationHandler implements PaginationHandlerInterface */ public function getUrlForQueryParam($key, $value) { - $uri = $this->request->getUri(); - $params = parse_url($uri); - $query = isset($params['query']) ? $params['query'] : ''; + $path = strtok($this->request->getRequestUri(), '?'); + $query = array_merge($this->request->query->all(), [ + $key => $value + ]); - return sprintf("%s?%s", $params['path'], implode('&', array_merge(explode('&', $query), [ - $key.'='.$value - ]))); + return sprintf("%s?%s", $path, http_build_query($query)); } /**
Improve url generation for pagination component
MindyPHP_Pagination
train
php
3a66083c496061dbf16e773d49ef3f48b7daab9e
diff --git a/lib/sht_rails/engine.rb b/lib/sht_rails/engine.rb index <HASH>..<HASH> 100644 --- a/lib/sht_rails/engine.rb +++ b/lib/sht_rails/engine.rb @@ -4,10 +4,10 @@ module ShtRails app.paths['app/views'] << ShtRails.template_base_path end - initializer "sprockets.smt_rails", :after => "sprockets.environment", :group => :all do |app| + initializer "sprockets.sht_rails", :after => "sprockets.environment", :group => :all do |app| next unless app.assets app.assets.register_engine(".#{ShtRails.template_extension}", Tilt) app.config.assets.paths << ShtRails.template_base_path end end -end \ No newline at end of file +end
fixed typo with smt_rails was killing sprockets settings integration
railsware_sht_rails
train
rb
1447f1a89201d982375cc348bf8a0274d60e4f4c
diff --git a/test/kerberos_tests.js b/test/kerberos_tests.js index <HASH>..<HASH> 100644 --- a/test/kerberos_tests.js +++ b/test/kerberos_tests.js @@ -7,8 +7,9 @@ const SegfaultHandler = require('segfault-handler'); SegfaultHandler.registerHandler(); chai.use(require('chai-string')); +// environment variables const username = process.env.KERBEROS_USERNAME || 'administrator'; -// const password = process.env.KERBEROS_PASSWORD || 'Password01'; +const password = process.env.KERBEROS_PASSWORD || 'Password01'; const realm = process.env.KERBEROS_REALM || 'example.com'; const hostname = process.env.KERBEROS_HOSTNAME || 'hostname.example.com'; const port = process.env.KERBEROS_PORT || '80'; @@ -23,6 +24,15 @@ describe('Kerberos', function() { }); }); + it('should check a given password against a kerberos server', function(done) { + const service = `HTTP/${hostname}`; + kerberos.checkPassword(username, password, service, realm.toUpperCase(), (err, result) => { + expect(err).to.not.exist; + expect(result).to.exist; + done(); + }); + }); + it('should authenticate against a kerberos server using GSSAPI', function(done) { const service = `HTTP@${hostname}`;
test(check-password): include test for the `checkPassword` api
mongodb-js_kerberos
train
js
69e21373cd5bf4da823958f9c1163ff70548ca55
diff --git a/src/Jobs/Repository/Job.php b/src/Jobs/Repository/Job.php index <HASH>..<HASH> 100644 --- a/src/Jobs/Repository/Job.php +++ b/src/Jobs/Repository/Job.php @@ -56,6 +56,15 @@ class Job extends AbstractRepository implements EntityBuilderAwareInterface return $collection; } + public function countByUser($userOrId = null) + { + if ($userOrId instanceOf \Auth\Entity\UserInterface) { + $userOrId = $userOrId->id; + } + + return $this->getMapper('job')->count(array('userId' => $userOrId)); + } + public function getPaginatorAdapter(array $propertyFilter, $sort) { diff --git a/src/Jobs/Repository/Mapper/JobMapper.php b/src/Jobs/Repository/Mapper/JobMapper.php index <HASH>..<HASH> 100644 --- a/src/Jobs/Repository/Mapper/JobMapper.php +++ b/src/Jobs/Repository/Mapper/JobMapper.php @@ -37,7 +37,11 @@ class JobMapper extends CoreMapper return $collection; } - + public function count(array $query = array()) + { + $cursor = $this->getCursor($query); + return $cursor->count(); + } public function save(EntityInterface $entity) {
[Applications] Adds sort columns abilities to applications list.
yawik_jobs
train
php,php
fe71cbcdf09618307b594a28431dc6fa1a6c08d0
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index <HASH>..<HASH> 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -952,6 +952,11 @@ class Chef if name != NOT_PASSED if name @resource_name = name.to_sym + name = name.to_sym + # FIXME: determine a way to deprecate this magic behavior + unless Chef::ResourceResolver.includes_handler?(name, self) + provides name + end else @resource_name = nil end @@ -1338,7 +1343,8 @@ class Chef def self.provides(name, **options, &block) name = name.to_sym - resource_name name if resource_name.nil? + # deliberately do not go through the accessor here + @resource_name = name if resource_name.nil? if @chef_version_for_provides && !options.include?(:chef_version) options[:chef_version] = @chef_version_for_provides
add back magical wiring up from resource_name to provides <I>% of resources on the supermarket only declare resource_name and never call provides, which is consistent with our documentation.
chef_chef
train
rb
e1d06631534a48c32acf11c1b18fbb3f6f923ea8
diff --git a/xchange-cexio/src/main/java/org/knowm/xchange/cexio/CexIOAdapters.java b/xchange-cexio/src/main/java/org/knowm/xchange/cexio/CexIOAdapters.java index <HASH>..<HASH> 100644 --- a/xchange-cexio/src/main/java/org/knowm/xchange/cexio/CexIOAdapters.java +++ b/xchange-cexio/src/main/java/org/knowm/xchange/cexio/CexIOAdapters.java @@ -31,7 +31,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; -import static org.knowm.xchange.utils.DateUtils.*; +import static org.knowm.xchange.utils.DateUtils.fromISODateString; /** * Author: brox Since: 2/6/14 @@ -139,6 +139,9 @@ public class CexIOAdapters { public static List<LimitOrder> createOrders(CurrencyPair currencyPair, OrderType orderType, List<List<BigDecimal>> orders) { List<LimitOrder> limitOrders = new ArrayList<>(); + if(orders == null) + return limitOrders; + for (List<BigDecimal> o : orders) { checkArgument(o.size() == 2, "Expected a pair (price, amount) but got {0} elements.", o.size()); limitOrders.add(createOrder(currencyPair, o, orderType));
[CexIO] another NPE guard
knowm_XChange
train
java
06d2c569e347467dddd2dee2ab3c7cab747e7d15
diff --git a/chess/uci.py b/chess/uci.py index <HASH>..<HASH> 100644 --- a/chess/uci.py +++ b/chess/uci.py @@ -78,8 +78,8 @@ class InfoHandler(object): >>> class MyHandler(chess.uci.InfoHandler): ... def post_info(self): ... # Called whenever a complete *info* line has been processed. - ... super(MyHandler, self).post_info() ... print(self.info) + ... super(MyHandler, self).post_info() # release lock """ def __init__(self): self.lock = threading.Lock()
Fix lock release in InfoHandler docs
niklasf_python-chess
train
py
662a90a830f1a8303e4e32570465491eecf2395b
diff --git a/client.go b/client.go index <HASH>..<HASH> 100644 --- a/client.go +++ b/client.go @@ -521,7 +521,9 @@ func (c *client) closeStop() { case <-c.stop: DEBUG.Println("In disconnect and stop channel is already closed") default: - close(c.stop) + if c.stop != nil { + close(c.stop) + } } }
Fixed "close of nil channel" when calling Stop() on a not connected client
eclipse_paho.mqtt.golang
train
go
9218c263ae421a7942af3990f17469959f78bae1
diff --git a/src/node/basic-node.js b/src/node/basic-node.js index <HASH>..<HASH> 100644 --- a/src/node/basic-node.js +++ b/src/node/basic-node.js @@ -22,6 +22,10 @@ class Node { * @return {Boolean} Whether there is a child node of given type */ contains(type) { + if (!Array.isArray(this.content)) { + return false; + } + return this.content.some(function(node) { return node.type === type; });
fix(node): add guard around node.contains
tonyganch_gonzales-pe
train
js
6739fba02e362d10ecf74f83d6ec47a7b43ea5aa
diff --git a/openfisca_core/periods.py b/openfisca_core/periods.py index <HASH>..<HASH> 100644 --- a/openfisca_core/periods.py +++ b/openfisca_core/periods.py @@ -898,7 +898,7 @@ def period(value): raise_error(value) # reject ambiguous period such as month:2014 - if base_period.unit == YEAR and unit == MONTH: + if unit_weight(base_period.unit) > unit_weight(unit): raise_error(value) return Period((unit, base_period.start, size))
Don't allow ambigious division of periods
openfisca_openfisca-core
train
py
5d75e0c1ba87069b6a48f1b37757f2f4faa08635
diff --git a/src/gql/resolvers/elements/SuperTableBlock.php b/src/gql/resolvers/elements/SuperTableBlock.php index <HASH>..<HASH> 100644 --- a/src/gql/resolvers/elements/SuperTableBlock.php +++ b/src/gql/resolvers/elements/SuperTableBlock.php @@ -11,7 +11,7 @@ class SuperTableBlock extends ElementResolver /** * @inheritdoc */ - public static function prepareQuery(mixed $source, array $arguments, $fieldName = null): ElementQuery + public static function prepareQuery(mixed $source, array $arguments, $fieldName = null): mixed { // If this is the beginning of a resolver chain, start fresh if ($source === null) { diff --git a/src/gql/types/generators/SuperTableBlockType.php b/src/gql/types/generators/SuperTableBlockType.php index <HASH>..<HASH> 100644 --- a/src/gql/types/generators/SuperTableBlockType.php +++ b/src/gql/types/generators/SuperTableBlockType.php @@ -6,7 +6,6 @@ use verbb\supertable\elements\SuperTableBlockElement; use verbb\supertable\fields\SuperTableField; use verbb\supertable\gql\interfaces\elements\SuperTableBlock as SuperTableBlockInterface; use verbb\supertable\gql\types\elements\SuperTableBlock; -use verbb\supertable\models\SuperTableBlockType; use Craft; use craft\gql\base\Generator;
Craft <I> - Fix return type of prepareQuery to be mixed - Useless import of SuperTableBlockType clashes with the class being defined.
verbb_super-table
train
php,php
0c2d5adc00592139fda8901457bc3f81d1977e35
diff --git a/integration/shared/isolated/help_command_test.go b/integration/shared/isolated/help_command_test.go index <HASH>..<HASH> 100644 --- a/integration/shared/isolated/help_command_test.go +++ b/integration/shared/isolated/help_command_test.go @@ -1,5 +1,3 @@ -// +build !partialPush - package isolated import ( @@ -190,11 +188,9 @@ var _ = Describe("help command", func() { session, err := Start(cmd, GinkgoWriter, GinkgoWriter) Expect(err).NotTo(HaveOccurred()) - Eventually(session).Should(Say(` -ENVIRONMENT: - CF_STAGING_TIMEOUT=15 Max wait time for buildpack staging, in minutes - CF_STARTUP_TIMEOUT=5 Max wait time for app instance startup, in minutes -`)) + Eventually(session).Should(Say("ENVIRONMENT:")) + Eventually(session).Should(Say("CF_STAGING_TIMEOUT=15\\s+Max wait time for buildpack staging, in minutes")) + Eventually(session).Should(Say("CF_STARTUP_TIMEOUT=5\\s+Max wait time for app instance startup, in minutes")) Eventually(session).Should(Exit(exitCode)) },
separate environment help text checking into multiple lines This is to allow additional environment variables in the help display for push command.
cloudfoundry_cli
train
go
7f6671628d4788c76784f5b265aabddb7e560690
diff --git a/forms/UploadField.php b/forms/UploadField.php index <HASH>..<HASH> 100644 --- a/forms/UploadField.php +++ b/forms/UploadField.php @@ -281,7 +281,7 @@ class UploadField extends FileField { )); // we do this in a second customise to have the access to the previous customisations return $file->customise(array( - 'UploadFieldFileButtons' => $file->renderWith($this->getTemplateFileButtons()) + 'UploadFieldFileButtons' => (string)$file->renderWith($this->getTemplateFileButtons()) )); }
"UploadFieldFileButtons" casting (regression from casting changes) Caused the UploadField rows to show "[Object object]" because it tried to pass through a PHP object to JS without string casting (the return used to be a string).
silverstripe_silverstripe-framework
train
php
83417ef8093c098a416734007ce088ab39b17248
diff --git a/test/Transaction/CreditCardTransactionUTest.php b/test/Transaction/CreditCardTransactionUTest.php index <HASH>..<HASH> 100644 --- a/test/Transaction/CreditCardTransactionUTest.php +++ b/test/Transaction/CreditCardTransactionUTest.php @@ -510,7 +510,7 @@ class CreditCardTransactionUTest extends \PHPUnit_Framework_TestCase [ Operation::PAY, null, - CreditCardTransaction::TYPE_PURCHASE + CreditCardTransaction::TYPE_CHECK_ENROLLMENT ], ]; } @@ -575,7 +575,7 @@ class CreditCardTransactionUTest extends \PHPUnit_Framework_TestCase $result = $this->tx->mappedProperties(); - $this->assertEquals(CreditCardTransaction::TYPE_PURCHASE, $result['transaction-type']); + $this->assertEquals(CreditCardTransaction::TYPE_CHECK_ENROLLMENT, $result['transaction-type']); } /**
#<I> Update CreditCardTransaction tests
wirecard_paymentSDK-php
train
php
01cd27122900720580ea1e2e1ee96220050292da
diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index <HASH>..<HASH> 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -6973,7 +6973,7 @@ func validateServices(t *Task, tgNetworks Networks) error { } } - // Get the set of port labels. + // Get the set of group port labels. portLabels := make(map[string]struct{}) if len(tgNetworks) > 0 { ports := tgNetworks[0].PortLabels() @@ -6982,6 +6982,18 @@ func validateServices(t *Task, tgNetworks Networks) error { } } + // COMPAT(0.13) + // Append the set of task port labels. (Note that network resources on the + // task resources are deprecated, but we must let them continue working; a + // warning will be emitted on job submission). + if t.Resources != nil { + for _, network := range t.Resources.Networks { + for portLabel := range network.PortLabels() { + portLabels[portLabel] = struct{}{} + } + } + } + // Iterate over a sorted list of keys to make error listings stable keys := make([]string, 0, len(servicePorts)) for p := range servicePorts {
nomad/structs: validate deprecated task.resource.network port labels Enable users to submit jobs that still make use of the deprecated task.resources.network stanza. Such jobs can be submitted, but will emit a warning.
hashicorp_nomad
train
go
745cf96ed14fbc4dab9622eba20467108175f838
diff --git a/actor/base/src/main/java/org/getopentest/Main.java b/actor/base/src/main/java/org/getopentest/Main.java index <HASH>..<HASH> 100644 --- a/actor/base/src/main/java/org/getopentest/Main.java +++ b/actor/base/src/main/java/org/getopentest/Main.java @@ -30,6 +30,7 @@ public class Main { OptionParser parser = new OptionParser(); parser.acceptsAll(Arrays.asList(new String[]{"encrypt"})).withRequiredArg(); + parser.acceptsAll(Arrays.asList(new String[]{"decrypt"})).withRequiredArg(); parser.acceptsAll(Arrays.asList(new String[]{"p", "password"})).withRequiredArg(); parser.acceptsAll(Arrays.asList(new String[]{"w", "workdir"})).withRequiredArg(); @@ -62,5 +63,19 @@ public class Main { System.exit(0); } + + if (options.has("decrypt")) { + if (options.has("password")) { + String encryptedData = options.valueOf("decrypt").toString(); + Encryptor encryptor = new Encryptor(options.valueOf("password").toString()); + System.out.println(encryptor.decrypt(encryptedData)); + } else { + System.out.println( + "To perform the decryption, we'll need a password. You can " + + "provide it using the --password argument."); + } + + System.exit(0); + } } }
feat(actor): add "decrypt" command line option
mcdcorp_opentest
train
java
ea43993bf7755dbfc7c1c81bfbc356f4682e53d6
diff --git a/test/common/util/Cookie.js b/test/common/util/Cookie.js index <HASH>..<HASH> 100644 --- a/test/common/util/Cookie.js +++ b/test/common/util/Cookie.js @@ -5,7 +5,7 @@ var cookie = new Cookie(); module.exports = { - parseCookie: function (test) { + 'Cookie.prototype.parse': function (test) { test.deepEqual(cookie.parse(' a=5; b=6,c=7=8; d="\\"" ;asd;e="'), { a: '5', b: '6', @@ -19,7 +19,7 @@ module.exports = { test.done(); }, - serialCookie: function (test) { + 'Cookie.prototype.serialize': function (test) { test.strictEqual(cookie.serialize('NAME', 'VALUE'), 'NAME=VALUE');
<I>.x: refactor Cookie tests
fistlabs_fist
train
js
0b2e30f0cb16041db1d08571a0dd0b42ba8f49c5
diff --git a/lib/rubocop/cli.rb b/lib/rubocop/cli.rb index <HASH>..<HASH> 100644 --- a/lib/rubocop/cli.rb +++ b/lib/rubocop/cli.rb @@ -179,7 +179,14 @@ module Rubocop rb << files.select { |file| File.extname(file) == '.rb' } rb << files.select do |file| File.extname(file) == '' && - File.open(file) { |f| f.readline } =~ /#!.*ruby/ + begin + File.open(file) { |f| f.readline } =~ /#!.*ruby/ + rescue EOFError, ArgumentError => e + if $options[:debug] + STDERR.puts "Unprocessable file: #{file.inspect}, #{e.class}, #{e.message}" + end + false + end end rb.flatten
Don't fail when unable to parse a file When files don't end in .rb, we check if the file has the ruby hashbang at the top This commit rescues errors caused by empty or unreadable files (EOFError) or unparseable files (ArgumentError) such as invalid UTF-8 character string Rubcop may now continue checking for ruby files
rubocop-hq_rubocop
train
rb
df8e1e400d9371392185e2b13e20979b8cd6233c
diff --git a/setup/run_once.py b/setup/run_once.py index <HASH>..<HASH> 100644 --- a/setup/run_once.py +++ b/setup/run_once.py @@ -36,8 +36,7 @@ def controller_create(): return r.db_create("Controller").run() def controller_plugins_create(): - return r.db("Controller").table_create("Plugins", - primary_key="Name").run() + return r.db("Controller").table_create("Plugins").run() def controller_ports_create(): return r.db("Controller").table_create("Ports").run()
deprecate controller code in query package
ramrod-project_database-brain
train
py
0c6b7949fe8d192702a445d401766447b720ada0
diff --git a/pandas/core/frame.py b/pandas/core/frame.py index <HASH>..<HASH> 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -703,10 +703,13 @@ class DataFrame(NDFrame): self.to_string(buf=buf) else: width, _ = fmt.get_console_size() - max_rows = get_option("display.max_rows") - if (get_option("display.expand_frame_repr") - and fits_vertical): - # and len(self.columns) < max_rows) + max_columns = get_option("display.max_columns") + expand_repr = get_option("display.expand_frame_repr") + # within max_cols and max_rows, but cols exceed width + # of terminal, then use expand_repr + if (fits_vertical and + expand_repr and + len(self.columns) <= max_columns): self.to_string(buf=buf, line_width=width) else: max_info_rows = get_option('display.max_info_rows')
BUG: restore <I> expand_repr behaviour, only for < max_cols, if wider then term GH<I>
pandas-dev_pandas
train
py
b5a6a77e0d04b99e31387e76d6d6b50d63f607f4
diff --git a/salesforce/models.py b/salesforce/models.py index <HASH>..<HASH> 100644 --- a/salesforce/models.py +++ b/salesforce/models.py @@ -13,6 +13,7 @@ column names are all in CamelCase. No attempt is made to work around this issue, but normal use of `db_column` and `db_table` parameters should work. """ +from __future__ import unicode_literals import logging from django.conf import settings @@ -76,7 +77,7 @@ def with_metaclass(meta, *bases): if this_bases is None: return type.__new__(cls, name, (), d) return meta(name, bases, d) - return metaclass('temporary_class', None, {}) + return metaclass(str('temporary_class'), None, {}) class SalesforceModel(with_metaclass(SalesforceModelBase, models.Model)): diff --git a/salesforce/testrunner/example/models.py b/salesforce/testrunner/example/models.py index <HASH>..<HASH> 100644 --- a/salesforce/testrunner/example/models.py +++ b/salesforce/testrunner/example/models.py @@ -5,6 +5,7 @@ # See LICENSE.md for details # +from __future__ import unicode_literals from salesforce import models from salesforce.models import SalesforceModel as SalesforceModelParent
Migrations: Minimal support for intercompatibility between Python 2 and 3. Otherwise it is impossible to apply a migration under Python 3 that has been created under Python <I> with Django <I>.
django-salesforce_django-salesforce
train
py,py
0efc12b6a1790a4d4f732ac2d208ceb5c22450f3
diff --git a/admin_trees_config.php b/admin_trees_config.php index <HASH>..<HASH> 100644 --- a/admin_trees_config.php +++ b/admin_trees_config.php @@ -728,19 +728,17 @@ echo WT_JS_START;?> if ($row->xref) { $record=WT_GedcomRecord::getInstance($row->xref); if ($record) { - $name=$record->getFullName(); + echo '<a href="', $record->getHtmlUrl(), '">', $record->getFullName(), '</a>'; } else { - $name=WT_I18N::translate('this record does not exist'); + echo WT_I18N::translate('this record does not exist'); } - // I18N: e.g. John DOE (I1234) - echo WT_I18N::translate('%1$s (%2$s)', $name, $row->xref); } else { echo '&nbsp;'; } echo '</td><td width="*">'; if ($row->tag_type) { // I18N: e.g. Marriage (MARR) - echo WT_I18N::translate('%1$s [%2$s]', WT_Gedcom_Tag::getLabel($row->tag_type), $row->tag_type); + echo WT_Gedcom_Tag::getLabel($row->tag_type); } else { echo '&nbsp;'; }
#<I> - Sorting of the Gedcom Privacy Restrriction List
fisharebest_webtrees
train
php
63985ac3e83fac35a1f5e4ac74462e1665512ff7
diff --git a/lib/mini_magick/image.rb b/lib/mini_magick/image.rb index <HASH>..<HASH> 100644 --- a/lib/mini_magick/image.rb +++ b/lib/mini_magick/image.rb @@ -448,6 +448,10 @@ module MiniMagick end end + def destroy! + @tempfile.unlink if @tempfile + end + private # Sometimes we get back a list of character values
Bring back MiniMagick::Image#destroy! CarrierWave uses that method, and maybe some others, so we still need to keep backwards compatibility.
minimagick_minimagick
train
rb
628d1345cb5b09d90b087ae23d5caf26b25a2e7d
diff --git a/irc3/__init__.py b/irc3/__init__.py index <HASH>..<HASH> 100644 --- a/irc3/__init__.py +++ b/irc3/__init__.py @@ -153,7 +153,7 @@ class IrcBot(base.IrcObject): def send_line(self, data): """send a line to the server. replace CR by spaces""" - self.send(data.replace('\n', ' ')) + self.send(data.replace('\n', ' ').replace('\r', ' ')) def send(self, data): """send data to the server"""
CRs are also valid line separators per RFC <I>
gawel_irc3
train
py
3bf63de781189cb34d761db65d6098e6045e33b3
diff --git a/blade-core/src/main/java/com/hellokaton/blade/mvc/ui/ModelAndView.java b/blade-core/src/main/java/com/hellokaton/blade/mvc/ui/ModelAndView.java index <HASH>..<HASH> 100644 --- a/blade-core/src/main/java/com/hellokaton/blade/mvc/ui/ModelAndView.java +++ b/blade-core/src/main/java/com/hellokaton/blade/mvc/ui/ModelAndView.java @@ -27,9 +27,9 @@ import java.util.Map; public class ModelAndView { /** - * Data object, the object is placed in the attribute httprequest + * Data object, the object is placed in the attribute request */ - private Map<String, Object> model = new HashMap<>(8); + private Map<String, Object> model = new HashMap<>(4); /** * View Page
:zap: model initiation cap=2
lets-blade_blade
train
java
17fba07500aae1ffc237a913a6039f54a01275cb
diff --git a/mintapi/api.py b/mintapi/api.py index <HASH>..<HASH> 100644 --- a/mintapi/api.py +++ b/mintapi/api.py @@ -1023,7 +1023,11 @@ class Mint(object): for budget in budgets[direction]: category = self.get_category_object_from_id(budget['cat'], categories) budget['cat'] = category['name'] - budget['parent'] = category['parent']['name'] + # Uncategorized budget's parent is a string: 'Uncategorized' + if isinstance(category['parent'], dict): + budget['parent'] = category['parent']['name'] + else: + budget['parent'] = category['parent'] return budgets
fix: :bug: Fix for 'string indices must be integers' The 'Uncategorized' budget's parent is a string not a dict. Probably only affects those who put a specific limit on uncategorized. Refs #<I>
mrooney_mintapi
train
py
a87ad9e405ad16422fe066026c24df818882b3c4
diff --git a/src/Fields/Base/Element.php b/src/Fields/Base/Element.php index <HASH>..<HASH> 100644 --- a/src/Fields/Base/Element.php +++ b/src/Fields/Base/Element.php @@ -398,15 +398,15 @@ abstract class Element implements FormElement */ protected function getValue() { - if ($value = $this->forceValue) { - return $value; + if (isset($this->forceValue)) { + return $this->forceValue; } if ($this->open->isSubmitted() && ($value = $this->dataStore->getOldValue($this->name))) { return $value; } - return $this->value ?: $this->dataStore->getModelValue($this->name); + return isset($this->value) ? $this->value : $this->dataStore->getModelValue($this->name); } /**
Use isset() insted of !empty()
laraplus_form
train
php