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
a78072ade8fa05cbaf65aaca8c6d68cfc92b24dd
diff --git a/bin/worker.js b/bin/worker.js index <HASH>..<HASH> 100644 --- a/bin/worker.js +++ b/bin/worker.js @@ -31,17 +31,25 @@ module.exports.run = function(worker) { }); scServer.on('connection', function(socket) { + var channelToWatch, channelToEmit; socket.on('login', function (credentials, respond) { - var channelName = credentials === 'master' ? 'respond' : 'log'; + if (credentials === 'master') { + channelToWatch = 'respond'; channelToEmit = 'log'; + } else { + channelToWatch = 'log'; channelToEmit = 'respond'; + } worker.exchange.subscribe('sc-' + socket.id).watch(function(msg) { - socket.emit(channelName, msg); + socket.emit(channelToWatch, msg); }); - respond(null, channelName); + respond(null, channelToWatch); }); socket.on('disconnect', function() { var channel = worker.exchange.channel('sc-' + socket.id); channel.unsubscribe(); channel.destroy(); - scServer.exchange.publish('log', { id: socket.id, type: 'DISCONNECTED' }); + scServer.exchange.publish( + channelToEmit, + { id: socket.id, type: 'DISCONNECTED' } + ); }); }); };
Let the app know when the monitor is disconnected Related to <URL>
zalmoxisus_remotedev-server
train
js
32e6b5db3b1693ca0f3039e9d9f70fa6876d8616
diff --git a/test/index.js b/test/index.js index <HASH>..<HASH> 100644 --- a/test/index.js +++ b/test/index.js @@ -164,6 +164,12 @@ test('match params (root index-vs-param)', t => { let quz = $.match('/', [$.parse('*')]); t.same(quz[0], { old:'*', type:2, val:'*' }, 'matches root-index route with root-wilcard pattern'); + let qut = $.match('/', ['/x', '*'].map($.parse)); + t.same(qut[0], { old:'*', type:2, val:'*' }, 'matches root-index with wildcard pattern'); + + let qar = $.match('/', ['*', '/x'].map($.parse)); + t.same(qar[0], { old:'*', type:2, val:'*' }, 'matches root-index with wildcard pattern (reorder)'); + t.end(); });
add tests for root-wildcard regardless of order
lukeed_matchit
train
js
be03598c3920b498f6ca56e5e54513952e89a54f
diff --git a/src/main/java/com/treasure_data/logger/sender/HttpSender.java b/src/main/java/com/treasure_data/logger/sender/HttpSender.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/treasure_data/logger/sender/HttpSender.java +++ b/src/main/java/com/treasure_data/logger/sender/HttpSender.java @@ -83,12 +83,12 @@ public class HttpSender implements Sender { if (!HttpClient.validateDatabaseName(databaseName)) { String msg = String.format("Invalid database name %s", new Object[] { databaseName }); LOG.error(msg); - throw new IllegalArgumentException(msg); // another exception throwing TODO + throw new IllegalArgumentException(msg); } if (!HttpClient.validateTableName(tableName)) { String msg = String.format("Invalid table name %s", new Object[] { tableName }); LOG.error(msg); - throw new IllegalArgumentException(msg); // another exceptionthrowing TODO + throw new IllegalArgumentException(msg); } String key = databaseName + "." + tableName; @@ -107,7 +107,7 @@ public class HttpSender implements Sender { } catch (IOException e) { LOG.error(String.format("Cannot serialize data to %s.%s", new Object[] { databaseName, tableName }), e); - chunks.remove(key); // TODO #MN + chunks.remove(key); return false; }
deleted TODO comments in HttpSender.java
treasure-data_td-logger-java
train
java
eb54e2f3dbaa9381f39b030c14bfff9ed91655e5
diff --git a/bika/lims/browser/js/bika.lims.analysisrequest.add_by_col.js b/bika/lims/browser/js/bika.lims.analysisrequest.add_by_col.js index <HASH>..<HASH> 100644 --- a/bika/lims/browser/js/bika.lims.analysisrequest.add_by_col.js +++ b/bika/lims/browser/js/bika.lims.analysisrequest.add_by_col.js @@ -1762,10 +1762,11 @@ function AnalysisRequestAddByCol() { // Expand category var service = service_data[si] services.push(service) - var th = $("table[form_id='" + service['PointOfCapture'] + "'] " + - "th[cat='" + service['CategoryTitle'] + "']") - if(expanded_categories.indexOf(th) < 0) { - expanded_categories.push(th) + var th_key = "table[form_id='" + service['PointOfCapture'] + "'] " + + "th[cat='" + service['CategoryTitle'] + "']" + var th = $(th_key) + if(expanded_categories.indexOf(th_key) < 0) { + expanded_categories.push(th_key) var def = $.Deferred() def = category_header_expand_handler(th) defs.push(def)
When an Analysis Profile is selected in AR Add, try to expand category only once
senaite_senaite.core
train
js
f3cacc17c85ecb7f1b6a9e373ee85d1480919868
diff --git a/codec/decode.go b/codec/decode.go index <HASH>..<HASH> 100644 --- a/codec/decode.go +++ b/codec/decode.go @@ -2382,6 +2382,10 @@ func (d *Decoder) wrapErrstr(v interface{}, err *error) { *err = fmt.Errorf("%s decode error [pos %d]: %v", d.hh.Name(), d.r.numread(), v) } +func (d *Decoder) NumBytesRead() int { + return d.r.numread() +} + // -------------------------------------------------- // decSliceHelper assists when decoding into a slice, from a map or an array in the stream.
codec: expose Number of Bytes Read by the Decoder This allows users know where in the stream they are, supporting consuming and truncating use-cases e.g. given a byte slice, decode a user from it, and return the remainder of the byte slice to other module for further processing. Fixes #<I> Fixes #<I>
ugorji_go
train
go
ce8e93bad3228bc1404d25fb5727662166e957b8
diff --git a/spec/asar-spec.js b/spec/asar-spec.js index <HASH>..<HASH> 100644 --- a/spec/asar-spec.js +++ b/spec/asar-spec.js @@ -895,6 +895,12 @@ describe('asar package', function () { const {hasOwnProperty} = Object.prototype for (const [propertyName, originalValue] of Object.entries(originalFs)) { + // Some properties exist but have a value of `undefined` on some platforms. + // E.g. `fs.lchmod`, which in only available on MacOS, see + // https://nodejs.org/docs/latest-v10.x/api/fs.html#fs_fs_lchmod_path_mode_callback + // Also check for `null`s, `hasOwnProperty()` can't handle them. + if (typeof originalValue === 'undefined' || originalValue === null) continue + if (hasOwnProperty.call(originalValue, util.promisify.custom)) { expect(fs).to.have.own.property(propertyName) .that.has.own.property(util.promisify.custom)
tests: ignore nulls and undefined in the "util.promisify" test
electron_electron
train
js
ce8073c969a595f44037b2739806a693446e0161
diff --git a/spec/job_cron_spec.rb b/spec/job_cron_spec.rb index <HASH>..<HASH> 100644 --- a/spec/job_cron_spec.rb +++ b/spec/job_cron_spec.rb @@ -108,10 +108,11 @@ describe Rufus::Scheduler::CronJob do it 'returns the next trigger time' do n = Time.now + if n.month == 12 - nt = Time.parse("#{n.year + 1}-01-01") + nt = Time.parse("#{n.year + 1}-01-01") else - nt = Time.parse("#{n.year}-#{n.month + 1}-01") + nt = Time.parse("#{n.year}-#{n.month + 1}-01") end expect(
clean up indentation in spec/job_cron_spec.rb
jmettraux_rufus-scheduler
train
rb
eb5da94322e46532ae5dbbae411ac90056ac7360
diff --git a/ext_localconf.php b/ext_localconf.php index <HASH>..<HASH> 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -3,7 +3,7 @@ defined('TYPO3_MODE') or die(); // === Variables === -$namespace = 't3v'; +$namespace = 'T3v'; $extensionKey = $_EXTKEY; $extensionSignature = \T3v\T3vCore\Utility\ExtensionUtility::extensionSignature($namespace, $extensionKey); $configurationFolder = \T3v\T3vCore\Utility\ExtensionUtility::configurationFolder($extensionKey);
[➠] Updated extension configuration.
t3v_t3v_content
train
php
add9ea1c770183f253ad39c977ec2e5870553e33
diff --git a/src/test/java/org/zeromq/guide/AsyncServerTest.java b/src/test/java/org/zeromq/guide/AsyncServerTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/org/zeromq/guide/AsyncServerTest.java +++ b/src/test/java/org/zeromq/guide/AsyncServerTest.java @@ -226,7 +226,7 @@ public class AsyncServerTest //The main thread simply starts several clients, and a server, and then //waits for the server to finish. - @Test(timeout = 5000) + @Test(timeout = 10000) public void testAsyncServer() throws Exception { try ( @@ -246,7 +246,7 @@ public class AsyncServerTest actors.add(new ZActor(ctx, new Worker(threadNbr), null)); } - ZMQ.sleep(5); + ZMQ.sleep(1); status = proxy.pause(true); assertThat(status, is(ZProxy.PAUSED));
Fix #<I> - Fix testAsyncServer test with more reasonable Timeout and sleep
zeromq_jeromq
train
java
086c42aeb2cc4d1bb242e1a03f8bf466b9e34223
diff --git a/Routing/Loader/RestRouteLoader.php b/Routing/Loader/RestRouteLoader.php index <HASH>..<HASH> 100644 --- a/Routing/Loader/RestRouteLoader.php +++ b/Routing/Loader/RestRouteLoader.php @@ -105,7 +105,13 @@ class RestRouteLoader extends Loader if (0 === strpos($controller, '@')) { $file = $this->locator->locate($controller); - $controller = $this->findClass($file); + $controllerClass = $this->findClass($file); + + if (false === $controllerClass) { + throw new \InvalidArgumentException(sprintf('Can\'t find class for controller "%s"', $controller)); + } + + $controller = $controllerClass; } if ($this->container->has($controller)) {
Added error handling for the class location in the route loader
FriendsOfSymfony_FOSRestBundle
train
php
e2920d9e3aba420f0f77fc00814b760abbb0d057
diff --git a/Lite.php b/Lite.php index <HASH>..<HASH> 100644 --- a/Lite.php +++ b/Lite.php @@ -309,7 +309,7 @@ class Cache_Lite */ function clean($group = false) { - $motif = ($group) ? 'cache_'.$group.'_' : 'cache_'; + $motif = ($group) ? 'cache_'.md5($group).'_' : 'cache_'; if ($this->_memoryCaching) { while (list($key, $value) = each($this->_memoryCaching)) { if (strpos($key, $motif, 0)) { @@ -440,7 +440,7 @@ class Cache_Lite */ function _setFileName($id, $group) { - $this->_file = ($this->_cacheDir.'cache_'.$group.'_'.md5($id)); + $this->_file = ($this->_cacheDir.'cache_'.md5($group).'_'.md5($id)); } /**
Little fix to avoid file names problems with an exotic group name (
pear_Cache_Lite
train
php
7163807fcf292e520e0f4af3146dc8e6bb8e9252
diff --git a/pyramid_authsanity/policy.py b/pyramid_authsanity/policy.py index <HASH>..<HASH> 100644 --- a/pyramid_authsanity/policy.py +++ b/pyramid_authsanity/policy.py @@ -137,7 +137,7 @@ class AuthServicePolicy(object): value = {} value['principal'] = principal - value['ticket'] = ticket = base64.urlsafe_b64encode(os.urandom(32)).rstrip(b"=") + value['ticket'] = ticket = str(base64.urlsafe_b64encode(os.urandom(32)).rstrip(b"=")) debug and self._log('Remember principal: %r, ticket: %r' % (principal, ticket), 'remember', request)
Ticket is now non-binary
usingnamespace_pyramid_authsanity
train
py
819c7a1c0a069e1ebeb7082273b73da5d8d15515
diff --git a/lib/jsonld-signatures.js b/lib/jsonld-signatures.js index <HASH>..<HASH> 100644 --- a/lib/jsonld-signatures.js +++ b/lib/jsonld-signatures.js @@ -617,9 +617,27 @@ if(_nodejs) { callback(null, verified); }; } else if(_browser) { - _verifySignature = function(input, options, callback) { - // FIXME: Implement signature creation in browser using forge - callback('not implemented'); + _verifySignature = function(input, signature, options, callback) { + var publicKey = forge.pki.publicKeyFromPem(options.publicKeyPem); + var md = forge.md.sha256.create(); + + if(options.nonce !== null) { + md.update(options.nonce); + } + md.update(options.date); + + md.update(input); + if(options.domain !== null) { + md.update('@' + options.domain); + } + + var verified = publicKey.verify(md.digest().bytes(), signature); + + if(!verified) { + return callback(new Error('[jsigs.verify] ' + + 'The digital signature on the message is invalid.')); + } + callback(null, verified); }; }
Implement forge-based signature verification for the browser.
digitalbazaar_jsonld-signatures
train
js
8ae68cacbd7d61300260750535c650e6e7772f53
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -31,8 +31,8 @@ if platform.system() in ["Darwin", "FreeBSD", "OpenBSD"]: if platform.system() == "Windows": conda_prefix = os.getenv("CONDA_PREFIX") if conda_prefix is not None: - include_dirs = [os.path.join(conda_prefix, "Library\include")] - library_dirs = [os.path.join(conda_prefix, "Library\lib")] + include_dirs = [os.path.join(conda_prefix, r"Library\include")] + library_dirs = [os.path.join(conda_prefix, r"Library\lib")] extra_compile_args = ["-Wall"] extra_link_args = []
Fix deprecation warnings due to invalid escape sequences.
jalan_pdftotext
train
py
25e4489a5f280e8f0a22ca99ecb401338bb75308
diff --git a/qunit/qunit.js b/qunit/qunit.js index <HASH>..<HASH> 100644 --- a/qunit/qunit.js +++ b/qunit/qunit.js @@ -129,6 +129,10 @@ var QUnit = { }); synchronize(function() { + if ( config.expected && config.expected != config.assertions.length ) { + QUnit.ok( false, "Expected " + config.expected + " assertions, but " + config.assertions.length + " were run" ); + } + var good = 0, bad = 0, tests = id("qunit-tests"); @@ -209,10 +213,6 @@ var QUnit = { fail("reset() failed, following Test " + name + ", exception and reset fn follows", e, QUnit.reset); } - if ( config.expected && config.expected != config.assertions.length ) { - QUnit.ok( false, "Expected " + config.expected + " assertions, but " + config.assertions.length + " were run" ); - } - QUnit.testDone( testName, bad, config.assertions.length ); if ( !window.setTimeout && !config.queue.length ) {
Moved expect-code back to beginning of function, where it belongs. Fixes #<I>
JamesMGreene_qunit-assert-html
train
js
62c3ae04041d044b8e660ece7c8f5011c8c93c42
diff --git a/sunspot/lib/sunspot/search/paginated_collection.rb b/sunspot/lib/sunspot/search/paginated_collection.rb index <HASH>..<HASH> 100644 --- a/sunspot/lib/sunspot/search/paginated_collection.rb +++ b/sunspot/lib/sunspot/search/paginated_collection.rb @@ -1,8 +1,7 @@ module Sunspot module Search - class PaginatedCollection - instance_methods.each { |m| undef_method m unless m =~ /^__|instance_eval|object_id|send/ } + class PaginatedCollection < Array attr_reader :current_page, :per_page attr_accessor :total_count @@ -11,10 +10,10 @@ module Sunspot alias :limit_value :per_page def initialize(collection, page, per_page, total) - @collection = collection @current_page = page @per_page = per_page @total_count = total + replace collection end def total_pages @@ -47,12 +46,6 @@ module Sunspot end alias :offset_value :offset - private - - def method_missing(method, *args, &block) - @collection.send(method, *args, &block) - end - end end end
Paginated collection behaves like an array so it should inherit from it.
sunspot_sunspot
train
rb
44c93e0d4b24d40f66ab8bf92c94ce12d57b7475
diff --git a/packages/ember-testing/lib/test.js b/packages/ember-testing/lib/test.js index <HASH>..<HASH> 100644 --- a/packages/ember-testing/lib/test.js +++ b/packages/ember-testing/lib/test.js @@ -173,9 +173,11 @@ var Test = { @public @method promise @param {Function} resolver The function used to resolve the promise. + @param {String} label An optional string for identifying the promise. */ - promise(resolver) { - return new Test.Promise(resolver); + promise(resolver, label) { + var fullLabel = `Ember.Test.promise: ${label || "<Unknown Promise>"}`; + return new Test.Promise(resolver, fullLabel); }, /**
[BUGFIX beta] Pass a label with Ember.Test.promise This allows promises used in testing code to be labeled: return Ember.Test.promise((resolve) => Ember.run.later(resolve, <I>), "Stall tests for 1 second");
emberjs_ember.js
train
js
49a7678a6f97f541206cc15229494f1f8b938df9
diff --git a/scribble-inject/src/main/java/io/inkstand/scribble/inject/ConfigPropertyInjection.java b/scribble-inject/src/main/java/io/inkstand/scribble/inject/ConfigPropertyInjection.java index <HASH>..<HASH> 100644 --- a/scribble-inject/src/main/java/io/inkstand/scribble/inject/ConfigPropertyInjection.java +++ b/scribble-inject/src/main/java/io/inkstand/scribble/inject/ConfigPropertyInjection.java @@ -62,10 +62,6 @@ public class ConfigPropertyInjection extends CdiInjection { * The name of the {@link ConfigProperty} into which the value should be injected. */ private final transient String configPropertyName; - /** - * The default value if it is set on the matching annotation. - */ - private transient Object defaultValue; /** * Constructor for a config property injection, accepting the property name and the value.
fixed sonar issues (removed unused fields)
inkstand-io_scribble
train
java
af472e3099086c8dea067690938258de3ad8fbd8
diff --git a/lib/billy/cache.rb b/lib/billy/cache.rb index <HASH>..<HASH> 100644 --- a/lib/billy/cache.rb +++ b/lib/billy/cache.rb @@ -11,8 +11,10 @@ module Billy def cacheable?(url, headers) if Billy.config.cache - host = URI(url).host - !Billy.config.whitelist.include?(host) + uri = URI(url) + host = uri.host + port = uri.port + !Billy.config.whitelist.include?(host) || !Billy.config.whitelist.include?("#{host}:#{port}") # TODO test headers for cacheability end end
First pass at supporting port in whitelist hosts
oesmith_puffing-billy
train
rb
9cfa80b5c8e0486257c403b25d6f93744a02af03
diff --git a/blog/blogpage.php b/blog/blogpage.php index <HASH>..<HASH> 100644 --- a/blog/blogpage.php +++ b/blog/blogpage.php @@ -1,5 +1,9 @@ <?php // $Id$ +if (!defined('MOODLE_INTERNAL')) { + die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page +} + /** * Definition of blog page type. */ diff --git a/course/report/stats/report.php b/course/report/stats/report.php index <HASH>..<HASH> 100644 --- a/course/report/stats/report.php +++ b/course/report/stats/report.php @@ -1,4 +1,8 @@ -<?php +<?php // $Id$ + + if (!defined('MOODLE_INTERNAL')) { + die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page + } $courses = get_courses('all','c.shortname','c.id,c.shortname,c.fullname'); $courseoptions = array();
MDL-<I> Merged prevention of direct access from <I>
moodle_moodle
train
php,php
e2458431931642b903f3f4965975bcebcf8610b4
diff --git a/lib/filestorage/file_storage.php b/lib/filestorage/file_storage.php index <HASH>..<HASH> 100644 --- a/lib/filestorage/file_storage.php +++ b/lib/filestorage/file_storage.php @@ -1556,7 +1556,16 @@ class file_storage { $img = imagecreatefromstring($file->get_content()); if ($height != $newheight or $width != $newwidth) { $newimg = imagecreatetruecolor($newwidth, $newheight); - if (!imagecopyresized($newimg, $img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height)) { + + // Maintain transparency. + if ($filerecord['mimetype'] == 'image/png' || $filerecord['mimetype'] == 'image/gif') { + $colour = imagecolorallocatealpha($newimg, 0, 0, 0, 127); + imagecolortransparent($newimg, $colour); + imagealphablending($newimg, false); + imagesavealpha($newimg, true); + } + + if (!imagecopyresampled($newimg, $img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height)) { // weird throw new file_exception('storedfileproblem', 'Can not resize image'); }
MDL-<I> files: convert_image() now supports transparency.
moodle_moodle
train
php
5aa7f4a6140fae348d5145c209933e215e794a1b
diff --git a/lib/resque_cleaner/server.rb b/lib/resque_cleaner/server.rb index <HASH>..<HASH> 100644 --- a/lib/resque_cleaner/server.rb +++ b/lib/resque_cleaner/server.rb @@ -99,6 +99,8 @@ module ResqueCleaner end end + mime_type :json, 'application/json' + get "/cleaner" do load_library load_cleaner_filter @@ -163,6 +165,16 @@ module ResqueCleaner erb File.read(ResqueCleaner::Server.erb_path('cleaner_exec.erb')) end + get "/cleaner_dump" do + load_library + load_cleaner_filter + + block = filter_block + + content_type :json + JSON.pretty_generate(cleaner.select(&block)) + end + post "/cleaner_stale" do load_library cleaner.clear_stale diff --git a/test/resque_web_test.rb b/test/resque_web_test.rb index <HASH>..<HASH> 100644 --- a/test/resque_web_test.rb +++ b/test/resque_web_test.rb @@ -42,5 +42,9 @@ context "resque-web" do post "/cleaner_exec", :action => "clear", :sha1 => Digest::SHA1.hexdigest(@cleaner.select[0].to_json) assert_equal 9, @cleaner.select.size end + test "#cleaner_dump should respond with success" do + get "/cleaner_dump" + assert last_response.ok?, last_response.errors + end end
you can dump JSON in case you want to backup failure information.
ono_resque-cleaner
train
rb,rb
8f50064a893be90be04e8b3214dc1f2347d88758
diff --git a/src/TestSuite/TestCase.php b/src/TestSuite/TestCase.php index <HASH>..<HASH> 100644 --- a/src/TestSuite/TestCase.php +++ b/src/TestSuite/TestCase.php @@ -70,13 +70,6 @@ abstract class TestCase extends BaseTestCase protected $_configure = []; /** - * Path settings to restore at the end of the test. - * - * @var array - */ - protected $_pathRestore = []; - - /** * Overrides SimpleTestCase::skipIf to provide a boolean return value * * @param bool $shouldSkip Whether or not the test should be skipped. @@ -161,7 +154,7 @@ abstract class TestCase extends BaseTestCase Configure::write($this->_configure); } $this->getTableLocator()->clear(); - $this->_configure = $this->_pathRestore = []; + $this->_configure = []; $this->_tableLocator = null; }
Remove unused property After looking at #<I> I noticed that `_pathRestore` is never actually set to anything by core tests/classes.
cakephp_cakephp
train
php
6b825debb2467a2da88e94bb19d16bea9a895b67
diff --git a/packages/@vue/cli-service-global/lib/util.js b/packages/@vue/cli-service-global/lib/util.js index <HASH>..<HASH> 100644 --- a/packages/@vue/cli-service-global/lib/util.js +++ b/packages/@vue/cli-service-global/lib/util.js @@ -6,15 +6,15 @@ exports.toPlugin = id => ({ id, apply: require(id) }) // Based on https://stackoverflow.com/questions/27367261/check-if-file-exists-case-sensitive // Case checking is required, to avoid errors raised by case-sensitive-paths-webpack-plugin function fileExistsWithCaseSync (filepath) { - const dir = path.dirname(filepath) + const { base, dir, root } = path.parse(filepath) - if (dir === '/' || dir === '.') { + if (dir === root || dir === '.') { return true } try { const filenames = fs.readdirSync(dir) - if (!filenames.includes(path.basename(filepath))) { + if (!filenames.includes(base)) { return false } } catch (e) {
fix: fix windows compatibility of fileExistsWithCaseSync
vuejs_vue-cli
train
js
8b792bde86bf4cecab341d40d6bb0d6d5c119123
diff --git a/npm.js b/npm.js index <HASH>..<HASH> 100644 --- a/npm.js +++ b/npm.js @@ -329,7 +329,8 @@ var warn = (function(){ if(!warned[name]) { warned[name] = true; var warning = "WARN: Could not find " + name + " in node_modules. Ignoring."; - if(console.warn) console.warn(warning); + if(typeof steal !== "undefined" && steal.dev) steal.dev.warn(warning) + else if(console.warn) console.warn(warning); else console.log(warning); } };
Use steal.dev for logging, if available If using Steal in dev mode, use steal.dev so that log levels can control what gets written. Fixes #<I>
stealjs_steal-npm
train
js
c62def33e530fc4ff550195301e459618362abc3
diff --git a/tests/Finite/Test/Bundle/FiniteBundle/DependencyInjection/FiniteFiniteExtensionTest.php b/tests/Finite/Test/Bundle/FiniteBundle/DependencyInjection/FiniteFiniteExtensionTest.php index <HASH>..<HASH> 100644 --- a/tests/Finite/Test/Bundle/FiniteBundle/DependencyInjection/FiniteFiniteExtensionTest.php +++ b/tests/Finite/Test/Bundle/FiniteBundle/DependencyInjection/FiniteFiniteExtensionTest.php @@ -85,7 +85,7 @@ class FiniteFiniteExtensionTest extends \PHPUnit_Framework_TestCase array('on' => '1_to_2', 'do' => array('@my.listener.service', 'on1To2')) ), 'after' => array( - array('from' => '-state3', 'to' => ['state2', 'state3'], 'do' => array('@my.listener.service', 'on1To2')) + array('from' => '-state3', 'to' => array('state2', 'state3'), 'do' => array('@my.listener.service', 'on1To2')) ) ) )
Removed a <I>ism
yohang_Finite
train
php
9e476599cb48ba830e55d5f5fcd1a13eb137ce14
diff --git a/lib/sup/person.rb b/lib/sup/person.rb index <HASH>..<HASH> 100644 --- a/lib/sup/person.rb +++ b/lib/sup/person.rb @@ -9,7 +9,7 @@ class PersonManager ## read in stored people IO.readlines(fn).map do |l| - l =~ /^(.*)?:\s+(\d+)\s+(.*)$/ or raise "can't parse: #{l}" + l =~ /^(.*)?:\s+(\d+)\s+(.*)$/ or next email, time, name = $1, $2, $3 @@people[email] = Person.new name, email, time, false end if File.exists? fn
don't crash when people.txt is corrupted This was a debug check, but if Sup crashes when writing out people.txt, this will prevent it from ever starting again!
sup-heliotrope_sup
train
rb
06fc48bbace0a507b429db7de67b5d7dab5782cf
diff --git a/h2o-py/tests/testdir_jira/pyunit_hexdev_29_separator.py b/h2o-py/tests/testdir_jira/pyunit_hexdev_29_separator.py index <HASH>..<HASH> 100644 --- a/h2o-py/tests/testdir_jira/pyunit_hexdev_29_separator.py +++ b/h2o-py/tests/testdir_jira/pyunit_hexdev_29_separator.py @@ -26,6 +26,7 @@ def separator(): fhex_wrong_separator = h2o.import_file(pyunit_utils.locate(path), sep=";") fhex_wrong_separator.summary() assert fhex_wrong_separator.ncol == 1 + assert fhex_wrong_separator.nrow == 6 try: h2o.import_file(pyunit_utils.locate(path), sep="--")
Make sure the h2o-py/tests/testdir_jira/pyunit_hexdev_<I>_separator.py test looks just like the one for R
h2oai_h2o-3
train
py
dab0e9f28993b774ae9c940d2af498d1e6e05789
diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java b/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java +++ b/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java @@ -569,7 +569,6 @@ class ManagedIndex<S extends Storable> implements IndexEntryAccessor<S> { // Existing entry is exactly what we expect. Return false // exception if alternate key constraint, since this is // user error. - // FIXME: The isUnique method always returns true. return !isUnique(); } } catch (FetchException e) {
Removed bogus fixme comment.
Carbonado_Carbonado
train
java
b11068384fd91b1cc74999ea5b8ab2d2240d2fd5
diff --git a/openquake/calculators/ebrisk.py b/openquake/calculators/ebrisk.py index <HASH>..<HASH> 100644 --- a/openquake/calculators/ebrisk.py +++ b/openquake/calculators/ebrisk.py @@ -211,7 +211,7 @@ class EventBasedRiskCalculator(event_based.EventBasedCalculator): self.A = A = len(self.assetcol) self.L = L = len(alt.loss_names) if (oq.aggregate_by and self.E * A > oq.max_potential_gmfs and - any(val == 0 for val in mal.values())): + any(val == 0 for val in self.minimum_asset_loss.values())): logging.warning('The calculation is really big; consider setting ' 'minimum_asset_loss')
Fixed small bug in a check [ci skip]
gem_oq-engine
train
py
000f916504e52c6dba38990dc41792fa7c6db392
diff --git a/azurerm/internal/services/network/resource_arm_public_ip_prefix.go b/azurerm/internal/services/network/resource_arm_public_ip_prefix.go index <HASH>..<HASH> 100644 --- a/azurerm/internal/services/network/resource_arm_public_ip_prefix.go +++ b/azurerm/internal/services/network/resource_arm_public_ip_prefix.go @@ -59,7 +59,7 @@ func resourceArmPublicIpPrefix() *schema.Resource { Optional: true, Default: 28, ForceNew: true, - ValidateFunc: validation.IntBetween(24, 31), + ValidateFunc: validation.IntBetween(28, 31), }, "ip_prefix": {
Update IP Prefix validation IP Prefix can be deployed as a maximum /<I> ip space. The code would allow a max of /<I> which is not correct. Updated to support /<I> as the max.
terraform-providers_terraform-provider-azurerm
train
go
06630dcce3e993b26df3797cb4f7ab4e315fa0bc
diff --git a/lib/Wei.php b/lib/Wei.php index <HASH>..<HASH> 100644 --- a/lib/Wei.php +++ b/lib/Wei.php @@ -100,6 +100,7 @@ namespace Wei * @property Password $password A wrapper class for password hashing functions * @property Pinyin $pinyin An util object that converts Chinese words to phonetic alphabets * @method string pinyin($word) Converts Chinese words to phonetic alphabets + * @property SafeUrl $safeUrl Generate a URL with signature * @property Uuid $uuid A util object that generates a RANDOM UUID(universally unique identifier) * @method string uuid() generates a RANDOM UUID(universally unique identifier) * @property T $t A translator object
added code hint for safeUrl service
twinh_wei
train
php
18e1bb33de933e3651088fcdb243a2812f2e4d80
diff --git a/src/OAuth2/Storage/SessionInterface.php b/src/OAuth2/Storage/SessionInterface.php index <HASH>..<HASH> 100644 --- a/src/OAuth2/Storage/SessionInterface.php +++ b/src/OAuth2/Storage/SessionInterface.php @@ -137,8 +137,8 @@ interface SessionInterface * ) * </code> * - * @param [type] $accessToken [description] - * @return [type] [description] + * @param string $accessToken The access token + * @return bool|array Returns false if the validation fails, array on success */ public function validateAccessToken($accessToken); @@ -161,7 +161,7 @@ interface SessionInterface * Validate a refresh token * @param string $refreshToken The refresh token * @param string $clientId The client ID - * @return int The session ID + * @return bool|int The session ID, or false on failure */ public function validateRefreshToken($refreshToken, $clientId);
Added missing details (return values on failure) to methods of SessionInterface
thephpleague_oauth2-server
train
php
6346744c9833af09824588d38efedb824d44a705
diff --git a/src/Xethron/MigrationsGenerator/MigrationsGenerator.php b/src/Xethron/MigrationsGenerator/MigrationsGenerator.php index <HASH>..<HASH> 100644 --- a/src/Xethron/MigrationsGenerator/MigrationsGenerator.php +++ b/src/Xethron/MigrationsGenerator/MigrationsGenerator.php @@ -24,7 +24,9 @@ class MigrationsGenerator { public function __construct( $database ) { - $this->schema = DB::connection( $database )->getDoctrineSchemaManager(); + $connection = DB::connection( $database )->getDoctrineConnection(); + $connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); + $this->schema = $connection->getSchemaManager(); } public function getTables()
Add support for enum as string. Closes #1
Xethron_migrations-generator
train
php
c86bb08a7d39c67dedbef40d553d2363beef86fb
diff --git a/playem-deezer.js b/playem-deezer.js index <HASH>..<HASH> 100644 --- a/playem-deezer.js +++ b/playem-deezer.js @@ -85,9 +85,7 @@ DeezerPlayer = (function(){ this.sound.destruct(); this.sound = null; } else { - DZ.player.seek(0); DZ.player.pause(); - DZ.player.playTracks([]); } }
whyd bug fix: prevent a deezer track from repeating sometimes when stop() is called
adrienjoly_playemjs
train
js
713725e8b60b538199369ca288b8000120018852
diff --git a/xchange-stream-bitfinex/src/main/java/info/bitrich/xchangestream/bitfinex/BitfinexStreamingService.java b/xchange-stream-bitfinex/src/main/java/info/bitrich/xchangestream/bitfinex/BitfinexStreamingService.java index <HASH>..<HASH> 100644 --- a/xchange-stream-bitfinex/src/main/java/info/bitrich/xchangestream/bitfinex/BitfinexStreamingService.java +++ b/xchange-stream-bitfinex/src/main/java/info/bitrich/xchangestream/bitfinex/BitfinexStreamingService.java @@ -226,8 +226,10 @@ public class BitfinexStreamingService extends JsonNettyStreamingService { BitfinexWebSocketAuthBalance balance = BitfinexStreamingAdapters.adaptBalance(object); if (balance != null) subjectBalance.onNext(balance); break; + case "bu": + break; default: - LOG.debug("Unknown Bitfinex authenticated message type {}. Content=", type, object); + LOG.debug("Unknown Bitfinex authenticated message type {}. Content={}", type, object); } }
Fix debug logging for bu (Balance Update) and others
knowm_XChange
train
java
46473b5f523b902e003c9c06a7e5180415e2d464
diff --git a/build/check.py b/build/check.py index <HASH>..<HASH> 100755 --- a/build/check.py +++ b/build/check.py @@ -60,7 +60,7 @@ def checkHtmlLint(): """ htmlhint_path = shakaBuildHelpers.getNodeBinaryPath('htmlhint') if not os.path.exists(htmlhint_path): - return 0 + return True base = shakaBuildHelpers.getSourceBase() files = ['index.html', 'demo/index.html', 'support.html'] file_paths = [os.path.join(base, x) for x in files]
Fix skipping of htmlhint when missing We were returning 0 in a function that was supposed to return True/False. Change-Id: Ie<I>c<I>b<I>a5c0fe3ffc0df<I>bdb2a2ab<I>
google_shaka-player
train
py
dcf636db6839a5df1b65be60f90c60ade98cd83a
diff --git a/cwltool/process.py b/cwltool/process.py index <HASH>..<HASH> 100644 --- a/cwltool/process.py +++ b/cwltool/process.py @@ -40,6 +40,7 @@ def extend_avro(items): r["fields"] = specialize(r["fields"], t["specialize"]) r["fields"].extend(t["fields"]) r["extends"] = t["extends"] + r["doc"] = t.get("doc", "") types[t["name"]] = r t = r n.append(t)
Now embedding major documenation directly in schema. Lots of progress, but still haven't gotten to describing CommandLineTool and Workflow.
common-workflow-language_cwltool
train
py
61cc03d20e2c78adc9f2b894c838589af9b3bb73
diff --git a/test/src/Ouzo/Goodies/Utilities/JsonTest.php b/test/src/Ouzo/Goodies/Utilities/JsonTest.php index <HASH>..<HASH> 100644 --- a/test/src/Ouzo/Goodies/Utilities/JsonTest.php +++ b/test/src/Ouzo/Goodies/Utilities/JsonTest.php @@ -136,8 +136,6 @@ class JsonTest extends PHPUnit_Framework_TestCase $this->assertTrue(false); } // then catch (JsonEncodeException $e) { - Assert::thatString($e->getMessage()) - ->isEqualTo('JSON encode error: Malformed UTF-8 characters, possibly incorrectly encoded'); } } @@ -152,8 +150,6 @@ class JsonTest extends PHPUnit_Framework_TestCase $this->assertTrue(false); } // then catch (JsonEncodeException $e) { - Assert::thatString($e->getMessage()) - ->isEqualTo('JSON encode error: Inf and NaN cannot be JSON encoded'); } }
Fixed build on php that have no json_last_error_msg()
letsdrink_ouzo
train
php
38dcdd05444ac48cc741ea84b9ca01c09a8b28f3
diff --git a/app/models/identifier.rb b/app/models/identifier.rb index <HASH>..<HASH> 100644 --- a/app/models/identifier.rb +++ b/app/models/identifier.rb @@ -14,6 +14,10 @@ class Identifier < ApplicationRecord acts_as_list scope: :manifestation_id strip_attributes only: :body + after_destroy do + manifestation&.touch + end + def check_identifier case identifier_type.try(:name) when 'isbn'
refresh manifestation when identifier is destroyed
next-l_enju_leaf
train
rb
9f7877bcedd4dd27866f5e83399c00b500d903aa
diff --git a/src/Controller/Plugin/MelisFrontDragDropZonePlugin.php b/src/Controller/Plugin/MelisFrontDragDropZonePlugin.php index <HASH>..<HASH> 100644 --- a/src/Controller/Plugin/MelisFrontDragDropZonePlugin.php +++ b/src/Controller/Plugin/MelisFrontDragDropZonePlugin.php @@ -170,9 +170,9 @@ class MelisFrontDragDropZonePlugin extends MelisTemplatingPlugin $configValues[$cpt] = array(); if (!empty($plugin->attributes()->module)) $configValues[$cpt]['pluginModule'] = (string)$plugin->attributes()->module; - if (!empty($plugin->attributes()->module)) + if (!empty($plugin->attributes()->name)) $configValues[$cpt]['pluginName'] = (string)$plugin->attributes()->name; - if (!empty($plugin->attributes()->module)) + if (!empty($plugin->attributes()->id)) $configValues[$cpt]['pluginId'] = (string)$plugin->attributes()->id; $cpt++;
Checking xml attributes in loadDbXmlToPluginConfig corrected
melisplatform_melis-front
train
php
48543319e97de61e782fdc3def5019d845980fbd
diff --git a/lib/fresh_connection/active_record/relation.rb b/lib/fresh_connection/active_record/relation.rb index <HASH>..<HASH> 100644 --- a/lib/fresh_connection/active_record/relation.rb +++ b/lib/fresh_connection/active_record/relation.rb @@ -5,7 +5,9 @@ module ActiveRecord def exec_queries_with_slave_connection return @records if loaded? - if go_slave? + if FreshConnection::SlaveConnection.ignore_model?(@klass.name) + exec_queries_without_slave_connection + elsif go_slave? FreshConnection::SlaveConnection.slave_access { exec_queries_without_slave_connection } else FreshConnection::SlaveConnection.master_access { exec_queries_without_slave_connection } @@ -14,8 +16,7 @@ module ActiveRecord alias_method_chain :exec_queries, :slave_connection def go_slave? - !FreshConnection::SlaveConnection.ignore_model?(@klass.name) && - connection.open_transactions == 0 && (@readonly_value.nil? || @readonly_value) + connection.open_transactions == 0 && (@readonly_value.nil? || @readonly_value) end end end
Ignore model is always ignore.
tsukasaoishi_fresh_connection
train
rb
335a242bbaaa7ecc44294c30f45f90bbcdefe0ac
diff --git a/classes/fields/datetime.php b/classes/fields/datetime.php index <HASH>..<HASH> 100644 --- a/classes/fields/datetime.php +++ b/classes/fields/datetime.php @@ -634,6 +634,7 @@ class PodsField_DateTime extends PodsField { 'fjy' => 'F j, Y', 'fjsy' => 'F jS, Y', 'y' => 'Y', + 'c' => 'c', ); $filter = 'pods_form_ui_field_date_formats';
Add `c` as valid date format
pods-framework_pods
train
php
95bb9e7636f70c9fb5a5f6a8d142b621ea27358f
diff --git a/kie-ci/src/test/java/org/kie/scanner/KieRepositoryScannerTest.java b/kie-ci/src/test/java/org/kie/scanner/KieRepositoryScannerTest.java index <HASH>..<HASH> 100644 --- a/kie-ci/src/test/java/org/kie/scanner/KieRepositoryScannerTest.java +++ b/kie-ci/src/test/java/org/kie/scanner/KieRepositoryScannerTest.java @@ -26,7 +26,6 @@ import java.util.List; import static org.junit.Assert.*; import static org.kie.scanner.MavenRepository.getMavenRepository; -@Ignore public class KieRepositoryScannerTest extends AbstractKieCiTest { private FileManager fileManager;
Un-ignore the KieRepositoryScannerTest * the KieScanner tests are suspect to random fails in CI environment. As agreed with Mario, we are enabling the tests to see if they start to fail. If they do, the root cause needs to be found and fixed, so the tests can be executed periodically as a part of the CI build
kiegroup_drools
train
java
6aa6c8945828deb50b2143ddf46f70697b9076fd
diff --git a/lib/chef/data_bag_item.rb b/lib/chef/data_bag_item.rb index <HASH>..<HASH> 100644 --- a/lib/chef/data_bag_item.rb +++ b/lib/chef/data_bag_item.rb @@ -107,9 +107,9 @@ class Chef end def to_hash - result = self.raw_data + result = self.raw_data.dup result["chef_type"] = "data_bag_item" - result["data_bag"] = self.data_bag + result["data_bag"] = self.data_bag.to_s result end diff --git a/spec/unit/data_bag_item_spec.rb b/spec/unit/data_bag_item_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/data_bag_item_spec.rb +++ b/spec/unit/data_bag_item_spec.rb @@ -146,6 +146,8 @@ describe Chef::DataBagItem do data_bag_item } + let!(:original_data_bag_keys) { data_bag_item.keys } + let(:to_hash) { data_bag_item.to_hash } it "should return a hash" do @@ -164,6 +166,11 @@ describe Chef::DataBagItem do it "should have the data_bag set" do expect(to_hash["data_bag"]).to eq("still_lost") end + + it "should not mutate the data_bag_item" do + data_bag_item.to_hash + expect(data_bag_item.keys).to eq(original_data_bag_keys) + end end describe "when deserializing from JSON" do
Fix a bug that was causing DataBagItem.to_hash to mutate the data bag item
chef_chef
train
rb,rb
e1d276468b00b9dd10054830b5b5ca95ccf6b73d
diff --git a/src/util/buildSelectorVariant.js b/src/util/buildSelectorVariant.js index <HASH>..<HASH> 100644 --- a/src/util/buildSelectorVariant.js +++ b/src/util/buildSelectorVariant.js @@ -1,6 +1,7 @@ import escapeClassName from './escapeClassName' import parser from 'postcss-selector-parser' import tap from 'lodash/tap' +import get from 'lodash/get' export default function buildSelectorVariant(selector, variantName, separator, onError = () => {}) { return parser(selectors => { @@ -10,7 +11,12 @@ export default function buildSelectorVariant(selector, variantName, separator, o return } - classSelector.value = `${variantName}${escapeClassName(separator)}${classSelector.value}` + const baseClass = get(classSelector, 'raws.value', classSelector.value) + + classSelector.setPropertyAndEscape( + 'value', + `${variantName}${escapeClassName(separator)}${baseClass}` + ) }) }).processSync(selector) }
Get tests passing with updated dependencies Latest postcss-selector-parser tries to be more intelligent about handling escape sequences for you. This is awesome! But our original code was handling escaping ourselves, so this change gets the tests passing for now, with the intent to stop doing escaping ourselves in the near future and instead rely on postcss-selector-parser to handle it for us, since I'm positive their implementation is significantly more robust.
tailwindcss_tailwindcss
train
js
47bfe4df50acd5bb482692098a022e0ae17691b8
diff --git a/client.go b/client.go index <HASH>..<HASH> 100644 --- a/client.go +++ b/client.go @@ -56,6 +56,17 @@ type Client interface { Closed() bool } +const ( + // OffsetNewest stands for the log head offset, i.e. the offset that will be assigned to the next message + // that will be produced to the partition. You can send this to a client's GetOffset method to get this + // offset, or when calling ConsumePartition to start consuming new messages. + OffsetNewest int64 = -1 + // OffsetOldest stands for the oldest offset available on the broker for a partition. You can send this + // to a client's GetOffset method to get this offset, or when calling ConsumePartition to start consuming + // from the oldest offset that is still available on the broker. + OffsetOldest int64 = -2 +) + type client struct { conf *Config closer chan none diff --git a/consumer.go b/consumer.go index <HASH>..<HASH> 100644 --- a/consumer.go +++ b/consumer.go @@ -97,15 +97,6 @@ func (c *consumer) Close() error { return nil } -const ( - // OffsetNewest causes the consumer to start at the most recent available offset, as - // determined by querying the broker. - OffsetNewest int64 = -1 - // OffsetOldest causes the consumer to start at the oldest available offset, as - // determined by querying the broker. - OffsetOldest int64 = -2 -) - func (c *consumer) ConsumePartition(topic string, partition int32, offset int64) (PartitionConsumer, error) { child := &partitionConsumer{ consumer: c,
Update godoc for OffsetOldest and OffsetNewest, and move these to client.go.
Shopify_sarama
train
go,go
736fbd51c74853bad57634b0d58189d881a38c01
diff --git a/lib/driver.js b/lib/driver.js index <HASH>..<HASH> 100644 --- a/lib/driver.js +++ b/lib/driver.js @@ -113,6 +113,10 @@ function connectBrowser(context, callback) { return; } context.basePath = context.basePath + '/session/' + res.sessionId; + if (context.timeout === 0) { + callback(null); + return; + } request(context, 'POST', '/timeouts/async_script', { ms : context.timeout || 10000 }, function (err) {
Set timeout to `0` to skip setting a log polling timeout
mantoni_min-webdriver
train
js
f7fd2f25eac6d8bb841e90397fc30d73734a022a
diff --git a/km3pipe/utils/tohdf5.py b/km3pipe/utils/tohdf5.py index <HASH>..<HASH> 100644 --- a/km3pipe/utils/tohdf5.py +++ b/km3pipe/utils/tohdf5.py @@ -26,7 +26,7 @@ Options: rough estimate for this (100, 10000000, ...) will greatly improve reading/writing speed and memory usage. Strongly recommended if the - table/array size is >= 100 MB. + table/array size is >= 100 MB. [default: 10000] """ from __future__ import division, absolute_import, print_function @@ -81,7 +81,7 @@ def main(): suffix = '.combined.h5' outfile = args['-o'] or infiles[0] + suffix - n_rows_expected = args['--expected-rows'] + n_rows_expected = int(args['--expected-rows']) use_jppy_pump = args['--jppy'] aa_format = args['--aa-format'] aa_lib = args['--aa-lib']
CLI provide `-e` default and cast to int
tamasgal_km3pipe
train
py
dfa83f6d84bee6f6a29663bb7a47e6130e86727c
diff --git a/test/mouse.js b/test/mouse.js index <HASH>..<HASH> 100644 --- a/test/mouse.js +++ b/test/mouse.js @@ -22,3 +22,26 @@ test('Move the mouse.', function(t) t.ok(currentPos.x === 100, 'mousepos.x is correct.'); t.ok(currentPos.y === 100, 'mousepos.y is correct.'); }); + +test('Drag the mouse.', function(t) +{ + t.plan(4); + + t.ok(robot.dragMouse(5, 5) === 1, 'successfully dragged the mouse.'); + + t.throws(function() + { + robot.dragMouse(0); + }, /Invalid number/, 'drag mouse to (0).'); + + t.throws(function() + { + robot.dragMouse(1, 1, "left", 5); + }, /Invalid number/, 'drag mouse with extra argument.'); + + t.throws(function() + { + robot.dragMouse(2, 2, "party"); + }, /Invalid mouse/, 'drag an incorrect mouse button (party).'); + +});
Tests for dragMouse.
octalmage_robotjs
train
js
5aaf86defa2763b6c888300cf36071e5a3a43e39
diff --git a/lib/fog/aws/models/ec2/security_group.rb b/lib/fog/aws/models/ec2/security_group.rb index <HASH>..<HASH> 100644 --- a/lib/fog/aws/models/ec2/security_group.rb +++ b/lib/fog/aws/models/ec2/security_group.rb @@ -10,11 +10,22 @@ module Fog attribute :ip_permissions, 'ipPermissions' attribute :owner_id, 'ownerId' - def authorize(options = {}) - options = { - 'GroupName' => @group_name - }.merge!(options) - connection.authorize_security_group_ingress(options) + def authorize_group_and_owner(group, owner) + connection.authorize_security_group_ingress( + 'GroupName' => @group_name + 'SourceSecurityGroupName' => group, + 'SourceSecurityGroupOwnerId' => owner + ) + end + + def authorize_port_range(range, options = {}) + connection.authorize_security_group_ingress( + 'CidrIp' => options[:cidr_ip] || '0.0.0.0/0', + 'FromPort' => range.min, + 'GroupName' => @group_name, + 'ToPort' => range.max, + 'IpProtocol' => options[:ip_protocol] || 'tcp' + ) end def destroy
nicer model interface to authorizing security group ingresses
fog_fog
train
rb
3037423a8f81ac69c170231c311984f4c2bd396f
diff --git a/router/src/main/java/io/micronaut/web/router/DefaultRouteBuilder.java b/router/src/main/java/io/micronaut/web/router/DefaultRouteBuilder.java index <HASH>..<HASH> 100644 --- a/router/src/main/java/io/micronaut/web/router/DefaultRouteBuilder.java +++ b/router/src/main/java/io/micronaut/web/router/DefaultRouteBuilder.java @@ -385,7 +385,7 @@ public abstract class DefaultRouteBuilder implements RouteBuilder { return buildRoute(httpMethod, uri, executableHandle); } - private UriRoute buildRoute(HttpMethod httpMethod, String uri, MethodExecutionHandle<?, Object> executableHandle) { + protected UriRoute buildRoute(HttpMethod httpMethod, String uri, MethodExecutionHandle<?, Object> executableHandle) { DefaultUriRoute route; if (currentParentRoute != null) { route = new DefaultUriRoute(httpMethod, currentParentRoute.uriMatchTemplate.nest(uri), executableHandle);
Allow registering a route with an execution handle directly
micronaut-projects_micronaut-core
train
java
8a5c907501457d71a1fcb3978fd02584448928fd
diff --git a/src/FormHandler.php b/src/FormHandler.php index <HASH>..<HASH> 100644 --- a/src/FormHandler.php +++ b/src/FormHandler.php @@ -715,6 +715,10 @@ class FormHandler $this->restoreDataHandler->setRestorableErrors($this, $this->getValidationErrors()); } + if (isset($this->restoreDataHandler)) { + $this->restoreDataHandler->setInvalid($this); + } + return false; } } diff --git a/src/RestoreDataHandler/RestoreDataHandlerInterface.php b/src/RestoreDataHandler/RestoreDataHandlerInterface.php index <HASH>..<HASH> 100644 --- a/src/RestoreDataHandler/RestoreDataHandlerInterface.php +++ b/src/RestoreDataHandler/RestoreDataHandlerInterface.php @@ -59,6 +59,14 @@ interface RestoreDataHandlerInterface public function setValid(FormHandler $formHandler); /** + * If called, the form was not valid + * + * @param FormHandler $formHandler + * @return mixed + */ + public function setInvalid(FormHandler $formHandler); + + /** * Check if the form was valid * * @param FormHandler $formHandler
Update the restore data handler if the form becomes invalid after initially passing as valid
andyvenus_form
train
php,php
c8ad1e2e530919f968f59a8ffef8b737c1d2a3ee
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -var Through = require('Through2'); +var Through = require('through2'); var Revisioner = require('./revisioner'); var RevAll = (function () {
fix(tests): Fix through2 include
smysnk_gulp-rev-all
train
js
5211ab6f1dc87af951628417baf68cd46f2bf852
diff --git a/run_tests.py b/run_tests.py index <HASH>..<HASH> 100644 --- a/run_tests.py +++ b/run_tests.py @@ -22,7 +22,7 @@ if not settings.configured: db_config = { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'USER': 'postgres', - 'NAME': 'manager_utils', + 'NAME': 'regex_field', } else: raise RuntimeError('Unsupported test DB {0}'.format(test_db))
updated test db settings to work with travis
ambitioninc_django-regex-field
train
py
b828add4469e208ef88ccdb9c88900cb4c101a24
diff --git a/salt/output/__init__.py b/salt/output/__init__.py index <HASH>..<HASH> 100644 --- a/salt/output/__init__.py +++ b/salt/output/__init__.py @@ -29,6 +29,7 @@ import salt.ext.six as six log = logging.getLogger(__name__) + def get_progress(opts, out, progress): ''' Get the progress bar from the given outputter
Add blank line to conform with PEP8 (E<I>).
saltstack_salt
train
py
a6e7f9dfc6b0624e59005da75fca267bae1b06b5
diff --git a/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java b/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java index <HASH>..<HASH> 100644 --- a/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java +++ b/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java @@ -493,6 +493,10 @@ public class GenericStyledArea<PS, SEG, S> extends Region // rich text changes @Override public final EventStream<RichTextChange<PS, SEG, S>> richChanges() { return content.richChanges(); } + private final SuspendableEventStream<?> viewportDirty; + /** Returns an EventStream that emits an event every time the viewport becomes dirty */ + public final EventStream<?> viewportDirtyEvents() { return viewportDirty; } + /* ********************************************************************** * * * * Private fields * @@ -509,8 +513,6 @@ public class GenericStyledArea<PS, SEG, S> extends Region private boolean followCaretRequested = false; - private final SuspendableEventStream<?> viewportDirty; - /* ********************************************************************** * * * * Fields necessary for Cloning *
Expose viewport dirty as public API
FXMisc_RichTextFX
train
java
c3b97d7d2f6642a3c53f364d066e516f111ee30f
diff --git a/telemetry/telemetry/core/backends/chrome/desktop_browser_backend.py b/telemetry/telemetry/core/backends/chrome/desktop_browser_backend.py index <HASH>..<HASH> 100644 --- a/telemetry/telemetry/core/backends/chrome/desktop_browser_backend.py +++ b/telemetry/telemetry/core/backends/chrome/desktop_browser_backend.py @@ -142,10 +142,21 @@ class DesktopBrowserBackend(chrome_browser_backend.ChromeBrowserBackend): if not os.path.isfile(port_file): # File isn't ready yet. Return false. Will retry. return False - with open(port_file) as f: - port_string = f.read() - self._port = int(port_string) - logging.info('Discovered ephemeral port %s' % self._port) + # Attempt to avoid reading the file until it's populated. + got_port = False + try: + if os.stat(port_file).st_size > 0: + with open(port_file) as f: + port_string = f.read() + self._port = int(port_string) + logging.info('Discovered ephemeral port %s' % self._port) + got_port = True + except Exception: + # Both stat and open can throw exceptions. + pass + if not got_port: + # File isn't ready yet. Return false. Will retry. + return False return super(DesktopBrowserBackend, self).HasBrowserFinishedLaunching() def GetBrowserStartupArgs(self):
Make Telemetry more robust during ephemeral port handshake. On Windows, if the browser is still writing the DevToolsActivePort file when Telemetry attempts to open it, Python will raise an IOError. Make the Telemetry-side code more robust when reading the file containing the port. BUG=<I> Review URL: <URL>
catapult-project_catapult
train
py
a20ead36bb715d861f2ef7b9d40a2466734dc80d
diff --git a/library/CM/PagingSource/Search/Location.php b/library/CM/PagingSource/Search/Location.php index <HASH>..<HASH> 100644 --- a/library/CM/PagingSource/Search/Location.php +++ b/library/CM/PagingSource/Search/Location.php @@ -3,6 +3,6 @@ class CM_PagingSource_Search_Location extends CM_PagingSource_Search { function __construct(CM_SearchQuery_Abstract $query) { - parent::__construct(new SK_Elastica_Type_Location(), $query, array('level', 'id')); + parent::__construct(new CM_Elastica_Type_Location(), $query, array('level', 'id')); } }
Fix: Use CM's location index
cargomedia_cm
train
php
946a1cdf8fe3b5d022208f1625a43d162eabf3ab
diff --git a/autopython/cpython.py b/autopython/cpython.py index <HASH>..<HASH> 100644 --- a/autopython/cpython.py +++ b/autopython/cpython.py @@ -58,7 +58,7 @@ class Quitter(object): if self.__shell._interacting: self.__shell._interacting = False else: - return func() + return self.__func() def __repr__(self): return repr(self.__func)
"AttributeError" (sometimes I miss static typing)
gosella_autopython
train
py
2cbdf358b19520ac690ef5e3788ca6fb9f2c2259
diff --git a/__init__.py b/__init__.py index <HASH>..<HASH> 100644 --- a/__init__.py +++ b/__init__.py @@ -44,7 +44,7 @@ def qgisMinimumVersion(): def icon(): """Icon path for the plugin - metadata.txt it will override this""" - return = os.path.join(os.path.dirname(__file__), 'gui', 'resources', + return os.path.join(os.path.dirname(__file__), 'gui', 'resources', 'img', 'icon.png')
Don't use assignment when setting icon (fixes load error with last commit)
inasafe_inasafe
train
py
9cc01b28098ca2cb087408372fa62878f32e931a
diff --git a/dropwizard-auth/src/main/java/io/dropwizard/auth/PolymorphicAuthDynamicFeature.java b/dropwizard-auth/src/main/java/io/dropwizard/auth/PolymorphicAuthDynamicFeature.java index <HASH>..<HASH> 100644 --- a/dropwizard-auth/src/main/java/io/dropwizard/auth/PolymorphicAuthDynamicFeature.java +++ b/dropwizard-auth/src/main/java/io/dropwizard/auth/PolymorphicAuthDynamicFeature.java @@ -44,14 +44,9 @@ public class PolymorphicAuthDynamicFeature<T extends Principal> implements Dynam for (final Annotation annotation : parameterAnnotations[i]) { if (annotation instanceof Auth && authFilterMap.containsKey(paramType)) { - if (type == Optional.class) { - final ContainerRequestFilter filter = authFilterMap.get(paramType); - context.register(new WebApplicationExceptionCatchingFilter(filter)); - return; - } else { - context.register(authFilterMap.get(type)); - return; - } + final ContainerRequestFilter filter = authFilterMap.get(paramType); + context.register(type == Optional.class ? new WebApplicationExceptionCatchingFilter(filter) : filter); + return; } } }
Eliminate duplication in PolymorphicAuthDynamicFeature This if statement had a fair amount of duplication. Refactor the flow to be simpler.
dropwizard_dropwizard
train
java
7430ed8db20a7045bd924c8d9ff2284ff4f70ead
diff --git a/webpack.config.js b/webpack.config.js index <HASH>..<HASH> 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,7 +9,7 @@ module.exports = env => { let mode = env.production ? "production" : "development"; let tsconfig = !env.karma ? "tsconfig.json" : "tsconfig.test.json"; let output = env.production ? "dist" : "dist-test"; - let filename = env.production ? "robotlegs-pixi.min.js" : "robotlegs-pixi.js"; + let filename = env.karma ? "[name].[hash].js" : (env.production ? "robotlegs-pixi.min.js" : "robotlegs-pixi.js"); return { mode: mode,
update webpack settings to generate hashed entry files for karma
RobotlegsJS_RobotlegsJS-Pixi
train
js
1978482b96f82cb76851a11a70b1244ea0e595e1
diff --git a/paypal/response.py b/paypal/response.py index <HASH>..<HASH> 100644 --- a/paypal/response.py +++ b/paypal/response.py @@ -95,6 +95,10 @@ class PayPalResponse(object): # of each one. Hasn't failed us so far. return value[0] return value + + def items(self): + for key in self.raw.keys(): + yield (key, self.__getitem__(key)) def success(self): """
Implements items method on PayPalResponse
gtaylor_paypal-python
train
py
e304117a934d3a24cff526aa9e84c2ca95f87f66
diff --git a/frasco_forms/__init__.py b/frasco_forms/__init__.py index <HASH>..<HASH> 100644 --- a/frasco_forms/__init__.py +++ b/frasco_forms/__init__.py @@ -67,7 +67,7 @@ class FormsFeature(Feature): obj = DictObject(obj) if csrf_enabled is None: csrf_enabled = self.options["csrf_enabled"] - form = form(obj=obj, csrf_enabled=csrf_enabled) + form = form(obj=obj, meta={'csrf': csrf_enabled}) current_context.data.form = form yield form diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup, find_packages setup( name='frasco-forms', - version='0.2.1', + version='0.3', url='http://github.com/frascoweb/frasco-forms', license='MIT', author='Maxime Bouroumeau-Fuseau', @@ -17,7 +17,7 @@ setup( platforms='any', install_requires=[ 'frasco', - 'Flask-WTF>=0.9.5', + 'Flask-WTF>=0.14.0', 'inflection' ] )
updated flask-wtf version
frascoweb_frasco-forms
train
py,py
775ad174ba5f3b106b26418d676a2324f2263ad3
diff --git a/lib/table.js b/lib/table.js index <HASH>..<HASH> 100644 --- a/lib/table.js +++ b/lib/table.js @@ -90,7 +90,7 @@ function table(data, options) { let cell = col.get(row); col.width = Math.max( - col.label.length, + _.result(col, 'label').length, col.width, calcWidth(cell) );
fix table widths if the label is longer than any of the cell data this doesn't calculate the label correctly
heroku_heroku-cli-util
train
js
7905e37874685a79fa79eda92d3a79e55f72d59b
diff --git a/src/main/java/com/bugsnag/SessionTracker.java b/src/main/java/com/bugsnag/SessionTracker.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/bugsnag/SessionTracker.java +++ b/src/main/java/com/bugsnag/SessionTracker.java @@ -9,8 +9,6 @@ import java.util.UUID; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Semaphore; import java.util.concurrent.atomic.AtomicReference; -import java.util.concurrent.atomic.AtomicStampedReference; -import java.util.function.UnaryOperator; class SessionTracker {
fix: remove unused import which breaks jdk 7
bugsnag_bugsnag-java
train
java
1e72aa6d069c1c23c5922a7f8e25137f7d463149
diff --git a/spec/unit/view_helpers/form_helper_spec.rb b/spec/unit/view_helpers/form_helper_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/view_helpers/form_helper_spec.rb +++ b/spec/unit/view_helpers/form_helper_spec.rb @@ -10,7 +10,7 @@ describe ActiveAdmin::ViewHelpers::FormHelper do end it "should filter out the field passed via the option :except" do - view.hidden_field_tags_for({:scope => "All", :filter => "None"}, except: :filter).should == + view.hidden_field_tags_for({:scope => "All", :filter => "None"}, :except => :filter).should == %{<input id="scope" name="scope" type="hidden" value="All" />} end end
Fix for Ruby <I> on recent pull request
activeadmin_activeadmin
train
rb
b50f42485bbcfbb99f1684460d28a6fdc93afdc9
diff --git a/Auth.php b/Auth.php index <HASH>..<HASH> 100644 --- a/Auth.php +++ b/Auth.php @@ -1218,6 +1218,13 @@ class Auth return $return; } + if ($this->isEmailTaken($email)) { + $this->addAttempt(); + $return['message'] = $this->lang["email_taken"]; + + return $return; + } + $validatePassword = $this->validatePassword($password); if ($validatePassword['error'] == 1) {
Check if email is already taken in changeEmail()
PHPAuth_PHPAuth
train
php
26cd9bdf595848473410e373387ece128ad1fb45
diff --git a/server/integration/testsuite/src/test/java/org/infinispan/server/test/client/hotrod/HotRodRemoteCacheCompatIT.java b/server/integration/testsuite/src/test/java/org/infinispan/server/test/client/hotrod/HotRodRemoteCacheCompatIT.java index <HASH>..<HASH> 100644 --- a/server/integration/testsuite/src/test/java/org/infinispan/server/test/client/hotrod/HotRodRemoteCacheCompatIT.java +++ b/server/integration/testsuite/src/test/java/org/infinispan/server/test/client/hotrod/HotRodRemoteCacheCompatIT.java @@ -51,6 +51,7 @@ public class HotRodRemoteCacheCompatIT { @AfterClass public static void release() { if (remoteCacheManager != null) { + remoteCacheManager.getCache(CACHE_NAME).clear(); remoteCacheManager.stop(); } }
ISPN-<I> Clean compatibility cache after tests
infinispan_infinispan
train
java
26720dae13e0614f38ea7fe44c67f5902ede1b09
diff --git a/src/Eseye.php b/src/Eseye.php index <HASH>..<HASH> 100644 --- a/src/Eseye.php +++ b/src/Eseye.php @@ -246,6 +246,11 @@ class Eseye if (in_array(strtolower($method), $this->cachable_verb) && ! $result->expired()) $this->getCache()->set($uri->getPath(), $uri->getQuery(), $result); + // In preperation for the next request, perform some + // self cleanups of this objects request data such as + // query string parameters and post bodies. + $this->cleanupRequestData(); + return $result; } @@ -415,4 +420,38 @@ class Eseye return $this->request_body; } + + /** + * @return \Seat\Eseye\Eseye + */ + public function cleanupRequestData(): self + { + + $this->unsetBody(); + $this->unsetQueryString(); + + return $this; + } + + /** + * @return \Seat\Eseye\Eseye + */ + public function unsetBody(): self + { + + $this->request_body = []; + + return $this; + } + + /** + * @return \Seat\Eseye\Eseye + */ + public function unsetQueryString(): self + { + + $this->query_string = []; + + return $this; + } }
Perform cleanups of request elements after an invoke().
eveseat_eseye
train
php
a87e62fe4171e5145da9aa75b8dd8e0aa6a78516
diff --git a/pycbc/workflow/jobsetup.py b/pycbc/workflow/jobsetup.py index <HASH>..<HASH> 100644 --- a/pycbc/workflow/jobsetup.py +++ b/pycbc/workflow/jobsetup.py @@ -635,6 +635,7 @@ class PyCBCInspiralExecutable(Executable): constant_psd_segs = int(self.get_opt('psd-recalculate-segments')) if constant_psd_segs is None: constant_psd_segs = min_analysis_segs + max_analysis_segs = min_analysis_segs if min_analysis_segs % constant_psd_segs != 0: raise ValueError('Constant PSD segments does not evenly divide the '
use min analysis segs when constant segs not given in inspiral job
gwastro_pycbc
train
py
15ba342b6511d0557435182d815690aa6b8e6aef
diff --git a/shim.php b/shim.php index <HASH>..<HASH> 100644 --- a/shim.php +++ b/shim.php @@ -35,4 +35,9 @@ namespace Codeception\Platform { namespace { class_alias('Codeception\TestInterface', 'Codeception\TestCase'); + + //Compatibility with Symfony 5 + if (!class_exists('Symfony\Component\EventDispatcher\Event') && class_exists('Symfony\Contracts\EventDispatcher\Event')) { + class_alias('Symfony\Contracts\EventDispatcher\Event', 'Symfony\Component\EventDispatcher\Event'); + } }
Symfony 5: EventDispatcher\Event was moved to different namespace
Codeception_Codeception
train
php
53af56014a17270e5630b875f3b6e895bcd5203b
diff --git a/can/interfaces/serial/serial_can.py b/can/interfaces/serial/serial_can.py index <HASH>..<HASH> 100644 --- a/can/interfaces/serial/serial_can.py +++ b/can/interfaces/serial/serial_can.py @@ -43,7 +43,7 @@ class SerialBus(BusABC): """ if channel == '': - raise TypeError("Must specify a serial port.") + raise ValueError("Must specify a serial port.") else: self.channel_info = "Serial interface: " + channel bitrate = kwargs.get('bitrate', 115200)
Set error from TypeError to ValueError for missing channel
hardbyte_python-can
train
py
e4c2c7601830aa869addbdccb5a6f9a91a028450
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -30,6 +30,7 @@ module.exports = function (file, options) { var data = ''; var ext = path.extname(file); options = options || {}; + options.extensions = options.extensions || ['.js']; var stream = through(write, end); return stream; @@ -42,7 +43,7 @@ module.exports = function (file, options) { , isUMD = false , supportsCommonJs = false; - if (ext.toLowerCase() === '.js') { + if (~options.extensions.indexOf(ext.toLowerCase())) { try { ast = esprima.parse(data) } catch (error) {
Optionally, support extensions other than just '.js'
jaredhanson_deamdify
train
js
2ce4407b96eb130d3b70de7fd4026231bc69f094
diff --git a/gtk/gtk_since_3_10.go b/gtk/gtk_since_3_10.go index <HASH>..<HASH> 100644 --- a/gtk/gtk_since_3_10.go +++ b/gtk/gtk_since_3_10.go @@ -552,6 +552,10 @@ func (v *ListBoxRow) GetHeader() (IWidget, error) { // SetHeader is a wrapper around gtk_list_box_row_set_header(). func (v *ListBoxRow) SetHeader(header IWidget) { + if header == nil { + C.gtk_list_box_row_set_header(v.native(), nil) + return + } C.gtk_list_box_row_set_header(v.native(), header.toWidget()) }
fix crash in SetHeader if header is nil
gotk3_gotk3
train
go
852c035e8dfaaadf328ef262e3d2022ca904cdb2
diff --git a/Config/bootstrap.php b/Config/bootstrap.php index <HASH>..<HASH> 100644 --- a/Config/bootstrap.php +++ b/Config/bootstrap.php @@ -1,7 +1,7 @@ <?php if (Configure::read('HtmlPurifier.standalone') != true) { - require_once( CakePlugin::path('HtmlPurifier') . 'Vendor' . DS . 'HtmlPurifier' . DS . 'library' . DS . 'HTMLPurifier.auto.php' ); + require_once(CakePlugin::path('HtmlPurifier') . 'Vendor' . DS . 'HtmlPurifier' . DS . 'library' . DS . 'HTMLPurifier.auto.php'); } else { - require_once( CakePlugin::path('HtmlPurifier') . 'Vendor' . DS . 'Htmlpurifier-4.4.0-standalone' . DS . 'HTMLPurifier.standalone.php' ); + require_once(CakePlugin::path('HtmlPurifier') . 'Vendor' . DS . 'htmlpurifier-4.4.0-standalone' . DS . 'HTMLPurifier.standalone.php'); } App::uses('Purifier', 'HtmlPurifier.Lib'); \ No newline at end of file
Fixing an issue for case-sensitive file systems in bootstrap.php
burzum_cakephp-html-purifier
train
php
08b49883243c4ede7c8bd92a279b37f30c313895
diff --git a/libraries/Maniaplanet/DedicatedServer/Connection.php b/libraries/Maniaplanet/DedicatedServer/Connection.php index <HASH>..<HASH> 100644 --- a/libraries/Maniaplanet/DedicatedServer/Connection.php +++ b/libraries/Maniaplanet/DedicatedServer/Connection.php @@ -432,7 +432,7 @@ class Connection throw new InvalidArgumentException('ratios = '.print_r($ratios, true)); foreach($ratios as $i => &$ratio) { - if(!$ratio->isValid()) + if(!($ratio instanceof Structures\VoteRatio && $ratio->isValid())) throw new InvalidArgumentException('ratios['.$i.'] = '.print_r($ratios, true)); $ratio = $ratio->toArray(); }
Missing check in setCallVoteRatios
maniaplanet_dedicated-server-api
train
php
adf5d39933c4900d9a7e896ca5bc517291503e48
diff --git a/tests/test_storage.py b/tests/test_storage.py index <HASH>..<HASH> 100644 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -66,6 +66,9 @@ class TestStorage(unittest.TestCase): self.storage_backend.create_folder, '/none/existent/path') self.assertRaises(securesystemslib.exceptions.StorageError, + self.storage_backend.create_folder, '') + + self.assertRaises(securesystemslib.exceptions.StorageError, self.storage_backend.list_folder, '/none/existent/path') @@ -97,6 +100,3 @@ class TestStorage(unittest.TestCase): fi.write(leaf.encode('utf-8')) found_leaves = self.storage_backend.list_folder(folder) self.assertListEqual(leaves, sorted(found_leaves)) - - # Test trying to create a folder with an empty string - self.storage_backend.create_folder('')
Move the empty path exception check The check if an exception is thrown when calling the securesystemslib.storage.FilesystemBackend.create_folder() function with empty string is better suited to be in the test_exceptions function in the tests/test_storage.py where the rest exception checks are.
secure-systems-lab_securesystemslib
train
py
407f2367a223cef6eed3f20b8f34116694a3dbc2
diff --git a/lib/jmespath/nodes/subexpression.rb b/lib/jmespath/nodes/subexpression.rb index <HASH>..<HASH> 100644 --- a/lib/jmespath/nodes/subexpression.rb +++ b/lib/jmespath/nodes/subexpression.rb @@ -46,7 +46,7 @@ module JMESPath end def optimize - children = @children.dup + children = @children.map(&:optimize) index = 0 while index < children.size - 1 if children[index].is_a?(Field) && children[index + 1].is_a?(Field)
Optimize an extra time in Chain Right now the children of a Chain are guaranteed to be optimized, but if it were used from somewhere else that would not hold.
jmespath_jmespath.rb
train
rb
1e2d28baa88f3a021604787c1356d6be1077be7e
diff --git a/lib/parser.rb b/lib/parser.rb index <HASH>..<HASH> 100644 --- a/lib/parser.rb +++ b/lib/parser.rb @@ -165,7 +165,13 @@ module OpenTox File.delete(file.path) data.each do |id,entry| entry[:values].each do |value_id| - value = feature_values[value_id].split(/\^\^/).first # remove XSD.type + split = feature_values[value_id].split(/\^\^/) + case split[-1] + when XSD.double + value = split.first.to_f + else + value = split.first + end @dataset.add entry[:compound],feature[value_id],value end end
adjust rdf dataset parsing: take XSD type into account
opentox_lazar
train
rb
dbecda12184f9622711032aa6dcdbbd3cce99551
diff --git a/lib/deride.js b/lib/deride.js index <HASH>..<HASH> 100644 --- a/lib/deride.js +++ b/lib/deride.js @@ -64,8 +64,8 @@ var Expectations = function() { assert.equal(timesCalled, 1, err); } - function calledTwice() { - assert.equal(timesCalled, 2); + function calledTwice(err) { + assert.equal(timesCalled, 2, err); } function call() { diff --git a/test/test-deride.js b/test/test-deride.js index <HASH>..<HASH> 100644 --- a/test/test-deride.js +++ b/test/test-deride.js @@ -165,6 +165,14 @@ _.forEach(tests, function(test) { done(); }); + it('can return a bespoke error for called twice', function(done) { + bob = deride.wrap(bob); + assert.throws(function() { + bob.expect.greet.called.twice('This is a bespoke error'); + }, /This is a bespoke error/); + done(); + }); + it('enables the determination that a method has NEVER been called', function(done) { bob = deride.wrap(bob); bob.expect.greet.called.never();
Added bespoke error to .twice
guzzlerio_deride
train
js,js
76bf8e6a1cb7691dce79bcce0977a3b849be9e1e
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ if sys.version_info < (3, 0): setup(name='picotui', - version='0.7', + version='0.8', description="""A simple text user interface (TUI) library.""", long_description=open('README.rst').read(), url='https://github.com/pfalcon/picotui',
setup.py: Release <I>.
pfalcon_picotui
train
py
a8a0d6087ffb37544638cea6962723f30624a1f6
diff --git a/src/javascript/runtime/Runtime.js b/src/javascript/runtime/Runtime.js index <HASH>..<HASH> 100644 --- a/src/javascript/runtime/Runtime.js +++ b/src/javascript/runtime/Runtime.js @@ -108,6 +108,15 @@ define('moxie/runtime/Runtime', [ // e.g. runtime.can('use_http_method', 'put') use_http_method: true }, caps); + + + if (Basic.typeOf(defaultMode) === 'undefined') { + defaultMode = 'browser'; + // default to the mode that is compatible with preferred caps + if (options.preferred_caps) { + defaultMode = Runtime.getMode(modeCaps, options.preferred_caps, defaultMode); + } + } // small extension factory here (is meant to be extended with actual extensions constructors)
Runtime: Introduce preferred_caps - a way to affect the defaultMode of the runtime.
moxiecode_moxie
train
js
68d8aee0ccfa0c94c090761057e5b6e26b952f85
diff --git a/tests/www/tests.js b/tests/www/tests.js index <HASH>..<HASH> 100644 --- a/tests/www/tests.js +++ b/tests/www/tests.js @@ -174,6 +174,8 @@ exports.defineAutoTests = function() { }); it("should set application/json for a .json file", function(done) { + pendingOnAndroid(); + fetchFromLocalServer("/some-data.json").then(function(response) { expect(response.headers.get("Content-Type")).toEqual("application/json"); done(); @@ -216,6 +218,8 @@ exports.defineAutoTests = function() { }); it("should set application/octet-stream for files without an extension", function(done) { + pendingOnAndroid(); + fetchFromLocalServer("/some-file").then(function(response) { expect(response.headers.get("Content-Type")).toEqual("application/octet-stream"); done();
Mark two MIME tests as pending on Android Making these pass would require changes to CordovaResourceApi.getMimeTypeFromPath().
meteor_cordova-plugin-meteor-webapp
train
js
c4b8a13968f0464e0a6506ede4e93600003c985a
diff --git a/guacamole-common-js/src/main/webapp/modules/SessionRecording.js b/guacamole-common-js/src/main/webapp/modules/SessionRecording.js index <HASH>..<HASH> 100644 --- a/guacamole-common-js/src/main/webapp/modules/SessionRecording.js +++ b/guacamole-common-js/src/main/webapp/modules/SessionRecording.js @@ -613,7 +613,7 @@ Guacamole.SessionRecording = function SessionRecording(source) { return; playbackClient.importState(JSON.parse(text)); - currentFrame = index; + currentFrame = startIndex; }); break;
GUACAMOLE-<I>: State of recording after resetting to a keyframe is the index of that keyframe, not necessarily the requested seek index. Further instructions may need to be replayed after seeking to the keyframe in order to reach the desired frame index.
glyptodon_guacamole-client
train
js
7fe4a31f640a4c253a1c7f74f83103cfc6ec142c
diff --git a/lib/apiary/command/styleguide.rb b/lib/apiary/command/styleguide.rb index <HASH>..<HASH> 100644 --- a/lib/apiary/command/styleguide.rb +++ b/lib/apiary/command/styleguide.rb @@ -110,7 +110,7 @@ module Apiary::Command method = :post unless method begin - response = RestClient::Request.execute(method: method, url: url, payload: data, headers: headers, verify_ssl: false) + response = RestClient::Request.execute(method: method, url: url, payload: data, headers: headers) rescue RestClient::Exception => e begin err = JSON.parse e.response diff --git a/lib/apiary/version.rb b/lib/apiary/version.rb index <HASH>..<HASH> 100644 --- a/lib/apiary/version.rb +++ b/lib/apiary/version.rb @@ -1,3 +1,3 @@ module Apiary - VERSION = '0.9.0'.freeze + VERSION = '0.9.1'.freeze end
fix: verify ssl in styleguide command (leftover from development)
apiaryio_apiary-client
train
rb,rb
26cb3ca064916f0f5b0f63a707ddaad048aceaca
diff --git a/go/vt/vttablet/tabletserver/connpool/dbconn.go b/go/vt/vttablet/tabletserver/connpool/dbconn.go index <HASH>..<HASH> 100644 --- a/go/vt/vttablet/tabletserver/connpool/dbconn.go +++ b/go/vt/vttablet/tabletserver/connpool/dbconn.go @@ -65,8 +65,12 @@ type DBConn struct { // NewDBConn creates a new DBConn. It triggers a CheckMySQL if creation fails. func NewDBConn(cp *Pool, appParams dbconfigs.Connector) (*DBConn, error) { + start := time.Now() + defer cp.env.Stats().MySQLTimings.Record("Connect", start) + c, err := dbconnpool.NewDBConnection(appParams) if err != nil { + cp.env.Stats().MySQLTimings.Record("ConnectError", start) cp.env.CheckMySQL() return nil, err }
componentization: add missed out MySQL vars
vitessio_vitess
train
go
42b0ef094792cf996517019959db3f8acff70ef9
diff --git a/includes/controllers/individual_ctrl.php b/includes/controllers/individual_ctrl.php index <HASH>..<HASH> 100644 --- a/includes/controllers/individual_ctrl.php +++ b/includes/controllers/individual_ctrl.php @@ -428,7 +428,7 @@ class IndividualController extends BaseController { for($i=0; $i<$ct; $i++) { echo '<div>'; $fact = trim($nmatch[$i][1]); - if (($fact!="SOUR")&&($fact!="NOTE")&&($fact!="GIVN")&&($fact!="SURN")) { + if (($fact!="SOUR")&&($fact!="NOTE")&&($fact!="GIVN")&&($fact!="SURN")&&($fact!="SPFX")) { echo '<dl><dt class="label">', translate_fact($fact, $this->indi), '</dt>'; echo '<span class="field">'; if (isset($nmatch[$i][2])) {
Don't show a SPFX without its SURN
fisharebest_webtrees
train
php
b3cb456ede852d22aa25c727ac038c1468ed77ef
diff --git a/pyecharts/js_extensions.py b/pyecharts/js_extensions.py index <HASH>..<HASH> 100644 --- a/pyecharts/js_extensions.py +++ b/pyecharts/js_extensions.py @@ -14,7 +14,7 @@ OFFICIAL_PLUGINS = [ "echarts_china_cities_pypkg", "echarts_countries_pypkg" ] -THIRD_PARTY_PLUGIN_PREFIX = "pyecharts_" +THIRD_PARTY_PLUGIN_PREFIX = "echarts_" JS_EXTENSION_REGISTRY = 'registry.json' REGISTRY_JS_FOLDER = 'JS_FOLDER'
:hammer: all javascript extension will need start with echarts_
pyecharts_pyecharts
train
py
de2de00de90271049424f819092e052ca88a10ac
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -101,7 +101,7 @@ def main(): python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', install_requires=install_requires, extras_require=extras_require, - packages=['_pytest', '_pytest.assertion', '_pytest._code'], + packages=['_pytest', '_pytest.assertion', '_pytest._code', '_pytest.mark'], py_modules=['pytest'], zip_safe=False, )
update setup.py for the mark package
pytest-dev_pytest
train
py
82e2c3bf13c0947812a75ae5e9edd6fd5011493f
diff --git a/src/lib/CollectStore.js b/src/lib/CollectStore.js index <HASH>..<HASH> 100644 --- a/src/lib/CollectStore.js +++ b/src/lib/CollectStore.js @@ -541,7 +541,7 @@ export default class CollectStore { return konnector ? konnectors.fetchManifest(cozy.client, konnector.repo) .then(this.manifestToKonnector) .catch(error => { - console.warn && console.warn(`Cannot fetch konnector's manifest (Error ${error.status})`) + console.warn && console.warn(`Cannot fetch konnector's manifest (Error ${error.status})`, error) return konnector }) : null }) diff --git a/src/lib/konnectors.js b/src/lib/konnectors.js index <HASH>..<HASH> 100644 --- a/src/lib/konnectors.js +++ b/src/lib/konnectors.js @@ -41,7 +41,7 @@ export function addAccount (cozy, konnector, account) { export function fetchManifest (cozy, source) { return source ? cozy.fetchJSON('GET', `/konnectors/manifests?Source=${encodeURIComponent(source)}`) - : Promise.reject(new Error('Source konnector is unavailable')) + : Promise.reject(new Error('A source must be provided to fetch the konnector manifest')) } let cachedSlugIndex
📚 doc: better logs
cozy_cozy-home
train
js,js
12fd6e5ffd88be60b3e1163f562235d3c7ad697b
diff --git a/js/bitfinex2.js b/js/bitfinex2.js index <HASH>..<HASH> 100644 --- a/js/bitfinex2.js +++ b/js/bitfinex2.js @@ -515,7 +515,7 @@ module.exports = class bitfinex2 extends bitfinex { 'info': market, }; if (swap) { - const settlementCurrencies = this.options['swap']['fetchMarkets']['settlementCurrencies']; + const settlementCurrencies = [ 'USDT' ]; // this.options['swap']['fetchMarkets']['settlementCurrencies']; for (let j = 0; j < settlementCurrencies.length; j++) { const settle = settlementCurrencies[j]; parsedMarket['settle'] = settle;
bitfinex2 - only USDT settled in CCXT, but exchange allows BTC and USDT settled
ccxt_ccxt
train
js
7b7b5b6711dc00f99d744f4d3479cf721716958e
diff --git a/lib/rtm_time.rb b/lib/rtm_time.rb index <HASH>..<HASH> 100644 --- a/lib/rtm_time.rb +++ b/lib/rtm_time.rb @@ -24,7 +24,7 @@ module RtmTime @hour = nil @min = nil - parsed = time_str.scan(/(?:([0-9\.]+)\s*([^0-9]+|\z))/u) + parsed = time_str.sub(/[PT]/, ' ').scan(/(?:([0-9\.]+)\s*([^0-9]+|\z))/u) if parsed.size > 0 # d, h, m の順番にも縛りはない diff --git a/lib/rtm_time/estimate/en.rb b/lib/rtm_time/estimate/en.rb index <HASH>..<HASH> 100644 --- a/lib/rtm_time/estimate/en.rb +++ b/lib/rtm_time/estimate/en.rb @@ -10,11 +10,11 @@ module RtmTime # def assort( num, unit ) case unit - when /\Ad/u + when /\Ad/ui @day ||= num.to_i - when /\Ah/u + when /\Ah/ui @hour ||= num.to_f - when /\Am/u + when /\Am/ui @min ||= num.to_i end end
enhance compatibility with newer mobile app's estimate time maybe unified as ISO <I>
wtnabe_rtm-time
train
rb,rb
bf74c7da83be7a43a09c73a49fa0fbc45509d005
diff --git a/spec/weary/request_spec.rb b/spec/weary/request_spec.rb index <HASH>..<HASH> 100644 --- a/spec/weary/request_spec.rb +++ b/spec/weary/request_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' +require 'multi_json' describe Weary::Request do describe "#uri" do
triage problem with Autoload not autoloading multi_json
mwunsch_weary
train
rb
78816ee40d4698afc05bb97dc5e4e5da198b5a8d
diff --git a/salt/modules/debconfmod.py b/salt/modules/debconfmod.py index <HASH>..<HASH> 100644 --- a/salt/modules/debconfmod.py +++ b/salt/modules/debconfmod.py @@ -19,8 +19,9 @@ def __virtual__(): is installed. ''' if salt.utils.which('debconf-get-selections') is None: - log.error('The package debconf-utils is missing') + log.warning('The package debconf-utils is missing') return False + if __grains__['os_family'] != 'Debian': return False @@ -84,6 +85,7 @@ def show(name): result = selections.get(name) return result + def _set_file(path): ''' Execute the set selections command for debconf @@ -92,6 +94,7 @@ def _set_file(path): __salt__['cmd.run_stdout'](cmd) + def set(package, question, type, value, *extra): ''' Set answers to debconf questions for a package. @@ -116,6 +119,7 @@ def set(package, question, type, value, *extra): return True + def set_file(path): ''' Set answers to debconf questions from a file.
Improve `salt.modules.debconfmod` + PEP8. A missing package is a warning not a error on since salt will run perfectly fine without that package. The module depends on that package but salt does not.
saltstack_salt
train
py
71198069a82bc8b67c9e94c1699f3ea71c80549b
diff --git a/lib/arduino_ci/display_manager.rb b/lib/arduino_ci/display_manager.rb index <HASH>..<HASH> 100644 --- a/lib/arduino_ci/display_manager.rb +++ b/lib/arduino_ci/display_manager.rb @@ -81,6 +81,28 @@ module ArduinoCI end end + # run a command in a display + def run(*args, **kwargs) + ret = false + # do some work to extract & merge environment variables if they exist + has_env = !args.empty? && args[0].class == Hash + with_display do |env_vars| + env_vars = {} if env_vars.nil? + env_vars.merge!(args[0]) if has_env + actual_args = has_env ? args[1..-1] : args # need to shift over if we extracted args + full_cmd = env_vars.empty? ? actual_args : [env_vars] + actual_args + + puts "Running #{env_vars} $ #{args.join(' ')}" + ret = system(*full_cmd, **kwargs) + end + ret + end + + # run a command in a display with no output + def run_silent(*args) + run(*args, out: File::NULL, err: File::NULL) + end + def environment return nil unless @existing || @enabled return {} if @existing
expose ability to run commands in display environment
ianfixes_arduino_ci
train
rb
022ace03284373dbdc4d2ef27e009ac1a7ef5e07
diff --git a/src/sap.uxap/src/sap/uxap/library.js b/src/sap.uxap/src/sap/uxap/library.js index <HASH>..<HASH> 100644 --- a/src/sap.uxap/src/sap/uxap/library.js +++ b/src/sap.uxap/src/sap/uxap/library.js @@ -10,6 +10,7 @@ sap.ui.define([ "sap/ui/base/DataType", "sap/ui/Device", "sap/ui/core/library", // library dependency + "sap/f/library", // library dependency "sap/m/library", // library dependency "sap/ui/layout/library" // library dependency ], function(Core, DataType, Device) {
[INTERNAL] sap.uxap: Consistent library dependency Libraries enumerated in initLibrary dependencies must be present in the define as dependencies. Change-Id: I7f<I>f3befed<I>fe<I>de<I>f<I>bd
SAP_openui5
train
js
b3e7765651db8a2bd2fca48f80a506f2546e57c6
diff --git a/immutable-history/src/Page/PageContent.php b/immutable-history/src/Page/PageContent.php index <HASH>..<HASH> 100644 --- a/immutable-history/src/Page/PageContent.php +++ b/immutable-history/src/Page/PageContent.php @@ -6,7 +6,7 @@ use Rcm\ImmutableHistory\ContentInterface; class PageContent implements ContentInterface { - const CONTET_SCHEMA_VERSION = 1; + const CONTENT_SCHEMA_VERSION = 1; protected $title; protected $keywords; @@ -35,7 +35,7 @@ class PageContent implements ContentInterface 'description' => $this->description, 'keywords' => $this->keywords, 'blockInstances' => $this->blockInstances, - 'contentSchemaVersion' => $this::CONTET_SCHEMA_VERSION + 'contentSchemaVersion' => $this::CONTENT_SCHEMA_VERSION ]; } }
work on immutable history proof of concept by cleaning code
reliv_Rcm
train
php
aab6b7d3aea78db51a7a4e6567d9fd8a708b3f3f
diff --git a/taxid.go b/taxid.go index <HASH>..<HASH> 100644 --- a/taxid.go +++ b/taxid.go @@ -25,6 +25,7 @@ const ( TaxIDTypeNZGST TaxIDType = "nz_gst" TaxIDTypeRUINN TaxIDType = "ru_inn" TaxIDTypeSGUEN TaxIDType = "sg_uen" + TaxIDTypeSGGST TaxIDType = "sg_gst" TaxIDTypeTHVAT TaxIDType = "th_vat" TaxIDTypeTWVAT TaxIDType = "tw_vat" TaxIDTypeUSEIN TaxIDType = "us_ein"
Add support for `TaxIDTypeSGGST` on `TaxId`
stripe_stripe-go
train
go