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
23fc43f3ef947cf464ce3f97e2babf395bed6bbd
diff --git a/core2/main.go b/core2/main.go index <HASH>..<HASH> 100644 --- a/core2/main.go +++ b/core2/main.go @@ -154,6 +154,10 @@ func (c *Core) CleanupLeftoverTasks() { task.ArchiveUUID, task.UUID, err) continue } + if archive == nil { + log.Infof("task %s was a backup task, but associated archive (%s) was never created; skipping...", task.UUID, task.ArchiveUUID) + continue + } log.Infof("task %s was a backup task, associated with archive %s; purging the archive", task.UUID, archive.UUID) task, err := c.db.CreatePurgeTask("", archive) if err != nil {
Avoid purging backup tasks that have no archives associated
starkandwayne_shield
train
go
29ae0bd341842df4f6aaf0e987a87de83dfc095e
diff --git a/lib/functions.php b/lib/functions.php index <HASH>..<HASH> 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -258,10 +258,13 @@ function __doResolve($name, array $types, $options) { yield new CoroutineResult(\Amp\resolve(__doResolve($name, $types, $options))); } } catch (ResolutionException $e) { - // if we have no cached results - if (empty($result)) { + if (empty($result)) { // if we have no cached results throw $e; } + } catch (\RuntimeException $e) { // if all promises in Amp\some fail + if (empty($result)) { // if we have no cached results + throw new ResolutionException("All name resolution requests failed", 0, $e); + } } yield new CoroutineResult($result);
Catch RuntimeException from Amp\some and turn it into ResolutionException
amphp_dns
train
php
50b366e08159b68286b2eae43732392d634e5f73
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -41,7 +41,7 @@ function merge(a, b) { out = out.concat(a); b.forEach(function(value) { if(typeof value === 'object') { - out.push(merge([], value)); + out.push(merge(Array.isArray(value) ? [] : {}, value)); } else { out.push(value); } diff --git a/tests/test_index.js b/tests/test_index.js index <HASH>..<HASH> 100644 --- a/tests/test_index.js +++ b/tests/test_index.js @@ -110,6 +110,16 @@ describe('Test utilities', function() { expect(r).to.deep.equal(o); }); + it('should merge object within array', function() { + var a = [[1, 2, 3], { a: 'b' }]; + var b = [1, 2, 3]; + + var out = merge(a, b); + + var expected = [[1,2,3], {a: 'b'}, 1,2,3]; + expect(out).to.deep.equal(expected); + }); + it('should handle merge object and array', function() { var a = { a: 'b'
added check to ensure merging objects to objects
limianwang_node-utilities
train
js,js
b898ed4941e0107739bdde771d52aa4b9cc14886
diff --git a/lib/marmot/client.rb b/lib/marmot/client.rb index <HASH>..<HASH> 100644 --- a/lib/marmot/client.rb +++ b/lib/marmot/client.rb @@ -12,7 +12,7 @@ module Marmot @@headers_set = false def initialize - logger = ::Logger.new("/dev/null") + logger = ::Logger.new(STDOUT) logger.close end
Support logger on Windows support /dev/null doesn't exist on windows. As a workaround I think logging to STDOUT by default is ok.
petethepig_marmot
train
rb
d0437610bb95ed513874c8346f658a6b9e4bf616
diff --git a/wandb/agent.py b/wandb/agent.py index <HASH>..<HASH> 100644 --- a/wandb/agent.py +++ b/wandb/agent.py @@ -101,7 +101,7 @@ class Agent(object): def _command_run(self, command): config = Config.from_environment_or_defaults() - run = wandb_run.Run(mode='run', config=config) + run = wandb_run.Run(mode='run', config=config, sweep_id=self._sweep_id) api = Api() api.set_current_run_id(run.id) @@ -125,7 +125,6 @@ class Agent(object): run.storage_id = upsert_result['id'] env = dict(os.environ) run.set_environment(env) - env['WANDB_SWEEP_ID'] = self._sweep_id # TODO(adrian): we need to do the following if we use pipes instead of PTYs (eg. for windows) # tell child python interpreters we accept utf-8 # env['PYTHONIOENCODING'] = 'UTF-8' @@ -133,6 +132,7 @@ class Agent(object): self._run_managers[run.id] = sync.Sync(api, run, program, args, env) def _command_stop(self, command): + run_id = command['run_id'] logger.info('Stop: %s', run_id) if run_id in self._run_managers: self._run_managers[run_id].proc.kill()
Agent: Fix setting sweep_id, fix stopping runs
wandb_client
train
py
71c3f32f523af8f98379896f20c284b515978f0e
diff --git a/src/Listener/AbstractEventListener.php b/src/Listener/AbstractEventListener.php index <HASH>..<HASH> 100644 --- a/src/Listener/AbstractEventListener.php +++ b/src/Listener/AbstractEventListener.php @@ -24,7 +24,7 @@ abstract class AbstractEventListener implements EventListenerInterface { $this->eventMessage = $eventMessage; - $this->getMethod($eventMessage, 'listen')($eventMessage->getPayload()); + $this->getMethod($eventMessage, 'on')($eventMessage->getPayload()); } /** diff --git a/test/Listener/AbstractEventListenerTest.php b/test/Listener/AbstractEventListenerTest.php index <HASH>..<HASH> 100644 --- a/test/Listener/AbstractEventListenerTest.php +++ b/test/Listener/AbstractEventListenerTest.php @@ -58,7 +58,7 @@ class ListenerStub extends AbstractEventListener /** * @param PayloadInterface $payload */ - public function listenPayloadStub(PayloadInterface $payload): void + public function onPayloadStub(PayloadInterface $payload): void { $this->payload = $payload; }
Changed prefix for payload method.
extendsframework_extends-event
train
php,php
28460f11e8d95d7eea2444bcc90dd47d7eb70117
diff --git a/lib/webinterface_handler_wsgi.py b/lib/webinterface_handler_wsgi.py index <HASH>..<HASH> 100644 --- a/lib/webinterface_handler_wsgi.py +++ b/lib/webinterface_handler_wsgi.py @@ -29,12 +29,6 @@ from urlparse import urlparse, urlunparse from wsgiref.util import FileWrapper -if __name__ != "__main__": - # Chances are that we are inside mod_wsgi. - ## You can't write to stdout in mod_wsgi, but some of our - ## dependecies do this! (e.g. 4Suite) - sys.stdout = sys.stderr - from invenio.webinterface_handler_wsgi_utils import table from invenio.webinterface_handler_config import \ HTTP_STATUS_MAP, SERVER_RETURN, OK, DONE, \
WebStyle: fix stdout redirect for mod_wsgi and shell * Due to module dependencies webinterface_handler_wsgi is loaded even for Invenio CLI commands, meaning that stdout is redirect to stderr. This fix moves the redirect from the WSGI handler to the WSGI script.
inveniosoftware_invenio-base
train
py
5bb5d50f774d34b03669627741855c658684568d
diff --git a/src/Pecee/Pixie/Exception.php b/src/Pecee/Pixie/Exception.php index <HASH>..<HASH> 100644 --- a/src/Pecee/Pixie/Exception.php +++ b/src/Pecee/Pixie/Exception.php @@ -14,7 +14,7 @@ class Exception extends \Exception protected $query; - public function __construct(string $message = '', int $code = 0, QueryObject $query = null) + public function __construct(string $message = '', $code = 0, QueryObject $query = null) { parent::__construct($message, $code); $this->query = $query;
Changed type for code as some exceptions doesn't provide proper data-type.
skipperbent_pecee-pixie
train
php
8e815eab1252a8961d01117ca5d2b0129a86faa0
diff --git a/core/src/main/java/org/jboss/hal/core/mbui/form/DefaultFormItemProvider.java b/core/src/main/java/org/jboss/hal/core/mbui/form/DefaultFormItemProvider.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/org/jboss/hal/core/mbui/form/DefaultFormItemProvider.java +++ b/core/src/main/java/org/jboss/hal/core/mbui/form/DefaultFormItemProvider.java @@ -220,7 +220,7 @@ class DefaultFormItemProvider implements FormItemProvider { Core.INSTANCE.eventBus().fireEvent(event); }); } - if (readOnly || runtime) { + if (readOnly) { formItem.setEnabled(false); } }
HAL-<I>: Enable form items for runtime attributes
hal_console
train
java
9a1a6f97c880b3a7b956fe9c4fe063771a9fc04d
diff --git a/FloatLabel/src/com/iangclifton/android/floatlabel/FloatLabel.java b/FloatLabel/src/com/iangclifton/android/floatlabel/FloatLabel.java index <HASH>..<HASH> 100644 --- a/FloatLabel/src/com/iangclifton/android/floatlabel/FloatLabel.java +++ b/FloatLabel/src/com/iangclifton/android/floatlabel/FloatLabel.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2014 Ian G. Clifton + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.iangclifton.android.floatlabel; import android.annotation.TargetApi;
License info added to FloatLabel.java Standard Apache <I> license header added to the FloatLabel class for people who miss the LICENSE file.
IanGClifton_AndroidFloatLabel
train
java
073b3be1d029b7b03e53b42ec665a089fd8413ce
diff --git a/cheroot/test/test_ssl.py b/cheroot/test/test_ssl.py index <HASH>..<HASH> 100644 --- a/cheroot/test/test_ssl.py +++ b/cheroot/test/test_ssl.py @@ -17,6 +17,7 @@ import trustme from .._compat import bton, ntob, ntou from ..server import Gateway, HTTPServer, get_ssl_adapter_class +from ..ssl.builtin import IS_ABOVE_OPENSSL10 from ..testing import ( ANY_INTERFACE_IPV4, ANY_INTERFACE_IPV6, @@ -264,7 +265,11 @@ def test_https_over_http_error(http_server, ip_addr): port=port, ) ).request('GET', '/') - assert 'wrong version number' in str(ssl_err.value) + expected_substring = ( + 'wrong version number' if IS_ABOVE_OPENSSL10 + else 'unknown protocol' + ) + assert expected_substring in ssl_err.value.args[-1] @pytest.mark.parametrize(
🐛 Fix test_https_over_http_error expectations
cherrypy_cheroot
train
py
bd2a387a4326055c50f1160c297a0b654c23c8e1
diff --git a/test/rollup/rollup.config.js b/test/rollup/rollup.config.js index <HASH>..<HASH> 100644 --- a/test/rollup/rollup.config.js +++ b/test/rollup/rollup.config.js @@ -5,7 +5,8 @@ export default { input: 'test/rollup/main.js', output: { file: 'test/rollup/dist/main.js', - format: 'cjs' + format: 'iife', + name: 'RunFastCheck' }, plugins: [ resolve(), cjs() ],
Rollup should build iife module first Basically IIFE and ESM are the two recommended build formats for web applications. Both of them need to be supported correctly.
dubzzz_fast-check
train
js
6d08bda6297dec7d901cbf0c108af6996a24ed23
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( author = "Eldarion", author_email = "[email protected]", description = "a reusable Django badges application", - long_description = open("README").read(), + long_description = open("README.md").read(), license = "BSD", url = "http://github.com/eldarion/brabeion", packages = [
Point setup.py to README.md
pinax_pinax-badges
train
py
6b840681ffbf6425ea7f0e4b5e6ab4263b0b6240
diff --git a/library/src/com/jakewharton/android/actionbarsherlock/ActionBarSherlock.java b/library/src/com/jakewharton/android/actionbarsherlock/ActionBarSherlock.java index <HASH>..<HASH> 100644 --- a/library/src/com/jakewharton/android/actionbarsherlock/ActionBarSherlock.java +++ b/library/src/com/jakewharton/android/actionbarsherlock/ActionBarSherlock.java @@ -16,7 +16,6 @@ package com.jakewharton.android.actionbarsherlock; -import android.app.ActionBar; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; @@ -447,9 +446,9 @@ public final class ActionBarSherlock { /** * Minimal handler for Android's native {@link android.app.ActionBar}. */ - public static class NativeActionBarHandler extends ActionBarHandler<ActionBar> { + public static class NativeActionBarHandler extends ActionBarHandler<android.app.ActionBar> { @Override - public ActionBar initialize(int layoutResourceId) { + public android.app.ActionBar initialize(int layoutResourceId) { //For native action bars assigning a layout is all that is required this.getActivity().setContentView(layoutResourceId); @@ -457,7 +456,7 @@ public final class ActionBarSherlock { } @Override - public ActionBar initialize(View view) { + public android.app.ActionBar initialize(View view) { //For native action bars assigning a layout is all that is required this.getActivity().setContentView(view);
Use direct package reference to the native action bar.
JakeWharton_ActionBarSherlock
train
java
21d64b7126b4c43c8ddd52bcaf86055876981b6e
diff --git a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php index <HASH>..<HASH> 100644 --- a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php @@ -368,7 +368,7 @@ class MySqlPlatform extends AbstractPlatform $query .= 'TABLE ' . $tableName . ' (' . $queryFields . ') '; if (isset($options['comment'])) { - $query .= 'COMMENT = ' . $options['comment'] . ' '; + $query .= sprintf("COMMENT = '%s' ", $options['comment']); } if ( ! isset($options['charset'])) {
Fixed bug with comments not adding quotes for tables.
doctrine_dbal
train
php
a3f4ec25c297e45216b60461e9dc61931bbab728
diff --git a/cerberus/tests/tests.py b/cerberus/tests/tests.py index <HASH>..<HASH> 100644 --- a/cerberus/tests/tests.py +++ b/cerberus/tests/tests.py @@ -30,7 +30,7 @@ class TestValidator(TestBase): try: func(*args, **kwargs) except SchemaError as e: - self.assertIn(err_msg, str(e)) + self.assertTrue(err_msg in str(e)) else: self.fail('SchemaError not raised')
Make the annoyance that is Python <I> happy
pyeve_cerberus
train
py
259e211ba0c3bbf3dd50c28dea57cb7887642fe3
diff --git a/src/Utils/Dimension.php b/src/Utils/Dimension.php index <HASH>..<HASH> 100644 --- a/src/Utils/Dimension.php +++ b/src/Utils/Dimension.php @@ -55,7 +55,7 @@ class Dimension { * @return rendered dimension */ public static function &fromOptions($options, - $scale_spec=array(), $scale_model='scale-to-dimension') { + $scale_spec=array(), $scale_model='scale-width-height') { // render Dimension according to scale model switch ($scale_model) {
Use 'scale-width-height' as default scale model 'scale-to-dimension' is renamed. Follow the rename.
phata_widgetfy
train
php
02a7aa3adc32205c96e6b3f07c9d425da3a9a310
diff --git a/geohub.js b/geohub.js index <HASH>..<HASH> 100755 --- a/geohub.js +++ b/geohub.js @@ -1,7 +1,30 @@ -var request = require('request'); +var request = require('request'), + GitHubApi = require('github'); + +var github = new GitHubApi({ + version: "3.0.0", + timeout: 5000 +}); module.exports = { + // scan repo for "geojson files" + repo: function( user, repo, path, callback ){ + var url = 'https://raw.github.com/'+ user + '/' + repo + '/master/' + path + '.geojson'; + request(url, function( error, response, body ){ + if (!error && response.statusCode == 200) { + var json = JSON.parse( body ); + try { + if (json.type && json.type == 'FeatureCollection'){ + callback( null, json ); + } + } catch (e){ + callback('Error: could not parse file contents' + e, null); + } + } + }); + }, + gist: function( id, callback ){ var url = 'https://api.github.com/gists/' + id; request.get(url, function (error, response, body) {
github geojson is working
koopjs_geohub
train
js
8467f0418c0e97b464e908ddc500671eb7bc699e
diff --git a/framework/directives/gestureDetector.js b/framework/directives/gestureDetector.js index <HASH>..<HASH> 100755 --- a/framework/directives/gestureDetector.js +++ b/framework/directives/gestureDetector.js @@ -56,8 +56,12 @@ } }; - var gestureDetector = element[0]._gestureDetector; - gestureDetector.on(EVENTS.join(' '), handler); + var gestureDetector; + + setImmediate(function() { + gestureDetector = element[0]._gestureDetector; + gestureDetector.on(EVENTS.join(' '), handler); + }); $onsen.cleaner.onDestroy(scope, function() { gestureDetector.off(EVENTS.join(' '), handler);
fix(ons-gesture-detector): Fixed Custom Elements timing.
OnsenUI_OnsenUI
train
js
1cacde7acdb675ba0cb270f5e2e46540d8a9b771
diff --git a/test/test_helper.rb b/test/test_helper.rb index <HASH>..<HASH> 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -3,13 +3,14 @@ require "http_monkey" require "minitest/autorun" require "minitest/reporters" -require "mocha" +require "mocha/setup" require "support/fake_environment" require "support/captain_hook" MiniTest::Unit.runner = MiniTest::SuiteRunner.new -MiniTest::Unit.runner.reporters << MiniTest::Reporters::SpecReporter.new +MiniTest::Unit.runner.reporters << MiniTest::Reporters::DefaultReporter.new +#MiniTest::Unit.runner.reporters << MiniTest::Reporters::SpecReporter.new MiniTest::Unit.runner.reporters << HttpMonkey::Support::CaptainHook.new require "minion_server"
Fix mocha warning and change to default report
rogerleite_http_monkey
train
rb
a395c44cb0f6e294f2556fafeeafca305213ddff
diff --git a/crysp/bits.py b/crysp/bits.py index <HASH>..<HASH> 100644 --- a/crysp/bits.py +++ b/crysp/bits.py @@ -85,18 +85,15 @@ class Bits(object): if size!=None: self.size = size def load(self,bytestr,bitorder=-1): - if bitorder==1: - b,size = unpack(bytestr) - self.ival = b - self.size = size - else: - self.size = len(bytestr)*8 + self.size = len(bytestr)*8 + f = ord + if bitorder==-1: f = lambda c: reverse_byte(ord(c)) - v = 0 - l = reversed([f(c) for c in bytestr]) - for o in l: - v = (v<<8) | o - self.ival = v + v = 0 + l = reversed([f(c) for c in bytestr]) + for o in l: + v = (v<<8) | o + self.ival = v def __len__(self): return self.size
revert load method (unpack is slower)
bdcht_crysp
train
py
d7a650ab7f2c0e8407e8cb947638b43a34772036
diff --git a/test/spec/CodeHint-test.js b/test/spec/CodeHint-test.js index <HASH>..<HASH> 100644 --- a/test/spec/CodeHint-test.js +++ b/test/spec/CodeHint-test.js @@ -202,7 +202,7 @@ define(function (require, exports, module) { editor = EditorManager.getCurrentFullEditor(); expect(editor).toBeTruthy(); - CodeHintManager._getCodeHintList()._handleKeydown(e); + CodeHintManager._getCodeHintList()._keydownHook(e); // doesn't matter what was inserted, but line should be different var newPos = editor.getCursorPos();
Fix missed rename in CodeHintManager unit test
adobe_brackets
train
js
942a2053f49728f2f070800ab7cbc9d9a05a2fd2
diff --git a/lib/base.js b/lib/base.js index <HASH>..<HASH> 100644 --- a/lib/base.js +++ b/lib/base.js @@ -24,7 +24,7 @@ var JasmineBridge = function(){ var spec = this.env[api].call(this.env, desc, function(done){ self.currentSpec = new JasmineBridge.Spec(self, {}, desc); //self != this here - fn.call(this); + fn.call(this.userContext); self.currentSpec.execute(function(){ self.currentSpec =null;
Fix about userContext when Spec is called.
lroche_karma-jasmine-bridge
train
js
a1361642c6fc562a2980a7a73f31b08b5f16d159
diff --git a/phy/plot/tests/test_utils.py b/phy/plot/tests/test_utils.py index <HASH>..<HASH> 100644 --- a/phy/plot/tests/test_utils.py +++ b/phy/plot/tests/test_utils.py @@ -70,4 +70,7 @@ def test_lasso(): [-.8, +.8], [-.8, -.8], ] - view = _show_visual(lasso, grid=True) + view = _show_visual(lasso, grid=True, stop=False) + view.visual.add_point([+.8, -.8]) + show_test_run(view, _N_FRAMES) + show_test_stop(view)
WIP: adding points in lasso.
kwikteam_phy
train
py
35213e984d56f23fee15e77a2f151e974e15e562
diff --git a/public/js/editor.js b/public/js/editor.js index <HASH>..<HASH> 100644 --- a/public/js/editor.js +++ b/public/js/editor.js @@ -62,9 +62,11 @@ function AposPeople(optionsArg) { // Suggest full name if none yet or it doesn't have both first and last yet function updateName() { var $name = $el.findByName('title'); - - if ($name.val() && $name.val().indexOf(' ') === -1) { - $name.val(($firstName.val() + ' ' + $lastName.val()).replace(/ +$/, '')); + var firstName = $firstName.val(); + var lastName = $lastName.val(); + if (firstName.length && lastName.length && (!$name.val().length)) { + var suggestion = (firstName + ' ' + lastName); + $name.val(suggestion); } return true; }
fixed the automatic full name suggester, which has been busted for however long...
apostrophecms-legacy_apostrophe-people
train
js
ed17512c3a3cee0131f24623fea4d119ea1edd8b
diff --git a/tests/test_parser.py b/tests/test_parser.py index <HASH>..<HASH> 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -813,16 +813,15 @@ def _make_parser_test(LEXER, PARSER): def test_templates(self): g = _Lark(r""" - start: number_list "\n" number_dict + start: "[" sep{NUMBER, ","} "]" sep{item, delim}: item (delim item)* - number_list: "[" sep{NUMBER, ","} "]" - number_dict: "{" sep{(NUMBER ":" NUMBER), ";"} "}" // Just to test this NUMBER: /\d+/ %ignore " " """) - x = g.parse("[1, 2, 3, 4] {1:2, 3:4, 5:6}") - print(x) - x = g.parse("[1] {1:2}") + x = g.parse("[1, 2, 3, 4]") + self.assertSequenceEqual(x.children,['1', '2', '3', '4']) + x = g.parse("[1]") + self.assertSequenceEqual(x.children,['1']) print(x) def test_token_collision_WS(self):
Corrected & Simplified test
lark-parser_lark
train
py
8152688666ce110e71a0131f7193d0b32a4a5f1a
diff --git a/modules/windowPerformance/windowPerformance.js b/modules/windowPerformance/windowPerformance.js index <HASH>..<HASH> 100644 --- a/modules/windowPerformance/windowPerformance.js +++ b/modules/windowPerformance/windowPerformance.js @@ -58,6 +58,22 @@ exports.module = function(phantomas) { }); }); + // fallback for --disable-js mode + var start; + + phantomas.once('recv', function() { + start = (new Date()).getTime(); + }); + + phantomas.on('loadFinished', function() { + var time = (new Date()).getTime() - start; + + if (phantomas.getMetric('windowOnLoadTime') === 0) { + phantomas.setMetric('windowOnLoadTime', time); + phantomas.setMetric('windowOnLoadTimeEnd', time); + } + }); + /** * Emit a notice with backend vs frontend time *
windowPerformance: set "windowOnLoadTime[End]" properly when in --disable-js mode (#<I>)
macbre_phantomas
train
js
9ba54eab7aab27788ac7493ac4dc7b3a626d244a
diff --git a/sentry/client/middleware.py b/sentry/client/middleware.py index <HASH>..<HASH> 100644 --- a/sentry/client/middleware.py +++ b/sentry/client/middleware.py @@ -3,7 +3,7 @@ from sentry.client.models import sentry_exception_handler class Sentry404CatchMiddleware(object): def process_response(self, request, response): if response.status_code != 404: - return + return response sentry_exception_handler(sender=Sentry404CatchMiddleware, request=request) return response @@ -14,6 +14,6 @@ class SentryResponseErrorIdMiddleware(object): """ def process_response(self, request, response): if not getattr(request, 'sentry', None): - return + return response response['X-Sentry-ID'] = request.sentry['id'] return response
Make sure ALL middleware returns a response
elastic_apm-agent-python
train
py
33772814e2356bdf1da8ad431af59d60713ab146
diff --git a/tests/support/unit.py b/tests/support/unit.py index <HASH>..<HASH> 100644 --- a/tests/support/unit.py +++ b/tests/support/unit.py @@ -33,8 +33,7 @@ from unittest import TestResult from unittest import TestSuite as _TestSuite from unittest import TextTestResult as _TextTestResult from unittest import TextTestRunner as _TextTestRunner -from unittest import expectedFailure, skip -from unittest import skipIf as _skipIf +from unittest import expectedFailure, skip, skipIf from unittest.case import SkipTest, _id from salt.ext import six @@ -394,16 +393,6 @@ class TextTestRunner(_TextTestRunner): resultclass = TextTestResult -def skipIf(skip, reason): - from tests.support.runtests import RUNTIME_VARS - - if RUNTIME_VARS.PYTEST_SESSION: - import pytest - - return pytest.mark.skipif(skip, reason=reason) - return _skipIf(skip, reason) - - __all__ = [ "TestLoader", "TextTestRunner",
This was a bad idea caught soon enough.
saltstack_salt
train
py
d4f2e18288cc4a7f9d48cfc58c8a07c9abe4ee9e
diff --git a/holoviews/element/chart.py b/holoviews/element/chart.py index <HASH>..<HASH> 100644 --- a/holoviews/element/chart.py +++ b/holoviews/element/chart.py @@ -373,7 +373,7 @@ class Spikes(Chart): group = param.String(default='Spikes', constant=True) - kdims = param.List(default=[Dimension('x')]) + kdims = param.List(default=[Dimension('x')], bounds=(1, 1)) vdims = param.List(default=[])
Allowed only one kdim on Spikes Element
pyviz_holoviews
train
py
956320ee12ccc459cf6abc26cccfc005415d3ef2
diff --git a/connection/requests_factory.py b/connection/requests_factory.py index <HASH>..<HASH> 100644 --- a/connection/requests_factory.py +++ b/connection/requests_factory.py @@ -231,7 +231,7 @@ class HttpRequestsFactory(object): if tries > 1: if not (second_api_key and self.api_key != second_api_key and tries < 3): raise exceptions.ErrorResponseException("Unauthorized") - api_name, secret = self.second_api_key.split('/', 1) + api_name, secret = second_api_key.split('/', 1) tries += 1 authenticate = oath.headers.__getitem__("www-authenticate")[len("Raven "):]
fix bug in the requests_factory.py
ravendb_ravendb-python-client
train
py
5933cb5ea65de20f6ac16f76321ffb7d608c4942
diff --git a/lib/acts_as_indexed.rb b/lib/acts_as_indexed.rb index <HASH>..<HASH> 100644 --- a/lib/acts_as_indexed.rb +++ b/lib/acts_as_indexed.rb @@ -142,7 +142,7 @@ module Foo #:nodoc: with_scope :find => find_options do # Doing the find like this eliminates the possibility of errors occuring # on either missing records (out-of-sync) or an empty results array. - records = find(:all, :conditions => [ "#{class_name.tableize}.id IN (?)", part_query]) + records = find(:all, :conditions => [ "#{table_name}.id IN (?)", part_query]) if find_options.include?(:order) records # Just return the records without ranking them.
Now supports non-standard table names automatically. (Patch by Nanda Lopes)
dougal_acts_as_indexed
train
rb
f7b1c6cea053e7357d031345217321d6f69a61ce
diff --git a/ORM/Repository.php b/ORM/Repository.php index <HASH>..<HASH> 100644 --- a/ORM/Repository.php +++ b/ORM/Repository.php @@ -71,7 +71,7 @@ class Repository /** * @return array */ - protected function getTypes() + public function getTypes() { $types = []; $meta = $this->manager->getBundlesMapping($this->namespaces);
Repository::getTypes encapsulation changed
ongr-io_ElasticsearchBundle
train
php
8402bb07c1242183e23c11063e12f6951f986373
diff --git a/gui/src/main/java/org/jboss/as/console/client/shared/deployment/DeploymentBrowser.java b/gui/src/main/java/org/jboss/as/console/client/shared/deployment/DeploymentBrowser.java index <HASH>..<HASH> 100644 --- a/gui/src/main/java/org/jboss/as/console/client/shared/deployment/DeploymentBrowser.java +++ b/gui/src/main/java/org/jboss/as/console/client/shared/deployment/DeploymentBrowser.java @@ -116,8 +116,7 @@ public class DeploymentBrowser addContext(DeployedPersistenceUnit.class, index++, new TextAreaItem("name", "Name"), - new CheckBoxItem("enabled", "Statistics Enabled"), - new ListItem("entities", "Entities")); + new CheckBoxItem("enabled", "Statistics Enabled")); addContext(DeployedServlet.class, index++, new TextAreaItem("name", "Name"),
remove entity list from deployment browser JPA view: it will blow the screen if too many entities are given
hal_core
train
java
3865d36b84709abf4d2a1fbb3e9cf501262754ad
diff --git a/classes/ezpage.php b/classes/ezpage.php index <HASH>..<HASH> 100644 --- a/classes/ezpage.php +++ b/classes/ezpage.php @@ -119,6 +119,21 @@ class eZPage } } + $zones = eZINI::instance( 'zone.ini' )->variable( $newObj->attribute( 'zone_layout' ), 'Zones' ); + foreach ( $zones as $zoneIdentifier ) + { + foreach ( $newObj->attribute( 'zones' ) as $inObjectZone ) + { + if ( $inObjectZone->attribute( 'zone_identifier' ) === $zoneIdentifier ) + continue 2; + } + + $newZone = $newObj->addZone( new eZPageZone() ); + $newZone->setAttribute( 'id', md5( mt_rand() . microtime() . $newObj->getZoneCount() ) ); + $newZone->setAttribute( 'zone_identifier', $zoneIdentifier ); + $newZone->setAttribute( 'action', 'add' ); + } + return $newObj; }
Fixed EZP-<I>: eZ Flow layout zone changes are not immediately visible Based on jjCavalleri's pull request
ezsystems_ezflow-ls-extension
train
php
3590a97bc4035cea0c2834dccdc7defb060d42d7
diff --git a/src/Auth/Role.php b/src/Auth/Role.php index <HASH>..<HASH> 100644 --- a/src/Auth/Role.php +++ b/src/Auth/Role.php @@ -103,6 +103,10 @@ class Role { $model[$auth_id_field] == $this->token->auth_id); } + protected function checkTrusted () { + return static::isTrusted(); + } + protected function checkRole($role) { return ($this->token && $this->token->role == $role); }
fix built-in 'trusted' role check.
doubleleft_hook
train
php
443fcbe1bf97dd2c880c37f7f55a0f5311beb542
diff --git a/spec/lib/rake/extensiontask_spec.rb b/spec/lib/rake/extensiontask_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/rake/extensiontask_spec.rb +++ b/spec/lib/rake/extensiontask_spec.rb @@ -152,7 +152,6 @@ describe Rake::ExtensionTask do describe 'tmp/{platform}/extension_one/Makefile' do it 'should define as task' do - puts Rake.application.tasks.inspect Rake::Task.task_defined?("tmp/#{@platform}/extension_one/Makefile").should be_true end
Removed debug info from specs (commit miss).
rake-compiler_rake-compiler
train
rb
f23436b991afe15586ef72f32585861a28a51d18
diff --git a/hazelcast/src/main/java/com/hazelcast/transaction/impl/TransactionImpl.java b/hazelcast/src/main/java/com/hazelcast/transaction/impl/TransactionImpl.java index <HASH>..<HASH> 100644 --- a/hazelcast/src/main/java/com/hazelcast/transaction/impl/TransactionImpl.java +++ b/hazelcast/src/main/java/com/hazelcast/transaction/impl/TransactionImpl.java @@ -29,7 +29,6 @@ import com.hazelcast.util.ExceptionUtil; import java.util.*; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import java.util.logging.Level; import static com.hazelcast.transaction.TransactionOptions.TransactionType; import static com.hazelcast.transaction.impl.Transaction.State.*; @@ -98,7 +97,9 @@ final class TransactionImpl implements Transaction, TransactionSupport { if (transactionLog instanceof KeyAwareTransactionLog) { KeyAwareTransactionLog keyAwareTransactionLog = (KeyAwareTransactionLog) transactionLog; TransactionLog removed = txLogMap.remove(keyAwareTransactionLog.getKey()); - txLogs.remove(removed); + if (removed != null){ + txLogs.remove(removed); + } } txLogs.add(transactionLog);
fixes full traversal of txLogs unnecessarily
hazelcast_hazelcast
train
java
02d8683f258841f7ccdd62673a88a087b9db1eae
diff --git a/src/basis/net.js b/src/basis/net.js index <HASH>..<HASH> 100644 --- a/src/basis/net.js +++ b/src/basis/net.js @@ -752,5 +752,17 @@ AjaxTransport: AjaxTransport, AjaxRequest: AjaxRequest, - Transport: AjaxTransport + Transport: AjaxTransport, + + request: function(config){ + var transport = new AjaxTransport(config); + transport.addHandler({ + complete: function(){ + setTimeout(function(){ + transport.destroy(); + }, 0); + } + }); + transport.request(); + } };
request function implmented, to make single request
basisjs_basisjs
train
js
55a4139a71b8143fb6fdde226e0bed94e7911270
diff --git a/tests/test_references.py b/tests/test_references.py index <HASH>..<HASH> 100644 --- a/tests/test_references.py +++ b/tests/test_references.py @@ -76,6 +76,18 @@ def test_multi_level_reference(): assert config.key == 'A seemingly full, complete sentence.' +def test_recursive_reference(): + config = Configuration({ + 'ns': {'reference': 'final', + 'final': 'the actual value'}, + 'wanted': '${ns.${ns.reference}}', + }) + + assert config.ns.final == 'the actual value' + assert config.ns.reference == 'final' + assert config.wanted == 'the actual value' + + def test_sub_config_reference(): config = Configuration({ 'key': 'string',
Test nested / recursive reference
HolmesNL_confidence
train
py
aee7a0655c88be94934f7efd1cba2713ba2c63cc
diff --git a/library/BrowserDetector/Detector/Os/Darwin.php b/library/BrowserDetector/Detector/Os/Darwin.php index <HASH>..<HASH> 100644 --- a/library/BrowserDetector/Detector/Os/Darwin.php +++ b/library/BrowserDetector/Detector/Os/Darwin.php @@ -148,6 +148,7 @@ class Darwin new \BrowserDetector\Detector\Browser\Mobile\Terra(), new \BrowserDetector\Detector\Browser\Mobile\Puffin(), new \BrowserDetector\Detector\Browser\Mobile\Omniweb(), + new \BrowserDetector\Detector\Browser\Mobile\AtomicBrowser(), ); $chain = new \BrowserDetector\Detector\Chain();
added AtomicBrowser as Browser for Darwin OS
mimmi20_BrowserDetector
train
php
b6d34c085ea2c2f8444ba7935f311cc7f67a1504
diff --git a/test/e2e/derivatives.js b/test/e2e/derivatives.js index <HASH>..<HASH> 100644 --- a/test/e2e/derivatives.js +++ b/test/e2e/derivatives.js @@ -68,6 +68,30 @@ describe('e2e - Derivatives', function () { }); }); + describe($('d/dx (1/x)'), function () { + it('should match -1/x^2', function () { + var x = new Real('x'); + var y = new Integer(1)['/'](x); + match(y, function (x) { return 1 / x; }, 'x'); + var dy = y.differentiate(x); + dy.should.be.an.instanceof(List.Real); + match(dy, M('-1 / (x^2)'), 'x'); + }); + }); + + + describe($('d/dx (log x)'), function () { + it('should match', function () { + + var x = new Real('x'); + var y = M.Global.log.default(x); + match(y, Math.log, 'x'); + var dy = y.differentiate(x); + dy.should.be.an.instanceof(List.Real); + match(dy, M('1 / x'), 'x'); + }); + }); + describe($('d/dx sin (x * x)'), function () { it($('= 2x \\cdot cos x^2'), function () { var x = new Real('x');
tests for d/dx log (x)
aantthony_javascript-cas
train
js
893756767455a3777382b959b9a03dc329f09630
diff --git a/rootpy/tree/tree.py b/rootpy/tree/tree.py index <HASH>..<HASH> 100644 --- a/rootpy/tree/tree.py +++ b/rootpy/tree/tree.py @@ -149,7 +149,7 @@ class Tree(Object, Plottable, QROOT.TTree): """ Create branches from a TreeBuffer or dict mapping names to type names - Paramaters + Parameters ---------- branches : TreeBuffer or dict """
DOCS: fix docstring in Tree
rootpy_rootpy
train
py
4d26ed9200aafc4c8a2e42d790d1205700c9db68
diff --git a/html-lint.js b/html-lint.js index <HASH>..<HASH> 100644 --- a/html-lint.js +++ b/html-lint.js @@ -6,7 +6,6 @@ var // node - exec = require('child_process').exec, fs = require('fs'), spawn = require('child_process').spawn,
forgot to remove exec when switching to spawn
curtisj44_HTML-Lint
train
js
fa9a4478cb1f1ff97d180c9ee4e818794ea6db3b
diff --git a/lib/coral_core/util/batch.rb b/lib/coral_core/util/batch.rb index <HASH>..<HASH> 100644 --- a/lib/coral_core/util/batch.rb +++ b/lib/coral_core/util/batch.rb @@ -32,7 +32,9 @@ class Batch < Core # Batch operations def add(name, options = {}, &code) - processes[name] = Util::Process.new(name, options, code) + processes[name] = Util::Process.new(name, options) do + code.call + end end #--- @@ -77,18 +79,18 @@ class Batch < Core thread = Thread.new do Thread.current[:error] = nil - start_pid = Process.pid + start_pid = ::Process.pid begin process.run rescue Exception => error - raise if ! parallel && Process.pid == start_pid + raise if ! parallel && ::Process.pid == start_pid Thread.current[:error] = error end - if Process.pid != start_pid + if ::Process.pid != start_pid exit_status = true if Thread.current[:error] @@ -100,7 +102,7 @@ class Batch < Core logger.error(error.backtrace.join("\n")) end - Process.exit!(exit_status) + ::Process.exit!(exit_status) end end
Fixing Process class namespace issues in the batch utility class.
coralnexus_corl
train
rb
14b1d84474163fccb77947802d08e092f728d15f
diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index <HASH>..<HASH> 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -850,7 +850,7 @@ func validateKubernetesVersions(old *cfg.Config) (string, bool) { oldestVersion, err := semver.Make(strings.TrimPrefix(constants.OldestKubernetesVersion, version.VersionPrefix)) if err != nil { - exit.WithCode(exit.Data, "Unable to parse oldest Kubernetes version from constants: %v", err) + exit.WithCodeT(exit.Data, "Unable to parse oldest Kubernetes version from constants: %v", err) } if nvs.LT(oldestVersion) { @@ -858,7 +858,7 @@ func validateKubernetesVersions(old *cfg.Config) (string, bool) { if viper.GetBool(force) { out.WarningT("Kubernetes {{.version}} is not supported by this release of minikube", out.V{"version": nvs}) } else { - exit.WithCode(exit.Data, "Sorry, Kubernetes {{.version}} is not supported by this release of minikube", out.V{"version": nvs}) + exit.WithCodeT(exit.Data, "Sorry, Kubernetes {{.version}} is not supported by this release of minikube", out.V{"version": nvs}) } }
start.go rename exit.WithCode with exit.WithCodeT
kubernetes_minikube
train
go
814f7005134187d769bd9df74a40d345d675cd04
diff --git a/src/Template.php b/src/Template.php index <HASH>..<HASH> 100644 --- a/src/Template.php +++ b/src/Template.php @@ -120,8 +120,14 @@ class Template */ public function render($name, Array $data = null) { + if (isset($this->_internal['rendering']) and $this->_internal['rendering']) { + throw new \LogicException('You cannot render a template from within a template.'); + } + ob_start(); + $this->_internal['rendering'] = true; + $this->data($data); include($this->_internal['engine']->resolvePath($name)); @@ -137,6 +143,8 @@ class Template include($this->_internal['layout_path']); } + $this->_internal['rendering'] = false; + return ob_get_clean(); } }
Prevent calling of render() method from inside templates.
thephpleague_plates
train
php
9f58ca84ffaafbe95d9811e99db36ffcabf14e25
diff --git a/libkbfs/bsplitter_simple.go b/libkbfs/bsplitter_simple.go index <HASH>..<HASH> 100644 --- a/libkbfs/bsplitter_simple.go +++ b/libkbfs/bsplitter_simple.go @@ -74,7 +74,11 @@ func NewBlockSplitterSimple(desiredBlockSize int64, "desired size of %d", desiredBlockSize) } - maxPtrs := int(maxSize / int64(bpSize)) + // Trial and error shows that this magic 75% constant maximizes + // the number of realistic indirect pointers you can fit into the + // default block size. TODO: calculate this number more exactly + // during initialization for a given `maxSize`. + maxPtrs := int(.75 * float64(maxSize/int64(bpSize))) if maxPtrs < 2 { maxPtrs = 2 }
bsplitter_simple: reduce number of maxPtrs to <I>% Otherwise, with real-life indirect pointers we end up bursting through the max block size. Issue: KBFS-<I>
keybase_client
train
go
a2817da0cd03a63fbf1d39e8e4dedbc1e87e9ea5
diff --git a/lib/racker/template.rb b/lib/racker/template.rb index <HASH>..<HASH> 100644 --- a/lib/racker/template.rb +++ b/lib/racker/template.rb @@ -7,6 +7,7 @@ require 'racker/builders/docker' require 'racker/builders/google' require 'racker/builders/null' require 'racker/builders/openstack' +require 'racker/builders/parallels' require 'racker/builders/qemu' require 'racker/builders/virtualbox' require 'racker/builders/vmware'
Add missing require for parallels support.
aspring_racker
train
rb
3d2dfb080c0933cf72425fa2b1e767ec036e95a8
diff --git a/src/Collection.php b/src/Collection.php index <HASH>..<HASH> 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -563,7 +563,9 @@ class Collection implements \Countable $document = $this->getDocumentDirectly($id); - $this->addDocumentToDocumentPool($document); + if (is_a($document, 'Document')) { + $this->addDocumentToDocumentPool($document); + } return $document; }
Making sure it's a Document
sokil_php-mongo
train
php
1e8ef0f4285d86de7aba8a74fe00562745c9f8b4
diff --git a/src/forms/UserFormFactory.php b/src/forms/UserFormFactory.php index <HASH>..<HASH> 100644 --- a/src/forms/UserFormFactory.php +++ b/src/forms/UserFormFactory.php @@ -46,6 +46,8 @@ class UserFormFactory public function create($userId) { $defaults = []; + $user = null; + if (isset($userId)) { $user = $this->userRepository->find($userId); $defaults = $user->toArray(); @@ -92,7 +94,7 @@ class UserFormFactory /** @var UserFormDataProviderInterface[] $providers */ $providers = $this->dataProviderManager->getProviders('users.dataprovider.user_form', UserFormDataProviderInterface::class); foreach ($providers as $sorting => $provider) { - $form = $provider->provide(['form' => $form]); + $form = $provider->provide(['form' => $form, 'user' => $user]); } $form->addGroup($this->translator->translate('users.admin.user_form.other'));
Finalizing extraction of invoices from user form remp/crm#<I>
remp2020_crm-users-module
train
php
2d08bb0fa4d4d7f6d27768388fd911b51396dca2
diff --git a/src/libraries/DomHelper.js b/src/libraries/DomHelper.js index <HASH>..<HASH> 100644 --- a/src/libraries/DomHelper.js +++ b/src/libraries/DomHelper.js @@ -2,7 +2,6 @@ export default class DomHelper { constructor(node) { this.node = node; - this.parent = node.parentNode; } get size() {
Remove unused var from DomHelper
deulos_vue-flux
train
js
0fa1b53f25616e3a3296a6b4c69ae55f1fe4ee27
diff --git a/lenstronomy/Sampling/sampler.py b/lenstronomy/Sampling/sampler.py index <HASH>..<HASH> 100644 --- a/lenstronomy/Sampling/sampler.py +++ b/lenstronomy/Sampling/sampler.py @@ -232,7 +232,7 @@ class Sampler(object): size=n_walkers) if backend_filename is not None: - backend = zeus.callbacks.SaveProgressCallback(backend_filename) + backend = zeus.callbacks.SaveProgressCallback(filename= backend_filename, ncheck = 1) n_run_eff = n_burn + n_run else: backend = None
set ncheck = 1 so backend file is always created
sibirrer_lenstronomy
train
py
ee69b9855af2d0f14a847307a331e16b7d5ee485
diff --git a/src/Select.js b/src/Select.js index <HASH>..<HASH> 100644 --- a/src/Select.js +++ b/src/Select.js @@ -144,7 +144,6 @@ const Select = React.createClass({ return { inputValue: '', isFocused: false, - isLoading: false, isOpen: false, isPseudoFocused: false, required: false,
Remove unused `isLoading` entry in getInitialState
HubSpot_react-select-plus
train
js
7a8862260842eb22af207a4aa7a5ddbe130169bb
diff --git a/lib/hammer_cli_katello/ping.rb b/lib/hammer_cli_katello/ping.rb index <HASH>..<HASH> 100644 --- a/lib/hammer_cli_katello/ping.rb +++ b/lib/hammer_cli_katello/ping.rb @@ -44,7 +44,12 @@ module HammerCLIKatello def execute d = send_request print_data d - d['status'] != _("FAIL") ? HammerCLI::EX_OK : 1 + service_statuses = d['services'].values.map { |v| v['status'] } + if d['status'] == _("FAIL") || service_statuses.include?(_("FAIL")) + 1 + else + HammerCLI::EX_OK + end end def send_request
Fixes #<I> - Return 1 if any service fails ping (#<I>)
Katello_hammer-cli-katello
train
rb
c563545587d3bbb08ffae6eaddef4033eca42ca8
diff --git a/cyclotron_std/sys/stdout.py b/cyclotron_std/sys/stdout.py index <HASH>..<HASH> 100644 --- a/cyclotron_std/sys/stdout.py +++ b/cyclotron_std/sys/stdout.py @@ -5,10 +5,21 @@ from cyclotron import Component Sink = namedtuple('Sink', ['data']) -def make_driver(loop = None): + +def make_driver(loop=None): def stdout_driver(sink): - sink.data.subscribe(lambda data: sys.stdout.write(bytes(data, 'utf-8').decode('unicode_escape'))) + def on_data_error(e): + sys.stdout.write("error: {}".format(e)) + sys.stdout.flush() + + def on_data_completed(): + sys.stdout.flush() + + sink.data.subscribe( + on_next=lambda data: sys.stdout.write(bytes(data, 'utf-8').decode('unicode_escape')), + on_error=on_data_error, + on_completed=on_data_completed) return None return Component(call=stdout_driver, input=Sink)
stdout: error management and flush when sink is completed
MainRo_cyclotron-std
train
py
335e6001f12ec7098f83eb8cb276131137163876
diff --git a/cassandra/query.py b/cassandra/query.py index <HASH>..<HASH> 100644 --- a/cassandra/query.py +++ b/cassandra/query.py @@ -356,20 +356,20 @@ class BatchStatement(Statement): def add(self, statement, parameters=None): if isinstance(statement, basestring): if parameters: - self._statements_and_parameters.append( - (statement, encode_params(parameters))) - else: - self._statements_and_parameters.append((statement, ())) + statement = bind_params(statement, parameters) + self._statements_and_parameters.append((statement, ())) else: try: # see if it's a PreparedStatement - string_or_id = statement.query_id + query_id = statement.query_id + self._statements_and_parameters.append( + (query_id, () if parameters is None else parameters)) except AttributeError: # it must be a SimpleStatement - string_or_id = statement.query_string - - parameters = () if parameters is None else parameters - self._statements_and_parameters.append((string_or_id, parameters)) + query_string = statement.query_string + if parameters: + query_string = bind_params(query_string, parameters) + self._statements_and_parameters.append((query_string, ())) return self def add_all(self, statements, parameters):
Bind non-prepared batch subqueries client-side
datastax_python-driver
train
py
a6ff5e6bfc117f9151c6506a5f6f4bba51a1676c
diff --git a/src/_pytest/main.py b/src/_pytest/main.py index <HASH>..<HASH> 100644 --- a/src/_pytest/main.py +++ b/src/_pytest/main.py @@ -386,6 +386,7 @@ class Session(nodes.FSCollector): self._initialpaths = frozenset() # Keep track of any collected nodes in here, so we don't duplicate fixtures self._node_cache = {} + # Dirnames of pkgs with dunder-init files. self._pkg_roots = {} self.config.pluginmanager.register(self, name="session") @@ -535,8 +536,7 @@ class Session(nodes.FSCollector): seen_dirs.add(dirpath) pkginit = dirpath.join("__init__.py") if pkginit.exists(): - collect_root = self._pkg_roots.get(dirpath, self) - for x in collect_root._collectfile(pkginit): + for x in self._collectfile(pkginit): yield x if isinstance(x, Package): self._pkg_roots[dirpath] = x
Cleanup/follow-up to #<I>
pytest-dev_pytest
train
py
046c39467a297cb2f02e47e229f3ad1ac81a5e79
diff --git a/marathon/client.py b/marathon/client.py index <HASH>..<HASH> 100644 --- a/marathon/client.py +++ b/marathon/client.py @@ -330,8 +330,10 @@ class MarathonClient(object): response = self._do_request('GET', '/v2/tasks') tasks = self._parse_response(response, MarathonTask, is_list=True, resource_name='tasks') + [setattr(t, 'app_id', app_id) for t in tasks if app_id and t.app_id is None] for k, v in kwargs.iteritems(): tasks = filter(lambda o: getattr(o, k) == v, tasks) + return tasks def kill_tasks(self, app_id, scale=False, host=None, batch_size=0, batch_delay=0):
Fill in task.app_id where (older) Marathon doesn't
thefactory_marathon-python
train
py
fabf192aa76fc3b12f0c8a2d6f15c1672226e83e
diff --git a/fastaq/tasks.py b/fastaq/tasks.py index <HASH>..<HASH> 100644 --- a/fastaq/tasks.py +++ b/fastaq/tasks.py @@ -190,7 +190,7 @@ def fastaq_to_mira_xml(infile, outfile): utils.close(fout) -def fastaq_to_orfs_gff(infile, outfile, min_length=300): +def fastaq_to_orfs_gff(infile, outfile, min_length=300, tool_name='fastaq'): seq_reader = sequences.file_reader(infile) fout = utils.open_file_write(outfile) for seq in seq_reader: @@ -201,7 +201,7 @@ def fastaq_to_orfs_gff(infile, outfile, min_length=300): else: strand = '+' - print(seq.id, 'fastaq', 'CDS', coords.start+1, coords.end+1, '.', strand, '.', sep='\t', file=fout) + print(seq.id, tool_name, 'CDS', coords.start+1, coords.end+1, '.', strand, '.', sep='\t', file=fout) utils.close(fout)
Add tool_name option to fastaq_to_orfs_gff
sanger-pathogens_Fastaq
train
py
a99ed16c0df679f86f8c4ad143058d990f75fdf7
diff --git a/specs/validate-async-spec.js b/specs/validate-async-spec.js index <HASH>..<HASH> 100644 --- a/specs/validate-async-spec.js +++ b/specs/validate-async-spec.js @@ -85,7 +85,6 @@ describe("validate.async", function() { expect(validate.tryRequire).toHaveBeenCalledWith("rsvp"); expect(validate.tryRequire).toHaveBeenCalledWith("when"); expect(validate.tryRequire).toHaveBeenCalledWith("q"); - console.log(validate.tryRequire.calls); }); it("supports native promises", function() {
Remove a debug print in the tests
ansman_validate.js
train
js
35f2aec3365a01a6779245663da9a91080ac85df
diff --git a/connection.go b/connection.go index <HASH>..<HASH> 100644 --- a/connection.go +++ b/connection.go @@ -120,49 +120,50 @@ func Protocols() []string { } /* - Frames Read Count. + FramesRead returns a count of the number of frames read on the connection. */ func (c *Connection) FramesRead() int64 { return c.mets.tfr } /* - Bytes Read Count. + BytesRead returns a count of the number of bytes read on the connection. */ func (c *Connection) BytesRead() int64 { return c.mets.tbr } /* - Frames Written Count. + FramesWritten returns a count of the number of frames written on the connection. */ func (c *Connection) FramesWritten() int64 { return c.mets.tfw } /* - Bytes Written Count. + BytesWritten returns a count of the number of bytes written on the connection. */ func (c *Connection) BytesWritten() int64 { return c.mets.tbw } /* - Duration since client start. + Running returns a time duration since connection start. */ func (c *Connection) Running() time.Duration { return time.Since(c.mets.st) } /* - Subscribe channel capacity. + SubChanCap returns the current scribe channel capacity. */ func (c *Connection) SubChanCap() int { return c.scc } /* - Set Subscribe channel capacity. + SetSubChanCap sets a new subscribe channel capacity, to be used during future + SUBSCRIBE operations. */ func (c *Connection) SetSubChanCap(nc int) { c.scc = nc
Use more idiomatic method comments.
gmallard_stompngo
train
go
9cc7e796853865ec0fc168cb3456067700de46e8
diff --git a/tests/test_stateful_browser.py b/tests/test_stateful_browser.py index <HASH>..<HASH> 100644 --- a/tests/test_stateful_browser.py +++ b/tests/test_stateful_browser.py @@ -75,7 +75,8 @@ def test_open_relative(): def test_links(): browser = mechanicalsoup.StatefulBrowser() - html = '<a class="bluelink" href="/blue" id="blue_link">A Blue Link</a>' + html = '''<a class="bluelink" href="/blue" id="blue_link">A Blue Link</a> + <a class="redlink" href="/red" id="red_link">A Red Link</a>''' expected = [BeautifulSoup(html).a] browser.open_fake_page(html) @@ -93,6 +94,11 @@ def test_links(): assert browser.links(id="blue_link") == expected assert browser.links(id="blue") == [] + # Test returning a non-singleton + two_links = browser.links(id=re.compile('_link')) + assert len(two_links) == 2 + assert two_links == BeautifulSoup(html).find_all('a') + if __name__ == '__main__': test_submit_online() test_no_404()
test_stateful_browser.py: improve test_links Add a test of the non-singleton result on a page containing several links. This was requested in the PR #<I> discussion.
MechanicalSoup_MechanicalSoup
train
py
485db8082a8b682b6773e676bd87cd7749b8bc04
diff --git a/src/Silex/Doctrine/DBAL/Connection.php b/src/Silex/Doctrine/DBAL/Connection.php index <HASH>..<HASH> 100644 --- a/src/Silex/Doctrine/DBAL/Connection.php +++ b/src/Silex/Doctrine/DBAL/Connection.php @@ -237,4 +237,18 @@ class Connection extends BaseConnection { return parent::executeUpdate($query, $params, $types); } + /** + * Prepares and executes an SQL query and returns the first row of the result + * as an associative array. Alias of <b>fetchAssoc</b>. + * + * @param string $statement The SQL query. + * @param array $params The query parameters. + * @param array $types The query parameter types. + * + * @return array + */ + public function fetch($statement, array $params = [], array $types = []) { + return parent::fetchAssoc($statement, $params, $types); + } + }
Add `fetch` alias method to Doctrine service provider
lokhman_silex-tools
train
php
c345fe39eed76725325ad3805ea76081bb394f97
diff --git a/src/Input.js b/src/Input.js index <HASH>..<HASH> 100644 --- a/src/Input.js +++ b/src/Input.js @@ -14,6 +14,10 @@ class Input extends React.Component { componentDidMount() { if (this.props.type === 'select' && !this.props.browserDefault && typeof $ !== 'undefined') { $(this.refs.inputEl).material_select(); + $(this.refs.inputEl).on('change', this._onChange); + if (!!this.props.onChange) { + $(this.refs.inputEl).on('change', this.props.onChange); + } } } @@ -70,7 +74,6 @@ class Input extends React.Component { <select id={id} className={cx(inputClasses)} - onChange={this._onChange} ref='inputEl' value={this.state.value} {...props} @@ -135,7 +138,8 @@ Input.propTypes = { id: React.PropTypes.string, name: React.PropTypes.string, validate: React.PropTypes.bool, - browserDefault: React.PropTypes.bool + browserDefault: React.PropTypes.bool, + onChange: React.PropTypes.func }; Input.defaultProps = {type: 'text'};
Make 'select' type Input trigger onChange and update state correctly. Adding onChange to React select components doesn't work with Materialize's <ul> based virtual styled select component. See: <URL>
react-materialize_react-materialize
train
js
7feaa91ad15ab214dccc115504cbe11ce5107a1b
diff --git a/component-3-patt-9-state.js b/component-3-patt-9-state.js index <HASH>..<HASH> 100644 --- a/component-3-patt-9-state.js +++ b/component-3-patt-9-state.js @@ -123,7 +123,8 @@ $cs.pattern.state = $cs.trait({ children = this.children(); for (i = 0; i < children.length; i++) if (children[i].state_compare(state) < 0) - if (children[i].state_auto_increase()) + if ( children[i].state_auto_increase() + || children[i].property("ComponentJS:state-auto-increase") === true) children[i].state(state, "downward"); } } @@ -172,7 +173,8 @@ $cs.pattern.state = $cs.trait({ if (_direction === "upward-and-downward" || _direction === "upward") if (this.parent() !== null) if (this.parent().state_compare(state_lower) > 0) - if (this.parent().state_auto_decrease()) + if ( this.parent().state_auto_decrease() + || this.parent().property("ComponentJS:state-auto-decrease") === true) this.parent().state(state_lower, "upward"); } }
check also properties when doing state auto increase/decrease
rse_componentjs
train
js
d2035496933b7bf499f43c106cdf264b322ac47b
diff --git a/.eslintrc.js b/.eslintrc.js index <HASH>..<HASH> 100755 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -88,10 +88,7 @@ module.exports = { 'eol-last': [ERROR], 'func-call-spacing': [ERROR, 'never'], 'func-name-matching': [ERROR], - 'indent': [ERROR, 2, { - 'SwitchCase': 1, - 'MemberExpression': 'off' - }], + 'indent': [OFF], 'key-spacing': [ERROR, { 'beforeColon': false, 'afterColon': true, @@ -149,7 +146,7 @@ module.exports = { }], // ECMAScript 6 - 'arrow-parens': [ERROR, 'always'], + 'arrow-parens': [ERROR, 'as-needed'], 'arrow-spacing': [ERROR], 'generator-star-spacing': [ERROR, { 'before': false,
Removed eslint indent rule because prettier is handling that (and they're incompatible)
Barandis_xduce
train
js
0e8b218ef489a2dac14585e97bff810ef6ea24d2
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -42,7 +42,7 @@ function init(behaviour) { subChannel.assertExchange(behaviour.exchange, "topic"); subChannel.assertQueue(queueName, queueOpts); routingKeys.forEach(function (key) { - subChannel.bindQueue(queue, behaviour.exchange, key, {}); + subChannel.bindQueue(queueName, behaviour.exchange, key, {}); }); var amqpHandler = function (message) { if (!message) return handleSubscribeError("Subscription cancelled"); @@ -52,8 +52,8 @@ function init(behaviour) { handler(transform.decode(message), message, {ack: ackFun}); }; var consumeOpts = {noAck: !behaviour.ack}; - subChannel.consume(queue, amqpHandler, consumeOpts, cb); - api.emit("subscribed", {key: routingKeyOrKeys, queue: queue}); + subChannel.consume(queueName, amqpHandler, consumeOpts, cb); + api.emit("subscribed", {key: routingKeyOrKeys, queue: queueName}); }); function handleSubscribeError(err) {
Use generated queue name for bind.
ExpressenAB_exp-amqp-connection
train
js
f317eba71627827923775fe85385f5a14dfda222
diff --git a/rflink/parser.py b/rflink/parser.py index <HASH>..<HASH> 100644 --- a/rflink/parser.py +++ b/rflink/parser.py @@ -392,6 +392,7 @@ translate_protocols = [ "Oregon UVN128/138", "Plieger York", "Byron SX", + "CAME-TOP432", ]
add came-top<I> to the list of translated protocols, for correct home assistant interaction
aequitas_python-rflink
train
py
12ccfb36f0b26a01521b110854372a6bbdc5c6d3
diff --git a/ui/plugins/similar_jobs/controller.js b/ui/plugins/similar_jobs/controller.js index <HASH>..<HASH> 100644 --- a/ui/plugins/similar_jobs/controller.js +++ b/ui/plugins/similar_jobs/controller.js @@ -59,7 +59,7 @@ treeherder.controller('SimilarJobsPluginCtrl', [ obj.authorResultsetFilterUrl = $scope.urlBasePath + "?repo=" + $scope.repoName + "&author=" + encodeURIComponent(obj.result_set.author); }); - $scope.similar_jobs = data; + $scope.similar_jobs = $.merge($scope.similar_jobs, data); // on the first page show the first element info by default if($scope.page === 1 && $scope.similar_jobs.length > 0){ $scope.show_job_info($scope.similar_jobs[0]); @@ -78,6 +78,7 @@ treeherder.controller('SimilarJobsPluginCtrl', [ $scope.update_similar_jobs = function(){ if(angular.isDefined($scope.jobLoadedPromise)){ $scope.jobLoadedPromise.then(function(){ + $scope.similar_jobs = []; $scope.page = 1; $scope.similar_job_selected = null; $scope.get_similar_jobs();
Bug <I> - let "Show previous jobs" append data instead of replacing it update_similar_jobs() now resets the list on job change get_list() now appends the new data by merging the arrays (using jQuery)
mozilla_treeherder
train
js
d928d673defdb80a73ee3e26ed8535ef7669e7f4
diff --git a/config/config-server/src/test/java/com/thoughtworks/go/config/MagicalGoConfigXmlLoaderTest.java b/config/config-server/src/test/java/com/thoughtworks/go/config/MagicalGoConfigXmlLoaderTest.java index <HASH>..<HASH> 100644 --- a/config/config-server/src/test/java/com/thoughtworks/go/config/MagicalGoConfigXmlLoaderTest.java +++ b/config/config-server/src/test/java/com/thoughtworks/go/config/MagicalGoConfigXmlLoaderTest.java @@ -4428,7 +4428,7 @@ public class MagicalGoConfigXmlLoaderTest { " <deny action=\"refer\" type=\"*\">up43</deny> \n" + " </rules>\n" + " </secretConfig>\n" + - "</secretConfigs>", 124); + "</secretConfigs>", CONFIG_SCHEMA_VERSION); CruiseConfig config = xmlLoader.loadConfigHolder(content).config;
Do not hardcode schemaVersion in XML Loader specs * Use GoConstants.CONFIG_SCHEMA_VERSION to always use to latest available schema version. * Using hardcoded schema version would cause test failures upon next xml migration.
gocd_gocd
train
java
d1bf4f48152ec00c3fbdd45888e4963e302f36e4
diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index <HASH>..<HASH> 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -86,6 +86,8 @@ AWS_S3_OBJECT_PARAMETERS = { } # https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings AWS_DEFAULT_ACL = None +# https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings +AWS_S3_REGION_NAME = env("DJANGO_AWS_S3_REGION_NAME", default=None) # STATIC # ------------------------
Added AWS_S3_REGION_NAME to production settings
pydanny_cookiecutter-django
train
py
89a24463ad890def402bb9faffe2460b656fb2fe
diff --git a/course/manage.php b/course/manage.php index <HASH>..<HASH> 100644 --- a/course/manage.php +++ b/course/manage.php @@ -314,8 +314,6 @@ if (can_edit_in_category()) { $PAGE->set_button($courserenderer->course_search_form('', 'navbar')); } -$displaylist[0] = get_string('top'); - // Start output. echo $OUTPUT->header(); @@ -345,6 +343,7 @@ if (!empty($searchcriteria)) { echo html_writer::table($table); } else { // Print the category selector. + $displaylist = coursecat::make_categories_list(); $select = new single_select(new moodle_url('/course/manage.php'), 'categoryid', $displaylist, $coursecat->id, null, 'switchcategory'); $select->set_label(get_string('categories').':');
MDL-<I> fixed bug with quick jump to category
moodle_moodle
train
php
c427599dd29c0635c761f51191d2604ef6a7905f
diff --git a/tests/test-globaltypography.php b/tests/test-globaltypography.php index <HASH>..<HASH> 100644 --- a/tests/test-globaltypography.php +++ b/tests/test-globaltypography.php @@ -80,15 +80,14 @@ class GlobalTypographyTest extends \WP_UnitTestCase { foreach ( $fontpacks as $val ) { $baseurl = $val['baseurl']; foreach ( $val['files'] as $font => $font_url ) { - $status = '404 Not Found'; $url = $baseurl . $font_url; $headers = wp_get_http_headers( $url ); - if ( $headers && isset( $headers['status'] ) ) { - $status = $headers['status']; + if ( $headers && isset( $headers['location'] ) ) { + $font_url = $headers['location']; } else { $this->assertTrue( false, "Cannot download: {$url}" ); } - $this->assertNotContains( $status, '404', "404 Not Found: {$url}" ); + $this->assertContains( "https://raw.githubusercontent.com", $font_url ); } } }
Fix test status header with a reailable value
pressbooks_pressbooks
train
php
86b579a96cc335e58f0920c1b9994bb7486b4309
diff --git a/lib/Cake/Model/Datasource/Database/Query.php b/lib/Cake/Model/Datasource/Database/Query.php index <HASH>..<HASH> 100644 --- a/lib/Cake/Model/Datasource/Database/Query.php +++ b/lib/Cake/Model/Datasource/Database/Query.php @@ -116,10 +116,7 @@ class Query implements Expression, IteratorAggregate { return $sql .= $this->{'_build' . ucFirst($name) . 'Part'}($parts, $sql); }; - // TODO: Should Query actually get the driver or just let the connection decide where - // to get the query translator? - $translator = $this->connection()->driver()->queryTranslator($this->_type); - $query = $translator($this); + $query = $this->_transformQuery(); $query->build($builder->bindTo($query)); return $sql; } @@ -473,6 +470,19 @@ class Query implements Expression, IteratorAggregate { } /** + * Returns a query object as returned by the connection object as a result of + * transforming this query instance to conform to any dialect specifics + * + * @return void + **/ + protected function _transformQuery() { + // TODO: Should Query actually get the driver or just let the connection decide where + // to get the query translator? + $translator = $this->connection()->driver()->queryTranslator($this->_type); + return $translator($this); + } + +/** * Returns string representation of this query (complete SQL statement) * * @return string
A bit of refactoring for clarity... Did I mention that all tests pass for all implemented drivers? :)
cakephp_cakephp
train
php
84baa3c6a3613117e757fd4809a8f6480504cf7c
diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncContainer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncContainer.java index <HASH>..<HASH> 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncContainer.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncContainer.java @@ -186,7 +186,7 @@ public class CosmosSyncContainer { * @throws CosmosClientException the cosmos client exception */ public CosmosSyncItemResponse upsertItem(Object item, CosmosItemRequestOptions options) throws CosmosClientException { - return this.mapItemResponseAndBlock(this.containerWrapper.createItem(item, options)); + return this.mapItemResponseAndBlock(this.containerWrapper.upsertItem(item, options)); } /**
Fixed upsertItem API to use upsertItem instead of createItem() (#<I>)
Azure_azure-sdk-for-java
train
java
3b634134a0e19f688b4992c8dd3fd31277d27cf8
diff --git a/test/test_convertible.rb b/test/test_convertible.rb index <HASH>..<HASH> 100644 --- a/test/test_convertible.rb +++ b/test/test_convertible.rb @@ -4,7 +4,11 @@ require 'ostruct' class TestConvertible < Test::Unit::TestCase context "yaml front-matter" do setup do - @convertible = OpenStruct.new + @convertible = OpenStruct.new( + "site" => Site.new(Jekyll.configuration( + "source" => File.expand_path('../fixtures', __FILE__) + )) + ) @convertible.extend Jekyll::Convertible @base = File.expand_path('../fixtures', __FILE__) end
Another test passing. :smile:
jekyll_jekyll
train
rb
b39e3ff9bf9cf53a82671c06df0e814078c69035
diff --git a/lib/oxidized/model/ironware.rb b/lib/oxidized/model/ironware.rb index <HASH>..<HASH> 100644 --- a/lib/oxidized/model/ironware.rb +++ b/lib/oxidized/model/ironware.rb @@ -55,6 +55,7 @@ class IronWare < Oxidized::Model end cmd 'show module' do |cfg| + cfg.gsub! /^((Invalid input)|(Type \?)).*$/, '' # some ironware devices are fixed config comment cfg end
some ironware devices are fixed config => no modules
ytti_oxidized
train
rb
06674cba29416c2e52ed0ce574c729f45bf7da57
diff --git a/MAVProxy/modules/mavproxy_mode.py b/MAVProxy/modules/mavproxy_mode.py index <HASH>..<HASH> 100644 --- a/MAVProxy/modules/mavproxy_mode.py +++ b/MAVProxy/modules/mavproxy_mode.py @@ -50,6 +50,7 @@ class ModeModule(mp_module.MPModule): latitude = float(args[0]) longitude = float(args[1]) altitude = int(args[2]) + latlon = (latitude, longitude) else: try: latlon = self.module('map').click_position
Fixed cannot find latlon issue when using guided with given latitude, longitude and altitude.
ArduPilot_MAVProxy
train
py
8889f732ed401b8e8c7ad7b6da144b5e62f5339e
diff --git a/fcrepo-integrationtest/fcrepo-integrationtest-core/src/main/java/org/fcrepo/test/api/TestAPIM.java b/fcrepo-integrationtest/fcrepo-integrationtest-core/src/main/java/org/fcrepo/test/api/TestAPIM.java index <HASH>..<HASH> 100644 --- a/fcrepo-integrationtest/fcrepo-integrationtest-core/src/main/java/org/fcrepo/test/api/TestAPIM.java +++ b/fcrepo-integrationtest/fcrepo-integrationtest-core/src/main/java/org/fcrepo/test/api/TestAPIM.java @@ -1197,7 +1197,7 @@ public class TestAPIM "A", "MD6", null, - "adding new datastream"); + "adding new datastream with bad checksum algorithm"); // fail if datastream was added Assert.fail(); } catch (javax.xml.ws.soap.SOAPFaultException af) { @@ -1222,7 +1222,7 @@ public class TestAPIM "A", "TIGER", null, - "adding new datastream"); + "adding new datastream with unimplemented checksum algorithm"); // fail if datastream was added Assert.fail(); } catch (javax.xml.ws.soap.SOAPFaultException af) {
improved log messages for APIM tests expected to fail
fcrepo3_fcrepo
train
java
f0a1a5b7ba32759fd7e89bf33ded27bd1c117250
diff --git a/phono3py/cui/create_force_constants.py b/phono3py/cui/create_force_constants.py index <HASH>..<HASH> 100644 --- a/phono3py/cui/create_force_constants.py +++ b/phono3py/cui/create_force_constants.py @@ -435,7 +435,7 @@ def _create_phono3py_phonon_fc2(phono3py, alm_options, log_level): file_exists("FORCES_FC2", log_level) - natom = phono3py.supercell.get_number_of_atoms() + natom = phono3py.phonon_supercell.get_number_of_atoms() disp_dataset = _get_type2_dataset(natom, filename="FORCES_FC3") if disp_dataset: if force_to_eVperA is not None:
Fixed dim-fc2 user interface
atztogo_phono3py
train
py
b76901eb56ff18ca3c58f9d2fa12184445b70644
diff --git a/lib/transports/http-polling.js b/lib/transports/http-polling.js index <HASH>..<HASH> 100644 --- a/lib/transports/http-polling.js +++ b/lib/transports/http-polling.js @@ -115,20 +115,6 @@ HTTPPolling.prototype.write = function (data, close) { }; /** - * Performs a volatile write - * - * @api private - */ - -HTTPPolling.prototype.writeVolatile = function (data) { - if (this.open) { - this.log.debug(); - } else { - this.log.debug('ignoring volatile message, no open request'); - } -}; - -/** * Override end. * * @api private
Removed writeVolatile special handling for polling transports, since it's now handled elegantly across all transports, and polling drained-ness doesn't concern us.
socketio_socket.io
train
js
71715fb7d088c7a27decd1df6c26aef103e21268
diff --git a/src/tokenize.js b/src/tokenize.js index <HASH>..<HASH> 100644 --- a/src/tokenize.js +++ b/src/tokenize.js @@ -26,7 +26,7 @@ export class Token { const pp = Parser.prototype // Are we running under Rhino? -const isRhino = typeof Packages !== "undefined" +const isRhino = typeof Packages == "object" && String(Packages) = "[JavaPackage ]" // Move to the next token
Prevent false positives when detecting Rhino Issue #<I>
acornjs_acorn
train
js
81ce996c413abf926375e99d1a8bd8ef7696aa84
diff --git a/session/session_test.go b/session/session_test.go index <HASH>..<HASH> 100644 --- a/session/session_test.go +++ b/session/session_test.go @@ -4296,6 +4296,8 @@ func (s *testSessionSuite3) TestGlobalTemporaryTable(c *C) { tk.MustQuery("select c from g_tmp where b = 3").Check(testkit.Rows("3")) // Cover point get. tk.MustQuery("select * from g_tmp where a = 3").Check(testkit.Rows("3 3 3")) + // Cover batch point get. + tk.MustQuery("select * from g_tmp where a in (2,3,4)").Check(testkit.Rows("3 3 3", "4 7 9")) tk.MustExec("commit") // The global temporary table data is discard after the transaction commit.
session: add a test case to cover batch point get for temporary table (#<I>)
pingcap_tidb
train
go
f771ef67e8fa3f395967d5c02918fbbc3410612a
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -544,8 +544,7 @@ ext_data = { '_libs.parsers': { 'pyxfile': '_libs/parsers', 'depends': ['pandas/_libs/src/parser/tokenizer.h', - 'pandas/_libs/src/parser/io.h', - 'pandas/_libs/src/numpy_helper.h'], + 'pandas/_libs/src/parser/io.h'], 'sources': ['pandas/_libs/src/parser/tokenizer.c', 'pandas/_libs/src/parser/io.c']}, '_libs.reduction': {
BLD: Drop nonexistent dependency of _libs/parsers (#<I>) Follow-up to gh-<I>. Closes gh-<I>.
pandas-dev_pandas
train
py
b22e07e3a5c4cf9af9d417027454e034eeb9b4d7
diff --git a/config/initializers/active_admin_index_calendar.rb b/config/initializers/active_admin_index_calendar.rb index <HASH>..<HASH> 100755 --- a/config/initializers/active_admin_index_calendar.rb +++ b/config/initializers/active_admin_index_calendar.rb @@ -5,7 +5,7 @@ module ActiveAdmin def build(page_presenter, collection) add_class "calendar" context = {:page_presenter => page_presenter, :collection => collection} - events = instance_exec(context, &page_presenter.block) + events = instance_exec(context, &page_presenter.block) unless page_presenter.block.blank? # Builds default events array for collection if page_presenter.block returns no data if events.blank?
Allows to render without page_presenter.block
bys-control_activeadmin-index_as_calendar
train
rb
30b8f3aa6f96150a97f1756394de0463999d0bc4
diff --git a/src/main/java/com/xtremelabs/robolectric/shadows/ShadowShapeDrawable.java b/src/main/java/com/xtremelabs/robolectric/shadows/ShadowShapeDrawable.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/xtremelabs/robolectric/shadows/ShadowShapeDrawable.java +++ b/src/main/java/com/xtremelabs/robolectric/shadows/ShadowShapeDrawable.java @@ -6,7 +6,7 @@ import com.xtremelabs.robolectric.internal.Implementation; import com.xtremelabs.robolectric.internal.Implements; @Implements(ShapeDrawable.class) -public class ShadowShapeDrawable { +public class ShadowShapeDrawable extends ShadowDrawable { private Paint paint = new Paint();
ShadowShapeDrawable extends ShadowDrawable
robolectric_robolectric
train
java
2345e8b5cac717cc250b388d84d3a06674e979d4
diff --git a/GoneSubscriber/GoneDocumentSubscriber.php b/GoneSubscriber/GoneDocumentSubscriber.php index <HASH>..<HASH> 100644 --- a/GoneSubscriber/GoneDocumentSubscriber.php +++ b/GoneSubscriber/GoneDocumentSubscriber.php @@ -97,7 +97,13 @@ class GoneDocumentSubscriber implements EventSubscriberInterface foreach ($this->getUrls($document) as $url) { try { - $this->redirectRouteManager->saveByData(['source' => $url, 'statusCode' => 410, 'enabled' => true, 'target' => '']); + $this->redirectRouteManager->saveByData([ + 'source' => $url, + 'sourceHost' => null, + 'statusCode' => 410, + 'enabled' => true, + 'target' => '', + ]); } catch (RedirectRouteNotUniqueException $exception) { // do nothing when there already exists a redirect route }
Fix GoneDocumentSubscriber by passing sourceHost to RedirectRouteManager (#<I>)
sulu_SuluRedirectBundle
train
php
089ccd42d65ddf8d19bd7beb4e6ce41aef35d595
diff --git a/opal/browser/dom/event.rb b/opal/browser/dom/event.rb index <HASH>..<HASH> 100644 --- a/opal/browser/dom/event.rb +++ b/opal/browser/dom/event.rb @@ -189,9 +189,8 @@ class Event end def self.new(value, *args) - # FIXME: fix when #detect is fixed - klass, _ = classes.find {|what| - Native.is_a?(value, what[1]) + klass, _ = classes.find {|_, constructor| + Native.is_a?(value, constructor) } if !klass || klass == self
dom/event: Enumerable#detect has been fixed
opal_opal-browser
train
rb
c6e7b744c309f5862b4bffe0236c72b3b868fd90
diff --git a/src/Adapter/UdpAdapter.php b/src/Adapter/UdpAdapter.php index <HASH>..<HASH> 100644 --- a/src/Adapter/UdpAdapter.php +++ b/src/Adapter/UdpAdapter.php @@ -15,9 +15,18 @@ final class UdpAdapter extends AdapterAbstract public function write($message) { + // Create a handler in order to handle the 'Host is down' message + set_error_handler(function() { + // Suppress the error, this is the UDP adapter and if we can't send + // it then we shouldn't inturrupt their application. + }); + $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); socket_sendto($socket, $message, strlen($message), 0, $this->getOptions()->getHost(), $this->getOptions()->getPort()); socket_close($socket); + + // Remove our error handler. + restore_error_handler(); } private function serialize(array $message)
Silently handle socket errors in the UdpAdapter (closes #<I>), add testcase Conflicts: tests/ClientTest.php
corley_influxdb-php-sdk
train
php
d6a86e8cb9bace90376bce2878ff2877c80f336a
diff --git a/tests/PHPUnit/System/PeriodIsRangeDateIsLastNMetadataAndNormalAPITest.php b/tests/PHPUnit/System/PeriodIsRangeDateIsLastNMetadataAndNormalAPITest.php index <HASH>..<HASH> 100755 --- a/tests/PHPUnit/System/PeriodIsRangeDateIsLastNMetadataAndNormalAPITest.php +++ b/tests/PHPUnit/System/PeriodIsRangeDateIsLastNMetadataAndNormalAPITest.php @@ -23,7 +23,7 @@ class PeriodIsRangeDateIsLastNMetadataAndNormalAPITest extends SystemTestCase public static function setUpBeforeClass() { - self::$fixture->dateTime = Date::factory('today')->getDateTime(); + self::$fixture->dateTime = Date::factory('yesterday')->getDateTime(); parent::setUpBeforeClass(); } @@ -70,7 +70,7 @@ class PeriodIsRangeDateIsLastNMetadataAndNormalAPITest extends SystemTestCase $result[] = array($apiToCall, array('idSite' => $idSite, 'date' => $date, 'periods' => array('range'), 'segment' => $segment, 'otherRequestParameters' => array( - 'lastMinutes' => 60 * 24, + 'lastMinutes' => 60 * 24 * 2, 'visitorId' => $visitorId // testing getLastVisitsForVisitor requires a visitor ID ))); }
Maybe this could help the random midnight test failure?
matomo-org_matomo
train
php
3884959577c672d4e2ef59572594fa9c8ebb7457
diff --git a/lib/socket.js b/lib/socket.js index <HASH>..<HASH> 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -1,4 +1,3 @@ - /** * socket.io * Copyright(c) 2011 LearnBoost <[email protected]> @@ -464,6 +463,8 @@ self.publish('reconnect', self.transport.name, self.reconnectionAttempts); } + clearTimeout(self.reconnectionTimer); + self.removeListener('connect_failed', maybeReconnect); self.removeListener('connect', maybeReconnect);
Clears the timeout from reconnection attempt when there is a successful or failed reconnection. This fixes the issue of setTimeout's carrying over from previous reconnection and changing (skipping) values of self.reconnectionDelay in the newer reconnection.
tsjing_socket.io-client
train
js
1230b83438c7354a4f43292cb2296abff3ab6ae3
diff --git a/cake/console/libs/tasks/fixture.php b/cake/console/libs/tasks/fixture.php index <HASH>..<HASH> 100644 --- a/cake/console/libs/tasks/fixture.php +++ b/cake/console/libs/tasks/fixture.php @@ -370,7 +370,7 @@ class FixtureTask extends BakeTask { $condition = $this->in($prompt, null, 'WHERE 1=1 LIMIT 10'); } } else { - $condition = 'WHERE 1=1 ' . isset($this->params['count']) ? $this->params['count'] : 10; + $condition = 'WHERE 1=1 LIMIT ' . (isset($this->params['count']) ? $this->params['count'] : 10); } App::import('Model', 'Model', false); $modelObject =& new Model(array('name' => $modelName, 'table' => $useTable, 'ds' => $this->connection));
Fixing incorrect string concatenation resulting in invalid conditions. Fixes failing tests.
cakephp_cakephp
train
php
00925be22697e3353cdb6e8e0efebcc921882120
diff --git a/mysql.go b/mysql.go index <HASH>..<HASH> 100644 --- a/mysql.go +++ b/mysql.go @@ -40,7 +40,7 @@ func (h *MySQL) tableNames(q queryable) ([]string, error) { query := ` SELECT table_name FROM information_schema.tables - WHERE table_schema=?; + WHERE table_schema=? AND table_type='BASE TABLE'; ` dbName, err := h.databaseName(q) if err != nil {
Calculating CHECKSUM on views broke the execution. For avoid that when we retrive all tables inside the database we have to filter only for the 'BASE TABLE', infact doesn't make sense try to add data to any views.
go-testfixtures_testfixtures
train
go
bc0b9e547eb99ccdd83fe7d37283ed041e10b665
diff --git a/packages/idyll-cli/bin/cmds/clean.js b/packages/idyll-cli/bin/cmds/clean.js index <HASH>..<HASH> 100644 --- a/packages/idyll-cli/bin/cmds/clean.js +++ b/packages/idyll-cli/bin/cmds/clean.js @@ -9,7 +9,7 @@ exports.handler = async _ => { try { let isTokenExists = await checkIfTokenExists(); if (isTokenExists) { - let userAnswer = await confirmClean(); + let userAnswer = await confirm(); if (userAnswer === 'Yes') { removeIdyll(); } @@ -25,18 +25,18 @@ checkIfTokenExists = _ => { return fs.pathExists(`${PATH}/token`); }; -confirmClean = async _ => { +confirm = async _ => { const userResponse = await inquirer.prompt([ { type: 'list', - name: 'confirmClean', + name: 'confirm', message: `This command will remove the idyll cache folder, including your idyll.pub token. Subsequent deploys to idyll.pub will receive a new URL. Are you sure you wish to continue?`, choices: ['Yes', 'No'] } ]); - return userResponse.confirmClean; + return userResponse.confirm; }; removeIdyll = _ => {
change conifrmClean fn name to confirm
idyll-lang_idyll
train
js
3d44a781edb855465d3e8a03443bf829e458fa4f
diff --git a/lib/mixlib/config.rb b/lib/mixlib/config.rb index <HASH>..<HASH> 100644 --- a/lib/mixlib/config.rb +++ b/lib/mixlib/config.rb @@ -118,7 +118,7 @@ module Mixlib # def internal_set(method_symbol,value) method_name = method_symbol.id2name - if self.public_methods.include?("#{method_name}=") + if (self.public_methods - ["[]="]).include?("#{method_name}=") self.send("#{method_name}=", value) else @@configuration[method_symbol] = value
Broke []= with internal_set, fixed
chef_mixlib-config
train
rb
6ff1e058b1972837889c6b532bfda9382796a69b
diff --git a/pnc-rest/src/main/java/org/jboss/pnc/rest/trigger/BuildTriggerer.java b/pnc-rest/src/main/java/org/jboss/pnc/rest/trigger/BuildTriggerer.java index <HASH>..<HASH> 100644 --- a/pnc-rest/src/main/java/org/jboss/pnc/rest/trigger/BuildTriggerer.java +++ b/pnc-rest/src/main/java/org/jboss/pnc/rest/trigger/BuildTriggerer.java @@ -35,7 +35,9 @@ public class BuildTriggerer { Preconditions.checkArgument(configuration != null, "Can't find configuration with given id=" + configurationId); final BuildRecordSet buildRecordSet = new BuildRecordSet(); - buildRecordSet.setProductMilestone(configuration.getProductVersion().getCurrentProductMilestone()); + if (configuration.getProductVersion() != null) { + buildRecordSet.setProductMilestone(configuration.getProductVersion().getCurrentProductMilestone()); + } return buildCoordinator.build(configuration).getBuildConfiguration().getId(); }
[NCL-<I>] Check for null product version when triggering a configuration
project-ncl_pnc
train
java
68be34a8e48206126a4c8a2c5ef1e5d24f1ea4c8
diff --git a/src/main/java/com/codahale/shamir/SecretSharing.java b/src/main/java/com/codahale/shamir/SecretSharing.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/codahale/shamir/SecretSharing.java +++ b/src/main/java/com/codahale/shamir/SecretSharing.java @@ -31,7 +31,6 @@ public final class SecretSharing { if (k <= 1) { throw new IllegalArgumentException("K must be > 1"); } - if (n < k) { throw new IllegalArgumentException("N must be >= K"); } @@ -72,7 +71,8 @@ public final class SecretSharing { final int[] lens = shares.stream().mapToInt(s -> s.getValue().length).distinct().toArray(); if (lens.length == 0) { throw new IllegalArgumentException("No shares provided"); - } else if (lens.length != 1) { + } + if (lens.length != 1) { throw new IllegalArgumentException("Varying lengths of share values"); }
Remove extraneous `else`.
codahale_shamir
train
java
f6bec87fdde3296e36263e1f6aee8c5ac84e6d0a
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,13 @@ setup( 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 2.7 :: 3', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.1', + 'Programming Language :: Python :: 3.2', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', 'Topic :: Software Development :: Libraries :: Python Modules' ]
pypi changes to reflect python 3 support
viralogic_py-enumerable
train
py
abc2cdff8a1517f1b9a76b134087171a939923bf
diff --git a/lib/spreadsheet/excel/row.rb b/lib/spreadsheet/excel/row.rb index <HASH>..<HASH> 100644 --- a/lib/spreadsheet/excel/row.rb +++ b/lib/spreadsheet/excel/row.rb @@ -20,9 +20,9 @@ class Row < Spreadsheet::Row def datetime idx _datetime at(idx) end - def each &block + def each size.times do |idx| - block.call self[idx] + yield self[idx] end end ## diff --git a/lib/spreadsheet/worksheet.rb b/lib/spreadsheet/worksheet.rb index <HASH>..<HASH> 100644 --- a/lib/spreadsheet/worksheet.rb +++ b/lib/spreadsheet/worksheet.rb @@ -108,9 +108,9 @@ module Spreadsheet # If the argument skip is given, #each iterates from that row until but # omitting the first unused Row, effectively skipping the first _skip_ Rows # from the top of the Worksheet. - def each skip=dimensions[0], &block + def each skip=dimensions[0] skip.upto(dimensions[1] - 1) do |idx| - block.call row(idx) + yield row(idx) end end def encoding # :nodoc:
Yield is more simple here too.
zdavatz_spreadsheet
train
rb,rb