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
91f5929ef0191a632402eea43596380f60783f7c
diff --git a/sunspot_rails/lib/sunspot/rails/searchable.rb b/sunspot_rails/lib/sunspot/rails/searchable.rb index <HASH>..<HASH> 100644 --- a/sunspot_rails/lib/sunspot/rails/searchable.rb +++ b/sunspot_rails/lib/sunspot/rails/searchable.rb @@ -232,7 +232,7 @@ module Sunspot #:nodoc: progress_bar = options[:progress_bar] if options[:batch_size] counter = 0 - find_in_batches(:include => options[:include], :batch_size => options[:batch_size]) do |records| + find_in_batches(:include => options[:include], :batch_size => options[:batch_size], :start => options[:first_id]) do |records| solr_benchmark options[:batch_size], counter do Sunspot.index(records) end
On reindex the :start => option is now passed to find_in_batches
sunspot_sunspot
train
rb
937532169ff5c969cd70c3210c0065042d2d20c4
diff --git a/config/drivers.php b/config/drivers.php index <HASH>..<HASH> 100644 --- a/config/drivers.php +++ b/config/drivers.php @@ -6,18 +6,18 @@ return [ 'chrome' => [ 'mac' => [ - 'version' => '2.9', - 'url' => 'http://chromedriver.storage.googleapis.com/2.9/chromedriver_mac32.zip', + 'version' => '2.35.0', + 'url' => 'https://chromedriver.storage.googleapis.com/2.35/chromedriver_mac64.zip', 'filename' => 'chromedriver', ], 'win' => [ - 'version' => '2.9', - 'url' => 'http://chromedriver.storage.googleapis.com/2.9/chromedriver_win32.zip', + 'version' => '2.35.0', + 'url' => 'https://chromedriver.storage.googleapis.com/2.35/chromedriver_win32.zip', 'filename' => 'chromedriver.exe', ], 'linux' => [ - 'version' => '2.9', - 'url' => 'http://chromedriver.storage.googleapis.com/2.9/chromedriver_linux64.zip', + 'version' => '2.35.0', + 'url' => 'https://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip', 'filename' => 'chromedriver', ], ],
updated versions for ChromeDriver download links (#<I>)
Modelizer_Laravel-Selenium
train
php
11602b8e4ecbd9cd53b49e0affbdad7fc19f7ee7
diff --git a/lib/fast_find.rb b/lib/fast_find.rb index <HASH>..<HASH> 100644 --- a/lib/fast_find.rb +++ b/lib/fast_find.rb @@ -32,7 +32,7 @@ module FastFind @mutex.synchronize do return if @walkers - @walkers = concurrency.times.map { Walker.new.spawn(@queue) } + @walkers = @concurrency.times.map { Walker.new.spawn(@queue) } end end @@ -41,8 +41,8 @@ module FastFind return unless @walkers @queue.clear - walkers.each { @queue << nil } - walkers.each(&:join) + @walkers.each { @queue << nil } + @walkers.each(&:join) @walkers = nil end @@ -89,7 +89,7 @@ module FastFind end end ensure - if one_shot + if one_shot? @queue.clear shutdown end @@ -97,6 +97,8 @@ module FastFind private + def one_shot?() !!@one_shot end + def yield_entry(entry, block) if block.arity == 2 block.call(entry[0].dup, entry[1]) @@ -104,8 +106,6 @@ module FastFind block.call entry[0].dup end end - - attr_reader :walkers, :one_shot, :concurrency end class Walker
Drop private attributes and just use @'s
Freaky_fast_find
train
rb
1aebce8d6eff330898098086fb56b001579fef7a
diff --git a/java/src/main/java/org/whispersystems/signalservice/api/SignalServiceMessageSender.java b/java/src/main/java/org/whispersystems/signalservice/api/SignalServiceMessageSender.java index <HASH>..<HASH> 100644 --- a/java/src/main/java/org/whispersystems/signalservice/api/SignalServiceMessageSender.java +++ b/java/src/main/java/org/whispersystems/signalservice/api/SignalServiceMessageSender.java @@ -296,7 +296,10 @@ public class SignalServiceMessageSender { throw new IOException("Unsupported sync message!"); } - sendMessage(localAddress, Optional.<UnidentifiedAccess>absent(), System.currentTimeMillis(), content, false); + long timestamp = message.getSent().isPresent() ? message.getSent().get().getTimestamp() + : System.currentTimeMillis(); + + sendMessage(localAddress, Optional.<UnidentifiedAccess>absent(), timestamp, content, false); } public void setSoTimeoutMillis(long soTimeoutMillis) {
Fix self-sync timestamp inconsistency
signalapp_libsignal-service-java
train
java
7edb3dd7cdb07f2bd80d4f5764d1c0519b0ca37c
diff --git a/src/main/java/org/cactoos/collection/CollectionOf.java b/src/main/java/org/cactoos/collection/CollectionOf.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/cactoos/collection/CollectionOf.java +++ b/src/main/java/org/cactoos/collection/CollectionOf.java @@ -53,8 +53,8 @@ import org.cactoos.scalar.Unchecked; * @todo #1116:30min Remove this deprecated class after the issue * https://github.com/llorllale/cactoos-matchers/issues/148 has been resolved. * The Cactoos-Matchers project(https://github.com/llorllale/cactoos-matchers) - * utilizes this class and by removing the class right now causes issues with - * class not found in the Cactoos-Matchers project. + * utilizes this class and by removing the class right now will cause issues + * of class not found in the Cactoos-Matchers project. */ @Deprecated public final class CollectionOf<T> implements Collection<T> {
(#<I>) Small spelling fixes done
yegor256_cactoos
train
java
3b0be68eef64784acfba2fae11d08c208f5c90f7
diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py index <HASH>..<HASH> 100644 --- a/pylint/checkers/base.py +++ b/pylint/checkers/base.py @@ -1943,10 +1943,11 @@ class NameChecker(_BasicChecker): class DocStringChecker(_BasicChecker): msgs = { "C0112": ( - "Empty %s docstring", # W0132 + "Empty %s docstring", "empty-docstring", "Used when a module, function, class or method has an empty " "docstring (it would be too easy ;).", + {"old_names": [("W0132", "old-empty-docstring")]}, ), "C0114": ( "Missing module docstring",
[docstrings] Add W<I> as the old name for empty-docstring
PyCQA_pylint
train
py
7ff9801bebf46180813b7afbfe881ccd9c69b0de
diff --git a/moa/src/main/java/moa/tasks/active/ALPrequentialEvaluationTask.java b/moa/src/main/java/moa/tasks/active/ALPrequentialEvaluationTask.java index <HASH>..<HASH> 100644 --- a/moa/src/main/java/moa/tasks/active/ALPrequentialEvaluationTask.java +++ b/moa/src/main/java/moa/tasks/active/ALPrequentialEvaluationTask.java @@ -64,7 +64,7 @@ public class ALPrequentialEvaluationTask extends ALMainTask { public ClassOption learnerOption = new ClassOption("learner", 'l', "Learner to train.", ALClassifier.class, - "moa.classifiers.active.PALStream"); + "moa.classifiers.active.ALRandom"); public ClassOption streamOption = new ClassOption("stream", 's', "Stream to learn from.", ExampleStream.class,
Set default learner to ALRandom
Waikato_moa
train
java
ec7e19ce19f4c4630bef9313aa4411f227dde472
diff --git a/hepdata_validator/full_submission_validator.py b/hepdata_validator/full_submission_validator.py index <HASH>..<HASH> 100644 --- a/hepdata_validator/full_submission_validator.py +++ b/hepdata_validator/full_submission_validator.py @@ -43,6 +43,7 @@ class FullSubmissionValidator(Validator): """ self.single_yaml_file = False temp_directory = None + self.directory = directory try: # Check input file/directory exists and is valid
Ensure self.directory is updated at each call to validate
HEPData_hepdata-validator
train
py
09474810b671f65ec4ce829bd345ddc94d038a63
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( author_email='aymeric.augustin@m4x.org', url='https://github.com/trac-hacks/trac-github', description='Trac - GitHub integration', - download_url='http://pypi.python.org/pypi/trac-github', + download_url='https://pypi.python.org/pypi/trac-github', packages=['tracext'], platforms='all', license='BSD',
Use HTTPS in download URL It appears that PyPI is now HTTPS-only.
trac-hacks_trac-github
train
py
0efa046ff035f14376dd6a99ad2dd00e980d3969
diff --git a/lib/arjdbc/postgresql/adapter.rb b/lib/arjdbc/postgresql/adapter.rb index <HASH>..<HASH> 100644 --- a/lib/arjdbc/postgresql/adapter.rb +++ b/lib/arjdbc/postgresql/adapter.rb @@ -1081,6 +1081,7 @@ module ArJdbc # Returns the list of all column definitions for a table. def columns(table_name, name = nil) klass = ::ActiveRecord::ConnectionAdapters::PostgreSQLColumn + pass_cast_type = respond_to?(:lookup_cast_type) column_definitions(table_name).map do |row| # name, type, default, notnull, oid, fmod name = row[0]; type = row[1]; default = row[2] @@ -1094,7 +1095,12 @@ module ArJdbc elsif default =~ /^\(([-+]?[\d\.]+)\)$/ # e.g. "(-1)" for a negative default default = $1 end - klass.new(name, default, oid, type, ! notnull, fmod, self) + if pass_cast_type + cast_type = lookup_cast_type(type) + klass.new(name, default, cast_type, type, ! notnull, fmod, self) + else + klass.new(name, default, oid, type, ! notnull, fmod, self) + end end end
Update postgres adapter column definition with cast_type
jruby_activerecord-jdbc-adapter
train
rb
29efe1fc7eccf3eb99a69c52427efbdb30de1a9f
diff --git a/core/types/transaction.go b/core/types/transaction.go index <HASH>..<HASH> 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -213,7 +213,7 @@ func (tx *Transaction) Hash() common.Hash { } // Size returns the true RLP encoded storage size of the transaction, either by -// encoding and returning it, or returning a previsouly cached value. +// encoding and returning it, or returning a previously cached value. func (tx *Transaction) Size() common.StorageSize { if size := tx.size.Load(); size != nil { return size.(common.StorageSize)
core/types: fixed typo (#<I>)
ethereum_go-ethereum
train
go
6921aaeca8f1a49327f532a53f26ffd8deca62f3
diff --git a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/RewardBase.java b/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/RewardBase.java index <HASH>..<HASH> 100755 --- a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/RewardBase.java +++ b/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/RewardBase.java @@ -23,10 +23,26 @@ public class RewardBase extends HandlerBase implements IRewardProducer if (distribution == null || distribution.isEmpty()) return reward; List<String> parties = Arrays.asList(distribution.split(" ")); - int ind = parties.indexOf(this.agentName); - if (ind == -1) - ind = parties.indexOf("me"); - if (ind != -1) + // Search for our agent name in this list of parties: + int ind = 0; + for (String party : parties) + { + if (party.startsWith(this.agentName + ":")) + break; + ind++; + } + if (ind == parties.size()) + { + // Didn't find it - search for "me": + ind = 0; + for (String party : parties) + { + if (party.startsWith("me:")) + break; + ind++; + } + } + if (ind != parties.size()) { String us = parties.get(ind); String[] parts = us.split(":");
Fixed bug with reward distibution.
Microsoft_malmo
train
java
9f68e0c6df10784faa9dec692e670d7bc427de39
diff --git a/python/dllib/src/bigdl/dllib/utils/common.py b/python/dllib/src/bigdl/dllib/utils/common.py index <HASH>..<HASH> 100644 --- a/python/dllib/src/bigdl/dllib/utils/common.py +++ b/python/dllib/src/bigdl/dllib/utils/common.py @@ -462,6 +462,17 @@ def create_spark_conf(): sparkConf.setAll(bigdl_conf.items()) if not is_spark_below_2_2(): extend_spark_driver_cp(sparkConf, get_bigdl_classpath()) + + # add content in PYSPARK_FILES in spark.submit.pyFiles + # This is a workaround for current Spark on k8s + python_lib = os.environ.get('PYSPARK_FILES', None) + if python_lib: + existing_py_files = sparkConf.get("spark.submit.pyFiles") + if existing_py_files: + sparkConf.set(key="spark.submit.pyFiles", value="%s,%s" % (python_lib, existing_py_files)) + else: + sparkConf.set(key="spark.submit.pyFiles", value=python_lib) + return sparkConf
Support BigDL for Spark on k8s (#<I>) * maybe some refactor * handle k8s master url * k8s * add doc * add more doc * add doc
intel-analytics_BigDL
train
py
ad1d13faea8b94ac63068bd6c3d82e6f2af19039
diff --git a/lib/formwandler/form.rb b/lib/formwandler/form.rb index <HASH>..<HASH> 100644 --- a/lib/formwandler/form.rb +++ b/lib/formwandler/form.rb @@ -96,7 +96,9 @@ module Formwandler def submit if valid? && models_valid? - save_models! + ActiveRecord::Base.transaction do + save_models! + end load_results else false
Add transaction around #save_models! call (fixes #3)
sbilharz_formwandler
train
rb
79c15566da3f267d66cfd6cc8e2257b6aacc0e38
diff --git a/actionpack/lib/action_dispatch/journey/path/pattern.rb b/actionpack/lib/action_dispatch/journey/path/pattern.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_dispatch/journey/path/pattern.rb +++ b/actionpack/lib/action_dispatch/journey/path/pattern.rb @@ -136,6 +136,10 @@ module ActionDispatch Array.new(length - 1) { |i| self[i + 1] } end + def named_captures + @names.zip(captures).to_h + end + def [](x) idx = @offsets[x - 1] + x @match[idx] diff --git a/actionpack/test/journey/path/pattern_test.rb b/actionpack/test/journey/path/pattern_test.rb index <HASH>..<HASH> 100644 --- a/actionpack/test/journey/path/pattern_test.rb +++ b/actionpack/test/journey/path/pattern_test.rb @@ -280,6 +280,15 @@ module ActionDispatch assert_equal "list", match[1] assert_equal "rss", match[2] end + + def test_named_captures + path = Path::Pattern.from_string "/books(/:action(.:format))" + + uri = "/books/list.rss" + match = path =~ uri + named_captures = { "action" => "list", "format" => "rss" } + assert_equal named_captures, match.named_captures + end end end end
Adds named_captures to MatchData to emulate Regex This change adds a `named_captures` method to `ActionDispatch::Journey::Path::MatchData` in order to emulate a similar method present on `Regex`'s `MatchData` present in Ruby core. This method can be useful for introspection of routes without the need to use `zip` while testing or developing in Rails core.
rails_rails
train
rb,rb
9737783eb6a057247392129fe6a49f3cbfddb97e
diff --git a/gns3server/modules/base_manager.py b/gns3server/modules/base_manager.py index <HASH>..<HASH> 100644 --- a/gns3server/modules/base_manager.py +++ b/gns3server/modules/base_manager.py @@ -372,8 +372,8 @@ class BaseManager: nio = NIOUDP(lport, rhost, rport) elif nio_settings["type"] == "nio_tap": tap_device = nio_settings["tap_device"] - if not is_interface_up(tap_device): - raise aiohttp.web.HTTPConflict(text="TAP interface {} does not exist or is down".format(tap_device)) + #if not is_interface_up(tap_device): + # raise aiohttp.web.HTTPConflict(text="TAP interface {} does not exist or is down".format(tap_device)) # FIXME: check for permissions on tap device # if not self.has_privileged_access(executable): # raise aiohttp.web.HTTPForbidden(text="{} has no privileged access to {}.".format(executable, tap_device))
Do not require a TAP interface to already exist. Fixes #<I>.
GNS3_gns3-server
train
py
f917170386963e9f0f5e69ffaf900e8497641c9a
diff --git a/openquake/baselib/node.py b/openquake/baselib/node.py index <HASH>..<HASH> 100644 --- a/openquake/baselib/node.py +++ b/openquake/baselib/node.py @@ -729,13 +729,14 @@ def node_from_xml(xmlfile, nodefactory=Node): return node_from_elem(root, nodefactory) -def node_to_xml(node, output=sys.stdout, nsmap=None): +def node_to_xml(node, output, nsmap=None): """ Convert a Node object into a pretty .xml file without keeping everything in memory. If you just want the string representation use tostring(node). :param node: a Node-compatible object (ElementTree nodes are fine) + :param output: a binary output file :param nsmap: if given, shorten the tags with aliases """
Small fix in node_to_xml [ci skip]
gem_oq-engine
train
py
2cbc647259ff161af07cc5b64a373b5c99e81f78
diff --git a/autoinput.js b/autoinput.js index <HASH>..<HASH> 100644 --- a/autoinput.js +++ b/autoinput.js @@ -65,8 +65,8 @@ BlockQuote.register("autoInput", "startBlockQuote", new InputRule( OrderedList.register("autoInput", "startOrderedList", new InputRule( /^(\d+)\. $/, " ", function(pm, match, pos) { - wrapAndJoin(pm, pos, this, {order: match[1]}, - node => node.childCount + +node.attrs.order == match[1]) + wrapAndJoin(pm, pos, this, {order: +match[1]}, + node => node.childCount + node.attrs.order == +match[1]) } )) @@ -86,7 +86,7 @@ CodeBlock.register("autoInput", "startCodeBlock", new InputRule( Heading.registerComputed("autoInput", "startHeading", type => { let re = new RegExp("^(#{1," + type.maxLevel + "}) $") return new InputRule(re, " ", function(pm, match, pos) { - setAs(pm, pos, this, {level: String(match[1].length)}) + setAs(pm, pos, this, {level: match[1].length}) }) })
Allow any JSON-serializeable value as attribute value
ProseMirror_prosemirror-inputrules
train
js
2f50cc54b27407aa517a15050c31f656dc696b19
diff --git a/src/tagify.js b/src/tagify.js index <HASH>..<HASH> 100644 --- a/src/tagify.js +++ b/src/tagify.js @@ -997,8 +997,9 @@ Tagify.prototype = { }, fixFirefoxLastTagNoCaret(){ - if( isFirefox && this.DOM.input.lastChild.nodeType == 1 ){ - this.DOM.input.appendChild(document.createTextNode("")) + var inputElm = this.DOM.input + if( isFirefox && inputElm.childNodes.length && inputElm.lastChild.nodeType == 1 ){ + inputElm.appendChild(document.createTextNode("")) this.setRangeAtStartEnd(true) return true } @@ -1863,14 +1864,13 @@ Tagify.prototype = { this.preUpdate() var value = removeCollectionProp(this.value, "__isValid") - if( this.settings.originalInputValueFormat ) - value = this.settings.originalInputValueFormat(value) - else - value = JSON.stringify(value) - this.DOM.originalInput.value = this.settings.mode == 'mix' ? this.getMixedTagsAsString(value) - : value.length ? value : "" + : value.length + ? this.settings.originalInputValueFormat + ? this.settings.originalInputValueFormat(value) + : JSON.stringify(value) + : "" this.DOM.originalInput.dispatchEvent(new CustomEvent('change')) },
fixed major bug with previous commit regarding "originalInputValueFormat" in "update" method
yairEO_tagify
train
js
47d23eea2932c855e37b6a3b1adbb60fb7f0a707
diff --git a/java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandler.java b/java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandler.java index <HASH>..<HASH> 100644 --- a/java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandler.java +++ b/java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandler.java @@ -589,7 +589,7 @@ public abstract class ProxyInvocationHandler implements InvocationHandler { return invokeInternal(proxy, method, args); } catch (Exception e) { if (this.throwable != null) { - logger.debug("Exception caught: {} overridden by: {}", e.getMessage(), throwable.getMessage()); + logger.trace("Exception caught: {} overridden by: {}", e.getMessage(), throwable.getMessage()); throw throwable; } else { throw e;
[Java] Moved log to loglevel trace in ProxyInvocationHandler
bmwcarit_joynr
train
java
b3710d83841e74006eacae85b53f06ffc0b2e162
diff --git a/concrete/src/Cache/CacheClearer.php b/concrete/src/Cache/CacheClearer.php index <HASH>..<HASH> 100644 --- a/concrete/src/Cache/CacheClearer.php +++ b/concrete/src/Cache/CacheClearer.php @@ -145,7 +145,13 @@ class CacheClearer */ protected function filesToClear($directory) { - $iterator = new FilesystemIterator($directory); + try { + $iterator = new FilesystemIterator($directory); + } catch (\UnexpectedValueException $e) { + // The directory doesn't exist + return; + } + $exclude = []; if (!$this->repository->get('concrete.cache.clear.thumbnails', true)) {
Catch exception when cache directory doesn't exist
concrete5_concrete5
train
php
d426b2ae98f3624f1113e237daec27d22e431ecb
diff --git a/lib/icomoon-phantomjs.js b/lib/icomoon-phantomjs.js index <HASH>..<HASH> 100644 --- a/lib/icomoon-phantomjs.js +++ b/lib/icomoon-phantomjs.js @@ -7,14 +7,20 @@ var casper = require('casper').create({ casper.start('http://icomoon.io/app'); // Wait for loading to complete -casper.waitFor(function waitForLoadingComplete () { - // Wait until div#loading no longer exists - return this.evaluate(function () { - return !document.getElementById('loading'); - }); +casper.waitWhileVisible('#loading'); + +// Submit many images (need a file path for all our images) +var files = ['test/test_files/eye.svg']; +casper.then(function () { + console.log('abc', this.evaluate(function (file) { + $('#files').val(file); + $('#files').change(); + return file; + }, files[0])); }); -// TODO: Submit many images (need a file path for all our images) +// casper.wait(5000); + // TODO: Export our font // TODO: Extract variables (if specified)
Going for short-term of getting this working first before talking directly to backend
twolfson_icomoon-phantomjs
train
js
ca623b8402a104be965cb3d56cfeef66ac551b2c
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -65,21 +65,30 @@ SQLite3Connection.prototype.query = function (text, values, callback) { this.emit('query', query) if (query.text.match(/^\s*(insert|update|replace)\s+/i)) { - this._db.run(query.text, - query.values, - function (err) { - query.complete(err, this.changes, this.lastID) - }) + runQuery(this._db, query); } else { - this._db.each(query.text, - query.values, - query.onRow.bind(query), - query.complete.bind(query)) + eachQuery(this._db, query); } return query } +function runQuery (db, query) { + db.run(query.text, query.values, function (err) { + query.complete(err, this.changes, this.lastID) + }) +} + +function eachQuery (db, query) { + db.each(query.text, query.values, onRow, function (err, count) { + query.complete(err, count); + }) + + function onRow (err, row) { + query.onRow(err, row) + } +} + SQLite3Connection.prototype.end = function (callback) { if (callback) this.on('end', callback) this._db.close()
Move differing run/each behaviour into helpers
grncdr_node-any-db
train
js
83a52d7f14967ca3bdd65355078a9737ac8efdb2
diff --git a/Eloquent/Relations/Concerns/InteractsWithPivotTable.php b/Eloquent/Relations/Concerns/InteractsWithPivotTable.php index <HASH>..<HASH> 100644 --- a/Eloquent/Relations/Concerns/InteractsWithPivotTable.php +++ b/Eloquent/Relations/Concerns/InteractsWithPivotTable.php @@ -225,7 +225,7 @@ trait InteractsWithPivotTable $this->relatedPivotKey => $this->parseId($id), ], true); - $pivot->timestamps = in_array($this->updatedAt(), $this->pivotColumns); + $pivot->timestamps = $updated && in_array($this->updatedAt(), $this->pivotColumns); $pivot->fill($attributes)->save();
Prevent timestamp update when pivot is not dirty (#<I>)
illuminate_database
train
php
89b49a25a1a03281c1f7452b37184dfb4621d79f
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java index <HASH>..<HASH> 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2000-2017. All Rights Reserved. + * Copyright Ericsson AB 2000-2021. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -565,6 +565,11 @@ public abstract class AbstractConnection extends Thread { // received tick? send tock! if (len == 0) { synchronized (this) { + if (socket == null) { + // protect from a potential thin race when the + // connection to the remote node is closed + throw new IOException("socket was closed"); + } OutputStream out = socket.getOutputStream(); out.write(tock); out.flush();
jinterface: Fix a NullPointerException in AbstractConnection After a call to close(), the socket is set to null which could lead to a NullPointerException in the receive_loop when handling tick messages. End the receive_loop instead in this case.
erlang_otp
train
java
076738bb5db0a103425b837353ba72efb6a2a0d5
diff --git a/src/PhoreDirectory.php b/src/PhoreDirectory.php index <HASH>..<HASH> 100644 --- a/src/PhoreDirectory.php +++ b/src/PhoreDirectory.php @@ -145,4 +145,14 @@ class PhoreDirectory extends PhoreUri return $ret; } + /** + * Import file contents of parameter 1 to this directory + * + * @param $filename + */ + public function importZipFile($filename) + { + phore_exec("unzip :zipfile -d :folder", ["zipfile" => $filename, "folder" => (string)$this]); + } + } diff --git a/src/PhoreTempDir.php b/src/PhoreTempDir.php index <HASH>..<HASH> 100644 --- a/src/PhoreTempDir.php +++ b/src/PhoreTempDir.php @@ -14,6 +14,9 @@ class PhoreTempDir extends PhoreDirectory $this->mkdir(); } + + + public function __destruct() { $this->rmDir(true);
added importZipFile to directory
phore_phore-filesystem
train
php,php
e78c28a8c872d0432a233a223da3953742b21cf9
diff --git a/allaccess/tests/custom/views.py b/allaccess/tests/custom/views.py index <HASH>..<HASH> 100644 --- a/allaccess/tests/custom/views.py +++ b/allaccess/tests/custom/views.py @@ -5,7 +5,7 @@ import hashlib from django.core.urlresolvers import reverse -from allaccess.compat import get_user_model, smart_bytes +from allaccess.compat import get_user_model, smart_bytes, force_text from allaccess.views import OAuthRedirect, OAuthCallback @@ -28,7 +28,7 @@ class CustomCallback(OAuthCallback): digest = hashlib.sha1(smart_bytes(access)).digest() # Base 64 encode to get below 30 characters # Removed padding characters - email = '%s@example.com' % base64.urlsafe_b64encode(digest).replace('=', '') + email = '%s@example.com' % force_text(base64.urlsafe_b64encode(digest)).replace('=', '') User = get_user_model() kwargs = { 'email': email,
Custom test view needs to convert digest back to string.
mlavin_django-all-access
train
py
b034eaaad4c4f96726dcc4e708efa4a10fc4ada9
diff --git a/spinoff/actor/_actor.py b/spinoff/actor/_actor.py index <HASH>..<HASH> 100644 --- a/spinoff/actor/_actor.py +++ b/spinoff/actor/_actor.py @@ -539,9 +539,10 @@ class Node(object): _all = [] @classmethod + @inlineCallbacks def stop_all(cls): for node in cls._all: - node.stop() + yield node.stop() del cls._all[:] @classmethod @@ -593,8 +594,11 @@ class Node(object): @inlineCallbacks def stop(self): - yield self.hub.stop() yield self.guardian.stop() + # TODO: just make the node send a special notification to other nodes, so as to avoid needless sending of many + # small termination messages: + yield sleep(.1) # let actors send termination messages + yield self.hub.stop() def __getstate__(self): # pragma: no cover raise PicklingError("Node cannot be serialized")
Node.stop now first stops the actors and then remoting, and then waits a bit before shutting down remoting to allow actors to send termination or other notifications in post_stop
eallik_spinoff
train
py
4f48fbc50a4f680811be95096301927b2da7ecf5
diff --git a/iopipe/context.py b/iopipe/context.py index <HASH>..<HASH> 100644 --- a/iopipe/context.py +++ b/iopipe/context.py @@ -55,6 +55,13 @@ class IOpipeContext(object): log = metric def label(self, name): + if self.instance.report is None: + warnings.warn( + "Attempting to add label before function decorated with IOpipe. " + "This label will not be recorded." + ) + return + if not isinstance(name, string_types): warnings.warn( "Attempted to add a label that is not of type string. "
Check if there's a report before labeling (#<I>) Closes #<I>
iopipe_iopipe-python
train
py
4e3b5a3bda064a84b9e1cd5d99a329f3ef544981
diff --git a/backends/etcdv3/client.go b/backends/etcdv3/client.go index <HASH>..<HASH> 100644 --- a/backends/etcdv3/client.go +++ b/backends/etcdv3/client.go @@ -21,8 +21,10 @@ type Client struct { // NewEtcdClient returns an *etcdv3.Client with a connection to named machines. func NewEtcdClient(machines []string, cert, key, caCert string, basicAuth bool, username string, password string) (*Client, error) { cfg := clientv3.Config{ - Endpoints: machines, - DialTimeout: 5 * time.Second, + Endpoints: machines, + DialTimeout: 5 * time.Second, + DialKeepAliveTime: 10 * time.Second, + DialKeepAliveTimeout: 3 * time.Second, } if basicAuth {
Configure keepalives for etcdv3 backend
kelseyhightower_confd
train
go
716c4ae49be062497e6996cf48d501b73aeea159
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/DefaultTraversal.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/DefaultTraversal.java index <HASH>..<HASH> 100644 --- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/DefaultTraversal.java +++ b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/DefaultTraversal.java @@ -62,7 +62,8 @@ public class DefaultTraversal<S, E> implements Traversal<S, E> { } public String toString() { - this.doFinalOptimization(); + // todo: optimizing on toString can cause weird stuff when debugging - can we have doPreflightFinalOptimization? + //this.doFinalOptimization(); return this.getSteps().toString(); }
Commented out toString execution of traversal optimizations. This causes early evaluation in the debugger and then really crazy stuff starts happening.
apache_tinkerpop
train
java
94cf4314e66d772ae2338e333823dda502710d1d
diff --git a/rules/DowngradePhp70/Rector/Spaceship/DowngradeSpaceshipRector.php b/rules/DowngradePhp70/Rector/Spaceship/DowngradeSpaceshipRector.php index <HASH>..<HASH> 100644 --- a/rules/DowngradePhp70/Rector/Spaceship/DowngradeSpaceshipRector.php +++ b/rules/DowngradePhp70/Rector/Spaceship/DowngradeSpaceshipRector.php @@ -64,8 +64,8 @@ $battleShipcompare = function ($left, $right) { return 0; } return $left < $right ? -1 : 1; -}); -return $battleShipcompare; +}; +return $battleShipcompare($a, $b); CODE_SAMPLE ), ]
Fix DowngradeSpaceshipRector sample code (#<I>)
rectorphp_rector
train
php
ae992dc25c16fd24c7aaf9052535e9f3f332444a
diff --git a/src/Http/Middleware/DynamicMenusBuilder.php b/src/Http/Middleware/DynamicMenusBuilder.php index <HASH>..<HASH> 100644 --- a/src/Http/Middleware/DynamicMenusBuilder.php +++ b/src/Http/Middleware/DynamicMenusBuilder.php @@ -26,16 +26,18 @@ class DynamicMenusBuilder */ public function handle($request, Closure $next) { + session()->forget('active_menu'); + if (! $request->is('administrator*')) { $this->repository = app(Repository::class); $this->repository->getPublished()->each(function (Navigation $navigation) { MenuFactory::make($navigation->type, function (Builder $builder) use ($navigation) { $widgets = $navigation->getConnection()->table('widget_menu'); $assignment = [0]; - $navigation->menus->each(function (Menu $menu) use ($builder, $widgets, $assignment) { + $navigation->menus->each(function (Menu $menu) use ($builder, $widgets, &$assignment) { if ($menu->isActive()) { $assignment[] = $menu->id; - session(['active_menu' => $menu]); + session()->flash('active_menu', $menu); } $menus = $menu->descendantsAndSelf()->with('permissions')->get()->toHierarchy();
Flash active menu session on every request.
yajra_cms-core
train
php
67fca5bdc7b007aae35ca271ffcb8adaf8b7bb8f
diff --git a/js/lib/mediawiki.ApiRequest.js b/js/lib/mediawiki.ApiRequest.js index <HASH>..<HASH> 100644 --- a/js/lib/mediawiki.ApiRequest.js +++ b/js/lib/mediawiki.ApiRequest.js @@ -560,12 +560,16 @@ function ParsoidCacheRequest ( env, title, oldid, options ) { timeout: 60 * 1000, // 60 seconds: less than 100s VE timeout so we still finish headers: { 'User-Agent': userAgent, - 'Cookie': env.cookie, 'Connection': 'close', 'x-parsoid-request': 'cache' } }; + if (env.cookie) { + // Forward the cookie if set + this.requestOptions.headers.Cookie = env.cookie; + } + if (!options.evenIfNotCached) { // Request a reply only from cache. this.requestOptions.headers['Cache-control'] = 'only-if-cached';
Only set cookie header on API requests when one was passed in We don't send Vary: Cookie headers ourselves, but it seems to be well possible that our Varnish config (by using various MW defaults) varies on cookies by default. That would explain the cache misses on selser that we are seeing in production. Change-Id: Id<I>fce<I>c<I>b<I>a9c<I>cf4bdd<I>e<I>
wikimedia_parsoid
train
js
a8f3d5a63446ec52e669e1dd12caba36d1c9ae45
diff --git a/lib/typed/parfait/type.rb b/lib/typed/parfait/type.rb index <HASH>..<HASH> 100644 --- a/lib/typed/parfait/type.rb +++ b/lib/typed/parfait/type.rb @@ -61,9 +61,17 @@ module Parfait end def self.str_hash(str) - str = str.hash + if RUBY_ENGINE == "OPAL" + hash = 5381 + str.to_s.each_char do |c| + hash = ((hash << 5) + hash) + c.to_i; # hash * 33 + c without getting bignums + end + hash % (2 ** 51) + else + str.hash + end end - + def initialize( object_class , hash = {}) super() private_add_instance_variable :type ,:Type
had to fix the string hash for opal
ruby-x_rubyx
train
rb
f1b5d7ef521248e327569a1b1a181a05105ede94
diff --git a/src/properties/class-papi-property-group.php b/src/properties/class-papi-property-group.php index <HASH>..<HASH> 100644 --- a/src/properties/class-papi-property-group.php +++ b/src/properties/class-papi-property-group.php @@ -115,7 +115,7 @@ class Papi_Property_Group extends Papi_Property_Repeater { * @return array */ public function update_value( $values, $slug, $post_id ) { - if ( ! isset( $values[0] ) ) { + if ( ! isset( $values[0] ) && ! empty( $values ) ) { $values = [$values]; }
Fix empty array issue with group property test
wp-papi_papi
train
php
1ecc0ccdef4e71b3a47c4b6c5dadb85fcb3a523f
diff --git a/cell/tests/actors/test_agents.py b/cell/tests/actors/test_agents.py index <HASH>..<HASH> 100644 --- a/cell/tests/actors/test_agents.py +++ b/cell/tests/actors/test_agents.py @@ -35,11 +35,12 @@ class test_dAgent(Case): ag, a = dA(conn), A() ag.cast = Mock() - proxy = ag.spawn(qualname(a)) + proxy = ag.spawn(A) ag.cast.assert_called_once_with( 'spawn', - {'name': qualname(a), 'id': actor_static_id.return_value}, + {'name': qualname(a), 'id': actor_static_id.return_value, + 'kwargs': {}}, ANY, reply_to=ticket_static_id.return_value, type=ACTOR_TYPE.RR, nowait=False)
Fix tests broken due the additional kwargs argument in spawn
celery_cell
train
py
887b26497a991f91334b7ade419f3195fde0ff1d
diff --git a/system/modules/generalDriver/GeneralControllerDefault.php b/system/modules/generalDriver/GeneralControllerDefault.php index <HASH>..<HASH> 100644 --- a/system/modules/generalDriver/GeneralControllerDefault.php +++ b/system/modules/generalDriver/GeneralControllerDefault.php @@ -1589,7 +1589,7 @@ class GeneralControllerDefault extends Controller implements InterfaceGeneralCon } // Check if we have a valide sorting. - if ($intNextSorting <= 2 && !$blnWithoutReorder) + if (($intLowestSorting < 2 || $intNextSorting <= 2) && !$blnWithoutReorder) { // ToDo: Add child <=> parent config. $objConfig = $objCDP->getEmptyConfig(); @@ -1657,7 +1657,7 @@ class GeneralControllerDefault extends Controller implements InterfaceGeneralCon } // Check if we have a valide sorting. - if (round(($intNextSorting - $intAfterSorting) / 2) <= 2 && !$blnWithoutReorder) + if (($intAfterSorting < 2 || $intNextSorting < 2 || round(($intNextSorting - $intAfterSorting) / 2) <= 2) && !$blnWithoutReorder) { // ToDo: Add child <=> parent config. $objConfig = $objCDP->getEmptyConfig();
Update the "getNewPosition" function. Add some checks to validate the after sorting value.
contao-community-alliance_dc-general
train
php
91561429c2fd621d545645ba4977dc17c254359a
diff --git a/oct2py/session.py b/oct2py/session.py index <HASH>..<HASH> 100644 --- a/oct2py/session.py +++ b/oct2py/session.py @@ -397,8 +397,12 @@ class Oct2Py(object): except Oct2PyError as e: if 'syntax error' in str(e): raise(e) - doc = self._eval('type {0}'.format(name), log=False, verbose=False) - doc = doc.splitlines()[0] + try: + doc = self._eval('type {0}'.format(name), log=False, verbose=False) + doc = doc.splitlines()[0] + except Oct2PyError: + msg = 'Function "%s" does not exist on the Octave Session path' + raise Oct2PyError(msg % name) return doc def __getattr__(self, attr):
Improve error message when function is not found
blink1073_oct2py
train
py
92c2356d4c640135f7e4dae56abeba18158ce5ae
diff --git a/example-expo/AccessoryBar.js b/example-expo/AccessoryBar.js index <HASH>..<HASH> 100644 --- a/example-expo/AccessoryBar.js +++ b/example-expo/AccessoryBar.js @@ -10,8 +10,7 @@ import { export default class AccessoryBar extends React.Component { render() { - const { onSend } = this.props - const isTyping = this.props.isTyping + const { onSend, isTyping } = this.props return ( <View style={styles.container}>
refactor(typing-indicator): DRY in example
FaridSafi_react-native-gifted-chat
train
js
84ea54a1966148bd152eed4dadb2e2426456fa7e
diff --git a/lib/knife-cloudformation/aws_commons.rb b/lib/knife-cloudformation/aws_commons.rb index <HASH>..<HASH> 100644 --- a/lib/knife-cloudformation/aws_commons.rb +++ b/lib/knife-cloudformation/aws_commons.rb @@ -120,6 +120,7 @@ module KnifeCloudformation cache.apply_limit(:stacks, args[:refresh_every].to_i) end if(@memo[:stacks].update_allowed? || args[:force_refresh]) + @memo[:stacks].restamp! long_running_job(:stacks) do logger.debug 'Populating full cloudformation list from remote end point' @memo.locked_action(:stacks_lock) do
Restamp the cached value prior to detached fetching
sparkleformation_sfn
train
rb
c44e74e676ab6bda3eac97690893f73350c34e9e
diff --git a/cli/command/system/info.go b/cli/command/system/info.go index <HASH>..<HASH> 100644 --- a/cli/command/system/info.go +++ b/cli/command/system/info.go @@ -91,6 +91,10 @@ func prettyPrintInfo(dockerCli *command.DockerCli, info types.Info) error { fmt.Fprintf(dockerCli.Out(), "\n") } + fmt.Fprintf(dockerCli.Out(), " Log:") + fmt.Fprintf(dockerCli.Out(), " %s", strings.Join(info.Plugins.Log, " ")) + fmt.Fprintf(dockerCli.Out(), "\n") + fmt.Fprintf(dockerCli.Out(), "Swarm: %v\n", info.Swarm.LocalNodeState) if info.Swarm.LocalNodeState != swarm.LocalNodeStateInactive && info.Swarm.LocalNodeState != swarm.LocalNodeStateLocked { fmt.Fprintf(dockerCli.Out(), " NodeID: %s\n", info.Swarm.NodeID)
Add logdrivers to /info This is required for swarmkit to be able to filter based on log driver.
docker_cli
train
go
d6a0e86aae97fa4d1572301b57767d094b9edff5
diff --git a/webpack.config.js b/webpack.config.js index <HASH>..<HASH> 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -49,7 +49,7 @@ module.exports = [{ }, { entry: './src/demo.js', output: { - path: path.join(__dirname, 'assets/dist'), + path: path.join(__dirname, 'dist'), filename: '[name].js', }, module: {loaders: loaders},
fix webpack config (#<I>)
sstur_react-rte
train
js
d37ca7c7f819aac06adc0365bbe438da38e20d57
diff --git a/backup/restorelib.php b/backup/restorelib.php index <HASH>..<HASH> 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -10,7 +10,7 @@ $status = true; if (empty($CFG->unzip)) { // Use built-in php-based unzip function - include_once("$CFG->wwwroot/lib/pclzip/pclzip.lib.php"); + include_once("$CFG->dirroot/lib/pclzip/pclzip.lib.php"); $archive = new PclZip($file); if (!$list = $archive->extract(dirname($file))) { $status = false;
Chanfed to locate the pclzip properly.
moodle_moodle
train
php
758e7fb279303911c90157e147c41b4370f64a34
diff --git a/src/Corpus/TextCorpus.php b/src/Corpus/TextCorpus.php index <HASH>..<HASH> 100644 --- a/src/Corpus/TextCorpus.php +++ b/src/Corpus/TextCorpus.php @@ -150,23 +150,6 @@ class TextCorpus } /** - * Mark the neddle and get its context - * - * @return String - */ - private function extractExcerptTerm(int $needlePos, int $needleLength, String $text, int $contextLength, bool $mark = false) - { - //marking the term - $text = ($mark) ? Text::markString($text, $needlePos, $needleLength, ['{{','}}']) : $text; - $needleLength = ($mark) ? $needleLength+4 : $needleLength; - - //extracts the excerpt - $text = Text::getExcerpt($text, $needlePos, $needleLength, $contextLength); - - return utf8_encode($text); - } - - /** * Get percentage of times the needle shows up in the text * @param string $needle * @return float
Removed unused method Removed extractExcerptTerm method that was not used anymore.
yooper_php-text-analysis
train
php
e6dd59c409a9ac01a170b359801743f2f9e35a60
diff --git a/lib/fog/rackspace/models/auto_scale/group_config.rb b/lib/fog/rackspace/models/auto_scale/group_config.rb index <HASH>..<HASH> 100644 --- a/lib/fog/rackspace/models/auto_scale/group_config.rb +++ b/lib/fog/rackspace/models/auto_scale/group_config.rb @@ -49,11 +49,30 @@ module Fog options['maxEntities'] = max_entities options['metadata'] = metadata unless metadata.nil? - data = service.update_group_config(group.id, options) - merge_attributes(data.body) + service.update_group_config(group.id, options) true end + # Saves group's configuration. + # This method will only save existing group configurations. New group configurations are created when a scaling group is created + # @return [Boolean] true if server has started saving + def save + if group.id + update + true + else + raise "New #{self.class} are created when a new Fog::Rackspace::AutoScale::Group is created" + end + end + + def reload + if group.id + data = service.get_group_config(group.id) + merge_attributes data.body['groupConfiguration'] + end + end + + end end end
[rackspace|auto_scale] fixed bug with group_config.update; added save and reload method
fog_fog
train
rb
8072b4be084637b65846b662e4307b3d5a3a2f79
diff --git a/spec/unit/application/face_base_spec.rb b/spec/unit/application/face_base_spec.rb index <HASH>..<HASH> 100755 --- a/spec/unit/application/face_base_spec.rb +++ b/spec/unit/application/face_base_spec.rb @@ -97,6 +97,17 @@ describe Puppet::Application::FaceBase do end end + [%w{something_I_cannot_do --unknown-option}, + %w{something_I_cannot_do argument --unknown-option}].each do |input| + it "should report unknown actions even if there are unknown options" do + app.command_line.stubs(:args).returns input + Puppet::Face[:basetest, '0.0.1'].expects(:get_default_action).returns(nil) + app.stubs(:main) + expect { app.run }.to exit_with 1 + @logs.first.message.should =~ /has no 'something_I_cannot_do' action/ + end + end + it "should report a sensible error when options with = fail" do app.command_line.stubs(:args).returns %w{--action=bar foo} expect { app.preinit; app.parse_options }.
#<I>: Test unknown options don't shadow unknown actions. Unknown options used to shadow unknown actions: $ puppet node something_I_cannot_do --unknown-option Could not parse options: invalid option: --unknown-option The earlier changes have fixed this problem, but we now add extra testing to make sure that we don't regress to the earlier state of play.
puppetlabs_puppet
train
rb
c85c4ae82a9ff766aafc9f2235ccb0b41e1d15d4
diff --git a/stitch/src/main/java/com/mongodb/stitch/android/auth/anonymous/AnonymousAuthProviderInfo.java b/stitch/src/main/java/com/mongodb/stitch/android/auth/anonymous/AnonymousAuthProviderInfo.java index <HASH>..<HASH> 100644 --- a/stitch/src/main/java/com/mongodb/stitch/android/auth/anonymous/AnonymousAuthProviderInfo.java +++ b/stitch/src/main/java/com/mongodb/stitch/android/auth/anonymous/AnonymousAuthProviderInfo.java @@ -13,7 +13,7 @@ import com.mongodb.stitch.android.auth.AuthProviderInfo; */ @JsonIgnoreProperties(ignoreUnknown = true) public class AnonymousAuthProviderInfo extends AuthProviderInfo { - public static final String FQ_NAME = "anon/user"; + public static final String FQ_NAME = "anon-user"; @JsonCreator public AnonymousAuthProviderInfo(@JsonProperty(Fields.TYPE) @Nullable final String type,
fix FQ_NAME for anon provider (#<I>)
mongodb_stitch-android-sdk
train
java
f29f5cb53ec11de0bb46e9a375164170e5526caa
diff --git a/app/models/content.js b/app/models/content.js index <HASH>..<HASH> 100644 --- a/app/models/content.js +++ b/app/models/content.js @@ -1,6 +1,8 @@ import DS from 'ember-data'; import { get, computed } from '@ember/object'; +import { deprecate } from '@ember/application/deprecations'; + export default DS.Model.extend({ title: DS.attr('string'), canonical: DS.attr(), @@ -23,8 +25,10 @@ export default DS.Model.extend({ authors: DS.hasMany('author'), author: computed('authors.[]', function() { - // eslint-disable-next-line no-console - console.warn(`"author" is deprecated, you must define "authors" now. Content: ${this.title}`); + deprecate(`"author" is deprecated in the content model. You must use "authors" now in your templates.`, false, { + id: 'empress-blog:content-model-author', + until: '4.0.0', + }); return get(this, 'authors.firstObject'); }) });
turning contet.author deprecation into a real deprecation
empress_empress-blog
train
js
bd7652823c5c682f43d0c8c02fb34be516ac6afb
diff --git a/lib/optimize/ConcatenatedModule.js b/lib/optimize/ConcatenatedModule.js index <HASH>..<HASH> 100644 --- a/lib/optimize/ConcatenatedModule.js +++ b/lib/optimize/ConcatenatedModule.js @@ -576,9 +576,12 @@ class ConcatenatedModule extends Module { moduleToInfoMap ) ); + + // Must use full identifier in our cache here to ensure that the source + // is updated should our dependencies list change. innerDependencyTemplates.set( "hash", - innerDependencyTemplates.get("hash") + this.rootModule.identifier() + innerDependencyTemplates.get("hash") + this.identifier() ); // Generate source code and analyse scopes
Invalidate concatenated module on dep change When the moduleSet for a given concatenated module changed, the source for the embedded modules would not necessarily, which lead to caching mismatch between the source and the modulesWithInfo structure. Fixes #<I>
webpack_webpack
train
js
1d794896ac63c55d1eaf61b9b581cc9c2c5ac46b
diff --git a/web/web.go b/web/web.go index <HASH>..<HASH> 100644 --- a/web/web.go +++ b/web/web.go @@ -31,6 +31,7 @@ import ( var ( listenAddress = flag.String("listenAddress", ":9090", "Address to listen on for web interface.") useLocalAssets = flag.Bool("useLocalAssets", false, "Read assets/templates from file instead of binary.") + userAssetsPath = flag.String("userAssets", "", "Path to static asset directory, available at /user") ) type WebService struct { @@ -65,6 +66,10 @@ func (w WebService) ServeForever() error { exp.Handle("/static/", http.StripPrefix("/static/", new(blob.Handler))) } + if *userAssetsPath != "" { + exp.Handle("/user/", http.StripPrefix("/user/", http.FileServer(http.Dir(*userAssetsPath)))) + } + log.Printf("listening on %s", *listenAddress) return http.ListenAndServe(*listenAddress, exp.DefaultCoarseMux)
Support user-provided static asset directory [fix #<I>]
prometheus_prometheus
train
go
4e8dcf7597b9aa3b6aa933d7fd6bf3ed9e25a85e
diff --git a/src/library.js b/src/library.js index <HASH>..<HASH> 100644 --- a/src/library.js +++ b/src/library.js @@ -82,6 +82,7 @@ } else if (Isla.Utils.type(o) === "String" || Isla.Utils.type(o) === "Boolean" || Isla.Utils.type(o) === "Function") { + o === null) { c = o; }
Fix library.clone so it preserves nulls.
maryrosecook_isla
train
js
6f51ba2f34bd7db87beb16263d495468e2616918
diff --git a/trustar/models/page.py b/trustar/models/page.py index <HASH>..<HASH> 100644 --- a/trustar/models/page.py +++ b/trustar/models/page.py @@ -148,31 +148,6 @@ class Page(ModelBase): from_time=from_time, to_time=to_time) - @staticmethod - def get_cursor_based_page_generator(get_page, cursor=None): - """ - A page generator that uses cursor-based paginantion. - - :param get_page: a function to get the next page, given values for from_time and to_time - :param cursor: A Base64-encoded string that contains information on how to retrieve the next page. - If a cursor isn't passed, it will default to pageSize: 25, pageNumber: 0 - :return: a generator that yields each successive page - """ - - def get_next_cursor(result): - """ - Retrieves the Base-64 encoded cursor string from a page. - """ - - return result.responseMetaData.nextCursor - - # Yields result until an empty string is returned - while cursor != "": - # If cursor is None, no cursor value will be sent with request - result = get_page(cursor=cursor) - cursor = get_next_cursor(result) - yield result - @classmethod def get_generator(cls, page_generator): """
moved cursor-based pagination to own class
trustar_trustar-python
train
py
95671c345dbb73dd7b200d6ed1da3414ce53b54d
diff --git a/src/main/java/org/freecompany/redline/header/Header.java b/src/main/java/org/freecompany/redline/header/Header.java index <HASH>..<HASH> 100755 --- a/src/main/java/org/freecompany/redline/header/Header.java +++ b/src/main/java/org/freecompany/redline/header/Header.java @@ -96,7 +96,7 @@ public class Header extends AbstractHeader { REQUIREFLAGS( 1048, 4, "requireflags"), REQUIRENAME( 1049, 8, "requirename"), REQUIREVERSION( 1050, 8, "requireversion"), - CONFLICTFLAGS( 1053, 6, "conflictflags"), + CONFLICTFLAGS( 1053, 4, "conflictflags"), CONFLICTNAME( 1054, 8, "conflictname"), CONFLICTVERSION( 1055, 8, "conflictversion"), OBSOLETENAME( 1090, 8, "obsoletename"),
Changed data types for string arrays
craigwblake_redline
train
java
35adfe95cd2f1587d595aef8d8bf108d01a32a24
diff --git a/input/_relation.js b/input/_relation.js index <HASH>..<HASH> 100644 --- a/input/_relation.js +++ b/input/_relation.js @@ -2,6 +2,7 @@ var d = require('es5-ext/lib/Object/descriptor') , copy = require('es5-ext/lib/Object/copy') + , extend = require('es5-ext/lib/Object/extend') , filter = require('es5-ext/lib/Object/filter') , forEach = require('es5-ext/lib/Object/for-each') , makeElement = require('dom-ext/lib/Document/prototype/make-element') @@ -100,6 +101,10 @@ module.exports = Object.defineProperties(relation, { inputOptions = filter(options, function (value, name) { return !htmlAttributes[name]; }); + if (options.input) { + extend(inputOptions, options.input); + delete inputOptions.input; + } input = this.toDOMInput(document, inputOptions); if (options.label == null) options.label = this._label;
Allow to provide custom input options to component
medikoo_dbjs-dom
train
js
7eea4ec409f5ac04d6420b503e326218d5e5c082
diff --git a/src/Enhavo/Bundle/NavigationBundle/Form/Type/NodeCollectionType.php b/src/Enhavo/Bundle/NavigationBundle/Form/Type/NodeCollectionType.php index <HASH>..<HASH> 100644 --- a/src/Enhavo/Bundle/NavigationBundle/Form/Type/NodeCollectionType.php +++ b/src/Enhavo/Bundle/NavigationBundle/Form/Type/NodeCollectionType.php @@ -87,7 +87,9 @@ class NodeCollectionType extends AbstractType /** @var NodeInterface $node */ $node = new $this->class; $modelClass = $item->getModel(); - $node->setSubject(new $modelClass); + if ($modelClass !== null) { + $node->setSubject(new $modelClass); + } $data[$key] = $node; } return $data;
Fix empty navigation model (#<I>)
enhavo_enhavo
train
php
123bdd4572959d7d647f7a0b4a70999dc4c40e35
diff --git a/lib/workers/branch/parent.js b/lib/workers/branch/parent.js index <HASH>..<HASH> 100644 --- a/lib/workers/branch/parent.js +++ b/lib/workers/branch/parent.js @@ -28,7 +28,14 @@ async function getParentBranch(config) { } if (pr.labels && pr.labels.includes(config.rebaseLabel)) { logger.info('Manual rebase requested via PR labels for #' + pr.number); - await platform.deleteLabel(pr.number, config.rebaseLabel); + // istanbul ignore if + if (config.dryRun) { + logger.info( + `DRY-RUN: Would delete label ${config.rebaseLabel} from #${pr.number}` + ); + } else { + await platform.deleteLabel(pr.number, config.rebaseLabel); + } return { parentBranch: undefined }; } }
fix: ignore delete label if dry-run (#<I>)
renovatebot_renovate
train
js
f0e777f0c0cf025071956a5ffa8f4ab6ddea5d28
diff --git a/mapmyfitness/__init__.py b/mapmyfitness/__init__.py index <HASH>..<HASH> 100644 --- a/mapmyfitness/__init__.py +++ b/mapmyfitness/__init__.py @@ -11,7 +11,7 @@ class MapMyFitness(object): def __new__(cls, *args, **kwargs): if not cls._instance: - cls._instance = super(MapMyFitness, cls).__new__(cls, *args, **kwargs) + cls._instance = super(MapMyFitness, cls).__new__(cls) return cls._instance
Trying to make python3 happy with the singleton's use of super.
JasonSanford_mapmyfitness-python
train
py
190b20ebce90dab848bbdbeee3600b4e62050c13
diff --git a/test/spec/ol/interaction/modify.test.js b/test/spec/ol/interaction/modify.test.js index <HASH>..<HASH> 100644 --- a/test/spec/ol/interaction/modify.test.js +++ b/test/spec/ol/interaction/modify.test.js @@ -423,6 +423,37 @@ describe('ol.interaction.Modify', function () { expect(lineFeature.getGeometry().getCoordinates().length).to.equal(5); }); + it('inserts one vertex into both linestrings with duplicate segments each', function () { + const lineFeature1 = new Feature( + new LineString([ + [-10, -10], + [10, 10], + [-10, -10], + ]) + ); + const lineFeature2 = new Feature( + new LineString([ + [10, 10], + [-10, -10], + [10, 10], + ]) + ); + features.length = 0; + features.push(lineFeature1, lineFeature2); + + const modify = new Modify({ + features: new Collection(features), + }); + map.addInteraction(modify); + + // Click on line + simulateEvent('pointermove', 0, 0, null, 0); + simulateEvent('pointerdown', 0, 0, null, 0); + simulateEvent('pointerup', 0, 0, null, 0); + + expect(lineFeature1.getGeometry().getCoordinates().length).to.be(4); + expect(lineFeature2.getGeometry().getCoordinates().length).to.be(4); + }); }); describe('circle modification', function () {
Add vertex insertion test for modify interaction
openlayers_openlayers
train
js
6e2864680510124e57d10ff6ccda465ac161c2a8
diff --git a/src/org/parosproxy/paros/network/HttpSender.java b/src/org/parosproxy/paros/network/HttpSender.java index <HASH>..<HASH> 100644 --- a/src/org/parosproxy/paros/network/HttpSender.java +++ b/src/org/parosproxy/paros/network/HttpSender.java @@ -31,6 +31,7 @@ // ZAP: 2013/01/23 Clean up of exception handling/logging. // ZAP: 2013/01/30 Issue 478: Allow to choose to send ZAP's managed cookies on // a single Cookie request header and set it as the default +// ZAP: 2013/07/10 Issue 720: Cannot send non standard http methods package org.parosproxy.paros.network; @@ -373,7 +374,10 @@ public class HttpSender { // no more retry modifyUserAgent(msg); method = helper.createRequestMethod(msg.getRequestHeader(), msg.getRequestBody()); - method.setFollowRedirects(isFollowRedirect); + if (! (method instanceof GenericMethod)) { + // cant do this for Generic methods - it will fail + method.setFollowRedirects(isFollowRedirect); + } this.executeMethod(method); if (allowState) { if (param.isHttpStateEnabled()) {
Issue <I>: Cannot send non standard http methods
zaproxy_zaproxy
train
java
02695300d8732055bc3fda37411a3cbd821f50ab
diff --git a/src/Canonical.php b/src/Canonical.php index <HASH>..<HASH> 100644 --- a/src/Canonical.php +++ b/src/Canonical.php @@ -84,14 +84,15 @@ class Canonical implements EventSubscriberInterface $override = $this->override; - $schemeStubbed = false; + // Prepend scheme if not included so parse_url doesn't choke. if (strpos($override, 'http') !== 0) { - $schemeStubbed = true; $override = 'http://' . $override; } $parts = parse_url($override); - if (!$schemeStubbed && isset($parts['scheme'])) { + // Only override scheme if it's an upgrade to https. + // i.e Don't do: https -> http + if (isset($parts['scheme']) && $parts['scheme'] === 'https') { $this->requestContext->setScheme($parts['scheme']); } if (isset($parts['host'])) {
Change canonical to only override scheme if it is an upgrade. i.e. don't https -> http.
bolt_bolt
train
php
b14ea46391ab00119f999bb57b42481d52729ec4
diff --git a/src/editor/EditorManager.js b/src/editor/EditorManager.js index <HASH>..<HASH> 100644 --- a/src/editor/EditorManager.js +++ b/src/editor/EditorManager.js @@ -407,6 +407,7 @@ define(function (require, exports, module) { _destroyEditorIfUnneeded(_currentEditorsDocument); _doFocusedEditorChanged(null, _currentEditor); _currentEditorsDocument = null; + StatusBar.hide(); $("#not-editor").css("display", ""); }
hide status bar when ther is no editor
adobe_brackets
train
js
ed2aa831feff89e5d5bce004c91f5551990d423f
diff --git a/test/com/google/javascript/jscomp/fuzzing/ControlledRandom.java b/test/com/google/javascript/jscomp/fuzzing/ControlledRandom.java index <HASH>..<HASH> 100644 --- a/test/com/google/javascript/jscomp/fuzzing/ControlledRandom.java +++ b/test/com/google/javascript/jscomp/fuzzing/ControlledRandom.java @@ -26,7 +26,7 @@ import java.util.Random; */ public class ControlledRandom extends Random { public ControlledRandom() { - super(); + super(123); } /** * @param seed
Fixing failed tests ------------- Created by MOE: <URL>
google_closure-compiler
train
java
5b634473e393b996104dc112bcff2ce33cf99a76
diff --git a/napalm_junos/junos.py b/napalm_junos/junos.py index <HASH>..<HASH> 100644 --- a/napalm_junos/junos.py +++ b/napalm_junos/junos.py @@ -854,20 +854,22 @@ class JunOSDriver(NetworkDriver): def get_mac_address_table(self): - mac_address_table = list() + mac_address_table = [] mac_table = junos_views.junos_mac_address_table(self.device) + if self.device.facts.get('personality', '') in ['SWITCH']: # for EX, QFX devices + mac_table.GET_RPC = 'get-ethernet-switching-table-information' mac_table.get() mac_table_items = mac_table.items() default_values = { - 'mac' : u'', - 'interface' : u'', - 'vlan' : 0, - 'static' : False, - 'active' : True, - 'moves' : 0, - 'last_move' : 0.0 + 'mac': u'', + 'interface': u'', + 'vlan': 0, + 'static': False, + 'active': True, + 'moves': 0, + 'last_move': 0.0 } for mac_table_entry in mac_table_items:
Diffrent RPC for EX & QFX series
napalm-automation_napalm
train
py
ef767afb2f131e0771a08254f23b13cc3dabfd61
diff --git a/executor/opensubmit/executor/__init__.py b/executor/opensubmit/executor/__init__.py index <HASH>..<HASH> 100755 --- a/executor/opensubmit/executor/__init__.py +++ b/executor/opensubmit/executor/__init__.py @@ -147,7 +147,7 @@ def _infos_cmd(cmd, stdhndl=" 2>&1", e_shell=True): except Exception as e: return "" -def _fetch_validator(url, path): +def _fetch_validator(config, url, path): ''' Fetch validator script from the given URL and put it under the given target file. @@ -536,7 +536,7 @@ def run(config_file): lock.release() return False # fetch validator into target directory - _fetch_validator(validator_url, finalpath) + _fetch_validator(config, validator_url, finalpath) # Allow submission to load their own libraries logger.debug("Setting LD_LIBRARY_PATH to "+finalpath) os.environ["LD_LIBRARY_PATH"]=finalpath
fixing issues #<I>. NameError: global name 'config' is not defined IF Validator ZIP package does not contain validator.py
troeger_opensubmit
train
py
12dfe14ddf98d5ed4507980f3352c930bfce985f
diff --git a/internal/frame/frame.go b/internal/frame/frame.go index <HASH>..<HASH> 100644 --- a/internal/frame/frame.go +++ b/internal/frame/frame.go @@ -139,7 +139,7 @@ func (f *Frame) requantizeProcessLong(gr, ch, is_pos, sfb int) { if f.sideInfo.ScalefacScale[gr][ch] != 0 { sf_mult = 1.0 } - tmp1 := 1.0 + tmp1 := 0.0 // https://github.com/technosaurus/PDMP3/issues/4 if sfb < 21 { pf_x_pt := float64(f.sideInfo.Preflag[gr][ch]) * pretab[sfb] @@ -160,7 +160,7 @@ func (f *Frame) requantizeProcessShort(gr, ch, is_pos, sfb, win int) { if f.sideInfo.ScalefacScale[gr][ch] != 0 { sf_mult = 1.0 } - tmp1 := 1.0 + tmp1 := 0.0 // https://github.com/technosaurus/PDMP3/issues/4 if sfb < 12 { tmp1 = math.Pow(2.0, -(sf_mult * float64(f.mainData.ScalefacS[gr][ch][sfb][win])))
Reduce noises (but not all the problems are solved) (#<I>)
hajimehoshi_go-mp3
train
go
fb6c9e51889b9c357463295395320bcefa15d05b
diff --git a/lib/taskrabbit/task.rb b/lib/taskrabbit/task.rb index <HASH>..<HASH> 100644 --- a/lib/taskrabbit/task.rb +++ b/lib/taskrabbit/task.rb @@ -50,6 +50,10 @@ module Taskrabbit end end + def new_record? + !id + end + def delete! reload('delete', "tasks/#{id.to_s}") end diff --git a/spec/taskrabbit/task_spec.rb b/spec/taskrabbit/task_spec.rb index <HASH>..<HASH> 100644 --- a/spec/taskrabbit/task_spec.rb +++ b/spec/taskrabbit/task_spec.rb @@ -78,6 +78,20 @@ describe Taskrabbit::Task do end end + describe "#new_record?" do + subject { Taskrabbit::Task.new } + + it "returns true if the task has no id" do + subject.stub(:id => nil) + subject.should be_new_record + end + + it "returns false if the task has an id" do + subject.stub(:id => 123) + subject.should_not be_new_record + end + end + describe "#find" do it "should fetch tasks" do
Add new_record? to Taskrabbit::Task
jrichardlai_taskrabbit
train
rb,rb
51ea1f03f9088095fd1192278fd67a5fdf8eb5ab
diff --git a/src/Composer/Command/RequireCommand.php b/src/Composer/Command/RequireCommand.php index <HASH>..<HASH> 100644 --- a/src/Composer/Command/RequireCommand.php +++ b/src/Composer/Command/RequireCommand.php @@ -20,6 +20,7 @@ use Composer\Factory; use Composer\Installer; use Composer\Json\JsonFile; use Composer\Json\JsonManipulator; +use Composer\Package\Version\VersionParser; /** * @author Jérémy Romey <jeremy@free-agent.fr> @@ -80,6 +81,12 @@ EOT $baseRequirements = array_key_exists($requireKey, $composer) ? $composer[$requireKey] : array(); $requirements = $this->formatRequirements($requirements); + // validate requirements format + $versionParser = new VersionParser(); + foreach ($requirements as $constraint) { + $versionParser->parseConstraints($constraint); + } + if (!$this->updateFileCleanly($json, $baseRequirements, $requirements, $requireKey)) { foreach ($requirements as $package => $version) { $baseRequirements[$package] = $version;
Validate constraints in require command, fixes #<I>
mothership-ec_composer
train
php
db1d66c2d2aae8f7c43935a34fe950c9b3e54abd
diff --git a/addon/merge/merge.js b/addon/merge/merge.js index <HASH>..<HASH> 100644 --- a/addon/merge/merge.js +++ b/addon/merge/merge.js @@ -918,7 +918,7 @@ hasMarker: function(n) { var handle = this.cm.getLineHandle(n) if (handle.markedSpans) for (var i = 0; i < handle.markedSpans.length; i++) - if (handle.markedSpans[i].mark.collapsed && handle.markedSpans[i].to != null) + if (handle.markedSpans[i].marker.collapsed && handle.markedSpans[i].to != null) return true return false },
[merge addon] Fix typo in hasMarker() This was causing exceptions to be thrown when using custom markers.
codemirror_CodeMirror
train
js
894cdfdf5d37fe444d473b79beda6109c73ec08f
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -115,6 +115,7 @@ setup( 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', ], # trinity entry_points={
misc: list Python <I> (sic!) in setup.py. This is a "bump" commit to force CircleCI picking up the new branch. Python <I> is known-to-work and regularly tested; it missing in setup.py is an oversight. Python <I> is not yet known to work, is just starting to get one module tested, - therefore not adding it here (yet).
ethereum_py-evm
train
py
c0528d0fd4ab3d350ff3c85731255423c32256ff
diff --git a/src/main/java/org/fluentd/logger/Sender.java b/src/main/java/org/fluentd/logger/Sender.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/fluentd/logger/Sender.java +++ b/src/main/java/org/fluentd/logger/Sender.java @@ -1,3 +1,20 @@ +// +// A Structured Logger for Fluent +// +// Copyright (C) 2011 Muga Nishizawa +// +// 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 org.fluentd.logger; import java.io.BufferedOutputStream;
added copyright notation in Sender.java
fluent_fluent-logger-java
train
java
0d66ea910ddc68890f10d7f5d489afd0d6bc96af
diff --git a/phpsec/phpsec.rand.php b/phpsec/phpsec.rand.php index <HASH>..<HASH> 100644 --- a/phpsec/phpsec.rand.php +++ b/phpsec/phpsec.rand.php @@ -3,7 +3,7 @@ phpSec - A PHP security library @author Audun Larsen <larsen@xqus.com> - @copyright Copyright (c) Audun Larsen, 2011 + @copyright Copyright (c) Audun Larsen, 2011, 2012 @link https://github.com/phpsec/phpSec @license http://opensource.org/licenses/mit-license.php The MIT License @package phpSec @@ -23,7 +23,7 @@ class phpsecRand { */ public static function bytes($len) { /* Code inspired by this blogpost by Enrico Zimuel - * http://www.zimuel.it/blog/2011/01/strong-cryptography-in-php/ */ + * http://www.zimuel.it/en/strong-cryptography-in-php/ */ $strong = false; if(function_exists('openssl_random_pseudo_bytes')) { $rnd = openssl_random_pseudo_bytes($len, $strong);
Updates URL to the blogpost by Enrico Zimuel.
phpsec_phpSec
train
php
3dafed4c908ec62c4e8036c097802612c3749cbf
diff --git a/spec/support/star_wars/schema.rb b/spec/support/star_wars/schema.rb index <HASH>..<HASH> 100644 --- a/spec/support/star_wars/schema.rb +++ b/spec/support/star_wars/schema.rb @@ -17,7 +17,6 @@ module StarWars global_id_field :id field :name, types.String field :planet, types.String - connection :ships, Ship.connection_type end # Use an optional block to add fields to the connection type:
test(BaseType) show bug on self-referenctial connections
rmosolgo_graphql-ruby
train
rb
eb2aedb5a47ee6da709e58c3a6fbd4d84435b265
diff --git a/activerecord/lib/active_record/railties/collection_cache_association_loading.rb b/activerecord/lib/active_record/railties/collection_cache_association_loading.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/railties/collection_cache_association_loading.rb +++ b/activerecord/lib/active_record/railties/collection_cache_association_loading.rb @@ -8,12 +8,12 @@ module ActiveRecord return super unless options[:cached] - @relation = relation_from_options(**options) + @relation = relation_from_options(options[:partial], options[:collection]) super end - def relation_from_options(cached: nil, partial: nil, collection: nil, **_) + def relation_from_options(partial, collection) relation = partial if partial.is_a?(ActiveRecord::Relation) relation ||= collection if collection.is_a?(ActiveRecord::Relation)
Remove hash deconstruction I don't think this hash deconstruction buys us much in terms of readability. We only need two parameters, the rest are ignored, and on top of that we have to allocate a hash. Convert to positional parameters instead.
rails_rails
train
rb
98489440dfec641d2d77274fd9a4c420a33f0dd7
diff --git a/kontrol/storage.go b/kontrol/storage.go index <HASH>..<HASH> 100644 --- a/kontrol/storage.go +++ b/kontrol/storage.go @@ -2,6 +2,7 @@ package kontrol import ( "errors" + "net/http" "strings" "time" @@ -44,6 +45,10 @@ func NewEtcd(machines []string) (*Etcd, error) { return nil, errors.New("cannot connect to etcd cluster: " + strings.Join(machines, ",")) } + client.CheckRetry = func(c *etcd.Cluster, n int, resp http.Response, err error) error { + return err + } + return &Etcd{ client: client, }, nil
kontrol: checkRetry is spamming etcd Disable it by returning simply an error. Otherwise subsequent calls are made which are ddosing the server. go-etcd should be smart, but is not.
koding_kite
train
go
011084425a9c3a07923e9bd1ef5f2940d8e6d1fd
diff --git a/tests/test_alignmentSimulationRandomSeed.py b/tests/test_alignmentSimulationRandomSeed.py index <HASH>..<HASH> 100644 --- a/tests/test_alignmentSimulationRandomSeed.py +++ b/tests/test_alignmentSimulationRandomSeed.py @@ -86,8 +86,8 @@ class test_simulateAlignmentRandomSeed_ExpCM(unittest.TestCase): alignments[counter][s.id] = str(s.seq) # check they are the same for key in alignments[counter].keys(): - assert alignments[counter][key] == alignments[counter - 1][key] - # + self.assertTrue(alignments[counter][key] == alignments[counter - 1][key]) + # alignments with different seed numbers should be different # make an alignment with a different seed number seed += 1 @@ -98,7 +98,7 @@ class test_simulateAlignmentRandomSeed_ExpCM(unittest.TestCase): alignments[counter][s.id] = str(s.seq) # check they are different for key in alignments[counter].keys(): - assert alignments[counter][key] != alignments[counter - 1][key] + self.assertFalse(alignments[counter][key] == alignments[counter - 1][key]) # general clean-up
changed assert to self.assertTrue/self.assertFalse in random seed test
jbloomlab_phydms
train
py
ba504c99928290d6cb8e8a41633e12e9b1cd7afe
diff --git a/lib/backburner.js b/lib/backburner.js index <HASH>..<HASH> 100644 --- a/lib/backburner.js +++ b/lib/backburner.js @@ -39,9 +39,6 @@ export default function Backburner(queueNames, options) { }; } -// ms of delay before we conclude a timeout was lost -var TIMEOUT_STALLED_THRESHOLD = 1000; - Backburner.prototype = { begin: function() { var options = this.options; @@ -404,8 +401,6 @@ Backburner.prototype = { return fn; } - this._reinstallStalledTimerTimeout(); - // find position to insert var i = searchTimer(executeAt, this._timers); @@ -600,21 +595,6 @@ Backburner.prototype = { this._installTimerTimeout(); }, - _reinstallStalledTimerTimeout: function () { - if (!this._timerTimeoutId) { - return; - } - // if we have a timer we should always have a this._timerTimeoutId - var minExpiresAt = this._timers[0]; - var delay = now() - minExpiresAt; - // threshold of a second before we assume that the currently - // installed timeout will not run, so we don't constantly reinstall - // timeouts that are delayed but good still - if (delay < TIMEOUT_STALLED_THRESHOLD) { - return; - } - }, - _reinstallTimerTimeout: function () { this._clearTimerTimeout(); this._installTimerTimeout();
Remove dead code used for dropping stalled timeouts
BackburnerJS_backburner.js
train
js
34a24cdb0273e9e94a8b5abd75e085554fc930ae
diff --git a/pymatgen/analysis/chemenv/connectivity/connected_components.py b/pymatgen/analysis/chemenv/connectivity/connected_components.py index <HASH>..<HASH> 100644 --- a/pymatgen/analysis/chemenv/connectivity/connected_components.py +++ b/pymatgen/analysis/chemenv/connectivity/connected_components.py @@ -285,10 +285,7 @@ class ConnectedComponent(MSONable): if edge_data['delta'] == (0, 0, 0): raise ValueError('There should not be self loops with delta image = (0, 0, 0).') this_node_cell_img_vectors.append(edge_data['delta']) - ndeltas = len(this_node_cell_img_vectors) this_node_cell_img_vectors = get_linearly_independent_vectors(this_node_cell_img_vectors) - if len(this_node_cell_img_vectors) != ndeltas: - raise ValueError('There should not be self loops with the same (or opposite) delta image.') # Here, we adopt a cutoff equal to the size of the graph, contrary to the default of networkX (size - 1), # because otherwise, the all_simple_paths algorithm fail when the source node is equal to the target node. paths = []
Fixed minor issue in connected_components.
materialsproject_pymatgen
train
py
1f5069df039d2526453212ffce0b1892f39481ce
diff --git a/lib/mongoid/slug/criterion.rb b/lib/mongoid/slug/criterion.rb index <HASH>..<HASH> 100644 --- a/lib/mongoid/slug/criterion.rb +++ b/lib/mongoid/slug/criterion.rb @@ -83,7 +83,7 @@ module Mongoid end def for_slugs(slugs) - where({ _slugs: { '$in' => slugs } }) + where({ _slugs: { '$in' => slugs } }).limit(slugs.length) end def execute_or_raise_for_slugs(slugs, multi)
Limit the query in #find to at most the number of suppled params/slugs.
mongoid_mongoid-slug
train
rb
68fb38c6818d88462555ed191b918919e4f2ef00
diff --git a/examples/v3arch/asyncore/agent/cmdrsp/multiple-usm-users.py b/examples/v3arch/asyncore/agent/cmdrsp/multiple-usm-users.py index <HASH>..<HASH> 100644 --- a/examples/v3arch/asyncore/agent/cmdrsp/multiple-usm-users.py +++ b/examples/v3arch/asyncore/agent/cmdrsp/multiple-usm-users.py @@ -15,6 +15,7 @@ # # $ snmpwalk -v3 -u usr-md5-des -l authPriv -A authkey1 -X privkey1 localhost .1.3.6 # $ snmpwalk -v3 -u usr-sha-none -l authNoPriv -a SHA -A authkey1 localhost .1.3.6 +# $ snmpwalk -v3 -u usr-sha-aes128 -l authPriv -a SHA -A authkey1 -x AES -X privkey1 localhost .1.3.6 # from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, context
missing snmpwalk command added
etingof_pysnmp
train
py
1b90f872697c272511e95818bb986c79796fd367
diff --git a/app/services/foreman_ansible/ansible_report_importer.rb b/app/services/foreman_ansible/ansible_report_importer.rb index <HASH>..<HASH> 100644 --- a/app/services/foreman_ansible/ansible_report_importer.rb +++ b/app/services/foreman_ansible/ansible_report_importer.rb @@ -18,6 +18,10 @@ module ForemanAnsible partial_hostname_match(hostname) end + def self.authorized_smart_proxy_features + super + ['Ansible'] + end + def partial_hostname_match(hostname) return @host unless @host.new_record? hosts = Host.where(Host.arel_table[:name].matches("#{hostname}.%"))
Fixes #<I> - Ansible can submit ConfigReport's too
theforeman_foreman_ansible
train
rb
f9aaa678fdfe85e58968719570a888f4531509c4
diff --git a/lib/tilelive/tile.js b/lib/tilelive/tile.js index <HASH>..<HASH> 100644 --- a/lib/tilelive/tile.js +++ b/lib/tilelive/tile.js @@ -71,4 +71,12 @@ Tile.prototype.render = function(callback) { ); }; +Tile.prototype.getMap = function(callback) { + Pool.acquire(this.type, this.datasource, this.options, function (err,map) { + if (err) throw err; + callback(null,map); + }); +}; + + module.exports = Tile;
expose a function to get the map for a given tile
mapbox_tilelive
train
js
b03a1a05b68a57984fe059701b706a22ad734dfe
diff --git a/acos_client/errors.py b/acos_client/errors.py index <HASH>..<HASH> 100644 --- a/acos_client/errors.py +++ b/acos_client/errors.py @@ -131,3 +131,7 @@ class ACOSSystemNotReady(ACOSException): class ACOSSystemIsBusy(ACOSException): pass + + +class LicenseOptionNotAllowed(ACOSException): + pass diff --git a/acos_client/v30/responses.py b/acos_client/v30/responses.py index <HASH>..<HASH> 100644 --- a/acos_client/v30/responses.py +++ b/acos_client/v30/responses.py @@ -223,6 +223,7 @@ RESPONSE_CODES = { }, 4294967295: { '*': { + '/axapi/v3/glm': ae.LicenseOptionNotAllowed, '*': ae.ConfigManagerNotReady } }, @@ -243,6 +244,7 @@ def raise_axapi_auth_error(response, method, api_url, headers): def raise_axapi_ex(response, method, api_url): + if 'response' in response and 'err' in response['response']: code = response['response']['err']['code']
Added error for scenario where a glm license option has been set but is not allowed by the license type
a10networks_acos-client
train
py,py
bda5e69184de7f4d3a87d3d4c4c78359803d7570
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -24,7 +24,7 @@ module.exports = { const app = express(); const HOTE = 'localhost'; - const PORT = 10500; + const PORT = 9220; /** * Sur appel de l'URL /abc
[fix] duniter-ui should listen on port <I>
duniter_duniter-ui
train
js
e32330ad95132c50f9c93efb1f3a68ffd46b2129
diff --git a/openvidu-server/docker/openvidu-health-checker/openvidu_helth_check.py b/openvidu-server/docker/openvidu-health-checker/openvidu_helth_check.py index <HASH>..<HASH> 100644 --- a/openvidu-server/docker/openvidu-health-checker/openvidu_helth_check.py +++ b/openvidu-server/docker/openvidu-health-checker/openvidu_helth_check.py @@ -59,7 +59,7 @@ class InfraSmokeTests(unittest.TestCase): video_error = False try: - self.driver.find_elements(By.XPATH, "//*[contains(text(), 'Stream playing')]") + self.driver.find_element(By.XPATH, "//*[contains(text(), 'Stream playing')]") except: video_error = True finally:
deployment: find_element instead of find_elements in openvidu_health_check
OpenVidu_openvidu
train
py
6b52cf5c67802add22aa784343d960cf64fe6345
diff --git a/lib/ronin/installation.rb b/lib/ronin/installation.rb index <HASH>..<HASH> 100644 --- a/lib/ronin/installation.rb +++ b/lib/ronin/installation.rb @@ -96,8 +96,9 @@ module Ronin if Installation.gems.empty? # if there are no gems installed, do a raw Dir.glob root_dir = File.expand_path(File.join(File.dirname(__FILE__),'..','..')) + directory = File.join(root_dir,directory) - Dir.glob(File.join(root_dir,directory,'**/*.*'),&pass_path) + Dir.glob(File.join(directory,'**/*.*'),&pass_path) else # query the installed gems Installation.gems.each do |name,gem|
Only pass back the found sub-paths from Installation.each_file.
ronin-ruby_ronin
train
rb
24899b7a6a5ceb567b260a330cb27df67ee5e3bb
diff --git a/app/models/fluentd/agent/td_agent.rb b/app/models/fluentd/agent/td_agent.rb index <HASH>..<HASH> 100644 --- a/app/models/fluentd/agent/td_agent.rb +++ b/app/models/fluentd/agent/td_agent.rb @@ -36,6 +36,7 @@ class Fluentd Bundler.with_clean_env do spawn(cmd) end + sleep 1 # NOTE/FIXME: too early return will be caused incorrect status report, "sleep 1" is a adhoc hack end end end
Don't too quickly response of td-agent start/stop/restart
fluent_fluentd-ui
train
rb
405fffccea8983ce21a87e7c5f192cf7e7e41f3e
diff --git a/Classes/ViewHelpers/HtmlViewHelper.php b/Classes/ViewHelpers/HtmlViewHelper.php index <HASH>..<HASH> 100644 --- a/Classes/ViewHelpers/HtmlViewHelper.php +++ b/Classes/ViewHelpers/HtmlViewHelper.php @@ -38,7 +38,8 @@ class Tx_HappyFeet_ViewHelpers_HtmlViewHelper extends \TYPO3\CMS\Fluid\ViewHelpe * @param boolean $simulateTSFEinBackend * @return string the parsed string. */ - public function render($parseFuncTSPath = 'lib.parseFunc_RTE', $simulateTSFEinBackend = false) { + public function render($parseFuncTSPath = 'lib.parseFunc_RTE', $simulateTSFEinBackend = false) + { if (TYPO3_MODE === 'BE' && $simulateTSFEinBackend === true) { $this->simulateFrontendEnvironment(); }
fix checkstyle warning "Opening brace should be on a new line"
AOEpeople_happy_feet
train
php
f5c3712f9064d4a0db7e6e8de11aaf7a062a00a8
diff --git a/data/handleDB.php b/data/handleDB.php index <HASH>..<HASH> 100644 --- a/data/handleDB.php +++ b/data/handleDB.php @@ -1984,5 +1984,5 @@ class DbHandleApplication extends Application } } -$application = new DbHandleApplication('Database handler for CompatInfo', '1.28.0'); +$application = new DbHandleApplication('Database handler for CompatInfo', '1.29.0'); $application->run();
Bump new version <I>
llaville_php-compatinfo-db
train
php
9aecf903f4a05393acff73cb410c178ea209f0bd
diff --git a/examples/benchmarks/json/cpu.py b/examples/benchmarks/json/cpu.py index <HASH>..<HASH> 100755 --- a/examples/benchmarks/json/cpu.py +++ b/examples/benchmarks/json/cpu.py @@ -44,6 +44,10 @@ except: def parse_time(_json_string, _iterations): return float('inf') + @staticmethod + def version(): + return 'unknown' + try: from parsers import parsy_json except: @@ -53,6 +57,10 @@ except: def parse_time(_json_string, _iterations): return float('inf') + @staticmethod + def version(): + return 'unknown' + try: from parsers import pyleri_json except: @@ -62,6 +70,10 @@ except: def parse_time(_json_string, _iterations): return float('inf') + @staticmethod + def version(): + return 'unknown' + SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) DATA_JSON = os.path.relpath(os.path.join(SCRIPT_DIR, 'data.json'))
Added version to CPU benchmark stubs.
eerimoq_textparser
train
py
2664356b7f306b6efe2add089a86c88f0e85b1b1
diff --git a/skyfield/timelib.py b/skyfield/timelib.py index <HASH>..<HASH> 100644 --- a/skyfield/timelib.py +++ b/skyfield/timelib.py @@ -3,7 +3,7 @@ import datetime as dt_module import re from collections import namedtuple from datetime import date, datetime -from numpy import (array, concatenate, cos, float_, interp, isnan, nan, +from numpy import (array, concatenate, cos, float_, int64, interp, isnan, nan, ndarray, pi, rollaxis, searchsorted, sin, where, zeros_like) from time import strftime, struct_time from .constants import ASEC2RAD, B1950, DAY_S, T0, tau @@ -559,7 +559,7 @@ class Time(object): """ second, sfr, is_leap_second = self._utc_seconds(offset) - second = second.astype(int) + second = second.astype(int64) second -= is_leap_second jd, second = divmod(second + 12*60*60, 86400) cutoff = self.ts.julian_calendar_cutoff
Fix new internal "UTC seconds" on <I> bit platforms
skyfielders_python-skyfield
train
py
329083400930ede6ddd3a1b037bafa8dfc4c0f36
diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py index <HASH>..<HASH> 100644 --- a/spyder/app/mainwindow.py +++ b/spyder/app/mainwindow.py @@ -1235,9 +1235,6 @@ class MainWindow(QMainWindow): logger.info("Setting up window...") self.setup_layout(default=False) - if self.splash is not None: - self.splash.hide() - # Enabling tear off for all menus except help menu if CONF.get('main', 'tear_off_menus'): for child in self.menuBar().children(): @@ -1354,6 +1351,12 @@ class MainWindow(QMainWindow): if not self.ipyconsole._isvisible: self.historylog.add_history(get_conf_path('history.py')) + # Process pending events and hide splash before loading the + # previous session. + QApplication.processEvents() + if self.splash is not None: + self.splash.hide() + if self.open_project: self.projects.open_project(self.open_project) else:
Main Window: Hide splash screen in post_visible_setup This maintains the splash visible until the very last second before loading the previous session.
spyder-ide_spyder
train
py
bacac38842e822485f4d78e068436f8c13fd6ac2
diff --git a/internetarchive/item.py b/internetarchive/item.py index <HASH>..<HASH> 100644 --- a/internetarchive/item.py +++ b/internetarchive/item.py @@ -337,6 +337,8 @@ class Item(object): ignore_bucket=ignore_bucket) request = Request('PUT', endpoint, headers=headers) # TODO: Add support for multipart. + # `contextlib.closing()` is used to make StringIO work with + # `with` statement. with closing(local_file) as data: request.data = data.read() prepped_request = request.prepare()
Added comment about why we are using `contextlib.closing()` in the `upload_file()` method (StringIO).
jjjake_internetarchive
train
py
84bd1731c43a941758e486e68b890d5b6dbde73c
diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Database/Eloquent/Model.php +++ b/src/Illuminate/Database/Eloquent/Model.php @@ -332,6 +332,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab public static function clearBootedModels() { static::$booted = []; + static::$globalScopes = []; } /**
reset global scopes when booted models get cleared
laravel_framework
train
php
ed17875c40bf4504a612780838fff0fd1e64ad93
diff --git a/hadoop/src/main/java/water/hadoop/h2odriver.java b/hadoop/src/main/java/water/hadoop/h2odriver.java index <HASH>..<HASH> 100644 --- a/hadoop/src/main/java/water/hadoop/h2odriver.java +++ b/hadoop/src/main/java/water/hadoop/h2odriver.java @@ -138,7 +138,7 @@ public class h2odriver extends Configured implements Tool { Thread.sleep(1000); } } - catch (Exception _) { + catch (Exception e) { } finally { if (! killed) { diff --git a/hadoop/src/main/java/water/hadoop/h2omapper.java b/hadoop/src/main/java/water/hadoop/h2omapper.java index <HASH>..<HASH> 100644 --- a/hadoop/src/main/java/water/hadoop/h2omapper.java +++ b/hadoop/src/main/java/water/hadoop/h2omapper.java @@ -78,9 +78,9 @@ public class h2omapper extends Mapper<Text, Text, Text, Text> { try { e.printStackTrace(); } - catch (Exception _) { + catch (Exception e2) { System.err.println("_context.write excepted in UserMain"); - _.printStackTrace(); + e2.printStackTrace(); } } finally {
Rename swallowed exceptions to not be named _. Java 8 change. No semantic change.
h2oai_h2o-2
train
java,java
776f24a90e2fa86a2bac01b0955a265812e1c2a8
diff --git a/menu/Container.php b/menu/Container.php index <HASH>..<HASH> 100644 --- a/menu/Container.php +++ b/menu/Container.php @@ -359,7 +359,7 @@ class Container extends \yii\base\Component implements ArrayAccess if (empty($requestPath)) { $home = $this->getHome(); if (!$home) { - throw new Exception('Home item could not be found, have you forget to set a default page?'); + throw new NotFoundHttpException('Home item could not be found, have you forget to set a default page?'); } $requestPath = $home->alias; } @@ -470,7 +470,7 @@ class Container extends \yii\base\Component implements ArrayAccess $lang = $this->getLanguage($langShortCode); if (!$lang) { - throw new Exception(sprintf("The requested language '%s' does not exist in language table", $langShortCode)); + throw new NotFoundHttpException(sprintf("The requested language '%s' does not exist in language table", $langShortCode)); } $data = $this->getNavData($lang['id']);
changed menu exception to NotFoundHttpException to hide informations from api as those exception are not system errors.
luyadev_luya-module-cms
train
php
cd80c2ef822ad362ba92b9bc9555c6e3c157078c
diff --git a/bench.py b/bench.py index <HASH>..<HASH> 100644 --- a/bench.py +++ b/bench.py @@ -29,7 +29,7 @@ def timed(fn): start = time.time() fn(*args, **kwargs) times.append(time.time() - start) - print fn.__name__, round(sum(times) / N, 3) + print(fn.__name__, round(sum(times) / N, 3)) return inner def populate_register(n):
python 3 fix for bench.py
coleifer_peewee
train
py
8ea3037fa4515b0cb825e423a622bb5e78de1b7b
diff --git a/src/RouteConditionApplier.php b/src/RouteConditionApplier.php index <HASH>..<HASH> 100644 --- a/src/RouteConditionApplier.php +++ b/src/RouteConditionApplier.php @@ -63,7 +63,18 @@ class RouteConditionApplier public function getActions($action) { - return $this->actions[$action] ?? function(){}; + if (array_key_exists($action, $this->actions)) { + return $this->actions[$action]; + } + + foreach ($this->actions as $pattern => $callback) { + if (Str::is($pattern, $action)) { + return $callback; + }; + } + + return function () { + }; } /**
make controller actions be matched with patterns
imanghafoori1_laravel-heyman
train
php
07ede3afa60b9aeeb4cc1c5223fef61e5a80991a
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,6 @@ tests_require = [ 'isort>=4.2.2', 'jsonresolver[jsonschema]>=0.2.1', 'pydocstyle>=2.0.0', - 'pytest-cache>=1.0', 'pytest-cov>=1.8.0', 'pytest-pep8>=1.0.6', 'pytest>=2.8.0',
installation: removed pytest-cache dependency
inveniosoftware_invenio-jsonschemas
train
py
05d652d02473276f6c2292c3aa80b24141f97037
diff --git a/tests/VatCalculatorTest.php b/tests/VatCalculatorTest.php index <HASH>..<HASH> 100644 --- a/tests/VatCalculatorTest.php +++ b/tests/VatCalculatorTest.php @@ -921,6 +921,6 @@ class VatCalculatorTest extends PHPUnit $vatCalculator = new VatCalculator(); $result = $vatCalculator->calculate($gross, $countryCode, $postalCode, $company, $type); - $this->assertEquals(25.44, $result); + $this->assertEquals(26.16, $result); } }
Update VatCalculatorTest.php
mpociot_vat-calculator
train
php