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
bee0807e2da436f0d47fd048f8f6d2f6194751a9
diff --git a/packages/ember-metal/lib/events.js b/packages/ember-metal/lib/events.js index <HASH>..<HASH> 100644 --- a/packages/ember-metal/lib/events.js +++ b/packages/ember-metal/lib/events.js @@ -267,10 +267,6 @@ function suspendListeners(obj, eventNames, target, method, callback) { } } -// TODO: This knowledge should really be a part of the -// meta system. -var SKIP_PROPERTIES = { __ember_source__: true }; - /** @private @@ -285,9 +281,7 @@ function watchedEvents(obj) { if (listeners) { for(var eventName in listeners) { - if (!SKIP_PROPERTIES[eventName] && listeners[eventName]) { - ret.push(eventName); - } + if (listeners[eventName]) { ret.push(eventName); } } } return ret;
Remove SKIP_PROPERTIES, not necessary anymore since we're using hasOwnProperty
emberjs_ember.js
train
js
b9963a5df71c17015594ce6979f9ba0983223786
diff --git a/admin/controllers/accounts.php b/admin/controllers/accounts.php index <HASH>..<HASH> 100644 --- a/admin/controllers/accounts.php +++ b/admin/controllers/accounts.php @@ -679,7 +679,8 @@ class NAILS_Accounts extends NAILS_Admin_Controller $_data['last_name'] = $this->input->post( 'last_name' ); $_data['username'] = $this->input->post( 'username' ); $_data['gender'] = $this->input->post( 'gender' ); - $_data['dob'] = ! empty( $this->input->post( 'dob' ) ) ? $this->input->post( 'dob' ) : NULL; + $_data['dob'] = $this->input->post( 'dob' ); + $_data['dob'] = ! empty( $_data['dob'] ) ? $_data['dob'] : NULL; $_data['timezone'] = $this->input->post( 'timezone' ); $_data['datetime_format_date'] = $this->input->post( 'datetime_format_date' ); $_data['datetime_format_time'] = $this->input->post( 'datetime_format_time' );
changing logic, for backwards compatability
nails_module-admin
train
php
23264f749d1b7da36173667c1c7ae4cc703af292
diff --git a/request.go b/request.go index <HASH>..<HASH> 100644 --- a/request.go +++ b/request.go @@ -3,6 +3,7 @@ package kite import ( "errors" "fmt" + "runtime/debug" "strings" "github.com/dgrijalva/jwt-go" @@ -38,6 +39,7 @@ func (c *Client) runMethod(method *Method, args *dnode.Partial) { // functions like MustString(), MustSlice()... without the fear of panic. defer func() { if r := recover(); r != nil { + debug.PrintStack() callFunc(nil, createError(r)) } }()
kite/request: print debug stack if we have recovered from something
koding_kite
train
go
fc7cfa4084883ffe3fffc81f27e2167140cf2baf
diff --git a/tasks/uncss-inline.js b/tasks/uncss-inline.js index <HASH>..<HASH> 100644 --- a/tasks/uncss-inline.js +++ b/tasks/uncss-inline.js @@ -66,9 +66,8 @@ module.exports = function ( grunt ) { throw error; } - // remove all `<style>` tags except the last one - var styleTags = $('style'); - styleTags.slice(0, styleTags.length - 1).remove(); + // remove all `<style>` tags except the first one + $('style').slice(1).remove(); $('style').text(output); var html = $.html(); grunt.file.write( file.dest, html );
feat: preserve the first for final process
sparanoid_grunt-uncss-inline
train
js
504b04533245a519ed52bd6e541a4ab06144da61
diff --git a/wallet/notifications.go b/wallet/notifications.go index <HASH>..<HASH> 100644 --- a/wallet/notifications.go +++ b/wallet/notifications.go @@ -119,8 +119,8 @@ func makeTxSummary(w *Wallet, details *wtxmgr.TxDetails) TransactionSummary { } } outputs := make([]TransactionSummaryOutput, 0, len(details.MsgTx.TxOut)) - var credIndex int for i := range details.MsgTx.TxOut { + credIndex := len(outputs) mine := len(details.Credits) > credIndex && details.Credits[credIndex].Index == uint32(i) if !mine { continue
Fix credit slice indexing for transaction notifications. Previously, this would always check a transaction output index against the 0th credit's index.
btcsuite_btcwallet
train
go
de52735921d7f58f16806c270022717ea83b760d
diff --git a/src/jquery.jcarousel.js b/src/jquery.jcarousel.js index <HASH>..<HASH> 100644 --- a/src/jquery.jcarousel.js +++ b/src/jquery.jcarousel.js @@ -573,11 +573,16 @@ }); $.fn.jcarousel = function(o) { - var args = Array.prototype.slice.call(arguments, 1); - return this.each(function() { + var args = Array.prototype.slice.call(arguments, 1), returnResult = false, result; + this.each(function() { var j = $(this).data('jcarousel'); if (typeof o === 'string') { - j[o].apply(j, args); + var r = j[o].apply(j, args); + if (r !== j) { + returnResult = true; + result = r; + return false; + } } else { if (j) { $.extend(j.options, o || {}); @@ -586,6 +591,8 @@ } } }); + + return returnResult ? result : this; }; })(jQuery, window);
Return correct if a getter is called
jsor_jcarousel
train
js
e2a0a94c6efcce7a0b6223d33bc3ba4eee692827
diff --git a/railties/test/generators/plugin_new_generator_test.rb b/railties/test/generators/plugin_new_generator_test.rb index <HASH>..<HASH> 100644 --- a/railties/test/generators/plugin_new_generator_test.rb +++ b/railties/test/generators/plugin_new_generator_test.rb @@ -176,6 +176,11 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase assert_file "bukkits.gemspec", /s.version = "0.0.1"/ end + def test_shebang + run_generator + assert_file "script/rails", /#!\/usr\/bin\/env ruby/ + end + def test_passing_dummy_path_as_a_parameter run_generator [destination_root, "--dummy_path", "spec/dummy"] assert_file "spec/dummy"
Add test for shebang in engine's script/rails file
rails_rails
train
rb
825d2f466ecba12c77ccb57f0231eb9873dde9ae
diff --git a/opal/browser/dom/element.rb b/opal/browser/dom/element.rb index <HASH>..<HASH> 100644 --- a/opal/browser/dom/element.rb +++ b/opal/browser/dom/element.rb @@ -14,11 +14,12 @@ class Element < Node def self.new(node) if self == Element - case `node.nodeName`.downcase - when :input - Input.new(node) + name = `node.nodeName`.capitalize - else super + if Element.const_defined?(name) + Element.const_get(name).new(node) + else + super end else super diff --git a/opal/browser/dom/element/image.rb b/opal/browser/dom/element/image.rb index <HASH>..<HASH> 100644 --- a/opal/browser/dom/element/image.rb +++ b/opal/browser/dom/element/image.rb @@ -18,4 +18,6 @@ class Image < Element end end +Img = Image + end; end; end
dom/element: fix specialization creation
opal_opal-browser
train
rb,rb
c5fdd47a56eb276c6a99372a74e16e1c4cae33e8
diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index <HASH>..<HASH> 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -308,7 +308,7 @@ module Vagrant logger.debug("Querying installed WSL from Windows registry.") - PowerShell.execute_cmd('(Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | ForEach-Object {Get-ItemProperty $_.PSPath}).BasePath').split(" ").each do |path| + PowerShell.execute_cmd('(Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | ForEach-Object {Get-ItemProperty $_.PSPath}).BasePath').split("\r\n").each do |path| # Lowercase the drive letter, skip the next symbol (which is a # colon from a Windows path) and convert path to UNIX style. path = "/mnt/#{path[0, 1].downcase}#{path[2..-1].tr('\\', '/')}/rootfs"
#<I>: Respect usernames with spaces
hashicorp_vagrant
train
rb
5d61edbd09c41c5d8d06662d69e287662a39202c
diff --git a/containers/pax-exam-container-tomee/src/test/java/org/ops4j/pax/exam/tomee/TomEEDeploymentTest.java b/containers/pax-exam-container-tomee/src/test/java/org/ops4j/pax/exam/tomee/TomEEDeploymentTest.java index <HASH>..<HASH> 100644 --- a/containers/pax-exam-container-tomee/src/test/java/org/ops4j/pax/exam/tomee/TomEEDeploymentTest.java +++ b/containers/pax-exam-container-tomee/src/test/java/org/ops4j/pax/exam/tomee/TomEEDeploymentTest.java @@ -32,7 +32,7 @@ public class TomEEDeploymentTest { public void deployWebapp() throws IOException { System.setProperty("java.protocol.handler.pkgs", "org.ops4j.pax.url"); ExamSystem system = DefaultExamSystem.create(options(war( - "mvn:org.ops4j.pax.exam.samples/pax-exam-sample1-web/3.0.0-SNAPSHOT/war").name( + "mvn:org.ops4j.pax.exam.samples/pax-exam-sample1-web/3.0.0/war").name( "sample1"))); TomEETestContainer container = new TomEETestContainer(system); container.start();
do not use SNAPSHOT version in deployment test
ops4j_org.ops4j.pax.exam2
train
java
15859df05730bbe72572bdaee59172e5ddb9807d
diff --git a/src/apex/plugins/id/__init__.py b/src/apex/plugins/id/__init__.py index <HASH>..<HASH> 100644 --- a/src/apex/plugins/id/__init__.py +++ b/src/apex/plugins/id/__init__.py @@ -53,7 +53,7 @@ class IdPlugin(object): port = self.port_map[port_name] id_frame = {'source': port['identifier'], 'destination': 'ID', 'path': port['id_path'].split(','), - 'text': list(port['id_text'].encode('ascii'))} + 'text': port['id_text']} frame_hash = apex.aprs.util.hash_frame(id_frame) if frame_hash not in self.packet_cache.values(): self.packet_cache[str(frame_hash)] = frame_hash
Fixed a bug in the id plugin where the text field was int he wrong format.
Syncleus_apex-aprs
train
py
bdfd95bda45e24e9b6eb714fa5a62c3fef703c6e
diff --git a/tests/binary/PharTest.php b/tests/binary/PharTest.php index <HASH>..<HASH> 100644 --- a/tests/binary/PharTest.php +++ b/tests/binary/PharTest.php @@ -7,8 +7,7 @@ namespace Test\Binary; class PharTest extends \PHPUnit_Framework_TestCase { - //private $phar = __DIR__ . '/../binary/../../build/phpmetrics.phar'; - private $phar = __DIR__ . '/../../bin/phpmetrics'; + private $phar = __DIR__ . '/../../build/phpmetrics.phar'; public function testICanRunPhar() {
fixed error in test of phar
phpmetrics_PhpMetrics
train
php
5534f9a449840872a6be95c0005f913105b66a1f
diff --git a/Rakefile b/Rakefile index <HASH>..<HASH> 100755 --- a/Rakefile +++ b/Rakefile @@ -1,13 +1,14 @@ -#!/usr/bin/env ruby +#!/usr/bin/env ruby -KU + require 'pathname' require 'rubygems' require 'rake' require 'rake/rdoctask' -require 'lib/dm-core/version' - ROOT = Pathname(__FILE__).dirname.expand_path +require ROOT + 'lib/dm-core/version' + AUTHOR = 'Dan Kubb' EMAIL = 'dan.kubb@gmail.com' GEM_NAME = 'dm-core' diff --git a/script/performance.rb b/script/performance.rb index <HASH>..<HASH> 100755 --- a/script/performance.rb +++ b/script/performance.rb @@ -1,4 +1,4 @@ -#!/usr/bin/env ruby +#!/usr/bin/env ruby -KU require 'ftools' require 'rubygems' diff --git a/script/profile.rb b/script/profile.rb index <HASH>..<HASH> 100755 --- a/script/profile.rb +++ b/script/profile.rb @@ -1,4 +1,4 @@ -#!/usr/bin/env ruby +#!/usr/bin/env ruby -KU require 'ftools' require 'rubygems'
Minor code update to Rakefile require and ruby command line in scripts
datamapper_dm-core
train
Rakefile,rb,rb
0ab022d28ad3136de4f833345dcfe3cd5dff3066
diff --git a/test/index_test.rb b/test/index_test.rb index <HASH>..<HASH> 100644 --- a/test/index_test.rb +++ b/test/index_test.rb @@ -93,6 +93,7 @@ class IndexTest < Minitest::Test assert_search "product", ["Product A"], {}, Region assert_search "hello", ["Product A"], {fields: [:name, :text]}, Region assert_search "hello", ["Product A"], {}, Region + assert_search "*", ["Product A"], {where: {text: large_value}}, Region end def test_very_large_value @@ -102,6 +103,8 @@ class IndexTest < Minitest::Test assert_search "product", ["Product A"], {}, Region assert_search "hello", ["Product A"], {fields: [:name, :text]}, Region assert_search "hello", ["Product A"], {}, Region + # keyword not indexed + assert_search "*", [], {where: {text: large_value}}, Region end def test_bulk_import_raises_error
Improved tests [skip ci]
ankane_searchkick
train
rb
bb37a4aa18f133092d596c6870a858324fc6691f
diff --git a/scipy_data_fitting/fit.py b/scipy_data_fitting/fit.py index <HASH>..<HASH> 100644 --- a/scipy_data_fitting/fit.py +++ b/scipy_data_fitting/fit.py @@ -263,7 +263,7 @@ class Fit: from `scipy_data_fitting.Model.expressions`. The expressions must not contain the symbols corresponding to - `scipy_data_fitting.Fit.free_variables`, scipy_data_fitting.Fit.independent`, + `scipy_data_fitting.Fit.free_variables`, `scipy_data_fitting.Fit.independent`, or `scipy_data_fitting.Fit.dependent`. The other keys are the same as the optional ones explained
Missing a backtick in docstring.
razor-x_scipy-data_fitting
train
py
42f85904221aeaf0181f75af2fa5d469b8cbcee7
diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java index <HASH>..<HASH> 100644 --- a/src/java/org/apache/cassandra/gms/Gossiper.java +++ b/src/java/org/apache/cassandra/gms/Gossiper.java @@ -987,7 +987,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean if (logger.isTraceEnabled()) logger.trace(ep + "local generation " + localGeneration + ", remote generation " + remoteGeneration); - if (remoteGeneration > localGeneration + MAX_GENERATION_DIFFERENCE) + if (localGeneration != 0 && remoteGeneration > localGeneration + MAX_GENERATION_DIFFERENCE) { // assume some peer has corrupted memory and is broadcasting an unbelievable generation about another peer (or itself) logger.warn("received an invalid gossip generation for peer {}; local generation = {}, received generation = {}", ep, localGeneration, remoteGeneration);
Don't do generation safety check when the local gen is zero Patch by brandonwilliams, reviewed by jasobrown for CASSANDRA-<I>
Stratio_stratio-cassandra
train
java
9b55683f6a6cdc3cbfff8f887dbc6ff8d67dc095
diff --git a/salt/client/ssh/__init__.py b/salt/client/ssh/__init__.py index <HASH>..<HASH> 100644 --- a/salt/client/ssh/__init__.py +++ b/salt/client/ssh/__init__.py @@ -1219,6 +1219,8 @@ def _convert_args(args): for arg in args: if isinstance(arg, dict): for key in list(arg.keys()): + if key == '__kwarg__': + continue converted.append('{0}={1}'.format(key, arg[key])) else: converted.append(arg)
Remove __kwarg__ from salt-ssh keyword args Currently this keyword arg is actually being removed as a side effect of salt.utils.args.parse_input. If that ever changed then this code would break. Prevent that future breakage. (I considered removing that side effect but wasn't sure what else it would break so I held off for now)
saltstack_salt
train
py
e7442b802d38012e627b781f940ae1cac9b9c2b0
diff --git a/src/main/java/org/jfrog/hudson/pipeline/types/Docker.java b/src/main/java/org/jfrog/hudson/pipeline/types/Docker.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/jfrog/hudson/pipeline/types/Docker.java +++ b/src/main/java/org/jfrog/hudson/pipeline/types/Docker.java @@ -13,7 +13,7 @@ import java.util.Map; * Created by romang on 7/28/16. */ public class Docker implements Serializable { - private CpsScript script; + private transient CpsScript script; private String username; private String password; private String credentialsId;
HAP-<I> - Serializable exception after upgrade when doing server.upload
jenkinsci_artifactory-plugin
train
java
018e0f440536f6f16e2893b7c9a5825290a1ffbd
diff --git a/mot/runtime_configuration.py b/mot/runtime_configuration.py index <HASH>..<HASH> 100644 --- a/mot/runtime_configuration.py +++ b/mot/runtime_configuration.py @@ -1,6 +1,6 @@ from contextlib import contextmanager from .cl_environments import CLEnvironmentFactory -from .load_balance_strategies import EvenDistribution +from .load_balance_strategies import PreferGPU __author__ = 'Robbert Harms' __date__ = "2015-07-22" @@ -25,10 +25,11 @@ known from the context defaults can be obtained from this module. ignore_kernel_warnings = True runtime_config = { - 'cl_environments': CLEnvironmentFactory.all_devices(cl_device_type='GPU'), - 'load_balancer': EvenDistribution(), + 'cl_environments': CLEnvironmentFactory.all_devices(), + 'load_balancer': PreferGPU(), } + @contextmanager def runtime_config_context(cl_environments=None, load_balancer=None): old_config = {k: v for k, v in runtime_config.items()}
Reverted the default runtime configuration settings to all devices with GPUPreferred load balancer.
cbclab_MOT
train
py
ac61b2f99f91a274572e96be8f0136871288f1bb
diff --git a/proso/util.py b/proso/util.py index <HASH>..<HASH> 100644 --- a/proso/util.py +++ b/proso/util.py @@ -6,11 +6,12 @@ _timers = {} def timer(name): - now = time.clock() + now = time.time() + diff = None if name in _timers: diff = now - _timers[name] - return diff _timers[name] = now + return diff def instantiate(classname, *args, **kwargs):
update timer to be able to measure time more times
adaptive-learning_proso-apps
train
py
bed41f3f0ffb324d092bd51ffa728bacb6c1c365
diff --git a/resources/lang/nl-NL/cachet.php b/resources/lang/nl-NL/cachet.php index <HASH>..<HASH> 100644 --- a/resources/lang/nl-NL/cachet.php +++ b/resources/lang/nl-NL/cachet.php @@ -92,6 +92,7 @@ return [ 'email' => [ 'subscribe' => 'Abonneren op e-mail updates.', 'subscribed' => 'U bent geabonneerd op e-mail notificaties, controleer uw e-mail om uw abonnement te bevestigen.', + 'updated-subscribe' => 'You\'ve succesfully updated your subscriptions.', 'verified' => 'Uw e-mail abonnement is bevestigd. Bedankt!', 'manage' => 'Beheer je abonnement', 'unsubscribe' => 'Afmelden voor e-mail updates.',
New translations cachet.php (Dutch)
CachetHQ_Cachet
train
php
9a6d5cd5158ba31864aa40e775aaf9b23dabb8ff
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -697,6 +697,9 @@ function readToMatch(stream, regexp, options) { } module.exports = { + AbortError: AbortError, + EOFError: EOFError, + TimeoutError: TimeoutError, read: read, readUntil: readUntil, readTo: readTo,
Expose Error classes In case callers want to do instanceof checks or construct their own error instances.
kevinoid_promised-read
train
js
7c269103f33aefcef089ff818ea6d2643d977abf
diff --git a/test/integration/sanity/proxy-http.test.js b/test/integration/sanity/proxy-http.test.js index <HASH>..<HASH> 100644 --- a/test/integration/sanity/proxy-http.test.js +++ b/test/integration/sanity/proxy-http.test.js @@ -6,15 +6,8 @@ describe('sanity test', function () { testrun; before(function (done) { - var port = 9090, // @todo: configure port dynamically via random number generation - fakeProxyManager = { - getProxyConfiguration: function (url, callback) { - callback(null, { - proxy: 'http://localhost:' + port, - tunnel: false - }); - } - }; + var port = 9090, + proxyList = [{match: '*://*.getpostman.com/*', server: 'http://localhost:' + port, tunnel: false}]; server = new proxy.createProxyServer({ target: 'http://echo.getpostman.com', @@ -22,7 +15,7 @@ describe('sanity test', function () { 'x-postman-proxy': 'true' } }); - + console.log(proxyList); server.listen(port); this.run({ @@ -32,7 +25,7 @@ describe('sanity test', function () { } }, requester: { - proxyManager: fakeProxyManager + proxyList: proxyList } }, function (err, results) { testrun = results;
Fixed the tests for proxyList over the proxyManager
postmanlabs_postman-runtime
train
js
0a2f1350f98a4a208578e24a2ff2362a1de607fc
diff --git a/gocd_cli/commands/pipeline/__init__.py b/gocd_cli/commands/pipeline/__init__.py index <HASH>..<HASH> 100644 --- a/gocd_cli/commands/pipeline/__init__.py +++ b/gocd_cli/commands/pipeline/__init__.py @@ -2,7 +2,7 @@ from gocd_cli.command import BaseCommand from .retrigger_failed import RetriggerFailed -__all__ = ['Pause', 'RetriggerFailed', 'Trigger', 'Unlock'] +__all__ = ['Pause', 'RetriggerFailed', 'Trigger', 'Unlock', 'Unpause'] def unlock_pipeline(pipeline):
Add Unpause to the list of available pipeline commands
gaqzi_gocd-cli
train
py
2cc040c9f4d71a33d33b20ec0fd82c2a3355133b
diff --git a/psiturk/example/static/js/task.js b/psiturk/example/static/js/task.js index <HASH>..<HASH> 100644 --- a/psiturk/example/static/js/task.js +++ b/psiturk/example/static/js/task.js @@ -244,7 +244,7 @@ var Questionnaire = function() { var completeHIT = function() { // save data one last time here? - window.location= adServerLoc + "/complete?uniqueId=" + psiTurk.taskdata.id; + window.location= adServerLoc + "?uniqueId=" + psiTurk.taskdata.id; } diff --git a/psiturk/experiment.py b/psiturk/experiment.py index <HASH>..<HASH> 100644 --- a/psiturk/experiment.py +++ b/psiturk/experiment.py @@ -350,7 +350,7 @@ def start_exp(): # if everything goes ok here relatively safe to assume we can lookup the ad ad_id = get_ad_via_hitid(hitId) if ad_id != "error": - ad_server_location = 'https://ad.psiturk.org/view/' + str(ad_id) + ad_server_location = 'https://ad.psiturk.org/complete/' + str(ad_id) else: raise ExperimentError('hit_not_registered_with_ad_server')
dealing with complete hit. WARNING... your task.js may need to be update to point to the correct URL to complete the hit (see new example) var completeHIT = function() { // save data one last time here? window.location= adServerLoc + "?uniqueId=" + psiTurk.taskdata.id; }
NYUCCL_psiTurk
train
js,py
88a0cf528454c1c54f450a5b658c1a8b26679c60
diff --git a/lxc/launch.go b/lxc/launch.go index <HASH>..<HASH> 100644 --- a/lxc/launch.go +++ b/lxc/launch.go @@ -21,7 +21,7 @@ func (c *launchCmd) usage() string { return gettext.Gettext( `Launch a container from a particular image. -lxc launch [remote:]<image> [remote:][<name>] [--ephemeral|-e] [--profile|-p <profile>...] +lxc launch [remote:]<image> [remote:][<name>] [--ephemeral|-e] [--profile|-p <profile>...] [--config|-c <key=value>...] Launches a container using the specified image and name.
launch: show --config in help text
lxc_lxd
train
go
4b6c6c816927cb7ef2d5a8a4d395c41abf3db7fe
diff --git a/stats/aggregated_stats.go b/stats/aggregated_stats.go index <HASH>..<HASH> 100644 --- a/stats/aggregated_stats.go +++ b/stats/aggregated_stats.go @@ -18,8 +18,11 @@ type AggregatedStat struct { } func convertToAggregatedStats(id string, containerIds map[string]string, resourceType string, stats []info.ContainerInfo, memLimit uint64) []AggregatedStats { - maxDataPoints := len(stats[0].Stats) totalAggregatedStats := []AggregatedStats{} + if len(stats) == 0 { + return totalAggregatedStats + } + maxDataPoints := len(stats[0].Stats) for i := 0; i < maxDataPoints; i++ { aggregatedStats := []AggregatedStat{}
Avoid panic in aggregating stats
rancher_host-api
train
go
bcc894c2d9aed23a52750918bd3e5e2f4650898e
diff --git a/app/modules/App/Run.php b/app/modules/App/Run.php index <HASH>..<HASH> 100644 --- a/app/modules/App/Run.php +++ b/app/modules/App/Run.php @@ -13,11 +13,11 @@ use \Devvoh\Parable\App as App; class Run { public function preDispatch() { - echo 'preDispatch RUN'; + // Do whatever preDispatch stuff you want to do here. This is BEFORE the controller/closure is called. } public function postDispatch() { - echo 'postDispatch RUN'; + // Do whatever postDispatch stuff you want to do here. This is AFTER the view template is included. } } \ No newline at end of file
Removed debug echoes and placed comments instead.
devvoh_parable
train
php
8605ca5429f21e6bfdbdff33d6262d9e4bf7520d
diff --git a/spec/validator.spec.js b/spec/validator.spec.js index <HASH>..<HASH> 100644 --- a/spec/validator.spec.js +++ b/spec/validator.spec.js @@ -17,7 +17,7 @@ describe('Validator()', function() { }); it('should have a rules property containing all the validation rules', function() { - expect(validator.rules).toBeTruthy(); + expect(validator.rules4).toBeTruthy(); }); it('should have an input property containing the input data to be validated', function() {
travis setup -test failed test with jasmine-node
skaterdav85_validatorjs
train
js
4282cafe0c3c546036405ec4c33b7748bd7d7d1e
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -13,12 +13,13 @@ install_requires = [ test_requires = [ 'nose2', 'pandas', - 'pathlib', - 'anndata', 'coverage', 'coveralls' ] +if sys.version_info[0] == 3: + test_requires += ['anndata'] + doc_requires = [ 'sphinx', 'sphinxcontrib-napoleon',
don't install anndata on python2
KrishnaswamyLab_graphtools
train
py
28f29a5f276c2ed0d48c938b022a6242fcb01a2c
diff --git a/src/draw/handler/Draw.Polyline.js b/src/draw/handler/Draw.Polyline.js index <HASH>..<HASH> 100644 --- a/src/draw/handler/Draw.Polyline.js +++ b/src/draw/handler/Draw.Polyline.js @@ -107,13 +107,10 @@ L.Draw.Polyline = L.Draw.Feature.extend({ }, _finishShape: function () { - if (!this.options.allowIntersection && this._poly.newLatLngIntersects(this._poly.getLatLngs()[0], true)) { - this._showErrorTooltip(); - return; - } + var intersects = this._poly.newLatLngIntersects(this._poly.getLatLngs()[0], true); - if (!this._shapeIsValid()) { - this._showErrorLabel(); + if ((!this.options.allowIntersection && intersects) || !this._shapeIsValid()) { + this._showErrorTooltip(); return; }
Refactor check for intserection and valid shape.
Leaflet_Leaflet.draw
train
js
432c5d7f2ba9e5b6dcb44c50aa243dfd10b1b543
diff --git a/modules/social_features/social_group/src/Controller/SocialGroupController.php b/modules/social_features/social_group/src/Controller/SocialGroupController.php index <HASH>..<HASH> 100644 --- a/modules/social_features/social_group/src/Controller/SocialGroupController.php +++ b/modules/social_features/social_group/src/Controller/SocialGroupController.php @@ -133,7 +133,7 @@ class SocialGroupController extends ControllerBase { if ($group instanceof GroupInterface) { return $this->t('Add members to group: @group_name', ['@group_name' => $group->label()]); } - + return $this->t('Add members'); }
When adding members directly, remove the hero and make sure the page title reflects to what group you are adding a member to
goalgorilla_open_social
train
php
a1609cfb109f53517de32d2e851044b1ac1da61c
diff --git a/dvc/repo/experiments/base.py b/dvc/repo/experiments/base.py index <HASH>..<HASH> 100644 --- a/dvc/repo/experiments/base.py +++ b/dvc/repo/experiments/base.py @@ -135,7 +135,7 @@ class ExpRefInfo: or len(parts) > 5 or "/".join(parts[:2]) != EXPS_NAMESPACE ): - InvalidExpRefError(ref) + raise InvalidExpRefError(ref) except ValueError: raise InvalidExpRefError(ref) baseline_sha = parts[2] + parts[3] if len(parts) >= 4 else None
exp: raise InvalidExpRefError properly Before it was just left instantiated, but was not raised.
iterative_dvc
train
py
363cb7ce60c994d359f180274481e104fecebb5c
diff --git a/backtrader/indicators/macd.py b/backtrader/indicators/macd.py index <HASH>..<HASH> 100644 --- a/backtrader/indicators/macd.py +++ b/backtrader/indicators/macd.py @@ -46,7 +46,7 @@ class MACD(Indicator): class MACDHisto(MACD): lines = ('histo',) - plotlines = dict(histo=dict(_method='bar', alpha=0.50, width=0.66)) + plotlines = dict(histo=dict(_method='bar', alpha=0.50, width=1.0)) def __init__(self): super(MACDHisto, self).__init__()
macd cosmetic plot change for the histo line
backtrader_backtrader
train
py
8dddf3d99a7be75c17df43c614e6f3f3914bf07a
diff --git a/server/src/main/java/org/uiautomation/ios/utils/SimulatorSettings.java b/server/src/main/java/org/uiautomation/ios/utils/SimulatorSettings.java index <HASH>..<HASH> 100644 --- a/server/src/main/java/org/uiautomation/ios/utils/SimulatorSettings.java +++ b/server/src/main/java/org/uiautomation/ios/utils/SimulatorSettings.java @@ -292,9 +292,10 @@ public class SimulatorSettings { private String getSimulateDeviceValue(DeviceType device, DeviceVariation variation, String desiredSDKVersion) throws WebDriverException { if (!DeviceVariation.compatibleWithSDKVersion(device, variation, desiredSDKVersion)) { - throw new WebDriverException(String.format("%s incompatible with SDK %s", + DeviceVariation compatibleVariation = DeviceVariation.getCompatibleVersion(device, desiredSDKVersion); + throw new WebDriverException(String.format("%s variation incompatible with SDK %s, a compatible variation is %s", DeviceVariation.deviceString(device, variation), - desiredSDKVersion)); + desiredSDKVersion, compatibleVariation)); } return DeviceVariation.deviceString(device, variation); }
Suggest compatible variation in the no compatible variation error.
ios-driver_ios-driver
train
java
97ee3f9bf924930c33decea26a9de624a48b9a39
diff --git a/tangy-form.js b/tangy-form.js index <HASH>..<HASH> 100644 --- a/tangy-form.js +++ b/tangy-form.js @@ -281,7 +281,7 @@ export class TangyForm extends PolymerElement { } disconnectedCallback() { - this.unsubscribe() + if (this.unsubscribe) this.unsubscribe() } onFormResponseComplete(event) {
Protect in situations where disconnectedCallback may be called before connectedCallback
Tangerine-Community_tangy-form
train
js
900b7f977d02edc2a58ffad12a30128099f13c25
diff --git a/test/channel.spec.js b/test/channel.spec.js index <HASH>..<HASH> 100644 --- a/test/channel.spec.js +++ b/test/channel.spec.js @@ -566,16 +566,18 @@ describe('Channel', function() { let ch1 = new Channel(4); let ch2 = new Channel(4); let ch3 = new Channel(4); + let ch4 = new Channel(4); for (let i = 0; i < 4; i++) await ch1.put(i); - ch1.pipe(ch2).pipe(ch3); + ch1.pipe(ch2).pipe(ch3).pipe(ch4); ch1.close(true); for (let i = 0; i < 4; i++) - assert.equal(await ch3.take(), i); - await ch3.done(); + assert.equal(await ch4.take(), i); + await ch4.done(); assert.equal(ch1.state, STATES.ENDED); assert.equal(ch2.state, STATES.ENDED); assert.equal(ch3.state, STATES.ENDED); + assert.equal(ch4.state, STATES.ENDED); }); });
test: extend full channel pipe close unit tests Full channel pipe close now includes 4 pipes by default in order to ensure that multiple internal pipes will all be properly closed.
dvlsg_async-csp
train
js
160198338925949f2be9d6bc4ac0d68df369f4f7
diff --git a/src/Web/Account/Asset/Get.php b/src/Web/Account/Asset/Get.php index <HASH>..<HASH> 100644 --- a/src/Web/Account/Asset/Get.php +++ b/src/Web/Account/Asset/Get.php @@ -32,7 +32,7 @@ class Get $custId = $data->getCustomerId(); /** TODO: add access rights validation */ - $reqCustId = $this->auth->getCurrentCustomerId($request); + $reqCustId = $this->auth->getCurrentUserId($request); /** perform processing */ $items = $this->getAssets($reqCustId); diff --git a/src/Web/Account/Asset/Transfer.php b/src/Web/Account/Asset/Transfer.php index <HASH>..<HASH> 100644 --- a/src/Web/Account/Asset/Transfer.php +++ b/src/Web/Account/Asset/Transfer.php @@ -37,7 +37,7 @@ class Transfer /** TODO: add access rights validation */ $reqAdminId = $this->auth->getCurrentAdminId($request); - $reqCustId = $this->auth->getCurrentCustomerId($request); + $reqCustId = $this->auth->getCurrentUserId($request); /** perform processing */ $resp = $this->transfer($amount, $assetTypeId, $counterPartyId, $custId, $isDirect, $reqAdminId);
MOBI-<I> Improve API authenticator to process frontend & backend sessions
praxigento_mobi_mod_accounting
train
php,php
5d0f2bcfb218d1a96724fb5e93530caa315b01ef
diff --git a/salt/minion.py b/salt/minion.py index <HASH>..<HASH> 100644 --- a/salt/minion.py +++ b/salt/minion.py @@ -1409,12 +1409,18 @@ class Minion(MinionBase): ''' Refresh the pillar ''' - self.opts['pillar'] = salt.pillar.get_pillar( - self.opts, - self.opts['grains'], - self.opts['id'], - self.opts['environment'], - ).compile_pillar() + try: + self.opts['pillar'] = salt.pillar.get_pillar( + self.opts, + self.opts['grains'], + self.opts['id'], + self.opts['environment'], + ).compile_pillar() + except SaltClientError: + # Do not exit if a pillar refresh fails. + log.error('Pillar data could not be refreshed. ' + 'One or more masters may be down!') + continue self.module_refresh(force_refresh) def manage_schedule(self, package):
Prevent multi-master from dying with pillar refresh error
saltstack_salt
train
py
35dbc918752391dbd213ab082b19a9c6c967c96a
diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py index <HASH>..<HASH> 100644 --- a/setuptools/command/editable_wheel.py +++ b/setuptools/command/editable_wheel.py @@ -168,7 +168,7 @@ class editable_wheel(Command): if not dist.namespace_packages: return - src_root = Path(self.project_dir, self.pakcage_dir.get("", ".")).resolve() + src_root = Path(self.project_dir, self.package_dir.get("", ".")).resolve() installer = _NamespaceInstaller(dist, installation_dir, pth_prefix, src_root) installer.install_namespaces()
Fix typo in editable_wheel.py
pypa_setuptools
train
py
78eb8b22b5bdd57bb16ea42c090a3087b9b128a6
diff --git a/vsphere/virtual_machine_config_structure.go b/vsphere/virtual_machine_config_structure.go index <HASH>..<HASH> 100644 --- a/vsphere/virtual_machine_config_structure.go +++ b/vsphere/virtual_machine_config_structure.go @@ -628,7 +628,9 @@ func expandVAppConfig(d *schema.ResourceData, client *govmomi.Client) (*types.Vm if newVApps != nil && len(newVApps) > 0 && newVApps[0] != nil { newVApp := newVApps[0].(map[string]interface{}) if props, ok := newVApp["properties"].(map[string]interface{}); ok { - newMap = props + for k, v := range props { + newMap[k] = v + } } }
Fix missing vapp properties Due to the way maps behave in goland we ended up removing data from the original map holding the vapp properties. The consequence was that if expandVAppConfig was called more than once, we'd end up effectively emptying the vapp properties map.
terraform-providers_terraform-provider-vsphere
train
go
c81575880bd4206e7c81d9ab249505d0eabd6139
diff --git a/src/entity/entity.js b/src/entity/entity.js index <HASH>..<HASH> 100644 --- a/src/entity/entity.js +++ b/src/entity/entity.js @@ -125,14 +125,11 @@ */ this.renderable = null; - // just to keep track of when we flip - this.lastflipX = false; - this.lastflipY = false; - // ensure mandatory properties are defined if ((typeof settings.width !== "number") || (typeof settings.height !== "number")) { throw new me.ObjectEntity.Error("height and width properties are mandatory when passing settings parameters to an object entity"); } + // call the super constructor this._super(me.Renderable, "init", [x, y, settings.width, @@ -194,11 +191,6 @@ typeof(settings.collidable) !== "undefined" ? settings.collidable : true ); - - // ensure mandatory properties are defined - if ((typeof settings.width !== "number") || (typeof settings.height !== "number")) { - throw new me.Entity.Error("height and width properties are mandatory when passing settings parameters to an object entity"); - } /** * the entity body object
[#<I>] removed duplicated code
melonjs_melonJS
train
js
45126121809acd3eaafc884ea6969fe4d7bc06c8
diff --git a/app/js/timer.js b/app/js/timer.js index <HASH>..<HASH> 100644 --- a/app/js/timer.js +++ b/app/js/timer.js @@ -12,6 +12,14 @@ angular.module('timer', []) }, controller: ['$scope', '$element', '$attrs', '$timeout', function ($scope, $element, $attrs, $timeout) { + // Checking for trim function since IE8 doesn't have it + // If not a function, create tirm with RegEx to mimic native trim + if(typeof String.prototype.trim !== 'function') { + String.prototype.trim = function() { + return this.replace(/^\s+|\s+$/g, ''); + } + } + //angular 1.2 doesn't support attributes ending in "-start", so we're //supporting both "autostart" and "auto-start" as a solution for //backward and forward compatibility.
Adding trim function check for IE8 support
siddii_angular-timer
train
js
49e93d11acff8392f99317e9d55241b2293c4df0
diff --git a/cwltool/avro_ld/validate.py b/cwltool/avro_ld/validate.py index <HASH>..<HASH> 100644 --- a/cwltool/avro_ld/validate.py +++ b/cwltool/avro_ld/validate.py @@ -139,8 +139,13 @@ def validate_ex(expected_schema, datum, strict=False): errors = [] for f in expected_schema.fields: + if f.name in datum: + fieldval = datum[f.name] + else: + fieldval = f.default + try: - validate_ex(f.type, datum.get(f.name), strict=strict) + validate_ex(f.type, fieldval, strict=strict) except ValidationException as v: if f.name not in datum: errors.append("missing required field `%s`" % f.name)
Make validation aware of defaults, validate default (if provided) when is field is missing.
common-workflow-language_cwltool
train
py
a5f35a53e44090667ff2fe4ef2d1a25a4a5a9b41
diff --git a/TYPO3.Flow/Tests/Unit/Http/Component/TrustedProxiesComponentTest.php b/TYPO3.Flow/Tests/Unit/Http/Component/TrustedProxiesComponentTest.php index <HASH>..<HASH> 100644 --- a/TYPO3.Flow/Tests/Unit/Http/Component/TrustedProxiesComponentTest.php +++ b/TYPO3.Flow/Tests/Unit/Http/Component/TrustedProxiesComponentTest.php @@ -460,5 +460,4 @@ class TrustedProxiesComponentTest extends UnitTestCase $trustedRequest = $this->callWithRequest($request); $this->assertEquals($expectedUri, (string)$trustedRequest->getUri()); } - }
TASK: Fix CGL issue
neos_flow-development-collection
train
php
57b947c7e43639820b3ec4acf6fbd70ddf370ed1
diff --git a/lib/active_admin/namespace_settings.rb b/lib/active_admin/namespace_settings.rb index <HASH>..<HASH> 100644 --- a/lib/active_admin/namespace_settings.rb +++ b/lib/active_admin/namespace_settings.rb @@ -23,10 +23,10 @@ module ActiveAdmin # Set a favicon register :favicon, false - # Additional meta tags to place in head of logged in pages. + # Additional meta tags to place in head of logged in pages register :meta_tags, {} - # Additional meta tags to place in head of logged out pages. + # Additional meta tags to place in head of logged out pages register :meta_tags_for_logged_out_pages, { robots: "noindex, nofollow" } # The view factory to use to generate all the view classes. Take @@ -53,10 +53,10 @@ module ActiveAdmin # Whether filters are enabled register :filters, true - # The namespace root. + # The namespace root register :root_to, 'dashboard#index' - # Options that a passed to root_to. + # Options that are passed to root_to register :root_to_options, {} # Options passed to the routes, i.e. { path: '/custom' }
Fix a typo and extra dots for comments in NamespaceSettings
activeadmin_activeadmin
train
rb
511c5c27e6d77b1fe03def738b012e1fc9932799
diff --git a/ansible_runner/__main__.py b/ansible_runner/__main__.py index <HASH>..<HASH> 100644 --- a/ansible_runner/__main__.py +++ b/ansible_runner/__main__.py @@ -216,7 +216,7 @@ def main(sys_args=None): parser.add_argument( 'private_data_dir', - help="base directory cotnaining the ansible-runner metadata " + help="base directory containing the ansible-runner metadata " "(project, inventory, env, etc)" )
[Trivial] Fix typo in command help
ansible_ansible-runner
train
py
1c2821be26862d9fc1ce4c7fcdc1ddc2757f1b1d
diff --git a/salt/cloud/clouds/openstack.py b/salt/cloud/clouds/openstack.py index <HASH>..<HASH> 100644 --- a/salt/cloud/clouds/openstack.py +++ b/salt/cloud/clouds/openstack.py @@ -260,10 +260,14 @@ def get_configured_provider(): ''' Return the first configured instance. ''' - return config.is_provider_configured( + provider = config.is_provider_configured( __opts__, __active_provider_name__ or __virtualname__, - ('auth', 'region_name'), log_message=False, - ) or config.is_provider_configured( + ('auth', 'region_name') + ) + if provider: + return provider + + return config.is_provider_configured( __opts__, __active_provider_name__ or __virtualname__, ('cloud', 'region_name') )
Return a configured provider, not a bool
saltstack_salt
train
py
f7834cf8cb786f7c978b01ff281ba5fcd887ec20
diff --git a/api/api.go b/api/api.go index <HASH>..<HASH> 100644 --- a/api/api.go +++ b/api/api.go @@ -83,6 +83,7 @@ func Mount( TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 10 * time.Second, }, + Timeout: 30 * time.Second, }) if len(flags.Profile) > 0 {
Set a timeout on the http client Fixes #<I>
kahing_goofys
train
go
e28a537a4e6d2984fccd350c5981c7bf5936aac2
diff --git a/src/main/java/nl/hsac/fitnesse/fixture/slim/JsonHttpTest.java b/src/main/java/nl/hsac/fitnesse/fixture/slim/JsonHttpTest.java index <HASH>..<HASH> 100644 --- a/src/main/java/nl/hsac/fitnesse/fixture/slim/JsonHttpTest.java +++ b/src/main/java/nl/hsac/fitnesse/fixture/slim/JsonHttpTest.java @@ -20,14 +20,6 @@ public class JsonHttpTest extends HttpTest { } /** - * @return request sent last time postTo() or getFrom() was called. - */ - @Override - public String request() { - return formatValue(super.request()); - } - - /** * @return response received last time postTo() or getFrom() was called. */ @Override
I don't expect JSON to be posted (but url encoded form) so no need to format as such.
fhoeben_hsac-fitnesse-fixtures
train
java
c59ff78589679138e2698c9c0ccfcdfcb81ec427
diff --git a/treeherder/settings/base.py b/treeherder/settings/base.py index <HASH>..<HASH> 100644 --- a/treeherder/settings/base.py +++ b/treeherder/settings/base.py @@ -9,8 +9,8 @@ from datetime import timedelta from treeherder import path # Insure the vendor libraries are added to the python path -# in production -sys.path.append(path('..', 'vendor')) +# in production, and before the site-packages entry. +sys.path.insert(1, path('..', 'vendor')) # These settings can all be optionally set via env vars, or in local.py:
Bug <I> - Use vendor packages in preference to globally installed There is currently duplication between the packages in vendor/ and those globally installed on stage/production. This change ensures we use those in vendor/ in preference to those in site-packages & so are using the version we expected.
mozilla_treeherder
train
py
851b09e1314592ecb91920089764e422b613bae4
diff --git a/lib/tetra/facades/bash.rb b/lib/tetra/facades/bash.rb index <HASH>..<HASH> 100644 --- a/lib/tetra/facades/bash.rb +++ b/lib/tetra/facades/bash.rb @@ -3,6 +3,7 @@ module Tetra # runs Bash with tetra-specific options class Bash + include Logging include ProcessRunner def initialize(project) @@ -21,8 +22,11 @@ module Tetra mvn_path = kit.find_executable("mvn") mvn_commandline = Tetra::Mvn.commandline(@project.full_path, mvn_path) - bashrc = Bashrc.new(history_file.path, ant_commandline, mvn_commandline) - bashrc_file.write(bashrc.to_s) + bashrc_content = Bashrc.new(history_file.path, ant_commandline, mvn_commandline).to_s + log.debug "writing bashrc file: #{bashrc_file.path}" + log.debug bashrc_content + + bashrc_file.write(bashrc_content) bashrc_file.flush run_interactive("bash --rcfile #{bashrc_file.path}")
Bash: add more verbose logging
moio_tetra
train
rb
7d872508358141fc69476b352dda2641ff00f086
diff --git a/mmcv/torchpack/runner/runner.py b/mmcv/torchpack/runner/runner.py index <HASH>..<HASH> 100644 --- a/mmcv/torchpack/runner/runner.py +++ b/mmcv/torchpack/runner/runner.py @@ -108,11 +108,14 @@ class Runner(object): Args: optimizer (dict or :obj:`~torch.optim.Optimizer`): Either an optimizer object or a dict used for constructing the optimizer. - An example of the dict: ``{'algorithm': 'SGD', 'lr': 0.02, - 'momentum': 0.9, 'weight_decay': 0.0001}``. Returns: :obj:`~torch.optim.Optimizer`: An optimizer object. + + Examples: + >>> optimizer = dict(type='SGD', lr=0.01, momentum=0.9) + >>> type(runner.init_optimizer(optimizer)) + <class 'torch.optim.sgd.SGD'> """ if isinstance(optimizer, dict): optimizer = obj_from_dict(
fix a typo in docstring
open-mmlab_mmcv
train
py
28358335a9d020ad25bbc53ffd584ed1c22a98a0
diff --git a/lib/dotrepo/cli.rb b/lib/dotrepo/cli.rb index <HASH>..<HASH> 100644 --- a/lib/dotrepo/cli.rb +++ b/lib/dotrepo/cli.rb @@ -31,7 +31,7 @@ module Dotrepo DotFileManager.new( config.source, config.destination ).symlink_dotfiles end - desc "refresh", "update linked dotfiles" + desc "refresh", "link new dotfiles" def refresh # runs the manager again to symlink new files & prune abandoned files DotFileManager.new( config.source, config.destination ).symlink_dotfiles
better description for CLI#refresh
stevenosloan_dotrepo
train
rb
c7fb5c4d08e27a954082e58d33e1bc29a37183d9
diff --git a/modules/dropdown/js/dropdown_directive.js b/modules/dropdown/js/dropdown_directive.js index <HASH>..<HASH> 100644 --- a/modules/dropdown/js/dropdown_directive.js +++ b/modules/dropdown/js/dropdown_directive.js @@ -31,12 +31,12 @@ angular.module('lumx.dropdown', ['lumx.utils.event-scheduler']) { if (openScope === dropdownScope) { - if (angular.isDefined(openScope.idEventScheduler)) + if (angular.isDefined(dropdownScope.idEventScheduler)) { $timeout(function() { - LxEventSchedulerService.unregister(openScope.idEventScheduler); - delete openScope.idEventScheduler; + LxEventSchedulerService.unregister(dropdownScope.idEventScheduler); + delete dropdownScope.idEventScheduler; openScope = null; }, 1);
fix dropdown: fix event scheduler on close
lumapps_lumX
train
js
7ce4a81ca7ee8cb81a7fe614dcdf4bc8d326a0de
diff --git a/spylon/common.py b/spylon/common.py index <HASH>..<HASH> 100644 --- a/spylon/common.py +++ b/spylon/common.py @@ -68,6 +68,8 @@ def as_iterable(iterable_or_scalar): else: return (iterable_or_scalar,) +# preserve backwards compatibility +_as_iterable = as_iterable @add_metaclass(ABCMeta) class JVMHelpers(object):
MNT: Need to preserve backwards compatibility
Valassis-Digital-Media_spylon
train
py
65ec053a67f753d7c1424cf5623e8e75267e1c14
diff --git a/scripts/__init__.py b/scripts/__init__.py index <HASH>..<HASH> 100644 --- a/scripts/__init__.py +++ b/scripts/__init__.py @@ -1,4 +1,3 @@ - from __future__ import absolute_import, division, print_function, unicode_literals from pies.overrides import *
Remove unintentionaly added line
timothycrosley_deprecated.frosted
train
py
da94f98e394c5f6a78871f3d51387777ac3c9235
diff --git a/server/fsm.go b/server/fsm.go index <HASH>..<HASH> 100644 --- a/server/fsm.go +++ b/server/fsm.go @@ -866,6 +866,7 @@ func (h *FSMHandler) opensent() (bgp.FSMState, FsmStateReason) { "Key": fsm.pConf.Config.NeighborAddress, "State": fsm.state.String(), }).Warn("graceful restart timer expired") + h.conn.Close() return bgp.BGP_FSM_IDLE, FSM_RESTART_TIMER_EXPIRED } case i, ok := <-h.msgCh.Out(): @@ -1076,6 +1077,7 @@ func (h *FSMHandler) openconfirm() (bgp.FSMState, FsmStateReason) { "Key": fsm.pConf.Config.NeighborAddress, "State": fsm.state.String(), }).Warn("graceful restart timer expired") + h.conn.Close() return bgp.BGP_FSM_IDLE, FSM_RESTART_TIMER_EXPIRED } case <-ticker.C:
server: Close conn when graceful restart timer expired
osrg_gobgp
train
go
3561226788676d9fc5487c984e5894cbebb65595
diff --git a/lib/fluent/plugin/out_buffered_stdout.rb b/lib/fluent/plugin/out_buffered_stdout.rb index <HASH>..<HASH> 100644 --- a/lib/fluent/plugin/out_buffered_stdout.rb +++ b/lib/fluent/plugin/out_buffered_stdout.rb @@ -34,7 +34,7 @@ module Fluent def write(chunk) chunk.msgpack_each do |time, tag, record| - log.write "#{time} #{tag}: #{@formatter.format(time.localtime.to_s, tag, record)}\n" + log.write "#{time} #{tag}: #{@formatter.format(tag, time, record)}\n" end log.flush end
out_buffered_stdout: Fix no method error due to wrong formattter#format usage
fluent_fluentd
train
rb
803a3586ee10ecdf47a019451c3a4f72c317858f
diff --git a/Joomla/Sniffs/Operators/ValidLogicalOperatorsSniff.php b/Joomla/Sniffs/Operators/ValidLogicalOperatorsSniff.php index <HASH>..<HASH> 100644 --- a/Joomla/Sniffs/Operators/ValidLogicalOperatorsSniff.php +++ b/Joomla/Sniffs/Operators/ValidLogicalOperatorsSniff.php @@ -52,7 +52,7 @@ class Joomla_Sniffs_Operators_ValidLogicalOperatorsSniff implements PHP_CodeSnif return; } - $nextToken = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true); + $nextToken = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true); if ($tokens[$nextToken]['code'] === T_EXIT) { @@ -60,6 +60,13 @@ class Joomla_Sniffs_Operators_ValidLogicalOperatorsSniff implements PHP_CodeSnif return; } + // Special Joomla! case `jexit()`. + if ($tokens[$nextToken]['content'] == 'jexit') + { + // Put in an exception for things like `or jexit()` + return; + } + $error = 'Logical operator "%s" not allowed; use "%s" instead'; $data = array( $operator,
Attempt fix for `or jexit()` case
joomla_coding-standards
train
php
018fadad468f5431d737da19c478378e2cbb6398
diff --git a/eZ/Publish/API/Repository/Values/Content/ContentInfo.php b/eZ/Publish/API/Repository/Values/Content/ContentInfo.php index <HASH>..<HASH> 100644 --- a/eZ/Publish/API/Repository/Values/Content/ContentInfo.php +++ b/eZ/Publish/API/Repository/Values/Content/ContentInfo.php @@ -100,4 +100,15 @@ abstract class ContentInfo extends ValueObject * @var string */ protected $mainLanguageCode; + + /** + * Identifier of the main location. + * + * If the content object has multiple locations, + * $mainLocationId will point to the main one. + * + * @var mixed + */ + protected $mainLocationId; + } diff --git a/eZ/Publish/API/Repository/Values/Content/Location.php b/eZ/Publish/API/Repository/Values/Content/Location.php index <HASH>..<HASH> 100644 --- a/eZ/Publish/API/Repository/Values/Content/Location.php +++ b/eZ/Publish/API/Repository/Values/Content/Location.php @@ -111,16 +111,6 @@ abstract class Location extends ValueObject protected $modifiedSubLocationDate; /** - * Identifier of the main location. - * - * If the content object in this location has multiple locations, - * $mainLocationId will point to the main one. - * - * @var mixed - */ - protected $mainLocationId; - - /** * Depth location has in the location tree. * * @var int
moved main location from Location to ContentInfo
ezsystems_ezpublish-kernel
train
php,php
9be765d24a8ad62f0ba1a6650b321651161ac3d9
diff --git a/lib/3scale/core/version.rb b/lib/3scale/core/version.rb index <HASH>..<HASH> 100644 --- a/lib/3scale/core/version.rb +++ b/lib/3scale/core/version.rb @@ -1,5 +1,5 @@ module ThreeScale module Core - VERSION = '1.2.7' + VERSION = '1.2.8' end end
core: bugfix release <I>
3scale_pisoni
train
rb
947b486ef5143119b7db6555a9d5731d73559763
diff --git a/phy/cluster/views/base.py b/phy/cluster/views/base.py index <HASH>..<HASH> 100644 --- a/phy/cluster/views/base.py +++ b/phy/cluster/views/base.py @@ -266,8 +266,10 @@ class ManualClusteringView(object): connect(on_select, event='select') # Save the view state in the GUI state. - @connect(view=self) + @connect def on_close_view(view_, gui): + if view_ != self: + return logger.debug("Close view %s.", self.name) self._closed = True gui.remove_menu(self.name)
Fix frozen view bug: the close event was sent to all views
kwikteam_phy
train
py
3fe3199245bce6111ad12276ab796ae7f80cfe44
diff --git a/lib/endpoints/class-wp-rest-posts-terms-controller.php b/lib/endpoints/class-wp-rest-posts-terms-controller.php index <HASH>..<HASH> 100644 --- a/lib/endpoints/class-wp-rest-posts-terms-controller.php +++ b/lib/endpoints/class-wp-rest-posts-terms-controller.php @@ -126,8 +126,9 @@ class WP_REST_Posts_Terms_Controller extends WP_REST_Controller { if ( is_wp_error( $is_request_valid ) ) { return $is_request_valid; } - - $tt_ids = wp_set_object_terms( $post->ID, $term_id, $this->taxonomy, true ); + + $term = get_term_by('term_taxonomy_id', $term_id, $this->taxonomy); + $tt_ids = wp_set_object_terms( $post->ID, $term->term_id, $this->taxonomy, true ); if ( is_wp_error( $tt_ids ) ) { return $tt_ids;
#<I>: When associating terms to posts, align WP-API use of term_taxonomy_id with WP core's use of term_id.
WP-API_WP-API
train
php
91a6adfbd98b467bf3a3567b7b9e84f7dbcc1c2b
diff --git a/tests/text_encoders/test_spacy_encoder.py b/tests/text_encoders/test_spacy_encoder.py index <HASH>..<HASH> 100644 --- a/tests/text_encoders/test_spacy_encoder.py +++ b/tests/text_encoders/test_spacy_encoder.py @@ -6,13 +6,16 @@ from torchnlp.text_encoders import SpacyEncoder @pytest.fixture -def encoder(): - input_ = 'This is a sentence' +def input_(): + return ('This is a sentence') + + +@pytest.fixture +def encoder(input_): return SpacyEncoder([input_]) -def test_spacy_encoder(encoder): - input_ = 'This is a sentence' +def test_spacy_encoder(encoder, input_): tokens = encoder.encode(input_) assert encoder.decode(tokens) == input_ @@ -24,9 +27,7 @@ def test_spacy_encoder_issue_44(): assert 'n\'t' in encoder.vocab -def test_spacy_encoder_batch(): - input_ = 'This is a sentence' - encoder = SpacyEncoder([input_]) +def test_spacy_encoder_batch(encoder, input_): tokens = encoder.batch_encode([input_, input_]) assert encoder.decode(tokens[0]) == input_ assert encoder.decode(tokens[1]) == input_
Normalize Spacy Encoder Tests
PetrochukM_PyTorch-NLP
train
py
81f763668983b1a92e2a894fdfb26d8fa1e473fe
diff --git a/spec/neovim/host_spec.rb b/spec/neovim/host_spec.rb index <HASH>..<HASH> 100644 --- a/spec/neovim/host_spec.rb +++ b/spec/neovim/host_spec.rb @@ -25,6 +25,21 @@ module Neovim end end + describe "#run" do + it "runs the session event loop and handles messages" do + message = double(:message) + expect(session).to receive(:run).and_yield(message) + expect(host).to receive(:handle).with(message) + + host.run + end + + it "rescues session exceptions", :silence_logging do + expect(session).to receive(:run).and_raise("BOOM") + expect { host.run }.not_to raise_error + end + end + describe "#handlers" do it "has a default poll handler" do expect(host.handlers["poll"]).to respond_to(:call)
Add test coverage around Host#run
neovim_neovim-ruby
train
rb
2f96281b79d0c2fe2c705b1b4cd1122e7dbd003e
diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Database/Eloquent/Model.php +++ b/src/Illuminate/Database/Eloquent/Model.php @@ -735,6 +735,22 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab return $instance->newQuery()->with($relations); } + + /** + * Append attributes to query when building a query + * + * @return $this + */ + public function append($relations) + { + if (is_string($relations)) { + $relations = func_get_args(); + } + + $this->appends = array_merge($this->appends, $relations); + + return $this; + } /** * Define a one-to-one relationship.
Update Model.php to allow dynamic appending of attributes after making the query. We then could use it like this: ``` return $resource->findOrFail($id) ->append(['custom_attribute']) ->toArray(); ```
laravel_framework
train
php
9ca78df5a0c6006741c01a4253c9d4934dd78ce0
diff --git a/reliure/pipeline.py b/reliure/pipeline.py index <HASH>..<HASH> 100644 --- a/reliure/pipeline.py +++ b/reliure/pipeline.py @@ -75,7 +75,7 @@ class Composable(object): self.name = self.__class__.__name__ else: self.name = name - self._logger = logging.getLogger("reliure.%s" % self.__class__.__name__) + self._logger = logging.getLogger("reliure.%s" % self.name) @property def name(self):
Use component name as logging name. Class name was used before. Note that class name is used as default component name.
kodexlab_reliure
train
py
572414c03a03f523d92c71bfeb64932ed3a0c56b
diff --git a/src/main/java/com/semanticcms/core/model/Element.java b/src/main/java/com/semanticcms/core/model/Element.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/semanticcms/core/model/Element.java +++ b/src/main/java/com/semanticcms/core/model/Element.java @@ -162,6 +162,15 @@ abstract public class Element extends Node { } /** + * Gets the element ID template for generating IDs. + * + * @see #getLabel() Defaults to getLabel() + */ + protected String getElementIdTemplate() { + return getLabel(); + } + + /** * Gets the default element ID prefix for this type of element. */ abstract protected String getDefaultIdPrefix(); @@ -213,7 +222,7 @@ abstract public class Element extends Node { if(page != null) { Map<String,Element> elementsById = page.getElementsById(); // Generate the ID now - StringBuilder possId = Element.generateIdPrefix(getLabel(), getDefaultIdPrefix()); + StringBuilder possId = Element.generateIdPrefix(getElementIdTemplate(), getDefaultIdPrefix()); int possIdLen = possId.length(); // Find an unused identifier for(int i=1; i<=Integer.MAX_VALUE; i++) {
ID templates may now be determined by elements independently of their label.
aoindustries_semanticcms-core-model
train
java
b6bd8da5ffa1707c8c5d4ca552dd4ec9fb47b437
diff --git a/apiserver/metricsender/metricsender.go b/apiserver/metricsender/metricsender.go index <HASH>..<HASH> 100644 --- a/apiserver/metricsender/metricsender.go +++ b/apiserver/metricsender/metricsender.go @@ -47,7 +47,7 @@ func handleResponse(mm *state.MetricsManager, st ModelBackend, response wireform } } } - if response.NewGracePeriod > 0 { + if response.NewGracePeriod > 0 && response.NewGracePeriod != mm.GracePeriod() { err := mm.SetGracePeriod(response.NewGracePeriod) if err != nil { logger.Errorf("failed to set new grace period %v", err)
Fixed set grace period. We do not need to set the grace period on every send/receive if it is not changed.
juju_juju
train
go
ce335d953bb32f8723ff7a4ac539486194d940a1
diff --git a/tests/webdriver/fuzzer.rb b/tests/webdriver/fuzzer.rb index <HASH>..<HASH> 100644 --- a/tests/webdriver/fuzzer.rb +++ b/tests/webdriver/fuzzer.rb @@ -125,7 +125,7 @@ if browserdriver == :firefox elsif browserdriver == :chrome log_path = FileUtils.mkpath(File.join(File.dirname(File.expand_path(__FILE__)), "fuzzer_output")) log_path = log_path.first - driver = Selenium::WebDriver.for browserdriver, :service_log_path => log_path + driver = Selenium::WebDriver.for browserdriver else driver = Selenium::WebDriver.for browserdriver end diff --git a/tests/webdriver/lib/scribe_driver.rb b/tests/webdriver/lib/scribe_driver.rb index <HASH>..<HASH> 100644 --- a/tests/webdriver/lib/scribe_driver.rb +++ b/tests/webdriver/lib/scribe_driver.rb @@ -101,7 +101,7 @@ module ScribeDriver elsif browser== :chrome log_path = FileUtils.mkpath(File.join(File.dirname(File.expand_path(__FILE__)), "fuzzer_output")) log_path = log_path.first - @@driver = Selenium::WebDriver.for browser, :service_log_path => log_path + @@driver = Selenium::WebDriver.for browser else @@driver = Selenium::WebDriver.for browser end
Remove log path for ChromeDriver2 compatibility. It seems we need to use a ChromeOptions class now, which is not yet exposed in the Ruby bindings.
quilljs_quill
train
rb,rb
7ad05b2d395741b13ac205f02845653d1e7a7173
diff --git a/JsonApi/Request/ParamEntityFinder.php b/JsonApi/Request/ParamEntityFinder.php index <HASH>..<HASH> 100644 --- a/JsonApi/Request/ParamEntityFinder.php +++ b/JsonApi/Request/ParamEntityFinder.php @@ -73,7 +73,7 @@ class ParamEntityFinder $access = self::$actionToAccess[$params->action->name]; - if ($this->securityContext->isGranted($access, $entity)) { + if (!$this->securityContext->isGranted($access, $entity)) { throw new EntityAccessDeniedException( self::ERROR_ACCESS_DENIED );
Same mistake twice - Trix are for kids after all.
GoIntegro_hateoas-bundle
train
php
41a8b7f5bd66eda6c5377e16fc977611df44eebc
diff --git a/libs/Parser/Section.php b/libs/Parser/Section.php index <HASH>..<HASH> 100644 --- a/libs/Parser/Section.php +++ b/libs/Parser/Section.php @@ -24,7 +24,7 @@ class Section */ private $content=''; - public function __construct( string$name ) + public function __construct( string$name=null ) { $this->name = $name; } @@ -40,4 +40,9 @@ class Section { return $this->content; } + + public function getName()//:string|null + { + return $this->name; + } }
Allow nameless Section with name value of null.
Fenzland_Htsl.php
train
php
99985ca86448beee0e076dcca7c0a9477de29f14
diff --git a/natasha/grammars/person/grammars.py b/natasha/grammars/person/grammars.py index <HASH>..<HASH> 100644 --- a/natasha/grammars/person/grammars.py +++ b/natasha/grammars/person/grammars.py @@ -523,4 +523,33 @@ class ProbabilisticPerson(Enum): POSSIBLE_PART_OF_NAME_GRAMMAR, ] - FirstnameAndLastnameWithPosition = Person.WithPosition.value[:-1] + FirstnameAndLastname + FirstnameAndLastnameWithPosition = Person.WithPosition.value[:-1] + [ + FirstnameAndLastname[-1] + ] + + Latin = [ + { + 'labels': [ + gram('LATN'), + is_capitalized(True), + ], + }, + { + 'labels': [ + gram('LATN'), + is_capitalized(True), + ], + }, + { + 'labels': [ + gram('PUNCT'), + eq('.') + ], + }, + { + 'labels': [ + gram('LATN'), + is_capitalized(True), + ], + }, + ]
Added probabilistic grammar for english names (in 'John W. Doe' format)
natasha_natasha
train
py
cb635dd9a55aa1ddbf83170b1364372e45636048
diff --git a/server/index.js b/server/index.js index <HASH>..<HASH> 100644 --- a/server/index.js +++ b/server/index.js @@ -131,7 +131,7 @@ export default class Server { return await renderScriptError(req, res, '/_error', error, customFields, this.renderOpts) } - const p = join(this.dir, '.next/bundles/pages/_error.js') + const p = join(this.dir, `${this.dist}/bundles/pages/_error.js`) await this.serveStatic(req, res, p) }, diff --git a/server/render.js b/server/render.js index <HASH>..<HASH> 100644 --- a/server/render.js +++ b/server/render.js @@ -109,7 +109,8 @@ async function doRender (req, res, pathname, query, { export async function renderScript (req, res, page, opts) { try { - const path = join(opts.dir, '.next', 'bundles', 'pages', page) + const dist = getConfig(opts.dir).distDir + const path = join(opts.dir, dist, 'bundles', 'pages', page) const realPath = await resolvePath(path) await serveStatic(req, res, realPath) } catch (err) {
use configured distDir where required (#<I>)
zeit_next.js
train
js,js
9d4748d084162118450a5eacde6d8b020bc90130
diff --git a/lib/rasn1/types/base.rb b/lib/rasn1/types/base.rb index <HASH>..<HASH> 100644 --- a/lib/rasn1/types/base.rb +++ b/lib/rasn1/types/base.rb @@ -115,7 +115,11 @@ module Rasn1 if primitive? raise ASN1Error, "malformed #{type} TAG (#@name): indefinite length forbidden for primitive types" else - raise ASN1Error, "TAG #@name: indefinite length not supported yet" + if ber + raise NotImplementedError, "TAG #@name: indefinite length not supported yet" + else + raise ASN1Error, "TAG #@name: indefinite length forbidden in DER encoding" + end end elsif length < INDEFINITE_LENGTH der_to_value(der[2, length], ber: ber) diff --git a/spec/types/base_spec.rb b/spec/types/base_spec.rb index <HASH>..<HASH> 100644 --- a/spec/types/base_spec.rb +++ b/spec/types/base_spec.rb @@ -94,7 +94,9 @@ module Rasn1::Types expect { bool.parse!(der) }.to raise_error(Rasn1::ASN1Error). with_message('malformed BOOLEAN TAG (bool): indefinite length forbidden for primitive types') end - it 'raises on indefinite length with constructed types' + + it 'raises on indefinite length with constructed types on DER encoding' + it 'raises on indefinite length with constructed types on BER encoding' end end end
Types::Base#parse!: differentiate BER and DER encoding on indefinite length
sdaubert_rasn1
train
rb,rb
985e6bafeeeb9a0c971f7860e6f88f6a7853a8e4
diff --git a/tests/pipeline/test_engine.py b/tests/pipeline/test_engine.py index <HASH>..<HASH> 100644 --- a/tests/pipeline/test_engine.py +++ b/tests/pipeline/test_engine.py @@ -1221,6 +1221,9 @@ class ParameterizedFactorTestCase(WithTradingEnvironment, ZiplineTestCase): expected_5 = rolling_mean((self.raw_data ** 2) * 2, window=5)[5:] assert_frame_equal(results['dv5'].unstack(), expected_5) + # The following two use USEquityPricing.open and .volume as inputs. + # The former uses self.raw_data_with_nans, and the latter uses + # .raw_data * 2. Thus we multiply instead of squaring as above. expected_1_nan = (self.raw_data_with_nans[5:] * self.raw_data[5:] * 2).fillna(0) assert_frame_equal(results['dv1_nan'].unstack(), expected_1_nan)
DOC: Add comment explaining ADV NaN test expected result calculation.
quantopian_zipline
train
py
94f9fb75b44bdda7c32916d0f0f289a67e7f5a26
diff --git a/src/Passbook/PassFactory.php b/src/Passbook/PassFactory.php index <HASH>..<HASH> 100644 --- a/src/Passbook/PassFactory.php +++ b/src/Passbook/PassFactory.php @@ -219,7 +219,6 @@ class PassFactory throw new FileException("Couldn't open zip file."); } if ($handle = opendir($passDir)) { - $zip->addFile($passDir); while (false !== ($entry = readdir($handle))) { if ($entry == '.' or $entry == '..') continue; $zip->addFile($passDir . $entry, $entry);
Pass dir removed from zip archive. closes #<I>
eymengunay_php-passbook
train
php
9b33cfc457cff3b51252e150f6e17d0f58d6a01e
diff --git a/storage/remote/client.go b/storage/remote/client.go index <HASH>..<HASH> 100644 --- a/storage/remote/client.go +++ b/storage/remote/client.go @@ -101,7 +101,9 @@ func (c *Client) Store(samples model.Samples) error { } httpReq.Header.Add("Content-Encoding", "snappy") - ctx, _ := context.WithTimeout(context.Background(), c.timeout) + ctx, cancel := context.WithTimeout(context.Background(), c.timeout) + defer cancel() + httpResp, err := ctxhttp.Do(ctx, c.client, httpReq) if err != nil { return err @@ -144,6 +146,10 @@ func (c *Client) Read(ctx context.Context, from, through model.Time, matchers me if err != nil { return nil, fmt.Errorf("unable to create request: %v", err) } + + ctx, cancel := context.WithTimeout(ctx, c.timeout) + defer cancel() + httpResp, err := ctxhttp.Do(ctx, c.client, httpReq) if err != nil { return nil, fmt.Errorf("error sending request: %v", err)
Fix/unify context-based remote storage timeouts
prometheus_prometheus
train
go
db2d873d32560f190765474cd30f2f3ee0e80f59
diff --git a/lib/xcodeproj/project/object/build_configuration.rb b/lib/xcodeproj/project/object/build_configuration.rb index <HASH>..<HASH> 100644 --- a/lib/xcodeproj/project/object/build_configuration.rb +++ b/lib/xcodeproj/project/object/build_configuration.rb @@ -215,14 +215,15 @@ module Xcodeproj settings.keys.each do |key| next unless value = settings[key] + stripped_key = key.sub(/\[[^\]]+\]$/, '') case value when String - next unless array_settings.include?(key) + next unless array_settings.include?(stripped_key) array_value = split_build_setting_array_to_string(value) next unless array_value.size > 1 settings[key] = array_value when Array - next if value.size > 1 && array_settings.include?(key) + next if value.size > 1 && array_settings.include?(stripped_key) settings[key] = value.join(' ') end end
Fix incorrect formatting of build settings with modifiers
CocoaPods_Xcodeproj
train
rb
55392aa3750c3f7e627e955b07f46307f7d35188
diff --git a/code/libraries/koowa/libraries/template/helper/listbox.php b/code/libraries/koowa/libraries/template/helper/listbox.php index <HASH>..<HASH> 100644 --- a/code/libraries/koowa/libraries/template/helper/listbox.php +++ b/code/libraries/koowa/libraries/template/helper/listbox.php @@ -328,15 +328,20 @@ class KTemplateHelperListbox extends KTemplateHelperSelect if (form.hasClass("-koowa-form") || form.hasClass("-koowa-grid")) { form.submit(explode); } else { - var element = form.get(0); - - if (element.addEvent) { - element.addEvent("submit", explode); - } else if (element.addEventListener) { - element.addEventListener("submit", explode, false); - } else if (element.attachEvent) { - element.attachEvent("onsubmit", explode); - } + // See: https://github.com/joomla/joomla-cms/pull/5914 for why we use onsubmit + var element = form.get(0), + previous = element.onsubmit; + + element.onsubmit = function() { + if (typeof previous === "function") { + previous(); + } + + explode(); + + // Avoid explode to be executed more than once. + element.onsubmit = previous; + }; } });</script>'; }
re #<I> Avoid explode from being executed more than once. IE makes a second call to onsubmit when a fireEvent call is made.
joomlatools_joomlatools-framework
train
php
2205f047c2169344aed644f47ae5e41a67c1327a
diff --git a/pyang/translators/schemanode.py b/pyang/translators/schemanode.py index <HASH>..<HASH> 100644 --- a/pyang/translators/schemanode.py +++ b/pyang/translators/schemanode.py @@ -175,7 +175,7 @@ class SchemaNode(object): def _default_format(self, occur): """Return the default serialization format.""" if self.text or self.children: - return self.start_tag() + "%s" + self.end_tag() + return self.start_tag() + self._chorder() + self.end_tag() else: return self.start_tag(empty=True) + "%s"
Interleave for elements other that rng:element.
mbj4668_pyang
train
py
77e2414489088d390de81ef3eb02314f6a5921b9
diff --git a/teslajsonpy/controller.py b/teslajsonpy/controller.py index <HASH>..<HASH> 100644 --- a/teslajsonpy/controller.py +++ b/teslajsonpy/controller.py @@ -874,7 +874,7 @@ class Controller: tasks = [] for vin, online in self.car_online.items(): # If specific car_id provided, only update match - if (car_vin and car_vin != vin) or ( + if (car_vin and car_vin != vin) or vin not in self.__lock.keys() or ( vin and self.car_state[vin].get("in_service") ): continue
fix(vins): ensure vin is in saved state
zabuldon_teslajsonpy
train
py
ce9953357273e73e1b355c467189ef3d1d27c8b3
diff --git a/lib/puppet-repl/support/input_responders.rb b/lib/puppet-repl/support/input_responders.rb index <HASH>..<HASH> 100644 --- a/lib/puppet-repl/support/input_responders.rb +++ b/lib/puppet-repl/support/input_responders.rb @@ -17,10 +17,10 @@ module PuppetRepl def vars(args=[]) # remove duplicate variables that are also in the facts hash - vars = scope.to_hash.delete_if {| key, value | node.facts.values.key?(key) } - vars['facts'] = 'removed by the puppet-repl' if vars.key?('facts') + variables = scope.to_hash.delete_if {| key, value | node.facts.values.key?(key) } + variables['facts'] = 'removed by the puppet-repl' if variables.key?('facts') ap 'Facts were removed for easier viewing' - ap(vars, {:sort_keys => true, :indent => -1}) + ap(variables, {:sort_keys => true, :indent => -1}) end def environment(args=[])
use different variable name to prevent stack overflow
nwops_puppet-debugger
train
rb
2ef70bc9ab9654a6a5bb455b0322e3969ccb2c4b
diff --git a/provider.go b/provider.go index <HASH>..<HASH> 100644 --- a/provider.go +++ b/provider.go @@ -5,7 +5,8 @@ import ( "sync" "time" - "github.com/awslabs/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/awslabs/aws-sdk-go/aws/credentials/ec2rolecreds" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" @@ -39,7 +40,7 @@ func Provider() terraform.ResourceProvider { conn, err := net.DialTimeout("tcp", "169.254.169.254:80", 100*time.Millisecond) if err == nil { conn.Close() - providers = append(providers, &credentials.EC2RoleProvider{}) + providers = append(providers, &ec2rolecreds.EC2RoleProvider{}) } credVal, credErr = credentials.NewChainCredentials(providers).Get()
provider/aws: match with upstream changes
terraform-providers_terraform-provider-aws
train
go
5e9459ab924c4200de50182823002d165087f5e9
diff --git a/lib/resource_renderer/version.rb b/lib/resource_renderer/version.rb index <HASH>..<HASH> 100644 --- a/lib/resource_renderer/version.rb +++ b/lib/resource_renderer/version.rb @@ -1,3 +1,3 @@ module ResourceRenderer - VERSION = '1.2.2' + VERSION = '1.2.3' end
Bumped version to <I>
robotex82_resource_renderer
train
rb
30b6f96e51baffdc8dfe9fa186bd68b2b383f7e0
diff --git a/dimod/core/bqm.py b/dimod/core/bqm.py index <HASH>..<HASH> 100644 --- a/dimod/core/bqm.py +++ b/dimod/core/bqm.py @@ -860,7 +860,7 @@ class BQM(metaclass=abc.ABCMeta): """ if not inplace: - return self.copy().relabel_variables(inplace=True) + return self.copy().relabel_variables_as_integers(inplace=True) mapping = dict((v, i) for i, v in enumerate(self.variables) if i != v) return (self.relabel_variables(mapping, inplace=True),
fixed relabel variables as integers with no inplace
dwavesystems_dimod
train
py
3b4c331e0b9a2e684da321642620547727a4fbe3
diff --git a/src/java/com/threerings/presents/peer/server/PeerManager.java b/src/java/com/threerings/presents/peer/server/PeerManager.java index <HASH>..<HASH> 100644 --- a/src/java/com/threerings/presents/peer/server/PeerManager.java +++ b/src/java/com/threerings/presents/peer/server/PeerManager.java @@ -680,6 +680,7 @@ public class PeerManager public void shutdown () { if (_client.isActive()) { + log.info("Logging off of peer " + _record + "."); _client.logoff(false); } }
Log when we're calling logoff() for our local peers to see if this is or isn't happening on the hanging dev server. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@<I> <I>f4-<I>e9-<I>-aa3c-eee0fc<I>fb1
threerings_narya
train
java
3f1b50ec16d78ad7309934bafe84043c7a6e2a82
diff --git a/app/helpers/i18n_helpers.rb b/app/helpers/i18n_helpers.rb index <HASH>..<HASH> 100644 --- a/app/helpers/i18n_helpers.rb +++ b/app/helpers/i18n_helpers.rb @@ -82,15 +82,18 @@ module I18nHelpers # def t_title(action = nil, model = nil) action ||= action_name + I18n.translate("#{t_context(model)}.#{action}.title", default: [:"crud.title.#{action}"], + model: t_model(model)) + end + alias :t_crud :t_title + + def t_context(model = nil) if model - context = model.name.pluralize.underscore + model.name.pluralize.underscore else - context = controller_name.underscore + controller_name end - - I18n::translate("#{context}.#{action}.title", :default => [:"crud.title.#{action}"], :model => t_model(model)) end - alias :t_crud :t_title # Returns translated string for current +action+. #
get context with method and controller_name needn't to be underscored
huerlisi_i18n_rails_helpers
train
rb
33d827a7c8eaaf71ea80d85673d1c186137e055e
diff --git a/test/app.js b/test/app.js index <HASH>..<HASH> 100644 --- a/test/app.js +++ b/test/app.js @@ -5,6 +5,10 @@ var Joi = require('joi'); var config = require('./config.js'); + +var personRoutingKey = 'name' // used in the customRouting.spec.js tests + + function configureApp(harvesterApp) { var peopleSearch, equipmentSearch, warriorSearch; //This circumvents a dependency issue between harvest and elastic-harvest. @@ -56,6 +60,7 @@ function configureApp(harvesterApp) { peopleSearch.setHarvestRoute(harvesterApp.createdResources['person']); peopleSearch.enableAutoSync("person"); peopleSearch.enableAutoIndexUpdate(); + peopleSearch.setCustomRouting(personRoutingKey) equipmentSearch = new ElasticHarvest(harvesterApp, options.es_url, options.es_index, 'equipment'); equipmentSearch.setHarvestRoute(harvesterApp.createdResources['equipment']); @@ -97,6 +102,7 @@ function createAndConfigure() { */ module.exports = function () { var that = this; + that.personRoutingKey = personRoutingKey return createAndConfigure().spread(function (app, peopleSearch) { app.listen(config.harvester.port); that.harvesterApp = app;
Exposed customRouting key for use in tests.
agco_elastic-harvesterjs
train
js
c1b1b1115294d9af4c5138bbf6c34eac219d91f6
diff --git a/topgg/errors.py b/topgg/errors.py index <HASH>..<HASH> 100644 --- a/topgg/errors.py +++ b/topgg/errors.py @@ -70,46 +70,30 @@ class HTTPException(TopGGException): class Unauthorized(HTTPException): - """Exception that's thrown when status code 401 occurs. - - Subclass of :exc:`HTTPException` - """ + """Exception that's thrown when status code 401 occurs.""" pass class UnauthorizedDetected(TopGGException): - """Exception that's thrown when no API Token is provided. - - Subclass of :exc:`TopGGException` - """ + """Exception that's thrown when no API Token is provided.""" pass class Forbidden(HTTPException): - """Exception that's thrown when status code 403 occurs. - - Subclass of :exc:`HTTPException` - """ + """Exception that's thrown when status code 403 occurs.""" pass class NotFound(HTTPException): - """Exception that's thrown when status code 404 occurs. - - Subclass of :exc:`HTTPException` - """ + """Exception that's thrown when status code 404 occurs.""" pass class ServerError(HTTPException): - """Exception that's thrown when Top.gg returns "Server Error" responses - (status codes such as 500 and 503). - - Subclass of :exc:`HTTPException` - """ + """Exception that's thrown when Top.gg returns "Server Error" responses (status codes such as 500 and 503).""" pass
Exception inheritance in docstrings rephrased
DiscordBotList_DBL-Python-Library
train
py
5991aac9b790b2c41394262f7a036d22982debc2
diff --git a/test/gorpc_protocols_flavor.py b/test/gorpc_protocols_flavor.py index <HASH>..<HASH> 100644 --- a/test/gorpc_protocols_flavor.py +++ b/test/gorpc_protocols_flavor.py @@ -45,7 +45,6 @@ class GoRpcProtocolsFlavor(protocols_flavor.ProtocolsFlavor): return [ 'bsonrpc-vt-queryservice', 'bsonrpc-vt-tabletmanager', - 'bsonrpc-vt-toporeader', 'bsonrpc-vt-updatestream', 'bsonrpc-vt-vtctl', 'bsonrpc-vt-vtgateservice', diff --git a/test/grpc_protocols_flavor.py b/test/grpc_protocols_flavor.py index <HASH>..<HASH> 100644 --- a/test/grpc_protocols_flavor.py +++ b/test/grpc_protocols_flavor.py @@ -41,7 +41,6 @@ class GRpcProtocolsFlavor(protocols_flavor.ProtocolsFlavor): def service_map(self): return [ - 'bsonrpc-vt-toporeader', 'bsonrpc-vt-vtgateservice', 'grpc-queryservice', 'grpc-updatestream',
Removed toporeader from service map in tests.
vitessio_vitess
train
py,py
1994a2678465833199f45f686f8ca191782be8c3
diff --git a/master/buildbot/test/unit/test_process_properties.py b/master/buildbot/test/unit/test_process_properties.py index <HASH>..<HASH> 100644 --- a/master/buildbot/test/unit/test_process_properties.py +++ b/master/buildbot/test/unit/test_process_properties.py @@ -1534,6 +1534,11 @@ class Renderer(unittest.TestCase): self.assertIn('args=[\'a\']', repr(rend)) self.assertIn('kwargs={\'kwarg\': \'kw\'}', repr(rend)) + @defer.inlineCallbacks + def test_interpolate_worker(self): + rend = yield self.build.render(Interpolate("%(worker:test)s")) + self.assertEqual(rend, "test") + class Compare(unittest.TestCase): @@ -1585,6 +1590,11 @@ class Compare(unittest.TestCase): Interpolate('testing: %(kw:test)s', test="test", other=3), Interpolate('testing: %(kw:test)s', test="test", other=3)) + def test_Interpolate_worker(self): + self.assertEqual( + Interpolate('testing: %(worker:test)s'), + Interpolate('testing: %(worker:test)s')) + def test_renderer(self): self.assertNotEqual( renderer(lambda p: 'val'),
test_process_properties: Test that worker interpolation works
buildbot_buildbot
train
py
c348737fe61f98ce5113fd68359ae989fe012160
diff --git a/test/socket.io.js b/test/socket.io.js index <HASH>..<HASH> 100644 --- a/test/socket.io.js +++ b/test/socket.io.js @@ -1536,7 +1536,7 @@ describe('socket.io', function(){ }); it('should handle very large binary data', function(done){ - this.timeout(10000); + this.timeout(30000); var srv = http(); var sio = io(srv, { perMessageDeflate: false }); var received = 0;
socket.io: increase large binary data test timeout
socketio_socket.io
train
js
619fed746b45b195021bffba1dd3a40e3db70fdc
diff --git a/test/responder_test.rb b/test/responder_test.rb index <HASH>..<HASH> 100644 --- a/test/responder_test.rb +++ b/test/responder_test.rb @@ -68,7 +68,7 @@ class ResponderTest < ActionController::TestCase end tests SingersController - test "returns non-represented json of model by falling back to Rails default responding" do + test "returns non-represented json of model by falling back to Rails default responding when supressed in respond_with" do singer = Singer.new('Bumi', 42) get do @@ -77,6 +77,18 @@ class ResponderTest < ActionController::TestCase assert_equal singer.to_json, @response.body end + + test "return non-represented json model by falling back to Rails default responding when supressed in the configuration" do + singer = Singer.new('Bumi', 42) + + Rails.application.config.representer.represented_formats = [] + get do + respond_with singer + end + Rails.application.config.representer.represented_formats = nil + + assert_equal singer.to_json, @response.body + end end class ProvidingRepresenterForFormatTest < ResponderTest
Add test for supressing the representation for specific formats from the application configuration.
apotonick_roar-rails
train
rb
4142a431b501e1814a93113b4fbc305e393751ec
diff --git a/lib/model/folder_sendonly.go b/lib/model/folder_sendonly.go index <HASH>..<HASH> 100644 --- a/lib/model/folder_sendonly.go +++ b/lib/model/folder_sendonly.go @@ -92,7 +92,7 @@ func (f *sendOnlyFolder) Override() { } func (f *sendOnlyFolder) override() { - l.Infof("Overriding global state on folder %v", f.Description) + l.Infoln("Overriding global state on folder", f.Description()) f.setState(FolderScanning) defer f.setState(FolderIdle)
model: Actually print folder description in "Overriding" log message
syncthing_syncthing
train
go
53568559c817e8e5294cf4e09bf29e3080d92b67
diff --git a/src/main/java/org/apache/jmeter/JMeterMojo.java b/src/main/java/org/apache/jmeter/JMeterMojo.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/apache/jmeter/JMeterMojo.java +++ b/src/main/java/org/apache/jmeter/JMeterMojo.java @@ -310,12 +310,15 @@ public class JMeterMojo extends AbstractMojo { */ private void checkForErrors(List<String> results) throws MojoExecutionException, MojoFailureException { ErrorScanner scanner = new ErrorScanner(this.jmeterIgnoreError, this.jmeterIgnoreFailure); + int errorCount = 0; try { for (String file : results) { if (scanner.scanForProblems(new File(file))) { - getLog().warn("There were test errors. See the jmeter logs for details"); + errorCount++; } } + getLog().info("\n\nResults :\n\n"); + getLog().info("Tests Run: " + results.size() + ", Errors: " + errorCount +"\n\n"); } catch (IOException e) { throw new MojoExecutionException("Can't read log file", e); }
Error checking tweaked to display tests run as well as number of failures.
jmeter-maven-plugin_jmeter-maven-plugin
train
java
f8fbe6aaad57340cc5dfaf28f80306b46e742740
diff --git a/examples/plotting/file/stocks.py b/examples/plotting/file/stocks.py index <HASH>..<HASH> 100644 --- a/examples/plotting/file/stocks.py +++ b/examples/plotting/file/stocks.py @@ -44,7 +44,7 @@ def stocks(): scatter(aapl_dates, aapl, x_axis_type = "datetime", - color='#A6CEE3', radius=1, tools="pan,zoom,resize,embed", legend='close') + color='#A6CEE3', radius=1, tools="pan,zoom,resize", legend='close') line(aapl_dates, aapl_avg, color='red', tools="pan,zoom,resize", legend='avg', name="stocks")
removed embed_tool because it isn't applicable to file based plots
bokeh_bokeh
train
py
0e25791422353ce4c832567ecaeffd4bc1460635
diff --git a/rpcclient.go b/rpcclient.go index <HASH>..<HASH> 100644 --- a/rpcclient.go +++ b/rpcclient.go @@ -266,7 +266,7 @@ func NewRpcClientPool(transmissionType string, replyTimeout time.Duration) *RpcC } func (pool *RpcClientPool) AddClient(rcc RpcClientConnection) { - if rcc != nil { + if rcc != nil && !reflect.ValueOf(rcc).IsNil() { pool.connections = append(pool.connections, rcc) } }
Make sure we don't hide nil into interface for connections in the pool
cgrates_rpcclient
train
go
ceafae0ab2cb52c8b9fde100caf91fde9afaa5e1
diff --git a/discord/gateway.py b/discord/gateway.py index <HASH>..<HASH> 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -63,6 +63,7 @@ class KeepAliveHandler(threading.Thread): self.msg = 'Keeping websocket alive with sequence %s.' self._stop_ev = threading.Event() self._last_ack = time.time() + self._last_send = time.time() def run(self): while not self._stop_ev.wait(self.interval): @@ -88,6 +89,8 @@ class KeepAliveHandler(threading.Thread): f.result() except Exception: self.stop() + else: + self._last_send = time.time() def get_payload(self): return { @@ -408,6 +411,12 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol): for index in reversed(removed): del self._dispatch_listeners[index] + @property + def latency(self): + """float: Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds.""" + heartbeat = self._keep_alive + return float('inf') if heartbeat is None else heartbeat._last_ack - heartbeat._last_send + def _can_handle_close(self, code): return code not in (1000, 4004, 4010, 4011)
Add DiscordWebSocket.latency to measure discord heartbeat latency.
Rapptz_discord.py
train
py